Example #1
0
        private static OCurrency GetValue(ProvisionEvent eventItem, ContractAccountingRule rule)
        {
            OCurrency amount = 0;

            if (rule.EventAttribute.Name.ToLower() == "amount")
            {
                amount = eventItem.Amount;
            }
            return(amount);
        }
Example #2
0
        public void Test_ProvisionRescheduledLoanProcessing()
        {
            Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6);

            OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLI =
                _SetRepaymentOptions(myContract, false);

            ProvisionTable provisionTable = ProvisionTable.GetInstance(new User());

            provisionTable.ProvisioningRates = new List <ProvisioningRate>();
            provisionTable.Add(new ProvisioningRate {
                Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, Rate = 0.5
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, Rate = 1
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, Rate = 1.5
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 3, NbOfDaysMin = 60, NbOfDaysMax = 999, Rate = 2
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 4, NbOfDaysMin = -1, NbOfDaysMax = -1, Rate = 1
            });


            Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate);
            myContract.Repay(1, new DateTime(2010, 8, 6), 100, false, false);

            ReschedulingOptions ro = new ReschedulingOptions
            {
                InterestRate              = 0.04m,
                NewInstallments           = 2,
                RepaymentDateOffset       = 0,
                ChargeInterestDuringShift = true,
                ReschedulingDate          = new DateTime(2010, 12, 1)
            };

            myContract.Reschedule(ro);
            myContract.Rescheduled = true;

            rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1));

            ProvisionEvent e = myContract.GetProvisionEvent(new DateTime(2010, 10, 1), provisionTable);

            Assert.AreEqual(e.Code, "LLPE");
            Assert.AreEqual(e.Amount, 1000);
            myContract.Events.Add(e);
        }
Example #3
0
        public void ProvisionLoanProcessing()
        {
            ProvisionTable provisionTable = ProvisionTable.GetInstance(User.CurrentUser);

            foreach (Loan loan in _listLoan)
            {
                _accountingClosure.ClosureStatus     = "ProvisionIsBeingProcessedForContract";
                _accountingClosure.ClosureStatusInfo = " ->" + loan.Code;
                ProvisionEvent e = loan.GetProvisionEvent(TimeProvider.Now, provisionTable);

                if (e != null)
                {
                    _generatedEvents.Add(e);
                }
            }
        }
Example #4
0
        public void Test_ProvisionLoanProcessing()
        {
            Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6);

            OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLI =
                _SetRepaymentOptions(myContract, false);

            ProvisionTable provisionTable = ProvisionTable.GetInstance(new User());

            provisionTable.ProvisioningRates = new List <ProvisioningRate>();
            provisionTable.Add(new ProvisioningRate {
                Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.5, ProvisioningInterest = 0.5, ProvisioningPenalty = 0.5
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty = 1
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 1.5, ProvisioningInterest = 1.5, ProvisioningPenalty = 1.5
            });
            provisionTable.Add(new ProvisioningRate {
                Number = 3, NbOfDaysMin = 60, NbOfDaysMax = 999, ProvisioningValue = 2, ProvisioningInterest = 2, ProvisioningPenalty = 2
            });


            Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate);
            Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate);

            rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1));

            ProvisionEvent e = myContract.GetProvisionEvent(new DateTime(2010, 10, 1), provisionTable);

            Assert.AreEqual(e.Code, "LLPE");
            Assert.AreEqual(e.Amount, 2000);
            myContract.Events.Add(e);
            myContract.Repay(1, new DateTime(2010, 10, 20), 500, false, true);
        }
Example #5
0
 private void ProvisionEventOrigination(ProvisionEvent provisionEvent, Loan loanContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(provisionEvent, loanContract.Id, sqlTransac);
 }
Example #6
0
        public ProvisionEvent GetProvisionEvent(DateTime dateTime, ProvisionTable provisionTable)
        {
            int lateDays = CalculatePastDueSinceLastRepayment(dateTime);
            OCurrency rate = 0;

            foreach (ProvisioningRate provisioningRate in provisionTable.ProvisioningRates)
            {
                if(lateDays >= provisioningRate.NbOfDaysMin && lateDays <= provisioningRate.NbOfDaysMax)
                {
                    rate = (decimal)provisioningRate.Rate;
                }

                if(Rescheduled && provisioningRate.NbOfDaysMin  < 0 && provisioningRate.NbOfDaysMax < 0)
                {
                    rate = (decimal)provisioningRate.Rate;
                }
            }

            ProvisionEvent provisionEvent = new ProvisionEvent
            {
                Id = 0,
                Code = "LLPE",
                Amount = GetOlb() * rate,
                OverdueDays = lateDays,
                Rate = rate,
                Date = TimeProvider.Now,
                User = User.CurrentUser
            };
            if (provisionEvent.Amount > 0)
            {
                Events.Add(provisionEvent);
                return provisionEvent;
            }
            return null;
        }