Distribution report
This commit is contained in:
@@ -74,21 +74,24 @@ namespace InventoryTraker.Web
|
|||||||
{
|
{
|
||||||
var r = new Random(1);
|
var r = new Random(1);
|
||||||
var inventoryTypes = context.InventoryTypes.ToList();
|
var inventoryTypes = context.InventoryTypes.ToList();
|
||||||
var cityNames = new List<string> {"Maryville", "Wartburg", "Clinton", "Oak Ridge", "Alcoa", "Jellico"};
|
var counties = new List<string> {"Blount County", "Morgan County", "Knox County", "Anderson County", "Claiborne County", "Campbell County"};
|
||||||
var colorNames = new List<string> {"Red", "Purple", "Blue", "Yellow", "White"};
|
var colors = new List<string> {"Red", "Purple", "Blue", "Yellow", "White"};
|
||||||
|
|
||||||
for (int i = 0; i < 200; i++)
|
for (var dd = DateTime.Today.AddYears(-4); dd < DateTime.Today.AddMonths(-2); dd = dd.AddMonths(3))
|
||||||
|
{
|
||||||
|
// add some inventory
|
||||||
|
for (int i = 0; i < r.Next(5,10); i++)
|
||||||
{
|
{
|
||||||
var inventoryType = inventoryTypes.ElementAt(r.Next(0, context.InventoryTypes.Count()));
|
var inventoryType = inventoryTypes.ElementAt(r.Next(0, context.InventoryTypes.Count()));
|
||||||
var addedDate = DateTime.Today.AddMonths(-r.Next(1, 24));
|
var addedDate = dd.AddDays(r.Next(-10, 10));
|
||||||
var expiration = addedDate.AddMonths(r.Next(2, 48));
|
var expiration = addedDate.AddMonths(r.Next(2, 48));
|
||||||
var memo =
|
var memo =
|
||||||
r.Next(0,3) > 0
|
r.Next(0, 3) > 0
|
||||||
? colorNames.ElementAt(r.Next(0, colorNames.Count)) + $" {inventoryType.ContainerType}"
|
? colors.ElementAt(r.Next(0, colors.Count)) + $" {inventoryType.ContainerType}"
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
var quantity = r.Next(5, 112);
|
var quantity = r.Next(5, 112);
|
||||||
|
|
||||||
var previousTransaction = new Transaction
|
var addedTransaction = new Transaction
|
||||||
{
|
{
|
||||||
TransactionType = TransactionType.Added,
|
TransactionType = TransactionType.Added,
|
||||||
AddedQuantity = quantity,
|
AddedQuantity = quantity,
|
||||||
@@ -104,67 +107,180 @@ namespace InventoryTraker.Web
|
|||||||
AddedDate = addedDate,
|
AddedDate = addedDate,
|
||||||
Memo = memo,
|
Memo = memo,
|
||||||
Quantity = quantity,
|
Quantity = quantity,
|
||||||
Transactions = new List<Transaction> { previousTransaction}
|
Transactions = new List<Transaction> {addedTransaction}
|
||||||
};
|
};
|
||||||
context.Inventories.Add(inventory);
|
context.Inventories.Add(inventory);
|
||||||
|
}
|
||||||
|
dd = dd.AddDays(14);
|
||||||
|
// expire/loss some inventory
|
||||||
|
var availableInventories =
|
||||||
|
context.Inventories.Local.Where(i => i.Quantity > 0).ToList();
|
||||||
|
|
||||||
for (int j = 0; j < 5 && previousTransaction.CurrentQuantity > 0; j++)
|
foreach (var inventory in availableInventories)
|
||||||
{
|
{
|
||||||
var transactionDate = previousTransaction.TransactionDate.AddDays(r.Next(1, 100));
|
if (inventory.ExpirationDate <= dd && r.Next(0, 3) > 0)
|
||||||
if (transactionDate >= DateTime.Today)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Transaction transaction;
|
|
||||||
if (transactionDate >= expiration)
|
|
||||||
{
|
{
|
||||||
if (r.Next(1, 3) == 1)
|
var expiredTransaction = new Transaction
|
||||||
break;
|
|
||||||
|
|
||||||
transaction = new Transaction
|
|
||||||
{
|
{
|
||||||
TransactionType = TransactionType.Expired,
|
TransactionType = TransactionType.Expired,
|
||||||
RemovedQuantity = previousTransaction.CurrentQuantity,
|
RemovedQuantity = inventory.Quantity,
|
||||||
CurrentQuantity = 0,
|
CurrentQuantity = 0,
|
||||||
Inventory = inventory,
|
Inventory = inventory,
|
||||||
Memo = $"Expired on {expiration.ToShortDateString()}",
|
Memo = $"Expired on {inventory.ExpirationDate.ToShortDateString()}",
|
||||||
TransactionDate = transactionDate,
|
TransactionDate = dd,
|
||||||
Timestamp = transactionDate
|
Timestamp = dd
|
||||||
};
|
};
|
||||||
|
inventory.Quantity = expiredTransaction.CurrentQuantity;
|
||||||
|
inventory.Transactions.Add(expiredTransaction);
|
||||||
}
|
}
|
||||||
else
|
else if (r.Next(0, 20) == 0)
|
||||||
{
|
{
|
||||||
var quantityRemoved = r.Next(1, 100);
|
var lossQty = r.Next(1, inventory.Quantity + 1);
|
||||||
if (quantityRemoved > previousTransaction.CurrentQuantity)
|
var lossTransaction = new Transaction
|
||||||
quantityRemoved = previousTransaction.CurrentQuantity;
|
{
|
||||||
|
TransactionType = TransactionType.Loss,
|
||||||
|
RemovedQuantity = lossQty,
|
||||||
|
CurrentQuantity = inventory.Quantity - lossQty,
|
||||||
|
Inventory = inventory,
|
||||||
|
Memo = $"Missing",
|
||||||
|
TransactionDate = dd,
|
||||||
|
Timestamp = dd
|
||||||
|
};
|
||||||
|
inventory.Quantity = lossTransaction.CurrentQuantity;
|
||||||
|
inventory.Transactions.Add(lossTransaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var transMemo = $"Distributed to {cityNames.ElementAt(r.Next(0, cityNames.Count))}";
|
|
||||||
|
dd = dd.AddDays(14);
|
||||||
|
// distribute some inventory
|
||||||
|
foreach (var destination in counties)
|
||||||
|
{
|
||||||
|
availableInventories =
|
||||||
|
context.Inventories.Local.Where(i => i.Quantity > 0).ToList();
|
||||||
|
|
||||||
|
for (
|
||||||
|
var i = r.Next(0, availableInventories.Count);
|
||||||
|
i < availableInventories.Count;
|
||||||
|
i += r.Next(1, availableInventories.Count / 2))
|
||||||
|
{
|
||||||
|
var inventory = availableInventories.ElementAt(i);
|
||||||
|
if (inventory.ExpirationDate <= dd)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var quantityRemoved = r.Next(1, inventory.Quantity + 1);
|
||||||
|
|
||||||
|
var transMemo = $"Distributed to {destination}";
|
||||||
var transType = TransactionType.Distributed;
|
var transType = TransactionType.Distributed;
|
||||||
|
|
||||||
if (r.Next(1, 15) == 1)
|
var distributeTransaction = new Transaction
|
||||||
{
|
|
||||||
transMemo = "Loss";
|
|
||||||
transType = TransactionType.Loss;
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction = new Transaction
|
|
||||||
{
|
{
|
||||||
TransactionType = transType,
|
TransactionType = transType,
|
||||||
RemovedQuantity = quantityRemoved,
|
RemovedQuantity = quantityRemoved,
|
||||||
CurrentQuantity = previousTransaction.CurrentQuantity - quantityRemoved,
|
CurrentQuantity = inventory.Quantity - quantityRemoved,
|
||||||
Inventory = inventory,
|
Inventory = inventory,
|
||||||
Memo = transMemo,
|
Memo = transMemo,
|
||||||
TransactionDate = transactionDate,
|
TransactionDate = dd,
|
||||||
Timestamp = transactionDate
|
Timestamp = dd,
|
||||||
|
Destination = destination
|
||||||
};
|
};
|
||||||
}
|
inventory.Quantity = distributeTransaction.CurrentQuantity;
|
||||||
|
|
||||||
inventory.Quantity = transaction.CurrentQuantity;
|
inventory.Transactions.Add(distributeTransaction);
|
||||||
|
|
||||||
inventory.Transactions.Add(transaction);
|
|
||||||
|
|
||||||
previousTransaction = transaction;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for (int i = 0; i < 200; i++)
|
||||||
|
//{
|
||||||
|
// var inventoryType = inventoryTypes.ElementAt(r.Next(0, context.InventoryTypes.Count()));
|
||||||
|
// var addedDate = DateTime.Today.AddMonths(-r.Next(1, 24));
|
||||||
|
// var expiration = addedDate.AddMonths(r.Next(2, 48));
|
||||||
|
// var memo =
|
||||||
|
// r.Next(0,3) > 0
|
||||||
|
// ? colors.ElementAt(r.Next(0, colors.Count)) + $" {inventoryType.ContainerType}"
|
||||||
|
// : string.Empty;
|
||||||
|
// var quantity = r.Next(5, 112);
|
||||||
|
|
||||||
|
// var previousTransaction = new Transaction
|
||||||
|
// {
|
||||||
|
// TransactionType = TransactionType.Added,
|
||||||
|
// AddedQuantity = quantity,
|
||||||
|
// Memo = "Arrival",
|
||||||
|
// CurrentQuantity = quantity,
|
||||||
|
// TransactionDate = addedDate,
|
||||||
|
// Timestamp = addedDate
|
||||||
|
// };
|
||||||
|
// var inventory = new Inventory
|
||||||
|
// {
|
||||||
|
// InventoryType = inventoryType,
|
||||||
|
// ExpirationDate = expiration,
|
||||||
|
// AddedDate = addedDate,
|
||||||
|
// Memo = memo,
|
||||||
|
// Quantity = quantity,
|
||||||
|
// Transactions = new List<Transaction> { previousTransaction}
|
||||||
|
// };
|
||||||
|
// context.Inventories.Add(inventory);
|
||||||
|
|
||||||
|
// for (int j = 0; j < 5 && previousTransaction.CurrentQuantity > 0; j++)
|
||||||
|
// {
|
||||||
|
// var transactionDate = previousTransaction.TransactionDate.AddDays(r.Next(1, 100));
|
||||||
|
// if (transactionDate >= DateTime.Today)
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// Transaction transaction;
|
||||||
|
// if (transactionDate >= expiration)
|
||||||
|
// {
|
||||||
|
// if (r.Next(1, 3) == 1)
|
||||||
|
// break;
|
||||||
|
|
||||||
|
//transaction = new Transaction
|
||||||
|
//{
|
||||||
|
// TransactionType = TransactionType.Expired,
|
||||||
|
// RemovedQuantity = previousTransaction.CurrentQuantity,
|
||||||
|
// CurrentQuantity = 0,
|
||||||
|
// Inventory = inventory,
|
||||||
|
// Memo = $"Expired on {expiration.ToShortDateString()}",
|
||||||
|
// TransactionDate = transactionDate,
|
||||||
|
// Timestamp = transactionDate
|
||||||
|
//};
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// var quantityRemoved = r.Next(1, 100);
|
||||||
|
// if (quantityRemoved > previousTransaction.CurrentQuantity)
|
||||||
|
// quantityRemoved = previousTransaction.CurrentQuantity;
|
||||||
|
|
||||||
|
// var destination = counties.ElementAt(r.Next(0, counties.Count));
|
||||||
|
// var transMemo = $"Distributed to {destination}";
|
||||||
|
// var transType = TransactionType.Distributed;
|
||||||
|
|
||||||
|
// if (r.Next(1, 15) == 1)
|
||||||
|
// {
|
||||||
|
// transMemo = "Loss";
|
||||||
|
// transType = TransactionType.Loss;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// transaction = new Transaction
|
||||||
|
// {
|
||||||
|
// TransactionType = transType,
|
||||||
|
// RemovedQuantity = quantityRemoved,
|
||||||
|
// CurrentQuantity = previousTransaction.CurrentQuantity - quantityRemoved,
|
||||||
|
// Inventory = inventory,
|
||||||
|
// Memo = transMemo,
|
||||||
|
// TransactionDate = transactionDate,
|
||||||
|
// Timestamp = transactionDate,
|
||||||
|
// Destination = destination
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// inventory.Quantity = transaction.CurrentQuantity;
|
||||||
|
|
||||||
|
// inventory.Transactions.Add(transaction);
|
||||||
|
|
||||||
|
// previousTransaction = transaction;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,11 +119,8 @@ namespace InventoryTraker.Web.Controllers
|
|||||||
TransactionType = TransactionType.Distributed,
|
TransactionType = TransactionType.Distributed,
|
||||||
RemovedQuantity = quantityForm.Quantity,
|
RemovedQuantity = quantityForm.Quantity,
|
||||||
CurrentQuantity = inventory.Quantity,
|
CurrentQuantity = inventory.Quantity,
|
||||||
Memo =
|
Destination = form.Destination,
|
||||||
string.IsNullOrEmpty(form.Memo)
|
Memo = form.Memo,
|
||||||
? $"{form.Memo} | "
|
|
||||||
: ""
|
|
||||||
+ $"Distributed to {form.Destination}",
|
|
||||||
Timestamp = DateTime.Now,
|
Timestamp = DateTime.Now,
|
||||||
TransactionDate = form.DistributedDate
|
TransactionDate = form.DistributedDate
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using InventoryTraker.Web.Core;
|
||||||
|
using InventoryTraker.Web.Data;
|
||||||
|
using InventoryTraker.Web.Models;
|
||||||
|
|
||||||
|
namespace InventoryTraker.Web.Controllers
|
||||||
|
{
|
||||||
|
public class ReportController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly AppDbContext _context;
|
||||||
|
|
||||||
|
public ReportController(AppDbContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public ActionResult Distribution()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Distribution(DateTime startDate, DateTime endDate)
|
||||||
|
{
|
||||||
|
var query =
|
||||||
|
from t in _context.Transactions
|
||||||
|
where
|
||||||
|
t.TransactionType == TransactionType.Distributed
|
||||||
|
&& t.TransactionDate >= startDate
|
||||||
|
&& t.TransactionDate < endDate
|
||||||
|
group t by new { t.TransactionDate, t.Destination }
|
||||||
|
into g
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
Date = g.Key.TransactionDate,
|
||||||
|
Destination = g.Key.Destination,
|
||||||
|
Transactions = g.ToList()
|
||||||
|
//(from transaction in g
|
||||||
|
//select Mapper.Map<TransactionViewModel>(transaction)).ToArray()
|
||||||
|
};
|
||||||
|
|
||||||
|
var report =
|
||||||
|
from item in query.ToArray()
|
||||||
|
select new DistributionReport
|
||||||
|
{
|
||||||
|
Date = item.Date,
|
||||||
|
Destination = item.Destination,
|
||||||
|
Transactions =
|
||||||
|
Mapper.Map<IList<Transaction>, IList<TransactionViewModel>>
|
||||||
|
(item.Transactions).ToArray()
|
||||||
|
};
|
||||||
|
|
||||||
|
return BetterJson(report.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Collections;
|
||||||
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using AutoMapper.QueryableExtensions;
|
using AutoMapper.QueryableExtensions;
|
||||||
using InventoryTraker.Web.Attributes;
|
using InventoryTraker.Web.Attributes;
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ namespace InventoryTraker.Web.Core
|
|||||||
|
|
||||||
public string Memo { get; set; }
|
public string Memo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used only when inventory was distributed
|
||||||
|
/// </summary>
|
||||||
|
public string Destination { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime Timestamp { get; set; }
|
public DateTime Timestamp { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,9 +246,15 @@
|
|||||||
<Content Include="js\inventory\InventoryEditDirective.js" />
|
<Content Include="js\inventory\InventoryEditDirective.js" />
|
||||||
<Content Include="js\inventory\InventoryDistributeDirective.js" />
|
<Content Include="js\inventory\InventoryDistributeDirective.js" />
|
||||||
<Content Include="js\profile\EditProfileController.js" />
|
<Content Include="js\profile\EditProfileController.js" />
|
||||||
|
<Content Include="js\report\DistributionReportDirective.js" />
|
||||||
|
<Content Include="js\report\DistributionReportQueryDirective.js" />
|
||||||
|
<Content Include="js\report\DistributionReportController.js" />
|
||||||
|
<Content Include="js\report\reportSvc.js" />
|
||||||
<Content Include="js\transaction\TransactionController.js" />
|
<Content Include="js\transaction\TransactionController.js" />
|
||||||
<Content Include="js\transaction\transactionSvc.js" />
|
<Content Include="js\transaction\transactionSvc.js" />
|
||||||
<Content Include="js\utility\ArrayExtensions.js" />
|
<Content Include="js\utility\ArrayExtensions.js" />
|
||||||
|
<Content Include="js\utility\StatusMessage.js" />
|
||||||
|
<Content Include="js\utility\ErrorList.js" />
|
||||||
<Content Include="js\utility\FormGroupValidationDirective.js" />
|
<Content Include="js\utility\FormGroupValidationDirective.js" />
|
||||||
<Content Include="js\utility\HideZeroFilter.js" />
|
<Content Include="js\utility\HideZeroFilter.js" />
|
||||||
<Content Include="js\utility\InputValidationIconsDirective.js" />
|
<Content Include="js\utility\InputValidationIconsDirective.js" />
|
||||||
@@ -293,6 +299,10 @@
|
|||||||
<Content Include="NLog.config">
|
<Content Include="NLog.config">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="js\report\templates\distributionReportQuery.tmpl.cshtml" />
|
||||||
|
<Content Include="js\utility\templates\errorList.tmpl.cshtml" />
|
||||||
|
<Content Include="js\report\templates\distributionReport.tmpl.cshtml" />
|
||||||
|
<Content Include="js\utility\templates\statusMessage.tmpl.cshtml" />
|
||||||
<None Include="NLog.xsd">
|
<None Include="NLog.xsd">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
@@ -319,6 +329,7 @@
|
|||||||
<Compile Include="App_Start\Startup.cs" />
|
<Compile Include="App_Start\Startup.cs" />
|
||||||
<Compile Include="App_Start\StructureMapConfig.cs" />
|
<Compile Include="App_Start\StructureMapConfig.cs" />
|
||||||
<Compile Include="Attributes\ActionLogAttribute.cs" />
|
<Compile Include="Attributes\ActionLogAttribute.cs" />
|
||||||
|
<Compile Include="Controllers\ReportController.cs" />
|
||||||
<Compile Include="Controllers\TransactionController.cs" />
|
<Compile Include="Controllers\TransactionController.cs" />
|
||||||
<Compile Include="Controllers\InventoryController.cs" />
|
<Compile Include="Controllers\InventoryController.cs" />
|
||||||
<Compile Include="Controllers\AuthenticationController.cs" />
|
<Compile Include="Controllers\AuthenticationController.cs" />
|
||||||
@@ -345,6 +356,8 @@
|
|||||||
<Compile Include="Identity\ApplicationUserManager.cs" />
|
<Compile Include="Identity\ApplicationUserManager.cs" />
|
||||||
<Compile Include="Identity\AspNetIdentityRegistry.cs" />
|
<Compile Include="Identity\AspNetIdentityRegistry.cs" />
|
||||||
<Compile Include="Migrations\Configuration.cs" />
|
<Compile Include="Migrations\Configuration.cs" />
|
||||||
|
<Compile Include="Models\DateRangeQuery.cs" />
|
||||||
|
<Compile Include="Models\DistributionReport.cs" />
|
||||||
<Compile Include="Models\InventoryDistributeForm.cs" />
|
<Compile Include="Models\InventoryDistributeForm.cs" />
|
||||||
<Compile Include="Models\InventoryAddForm.cs" />
|
<Compile Include="Models\InventoryAddForm.cs" />
|
||||||
<Compile Include="Models\InventoryQuantityForm.cs" />
|
<Compile Include="Models\InventoryQuantityForm.cs" />
|
||||||
@@ -381,6 +394,7 @@
|
|||||||
<Content Include="Views\_ViewStart.cshtml" />
|
<Content Include="Views\_ViewStart.cshtml" />
|
||||||
<Content Include="Views\Transaction\Index.cshtml" />
|
<Content Include="Views\Transaction\Index.cshtml" />
|
||||||
<Content Include="Views\InventoryType\Index.cshtml" />
|
<Content Include="Views\InventoryType\Index.cshtml" />
|
||||||
|
<Content Include="Views\Report\Distribution.cshtml" />
|
||||||
<None Include="Web.Debug.config">
|
<None Include="Web.Debug.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace InventoryTraker.Web.Models
|
||||||
|
{
|
||||||
|
public class DateRangeQuery
|
||||||
|
{
|
||||||
|
public DateTime StartDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime EndDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace InventoryTraker.Web.Models
|
||||||
|
{
|
||||||
|
public class DistributionReport
|
||||||
|
{
|
||||||
|
public TransactionViewModel[] Transactions;
|
||||||
|
|
||||||
|
public string Destination { get; set; }
|
||||||
|
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ namespace InventoryTraker.Web.Models
|
|||||||
public string ContainerType { get; set; }
|
public string ContainerType { get; set; }
|
||||||
public DateTime ExpirationDate { get; set; }
|
public DateTime ExpirationDate { get; set; }
|
||||||
public DateTime AddedDate { get; set; }
|
public DateTime AddedDate { get; set; }
|
||||||
|
public double WeightPerCase { get; set; }
|
||||||
|
|
||||||
public string TransactionType { get; set; }
|
public string TransactionType { get; set; }
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ namespace InventoryTraker.Web.Models
|
|||||||
|
|
||||||
public string Memo { get; set; }
|
public string Memo { get; set; }
|
||||||
|
|
||||||
|
public string Destination { get; set; }
|
||||||
|
|
||||||
public DateTime Timestamp { get; set; }
|
public DateTime Timestamp { get; set; }
|
||||||
|
|
||||||
public void CreateMappings(IMapperConfiguration configuration)
|
public void CreateMappings(IMapperConfiguration configuration)
|
||||||
@@ -49,6 +52,8 @@ namespace InventoryTraker.Web.Models
|
|||||||
opt => opt.MapFrom(s => s.Inventory.InventoryType.UnitsPerCase))
|
opt => opt.MapFrom(s => s.Inventory.InventoryType.UnitsPerCase))
|
||||||
.ForMember(d => d.ContainerType,
|
.ForMember(d => d.ContainerType,
|
||||||
opt => opt.MapFrom(s => s.Inventory.InventoryType.ContainerType))
|
opt => opt.MapFrom(s => s.Inventory.InventoryType.ContainerType))
|
||||||
|
.ForMember(d => d.WeightPerCase,
|
||||||
|
opt => opt.MapFrom(s => s.Inventory.InventoryType.WeightPerCase))
|
||||||
.ForMember(d => d.TransactionType,
|
.ForMember(d => d.TransactionType,
|
||||||
opt => opt.MapFrom(s => s.TransactionType.ToString()))
|
opt => opt.MapFrom(s => s.TransactionType.ToString()))
|
||||||
.ForMember(d => d.PreviousQuantity,
|
.ForMember(d => d.PreviousQuantity,
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
@using Microsoft.Web.Mvc.Html
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "Inventory Distribution Report";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div ng-controller="DistributionReportController as vm">
|
||||||
|
<h1 class="page-header">
|
||||||
|
<i class="fa fa-file-o"></i> @ViewBag.Title
|
||||||
|
</h1>
|
||||||
|
<div class="row hidden-print">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<distribution-report-query></distribution-report-query>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" ng-show="vm.distributionData.length">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<distribution-report distribution-data="vm.distributionData"></distribution-report>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
@using Microsoft.Web.Mvc.Html
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "Monthly Inventory Report";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div ng-controller="MonthlyInventoryReportController as vm">
|
||||||
|
<h1 class="page-header">
|
||||||
|
<i class="fa fa-file-o"></i> @ViewBag.Title
|
||||||
|
</h1>
|
||||||
|
<div class="row hidden-print">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<monthly-report-query></monthly-report-query>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" ng-show="vm.inventoryData.length">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<monthly-report distribution-data="vm.distributionData"></monthly-report>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -32,6 +32,17 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="@(Html.BuildUrlFromExpression<TransactionController>(c => c.Index()))"><i class="fa fa-fw fa-list"></i> Transaction History</a>
|
<a href="@(Html.BuildUrlFromExpression<TransactionController>(c => c.Index()))"><i class="fa fa-fw fa-list"></i> Transaction History</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#"><i class="fa fa-file-o"></i> Reports</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="@(Html.BuildUrlFromExpression<ReportController>(c => c.Distribution()))"><i class="fa fa-file-o"></i> Distribution</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@(Html.BuildUrlFromExpression<ReportController>(c => c.Distribution()))"><i class="fa fa-file-o"></i> Monthly Inventory</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.navbar-collapse -->
|
<!-- /.navbar-collapse -->
|
||||||
|
|||||||
@@ -17,9 +17,11 @@
|
|||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.add = add;
|
vm.add = add;
|
||||||
vm.saving = false;
|
|
||||||
vm.inventory = { };
|
vm.inventory = { };
|
||||||
vm.inventoryTypes = inventoryTypeSvc.inventoryTypes;
|
vm.inventoryTypes = inventoryTypeSvc.inventoryTypes;
|
||||||
|
|
||||||
|
vm.saving = false;
|
||||||
|
vm.statusMessage = "Enter details for the inventory arrival below.";
|
||||||
vm.errorMessages = [];
|
vm.errorMessages = [];
|
||||||
|
|
||||||
vm.quantity = quantity;
|
vm.quantity = quantity;
|
||||||
@@ -43,6 +45,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
|
vm.statusMessage = null;
|
||||||
vm.saving = true;
|
vm.saving = true;
|
||||||
inventorySvc.add(vm.inventory)
|
inventorySvc.add(vm.inventory)
|
||||||
.success(function () {
|
.success(function () {
|
||||||
|
|||||||
@@ -16,9 +16,11 @@
|
|||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.save = save;
|
vm.save = save;
|
||||||
vm.saving = false;
|
|
||||||
vm.quantities = angular.copy(inventorySvc.inventories);
|
vm.quantities = angular.copy(inventorySvc.inventories);
|
||||||
vm.distribution = {};
|
vm.distribution = {};
|
||||||
|
|
||||||
|
vm.saving = false;
|
||||||
|
vm.statusMessage = "Enter details for the inventory distribution below.";
|
||||||
vm.errorMessages = [];
|
vm.errorMessages = [];
|
||||||
|
|
||||||
function getInventoryDistributeQuantities(inventory) {
|
function getInventoryDistributeQuantities(inventory) {
|
||||||
@@ -31,6 +33,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
vm.statusMessage = null;
|
||||||
vm.saving = true;
|
vm.saving = true;
|
||||||
vm.distribution.inventoryQuantities = getInventoryDistributeQuantities(vm.quantities);
|
vm.distribution.inventoryQuantities = getInventoryDistributeQuantities(vm.quantities);
|
||||||
inventorySvc.distribute(vm.distribution)
|
inventorySvc.distribute(vm.distribution)
|
||||||
|
|||||||
@@ -25,9 +25,11 @@
|
|||||||
transactionType: vm.inventory.isExpired ? "Expired" : null
|
transactionType: vm.inventory.isExpired ? "Expired" : null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vm.statusMessage = "Enter details for the inventory removal below.";
|
||||||
vm.errorMessages = [];
|
vm.errorMessages = [];
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
vm.statusMessage = null;
|
||||||
vm.saving = true;
|
vm.saving = true;
|
||||||
inventorySvc.remove(vm.removeForm)
|
inventorySvc.remove(vm.removeForm)
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
|
|||||||
@@ -14,15 +14,8 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
|
<status-message message="vm.statusMessage"></status-message>
|
||||||
Enter details for the inventory arrival below.
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
|
|
||||||
There were problems adding the inventory.
|
|
||||||
<ul>
|
|
||||||
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/ng-template" id="commodityTypeahead.html">
|
<script type="text/ng-template" id="commodityTypeahead.html">
|
||||||
<a>
|
<a>
|
||||||
|
|||||||
@@ -14,15 +14,8 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
|
<status-message message="vm.statusMessage"></status-message>
|
||||||
Enter details for the inventory distribution below.
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
|
|
||||||
There were problems distributing the inventory.
|
|
||||||
<ul>
|
|
||||||
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@distribution.FormGroupFor(m => m.Destination)
|
@distribution.FormGroupFor(m => m.Destination)
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,7 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-danger" ng-show="vm.errorMessage != null">
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
{{vm.errorMessage}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<inventory-info inventory="inventory"></inventory-info>
|
<inventory-info inventory="inventory"></inventory-info>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
@@ -14,15 +14,8 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
|
<status-message message="vm.statusMessage"></status-message>
|
||||||
Enter details for the inventory removal below.
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
|
|
||||||
There were problems removing the inventory.
|
|
||||||
<ul>
|
|
||||||
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|||||||
@@ -12,24 +12,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
controller.$inject = ['$scope', 'inventoryTypeSvc'];
|
controller.$inject = ['$scope', 'inventoryTypeSvc'];
|
||||||
|
function controller($scope, inventoryTypeSvc){
|
||||||
function controller($scope, inventoryTypeSvc) {
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.add = add;
|
vm.add = add;
|
||||||
vm.saving = false;
|
vm.saving = false;
|
||||||
vm.inventoryType = {};
|
vm.inventoryType = {};
|
||||||
|
|
||||||
|
vm.statusMessage = "Add a new commodity";
|
||||||
vm.errorMessages = [];
|
vm.errorMessages = [];
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
|
vm.statusMessage = null;
|
||||||
vm.saving = true;
|
vm.saving = true;
|
||||||
inventoryTypeSvc.add(vm.inventoryType)
|
inventoryTypeSvc.add(vm.inventoryType)
|
||||||
.success(function () {
|
.success(function () {
|
||||||
//Close the modal
|
//Close the modal
|
||||||
$scope.$close();
|
$scope.$close();
|
||||||
})
|
})
|
||||||
.error(function(data) {
|
.error(function (data) {
|
||||||
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
|
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
|
||||||
})
|
})
|
||||||
.finally(function() {
|
.finally(function() {
|
||||||
|
|||||||
@@ -22,9 +22,12 @@
|
|||||||
|
|
||||||
vm.saving = false;
|
vm.saving = false;
|
||||||
vm.inventoryTypeSvc = inventoryTypeSvc;
|
vm.inventoryTypeSvc = inventoryTypeSvc;
|
||||||
|
|
||||||
|
vm.statusMessage = "Edit this commodity";
|
||||||
vm.errorMessages = [];
|
vm.errorMessages = [];
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
vm.statusMessage = null;
|
||||||
vm.saving = true;
|
vm.saving = true;
|
||||||
inventoryTypeSvc.update($scope.inventoryType, vm.inventoryType)
|
inventoryTypeSvc.update($scope.inventoryType, vm.inventoryType)
|
||||||
.success(function () {
|
.success(function () {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
@using InventoryTraker.Web.Helpers
|
@using InventoryTraker.Web.Helpers
|
||||||
@model InventoryTraker.Web.Models.InventoryTypeViewModel
|
@model InventoryTraker.Web.Models.InventoryTypeViewModel
|
||||||
@{
|
|
||||||
var inventoryType = Html.Angular().ModelFor("vm.inventoryType");
|
|
||||||
}
|
|
||||||
<form novalidate
|
<form novalidate
|
||||||
name="vm.form"
|
name="vm.form"
|
||||||
ng-submit="vm.form.$valid && vm.add()">
|
ng-submit="vm.form.$valid && vm.add()">
|
||||||
@@ -13,16 +11,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
<status-message message="vm.statusMessage"></status-message>
|
||||||
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
Enter details for the added commodity below.
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
|
|
||||||
There were problems adding the commodity.
|
|
||||||
<ul>
|
|
||||||
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@Html.Angular().FormForModel("vm.inventoryType")
|
@Html.Angular().FormForModel("vm.inventoryType")
|
||||||
|
|
||||||
|
|||||||
@@ -11,15 +11,8 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="alert alert-info" ng-hide="vm.errorMessages.length">
|
<status-message message="vm.statusMessage"></status-message>
|
||||||
Edit details for the commodity below.
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" ng-show="vm.errorMessages.length">
|
|
||||||
There were problems saving the commodity.
|
|
||||||
<ul>
|
|
||||||
<li ng-repeat="error in vm.errorMessages">{{error}}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@Html.Angular().FormForModel("vm.inventoryType")
|
@Html.Angular().FormForModel("vm.inventoryType")
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
window.app.controller('DistributionReportController', DistributionReportController);
|
||||||
|
|
||||||
|
DistributionReportController.$inject = ['$scope', 'reportSvc'];
|
||||||
|
function DistributionReportController($scope, reportSvc) {
|
||||||
|
var vm = this;
|
||||||
|
vm.distributionData = reportSvc.distributionData;
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
window.app.directive('distributionReport', distributionReport);
|
||||||
|
function distributionReport() {
|
||||||
|
return {
|
||||||
|
scope: {distributionData: "="},
|
||||||
|
templateUrl: '/report/template/distributionReport.tmpl.cshtml',
|
||||||
|
controller: controller,
|
||||||
|
controllerAs: 'vm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.$inject = ['$scope'];
|
||||||
|
function controller($scope) {
|
||||||
|
var vm = this;
|
||||||
|
vm.distributionData = $scope.distributionData;
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
window.app.directive('distributionReportQuery', distributionReportQuery);
|
||||||
|
function distributionReportQuery() {
|
||||||
|
return {
|
||||||
|
scope: true,
|
||||||
|
templateUrl: '/report/template/distributionReportQuery.tmpl.cshtml',
|
||||||
|
controller: controller,
|
||||||
|
controllerAs: 'vm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.$inject = ['$scope', 'reportSvc'];
|
||||||
|
function controller($scope, reportSvc) {
|
||||||
|
var vm = this;
|
||||||
|
vm.query = {};
|
||||||
|
vm.submitting = false;
|
||||||
|
vm.errorMessages = [];
|
||||||
|
vm.submit = submit;
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
vm.submitting = true;
|
||||||
|
reportSvc.loadDistributionReport(vm.query)
|
||||||
|
.error(function (data) {
|
||||||
|
vm.errorMessages = angular.copy(data.errorMessages, vm.errorMessages);
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
vm.submitting = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
(function () {
|
||||||
|
window.app.factory('reportSvc', reportSvc);
|
||||||
|
|
||||||
|
reportSvc.$inject = ['$http'];
|
||||||
|
function reportSvc($http) {
|
||||||
|
var distributionData = [];
|
||||||
|
|
||||||
|
var svc = {
|
||||||
|
distributionData: distributionData,
|
||||||
|
loadDistributionReport: loadDistributionReport
|
||||||
|
};
|
||||||
|
|
||||||
|
//loadDistributionReport({ startDate: '2015-06-01', endDate: '2016-01-01' });
|
||||||
|
return svc;
|
||||||
|
|
||||||
|
function loadDistributionReport(query) {
|
||||||
|
return $http.post('/Report/Distribution', query)
|
||||||
|
.success(function (data) {
|
||||||
|
angular.copy(data, distributionData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<div ng-repeat="distribution in vm.distributionData">
|
||||||
|
<h3>{{distribution.destination}}</h3>
|
||||||
|
<h4>{{distribution.date | date:'shortDate'}}</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="col-md-3">Name</th>
|
||||||
|
<th class="col-md-3">Units per Case</th>
|
||||||
|
<th class="col-md-2">Exp. Date</th>
|
||||||
|
<th class="col-md-1">Case Qty</th>
|
||||||
|
<th class="col-md-1">Unit Qty</th>
|
||||||
|
<th class="col-md-2">Weight</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="transaction in distribution.transactions | orderBy:'name'">
|
||||||
|
<td>{{transaction.name}}</td>
|
||||||
|
<td>{{transaction.unitsPerCase}} / {{transaction.containerType}}</td>
|
||||||
|
<td>{{transaction.expirationDate | date:'shortDate'}}</td>
|
||||||
|
<td>{{transaction.removedQuantity}}</td>
|
||||||
|
<td>{{transaction.removedQuantity * transaction.unitsPerCase}}</td>
|
||||||
|
<td>{{transaction.weightPerCase * transaction.unitsPerCase | number:0 }} lbs</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
@using InventoryTraker.Web.Helpers
|
||||||
|
@model InventoryTraker.Web.Models.DateRangeQuery
|
||||||
|
@{
|
||||||
|
var query = Html.Angular().ModelFor("vm.query");
|
||||||
|
}
|
||||||
|
<form novalidate
|
||||||
|
name="vm.form"
|
||||||
|
ng-submit="vm.form.$valid && vm.submit()">
|
||||||
|
<fieldset ng-disabled="vm.submitting">
|
||||||
|
<error-list errors="vm.errorMessages"></error-list>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
@query.FormGroupFor(m => m.StartDate)
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
@query.FormGroupFor(m => m.EndDate)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-success pull-right">Submit</button>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
@@ -32,15 +32,17 @@
|
|||||||
'\rExp Date: {{row.entity.expirationDate | date:\'shortDate\'}}' +
|
'\rExp Date: {{row.entity.expirationDate | date:\'shortDate\'}}' +
|
||||||
'\rAdd Date: {{row.entity.addedDate | date:\'shortDate\'}}">' +
|
'\rAdd Date: {{row.entity.addedDate | date:\'shortDate\'}}">' +
|
||||||
'<a href="" ng-click="grid.appScope.editInventory(row.entity.inventoryId)"><i class="fa fa-edit"></i></a> ' +
|
'<a href="" ng-click="grid.appScope.editInventory(row.entity.inventoryId)"><i class="fa fa-edit"></i></a> ' +
|
||||||
'{{row.entity.name}}</div>'
|
'{{row.entity.name}}</div>',
|
||||||
|
width: "20%"
|
||||||
},
|
},
|
||||||
{ field: 'transactionType', name: 'Type', width: "10%" },
|
{ field: 'transactionType', name: 'Type', width: "10%" },
|
||||||
{ field: 'memo', cellTooltip: true },
|
{ field: 'destination', cellTooltip: true, width: "10%" },
|
||||||
{ field: 'transactionDate', name: 'Transaction Date', cellFilter: "date:'shortDate'", width: "15%" },
|
{ field: 'memo', cellTooltip: true, width: "15%" },
|
||||||
|
{ field: 'transactionDate', name: 'Transaction Date', cellFilter: "date:'shortDate'", width: "10%" },
|
||||||
{ field: 'previousQuantity', name: 'Prev Qty', width: "10%", enableSorting: false },
|
{ field: 'previousQuantity', name: 'Prev Qty', width: "10%", enableSorting: false },
|
||||||
{ field: 'addedQuantity', name: 'Add Qty', width: "10%", enableSorting: false, cellFilter: "hideZero" },
|
{ field: 'addedQuantity', name: 'Add Qty', width: "10%", enableSorting: false, cellFilter: "hideZero" },
|
||||||
{ field: 'removedQuantity', name: 'Remove Qty', width: "10%", enableSorting: false, cellFilter: "hideZero" },
|
{ field: 'removedQuantity', name: 'Remove Qty', width: "10%", enableSorting: false, cellFilter: "hideZero" },
|
||||||
{ field: 'currentQuantity', name: 'Current Qty', width: "15%", enableSorting: false }
|
{ field: 'currentQuantity', name: 'Current Qty', width: "10%", enableSorting: false }
|
||||||
],
|
],
|
||||||
onRegisterApi: function(gridApi) {
|
onRegisterApi: function(gridApi) {
|
||||||
vm.gridApi = gridApi;
|
vm.gridApi = gridApi;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
window.app.directive('errorList', errorList);
|
||||||
|
function errorList() {
|
||||||
|
return {
|
||||||
|
scope: {
|
||||||
|
errors: "=",
|
||||||
|
editMsg: "="
|
||||||
|
},
|
||||||
|
templateUrl: '/utility/template/errorList.tmpl.cshtml',
|
||||||
|
controller: controller,
|
||||||
|
controllerAs: 'vm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.$inject = ['$scope'];
|
||||||
|
function controller($scope) {
|
||||||
|
var vm = this;
|
||||||
|
vm.errors = $scope.errors;
|
||||||
|
vm.editMsg = $scope.editMsg;
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
window.app.directive('statusMessage', statusMessage);
|
||||||
|
function statusMessage() {
|
||||||
|
return {
|
||||||
|
scope: {
|
||||||
|
message: "=",
|
||||||
|
severity: "=?"
|
||||||
|
},
|
||||||
|
templateUrl: '/utility/template/statusMessage.tmpl.cshtml',
|
||||||
|
controller: controller,
|
||||||
|
controllerAs: 'vm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.$inject = ['$scope'];
|
||||||
|
function controller($scope) {
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<div class="alert alert-danger" ng-show="vm.errors.length">
|
||||||
|
Correct the following issues.
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="error in vm.errors">{{error}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="alert alert-{{angular.isDefined(severity) ? severity : 'info'}}" ng-show="message">
|
||||||
|
{{message}}
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user