Box modifications

This commit is contained in:
2016-10-18 11:10:01 -04:00
parent 3caf0bd766
commit fdc34c4ef7
109 changed files with 11033 additions and 2442 deletions
@@ -1,13 +0,0 @@
using System;
namespace InventoryTraker.Web.Models
{
public class DistributionReport
{
public TransactionViewModel[] Transactions;
public string Destination { get; set; }
public DateTime Date { get; set; }
}
}
+11 -8
View File
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using AutoMapper;
using InventoryTraker.Web.Core;
@@ -8,17 +7,20 @@ namespace InventoryTraker.Web.Models
{
public class InventoryAddForm
{
[HiddenInput(DisplayValue = false)]
[Required]
public int InventoryTypeId { get; set; }
public string Id { get; set; }
[Required]
public DateTime ExpirationDate { get; set; }
public string ProgramName { get; set; }
[Required, Range(1, int.MaxValue, ErrorMessage = "Quantity must be greater than 0")]
public int Quantity { get; set; }
public string ProgramSubtype { get; set; }
[Required, Display(Name = "Arrival Date")]
public string Description { get; set; }
[Required]
public DateTime ShredReadyDate { get; set; }
[Required]
public DateTime AddedDate { get; set; }
public string Memo { get; set; }
@@ -27,7 +29,8 @@ namespace InventoryTraker.Web.Models
{
public AutoMapperProfile()
{
CreateMap<InventoryAddForm, Inventory>();
CreateMap<InventoryAddForm, Inventory>()
.AfterMap((form, inventory) => { inventory.Quantity = 1; });
}
}
}
@@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace InventoryTraker.Web.Models
{
public class InventoryDistributeForm
{
public IList<InventoryQuantityForm> InventoryQuantities { get; set; }
[Required]
public string Destination { get; set; }
[Required, Display(Name = "Distributed Date")]
public DateTime DistributedDate { get; set; }
public string Memo { get; set; }
}
}
@@ -5,7 +5,7 @@ namespace InventoryTraker.Web.Models
public class InventoryQuantityForm
{
[Required]
public int InventoryId { get; set; }
public string InventoryId { get; set; }
[Required, Range(1, int.MaxValue, ErrorMessage = "Quantity must be greater than 0")]
public int Quantity { get; set; }
@@ -7,7 +7,7 @@ namespace InventoryTraker.Web.Models
public class InventoryRemoveForm
{
[Required]
public int InventoryId { get; set; }
public string InventoryId { get; set; }
[Required, Range(1, int.MaxValue, ErrorMessage = "Quantity must be greater than 0")]
public int Quantity { get; set; }
@@ -1,46 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using AutoMapper;
using InventoryTraker.Web.Core;
namespace InventoryTraker.Web.Models
{
public class InventoryTypeViewModel
{
[HiddenInput]
public int Id { get; set; }
[Required]
public string Identifier { get; set; }
[Required]
public string Name { get; set; }
[Required]
public int UnitsPerCase { get; set; }
[Required]
public string ContainerType { get; set; }
[HiddenInput]
public string UnitsPerCaseContainerType
{
get { return $"{UnitsPerCase} / {ContainerType}"; }
}
[Required]
public double WeightPerCase { get; set; }
[Required]
public decimal PricePerCase { get; set; }
public class AutoMapperProfile : Profile
{
public AutoMapperProfile()
{
CreateMap<InventoryType, InventoryTypeViewModel>();
CreateMap<InventoryTypeViewModel, InventoryType>();
}
}
}
}
@@ -6,42 +6,27 @@ namespace InventoryTraker.Web.Models
{
public class InventoryViewModel
{
public int Id { get; set; }
public string Id { get; set; }
public int InventoryTypeId { get; set; }
public string Name { get; set; }
public int UnitsPerCase { get; set; }
public string ContainerType { get; set; }
public double WeightPerCase { get; set; }
public decimal PricePerCase { get; set; }
public int Quantity { get; set; }
public DateTime ExpirationDate { get; set; }
public DateTime ShredReadyDate { get; set; }
public DateTime AddedDate { get; set; }
public int Quantity { get; set; }
public string Memo { get; set; }
public bool IsExpired => ExpirationDate < DateTime.Today;
public string ProgramName { get; set; }
public string ProgramSubtype { get; set; }
public string Description { get; set; }
public class AutoMapperProfile : Profile
{
public AutoMapperProfile()
{
CreateMap<Inventory, InventoryViewModel>()
.ForMember(d => d.InventoryTypeId, opt => opt.MapFrom(s => s.InventoryType.Id))
.ForMember(d => d.Name, opt => opt.MapFrom(s => s.InventoryType.Name))
.ForMember(d => d.UnitsPerCase, opt => opt.MapFrom(s => s.InventoryType.UnitsPerCase))
.ForMember(d => d.ContainerType, opt => opt.MapFrom(s => s.InventoryType.ContainerType))
.ForMember(d => d.WeightPerCase, opt => opt.MapFrom(s => s.InventoryType.WeightPerCase))
.ForMember(d => d.PricePerCase, opt => opt.MapFrom(s => s.InventoryType.PricePerCase))
.ForMember(d => d.AddedDate, opt => opt.MapFrom(s => s.AddedDate));
CreateMap<Inventory, InventoryViewModel>();
}
}
}
@@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
namespace InventoryTraker.Web.Models
{
public class MovementReport
{
public DateTime Month { get; set; }
public IEnumerable<MovementReportItem> Items { get; set; }
}
}
@@ -1,13 +0,0 @@
namespace InventoryTraker.Web.Models
{
public class MovementReportItem
{
public InventoryTypeViewModel InventoryType { get; set; }
public int BeginningQuantity { get; set; }
public int AddedQuantity { get; set; }
public int TotalAvailableQuantity { get; set; }
public int DistributedQuantity { get; set; }
public int AdjustmentQuantity { get; set; }
public int EndingQuantity { get; set; }
}
}
@@ -7,16 +7,19 @@ namespace InventoryTraker.Web.Models
{
public class TransactionViewModel
{
[Required]
public int Id { get; set; }
public int InventoryId { get; set; }
public string Name { get; set; }
public int UnitsPerCase { get; set; }
public string ContainerType { get; set; }
public DateTime ExpirationDate { get; set; }
public string InventoryId { get; set; }
public string ProgramName { get; set; }
public string ProgramSubtype { get; set; }
public string Description { get; set; }
public DateTime ShredReadyDate { get; set; }
public DateTime AddedDate { get; set; }
public double WeightPerCase { get; set; }
public string TransactionType { get; set; }
@@ -32,8 +35,6 @@ namespace InventoryTraker.Web.Models
public string Memo { get; set; }
public string Destination { get; set; }
public DateTime Timestamp { get; set; }
public class AutoMapperProfile : Profile
@@ -43,18 +44,16 @@ namespace InventoryTraker.Web.Models
CreateMap<Transaction, TransactionViewModel>()
.ForMember(d => d.InventoryId,
opt => opt.MapFrom(s => s.Inventory.Id))
.ForMember(d => d.Name,
opt => opt.MapFrom(s => s.Inventory.InventoryType.Name))
.ForMember(d => d.ExpirationDate,
opt => opt.MapFrom(s => s.Inventory.ExpirationDate))
.ForMember(d => d.ProgramName,
opt => opt.MapFrom(s => s.Inventory.ProgramName))
.ForMember(d => d.ProgramSubtype,
opt => opt.MapFrom(s => s.Inventory.ProgramSubtype))
.ForMember(d => d.Description,
opt => opt.MapFrom(s => s.Inventory.Description))
.ForMember(d => d.ShredReadyDate,
opt => opt.MapFrom(s => s.Inventory.ShredReadyDate))
.ForMember(d => d.AddedDate,
opt => opt.MapFrom(s => s.Inventory.AddedDate))
.ForMember(d => d.UnitsPerCase,
opt => opt.MapFrom(s => s.Inventory.InventoryType.UnitsPerCase))
.ForMember(d => d.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,
opt => opt.MapFrom(s => s.TransactionType.ToString()))
.ForMember(d => d.PreviousQuantity,