public ManualScheduleForm(Loan loan)
 {
     InitializeComponent();
     olvSchedule.RowFormatter = FormatRow;
     Loan = loan;
     InitializeSchedule();
 }
 public LoanDisbursementForm(Loan pLoan)
 {
     _loan = pLoan;
     _exchangeRate = null;
     InitializeComponent();
     Initialization();
 }
Beispiel #3
0
        public void CalculateExpectedOLB2()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency { Id = 1 }
            };
            package.KeepExpectedInstallment = false;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 20000, 0.02m, 10, 0, new DateTime(2009, 1, 17), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            myContract.BadLoan = false;

            myContract.Repay(1, new DateTime(2009, 1, 17), 1000, true, false);

            Assert.AreEqual(19000, myContract.CalculateExpectedOlb(1, false).Value);
            Assert.AreEqual(17100, myContract.CalculateExpectedOlb(2, false).Value);
            Assert.AreEqual(15200, myContract.CalculateExpectedOlb(3, false).Value);
            Assert.AreEqual(13300, myContract.CalculateExpectedOlb(4, false).Value);
            Assert.AreEqual(11400, myContract.CalculateExpectedOlb(5, false).Value);
            Assert.AreEqual(9500, myContract.CalculateExpectedOlb(6, false).Value);
            Assert.AreEqual(7600, myContract.CalculateExpectedOlb(7, false).Value);
            Assert.AreEqual(5700, myContract.CalculateExpectedOlb(8, false).Value);
            Assert.AreEqual(3800, myContract.CalculateExpectedOlb(9, false).Value);
            Assert.AreEqual(1900, myContract.CalculateExpectedOlb(10, false).Value);
        }
        public void DecliningRate_ExoticInstallments_GracePeriod()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.DecliningFixedInstallments,
                ChargeInterestWithinGracePeriod = true,
                                          ExoticProduct = new ExoticInstallmentsTable
                                                              {
                                                                  new ExoticInstallment(1, 0.1, null),
                                                                  new ExoticInstallment(2, 0.1, null),
                                                                  new ExoticInstallment(3, 0.1, null),
                                                                  new ExoticInstallment(4, 0.1, null),
                                                                  new ExoticInstallment(5, 0.1, null),
                                                                  new ExoticInstallment(6, 0.5, null)
                                                              },
                Currency = new Currency { Id = 1 }
                                      };
            Loan myContract = new Loan(package, 1000, 0.03m, 7, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            _AssertSpecifiedInstallment(myContract.GetInstallment(0), 1, new DateTime(2006, 2, 1), 30.00m,       0, 1000);
            _AssertSpecifiedInstallment(myContract.GetInstallment(1), 2, new DateTime(2006, 3, 1), 30.00m, 100.00m, 1000);
            _AssertSpecifiedInstallment(myContract.GetInstallment(2), 3, new DateTime(2006, 4, 3), 27.00m, 100.00m,  900);
            _AssertSpecifiedInstallment(myContract.GetInstallment(3), 4, new DateTime(2006, 5, 1), 24.00m, 100.00m,  800);
            _AssertSpecifiedInstallment(myContract.GetInstallment(4), 5, new DateTime(2006, 6, 1), 21.00m, 100.00m,  700);
            _AssertSpecifiedInstallment(myContract.GetInstallment(5), 6, new DateTime(2006, 7, 3), 18.00m, 100.00m,  600);
            _AssertSpecifiedInstallment(myContract.GetInstallment(6), 7, new DateTime(2006, 8, 1), 15.00m, 500.00m,  500);
        }
 public ReschedulingForm(Loan contract, IClient pClient)
 {
     InitializeComponent();
     _client = pClient;
     _contract = contract;
     InitializeRescheduleComponents();
     Setup();
 }
        public void testFixtureSetUp()
        {
            Loan credit = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
                ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            credit.Id = 4;

            _installmentsOptions = new CalculateInstallmentsOptions(credit.StartDate, OLoanTypes.Flat, true, credit, false);
        }
 public CreditContractRepayForm(Loan pLoan, IClient pClient)
 {
     InitializeComponent();
     _client = pClient;
     _loan = pLoan;
     SetUp();
     toolTip = new ToolTip();
 }
Beispiel #8
0
 public LoanSharesForm(Loan pLoan, Group pGroup)
 {
     InitializeComponent();
     _loan = pLoan;
     _group = pGroup;
     _total = _loan.LoanShares.Sum(x => x.Amount.Value);
     
     InitializeControls();
 }
Beispiel #9
0
        public MembersOfGroup(List<Member> pMembers, Loan pLoan, DateTime pDate)
        {
            InitializeComponent();
            _loan = pLoan;
            _paymentDate = pDate;
            OCurrency olb = _loan.CalculateActualOlb();
            Member leader = null;
            int roundTo = _loan.UseCents ? 2 : 0;
            OCurrency loanAmount =
                _loan.Events.GetLoanRepaymentEvents().Where(
                    rpe => rpe.RepaymentType == OPaymentType.PersonTotalPayment && !rpe.Deleted).Aggregate(
                        _loan.Amount, (current, rpe) => current - rpe.Principal);

            foreach (Member person in pMembers)
            {
                OCurrency olbByPerson = 0;
                OCurrency actualOlb = _loan.CalculateActualOlb();

                foreach (LoanShare loanShare in _loan.LoanShares)
                {
                    if (loanShare.PersonId == person.Tiers.Id && person.CurrentlyIn)
                    {
                        olbByPerson = actualOlb*loanShare.Amount/loanAmount;
                    }
                }
                olb -= Math.Round(olbByPerson.Value, roundTo);
                // Define the list items
                if (!person.IsLeader)
                {
                    Color color = person.CurrentlyIn ? Color.Black : Color.Silver;
                    ListViewItem lvi = new ListViewItem {Tag = person, Text = ((Person) person.Tiers).Name};
                    lvi.UseItemStyleForSubItems = false;
                    lvi.ForeColor = color;
                    lvi.SubItems.Add(olbByPerson.GetFormatedValue(_loan.UseCents));
                    listViewMembers.Items.Add(lvi);
                }
                else
                {
                    leader = person;
                    leader.LoanShareAmount = olbByPerson;
                }
            }

            if (leader != null)
            {
                leader.LoanShareAmount += olb;
                Color color = leader.CurrentlyIn ? Color.Red : Color.Silver;
                ListViewItem lvi = new ListViewItem { Tag = leader, Text = ((Person)leader.Tiers).Name };
                lvi.UseItemStyleForSubItems = false;
                lvi.ForeColor = color;
                lvi.SubItems.Add(leader.LoanShareAmount.GetFormatedValue(_loan.UseCents));
                listViewMembers.Items.Add(lvi);
            }
        }
 public void TestGetWriteOffContracts()
 {
     ClosureContractStock closureContractStock = new ClosureContractStock();
     Loan contract1 = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
                            {Id = 1};
     Loan contract2 = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
     contract2.Events.Add(new WriteOffEvent());
     contract2.Id = 2;
     contract2.WrittenOff = true;
     closureContractStock.AddContract(contract1);
     closureContractStock.AddContract(contract2);
     Assert.AreEqual(1,closureContractStock.WriteOffContracts.Count);
 }
 public void TestDeleteContract()
 {
     ClosureContractStock closureContractStock = new ClosureContractStock();
     Loan contract1 = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
                            {Id = 1};
     Loan contract2 = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
                            {Id = 2};
     closureContractStock.AddContract(contract1);
     closureContractStock.AddContract(contract2);
     Assert.AreEqual(2,closureContractStock.Contracts.Count);
     closureContractStock.DeleteContract(contract1.Id);
     Assert.AreEqual(1,closureContractStock.Contracts.Count);
 }
Beispiel #12
0
 public AddTrancheForm(Loan contract, IClient pClient)
 {
     InitializeComponent();
     Setup();
     _client = pClient;
     _contract = contract;
     interestRateNumericUpDown.Value = contract.InterestRate * 100;
     if (contract.Product.InterestRate.HasValue) { /* checkBoxIRChanged.Enabled = false; */ }
     else
     {
         interestRateNumericUpDown.Minimum = Convert.ToDecimal(contract.Product.InterestRateMin * 100);
         interestRateNumericUpDown.Maximum = Convert.ToDecimal(contract.Product.InterestRateMax * 100);
     }
     InitializeTrancheComponents();
 }
Beispiel #13
0
        public ManualScheduleForm(Loan loan)
        {
            InitializeComponent();
            olvSchedule.RowFormatter = FormatRow;
            Loan = loan;
            InitializeSchedule();

            ObjectListView.EditorRegistry.Register(typeof(DateTime), delegate
            {
                var picker = new DateTimePicker();
                picker.Format = DateTimePickerFormat.Custom;
                picker.CustomFormat = ApplicationSettings.GetInstance("").SHORT_DATE_FORMAT;
                return picker;
            });
        }
        public void FlatRate_BiWeeklyInstallmentType_GracePeriod()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Bi-Weekly", 14, 0),
                LoanType = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency { Id = 1, UseCents = true}
            };
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 2, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            _AssertSpecifiedInstallment(myContract.GetInstallment(0), 1, new DateTime(2006, 1, 16), 32.14m, 0, 1000);
            _AssertSpecifiedInstallment(myContract.GetInstallment(1), 2, new DateTime(2006, 1, 30), 30.00m,   0, 1000);
            _AssertSpecifiedInstallment(myContract.GetInstallment(2), 3, new DateTime(2006, 2, 13), 30.00m, 250, 1000);
            _AssertSpecifiedInstallment(myContract.GetInstallment(3), 4, new DateTime(2006, 2, 27), 30.00m, 250,  750);
            _AssertSpecifiedInstallment(myContract.GetInstallment(4), 5, new DateTime(2006, 3, 13), 30.00m, 250,  500);
            _AssertSpecifiedInstallment(myContract.GetInstallment(5), 6, new DateTime(2006, 3, 27), 30.00m, 250,  250);
        }
        public void CalculateRemainingInterest_AccrualAccounting()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency { Id = 1, UseCents = true}
            };
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 0, new DateTime(2009, 12, 25), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));

            myContract.Repay(1, new DateTime(2010, 1, 25), 196.67m, false, true);

            Assert.AreEqual(17.42m, Math.Round(myContract.CalculateRemainingInterests(new DateTime(2010, 2, 12)).Value, 2));

            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
        }
 public void SetUp()
 {
     _factory = new OctopusScheduleConfigurationFactory(NonWorkingDateSingleton.GetInstance(string.Empty));
     _loan = new Loan
     {
         Amount = 0m,
         NbOfInstallments = 0,
         GracePeriod = 0,
         InterestRate = 0,
         StartDate = DateTime.Today,
         FirstInstallmentDate = DateTime.Today,
         Product = new LoanProduct
         {
             LoanType = OLoanTypes.Flat,
             Currency = new Currency { Name = "USD" },
         },
         InstallmentType = new InstallmentType { NbOfDays = 0, NbOfMonths = 1 },
     };
 }
 public string GenerateContractCode(IClient client, Loan loan, SqlTransaction transaction)
 {
     var settings = ApplicationSettings.GetInstance(User.CurrentUser.Md5);
     var pattern = settings.ContractCodeTemplate;
     var clientName = client is Person ? (client as Person).LastName : client.Name;
     clientName = clientName.Replace(" ", string.Empty);
     clientName = clientName.Length < 5 ? clientName : clientName.Substring(0, 5);
     return pattern
         .Replace("BC", loan.BranchCode)
         .Replace("DT", client.District.Name.Substring(0, 1 == client.District.Name.Length ? 1 : 2))
         .Replace("YY", loan.StartDate.Year.ToString(CultureInfo.InvariantCulture).Substring(2, 2))
         .Replace("yyyy", loan.StartDate.Year.ToString(CultureInfo.InvariantCulture))
         .Replace("LO", loan.LoanOfficer.Name.Substring(0, 2).ToUpper())
         .Replace("PC", loan.Product.Code)
         .Replace("LC", (client.LoanCycle + 1).ToString(CultureInfo.InvariantCulture))
         .Replace("JC", client.Projects.Count.ToString(CultureInfo.InvariantCulture))
         .Replace("ID", client.Id.ToString(CultureInfo.InvariantCulture))
         .Replace("LN", clientName.ToUpper()) + "/" + loan.Id;
 }
Beispiel #18
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,
                                              InstallmentNumber =
                                                  contract.GetLastFullyRepaidInstallment() == null
                                                      ? 1
                                                      : contract.GetLastFullyRepaidInstallment().Number + 1
                                          };
            _contract.CalculateStartDates();
            return rSe;
        }
        public void Init(IClient client, Loan loan, Guarantee guarantee, SavingBookContract savings, IList<IPrintButtonContextMenuStrip> printMenus)
        {
            _printButton.AttachmentPoint = AttachmentPoint.CreditCommittee;
            Visibility visibility;
            switch (client.Type)
            {
                case OClientTypes.Person:
                    visibility = Visibility.Individual;
                    break;

                case OClientTypes.Group:
                    visibility = Visibility.Group;
                    break;

                case OClientTypes.Corporate:
                    visibility = Visibility.Corporate;
                    break;

                default:
                    visibility = Visibility.All;
                    break;
            }
            _printButton.Visibility = visibility;

            _printButton.ReportInitializer =
                report =>
                {
                    report.SetParamValue("user_id", User.CurrentUser.Id);
                    if (loan != null) report.SetParamValue("contract_id", loan.Id);
                };
            _printButton.LoadReports();

            foreach (var item in printMenus)
            {
                var menuItems = item.GetContextMenuStrip(client, loan, guarantee, savings, AttachmentPoint.CreditCommittee.ToString());
                if (menuItems == null) continue;

                foreach (var menuItem in menuItems)
                {
                    _printButton.Menu.Items.Add(menuItem);
                }
            }
        }
Beispiel #20
0
 public AddTrancheForm(Loan contract, IClient pClient)
 {
     InitializeComponent();
     _client = pClient;
     this._contract = contract;
     labelContractCode.Text = contract.Code;
     labelMaturityUnity.Text = contract.InstallmentType.Name;
     _IR = Convert.ToDecimal(contract.InterestRate);
     numericUpDownNewIR.Value = _IR * 100;
     numericUpDownNewIR.Text = (_IR * 100).ToString();
     if (contract.Product.InterestRate.HasValue) { /* checkBoxIRChanged.Enabled = false; */ }
     else
     {
         numericUpDownNewIR.Minimum = Convert.ToDecimal(contract.Product.InterestRateMin * 100);
         numericUpDownNewIR.Maximum = Convert.ToDecimal(contract.Product.InterestRateMax * 100);
     }
     DisplayInstallmentsForRepaymentsStatus(this._contract);
     InitializeTrancheComponents();
     CenterToScreen();
 }
Beispiel #21
0
        public EditContractSchedule(ref Loan pLoan)
        {
            InitializeComponent();
            if (pLoan.Product.LoanType == OLoanTypes.Flat && !pLoan.UseCents)
            {
                pnlRounding.Visible = true;
                rbtnRoundTo5.Visible = true;
                rbtnRoundTo10.Visible = true;
                rbtnInitialSchedule.Visible = true;
            }
            if (pLoan.Product.LoanType == OLoanTypes.DecliningFixedPrincipal)
            {
                pnlRounding.Visible = true;
                chxAutomaticCalculation.Visible = true;
            }

            _loan = pLoan;
            _initialLoan = _loan;
            InitializeSchedule();
        }
Beispiel #22
0
 public AddTrancheForm(Loan contract, IClient pClient)
 {
     InitializeComponent();
     Setup();
     _client = pClient;
     _contract = contract;
     interestRateNumericUpDown.Value = contract.InterestRate * 100;
     if (contract.Product.InterestRate.HasValue) { /* checkBoxIRChanged.Enabled = false; */ }
     else
     {
         interestRateNumericUpDown.Minimum = Convert.ToDecimal(contract.Product.InterestRateMin * 100);
         interestRateNumericUpDown.Maximum = Convert.ToDecimal(contract.Product.InterestRateMax * 100);
     }
     InitializeTrancheComponents();
     FillComboBoxPaymentMethods();
     startDateTimePicker.Format = DateTimePickerFormat.Custom;
     startDateTimePicker.CustomFormat = ApplicationSettings.GetInstance("").SHORT_DATE_FORMAT;
     firstRepaymentDateTimePicker.Format = DateTimePickerFormat.Custom;
     firstRepaymentDateTimePicker.CustomFormat = ApplicationSettings.GetInstance("").SHORT_DATE_FORMAT;
 }
Beispiel #23
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;
        }
        public EventCancelConfirmationForm(Loan pContract, Event pEvent, List<Installment> archivedInstallments)
        {
            InitializeComponent();
            _contract = pContract;
            _archivedInstallments = archivedInstallments;
            _event = pEvent;

            if ((archivedInstallments == null) || (archivedInstallments.Count == 0))
            {
                listViewRepayments.Visible = false;
                cbShowCurrentState.Visible = false;
                lblComeBackToState.Visible = false;
                DisplayEvent();
            }
            else
            {
                listViewEvents.Visible = false;
                lblConfirmEventDelete.Visible = false;
                DisplayInstallmentsForRepaymentsStatus();
            }
        }
Beispiel #25
0
        private static OCurrency _LoanLossReserveBalance(Loan pCredit,ProvisionTable pProvisionningTable, 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);
            }

            balance += pCredit.GetUnpaidLatePenalties(TimeProvider.Today);
            
            int pastDueDays = pCredit.GetPastDueDays(TimeProvider.Today);
            balance += pCredit.GetOlb() * Convert.ToDecimal(pProvisionningTable.GetProvisiningRateByNbOfDays(pastDueDays).Rate);
            
            OCurrency realBalance = 0;
            
            return balance > realBalance ? balance : realBalance;
        }
Beispiel #26
0
        public Loan EditSchedule(Loan pLoan, int roundTo)
        {
            Loan temp = pLoan.Copy();
            int sum = 0;
            if (roundTo == 0)
                return pLoan;

            foreach (Installment installment in temp.InstallmentList)
            {
                if (installment.Number != temp.InstallmentList.Count)
                {
                    int dif = Convert.ToInt32(installment.CapitalRepayment.Value + installment.InterestsRepayment.Value) % roundTo;
                    dif = dif > roundTo - dif ? roundTo - dif : -dif;
                    installment.CapitalRepayment += dif;
                    sum += dif;
                }
                else
                {
                    installment.CapitalRepayment -= sum;
                }
            }
            return temp;
        }
        public void DecliningBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepNotExpectedInstallment()
        {
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.DecliningFixedInstallments,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency { Id = 1, UseCents = true},
                RoundingType = ORoundingType.Approximate
            };
            package.KeepExpectedInstallment = false;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.InitialAmount = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType,package.KeepExpectedInstallment,false,0,0,false,0,package.AnticipatedTotalRepaymentPenaltiesBase);
            repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            //30 + 218.35 + 1000 * 0.003 * 42
            Assert.AreEqual(374.35m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
        }
 private void WriteOffOrigination(WriteOffEvent writeOffEvent, Loan loanContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(writeOffEvent, loanContract.Id, sqlTransac);
 }
 private void TrancheEventOrigination(TrancheEvent trancheEvent, Loan pContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(trancheEvent, pContract.Id, sqlTransac);
 }
 private void ReschedulingOfALoanOrigination(RescheduleLoanEvent rescheduleLoanEvent, Loan pContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(rescheduleLoanEvent, pContract.Id, sqlTransac);
 }