public PaymentFromCustomerForm GetDataIntoModel() { OptionsEntity oData = new OptionsEntity(); ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository(); oData = purchaseRepository.GetOptionSettings(); PaymentFromCustomerForm PQForm = new PaymentFromCustomerForm(); PQForm.PaymentFromCustomerDetails = new List <PaymentFromCustomerDetailsEntity>(); PaymentFromCustomerEntity model = new PaymentFromCustomerEntity(); // this.ID = pqf.PaymentFromCustomer.ID; model.CustomerID = this.SelectedCustomerID; model.AccountId = this.SelectedAccountID; //model.DateStr = this.DateStr; model.Date = DateTime.ParseExact(this.DateStr, oData.DateFormat, null); model.AmountStr = this.AmountStr; model.Amount = Convert.ToDecimal(this.AmountStr); model.IsCheque = this.IsCheque; model.CashChequeNo = this.CashChequeNo; model.Remarks = this.Remarks; if (this.IsChequeTrue == true) { model.IsCheque = true; } else { model.IsCheque = false; } PQForm.PaymentFromCustomer = model; foreach (var item in PQDetailsEntity.Where(e => Convert.ToDecimal(e.AmountAdjustedStr) != 0)) { PaymentFromCustomerDetailsEntity pqEntity = new PaymentFromCustomerDetailsEntity(); pqEntity.SalesNo = item.SalesNo; pqEntity.SalesDate = item.SalesDate; pqEntity.SalesAmount = Convert.ToDecimal(item.SalesAmountStr); //item.SalesAmount=pqEntity.SalesAmount; if (item.PaymentDueDateStr != string.Empty) { // pqEntity.PaymentDueDate = Convert.ToDateTime(item.PaymentDueDateStr); pqEntity.PaymentDueDate = Utility.SimpleDateTime(item.PaymentDueDateStr); //Sunil Sharma } else { pqEntity.PaymentDueDate = null; } //pqEntity.AmountDueStr = Convert.ToString(item.AmountDue); pqEntity.AmountDue = Convert.ToDecimal(item.AmountDueStr); // pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted); pqEntity.AmountAdjusted = Convert.ToDecimal(item.AmountAdjustedStr); pqEntity.Discount = Convert.ToDecimal(item.DiscountStr); PQForm.PaymentFromCustomerDetails.Add(pqEntity); } return(PQForm); }
public PaymentFromCustomerForm GetDataIntoModel() { PaymentFromCustomerForm PQForm = new PaymentFromCustomerForm(); PQForm.PaymentFromCustomerDetails = new List <PaymentFromCustomerDetailsEntity>(); PaymentFromCustomerEntity model = new PaymentFromCustomerEntity(); // this.ID = pqf.PaymentFromCustomer.ID; model.CustomerID = this.SelectedCustomerID; model.AccountId = this.SelectedAccountID; model.Date = this.Date; model.AmountStr = this.AmountStr; model.Amount = Convert.ToDecimal(this.AmountStr); model.IsCheque = this.IsCheque; model.CashChequeNo = this.CashChequeNo; model.Remarks = this.Remarks; if (this.IsChequeTrue == true) { model.IsCheque = true; } else { model.IsCheque = false; } PQForm.PaymentFromCustomer = model; foreach (var item in PQDetailsEntity) { PaymentFromCustomerDetailsEntity pqEntity = new PaymentFromCustomerDetailsEntity(); pqEntity.SalesNo = item.SalesNo; pqEntity.SalesDate = item.SalesDate; pqEntity.SalesAmount = Convert.ToDecimal(item.SalesAmountStr); //item.SalesAmount=pqEntity.SalesAmount; if (item.PaymentDueDateStr != string.Empty) { pqEntity.PaymentDueDate = Convert.ToDateTime(item.PaymentDueDateStr); } else { pqEntity.PaymentDueDate = null; } //pqEntity.AmountDueStr = Convert.ToString(item.AmountDue); pqEntity.AmountDue = Convert.ToDecimal(item.AmountDueStr); // pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted); pqEntity.AmountAdjusted = Convert.ToDecimal(item.AmountAdjustedStr); pqEntity.Discount = Convert.ToDecimal(item.DiscountStr); PQForm.PaymentFromCustomerDetails.Add(pqEntity); } return(PQForm); }