using System; using System.IO; using System.Transactions; using Comal.Classes; using InABox.Mobile; using Xamarin.Forms; namespace PRS.Mobile { public class StockMovementShell : Shell { protected override void ConfigureColumns(ShellColumns columns) { columns .Map(nameof(ProductID), x => x.Product.ID) .Map(nameof(ProductCode), x => x.Product.Code) .Map(nameof(ProductName), x => x.Product.Name) .Map(nameof(JobID), x => x.Job.ID) .Map(nameof(JobNumber), x => x.Job.JobNumber) .Map(nameof(JobName), x => x.Job.Name) .Map(nameof(LocationID), x => x.Location.ID) .Map(nameof(LocationCode), x => x.Location.Code) .Map(nameof(LocationDescription), x => x.Location.Description) .Map(nameof(LocationAreaID), x => x.Location.Area.ID) .Map(nameof(LocationAreaCode), x => x.Location.Area.Code) .Map(nameof(LocationAreaDescription), x => x.Location.Area.Description) .Map(nameof(StyleID), x => x.Style.ID) .Map(nameof(StyleCode), x => x.Style.Code) .Map(nameof(StyleDescription), x => x.Style.Description) .Map(nameof(RequisitionItemID), x=>x.JobRequisitionItem.ID) .Map(nameof(Received), x => x.Received) .Map(nameof(Issued), x => x.Issued) .Map(nameof(Date), x => x.Date) .Map(nameof(TransactionID), x => x.Transaction) .Map(nameof(BatchID), x=>x.Batch.ID) .Map(nameof(EmployeeID), x=>x.Employee.ID) .Map(nameof(Type), x=>x.Type) .Map(nameof(Notes), x=>x.Notes) .Map(nameof(DimensionsUnitID), x => x.Dimensions.Unit.ID) .Map(nameof(DimensionsQuantity), x => x.Dimensions.Quantity) .Map(nameof(DimensionsLength), x => x.Dimensions.Length) .Map(nameof(DimensionsHeight), x => x.Dimensions.Height) .Map(nameof(DimensionsWeight), x => x.Dimensions.Weight) .Map(nameof(DimensionsWidth), x => x.Dimensions.Width) .Map(nameof(DimensionsValue), x => x.Dimensions.Value) .Map(nameof(DimensionsUnitSize), x => x.Dimensions.UnitSize) .Map(nameof(Cost), x => x.Cost) .Map(nameof(Balance), x => x.Balance) ; } public Guid ProductID { get => Get(); set => Set(value); } public String ProductCode => Get(); public String ProductName => Get(); public Guid JobID { get => Get(); set => Set(value); } public String JobNumber => Get(); public String JobName => Get(); public Guid LocationID { get => Get(); set => Set(value); } public String LocationCode => Get(); public String LocationDescription => Get(); public Guid LocationAreaID => Get(); public String LocationAreaCode => Get(); public String LocationAreaDescription => Get(); public Guid StyleID { get => Get(); set => Set(value); } public String StyleCode => Get(); public String StyleDescription => Get(); public Guid RequisitionItemID { get => Get(); set => Set(value); } public Guid DimensionsUnitID { get => Get(); set => Set(value); } public double DimensionsQuantity { get => Get(); set => Set(value); } public double DimensionsLength { get => Get(); set => Set(value); } public double DimensionsWidth { get => Get(); set => Set(value); } public double DimensionsHeight { get => Get(); set => Set(value); } public double DimensionsWeight { get => Get(); set => Set(value); } public double DimensionsValue { get => Get(); set => Set(value); } public string DimensionsUnitSize { get => Get(); set => Set(value); } public Guid TransactionID { get => Get(); set => Set(value); } public Guid BatchID { get => Get(); set => Set(value); } public ImageSource Image => Type switch { StockMovementType.StockTake => ImageSource.FromFile("stock_stocktake"), // tick StockMovementType.Issue => ImageSource.FromFile("stock_issue"), //minus StockMovementType.Receive => ImageSource.FromFile("stock_receive"), //plus _ => ImageSource.FromFile("stock_relocate"), // transfer in/out }; public Guid EmployeeID { get => Get(); set => Set(value); } public StockMovementType Type { get => Get(); set => Set(value); } public DateTime Date { get => Get(); set => Set(value); } public double Received { get => Get(); set => Set(value); } public double Issued { get => Get(); set => Set(value); } public double Units => Received - Issued; public double Qty => Units * DimensionsValue; public double Cost { get => Get(); set => Set(value); } public double Balance { get => Get(); set => Set(value); } public string Notes { get => Get(); set => Set(value); } } }