fix ordinamento items + fix ricalcolo da flusso a stock!

This commit is contained in:
Samuele E. Locatelli
2016-09-26 15:51:31 +02:00
parent c0822af6ed
commit 562b3518ae
13 changed files with 78 additions and 64 deletions
+2 -1
View File
@@ -87,7 +87,8 @@ namespace StockManMVC
.WithValueExpression(i => i.QtaBatch.ToString());
cols.Add("QtaPend").WithColumnName("QtaPend")
.WithHeaderText("Stock")
.WithCellCssClassExpression(p => p.QtaPend >= p.QtaMin ? "success" : "danger")
.WithCellCssClassExpression(p => p.QtaPend >= p.QtaMin ? "success text-right" : "danger text-right")
.WithSortColumnData("QtaPend")
.WithValueExpression(i => i.QtaPend.ToString());
cols.Add("CurrValue").WithColumnName("CurrValue")
.WithHeaderText("€/pz")
@@ -15,17 +15,11 @@ namespace StockManMVC.Controllers
{
private StockManEntities db = new StockManEntities();
//// GET: ItemStockStatus
//public ActionResult Index()
//{
// return View(db.ItemStockStatus.ToList());
//}
// GET: ItemStockStatus
public ActionResult Index(string SearchVal)
{
var StockStatus = from s in db.ItemStockStatus
select s;
select s;
if (!String.IsNullOrEmpty(SearchVal))
{
StockStatus = StockStatus.Where(s => s.LocationID.Contains(SearchVal)
@@ -91,7 +85,7 @@ namespace StockManMVC.Controllers
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "ID,LocationID,LocationDesc,ItemID,Descr,CodInt,ItemFamilyID,CodExt,DescrExt,QtaMin,QtaBatch,QtyConf,ValConf,QtaPend,ValPend,QtaNew,ValNew")] ItemStockStatus itemStockStatus)
public ActionResult Create([Bind(Include = "ID,LocationID,LocationDesc,ItemID,Descr,CodInt,ItemFamilyID,CodExt,DescrExt,QtaMin,QtaBatch,QtyConf,ValConf,QtyPend,ValPend,QtyNew,ValNew")] ItemStockStatus itemStockStatus)
{
if (ModelState.IsValid)
{
@@ -123,7 +117,7 @@ namespace StockManMVC.Controllers
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include = "ID,LocationID,LocationDesc,ItemID,Descr,CodInt,ItemFamilyID,CodExt,DescrExt,QtaMin,QtaBatch,QtyConf,ValConf,QtaPend,ValPend,QtaNew,ValNew")] ItemStockStatus itemStockStatus)
public ActionResult Edit([Bind(Include = "ID,LocationID,LocationDesc,ItemID,Descr,CodInt,ItemFamilyID,CodExt,DescrExt,QtaMin,QtaBatch,QtyConf,ValConf,QtyPend,ValPend,QtyNew,ValNew")] ItemStockStatus itemStockStatus)
{
if (ModelState.IsValid)
{
@@ -83,6 +83,36 @@ namespace StockManMVC.Controllers
answ = answ.OrderBy(x => x.ItemFamilyID);
}
break;
case "qtapend":
if (Sort == "dsc")
{
answ = answ.OrderByDescending(x => x.QtaPend);
}
else
{
answ = answ.OrderBy(x => x.QtaPend);
}
break;
case "currvalue":
if (Sort == "dsc")
{
answ = answ.OrderByDescending(x => x.CurrValue);
}
else
{
answ = answ.OrderBy(x => x.CurrValue);
}
break;
case "totval":
if (Sort == "dsc")
{
answ = answ.OrderByDescending(x => x.CurrValue * x.QtaPend);
}
else
{
answ = answ.OrderBy(x => x.CurrValue * x.QtaPend);
}
break;
case "descr":
default:
if (Sort == "dsc")
+2 -2
View File
@@ -27,9 +27,9 @@ namespace StockManMVC.Models
public int QtaBatch { get; set; }
public int QtyConf { get; set; }
public decimal ValConf { get; set; }
public int QtaPend { get; set; }
public int QtyPend { get; set; }
public Nullable<decimal> ValPend { get; set; }
public Nullable<int> QtaNew { get; set; }
public Nullable<int> QtyNew { get; set; }
public Nullable<decimal> ValNew { get; set; }
}
}
+8 -21
View File
@@ -96,19 +96,6 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
<EntityType Name="vItemStockStatus">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" Nullable="false" />
<Property Name="LocationID" Type="nvarchar" MaxLength="50" Nullable="false" />
@@ -123,9 +110,9 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
<Property Name="QtaBatch" Type="int" Nullable="false" />
<Property Name="QtyConf" Type="int" Nullable="false" />
<Property Name="ValConf" Type="decimal" Precision="18" Scale="6" Nullable="false" />
<Property Name="QtaPend" Type="int" Nullable="false" />
<Property Name="QtyPend" Type="int" Nullable="false" />
<Property Name="ValPend" Type="decimal" Precision="38" Scale="6" />
<Property Name="QtaNew" Type="int" />
<Property Name="QtyNew" Type="int" />
<Property Name="ValNew" Type="decimal" Precision="38" Scale="6" />
</EntityType>
<Association Name="FK_Item_ItemFamily">
@@ -263,9 +250,9 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
[vItemStockStatus].[QtaBatch] AS [QtaBatch],
[vItemStockStatus].[QtyConf] AS [QtyConf],
[vItemStockStatus].[ValConf] AS [ValConf],
[vItemStockStatus].[QtaPend] AS [QtaPend],
[vItemStockStatus].[QtyPend] AS [QtyPend],
[vItemStockStatus].[ValPend] AS [ValPend],
[vItemStockStatus].[QtaNew] AS [QtaNew],
[vItemStockStatus].[QtyNew] AS [QtyNew],
[vItemStockStatus].[ValNew] AS [ValNew]
FROM [dbo].[vItemStockStatus] AS [vItemStockStatus]</DefiningQuery>
</EntitySet>
@@ -555,9 +542,9 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
<Property Name="QtaBatch" Type="Int32" Nullable="false" />
<Property Name="QtyConf" Type="Int32" Nullable="false" />
<Property Name="ValConf" Type="Decimal" Nullable="false" Precision="18" Scale="6" />
<Property Name="QtaPend" Type="Int32" Nullable="false" />
<Property Name="QtyPend" Type="Int32" Nullable="false" />
<Property Name="ValPend" Type="Decimal" Precision="38" Scale="6" />
<Property Name="QtaNew" Type="Int32" />
<Property Name="QtyNew" Type="Int32" />
<Property Name="ValNew" Type="Decimal" Precision="38" Scale="6" />
</EntityType>
<EntityType Name="Operator">
@@ -688,10 +675,10 @@ avviso 6002: Nessuna chiave primaria definita per la tabella/visualizzazione 'St
<EntitySetMapping Name="ItemStockStatus">
<EntityTypeMapping TypeName="StockManModel.ItemStockStatus">
<MappingFragment StoreEntitySet="vItemStockStatus">
<ScalarProperty Name="QtyNew" ColumnName="QtyNew" />
<ScalarProperty Name="QtyPend" ColumnName="QtyPend" />
<ScalarProperty Name="ValPend" ColumnName="ValPend" />
<ScalarProperty Name="ValNew" ColumnName="ValNew" />
<ScalarProperty Name="QtaNew" ColumnName="QtaNew" />
<ScalarProperty Name="QtaPend" ColumnName="QtaPend" />
<ScalarProperty Name="ValConf" ColumnName="ValConf" />
<ScalarProperty Name="QtyConf" ColumnName="QtyConf" />
<ScalarProperty Name="QtaBatch" ColumnName="QtaBatch" />
+5 -3
View File
@@ -52,7 +52,7 @@
<div class="form-group">
@Html.LabelFor(model => model.dtMov, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.dtMov, new { htmlAttributes = new { @class = "form-control" } })
@Html.EditorFor(model => model.dtMov, new { htmlAttributes = new { @class = "form-control date-picker", type="date" } })
@Html.ValidationMessageFor(model => model.dtMov, "", new { @class = "text-danger" })
</div>
</div>
@@ -92,7 +92,7 @@
<div class="form-group">
@Html.LabelFor(model => model.dtExport, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.dtExport, new { htmlAttributes = new { @class = "form-control" } })
@Html.EditorFor(model => model.dtExport, new { htmlAttributes = new { @class = "form-control date-picker", type = "date" } })
@Html.ValidationMessageFor(model => model.dtExport, "", new { @class = "text-danger" })
</div>
</div>
@@ -114,7 +114,9 @@
}
<div>
@Html.ActionLink("Back to List", "Index")
@*@Html.ActionLink("Back to List", "Index")*@
@*@Html.ActionLink("Torna ad elenco", "Details", "Items")*@
@Html.ActionLink("Torna ad elenco", "Details", "Items", new { id = Model.ItemID, StockItemID = Model.ItemID, FluxItemID = Model.ItemID }, null)
</div>
@section Scripts {
@@ -48,13 +48,13 @@
@Html.DisplayNameFor(model => model.ValConf)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaPend)
@Html.DisplayNameFor(model => model.QtyPend)
</th>
<th>
@Html.DisplayNameFor(model => model.ValPend)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaNew)
@Html.DisplayNameFor(model => model.QtyNew)
</th>
<th>
@Html.DisplayNameFor(model => model.ValNew)
@@ -101,13 +101,13 @@
@Html.DisplayFor(modelItem => item.ValConf)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaPend)
@Html.DisplayFor(modelItem => item.QtyPend)
</td>
<td>
@Html.DisplayFor(modelItem => item.ValPend)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaNew)
@Html.DisplayFor(modelItem => item.QtyNew)
</td>
<td>
@Html.DisplayFor(modelItem => item.ValNew)
@@ -120,10 +120,10 @@
</div>
<div class="form-group">
@Html.LabelFor(model => model.QtaPend, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.LabelFor(model => model.QtyPend, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.QtaPend, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtaPend, "", new { @class = "text-danger" })
@Html.EditorFor(model => model.QtyPend, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtyPend, "", new { @class = "text-danger" })
</div>
</div>
@@ -136,10 +136,10 @@
</div>
<div class="form-group">
@Html.LabelFor(model => model.QtaNew, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.LabelFor(model => model.QtyNew, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.QtaNew, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtaNew, "", new { @class = "text-danger" })
@Html.EditorFor(model => model.QtyNew, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtyNew, "", new { @class = "text-danger" })
</div>
</div>
@@ -108,11 +108,11 @@
</dd>
<dt>
@Html.DisplayNameFor(model => model.QtaPend)
@Html.DisplayNameFor(model => model.QtyPend)
</dt>
<dd>
@Html.DisplayFor(model => model.QtaPend)
@Html.DisplayFor(model => model.QtyPend)
</dd>
<dt>
@@ -124,11 +124,11 @@
</dd>
<dt>
@Html.DisplayNameFor(model => model.QtaNew)
@Html.DisplayNameFor(model => model.QtyNew)
</dt>
<dd>
@Html.DisplayFor(model => model.QtaNew)
@Html.DisplayFor(model => model.QtyNew)
</dd>
<dt>
@@ -107,11 +107,11 @@
</dd>
<dt>
@Html.DisplayNameFor(model => model.QtaPend)
@Html.DisplayNameFor(model => model.QtyPend)
</dt>
<dd>
@Html.DisplayFor(model => model.QtaPend)
@Html.DisplayFor(model => model.QtyPend)
</dd>
<dt>
@@ -123,11 +123,11 @@
</dd>
<dt>
@Html.DisplayNameFor(model => model.QtaNew)
@Html.DisplayNameFor(model => model.QtyNew)
</dt>
<dd>
@Html.DisplayFor(model => model.QtaNew)
@Html.DisplayFor(model => model.QtyNew)
</dd>
<dt>
@@ -114,10 +114,10 @@
</div>
<div class="form-group">
@Html.LabelFor(model => model.QtaPend, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.LabelFor(model => model.QtyPend, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.QtaPend, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtaPend, "", new { @class = "text-danger" })
@Html.EditorFor(model => model.QtyPend, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtyPend, "", new { @class = "text-danger" })
</div>
</div>
@@ -130,10 +130,10 @@
</div>
<div class="form-group">
@Html.LabelFor(model => model.QtaNew, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.LabelFor(model => model.QtyNew, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.QtaNew, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtaNew, "", new { @class = "text-danger" })
@Html.EditorFor(model => model.QtyNew, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.QtyNew, "", new { @class = "text-danger" })
</div>
</div>
@@ -52,13 +52,13 @@
@Html.DisplayNameFor(model => model.ValConf)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaPend)
@Html.DisplayNameFor(model => model.QtyPend)
</th>
<th>
@Html.DisplayNameFor(model => model.ValPend)
</th>
<th>
@Html.DisplayNameFor(model => model.QtaNew)
@Html.DisplayNameFor(model => model.QtyNew)
</th>
<th>
@Html.DisplayNameFor(model => model.ValNew)
@@ -105,13 +105,13 @@
@Html.DisplayFor(modelItem => item.ValConf)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaPend)
@Html.DisplayFor(modelItem => item.QtyPend)
</td>
<td>
@Html.DisplayFor(modelItem => item.ValPend)
</td>
<td>
@Html.DisplayFor(modelItem => item.QtaNew)
@Html.DisplayFor(modelItem => item.QtyNew)
</td>
<td>
@Html.DisplayFor(modelItem => item.ValNew)
Binary file not shown.