private void GetModelData(AdjustDebitNoteForm pqf) { if (IsNew == false) { this.ID = pqf.AdjustDebitNote.ID; this.SelectedSupplierID = pqf.AdjustDebitNote.SupplierID; this.DebitNoteNo = pqf.AdjustDebitNote.DebitNoteNo; this.SelectedAccountID = pqf.AdjustDebitNote.AccountId; this.Date = pqf.AdjustDebitNote.Date; this.AmountStr = pqf.AdjustDebitNote.AmountStr; this.IsCheque = pqf.AdjustDebitNote.IsCheque; if (IsCheque == true) { IsChequeTrue = true; } else { IsChequeFalse = true; } //this.CashChequeNo = pqf.AdjustDebitNote.CashChequeNo; this.Remarks = pqf.AdjustDebitNote.Remarks; if (this.ListSuppliers != null) { foreach (var item in this.ListSuppliers) { if (item.ID == this.SelectedSupplierID) { this.SelectedSupplierName = item.SupplierName; } } } } var result = pqf.AdjustDebitNoteDetails.OrderByDescending(e => e.UpdatedDate).GroupBy(e => e.PurchaseNo).Select(e => e.First()).ToList(); this.PQDetailsEntity = new ObservableCollection <CollectAmountDataGridViewModel>(); if (result != null) { foreach (var item in result) { CollectAmountDataGridViewModel pqEntity = new CollectAmountDataGridViewModel(); pqEntity.PurchaseNo = item.PurchaseNo; pqEntity.PurchaseDate = item.PurchaseDate; pqEntity.PurchaseDateStr = changedateformat(item.PurchaseDate); pqEntity.PurchaseAmountStr = Convert.ToString(item.PurchaseAmount); pqEntity.PurchaseAmount = item.PurchaseAmount; pqEntity.PaymentDueDate = item.PaymentDueDate; pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate); pqEntity.AmountDueStr = Convert.ToString(item.AmountDue); //pqEntity.AmountDue = item.AmountDue; //pqEntity.AmountAdjusted = item.AmountAdjusted; //pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted); //pqEntity.Discount = item.Discount; PQDetailsEntity.Add(pqEntity); OnPropertyChanged("PQDetailsEntity"); } } PQDetailsEntityLst = PQDetailsEntity; }
private void GetModelData(PaymentToSupplierForm pqf) { if (IsNew == false) { // this.ID = pqf.PaymentToSupplier.ID; this.SelectedSupplierID = pqf.PaymentToSupplier.SupplierID; this.SelectedAccountID = pqf.PaymentToSupplier.AccountId; this.AmountStr = pqf.PaymentToSupplier.AmountStr; this.IsCheque = pqf.PaymentToSupplier.IsCheque; if (IsCheque == true) { IsChequeTrue = true; IsChequeFalse = false; } else { IsChequeFalse = true; IsChequeTrue = false; } this.CashChequeNo = pqf.PaymentToSupplier.CashChequeNo; this.Remarks = pqf.PaymentToSupplier.Remarks; } var result = pqf.PaymentToSupplierDetails.OrderByDescending(e => e.CreatedDate).GroupBy(e => e.PurchaseNo).Select(e => e.First()).ToList(); this.PQDetailsEntity = new ObservableCollection <CollectAmountDataGridViewModel>(); foreach (var item in result) { CollectAmountDataGridViewModel pqEntity = new CollectAmountDataGridViewModel(); pqEntity.PurchaseNo = item.PurchaseNo; pqEntity.PurchaseDate = item.PurchaseDate; pqEntity.PurchaseDateStr = changedateformat(item.PurchaseDate); pqEntity.PurchaseAmountStr = Convert.ToString(item.PurchaseAmount); pqEntity.PurchaseAmount = item.PurchaseAmount; pqEntity.PaymentDueDate = item.PaymentDueDate; pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate); pqEntity.AmountDue = item.AmountDue; pqEntity.AmountDueStr = Convert.ToString(item.AmountDue); pqEntity.AmountAdjusted = item.AmountAdjusted; pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted); pqEntity.Discount = item.Discount; pqEntity.DiscountStr = Convert.ToString(item.Discount); PQDetailsEntity.Add(pqEntity); OnPropertyChanged("PQDetailsEntity"); } TotalSalesAmount = Convert.ToString(PQDetailsEntity.Sum(e => e.PurchaseAmount)); TotalAmountDue = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountDue)); TotalAmountPaid = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountAdjusted)); PQDetailsEntityLst = PQDetailsEntity; }
void GetNewPS(object param) { IsNew = true; // SelectedSupplierID = 0; IsSupplierEnabled = true; IsDebitNoEnabled = true; PSErrors = string.Empty; GetNewPS(); if (PQDetailsEntity != null) { if (PQDetailsEntity.Count > 0) { PQDetailsEntity.Clear(); var row = new CollectAmountDataGridViewModel(); PQDetailsEntity.Add(row); OnPropertyChanged("PQDetailsEntity"); } } }
private void GetModelData(AdjustDebitNoteForm pqf) { if (IsNew == false) { this.ID = pqf.AdjustDebitNote.ID; this.SelectedSupplierID = pqf.AdjustDebitNote.SupplierID; this.DebitNoteNo = pqf.AdjustDebitNote.DebitNoteNo; this.SelectedAccountID = pqf.AdjustDebitNote.AccountId; this.Date = pqf.AdjustDebitNote.Date; this.AmountStr = pqf.AdjustDebitNote.AmountStr; this.IsCheque = pqf.AdjustDebitNote.IsCheque; this.AdjustDebitNoteNumber = pqf.AdjustDebitNote.AdjustDebitNoteNumber; if (IsCheque == true) { IsChequeTrue = true; } else { IsChequeFalse = true; } //this.CashChequeNo = pqf.AdjustDebitNote.CashChequeNo; this.Remarks = pqf.AdjustDebitNote.Remarks; if (this.ListSuppliers != null) { foreach (var item in this.ListSuppliers) { if (item.ID == this.SelectedSupplierID) { this.SelectedSupplierName = item.SupplierName; } } } } var result = pqf.AdjustDebitNoteDetails.OrderByDescending(e => e.UpdatedDate).GroupBy(e => e.PurchaseNo).Select(e => e.First()).ToList(); OptionsEntity oData = new OptionsEntity(); ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository(); oData = purchaseRepository.GetOptionSettings(); this.PQDetailsEntity = new ObservableCollection <CollectAmountDataGridViewModel>(); if (result != null) { foreach (var item in result) { CollectAmountDataGridViewModel pqEntity = new CollectAmountDataGridViewModel(); pqEntity.PurchaseNo = item.PurchaseNo; if (item.PurchaseDate != null) { pqEntity.PurchaseDate = item.PurchaseDate; DateTime Dateinstr = (DateTime)item.PurchaseDate; pqEntity.PurchaseDateStr = Dateinstr.ToString(oData.DateFormat); } else { } pqEntity.PurchaseAmountStr = Convert.ToString(item.PurchaseAmount); pqEntity.PurchaseAmount = item.PurchaseAmount; if (item.PaymentDueDate != null) { pqEntity.PaymentDueDate = item.PaymentDueDate; DateTime Dateinstr1 = (DateTime)item.PaymentDueDate; pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate); } else { } pqEntity.AmountDueStr = Convert.ToString(item.AmountDue); //pqEntity.AmountDue = item.AmountDue; pqEntity.AmountAdjusted = item.AmountAdjusted; pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted); //pqEntity.Discount = item.Discount; PQDetailsEntity.Add(pqEntity); TotalPurchaseAmount = Convert.ToString(PQDetailsEntity.Sum(e => e.PurchaseAmount)); TotalAdjutedAmount = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountAdjusted)); OnPropertyChanged("PQDetailsEntity"); } } PQDetailsEntityLst = PQDetailsEntity; }