private static void CheckAddInvoiceLineItemCommand(ProductLineItem item, AddInvoiceLineItemCommand command) { Assert.AreEqual(item.Product.Id, command.ProductId, "Line item Product ID"); Assert.AreEqual(item.Quantity, command.Qty, "Line item quantity"); Assert.AreEqual(item.Value, command.ValueLineItem, "Line item value"); Assert.AreEqual(item.VatValue, command.LineItemVatValue, "Line item VAT value"); }
protected override void ShowProductEditor(ProductLineItem lineItem) { var dialog = new ProductSelectorDialog(Activity); dialog.ItemStateChanged += delegate(ProductDetails productWrapper) { MakeSaleFragment.AdjustSale(Order, productWrapper); ApplyOrder(); }; dialog.Show(new ProductDetails(lineItem), allowSellReturnables: true, showAvailable: true); }
protected override void ShowProductEditor(ProductLineItem lineItem) { var dialog = new ProductSelectorDialog(Activity); dialog.ItemStateChanged += delegate(ProductDetails productDetails) { MakeOrderFragment.AdjustOrder(Order, productDetails); ApplyOrder(); }; dialog.Show(new ProductDetails(lineItem)); }
public ProductDetails(ProductLineItem lineItem) { Description = lineItem.Description; Balance = lineItem.AvailableQauntity; AvailableQuantity = lineItem.AvailableQauntity; SaleProduct = lineItem.Product; Quantity = lineItem.Quantity; LineItem = lineItem; SellReturnables = lineItem.SellReturnables; Price = lineItem.Price; }
public void SellReturnablesForItem(ProductLineItem item) { var returnableItem = ReturnableLineItems.Find(i => i.ProductMasterId == item.Product.ReturnableProductMasterId && i.SaleQuantity == 0); if (returnableItem != null) { returnableItem.SaleQuantity = item.SaleQuantity; returnableItem.LineItemStatus = LineItemStatus.Approved; } var caseReturnableItem = ReturnableLineItems.Find(i => i.ProductMasterId == item.Product.ReturnableContainerMasterId && i.SaleQuantity == 0); if (caseReturnableItem != null) { caseReturnableItem.SaleQuantity = CaseQuantityFor(item.Product, item.SaleQuantity); caseReturnableItem.LineItemStatus = LineItemStatus.Approved; } item.SellReturnables = true; }
public void UnsellReturnablesForItem(ProductLineItem item) { var returnableItem = ReturnableLineItems.Find(i => i.ProductMasterId == item.Product.ReturnableProductMasterId && i.SaleQuantity == item.SaleQuantity); if (returnableItem != null) { returnableItem.SaleQuantity = 0; returnableItem.LineItemStatus = LineItemStatus.New; } var caseQuantity = CaseQuantityFor(item.Product, item.SaleQuantity); var caseReturnableItem = ReturnableLineItems.Find(i => i.ProductMasterId == item.Product.ReturnableContainerMasterId && i.SaleQuantity == caseQuantity); if (caseReturnableItem != null) { caseReturnableItem.SaleQuantity = 0; caseReturnableItem.LineItemStatus = LineItemStatus.New; } item.SellReturnables = false; }
protected void RemoveReturnables(ProductLineItem item) { var eachReturnable = ReturnableLineItems .First(i => i.ProductMasterId == item.Product.ReturnableProductMasterId && i.Quantity == item.Quantity); ReturnableLineItems.Remove(eachReturnable); var caseQuantity = CaseQuantityFor(item.Product, item.Quantity); if (caseQuantity > 0) { var caseReturnable = ReturnableLineItems .First(i => i.ProductMasterId == item.Product.ReturnableContainerMasterId && i.Quantity == caseQuantity); ReturnableLineItems.Remove(caseReturnable); } }
//This method is called when constructing the order from commands as part of a DB rebuild or when the Hub modified the order public ProductLineItem AddItem(Guid lineItemId, SaleProduct product, Guid saleProductId, decimal quantity, decimal price, decimal vatRate) { var item = new ProductLineItem(lineItemId, Id) { Quantity = quantity, Product = product, ProductMasterId = saleProductId, Price = price, VatRate = vatRate }; LineItems.Add(item); return item; }
protected override void SetupProductLineItem(ProductLineItem productLine, TextView quantity) { //Do nothing in read-only mode }
protected override void ShowProductEditor(ProductLineItem lineItem) { //Not shown for in read-only mode }
private static void CheckInventoryAdjustmentNoteLineCommand(ProductLineItem item, AddInventoryAdjustmentNoteLineItemCommand command, decimal availableStock) { Assert.AreEqual(item.Product.Id, command.ProductId, "Line item Product ID"); Assert.AreEqual(availableStock, command.Expected, "Line item available value"); Assert.AreEqual(availableStock - item.Quantity, command.Actual, "Line item expected value"); }