public void UpdateModel() { if (ParentModel.Order.OrderBaseType == OrderBaseTypes.Current) { ParentModel.PaymentSchedules = Schedules.Where(i => i.Amount.HasValue && i.Amount > 0).Cast <PaymentSchedule>().ToList(); } else { ParentModel.PaymentSchedules = Schedules.Where(i => i.Amount.HasValue && i.Amount > 0).Cast <ReleasedPaymentSchedule>().ToList(); } ParentModel.RefreshSummary(); }
public void UpdateModel() { if (ParentModel.Order.OrderBaseType == OrderBaseTypes.Current) { ParentModel.GenJournalLines = GeJournals.Where(i => i.Amount.HasValue && i.Amount > 0).Cast <GenJournalLine>().ToList(); } else { ParentModel.GenJournalLines = GeJournals.Where(i => i.Amount.HasValue && i.Amount > 0).Cast <ReleasedGenJournalLine>().ToList(); } ParentModel.RefreshSummary(); }
public void UpdateSalesLines() { SelectedItems.RemoveAll(i => i.SelectedQuantity == null || i.SelectedQuantity == 0 || i.OrderType == null); if (ParentModel.Order.OrderBaseType == OrderBaseTypes.Current) { (ParentSalesLines as List <SalesLine>).RemoveAll(i => SelectedItems.All(j => j.No_ != i.No_)); int maxIndex = GetMaxInd(); foreach (var item in SelectedItems) { var sl = ParentModel.SalesLines.FirstOrDefault(i => i.No_ == item.No_); if (sl != null) { sl.Quantity = item.SelectedQuantity; sl.OrderType = (int)item.OrderType.Value; sl.UnitPrice = item.OrderType == OrderTypes.CQ && item.UnitPriceCQ.HasValue ? item.UnitPriceCQ.Value : sl.UnitPrice; sl.AmountIncludingVAT = (item.OrderType == OrderTypes.Ok || item.OrderType == OrderTypes.CQ) ? Math.Round(item.SelectedQuantity.Value * item.UnitPrice.Value, 2, MidpointRounding.AwayFromZero) : 0; } else { maxIndex += 100; AddNewSalesLine(CreateSalesLine(item, maxIndex)); } } } else { int maxIndex = GetMaxInd(); foreach (var item in SelectedItems) { maxIndex += 100; AddNewSalesLine(CreateSalesLine(item, maxIndex)); } } ParentModel.Order.AmountIncludingVat = ParentModel.SalesLines.Sum(i => i.AmountIncludingVAT); ParentModel.RefreshSummary(); }