/// <summary> /// Initializes a new instance of the <see cref="LineItemCreate" /> class. /// </summary> /// <param name="amountIncludingTax">amountIncludingTax (required).</param> /// <param name="name">name (required).</param> /// <param name="quantity">quantity (required).</param> /// <param name="type">type (required).</param> /// <param name="uniqueId">The unique id identifies the line item within the set of line items associated with the transaction. (required).</param> public LineItemCreate(decimal?amountIncludingTax, string name, decimal?quantity, LineItemType type, string uniqueId) { // to ensure "amountIncludingTax" is required (not null) if (amountIncludingTax == null) { throw new InvalidDataException("amountIncludingTax is a required property for LineItemCreate and cannot be null"); } this.AmountIncludingTax = amountIncludingTax; // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for LineItemCreate and cannot be null"); } this.Name = name; // to ensure "quantity" is required (not null) if (quantity == null) { throw new InvalidDataException("quantity is a required property for LineItemCreate and cannot be null"); } this.Quantity = quantity; // to ensure "type" is required (not null) if (type == null) { throw new InvalidDataException("type is a required property for LineItemCreate and cannot be null"); } this.Type = type; // to ensure "uniqueId" is required (not null) if (uniqueId == null) { throw new InvalidDataException("uniqueId is a required property for LineItemCreate and cannot be null"); } this.UniqueId = uniqueId; }
/// <summary> /// Adds a line item to the collection /// </summary> /// <param name="container"> /// The container. /// </param> /// <param name="lineItemType"> /// The line Item Type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The sku. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="amount"> /// The amount. /// </param> /// <param name="extendedData"> /// The extended Data. /// </param> public static void AddItem(this ILineItemContainer container, LineItemType lineItemType, string name, string sku, int quantity, decimal amount, ExtendedDataCollection extendedData) { var lineItem = new ItemCacheLineItem(lineItemType, name, sku, quantity, amount, extendedData) { ContainerKey = container.Key }; container.AddItem(lineItem); }
/// <summary> /// Initializes a new instance of the <see cref="LineItemBase"/> class. /// </summary> /// <param name="lineItemType"> /// The line item type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="price"> /// The price. /// </param> protected LineItemBase(LineItemType lineItemType, string name, string sku, int quantity, decimal price) : this( EnumTypeFieldConverter.LineItemType.GetTypeField(lineItemType).TypeKey, name, sku, quantity, price, new ExtendedDataCollection()) { }
/// <summary> /// Initializes a new instance of the <see cref="ItemCacheLineItem"/> class. /// </summary> /// <param name="lineItemType"> /// The line item type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="price"> /// The price. /// </param> /// <param name="extendedData"> /// The extended data. /// </param> public ItemCacheLineItem( LineItemType lineItemType, string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData) : base(lineItemType, name, sku, quantity, price, extendedData) { }
public LineItem(double Amount, DateTime Date, LineItemType liType) { if (Amount < 0) { throw new ApplicationException("New Line Item must have an Amount >= 0"); } if (liType == LineItemType.Disbursement) { Amount = Amount * -1; } m_Amount = Amount; m_Date = Date; m_DateType = DateType.Date; m_Type = liType; }
private int GetNextLineNumber(LineItemType lineItemType, int ParentItemLineNumber = 100) { int returnLineNumber = 1; List <Product> _items = null; switch (lineItemType) { case LineItemType.LooseItem: if (this.LineItems == null) { return(returnLineNumber); } _items = this.LineItems.OfType <Product>().Where( o => o.LineItemType == LineItemType.LooseItem).ToList(); returnLineNumber = _items.Count + 1; break; case LineItemType.BTOSParent: if (this.LineItems == null) { return(100); } _items = this.LineItems.OfType <Product>().Where( o => o.LineItemType == LineItemType.BTOSParent).ToList(); returnLineNumber = (_items.Count + 1) * 100; break; case LineItemType.BTOSChild: if (this.LineItems == null) { return(101); } _items = this.LineItems.OfType <Product>().Where( o => o.ParentLineNumber == ParentItemLineNumber && o.LineItemType == LineItemType.BTOSChild).ToList(); returnLineNumber = ParentItemLineNumber + _items.Count + 1; break; } return(returnLineNumber); }
public LineItem(double Amount, int Periods, int OddDays, LineItemType liType) { if (Amount < 0) { throw new ApplicationException("New Line Item must have an Amount >= 0"); } if (liType == LineItemType.Disbursement) { Amount = Amount * -1; } m_Amount = Amount; this.m_Span.Periods = Periods; this.m_Span.OddDays = OddDays; m_DateType = DateType.Periods; m_Type = liType; }
public ReportLineItem(int day, float latitude, float longitude, int confirmed, int deaths, int recovered, LineItemType lineType) { Day = day; Latitude = latitude; Longitude = longitude; Confirmed = confirmed; Deaths = deaths; Recovered = recovered; LineType = lineType; }
private static ReportLineItem LoadEarlyReportLine(string[] lineComponents, int day) { string rawConfirmed = lineComponents[3]; int confirmed = LoadInt(rawConfirmed); string rawDeaths = lineComponents[4]; int deaths = LoadInt(rawDeaths); string rawRecovered = lineComponents[5]; int recovered = LoadInt(rawRecovered); string rawLatitude = lineComponents[6]; float latitude = LoadFloat(rawLatitude); string rawLongitude = lineComponents[7]; float longitude = LoadFloat(rawLongitude); LineItemType type = string.IsNullOrWhiteSpace(lineComponents[0]) ? LineItemType.Nation : LineItemType.Point; return(new ReportLineItem(day, latitude, longitude, confirmed, deaths, recovered, type)); }
private static ReportLineItem LoadLateReportLine(string[] components, int day) { string rawLat = components[5]; float latitude = LoadFloat(rawLat); string rawLong = components[6]; float longitude = LoadFloat(rawLong); string rawConfirmed = components[7]; int confirmed = LoadInt(rawConfirmed); string rawDeaths = components[8]; int deaths = LoadInt(rawDeaths); string rawRecovered = components[9]; int recovered = LoadInt(rawRecovered); LineItemType lineType = string.IsNullOrWhiteSpace(components[2]) ? LineItemType.Nation : LineItemType.Point; return(new ReportLineItem(day, latitude, longitude, confirmed, deaths, recovered, lineType)); }
public LineItem(LineItemType type, decimal amount) { Type = type; Amount = amount; }
protected LineItemBase(LineItemType lineItemType, string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData) : this(EnumTypeFieldConverter.LineItemType.GetTypeField(lineItemType).TypeKey, name, sku, quantity, price, extendedData) { }
/// <summary> /// Initializes a new instance of the <see cref="InvoiceLineItem"/> class. /// </summary> /// <param name="lineItemType"> /// The line item type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="price"> /// The price. /// </param> public InvoiceLineItem(LineItemType lineItemType, string name, string sku, int quantity, decimal price) : base(lineItemType, name, sku, quantity, price) { }
/// <summary> /// Initializes a new instance of the <see cref="OrderLineItem"/> class. /// </summary> /// <param name="lineItemType"> /// The line item type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The sku. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="price"> /// The price. /// </param> /// <param name="extendedData"> /// The extended data. /// </param> public OrderLineItem( LineItemType lineItemType, string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData) : base(lineItemType, name, sku, quantity, price, extendedData) { }
public void RemoveLineItem(Guid productId, LineItemType lit, bool isReceivedReturnable) { PackagingSummary delProduct; List<PackagingSummary> itemsToDelete; MessageBoxResult isConfirmed; delProduct = _productPackagingSummaryService.GetProductSummary().FirstOrDefault( p => p.Product.Id == productId && p.IsEditable); itemsToDelete = _productPackagingSummaryService.GetProductSummaryByProduct( productId, delProduct.Quantity); string msg = ""; foreach (PackagingSummary delitem in itemsToDelete) { msg += string.Format("\n\t{0} of {1} will be deleted", delitem.Quantity, delitem.Product.Description); } isConfirmed = MessageBox.Show( "Are sure you want to delete the following product(s)" + msg, "Delete POS Order Line item", MessageBoxButton.OKCancel); if (isConfirmed == MessageBoxResult.OK) { _productPackagingSummaryService.RemoveProduct(productId); RefreshList(); } }
public void RemoveLineItem(Guid productId, LineItemType lit) { var delProduct = _productPackagingSummaryService.GetProductSummary().FirstOrDefault( p => p.Product.Id == productId && p.IsEditable); string msg = ""; foreach ( PackagingSummary delitem in _productPackagingSummaryService.GetProductSummaryByProduct(productId, delProduct.Quantity)) { msg += string.Format("\n\t{0} of {1} will be deleted", delitem.Quantity, delitem.Product.Description); } MessageBoxResult isConfirmed = MessageBox.Show("Are sure you want to delete the following product(s)" + msg, "Delete Purchase Order Line item", MessageBoxButton.OKCancel); if (isConfirmed == MessageBoxResult.OK) { _productPackagingSummaryService.RemoveProduct(productId); } RefreshList(); CalcTotals(); }
private void UpdateOrAddLineItem(Product product, decimal quantity, bool isEditable, Guid parentProductId, LineItemType lineItemType,bool isEdit) { decimal UnitPrice = PriceCalc(product); decimal UnitVat = VatCalc(product); decimal net = UnitPrice * quantity; decimal vat = UnitPrice * UnitVat;//cn decimal VatAmount = net * UnitVat; decimal TotalPrice = net + VatAmount; int sequenceNo = 1; if (LineItems.Count() > 0) { sequenceNo = LineItems.Max(n => n.SequenceNo) + 1; } EditPurchaseOrderItem li; if (LineItems.Any(p => p.ProductId == product.Id && p.LineItemType==lineItemType) && isEdit==false) { li = LineItems.First(p => p.ProductId == product.Id && p.LineItemType == lineItemType); li.Qty = li.Qty + quantity; li.LineItemVatValue = li.LineItemVatValue + vat; li.VatAmount = li.VatAmount + VatAmount; li.TotalPrice = li.TotalPrice + TotalPrice; } else if (LineItems.Any(p => p.ProductId == product.Id && p.LineItemType == lineItemType) && isEdit==true) { li = LineItems.First(p => p.ProductId == product.Id && p.LineItemType == lineItemType); li.Qty = quantity; li.LineItemVatValue = vat; li.VatAmount = VatAmount; li.TotalPrice = TotalPrice; } else { li = new EditPurchaseOrderItem(); LineItems.Add(li); li.Qty = quantity; li.LineItemVatValue = vat; li.VatAmount = VatAmount; li.TotalPrice = TotalPrice; } li.SequenceNo = sequenceNo; li.ProductId = product.Id; li.Product = product.Description; li.UnitPrice = UnitPrice; li.IsEditable = isEditable; li.Vat = vat; li.ParentProductId = parentProductId; li.LineItemType = lineItemType; CalcTotals(); }
/// <summary> /// Adds a line item to the collection /// </summary> /// <param name="container"> /// The container. /// </param> /// <param name="lineItemType"> /// The line Item Type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The sku. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="amount"> /// The amount. /// </param> public static void AddItem(this ILineItemContainer container, LineItemType lineItemType, string name, string sku, int quantity, decimal amount) { container.AddItem(lineItemType, name, sku, quantity, amount, new ExtendedDataCollection()); }
/// <summary> /// Gets the line item collection by <see cref="LineItemType"/>. /// </summary> /// <param name="lineItemType"> /// The line item type. /// </param> /// <returns> /// The <see cref="IEnumerable{InvoiceLineItem}"/>. /// </returns> protected virtual IEnumerable <ILineItem> GetLineItemCollection(LineItemType lineItemType) { return(this.Invoice.Items.Where(x => x.LineItemType == lineItemType).Select(x => x.AsLineItemWithKeyOf <InvoiceLineItem>())); }
public void AddLineItem(Guid productId, string productdescription, decimal expected, decimal actual, string reason,LineItemType lineItemType) { bool isBulk = lineItemType == LineItemType.Bulk; using (var container = NestedContainer) { var bulkQuantity =Using<IProductPackagingSummaryService>(container).GetProductQuantityInBulk(productId); actual=isBulk? actual*bulkQuantity:actual; } if (_LineItems.Any(p => p.Id == productId)) { var liupdate = _LineItems.First(p => p.Id == productId); liupdate.ExpectedQty = expected; liupdate.ActualQty = actual; liupdate.Reason = reason; liupdate.Variance = liupdate.ActualQty - liupdate.ExpectedQty; liupdate.LineItemType = lineItemType; } else { EditIANViewModelInventoryAdustment li = new EditIANViewModelInventoryAdustment { ActualQty = actual, ExpectedQty = expected, Id = productId, ProductName = productdescription, Reason = reason, LineItemType = lineItemType }; li.Variance = li.ActualQty - li.ExpectedQty; _LineItems.Add(li); } }
/// <summary> /// Initializes a new instance of the <see cref="OrderLineItem"/> class. /// </summary> /// <param name="lineItemType"> /// The line item type. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="quantity"> /// The quantity. /// </param> /// <param name="price"> /// The price. /// </param> public OrderLineItem(LineItemType lineItemType, string name, string sku, int quantity, decimal price) : base(lineItemType, name, sku, quantity, price) { }
public void sAddLineItem(Guid productId, string productdescription, decimal expected, decimal actual, string reason, bool isEdit, LineItemType lineItemType) { LineItems.Clear(); bool isBulk = lineItemType == LineItemType.Bulk; using (var container = NestedContainer) { var bulkQuantity = Using<IProductPackagingSummaryService>(container).GetProductQuantityInBulk(productId); actual = isBulk ? actual * bulkQuantity : actual; } _productPackagingSummaryService.AddProduct(productId, actual, true, isEdit, false); List<PackagingSummary> summaryList = _productPackagingSummaryService.GetProductSummary(); // List<PackagingSummary> summarypro = _productPackagingSummaryService.GetProductSummaryByProduct(productId, actual,false); //int sd = _productPackagingSummaryService.GetProductQuantityInBulk(productId); RefreshList(summaryList); }