private void WriteValues() { foreach (MemberLoan memberLoan in MemberLoans) { LoanPayment hist = LoansHistory.Find(x => x.Id == memberLoan.Id); if (hist.AmountPaid == memberLoan.LoanAmount) { continue; } Loan loan = _loanRepository.Query(lo => lo.LoanNo == hist.Loan.LoanNo).Single(); loan.Paid = (loan.Paid - hist.AmountPaid); loan.Paid = (loan.Paid + memberLoan.LoanAmount); loan.Balance = loan.Amount - loan.Paid; SetLoanStatus(loan); hist.AmountPaid = memberLoan.LoanAmount; decimal newLoansTotal = MemberLoans.Sum(x => x.LoanAmount); _paymentDetail.AmountDue = newLoansTotal; _paymentDetail.NetPayments = (_payment.Amount * _paymentDetail.ShareNumbers) - newLoansTotal; } }
private void WriteValues() { foreach (MemberLoan memberLoan in MemberLoans) { LoanPayment loanPayment = LoansHistory.Find(x => x.DocNo == memberLoan.DocNo); if (loanPayment.AmountPaid == memberLoan.LoanAmount) { continue; } Loan loan = _loanRepository.Single(lo => lo.LoanNo == loanPayment.Loan.LoanNo); loanPayment.AmountPaid = memberLoan.LoanAmount; SetLoanStatus(loan, loanPayment.AmountPaid); decimal newLoansTotal = MemberLoans.Sum(x => x.LoanAmount); _paymentDetail.NetPayments = (_payment.Amount * _paymentDetail.ShareNumbers) - newLoansTotal; } }