Ejemplo n.º 1
0
 private static OCurrency _ExpensesLoanLossBalance(Loan pCredit,ProvisionTable pProvisionningTable)
 {
     if (pCredit.Disbursed && !pCredit.AllInstallmentsRepaid && !pCredit.WrittenOff)
         return pCredit.Amount * Convert.ToDecimal(pProvisionningTable.GetProvisiningRateByNbOfDays(0).Rate);
     else
         return 0;
 }
Ejemplo n.º 2
0
 private static OCurrency _BadLoanBalance(Loan pCredit, int badLoanDays)
 {
     int pastDueDays = pCredit.GetPastDueDays(TimeProvider.Today);
     if (pastDueDays <= badLoanDays && pastDueDays != 0)
         return pCredit.GetOlb();
     return 0;
 }
Ejemplo n.º 3
0
        private static OCurrency _CashCreditBalance(Loan pCredit)
        {
            if (!pCredit.Disbursed || pCredit.Rescheduled) return 0;

            if (pCredit.GetPastDueDays(TimeProvider.Today) == 0)
                return pCredit.GetOlb();
            else
                return 0;
        }
Ejemplo n.º 4
0
        private static OCurrency _CashStockBalance(Loan pCredit)
        {
            OCurrency balance = 0;
            if (!pCredit.Disbursed) return balance;

            balance += pCredit.GetPaidFees();
            balance += pCredit.GetPaidInterest();
            balance += pCredit.GetPaidPrincipal();

            return balance - pCredit.Amount;
        }
Ejemplo n.º 5
0
        private static OCurrency _IncomeLoanLossBalance(Loan pCredit, ProvisionTable pProvisionningTable)
        {
            OCurrency olb = pCredit.GetOlb();
            OCurrency rate = Convert.ToDecimal(pProvisionningTable.GetProvisiningRateByNbOfDays(0).Rate);
            if (pCredit.GetPastDueDays(TimeProvider.Today) != 0) olb = 0;
            if (pCredit.WrittenOff) return 0;

            if (!pCredit.Disbursed) return 0;

            if (pCredit.AllInstallmentsRepaid) return 0;

            if (!pCredit.BadLoan) return (pCredit.Amount - olb) * rate;

            else return (pCredit.Amount) * rate;
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
0
        public RescheduleLoanEvent Reschedule(ReschedulingOptions ro, Loan contract, NonWorkingDateSingleton nwdS, ApplicationSettings applicationSettings)
        {
            _contract = contract;
            _nwdS = nwdS;
            _generalSettings = applicationSettings;

            switch (contract.Product.LoanType)
            {
                case OLoanTypes.Flat:
                    _Reschedule_Flat(ro);
                    break;

                case OLoanTypes.DecliningFixedPrincipal:
                    _Reschedule_FixedPrincipal(ro);
                    break;

                case OLoanTypes.DecliningFixedInstallments:
                    _Reschedule_DecliningFixedInstallments(ro);
                    break;
            }

            _Reschedule_AdjustOverpaid();

            RescheduleLoanEvent rSe = new RescheduleLoanEvent
            {
                Date = ro.ReschedulingDate,
                Amount = contract.CalculateActualOlb(),
                Interest = contract.GetTotalInterestDue(),
                ClientType = contract.ClientType,
                BadLoan = contract.BadLoan,
                NbOfMaturity = ro.NewInstallments,
                DateOffset = ro.RepaymentDateOffset,
                GracePeriod = ro.GracePeriod,
                ChargeInterestDuringShift = ro.ChargeInterestDuringShift,
                ChargeInterestDuringGracePeriod = ro.ChargeInterestDuringGracePeriod
            };

            return rSe;
        }
Ejemplo n.º 8
0
        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;
        }
Ejemplo n.º 9
0
        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;
        }
Ejemplo n.º 10
0
 private static OCurrency _LoanLossBalance(Loan pCredit, int writeOffDays)
 {
     if (pCredit.WrittenOff || pCredit.GetPastDueDays(TimeProvider.Today) > writeOffDays) return pCredit.GetOlb();
     return 0;
 }
Ejemplo n.º 11
0
 private static OCurrency _LiabilitiesLoanLossBalance(Loan pCredit, ProvisionTable pProvisionningTable)
 {
     if (pCredit.Disbursed && !pCredit.BadLoan)
         return pCredit.GetPastDueDays(TimeProvider.Today) == 0
                    ? pCredit.GetOlb()* Convert.ToDecimal(pProvisionningTable.GetProvisiningRateByNbOfDays(0).Rate)
                    : 0;
     return 0;
 }
Ejemplo n.º 12
0
        private static OCurrency _InterestsPastDueLoansBalance(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;
            foreach (Installment installment in pCredit.InstallmentList)
            {
                if (installment.ExpectedDate > TimeProvider.Today)
                    break;
                balance += (installment.InterestsRepayment - installment.PaidInterests);
            }

            return balance;
        }
Ejemplo n.º 13
0
 private static OCurrency _AccruedInterestsLoanBalance(Loan pCredit)
 {
     return 0;
 }
Ejemplo n.º 14
0
 private static OCurrency _UnrecoverableBadLoanBalance(Loan pCredit, int badLoanDays, int writeOffDays)
 {
     int pastDueDays = pCredit.GetPastDueDays(TimeProvider.Today);
     if (pastDueDays > badLoanDays && pastDueDays <= writeOffDays)
         return pCredit.GetOlb();
     return 0;
 }
Ejemplo n.º 15
0
 private static OCurrency _CommissionsBalance(Loan pCredit)
 {
     return pCredit.GetPaidCommissions();
 }
Ejemplo n.º 16
0
 private static OCurrency AccruedInterestsRescheduleLoanBalance(Loan pCredit)
 {
     return 0;
 }
Ejemplo n.º 17
0
        public bool IsWriteOffContract(Loan contract)
        {
            if (contract.Events.GetEvent(0) is WriteOffEvent)
                return true;

            return false;
        }
Ejemplo n.º 18
0
 public void AddContract(Loan contract)
 {
     contracts.Add(contract);
 }
Ejemplo n.º 19
0
 private static OCurrency _RescheduledLoanBalance(Loan pCredit)
 {
     if (pCredit.Rescheduled)
         return pCredit.GetOlb();
     else
         return 0;
 }
Ejemplo n.º 20
0
        private static OCurrency _ProvisionWriteOffBalance(Loan pCredit, int writeOffDays)
        {
            OCurrency balance = 0;
            if (pCredit.WrittenOff || pCredit.GetPastDueDays(TimeProvider.Today) > writeOffDays) return pCredit.GetOlb();

            foreach (BadLoanRepaymentEvent e in pCredit.Events.GetEventsByType(typeof(BadLoanRepaymentEvent)))
            {
                balance += e.AccruedProvision;
            }
            return balance;
        }
Ejemplo n.º 21
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;
            }
            return balance;
        }
Ejemplo n.º 22
0
 private static OCurrency _RescheduledLoanBalance(Loan pCredit)
 {
     return pCredit.Rescheduled ? pCredit.GetOlb() : 0;
 }
Ejemplo n.º 23
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;
        }
Ejemplo n.º 24
0
 public void AddCredit(Loan pCredit,OClientTypes pClientType)
 {
     pCredit.ClientType = pClientType;
     pCredit.Project = this;
     _credits.Add(pCredit);
 }
Ejemplo n.º 25
0
 private static OCurrency _DeferredIncomeBalance(Loan pCredit)
 {
     return 0;
 }
Ejemplo n.º 26
0
        public static OCurrency GetStockBalance(Loan pCredit, ApplicationSettings settings, ProvisionTable pProvisionningTable, string pAccountNumber)
        {
            OCurrency balance = 0;

            return balance;
        }
Ejemplo n.º 27
0
        private static OCurrency _InterestOnBadloanBalance(Loan pCredit)
        {
            OCurrency balance = 0;

            if (!pCredit.Disbursed) return 0;

            if (pCredit.GetPastDueDays(TimeProvider.Today) > 0)
            {
                foreach (Installment installment in pCredit.InstallmentList)
                {
                    if (installment.ExpectedDate > TimeProvider.Today)
                        break;
                    balance += (installment.InterestsRepayment - installment.PaidInterests);
                }
            }

            OCurrency realBalance = 0;
            return balance > realBalance ? balance : realBalance;
        }
Ejemplo n.º 28
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;
        }
Ejemplo n.º 29
0
 public void AddLoan(Loan loanAccount)
 {
     _loans.Add(loanAccount);
 }