fix controllo quantità pos/neg x casi carico/scarico
This commit is contained in:
@@ -216,9 +216,17 @@ namespace StockManMVC
|
||||
.WithVisibility(true, false)
|
||||
.WithHeaderText("")
|
||||
.WithHtmlEncoding(false)
|
||||
.WithCellCssClassExpression(i => i.dtExport.ToString() == "" ? "" : "deleted")
|
||||
.WithValueExpression((i, c) => i.dtExport.ToString()== "" ? c.UrlHelper.Action("Edit", "ItemFluxes", new { id = i.ID }) : c.UrlHelper.Action("Details", "Items", new { id = i.ItemID, StockItemID = i.ItemID, FluxItemID = i.ItemID }))
|
||||
.WithValueTemplate("<a href='{Value}'>Edit</a>");
|
||||
.WithCellCssClassExpression(i => i.dtExport.ToString() == "" ? "" : "hidden deleted")
|
||||
.WithValueExpression((i, c) => i.dtExport.ToString() == "" ? c.UrlHelper.Action("Edit", "ItemFluxes", new { id = i.ID }) : c.UrlHelper.Action("Details", "Items", new { id = i.ItemID, StockItemID = i.ItemID, FluxItemID = i.ItemID }))
|
||||
.WithValueTemplate("<a href='{Value}' data-toggle=\"tooltip\" title=\"Modifica\"><i class=\"glyphicon glyphicon-edit\"></i></a>");
|
||||
cols.Add("DeleteLink").WithColumnName("DeleteLink")
|
||||
.WithSorting(false)
|
||||
.WithVisibility(true, false)
|
||||
.WithHeaderText("")
|
||||
.WithHtmlEncoding(false)
|
||||
.WithCellCssClassExpression(i => i.dtExport.ToString() == "" ? "" : "hidden deleted")
|
||||
.WithValueExpression((i, c) => i.dtExport.ToString() == "" ? c.UrlHelper.Action("Delete", "ItemFluxes", new { id = i.ID }) : c.UrlHelper.Action("Details", "Items", new { id = i.ItemID, StockItemID = i.ItemID, FluxItemID = i.ItemID }))
|
||||
.WithValueTemplate("<a href='{Value}' data-toggle=\"tooltip\" title=\"Elimina\"><i class=\"glyphicon glyphicon-trash\"></i></a>");
|
||||
})
|
||||
.WithRetrieveDataMethod((context) =>
|
||||
{
|
||||
|
||||
@@ -301,12 +301,21 @@ namespace StockManMVC.Controllers
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit([Bind(Include = "ID,ItemID,LocationID,MovTypeID,ExtLocationID,dtMov,Qta,TotValue,UnitVal,CodDoc,Note,dtExport,OperatorID")] ItemFlux itemFlux)
|
||||
{
|
||||
//// recupero dati originali x operatore e dtExport e reimposto...
|
||||
//ItemFlux oldData = db.ItemFlux.Find(itemFlux.ID);
|
||||
//itemFlux.OperatorID = oldData.OperatorID;
|
||||
//itemFlux.dtExport = oldData.dtExport;
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// verifico: se è un carico --> positivo, scarico --> negativo!
|
||||
switch (itemFlux.MovTypeID)
|
||||
{
|
||||
case "CAR":
|
||||
itemFlux.Qta = Math.Abs(itemFlux.Qta);
|
||||
break;
|
||||
case "SCAR":
|
||||
itemFlux.Qta = -Math.Abs(itemFlux.Qta);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// indico che devo salvare!
|
||||
db.Entry(itemFlux).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
|
||||
@@ -319,9 +328,7 @@ namespace StockManMVC.Controllers
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemFlux.ItemID);
|
||||
ViewBag.OperatorID = new SelectList(db.Operator, "ID", "CodExt", itemFlux.OperatorID);
|
||||
ViewBag.ExtLocationID = new SelectList(db.Location, "ID", "Descr", itemFlux.ExtLocationID);
|
||||
|
||||
//// rimando ad azione differente...
|
||||
//return RedirectToAction("Details", "Items", new { ID = itemFlux.ItemID, StockItemID = itemFlux.ItemID, FluxItemID = itemFlux.ItemID });
|
||||
|
||||
return View(itemFlux);
|
||||
}
|
||||
|
||||
@@ -348,7 +355,8 @@ namespace StockManMVC.Controllers
|
||||
ItemFlux itemFlux = db.ItemFlux.Find(id);
|
||||
db.ItemFlux.Remove(itemFlux);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
//return RedirectToAction("Index");
|
||||
return RedirectToAction("Details", "Items", new { ID = itemFlux.ItemID, StockItemID = itemFlux.ItemID, FluxItemID = itemFlux.ItemID });
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -4,11 +4,8 @@
|
||||
ViewBag.Title = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<h3>Eliminazione movimento</h3>
|
||||
<div>
|
||||
<h4>ItemFlux</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@@ -101,12 +98,16 @@
|
||||
|
||||
</dl>
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
<div class="form-actions no-color row">
|
||||
<div class="col-sm-3">
|
||||
<button type="submit" value="Delete" class="btn btn-danger form-control">Elimina <i class="glyphicon glyphicon-remove-circle"></i></button>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<a href="@Url.Action("Details", "Items", new { id=Model.ItemID, StockItemID= Model.ItemID, FluxItemID= Model.ItemID })" class="btn btn-info form-control">Torna ad elenco <i class="glyphicon glyphicon-retweet"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
<h3>Dettaglio Movimento</h3>
|
||||
|
||||
<div>
|
||||
<h4>ItemFlux</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@@ -100,6 +99,7 @@
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
<h3>Modifica movimento</h3>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
@@ -12,7 +12,6 @@
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>ItemFlux</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
@@ -85,7 +84,7 @@
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Note, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.TextAreaFor(model => model.Note, 4, 50, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.TextAreaFor(model => model.Note, 3, 50, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Note, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -106,17 +105,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@*<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
<div class="form-group no-color row">
|
||||
<div class="col-sm-3">
|
||||
<button type="submit" value="Save" class="btn btn-success form-control">Modifica <i class="glyphicon glyphicon-ok-circle"></i></button>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<a href="@Url.Action("Details", "Items", new { id=Model.ItemID, StockItemID= Model.ItemID, FluxItemID= Model.ItemID })" class="btn btn-info form-control">Torna ad elenco <i class="glyphicon glyphicon-retweet"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@*<div>
|
||||
@Html.ActionLink("Torna ad elenco", "Details", "Items", new { id = Model.ItemID, StockItemID = Model.ItemID, FluxItemID = Model.ItemID }, null)
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-6 padZR">
|
||||
<a href="@Url.Action("Consolidate", "Items", new { id = Model.ID, caller="Items" })" class="btn btn-primary form-control" onClick="return confirm('Sicuro di voler approvare i movimenti pending?')">
|
||||
<a href="@Url.Action("Consolidate", "Items", new { id = Model.ID, caller="Items" })" class="btn btn-primary form-control" onClick="return confirm('Sicuro di voler confermare i movimenti da registrare?')">
|
||||
<i class="glyphicon glyphicon-save" aria-hidden="true"></i>
|
||||
Conf. movimenti
|
||||
</a>
|
||||
@@ -113,24 +113,12 @@
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-xs-4 padZR">
|
||||
@*<a href="@Url.Action("CreatePrecompiled", "ItemFluxes", new { ItemID = Model.ID, MovTypeID = "CAR" })" class="btn btn-success form-control">
|
||||
<i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
|
||||
Carico
|
||||
</a>*@
|
||||
<button class="btn btn-success form-control" onclick="CreateNewMov(@Model.ID, 'SCAR');"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Carico</button>
|
||||
<button class="btn btn-success form-control" onclick="CreateNewMov(@Model.ID, 'CAR');"><i class="glyphicon glyphicon-plus" aria-hidden="true"></i> Carico</button>
|
||||
</div>
|
||||
<div class="col-xs-4 padZRL">
|
||||
@*<a href="@Url.Action("CreatePrecompiled", "ItemFluxes", new { ItemID = Model.ID, MovTypeID = "RETT" })" class="btn btn-info form-control">
|
||||
<i class="glyphicon glyphicon-edit" aria-hidden="true"></i>
|
||||
Rettifica
|
||||
</a>*@
|
||||
<button class="btn btn-info form-control" onclick="CreateNewMov(@Model.ID, 'SCAR');"><i class="glyphicon glyphicon-edit" aria-hidden="true"></i> Rettifica</button>
|
||||
<button class="btn btn-info form-control" onclick="CreateNewMov(@Model.ID, 'RETT');"><i class="glyphicon glyphicon-edit" aria-hidden="true"></i> Rettifica</button>
|
||||
</div>
|
||||
<div class="col-xs-4 padZL">
|
||||
@*<a href="@Url.Action("CreatePrecompiled", "ItemFluxes", new { ItemID = Model.ID, MovTypeID = "SCAR" })" class="btn btn-danger form-control">
|
||||
<i class="glyphicon glyphicon-minus" aria-hidden="true"></i>
|
||||
Scarico
|
||||
</a>*@
|
||||
<button class="btn btn-danger form-control" onclick="CreateNewMov(@Model.ID, 'SCAR');"><i class="glyphicon glyphicon-minus" aria-hidden="true"></i> Scarico</button>
|
||||
</div>
|
||||
<div class="col-xs-12 small" id="divCreateMov">
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user