diff --git a/StockManMVC/Controllers/ItemsController.cs b/StockManMVC/Controllers/ItemsController.cs index 2b5fd1a..b32931e 100644 --- a/StockManMVC/Controllers/ItemsController.cs +++ b/StockManMVC/Controllers/ItemsController.cs @@ -239,7 +239,7 @@ namespace StockManMVC.Controllers } // GET: Items/Details/5 - public ActionResult Details(int? id, int? page, int? pageSize) + public ActionResult Details(int? id, int? page, int? pageSize, string enabFR) { if (page == null) page = 1; if (pageSize == null) pageSize = 10; @@ -254,6 +254,14 @@ namespace StockManMVC.Controllers { return HttpNotFound(); } + // 2017.01.03 aggiunto controllo x permesso a resettare INTERA catena flussi + stock... SE in URL si trova comando enabFR=enabFR_key (da webconfig)... + ViewBag.DisplFR = "disabled invisible zeroWidth"; + if (enabFR != null) + { + string enabFR_key = System.Web.Configuration.WebConfigurationManager.AppSettings["enabFR_key"]; + if (enabFR == enabFR_key) ViewBag.DisplFR = ""; + } + // restituisco vista parziale return View(item); } @@ -273,6 +281,31 @@ namespace StockManMVC.Controllers return PartialView("_ItemDetail", item); } + // GET: Items/ResetAll/5 + public ActionResult ResetAll(int? id) + { + if (id == null) + { + return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + } + Item item = db.Item.Find(id); + if (item == null) + { + return HttpNotFound(); + } + // se ha trovato l'item ORA RESETTA TUTTO sia in stock che in flussi (toglie registrazione di tutti i movimenti) + // chiamo stored x consolidamento flussi (da movimenti a giacenza confermata) + using (var ctx = new StockManEntities()) + { + // esegue stored procedure come function... + ctx.stp_ItemResetAll(id); + } + // restituisco view! + //return PartialView("_ItemDetail", item); + return RedirectToAction("Details", "Items", new { ID = id, StockItemID = id }); + } + + // GET: Items/Create (mode=std|full, opzionale) public ActionResult Create(string mode) @@ -362,7 +395,7 @@ namespace StockManMVC.Controllers return View("Edit", item); } } - + // POST: Items/Edit/5 // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see http://go.microsoft.com/fwlink/?LinkId=317598. diff --git a/StockManMVC/Models/SMModel.Context.cs b/StockManMVC/Models/SMModel.Context.cs index e0a129e..b923efe 100644 --- a/StockManMVC/Models/SMModel.Context.cs +++ b/StockManMVC/Models/SMModel.Context.cs @@ -156,5 +156,14 @@ namespace StockManMVC.Models return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_ItemFluxDuplicate", mergeOption, original_IDParameter); } + + public virtual int stp_ItemResetAll(Nullable itemID) + { + var itemIDParameter = itemID.HasValue ? + new ObjectParameter("ItemID", itemID) : + new ObjectParameter("ItemID", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("stp_ItemResetAll", itemIDParameter); + } } } diff --git a/StockManMVC/Models/SMModel.edmx b/StockManMVC/Models/SMModel.edmx index c55913d..e7baea9 100644 --- a/StockManMVC/Models/SMModel.edmx +++ b/StockManMVC/Models/SMModel.edmx @@ -259,6 +259,9 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary + + + @@ -557,6 +560,9 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary + + + @@ -911,6 +917,7 @@ warning 6002: The table/view 'StockMan.dbo.vLocationVal' does not have a primary + diff --git a/StockManMVC/Views/Items/Details.cshtml b/StockManMVC/Views/Items/Details.cshtml index 9b29ee1..3ef564b 100644 --- a/StockManMVC/Views/Items/Details.cshtml +++ b/StockManMVC/Views/Items/Details.cshtml @@ -80,7 +80,16 @@
- Movimenti (data indica movimenti confermati o da registrare) +
+
+ Movimenti (data indica movimenti confermati o da registrare) +
+
+ + + +
+
@Html.Action("ListByItem", "ItemFluxes", new { ItemID = @Model.ID, page = ViewBag.page, pageSize = ViewBag.pageSize }) @@ -93,7 +102,7 @@ function CreateNewMov(ItemID, MovTypeID) { $("#divCreateMov").load('@(Url.Action("CreatePrecompiled", "ItemFluxes", null, Request.Url.Scheme))?ItemID=' + ItemID + '&MovTypeID=' + MovTypeID); } - + function LoadItemDetail(ItemID) { $("#itemPartialView").load('@(Url.Action("CurrItemDetail", "Items", null, Request.Url.Scheme))?ID=' + ItemID); $("#divButtons").show(); diff --git a/StockManMVC/Web.config b/StockManMVC/Web.config index f5cfd0e..527c30c 100644 --- a/StockManMVC/Web.config +++ b/StockManMVC/Web.config @@ -15,6 +15,7 @@ + diff --git a/StockManMVC/bin/StockManMVC.dll b/StockManMVC/bin/StockManMVC.dll index 5b9c50f..c733117 100644 Binary files a/StockManMVC/bin/StockManMVC.dll and b/StockManMVC/bin/StockManMVC.dll differ diff --git a/StockManMVC/bin/StockManMVC.dll.config b/StockManMVC/bin/StockManMVC.dll.config index f5cfd0e..527c30c 100644 --- a/StockManMVC/bin/StockManMVC.dll.config +++ b/StockManMVC/bin/StockManMVC.dll.config @@ -15,6 +15,7 @@ +