StockMovementShell.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. using System;
  2. using System.IO;
  3. using System.Transactions;
  4. using Comal.Classes;
  5. using InABox.Mobile;
  6. using Xamarin.Forms;
  7. namespace PRS.Mobile
  8. {
  9. public class StockMovementShell : Shell<StockMovementModel, StockMovement>
  10. {
  11. protected override void ConfigureColumns(ShellColumns<StockMovementModel, StockMovement> columns)
  12. {
  13. columns
  14. .Map(nameof(ProductID), x => x.Product.ID)
  15. .Map(nameof(ProductCode), x => x.Product.Code)
  16. .Map(nameof(ProductName), x => x.Product.Name)
  17. .Map(nameof(JobID), x => x.Job.ID)
  18. .Map(nameof(JobNumber), x => x.Job.JobNumber)
  19. .Map(nameof(JobName), x => x.Job.Name)
  20. .Map(nameof(LocationID), x => x.Location.ID)
  21. .Map(nameof(LocationCode), x => x.Location.Code)
  22. .Map(nameof(LocationDescription), x => x.Location.Description)
  23. .Map(nameof(LocationAreaID), x => x.Location.Area.ID)
  24. .Map(nameof(LocationAreaCode), x => x.Location.Area.Code)
  25. .Map(nameof(LocationAreaDescription), x => x.Location.Area.Description)
  26. .Map(nameof(StyleID), x => x.Style.ID)
  27. .Map(nameof(StyleCode), x => x.Style.Code)
  28. .Map(nameof(StyleDescription), x => x.Style.Description)
  29. .Map(nameof(RequisitionItemID), x=>x.JobRequisitionItem.ID)
  30. .Map(nameof(Received), x => x.Received)
  31. .Map(nameof(Issued), x => x.Issued)
  32. .Map(nameof(Date), x => x.Date)
  33. .Map(nameof(TransactionID), x => x.Transaction)
  34. .Map(nameof(BatchID), x=>x.Batch.ID)
  35. .Map(nameof(EmployeeID), x=>x.Employee.ID)
  36. .Map(nameof(Type), x=>x.Type)
  37. .Map(nameof(Notes), x=>x.Notes)
  38. .Map(nameof(DimensionsUnitID), x => x.Dimensions.Unit.ID)
  39. .Map(nameof(DimensionsQuantity), x => x.Dimensions.Quantity)
  40. .Map(nameof(DimensionsLength), x => x.Dimensions.Length)
  41. .Map(nameof(DimensionsHeight), x => x.Dimensions.Height)
  42. .Map(nameof(DimensionsWeight), x => x.Dimensions.Weight)
  43. .Map(nameof(DimensionsWidth), x => x.Dimensions.Width)
  44. .Map(nameof(DimensionsValue), x => x.Dimensions.Value)
  45. .Map(nameof(DimensionsUnitSize), x => x.Dimensions.UnitSize)
  46. .Map(nameof(Cost), x => x.Cost)
  47. .Map(nameof(Balance), x => x.Balance)
  48. ;
  49. }
  50. public Guid ProductID
  51. {
  52. get => Get<Guid>();
  53. set => Set(value);
  54. }
  55. public String ProductCode => Get<String>();
  56. public String ProductName => Get<String>();
  57. public Guid JobID
  58. {
  59. get => Get<Guid>();
  60. set => Set(value);
  61. }
  62. public String JobNumber => Get<String>();
  63. public String JobName => Get<String>();
  64. public Guid LocationID
  65. {
  66. get => Get<Guid>();
  67. set => Set(value);
  68. }
  69. public String LocationCode => Get<String>();
  70. public String LocationDescription => Get<String>();
  71. public Guid LocationAreaID => Get<Guid>();
  72. public String LocationAreaCode => Get<String>();
  73. public String LocationAreaDescription => Get<String>();
  74. public Guid StyleID
  75. {
  76. get => Get<Guid>();
  77. set => Set(value);
  78. }
  79. public String StyleCode => Get<String>();
  80. public String StyleDescription => Get<String>();
  81. public Guid RequisitionItemID
  82. {
  83. get => Get<Guid>();
  84. set => Set(value);
  85. }
  86. public Guid DimensionsUnitID
  87. {
  88. get => Get<Guid>();
  89. set => Set(value);
  90. }
  91. public double DimensionsQuantity
  92. {
  93. get => Get<double>();
  94. set => Set(value);
  95. }
  96. public double DimensionsLength
  97. {
  98. get => Get<double>();
  99. set => Set(value);
  100. }
  101. public double DimensionsWidth
  102. {
  103. get => Get<double>();
  104. set => Set(value);
  105. }
  106. public double DimensionsHeight
  107. {
  108. get => Get<double>();
  109. set => Set(value);
  110. }
  111. public double DimensionsWeight
  112. {
  113. get => Get<double>();
  114. set => Set(value);
  115. }
  116. public double DimensionsValue
  117. {
  118. get => Get<double>();
  119. set => Set(value);
  120. }
  121. public string DimensionsUnitSize
  122. {
  123. get => Get<string>();
  124. set => Set(value);
  125. }
  126. public Guid TransactionID
  127. {
  128. get => Get<Guid>();
  129. set => Set(value);
  130. }
  131. public Guid BatchID
  132. {
  133. get => Get<Guid>();
  134. set => Set(value);
  135. }
  136. public ImageSource Image => Type switch
  137. {
  138. StockMovementType.StockTake => ImageSource.FromFile("stock_stocktake"), // tick
  139. StockMovementType.Issue => ImageSource.FromFile("stock_issue"), //minus
  140. StockMovementType.Receive => ImageSource.FromFile("stock_receive"), //plus
  141. _ => ImageSource.FromFile("stock_relocate"), // transfer in/out
  142. };
  143. public Guid EmployeeID
  144. {
  145. get => Get<Guid>();
  146. set => Set(value);
  147. }
  148. public StockMovementType Type
  149. {
  150. get => Get<StockMovementType>();
  151. set => Set(value);
  152. }
  153. public DateTime Date
  154. {
  155. get => Get<DateTime>();
  156. set => Set(value);
  157. }
  158. public double Received
  159. {
  160. get => Get<double>();
  161. set => Set(value);
  162. }
  163. public double Issued
  164. {
  165. get => Get<double>();
  166. set => Set(value);
  167. }
  168. public double Units => Received - Issued;
  169. public double Qty => Units * DimensionsValue;
  170. public double Cost
  171. {
  172. get => Get<double>();
  173. set => Set(value);
  174. }
  175. public double Balance
  176. {
  177. get => Get<double>();
  178. set => Set(value);
  179. }
  180. public string Notes
  181. {
  182. get => Get<string>();
  183. set => Set(value);
  184. }
  185. }
  186. }