예제 #1
0
        private static OCurrency _AccruedInterestsLoanBalance(Loan pCredit)
        {
            if (!pCredit.Disbursed || pCredit.Rescheduled) return 0;
            if (pCredit.GetPastDueDays(TimeProvider.Today) != 0) return 0;

            foreach (Installment installment in pCredit.InstallmentList)
            {
                if(!installment.IsRepaid)
                {
                    DateTime date = installment.Number == 1
                                        ? pCredit.StartDate
                                        : pCredit.GetInstallment(installment.Number - 2).ExpectedDate;
                    int days = (TimeProvider.Today - date).Days;
                    OCurrency accruedInterest = installment.InterestsRepayment * (double)days / (double)DateTime.DaysInMonth(date.Year, date.Month);
                    accruedInterest -= installment.PaidInterests;

                    return accruedInterest > 0 ? accruedInterest : 0;
                }
            }
            return 0;
        }
예제 #2
0
        private static OCurrency _DeferredIncomeBalance(Loan pCredit)
        {
            if (!pCredit.Disbursed || pCredit.GetPastDueDays(TimeProvider.Today) != 0) return 0;

            OCurrency repaidAmount = 0;
            foreach (Installment installment in pCredit.InstallmentList)
            {
                if (TimeProvider.Today >= installment.ExpectedDate) continue;
                repaidAmount += installment.PaidInterests;
            }

            foreach (Installment installment in pCredit.InstallmentList)
            {
                if (TimeProvider.Today >= installment.ExpectedDate) continue;
                DateTime date = installment.Number == 1
                                    ? pCredit.StartDate
                                    : pCredit.GetInstallment(installment.Number - 2).ExpectedDate;
                int days = (TimeProvider.Today - date).Days;
                OCurrency accruedInterest = installment.InterestsRepayment * (double)days / (double)DateTime.DaysInMonth(date.Year, date.Month);
                repaidAmount -= accruedInterest;
                break;
            }
            return repaidAmount > 0 ? repaidAmount : 0;
        }
예제 #3
0
        private static OCurrency _InterestOnRescheduledloanBalance(Loan pCredit)
        {
            if (!pCredit.Rescheduled) return 0;

            OCurrency balance = 0;
            balance += pCredit.GetPaidInterest();
            foreach (BadLoanRepaymentEvent e in pCredit.Events.GetEventsByType(typeof(BadLoanRepaymentEvent)))
            {
                balance -= e.Interests;
            }

            if (pCredit.GetPastDueDays(TimeProvider.Today) != 0) return balance;
            foreach (Installment installment in pCredit.InstallmentList)
            {
                if (!installment.IsRepaid)
                {
                    DateTime date = installment.Number == 1
                                        ? pCredit.StartDate
                                        : pCredit.GetInstallment(installment.Number - 2).ExpectedDate;
                    int days = (TimeProvider.Today - date).Days;
                    OCurrency accruedInterest = installment.InterestsRepayment * (double)days / (double)DateTime.DaysInMonth(date.Year, date.Month);
                    accruedInterest -= installment.PaidInterests;

                    balance += accruedInterest > 0 ? accruedInterest : 0;
                    break;
                }
            }
            return balance;
        }