Receivals.xaml.cs 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using InABox.Core;
  7. using InABox.Clients;
  8. using Comal.Classes;
  9. using Xamarin.Forms;
  10. using Xamarin.Forms.Xaml;
  11. using XF.Material.Forms.UI.Dialogs;
  12. using Xamarin.Essentials;
  13. using System.IO;
  14. using PRSSecurity = InABox.Core.Security;
  15. namespace comal.timesheets
  16. {
  17. [XamlCompilation(XamlCompilationOptions.Compile)]
  18. public partial class Receivals : ContentPage
  19. {
  20. #region Fields & Constructor, OnAppearing
  21. Guid POID = Guid.Empty;
  22. List<POItemShell> poItemShells = new List<POItemShell>();
  23. List<StockLocationShell> stockLocationShells = new List<StockLocationShell>();
  24. bool bOpening = false;
  25. List<Guid> holdingsToLookup = new List<Guid>();
  26. string deviceType = "";
  27. Guid supplierID = Guid.Empty;
  28. string PONumber = "";
  29. Guid consignmentID = Guid.Empty;
  30. string consignmentNumber = "";
  31. List<POItemShell> listReceived = new List<POItemShell>();
  32. public Receivals(Guid _poID, string _PONumber, Guid _supplierID)
  33. {
  34. InitializeComponent();
  35. NavigationPage.SetHasBackButton(this, false);
  36. POID = _poID;
  37. PONumber = _PONumber;
  38. poNumberLbl.Text = "PO: " + _PONumber;
  39. var idiom = DeviceInfo.Idiom;
  40. if (idiom.Equals(DeviceIdiom.Tablet))
  41. {
  42. deviceType = "Tablet";
  43. }
  44. LoadPOItems();
  45. supplierID = _supplierID;
  46. AddIncomingStores();
  47. }
  48. protected override void OnAppearing()
  49. {
  50. base.OnAppearing();
  51. bOpening = false;
  52. }
  53. #endregion
  54. #region User Interaction
  55. private async void Exit_Clicked(object sender, EventArgs e)
  56. {
  57. if (listReceived.Count > 0)
  58. {
  59. DisplayAlert("Alert", "Consignment has items received and must be saved with photos before exiting", "OK");
  60. }
  61. else
  62. Navigation.PopAsync();
  63. }
  64. private async void Save_Clicked(object sender, EventArgs e)
  65. {
  66. ConsignmentCompletionPage completionPage = new ConsignmentCompletionPage(listReceived, consignmentID, consignmentNumber);
  67. completionPage.OnConsignmentSaved += () =>
  68. {
  69. Navigation.PopAsync();
  70. };
  71. Navigation.PushAsync(completionPage);
  72. }
  73. private void ConsignmentList_Tapped(object sender, EventArgs e)
  74. {
  75. if (bOpening)
  76. return;
  77. if (!PRSSecurity.IsAllowed<CanReceiveConsignments>())
  78. {
  79. DisplayAlert("Not allowed", "Please check security setting: Receive Consignments", "OK");
  80. return;
  81. }
  82. bOpening = true;
  83. POItemShell poItemShell = poItemListView.SelectedItem as POItemShell;
  84. if (poItemShell.Nonstock == true)
  85. {
  86. ChooseQtyNonStockItem(poItemShell);
  87. }
  88. else
  89. {
  90. ChooseQtyStockItem(poItemShell);
  91. }
  92. }
  93. private async void ChooseQtyStockItem(POItemShell poItemShell)
  94. {
  95. ConsignmentDetailsPopup popup = new ConsignmentDetailsPopup(poItemShell, stockLocationShells);
  96. popup.OnConsignmentPopupAccepted += async () =>
  97. {
  98. using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
  99. {
  100. poItemShell.StockLocationID = popup._POItemShell.StockLocationID;
  101. poItemShell.StockLocationCode = popup._POItemShell.StockLocationCode;
  102. poItemShell.StockLocationDescription = popup._POItemShell.StockLocationDescription;
  103. poItemShell.ReceivedQty = popup._POItemShell.ReceivedQty;
  104. StockLocationShell location = stockLocationShells.Find(x => x.ID.Equals(poItemShell.StockLocationID));
  105. if (location == null)
  106. {
  107. StockLocationShell newLocation = new StockLocationShell()
  108. {
  109. ID = poItemShell.StockLocationID,
  110. Code = poItemShell.StockLocationCode,
  111. Description = poItemShell.StockLocationDescription
  112. };
  113. stockLocationShells.Add(newLocation);
  114. }
  115. ChooseSavePathwayAsync(poItemShell);
  116. }
  117. };
  118. Navigation.PushAsync(popup);
  119. bOpening = false;
  120. }
  121. private async void ChooseQtyNonStockItem(POItemShell poItemShell)
  122. {
  123. Device.BeginInvokeOnMainThread(async () =>
  124. {
  125. //if nonstock item - only rec qty, otherwise open popup page
  126. string chosenOption = await DisplayPromptAsync("Enter Received Quantity", "", initialValue: poItemShell.ExpectedQty.ToString(), keyboard: Keyboard.Numeric);
  127. if (!string.IsNullOrEmpty(chosenOption) || chosenOption != "Cancel")
  128. {
  129. try
  130. {
  131. double qty = double.Parse(chosenOption);
  132. poItemShell.ReceivedQty = qty;
  133. }
  134. catch
  135. {
  136. DisplayAlert("Error", "Invalid Qty", "OK");
  137. bOpening = false;
  138. return;
  139. }
  140. bOpening = false;
  141. ChooseSavePathwayAsync(poItemShell);
  142. }
  143. else
  144. bOpening = false;
  145. });
  146. }
  147. private void SearchEnt_Changed(object sender, EventArgs e)
  148. {
  149. if (string.IsNullOrWhiteSpace(searchEnt.Text))
  150. {
  151. poItemListView.ItemsSource = poItemShells;
  152. }
  153. else
  154. {
  155. poItemListView.ItemsSource = poItemShells.Where(x =>
  156. x.Description.Contains(searchEnt.Text) || x.Description.Contains(UpperCaseFirst(searchEnt.Text)) || x.Description.Contains(LowerCaseFirst(searchEnt.Text))
  157. || x.Description.Contains(searchEnt.Text.ToUpper()) || x.Description.Contains(searchEnt.Text.ToLower()) ||
  158. x.ExpectedQty.ToString().Contains(searchEnt.Text)
  159. );
  160. }
  161. }
  162. static String UpperCaseFirst(string s)
  163. {
  164. char[] a = s.ToCharArray();
  165. a[0] = char.ToUpper(a[0]);
  166. return new string(a);
  167. }
  168. static String LowerCaseFirst(string s)
  169. {
  170. char[] a = s.ToCharArray();
  171. a[0] = char.ToLower(a[0]);
  172. return new string(a);
  173. }
  174. #endregion
  175. #region Saving
  176. private async Task ChooseSavePathwayAsync(POItemShell poItemShell)
  177. {
  178. if (consignmentID == Guid.Empty)
  179. await CreateNewConsignment();
  180. if (poItemShell.ReceivedQty == poItemShell.ExpectedQty)
  181. {
  182. SaveCorrectQuantityPOItem(poItemShell);
  183. }
  184. else if (poItemShell.ReceivedQty < poItemShell.ExpectedQty && poItemShell.ReceivedQty != 0)
  185. {
  186. SaveLesserQuantityPOItem(poItemShell);
  187. }
  188. else if (poItemShell.ReceivedQty > poItemShell.ExpectedQty)
  189. {
  190. SaveExtraQuantityPOItem(poItemShell);
  191. }
  192. }
  193. private async void SaveCorrectQuantityPOItem(POItemShell poItemShell)
  194. {
  195. await Task.Run(() =>
  196. {
  197. poItemShell.ReceivedQty = poItemShell.ExpectedQty;
  198. poItemShell.ReceivedDate = DateTime.Now;
  199. poItemShell.ConsignmentID = consignmentID;
  200. poItemShell.ConsignmentNumber = consignmentNumber;
  201. SavePOItem(poItemShell);
  202. int index = poItemShells.FindIndex(x => x.ID.Equals(poItemShell.ID));
  203. poItemShells.RemoveAt(index);
  204. RefreshLists(poItemShell);
  205. });
  206. }
  207. private void SavePOItem(POItemShell poItemShell)
  208. {
  209. Task.Run(() =>
  210. {
  211. listReceived.Add(poItemShell);
  212. PurchaseOrderItem purchaseOrderItem = new PurchaseOrderItem();
  213. purchaseOrderItem.Description = poItemShell.Description;
  214. purchaseOrderItem.ID = poItemShell.ID;
  215. purchaseOrderItem.Qty = poItemShell.ReceivedQty;
  216. purchaseOrderItem.ReceivedDate = DateTime.Now;
  217. purchaseOrderItem.Consignment.ID = consignmentID;
  218. purchaseOrderItem.PurchaseOrderLink.PONumber = poItemShell.PONumber;
  219. purchaseOrderItem.PurchaseOrderLink.ID = poItemShell.POID;
  220. purchaseOrderItem = CopyDetails(purchaseOrderItem, poItemShell);
  221. new Client<PurchaseOrderItem>().Save(purchaseOrderItem, "Updated from mobile device");
  222. });
  223. }
  224. private void RefreshLists(POItemShell poItemShell)
  225. {
  226. Device.BeginInvokeOnMainThread(() =>
  227. {
  228. poItemListView.ItemsSource = null;
  229. poItemListView.ItemsSource = poItemShells;
  230. poItemCountLbl.Text = "Items Unreceived: " + poItemShells.Count;
  231. if (poItemShell.StockLocationID != Guid.Empty)
  232. {
  233. StockLocationShell location = stockLocationShells.Find(x => x.ID.Equals(poItemShell.StockLocationID));
  234. location.PoItems.Add(poItemShell);
  235. location.NumberOfReceivedItems = "Received items: " + location.PoItems.Count;
  236. locationsStackLayout.Children.Clear();
  237. foreach (StockLocationShell shell in stockLocationShells)
  238. {
  239. StockLocationViewCell viewcell = new StockLocationViewCell(shell);
  240. locationsStackLayout.Children.Add(viewcell);
  241. }
  242. }
  243. });
  244. }
  245. private async void SaveLesserQuantityPOItem(POItemShell poItemShell)
  246. {
  247. using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
  248. {
  249. try
  250. {
  251. string originalDescription = poItemShell.Description;
  252. int index = poItemShells.FindIndex(x => x.ID.Equals(poItemShell.ID));
  253. poItemShells.RemoveAt(index);
  254. //placeholder added while all the loading / saving happens - to be replaced later when new purchaseorderitem ID is returned
  255. POItemShell placeHolderShell = poItemShell.DuplicateNewShell(poItemShell);
  256. placeHolderShell.ExpectedQty = poItemShell.ExpectedQty - poItemShell.ReceivedQty;
  257. poItemShells.Insert(index, placeHolderShell);
  258. SavePOItem(poItemShell); //original POItem is saved
  259. CoreTable table = new Client<PurchaseOrderItem>().Query(new Filter<PurchaseOrderItem>(x => x.ID).IsEqualTo(poItemShell.ID),
  260. columns);
  261. PurchaseOrderItem purchaseOrderItem = table.Rows.FirstOrDefault()?.ToObject<PurchaseOrderItem>();
  262. if (purchaseOrderItem == null)
  263. return;
  264. purchaseOrderItem.ID = Guid.Empty;
  265. purchaseOrderItem.Created = DateTime.Now;
  266. purchaseOrderItem.LastUpdate = DateTime.Now;
  267. purchaseOrderItem.OriginalValues.Remove("ID", out object obj);
  268. purchaseOrderItem.ReceivedDate = DateTime.MinValue;
  269. purchaseOrderItem.Qty = poItemShell.ExpectedQty - poItemShell.ReceivedQty;
  270. purchaseOrderItem.Description = originalDescription;
  271. purchaseOrderItem.Consignment.ID = Guid.Empty;
  272. purchaseOrderItem = CopyDetails(purchaseOrderItem, poItemShell);
  273. new Client<PurchaseOrderItem>().Save(purchaseOrderItem, "Update from mobile device");
  274. //new purchase order is split from original with different quantity and no consignment linked, saved to database
  275. POItemShell newShell = poItemShell.DuplicateNewShell(poItemShell);
  276. newShell.ID = purchaseOrderItem.ID;
  277. newShell.Description = purchaseOrderItem.Description;
  278. newShell.ExpectedQty = purchaseOrderItem.Qty;
  279. newShell.ConsignmentID = Guid.Empty;
  280. newShell.ConsignmentNumber = "";
  281. //placeholder is replaced by new shell with correct ID
  282. poItemShells.RemoveAt(index);
  283. poItemShells.Insert(index, newShell);
  284. RefreshLists(poItemShell);
  285. }
  286. catch { }
  287. }
  288. }
  289. private async void SaveExtraQuantityPOItem(POItemShell poItemShell)
  290. {
  291. await Task.Run(() =>
  292. {
  293. try
  294. {
  295. string originalDescription = poItemShell.Description;
  296. double originalExpectedQty = poItemShell.ExpectedQty;
  297. double originalReceivedQty = poItemShell.ReceivedQty;
  298. double extraSupplied = originalReceivedQty - originalExpectedQty;
  299. int index = poItemShells.FindIndex(x => x.ID.Equals(poItemShell.ID));
  300. poItemShells.RemoveAt(index);
  301. poItemShell.ReceivedDate = DateTime.Now;
  302. poItemShell.ConsignmentID = consignmentID;
  303. poItemShell.ConsignmentNumber = consignmentNumber;
  304. poItemShell.ReceivedQty = poItemShell.ExpectedQty;
  305. SavePOItem(poItemShell);
  306. RefreshLists(poItemShell);
  307. listReceived.Add(poItemShell);
  308. //for responsive view only
  309. POItemShell newShell = poItemShell.DuplicateNewShell(poItemShell);
  310. newShell.ReceivedQty = extraSupplied;
  311. newShell.ExpectedQty = extraSupplied;
  312. RefreshLists(newShell);
  313. listReceived.Add(newShell);
  314. CoreTable table = new Client<PurchaseOrderItem>().Query(new Filter<PurchaseOrderItem>(x => x.ID).IsEqualTo(poItemShell.ID)
  315. , columns);
  316. PurchaseOrderItem newPurchaseOrderItem = table.Rows.FirstOrDefault().ToObject<PurchaseOrderItem>();
  317. if (newPurchaseOrderItem == null)
  318. return;
  319. newPurchaseOrderItem.ReceivedDate = DateTime.Now;
  320. newPurchaseOrderItem.ID = Guid.Empty;
  321. newPurchaseOrderItem.Created = DateTime.Now;
  322. newPurchaseOrderItem.LastUpdate = DateTime.Now;
  323. newPurchaseOrderItem.OriginalValues.Remove("ID", out object obj);
  324. newPurchaseOrderItem.Qty = extraSupplied;
  325. newPurchaseOrderItem.Description = newShell.Description;
  326. newPurchaseOrderItem.Consignment.ID = consignmentID;
  327. newPurchaseOrderItem = CopyDetails(newPurchaseOrderItem, poItemShell);
  328. new Client<PurchaseOrderItem>().Save(newPurchaseOrderItem, "Update from mobile device");
  329. //new purchase order is split from original with different quantity, and consignment linked, saved to database
  330. }
  331. catch
  332. { }
  333. });
  334. }
  335. private PurchaseOrderItem CopyDetails(PurchaseOrderItem purchaseOrderItem, POItemShell poItemShell)
  336. {
  337. purchaseOrderItem.Product.ID = poItemShell.ProductID;
  338. purchaseOrderItem.Product.NonStock = poItemShell.Nonstock;
  339. purchaseOrderItem.Job.ID = poItemShell.JobID;
  340. purchaseOrderItem.Job.JobNumber = poItemShell.JobNumber;
  341. purchaseOrderItem.Job.Name = poItemShell.JobName;
  342. purchaseOrderItem.Style.ID = poItemShell.StyleID;
  343. purchaseOrderItem.Style.Code = poItemShell.StyleCode;
  344. purchaseOrderItem.Style.Description = poItemShell.StyleDescription;
  345. purchaseOrderItem.StockLocation.ID = poItemShell.StockLocationID;
  346. purchaseOrderItem.StockLocation.Description = poItemShell.StockLocationDescription;
  347. purchaseOrderItem.StockLocation.Code = poItemShell.StockLocationCode;
  348. purchaseOrderItem.Dimensions.Unit.ID = poItemShell.DimensionsUnitID;
  349. purchaseOrderItem.Dimensions.Quantity = poItemShell.DimensionsQuantity;
  350. purchaseOrderItem.Dimensions.Length = poItemShell.DimensionsLength;
  351. purchaseOrderItem.Dimensions.Width = poItemShell.DimensionsWidth;
  352. purchaseOrderItem.Dimensions.Height = poItemShell.DimensionsHeight;
  353. purchaseOrderItem.Dimensions.Weight = poItemShell.DimensionsWeight;
  354. purchaseOrderItem.Cost = poItemShell.Cost;
  355. purchaseOrderItem.Dimensions.Unit.HasHeight = poItemShell.DimensionsHasHeight;
  356. purchaseOrderItem.Dimensions.Unit.HasLength = poItemShell.DimensionsHasLength;
  357. purchaseOrderItem.Dimensions.Unit.HasWidth = poItemShell.DimensionsHasWidth;
  358. purchaseOrderItem.Dimensions.Unit.HasWeight = poItemShell.DimensionsHasWeight;
  359. purchaseOrderItem.Dimensions.Unit.HasQuantity = poItemShell.DimensionsHasQuantity;
  360. purchaseOrderItem.Dimensions.Unit.Formula = poItemShell.DimensionsUnitFormula;
  361. purchaseOrderItem.Dimensions.Unit.Format = poItemShell.DimensionsUnitFormat;
  362. purchaseOrderItem.Dimensions.Unit.Code = poItemShell.DimensionsUnitCode;
  363. purchaseOrderItem.Dimensions.Unit.Description = poItemShell.DimensionsUnitDescription;
  364. purchaseOrderItem.Dimensions.UnitSize = poItemShell.DimensionsUnitSize;
  365. purchaseOrderItem.Dimensions.Value = poItemShell.DimensionsValue;
  366. return purchaseOrderItem;
  367. }
  368. #region ChoosingLocations
  369. private async void ChooseReceivingLocationBtn_Clicked(object sender, EventArgs e)
  370. {
  371. string chosenOption = await DisplayActionSheet("Choose an Option", "Cancel", null, "New Location / Pack", "Existing Location / Pack");
  372. switch (chosenOption)
  373. {
  374. case "Cancel":
  375. return;
  376. break;
  377. case "New Location / Pack":
  378. ChooseNewLocation();
  379. break;
  380. case "Existing Location / Pack":
  381. ChooseReceivingLocation();
  382. break;
  383. default:
  384. return;
  385. break;
  386. }
  387. }
  388. private void ChooseNewLocation()
  389. {
  390. try
  391. {
  392. StockLocation location = new StockLocation();
  393. location.Active = true;
  394. location.Warehouse.ID = Guid.Parse("b6249c4a-a834-4927-a42c-87a07895d6bd"); //EXTRUSIONS
  395. location.Warehouse.Description = "Extrusions";
  396. location.Warehouse.Code = "EXTRUSIONS";
  397. location.Area.Warehouse.ID = Guid.Parse("b6249c4a-a834-4927-a42c-87a07895d6bd"); //EXTRUSIONS
  398. location.Area.Warehouse.Description = "Extrusions";
  399. location.Area.ID = Guid.Parse("fa02ecd8-e642-49aa-98b5-c04d7ea0f4eb"); //Rack FLOOR
  400. location.Area.Description = "Rack FLOOR";
  401. location.Area.Code = "FLOOR";
  402. LocationDetailsPage locationDetailsPage = new LocationDetailsPage(location);
  403. locationDetailsPage.OnSave += (o, loc) =>
  404. {
  405. if (String.IsNullOrWhiteSpace(loc.Code))
  406. {
  407. MaterialDialog.Instance.AlertAsync(message: "Code may not be blank!");
  408. return false;
  409. }
  410. if (String.IsNullOrWhiteSpace(loc.Description))
  411. {
  412. MaterialDialog.Instance.AlertAsync(message: "Description may not be blank!");
  413. return false;
  414. }
  415. if (loc.Area.ID == Guid.Empty)
  416. {
  417. MaterialDialog.Instance.AlertAsync(message: "Area may not be blank!");
  418. return false;
  419. }
  420. CoreTable others = new Client<StockLocation>().Query(
  421. new Filter<StockLocation>(x => x.Code).IsEqualTo(loc.Code).And(x => x.ID).IsNotEqualTo(loc.ID),
  422. new Columns<StockLocation>(x => x.ID)
  423. );
  424. if (others.Rows.Any())
  425. {
  426. MaterialDialog.Instance.AlertAsync(message: "Location Code already exists!");
  427. return false;
  428. }
  429. try
  430. {
  431. new Client<StockLocation>().Save(loc, "Created Location");
  432. StockLocationShell shell = new StockLocationShell();
  433. shell.ID = loc.ID;
  434. shell.Code = loc.Code;
  435. shell.Description = loc.Description;
  436. stockLocationShells.Add(shell);
  437. Device.BeginInvokeOnMainThread(() =>
  438. {
  439. locationsStackLayout.Children.Clear();
  440. foreach (StockLocationShell shell2 in stockLocationShells)
  441. {
  442. StockLocationViewCell viewcell = new StockLocationViewCell(shell2);
  443. viewcell.stockLocationShell.NumberOfReceivedItems = "Received items: " + shell2.PoItems.Count();
  444. locationsStackLayout.Children.Add(viewcell);
  445. }
  446. });
  447. }
  448. catch (Exception err)
  449. {
  450. MaterialDialog.Instance.AlertAsync(message: "Unable to save Location\n" + err.Message);
  451. return false;
  452. }
  453. return true;
  454. };
  455. Navigation.PushAsync(locationDetailsPage);
  456. }
  457. catch { }
  458. }
  459. private void ChooseReceivingLocation()
  460. {
  461. if (bOpening)
  462. return;
  463. bOpening = true;
  464. StockLocationSelectionPage stockLocationSelectionPage = new StockLocationSelectionPage(true);
  465. stockLocationSelectionPage.OnMultiLocationSelected += async (s) =>
  466. {
  467. using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
  468. {
  469. foreach (StockLocationShell shell in s)
  470. {
  471. if (!stockLocationShells.Any(x => x.ID == shell.ID))
  472. {
  473. shell.Color = Color.Default;
  474. shell.NumberOfReceivedItems = "Received items: " + shell.PoItems.Count();
  475. stockLocationShells.Add(shell);
  476. }
  477. }
  478. Device.BeginInvokeOnMainThread(() =>
  479. {
  480. locationsStackLayout.Children.Clear();
  481. foreach (StockLocationShell shell in stockLocationShells)
  482. {
  483. StockLocationViewCell viewcell = new StockLocationViewCell(shell);
  484. viewcell.stockLocationShell.NumberOfReceivedItems = "Received items: " + shell.PoItems.Count();
  485. locationsStackLayout.Children.Add(viewcell);
  486. }
  487. });
  488. }
  489. };
  490. Navigation.PushAsync(stockLocationSelectionPage);
  491. }
  492. #endregion
  493. #endregion
  494. #region Loading
  495. private void AddIncomingStores()
  496. {
  497. Task.Run(() =>
  498. {
  499. try
  500. {
  501. StockLocation location = new Client<StockLocation>().Query(
  502. new Filter<StockLocation>(x => x.ID).IsEqualTo(Guid.Parse("3ebb1fe3-21f4-4731-b80a-a28f814982ea")),
  503. new Columns<StockLocation>(x => x.ID, x => x.Code, x => x.Description))
  504. .Rows.FirstOrDefault().ToObject<StockLocation>();
  505. stockLocationShells.Add(new StockLocationShell
  506. {
  507. ID = location.ID,
  508. Code = location.Code,
  509. Description = location.Description,
  510. NumberOfReceivedItems = "Received items: ",
  511. });
  512. StockLocationViewCell viewcell = new StockLocationViewCell(stockLocationShells[0]);
  513. Device.BeginInvokeOnMainThread(() =>
  514. {
  515. locationsStackLayout.Children.Add(viewcell);
  516. });
  517. }
  518. catch { }
  519. });
  520. }
  521. private void LoadPOItems()
  522. {
  523. Task.Run(() =>
  524. {
  525. try
  526. {
  527. CoreTable table = new Client<PurchaseOrderItem>().Query(
  528. new Filter<PurchaseOrderItem>(x => x.PurchaseOrderLink.ID).IsEqualTo(POID).And(x => x.ReceivedDate).IsEqualTo(DateTime.MinValue),
  529. columns);
  530. if (table.Rows.Any())
  531. {
  532. foreach (CoreRow row in table.Rows)
  533. {
  534. POItemShell item = new POItemShell()
  535. {
  536. ID = row.Get<PurchaseOrderItem, Guid>(x => x.ID),
  537. PONumber = row.Get<PurchaseOrderItem, string>(x => x.PurchaseOrderLink.PONumber),
  538. ConsignmentNumber = "Cons: " + row.Get<PurchaseOrderItem, string>(x => x.Consignment.Number),
  539. JobName = row.Get<PurchaseOrderItem, string>(x => x.Job.Name),
  540. JobNumber = row.Get<PurchaseOrderItem, string>(x => x.Job.JobNumber),
  541. Description = row.Get<PurchaseOrderItem, string>(x => x.Description),
  542. ConsignmentID = row.Get<PurchaseOrderItem, Guid>(x => x.Consignment.ID),
  543. POID = row.Get<PurchaseOrderItem, Guid>(x => x.PurchaseOrderLink.ID),
  544. ReceivedDate = row.Get<PurchaseOrderItem, DateTime>(x => x.ReceivedDate),
  545. JobID = row.Get<PurchaseOrderItem, Guid>(x => x.Job.ID),
  546. SupplierCode = row.Get<PurchaseOrderItem, string>(x => x.SupplierCode),
  547. ProductID = row.Get<PurchaseOrderItem, Guid>(x => x.Product.ID),
  548. Nonstock = row.Get<PurchaseOrderItem, bool>(x => x.Product.NonStock),
  549. StyleID = row.Get<PurchaseOrderItem, Guid>(x => x.Style.ID),
  550. StyleCode = row.Get<PurchaseOrderItem, string>(x => x.Style.Code),
  551. StyleDescription = row.Get<PurchaseOrderItem, string>(x => x.Style.Description),
  552. StockLocationID = row.Get<PurchaseOrderItem, Guid>(x => x.Product.DefaultLocation.ID),
  553. StockLocationDescription = row.Get<PurchaseOrderItem, string>(x => x.Product.DefaultLocation.Description),
  554. StockLocationCode = row.Get<PurchaseOrderItem, string>(x => x.Product.DefaultLocation.Code),
  555. DimensionsUnitID = row.Get<PurchaseOrderItem, Guid>(x => x.Dimensions.Unit.ID),
  556. DimensionsQuantity = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Quantity),
  557. DimensionsLength = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Length),
  558. DimensionsWidth = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Width),
  559. DimensionsHeight = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Height),
  560. DimensionsWeight = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Weight),
  561. DimensionsValue = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Value),
  562. DimensionsUnitSize = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.UnitSize),
  563. Cost = row.Get<PurchaseOrderItem, double>(x => x.Cost),
  564. DimensionsHasHeight = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasHeight),
  565. DimensionsHasLength = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasLength),
  566. DimensionsHasWidth = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasWidth),
  567. DimensionsHasWeight = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasWeight),
  568. DimensionsHasQuantity = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasQuantity),
  569. DimensionsUnitFormula = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Formula),
  570. DimensionsUnitFormat = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Format),
  571. DimensionsUnitCode = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Code),
  572. DimensionsUnitDescription = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Description),
  573. ExpectedQty = row.Get<PurchaseOrderItem, double>(x => x.Qty),
  574. };
  575. if (string.IsNullOrWhiteSpace(item.DimensionsUnitSize) || item.DimensionsUnitID == Guid.Empty)
  576. item = TryFixPOItem(item, row);
  577. poItemShells.Add(item);
  578. }
  579. LoadProductImages();
  580. Device.BeginInvokeOnMainThread(() =>
  581. {
  582. poItemListView.ItemsSource = poItemShells;
  583. poItemCountLbl.Text = "Items Unreceived: " + poItemShells.Count;
  584. });
  585. }
  586. }
  587. catch (Exception ex)
  588. {
  589. Device.BeginInvokeOnMainThread(() => { DisplayAlert("Error loading Purchase Order items - please try again", ex.Message, "OK"); });
  590. }
  591. });
  592. }
  593. private void LoadProductImages()
  594. {
  595. Task.Run(() =>
  596. {
  597. foreach (POItemShell shell in poItemShells)
  598. {
  599. if (shell.ProductID != Guid.Empty)
  600. {
  601. CoreTable table = new Client<Product>().Query
  602. (
  603. new Filter<Product>(x => x.ID).IsEqualTo(shell.ProductID).And(x => x.Image.ID).IsNotEqualTo(Guid.Empty),
  604. new Columns<Product>(x => x.Image.ID)
  605. );
  606. CoreTable table1 = new Client<Document>().Query
  607. (
  608. new Filter<Document>(x => x.ID).IsEqualTo(Guid.Parse(table.Rows.First().Values[0].ToString())),
  609. new Columns<Document>(x => x.Data)
  610. );
  611. CoreRow docrow = table1.Rows.FirstOrDefault();
  612. if (docrow != null)
  613. {
  614. byte[] data = docrow.Get<Document, byte[]>(x => x.Data);
  615. ImageSource src = ImageSource.FromStream(() => new MemoryStream(data));
  616. if (src != null)
  617. {
  618. shell.ImageSource = src;
  619. shell.ImageVisible = true;
  620. if (deviceType == "Tablet")
  621. {
  622. shell.LastRowHeight = 300;
  623. }
  624. else
  625. {
  626. shell.LastRowHeight = 150;
  627. }
  628. Device.BeginInvokeOnMainThread(() =>
  629. {
  630. poItemListView.ItemsSource = null;
  631. poItemListView.ItemsSource = poItemShells;
  632. });
  633. }
  634. }
  635. }
  636. }
  637. });
  638. }
  639. private async Task CreateNewConsignment()
  640. {
  641. using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Creating new consignment"))
  642. {
  643. try
  644. {
  645. Consignment newConsignment = new Consignment() { };
  646. string name = "Unknown Supplier";
  647. if (supplierID != Guid.Empty)
  648. {
  649. newConsignment.Supplier.ID = supplierID;
  650. CoreTable supplierNameTable = new Client<Supplier>().Query(
  651. new Filter<Supplier>(x => x.ID).IsEqualTo(supplierID),
  652. new Columns<Supplier>(x => x.Name)
  653. );
  654. name = supplierNameTable.Rows.FirstOrDefault().Values[0].ToString();
  655. }
  656. newConsignment.Description = "Consignment for receival of items from " + name + ". Auto generated from mobile app by " + GlobalVariables.EmpName;
  657. CoreTable consignmentNumberTable = new Client<Consignment>().Query(
  658. new Filter<Consignment>(x => x.Number).Contains("APP").And(x => x.Created).IsGreaterThan(DateTime.Today.AddDays(-60)),
  659. new Columns<Consignment>(x => x.Number, x => x.Created),
  660. new SortOrder<Consignment>(x => x.Created));
  661. if (consignmentNumberTable.Rows.Any())
  662. {
  663. SetConsignmentNumber(newConsignment, consignmentNumberTable);
  664. }
  665. else
  666. {
  667. CoreTable consignmentNumberTable2 = new Client<Consignment>().Query(
  668. new Filter<Consignment>(x => x.Number).Contains("APP"),
  669. new Columns<Consignment>(x => x.Number, x => x.Created),
  670. new SortOrder<Consignment>(x => x.Created));
  671. if (consignmentNumberTable2.Rows.Any())
  672. {
  673. SetConsignmentNumber(newConsignment, consignmentNumberTable2);
  674. }
  675. else
  676. newConsignment.Number = "APP1" + " From PO: " + PONumber;
  677. }
  678. new Client<Consignment>().Save(newConsignment, "Updated from mobile device");
  679. consignmentID = newConsignment.ID;
  680. saveBtn.IsVisible = true;
  681. consignmentNumber = newConsignment.Number;
  682. consignmentNumberLbl.Text = "Consignment: " + newConsignment.Number;
  683. if (consignmentID == Guid.Empty)
  684. {
  685. DisplayAlert("Error", "Unable to create new consignment", "OK");
  686. Navigation.PopAsync();
  687. }
  688. }
  689. catch { }
  690. }
  691. }
  692. private Consignment SetConsignmentNumber(Consignment newConsignment, CoreTable table)
  693. {
  694. List<int> numbers = new List<int>();
  695. foreach (CoreRow row in table.Rows)
  696. {
  697. string number = row.Values[0].ToString();
  698. if (number.Contains(" From PO"))
  699. {
  700. int index = number.IndexOf(" From PO");
  701. string firstSubstring = number.Substring(0, index);
  702. string secondSubString = firstSubstring.Substring(3, firstSubstring.Length - 3);
  703. try
  704. {
  705. int i = int.Parse(secondSubString);
  706. numbers.Add(i);
  707. }
  708. catch { }
  709. }
  710. }
  711. numbers.Sort();
  712. int lastInt = numbers.Last();
  713. lastInt++;
  714. newConsignment.Number = "APP" + lastInt.ToString() + " From PO" + PONumber;
  715. return newConsignment;
  716. }
  717. Columns<PurchaseOrderItem> columns = new Columns<PurchaseOrderItem>(x => x.ID,
  718. x => x.PurchaseOrderLink.PONumber,
  719. x => x.Consignment.Number,
  720. x => x.Job.Name,
  721. x => x.Job.JobNumber,
  722. x => x.Description,
  723. x => x.Qty,
  724. x => x.Consignment.ID,
  725. x => x.PurchaseOrderLink.ID,
  726. x => x.ReceivedDate,
  727. x => x.Job.ID,
  728. x => x.SupplierCode,
  729. x => x.Product.ID,
  730. x => x.Product.NonStock,
  731. x => x.Style.ID,
  732. x => x.Style.Code,
  733. x => x.Style.Description,
  734. x => x.Product.DefaultLocation.ID,
  735. x => x.Product.DefaultLocation.Description,
  736. x => x.Product.DefaultLocation.Code,
  737. x => x.Dimensions.Unit.ID,
  738. x => x.Dimensions.Quantity,
  739. x => x.Dimensions.Length,
  740. x => x.Dimensions.Width,
  741. x => x.Dimensions.Height,
  742. x => x.Dimensions.Weight,
  743. x => x.Dimensions.Value,
  744. x => x.Dimensions.UnitSize,
  745. x => x.Cost,
  746. x => x.Dimensions.Unit.HasHeight,
  747. x => x.Dimensions.Unit.HasLength,
  748. x => x.Dimensions.Unit.HasWidth,
  749. x => x.Dimensions.Unit.HasWeight,
  750. x => x.Dimensions.Unit.HasQuantity,
  751. x => x.Dimensions.Unit.Formula,
  752. x => x.Dimensions.Unit.Format,
  753. x => x.Dimensions.Unit.Code,
  754. x => x.Dimensions.Unit.Description,
  755. x => x.Product.Dimensions.UnitSize,
  756. x => x.Product.Dimensions.Unit.ID,
  757. x => x.Product.Dimensions.Quantity,
  758. x => x.Product.Dimensions.Length,
  759. x => x.Product.Dimensions.Width,
  760. x => x.Product.Dimensions.Weight,
  761. x => x.Product.Dimensions.Height,
  762. x => x.Product.Dimensions.Value,
  763. x => x.Product.Dimensions.Unit.HasHeight,
  764. x => x.Product.Dimensions.Unit.HasLength,
  765. x => x.Product.Dimensions.Unit.HasWeight,
  766. x => x.Product.Dimensions.Unit.HasWidth,
  767. x => x.Product.Dimensions.Unit.HasQuantity,
  768. x => x.Product.Dimensions.Unit.Format,
  769. x => x.Product.Dimensions.Unit.Formula,
  770. x => x.Product.Dimensions.Unit.Code,
  771. x => x.Product.Dimensions.Unit.Description
  772. );
  773. private POItemShell TryFixPOItem(POItemShell item, CoreRow row)
  774. {
  775. PurchaseOrderItem poItem = row.ToObject<PurchaseOrderItem>();
  776. poItem.Dimensions.Quantity = poItem.Product.Dimensions.Quantity;
  777. poItem.Dimensions.Length = poItem.Product.Dimensions.Length;
  778. poItem.Dimensions.Width = poItem.Product.Dimensions.Width;
  779. poItem.Dimensions.Height = poItem.Product.Dimensions.Height;
  780. poItem.Dimensions.Weight = poItem.Product.Dimensions.Weight;
  781. poItem.Dimensions.Unit.ID = poItem.Product.Dimensions.Unit.ID;
  782. poItem.Dimensions.Unit.HasHeight = poItem.Product.Dimensions.Unit.HasHeight;
  783. poItem.Dimensions.Unit.HasLength = poItem.Product.Dimensions.Unit.HasLength;
  784. poItem.Dimensions.Unit.HasWidth = poItem.Product.Dimensions.Unit.HasWidth;
  785. poItem.Dimensions.Unit.HasWeight = poItem.Product.Dimensions.Unit.HasWeight;
  786. poItem.Dimensions.Unit.HasQuantity = poItem.Product.Dimensions.Unit.HasQuantity;
  787. poItem.Dimensions.Unit.Formula = poItem.Product.Dimensions.Unit.Formula;
  788. poItem.Dimensions.Unit.Code = poItem.Product.Dimensions.Unit.Code;
  789. poItem.Dimensions.Unit.Description = poItem.Product.Dimensions.Unit.Description;
  790. poItem.Dimensions.UnitSize = poItem.Product.Dimensions.UnitSize;
  791. poItem.Dimensions.Value = poItem.Product.Dimensions.Value;
  792. Task.Run(() => { new Client<PurchaseOrderItem>().Save(poItem, "Fix Dimensions on Receivals App"); });
  793. item.DimensionsQuantity = poItem.Dimensions.Quantity;
  794. item.DimensionsLength = poItem.Dimensions.Length;
  795. item.DimensionsWeight = poItem.Dimensions.Weight;
  796. item.DimensionsWidth = poItem.Dimensions.Width;
  797. item.DimensionsHeight = poItem.Dimensions.Height;
  798. item.DimensionsUnitID = poItem.Dimensions.Unit.ID;
  799. item.DimensionsHasHeight = poItem.Dimensions.Unit.HasHeight;
  800. item.DimensionsHasLength = poItem.Dimensions.Unit.HasLength;
  801. item.DimensionsHasWidth = poItem.Dimensions.Unit.HasWidth;
  802. item.DimensionsHasWeight = poItem.Dimensions.Unit.HasWeight;
  803. item.DimensionsHasQuantity = poItem.Dimensions.Unit.HasQuantity;
  804. item.DimensionsUnitFormula = poItem.Dimensions.Unit.Formula;
  805. item.DimensionsUnitFormat = poItem.Dimensions.Unit.Format;
  806. item.DimensionsUnitCode = poItem.Dimensions.Unit.Code;
  807. item.DimensionsUnitDescription = poItem.Dimensions.Unit.Description;
  808. item.DimensionsUnitSize = poItem.Dimensions.UnitSize;
  809. item.DimensionsValue = poItem.Dimensions.Value;
  810. return item;
  811. }
  812. }
  813. #endregion
  814. }
  815. #region Classes
  816. public class POItemShell
  817. {
  818. public Guid ID { get; set; }
  819. public string PONumber { get; set; }
  820. public string ConsignmentNumber { get; set; }
  821. public string Description { get; set; }
  822. public Guid ConsignmentID { get; set; }
  823. public Guid POID { get; set; }
  824. public double ExpectedQty { get; set; }
  825. public Color Color { get; set; }
  826. public double ReceivedQty { get; set; }
  827. public bool HasQAForm { get; set; }
  828. public bool IsReadyForQA { get; set; }
  829. public Color QATextColor { get; set; }
  830. public Color QABtnColor { get; set; }
  831. public Guid DigitalFormID { get; set; }
  832. public DateTime FormCompleted { get; set; }
  833. public DateTime ReceivedDate { get; set; }
  834. public string SupplierCode { get; set; }
  835. public Guid ProductID { get; set; }
  836. public bool Nonstock { get; set; }
  837. public Guid JobID { get; set; }
  838. public string JobName { get; set; }
  839. public string JobNumber { get; set; }
  840. public Guid StyleID { get; set; }
  841. public string StyleCode { get; set; }
  842. public string StyleDescription { get; set; }
  843. public Guid StockLocationID { get; set; }
  844. public string StockLocationDescription { get; set; }
  845. public string StockLocationCode { get; set; }
  846. public bool ImageVisible { get; set; }
  847. public ImageSource ImageSource { get; set; }
  848. public double LastRowHeight { get; set; }
  849. public double Cost { get; set; }
  850. public Guid DimensionsUnitID { get; set; }
  851. public double DimensionsQuantity { get; set; }
  852. public double DimensionsLength { get; set; }
  853. public double DimensionsWidth { get; set; }
  854. public double DimensionsHeight { get; set; }
  855. public double DimensionsWeight { get; set; }
  856. public double DimensionsValue { get; set; }
  857. public string DimensionsUnitSize { get; set; }
  858. public bool DimensionsHasHeight { get; set; }
  859. public bool DimensionsHasLength { get; set; }
  860. public bool DimensionsHasWidth { get; set; }
  861. public bool DimensionsHasWeight { get; set; }
  862. public bool DimensionsHasQuantity { get; set; }
  863. public string DimensionsUnitFormula { get; set; }
  864. public string DimensionsUnitFormat { get; set; }
  865. public string DimensionsUnitCode { get; set; }
  866. public string DimensionsUnitDescription { get; set; }
  867. public POItemShell()
  868. {
  869. ID = Guid.Empty;
  870. PONumber = string.Empty;
  871. ConsignmentNumber = string.Empty;
  872. JobID = Guid.Empty;
  873. JobName = string.Empty;
  874. JobNumber = string.Empty;
  875. Description = string.Empty;
  876. ConsignmentID = Guid.Empty;
  877. POID = Guid.Empty;
  878. ExpectedQty = 0;
  879. Color = Color.Default;
  880. ReceivedQty = 0;
  881. HasQAForm = false;
  882. IsReadyForQA = false;
  883. QATextColor = Color.LightGray;
  884. DigitalFormID = Guid.Empty;
  885. FormCompleted = DateTime.MinValue;
  886. ReceivedDate = DateTime.MinValue;
  887. SupplierCode = string.Empty;
  888. ProductID = Guid.Empty;
  889. Nonstock = false;
  890. StyleID = Guid.Empty;
  891. StyleCode = string.Empty;
  892. StyleDescription = string.Empty;
  893. StockLocationID = Guid.Empty;
  894. StockLocationCode = "";
  895. StockLocationDescription = "";
  896. ImageVisible = false;
  897. ImageSource = "";
  898. LastRowHeight = 0;
  899. DimensionsUnitID = Guid.Empty;
  900. DimensionsQuantity = 0;
  901. DimensionsLength = 0;
  902. DimensionsWidth = 0;
  903. DimensionsHeight = 0;
  904. DimensionsWeight = 0;
  905. DimensionsValue = 0;
  906. DimensionsUnitSize = "";
  907. Cost = 0.0;
  908. DimensionsHasHeight = false;
  909. DimensionsHasLength = false;
  910. DimensionsHasWidth = false;
  911. DimensionsHasWeight = false;
  912. DimensionsHasQuantity = false;
  913. DimensionsUnitFormula = "";
  914. DimensionsUnitFormat = "";
  915. DimensionsUnitCode = "";
  916. DimensionsUnitDescription = "";
  917. }
  918. public POItemShell DuplicateNewShell(POItemShell poitemshell)
  919. {
  920. POItemShell shell = new POItemShell
  921. {
  922. ID = poitemshell.ID,
  923. PONumber = poitemshell.PONumber,
  924. ConsignmentNumber = poitemshell.ConsignmentNumber,
  925. JobID = poitemshell.JobID,
  926. JobName = poitemshell.JobName,
  927. JobNumber = poitemshell.JobNumber,
  928. Description = poitemshell.Description,
  929. ConsignmentID = poitemshell.ConsignmentID,
  930. POID = poitemshell.POID,
  931. ExpectedQty = poitemshell.ExpectedQty,
  932. Color = poitemshell.Color,
  933. ReceivedQty = poitemshell.ReceivedQty,
  934. HasQAForm = poitemshell.HasQAForm,
  935. IsReadyForQA = poitemshell.IsReadyForQA,
  936. QATextColor = poitemshell.QATextColor,
  937. QABtnColor = poitemshell.QABtnColor,
  938. DigitalFormID = poitemshell.DigitalFormID,
  939. FormCompleted = poitemshell.FormCompleted,
  940. ReceivedDate = poitemshell.ReceivedDate,
  941. SupplierCode = poitemshell.SupplierCode,
  942. ProductID = poitemshell.ProductID,
  943. Nonstock = poitemshell.Nonstock,
  944. StyleID = poitemshell.StyleID,
  945. StyleCode = poitemshell.StyleCode,
  946. StyleDescription = poitemshell.StyleDescription,
  947. StockLocationID = poitemshell.StockLocationID,
  948. StockLocationCode = poitemshell.StockLocationCode,
  949. StockLocationDescription = poitemshell.StockLocationDescription,
  950. ImageVisible = poitemshell.ImageVisible,
  951. ImageSource = poitemshell.ImageSource,
  952. LastRowHeight = poitemshell.LastRowHeight,
  953. DimensionsUnitID = poitemshell.DimensionsUnitID,
  954. DimensionsQuantity = poitemshell.DimensionsQuantity,
  955. DimensionsLength = poitemshell.DimensionsLength,
  956. DimensionsWidth = poitemshell.DimensionsWidth,
  957. DimensionsHeight = poitemshell.DimensionsHeight,
  958. DimensionsWeight = poitemshell.DimensionsWeight,
  959. DimensionsValue = poitemshell.DimensionsValue,
  960. DimensionsUnitSize = poitemshell.DimensionsUnitSize,
  961. Cost = poitemshell.Cost,
  962. DimensionsHasHeight = poitemshell.DimensionsHasHeight,
  963. DimensionsHasLength = poitemshell.DimensionsHasLength,
  964. DimensionsHasWidth = poitemshell.DimensionsHasWidth,
  965. DimensionsHasWeight = poitemshell.DimensionsHasWeight,
  966. DimensionsHasQuantity = poitemshell.DimensionsHasQuantity,
  967. DimensionsUnitFormula = poitemshell.DimensionsUnitFormula,
  968. DimensionsUnitFormat = poitemshell.DimensionsUnitFormat,
  969. DimensionsUnitCode = poitemshell.DimensionsUnitCode,
  970. DimensionsUnitDescription = poitemshell.DimensionsUnitDescription
  971. };
  972. return shell;
  973. }
  974. }
  975. #endregion