public void UpdateTotalAmountProposalItemList(int currencyID) { ProposalItemList.ForEach(o => { o.ARProposalItemDiscountAmount = o.ARProposalItemPrice * o.ARProposalItemQty * o.ARProposalItemDiscountPercent / 100; VinaApp.RoundByCurrency(o, "ARProposalItemDiscountAmount", currencyID); o.ARProposalItemTaxAmount = (o.ARProposalItemPrice * o.ARProposalItemQty - o.ARProposalItemDiscountAmount) * o.ARProposalItemTaxPercent / 100; VinaApp.RoundByCurrency(o, "ARProposalItemTaxAmount", currencyID); o.ARProposalItemTotalAmount = o.ARProposalItemPrice * o.ARProposalItemQty - o.ARProposalItemDiscountAmount + o.ARProposalItemTaxAmount; VinaApp.RoundByCurrency(o, "ARProposalItemTotalAmount", currencyID); }); ProposalItemList.GridControl.RefreshDataSource(); }
public void UpdateTotalAmount() { ARCustomerPaymentsInfo mainObject = (ARCustomerPaymentsInfo)MainObject; foreach (ARCustomerPaymentTimePaymentsInfo item in CustomerPaymentTimePaymentsList) { item.ARCustomerPaymentTimePaymentPercent = item.ARCustomerPaymentTimePaymentAmount / item.ARCustomerPaymentTimePaymentTotalAmount * 100; } mainObject.ARCustomerPaymentTotalAmount = CustomerPaymentTimePaymentsList.Sum(p => p.ARCustomerPaymentTimePaymentAmount); VinaApp.RoundByCurrency(mainObject, "ARCustomerPaymentTotalAmount", mainObject.FK_GECurrencyID); mainObject.ARCustomerPaymentExchangeAmount = mainObject.ARCustomerPaymentExchangeRate * mainObject.ARCustomerPaymentTotalAmount; VinaApp.RoundByCurrency(mainObject, "ARCustomerPaymentExchangeAmount", mainObject.FK_GECurrencyID); UpdateMainObjectBindingSource(); }
public void UpdateTotalAmount() { ARSaleOrdersInfo mainObject = (ARSaleOrdersInfo)MainObject; mainObject.ARSaleOrderSubTotalAmount = SaleOrderItemsList.Sum(o => o.ARSaleOrderItemTotalAmount); VinaApp.RoundByCurrency(mainObject, "ARSaleOrderSubTotalAmount", mainObject.FK_GECurrencyID); mainObject.ARSaleOrderDiscountAmount = mainObject.ARSaleOrderDiscountPercent / 100 * mainObject.ARSaleOrderSubTotalAmount; VinaApp.RoundByCurrency(mainObject, "ARSaleOrderDiscountAmount", mainObject.FK_GECurrencyID); mainObject.ARSaleOrderTaxAmount = mainObject.ARSaleOrderTaxPercent / 100 * (mainObject.ARSaleOrderSubTotalAmount - mainObject.ARSaleOrderDiscountAmount); VinaApp.RoundByCurrency(mainObject, "ARSaleOrderTaxAmount", mainObject.FK_GECurrencyID); mainObject.ARSaleOrderTotalAmount = mainObject.ARSaleOrderSubTotalAmount - mainObject.ARSaleOrderDiscountAmount + mainObject.ARSaleOrderTaxAmount; VinaApp.RoundByCurrency(mainObject, "ARSaleOrderTotalAmount", mainObject.FK_GECurrencyID); UpdateMainObjectBindingSource(); }
public void UpdateTotalAmount() { ARProposalsInfo mainObject = (ARProposalsInfo)MainObject; mainObject.ARProposalSubTotalAmount = ProposalItemList.Sum(o => o.ARProposalItemTotalAmount); VinaApp.RoundByCurrency(mainObject, "ARProposalSubTotalAmount", mainObject.FK_GECurrencyID); mainObject.ARProposalDiscountAmount = mainObject.ARProposalDiscountPerCent / 100 * mainObject.ARProposalSubTotalAmount; VinaApp.RoundByCurrency(mainObject, "ARProposalDiscountAmount", mainObject.FK_GECurrencyID); mainObject.ARProposalTaxAmount = mainObject.ARProposalTaxPercent / 100 * (mainObject.ARProposalSubTotalAmount - mainObject.ARProposalDiscountAmount); VinaApp.RoundByCurrency(mainObject, "ARProposalTaxAmount", mainObject.FK_GECurrencyID); mainObject.ARProposalTotalAmount = mainObject.ARProposalSubTotalAmount - mainObject.ARProposalDiscountAmount + mainObject.ARProposalTaxAmount; VinaApp.RoundByCurrency(mainObject, "ARProposalTotalAmount", mainObject.FK_GECurrencyID); UpdateMainObjectBindingSource(); }
public void UpdatePriceBelongCurrency(int currencyID) { ARProposalsInfo mainObject = (ARProposalsInfo)MainObject; ProposalItemList.ForEach(o => { if (mainObject.ARProposalExchangeRate != mainObject.ARProposalExchangeRateOld) { o.ARProposalItemProductUnitPrice = o.ARProposalItemProductUnitPrice * mainObject.ARProposalExchangeRate; o.ARProposalItemPrice = o.ARProposalItemPrice * mainObject.ARProposalExchangeRate; } VinaApp.RoundByCurrency(o, "ARProposalItemProductUnitPrice", currencyID); VinaApp.RoundByCurrency(o, "ARProposalItemPrice", currencyID); }); mainObject.ARProposalExchangeRateOld = mainObject.ARProposalExchangeRate; UpdateTotalAmountProposalItemList(currencyID); UpdateTotalAmount(); }
public void GeneratePaymentTime(int paymentTermID) { if (Toolbar.IsNullOrNoneAction()) { return; } SaleOrderEntities entity = (SaleOrderEntities)CurrentModuleEntity; ARSaleOrdersInfo mainObject = (ARSaleOrdersInfo)entity.MainObject; GEPaymentTermsController objPaymentTermsController = new GEPaymentTermsController(); GEPaymentTermsInfo objPaymentTermsInfo = objPaymentTermsController.GetObjectByID(paymentTermID) as GEPaymentTermsInfo; if (objPaymentTermsInfo == null) { return; } GEPaymentTermItemsController objPaymentTermItemsController = new GEPaymentTermItemsController(); List <GEPaymentTermItemsInfo> paymentTermItems = objPaymentTermItemsController.GetListItemByPaymentTermID(paymentTermID); if (paymentTermItems.Count() <= 0) { return; } mainObject.FK_GEPaymentTermID = paymentTermID; if (entity.SaleOrderPaymentTimeList.Count() > 0) { entity.SaleOrderPaymentTimeList.Clear(); } if (mainObject.ARSaleOrderTotalAmount == 0) { return; } ARSaleOrderPaymentTimesInfo objPayment; paymentTermItems.ForEach(o => { objPayment = new ARSaleOrderPaymentTimesInfo(); objPayment.ARSaleOrderPaymentTimePaymentType = o.GEPaymentTermItemPaymentType; objPayment.ARSaleOrderPaymentTimeStatus = "New"; objPayment.ARSaleOrderPaymentTimeAmount = mainObject.ARSaleOrderTotalAmount * o.GEPaymentTermItemPaymentPercent / 100; objPayment.ARSaleOrderPaymentTimeDueAmount = mainObject.ARSaleOrderTotalAmount * o.GEPaymentTermItemPaymentPercent / 100; objPayment.FK_GEPaymentTermID = paymentTermID; objPayment.ARSaleOrderPaymentTimePaymentMethod = mainObject.ARSaleOrderPaymentMethodType; objPayment.FK_ARSaleOrderID = mainObject.ARSaleOrderID; objPayment.ARSaleOrderPaymentTimePaymentTermItemPaymentTime = o.GEPaymentTermItemPaymentTime; objPayment.ARSaleOrderPaymentTimePaymentTermItemDay = o.GEPaymentTermItemDay; objPayment.ARSaleOrderPaymentTimePaymentTermItemPercentPayment = o.GEPaymentTermItemPaymentPercent; objPayment.ARSaleOrderPaymentTimePaymentTermItemPaymentType = o.GEPaymentTermItemPaymentType; objPayment.ARSaleOrderPaymentTimePaymentTermItemType = o.GEPaymentTermItemPaymentType; objPayment.FK_GEPaymentTermItemID = o.GEPaymentTermItemID; if (o.GEPaymentTermItemPaymentTime == "IsContract") { if (mainObject.ARSaleOrderDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDate; objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDate; } } if (o.GEPaymentTermItemPaymentTime == "IsBeforeDelivery") { if (mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDeliveryDate.AddDays(-o.GEPaymentTermItemDay); objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDeliveryDate.AddDays(-o.GEPaymentTermItemDay); } } if (o.GEPaymentTermItemPaymentTime == "IsAfterDelivery") { if (mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); } } if (o.GEPaymentTermItemPaymentTime == "IsSaleOrder") { if (mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MaxValue.Date && mainObject.ARSaleOrderDeliveryDate.Date != DateTime.MinValue.Date) { objPayment.ARSaleOrderPaymentTimeDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); objPayment.ARSaleOrderPaymentTimeDueDate = mainObject.ARSaleOrderDeliveryDate.AddDays(o.GEPaymentTermItemDay); } } VinaApp.RoundByCurrency(objPayment, mainObject.FK_GECurrencyID); entity.SaleOrderPaymentTimeList.Add(objPayment); entity.SaleOrderPaymentTimeList.GridControl.RefreshDataSource(); }); }