private static OCurrency _PenaltiesPastDueLoansBalanceAsset(Loan pCredit, int writeOffDays) { OCurrency balance = 0; if (!pCredit.Disbursed) return balance; if (pCredit.GetPastDueDays(TimeProvider.Today) == 0) return balance; if (pCredit.GetPastDueDays(TimeProvider.Today) > writeOffDays) return balance; balance += pCredit.GetUnpaidLatePenalties(TimeProvider.Today); return balance; }
private static OCurrency _LoanLossReserveBalance(Loan pCredit, ProvisionTable pProvisionningTable, int writeOffDays) { OCurrency theoricBalance = 0; if (!pCredit.Disbursed) return theoricBalance; if (pCredit.GetPastDueDays(TimeProvider.Today) == 0) return theoricBalance; if (pCredit.GetPastDueDays(TimeProvider.Today) > writeOffDays) return theoricBalance; foreach (Installment installment in pCredit.InstallmentList) { if (installment.ExpectedDate >= TimeProvider.Today) break; theoricBalance += (installment.InterestsRepayment - installment.PaidInterests); } theoricBalance += pCredit.GetUnpaidLatePenalties(TimeProvider.Today); int pastDueDays = pCredit.GetPastDueDays(TimeProvider.Today); theoricBalance += pCredit.GetOlb() * Convert.ToDecimal(pProvisionningTable.GetProvisiningRateByNbOfDays(pastDueDays).Rate); OCurrency realBalance = 0; return theoricBalance > realBalance ? theoricBalance : realBalance; }