private static void CalculateYourPrice(InvoiceLineModel invoiceLine, InvoicePriceModel invoicePrice, OrderTotals_V01 response, decimal staticDiscount) { if (null != response.ItemTotalsList && response.ItemTotalsList.Any()) { var itemTotal = (ItemTotal_V01)response.ItemTotalsList.Find(p => ((ItemTotal_V01)p).SKU == invoiceLine.Sku); if (null != itemTotal) { invoiceLine.YourPrice = itemTotal.DiscountedPrice; invoiceLine.DisplayYourPrice = invoiceLine.YourPrice.FormatPrice(); } else { LoggerHelper.Error("CalculateYourPrice itemTotal is null"); invoiceLine.YourPrice = 0m; invoiceLine.DisplayYourPrice = invoiceLine.YourPrice.FormatPrice(); } } else { LoggerHelper.Error("CalculateYourPrice ItemTotalsList is null"); invoiceLine.YourPrice = 0m; invoiceLine.DisplayYourPrice = invoiceLine.YourPrice.FormatPrice(); } }
public MemberInvoicePrice ConvertToMemberInvoicePrice(InvoicePriceModel price) { return(new MemberInvoicePrice { CalcTaxAmount = price.CalcTaxAmount, CalcDiscountAmount = price.CalcDiscountAmount, CalcShippingAmount = price.CalcShippingAmount, DiscountAmount = price.DiscountAmount, DiscountPercentage = price.DiscountPercentage, MemberDiscount = price.MemberDiscount, MemberFreight = price.MemberFreight, MemberTax = price.MemberTax, ShippingAmount = price.ShippingAmount, ShippingPercentage = price.ShippingPercentage, SubTotal = price.SubTotal, TaxAmount = price.TaxAmount, TaxPercentage = price.TaxPercentage, TotalDiscountedAmount = price.TotalDiscountedAmount, TotalDue = price.TotalDue, TotalVolumePoints = price.TotalVolumePoints, MemberStaticDiscount = price.MemberStaticDiscount, TotalEarnBase = price.TotalEarnBase, TotalYourPrice = price.TotalYourPrice, MemberTotal = price.MemberTotal, Profit = price.Profit, ProfitPercentage = price.ProfitPercentage }); }
private static void CalculateLineDiscountedAmmount(InvoiceLineModel invoiceLine, InvoicePriceModel invoicePrice) { //var deltaPerItem = decimal.Round( // (-invoicePrice.CalcDiscountAmount * invoiceLine.RetailPrice / invoicePrice.SubTotal), 2); invoiceLine.CalcDiscountedAmount = invoiceLine.RetailPrice * invoiceLine.Quantity; }