当前位置: 首页>>代码示例>>C#>>正文


C# LoanRepayment.CreditContractRepayment类代码示例

本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.CreditContractRepayment的典型用法代码示例。如果您正苦于以下问题:C# CreditContractRepayment类的具体用法?C# CreditContractRepayment怎么用?C# CreditContractRepayment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CreditContractRepayment类属于OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment命名空间,在下文中一共展示了CreditContractRepayment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InstallmentType

        public void CalculateEvent_RepayTotallyDecliningBadLoan_42dayslate_NonRepaymentFeesBaseOnInitialAmount_KeepExpectedInstallment()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            LoanProduct package = new LoanProduct{
                                                     InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                                     LoanType = OLoanTypes.DecliningFixedInstallments,
                                                     ChargeInterestWithinGracePeriod = true,
                                                     Currency = new Currency {Id = 1, UseCents = true},
                                                     KeepExpectedInstallment = true,
                                                     AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB,
                                                     RoundingType = ORoundingType.Approximate
                                                 };
            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);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 15), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(1247.77m, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));
            RepaymentEvent bLRE = myContract.Repay(1, new DateTime(2006, 3, 15), 1247.77m, false, true);

            Assert.AreEqual(126m, bLRE.Fees.Value);
            Assert.AreEqual(121.77m, bLRE.Interests.Value);
            Assert.AreEqual(1000.00m, bLRE.Principal.Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:27,代码来源:TestCreditContractRepayment.cs

示例2: TestTotalAnticipatedRepaymentFormerPrepaymentSameDayDecliningCash

        public void TestTotalAnticipatedRepaymentFormerPrepaymentSameDayDecliningCash()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.DecliningFixedInstallments,
                                          ChargeInterestWithinGracePeriod = true,
                                          GracePeriod = 0,
                                          Currency = new Currency { Id = 1, UseCents = true}
                                      };
            package.KeepExpectedInstallment = true;
            package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03m, 6, 0, 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);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 1, 1), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(1107.58m, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));

            RepaymentEvent bLRE = myContract.Repay(1, new DateTime(2006, 1, 1), 194.60m, false, true);

            Assert.AreEqual(0, bLRE.Fees.Value);
            Assert.AreEqual(40m, bLRE.Interests.Value);
            Assert.AreEqual(154.60, bLRE.Principal.Value);

            cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 1, 1), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(912.98m, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));

            bLRE = myContract.Repay(2, new DateTime(2006, 1, 1), 912.98m, true, true);

            Assert.AreEqual(0, bLRE.Fees.Value);
            Assert.AreEqual(67.58m, bLRE.Interests.Value);
            Assert.AreEqual(845.40m, bLRE.Principal.Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:40,代码来源:TestCreditContractRepayment.cs

示例3: DecliningRate_OneMonthlate_FeesBasedOnOverdueAmountAndInterest_KeepNotExpectedInstallment

        public void DecliningRate_OneMonthlate_FeesBasedOnOverdueAmountAndInterest_KeepNotExpectedInstallment()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            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;
            Loan myContract = new Loan(package, 600, 0.03m, 6, 0, new DateTime(2006, 1, 4), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.OverDuePrincipal = 0.0016277;
            myContract.NonRepaymentPenalties.OverDueInterest = 0.0016277;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0,package.AnticipatedTotalRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 6), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(227.78m, cCR.MaximumAmountToRegradingLoan.Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:22,代码来源:TestCreditContractRepayment.cs

示例4: TestRepayFlatLoan2

        public void TestRepayFlatLoan2()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);

            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.Flat,
                                          ChargeInterestWithinGracePeriod = true,
                                          Currency = new Currency { Id = 1, UseCents = true }
                                      };
            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);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 15), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
            Assert.AreEqual(1194,Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value,2));
            Assert.AreEqual(386,Math.Round(cCR.MaximumAmountToRegradingLoan.Value,2));

            Assert.AreEqual(42, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 3, 15)));
            RepaymentEvent rPE = myContract.Repay(1,new DateTime(2006,3,15),386,false,false);
            Assert.AreEqual(126m,rPE.Fees.Value);
            Assert.AreEqual(60m,rPE.Interests.Value);
            Assert.AreEqual(200m,rPE.Principal.Value);
            Assert.IsFalse(myContract.BadLoan);

            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 3, 15)));
            CreditContractRepayment cCR2 = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 15), 3, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
            Assert.AreEqual(0, Math.Round(cCR2.MaximumAmountToRegradingLoan.Value,2));
            Assert.AreEqual(808, Math.Round(cCR2.MaximumAmountAuthorizeToRepay.Value,2));

            RepaymentEvent rPE2 = myContract.Repay(3,new DateTime(2006,3,15), 808m, false, false);
            Assert.AreEqual(8m, rPE2.Fees.Value);
            Assert.AreEqual(0m, rPE2.Interests.Value);
            Assert.AreEqual(800m, rPE2.Principal.Value);

            Assert.IsTrue(myContract.AllInstallmentsRepaid);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:44,代码来源:TestCreditContractRepayment.cs

示例5: TestRepayFlatLoanWhenCalculateFeesWithDelta2

        public void TestRepayFlatLoanWhenCalculateFeesWithDelta2()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.DecliningFixedInstallments,
                                          ChargeInterestWithinGracePeriod = true,
                                          Currency = new Currency {Id = 1},
                                          KeepExpectedInstallment = false
                                      };

            Loan myContract = new Loan(package, 600, 0.03m, 6, 0, new DateTime(2006, 1, 4), new User(),
                                       ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
                                       ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
                                  {
                                      BadLoan = false,
                                      NonRepaymentPenalties = {OverDueInterest = 0.02, OverDuePrincipal = 0.02},
                                      AnticipatedTotalRepaymentPenalties = 0
                                  };

            Assert.AreEqual(new DateTime(2006, 2, 6), myContract.GetInstallment(0).ExpectedDate);

            RepaymentEvent rPE = myContract.Repay(1, new DateTime(2006, 3, 6), 50, false, false);

            Assert.AreEqual(50m, rPE.Fees.Value);
            Assert.AreEqual(0m, rPE.Interests.Value);
            Assert.AreEqual(0m, rPE.Principal.Value);

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType,
                                                                  package.KeepExpectedInstallment,
                                                                  false,
                                                                  0, 0,
                                                                  false,
                                                                  0,
                                                                  package.AnticipatedTotalRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 4, 4), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(414m, cCR.MaximumAmountToRegradingLoan.Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:40,代码来源:TestCreditContractRepayment.cs

示例6: TestRounding

        public void TestRounding()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true,
                Currency = new Currency { Id = 1 }
            };
            package.KeepExpectedInstallment = true;
            package.AnticipatedRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisioningTable.GetInstance(new User()));
            myContract.BadLoan = false;
            myContract.NonRepaymentPenalties.InitialAmount = 0.003;
            myContract.AnticipatedRepaymentPenalties = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, false, 0,
                                                                  package.AnticipatedRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 2, 1), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
            Assert.AreEqual(1180, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));

            myContract.Repay(1,new DateTime(2006,2,1),1179.97m,false,true);
            Assert.AreEqual(0,myContract.GetInstallment(0).PaidCapital.Value);
            Assert.AreEqual(200, myContract.GetInstallment(1).PaidCapital.Value);
            Assert.AreEqual(200, myContract.GetInstallment(2).PaidCapital.Value);
            Assert.AreEqual(200, myContract.GetInstallment(3).PaidCapital.Value);
            Assert.AreEqual(200, myContract.GetInstallment(4).PaidCapital.Value);
            Assert.AreEqual(199.97m, myContract.GetInstallment(5).PaidCapital.Value);
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:30,代码来源:TestCreditContractRepayment.cs

示例7: CalculateAmountToRepaySpecifiedInstallment

        public OCurrency CalculateAmountToRepaySpecifiedInstallment(int pNumber, DateTime pDate,
            bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount, 
            bool pDisableInterests, OCurrency pManualInterests, bool pKeepExpectedInstallment)
        {
            CreditContractOptions cCo =
                new CreditContractOptions(Product.LoanType, pKeepExpectedInstallment,
                    pCancelFees, pManualFeesAmount, pManualCommissionAmount,
                    pDisableInterests, pManualInterests, Product.AnticipatedTotalRepaymentPenaltiesBase);

            CreditContractRepayment cCr = new CreditContractRepayment(this, cCo, pDate, pNumber, _user, _generalSettings, _nwdS);

            return cCr.AmountToRepayInstallment;
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:13,代码来源:Loan.cs

示例8: Repay

        /// <summary>
        /// This method manages all the repayment cases implemented in the software
        /// </summary>
        /// <param name="pNumber">pNumber of the installment paid</param>
        /// <param name="pDate">pDate of the payment</param>
        /// <param name="pAmountPaid">amount paid by the client which can be lower, equal or greater than the expected amount for an installment</param>
        /// <param name="cancelFees">when true, cancel anticipated payment Commission</param>
        /// <param name="manualFeesAmount">manual amount of commission (when anticipated payment commission are cancelled)</param>
        /// <returns>A RepaymentEvent or null if : 
        /// - repayment amount lower than 0
        /// - repayment amount greater than olb + interestsToPay + commission
        /// - installment already repaid
        /// - bad loan and past due days greater than 180
        /// </returns>
        /// <param name="manualCommissionAmount"></param>
        /// <param name="disableInterests"></param>
        /// <param name="manualInterests"></param>
        /// <param name="keepExpectedInstallment"></param>
        /// <param name="payProportion"></param>
        /// <param name="paymentMethod"></param>
        /// <param name="comment"></param>
        /// <param name="pending"></param>
        public RepaymentEvent Repay(int pNumber, 
                                    DateTime pDate, 
                                    OCurrency pAmountPaid,
                                    bool cancelFees, 
                                    OCurrency manualFeesAmount, 
                                    OCurrency manualCommissionAmount,
                                    bool disableInterests, 
                                    OCurrency manualInterests, 
                                    bool keepExpectedInstallment,
                                    bool payProportion,
                                    PaymentMethod paymentMethod, 
                                    string comment, 
                                    bool pending)
        {
            OCurrency anticipatePayment =
                CalculateAnticipateInteresAmountForClosure(pDate, OPaymentType.PartialPayment, payProportion) +
                CalculateTotalNonRepaymentPenalties(pDate);

            if (anticipatePayment >= pAmountPaid
                || (anticipatePayment == 0 && GetInstallment(pNumber - 1).ExpectedDate <= pDate))
            {
                keepExpectedInstallment = true;
                payProportion = false;
            }

            var cCo = new CreditContractOptions(Product.LoanType,
                                                keepExpectedInstallment,
                                                cancelFees,
                                                manualFeesAmount,
                                                manualCommissionAmount,
                                                disableInterests,
                                                manualInterests,
                                                Product.AnticipatedTotalRepaymentPenaltiesBase,
                                                Product.IsExotic,
                                                payProportion);

            var cCr = new CreditContractRepayment(this, cCo, pDate, pNumber, _user, _generalSettings, _nwdS);

            if (AmountComparer.Compare(pAmountPaid, cCr.MaximumAmountAuthorizeToRepay, pNumber) > 0)
            {
                return null;
            }

            OCurrency principalEvent = 0;
            OCurrency interestEvent = 0;
            OCurrency interestPrepayment = 0;
            OCurrency penaltiesEvent = 0;
            OCurrency commissionsEvent = 0;
            OCurrency manualInterestEvent = cCo.ManualInterestsAmount;

            int pastDueDays = CalculatePastDueSinceLastRepayment(pDate);

            OPaymentType paymentType = OPaymentType.StandardPayment;

            foreach (Installment installment in InstallmentList)
            {
                if (!installment.IsRepaid && installment.Number == pNumber && !keepExpectedInstallment)
                {
                    paymentType = OPaymentType.PartialPayment;
                }
            }

            //we have total repayment for a person
            if(EscapedMember != null)
            {
                paymentType = OPaymentType.PartialPayment;
                keepExpectedInstallment = false;
                cCo.KeepExpectedInstallments = false;
            }

            if (AmountComparer.Compare(pAmountPaid, cCr.MaximumAmountAuthorizeToRepay, pNumber) == 0 && !keepExpectedInstallment)
            {
                paymentType = OPaymentType.TotalPayment;
            }

            if (payProportion && _product.LoanType == OLoanTypes.DecliningFixedPrincipal)
            {
                paymentType = OPaymentType.ProportionalPayment;
//.........这里部分代码省略.........
开发者ID:TalasZh,项目名称:opencbs,代码行数:101,代码来源:Loan.cs

示例9: GenerateRepaymentEvents

        private EventStock GenerateRepaymentEvents(CreditContractRepayment cCr, 
                                                   DateTime payDate, 
                                                   OCurrency penaltiesEvent,
                                                   OCurrency commissionsEvent, 
                                                   OCurrency interestEvent, 
                                                   OCurrency interestPrepayment, 
                                                   OCurrency principalEvent,
                                                   int pastDueDays, 
                                                   OPaymentType paymentType, 
                                                   bool isPending, 
                                                   int instNumber,
                                                   PaymentMethod paymentMethod,
                                                   bool overridePenalty,
                                                   OCurrency manualPenalty,
                                                   OCurrency manualInterestEvent,
                                                   ref RepaymentEvent totalEvent)
        {
            RepaymentEvent rpEvent;
            totalEvent.Penalties = 0;
            totalEvent.Commissions = 0;
            EventStock listOfLoanEvents = new EventStock();

            #region Event identification
            //////////////////////////////////////////////////////////////////////////////////////////////////////////
            if (cCr.PaidIstallments.Count > 0)
            {
                List<Installment> lateInstallments = cCr.PaidIstallments.FindAll(i => i.CalculatedPenalty > 0);
                Installment lastLate = 0 == lateInstallments.Count ? null : lateInstallments.OrderBy(i => i.Number).Last();

                foreach (Installment paidInstallment in cCr.PaidIstallments)
                {
                    int number = paidInstallment.Number;
                    OCurrency rpeCapital = 0;
                    OCurrency rpeInterests = 0;
                    OCurrency rpeCommission = 0;
                    OCurrency rpePenalty = 0;
                    int overdueDays = (payDate.Date - paidInstallment.ExpectedDate).Days > 0
                                          ? (payDate.Date - paidInstallment.ExpectedDate).Days
                                          : 0;

                    foreach (RepaymentEvent rpe in Events.GetLoanRepaymentEvents())
                    {
                        if (rpe.InstallmentNumber == paidInstallment.Number && !rpe.Deleted)
                        {
                            if (rpe.RepaymentType != OPaymentType.PersonTotalPayment)
                            {
                                if ((rpe.RepaymentType != OPaymentType.PartialPayment)
                                    && (rpe.RepaymentType != OPaymentType.ProportionalPayment))
                                {
                                    rpeCapital += rpe.Principal;
                                    rpeInterests += rpe.Interests;
                                }

                                if (rpe.RepaymentType == OPaymentType.PartialPayment && paymentType == OPaymentType.TotalPayment)
                                {
                                    rpeCapital += rpe.Principal;
                                    rpeInterests += rpe.Interests;
                                }

                                rpePenalty += rpe.Penalties;
                            }

                            rpeCommission += rpe.Commissions;
                            if (rpe.RepaymentType == OPaymentType.PersonTotalPayment && cCr.LoanOptions.ManualCommissionAmount != 0)
                                rpeCommission -= rpe.Commissions;
                        }
                    }

                    if (rpeCapital > paidInstallment.PaidCapital)
                        rpeCapital = 0;

                    if (rpeInterests < 0)
                        rpeInterests = 0;

                    if (rpeInterests > paidInstallment.InterestsRepayment)
                    {
                        rpeInterests = 0;
                    }

                    OCurrency principalAmount = paidInstallment.CapitalRepayment -
                                                (paidInstallment.CapitalRepayment - (paidInstallment.PaidCapital - rpeCapital));

                    OCurrency interestAmount = paidInstallment.InterestsRepayment -
                                               (paidInstallment.InterestsRepayment - (paidInstallment.PaidInterests - rpeInterests));

                    if (interestAmount < 0)
                        interestAmount = 0;

                    principalEvent -= principalAmount;
                    interestEvent -= interestAmount;

                    if (principalAmount == 0
                        && interestAmount == 0
                        && paidInstallment.PaidCapital == 0 && manualInterestEvent == 0)
                    {
                        principalAmount = principalEvent;
                        interestAmount = interestEvent;
                    }

                    if (interestAmount < 0)
//.........这里部分代码省略.........
开发者ID:TalasZh,项目名称:opencbs,代码行数:101,代码来源:Loan.cs

示例10: CalculateMaximumAmountForEscapedMember

        public OCurrency CalculateMaximumAmountForEscapedMember(int pNumber, DateTime pDate,
            bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount,
            bool pDisableInterests, OCurrency pManualInterests, bool pKeepExpectedInstallment, OCurrency pLoanShareAmount)
        {
            var cCo = new CreditContractOptions(Product.LoanType,
                                                pKeepExpectedInstallment,
                                                pCancelFees,
                                                pManualFeesAmount,
                                                pManualCommissionAmount,
                                                pDisableInterests,
                                                pManualInterests,
                                                Product.AnticipatedTotalRepaymentPenaltiesBase,
                                                Product.IsExotic,
                                                false);

            var cCr = new CreditContractRepayment(this, cCo, pDate, pNumber, _user, _generalSettings, _nwdS);

            return cCr.MaximumAmountForEscapedMember;
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:19,代码来源:Loan.cs

示例11: CalculateMaximumAmountAuthorizedToRepay

        public OCurrency CalculateMaximumAmountAuthorizedToRepay(int pNumber, DateTime pDate, 
            bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount, 
            bool pDisableInterests, OCurrency pManualInterests, bool pKeepExpectedInstallment, bool pIsForExoticProduct)
        {
            Loan fakeLoan = Copy();
            if (_generalSettings.AccountingProcesses == OAccountingProcesses.Accrual && !pKeepExpectedInstallment)
            {
                fakeLoan.CreateLoanInterestAccruingEvent(pDate);
            }

            CreditContractOptions cCo = new CreditContractOptions(Product.LoanType,
                                                                  pKeepExpectedInstallment,
                                                                  pCancelFees,
                                                                  pManualFeesAmount,
                                                                  pManualCommissionAmount,
                                                                  pDisableInterests,
                                                                  pManualInterests,
                                                                  Product.AnticipatedTotalRepaymentPenaltiesBase,
                                                                  pIsForExoticProduct,
                                                                  false);

            CreditContractRepayment cCr = new CreditContractRepayment(fakeLoan,
                                                                      cCo,
                                                                      pDate,
                                                                      pNumber,
                                                                      _user,
                                                                      _generalSettings,
                                                                      _nwdS);

            return cCr.MaximumAmountAuthorizeToRepay;
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:31,代码来源:Loan.cs

示例12: InstallmentType

        public void TestCalculateAmountToRegradingLoanWithFlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepExpectedInstallmentAndCancelFeesSetToTrue()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.Flat,
                ChargeInterestWithinGracePeriod = true
            };
            package.KeepExpectedInstallment = true;
            package.AnticipatedRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
            Loan myContract = new Loan(package, 1000, 0.03, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisioningTable.GetInstance(new User()));
            myContract.BadLoan = true;
            myContract.NonRepaymentPenalties.InitialAmount = 0.003;
            myContract.AnticipatedRepaymentPenalties = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, true, 0, false, 0,
                                                                  package.AnticipatedRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 15), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(260, Math.Round(cCR.MaximumAmountToRegradingLoan.Value, 2));
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:22,代码来源:TestCreditContractRepayment.cs

示例13: TestCalculateMaximumAmountWhenRepayFlatLoanWith1MonthLate

        public void TestCalculateMaximumAmountWhenRepayFlatLoanWith1MonthLate()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            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, 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 = false;
            myContract.AnticipatedTotalRepaymentPenalties = 0.03;

            myContract.Repay(1, new DateTime(2006, 2, 1), 30, false, false);

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0,
                                                                  package.AnticipatedTotalRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 4, 3), 2, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(1078, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:24,代码来源:TestCreditContractRepayment.cs

示例14: TestRepayDecliningLoanWhenKeepExpectedInstallmentButEntirlyPaidButNoCancelFees

        public void TestRepayDecliningLoanWhenKeepExpectedInstallmentButEntirlyPaidButNoCancelFees()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);

            LoanProduct package = new LoanProduct
            {
                InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                LoanType = OLoanTypes.DecliningFixedInstallments,
                ChargeInterestWithinGracePeriod = true,
                KeepExpectedInstallment = true,
                Currency = new Currency { Id = 1, UseCents = true}
            };
            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()))
                                  {
                                      AnticipatedTotalRepaymentPenalties = 0.003,
                                      NonRepaymentPenalties = { InitialAmount = 0.003 }
                                  };
            myContract.Repay(1, new DateTime(2006, 2, 1), 30, true, false);

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 1), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));

            Assert.AreEqual(1107.58m, cCR.MaximumAmountAuthorizeToRepay.Value);

            RepaymentEvent repayEvent = myContract.Repay(2, new DateTime(2006, 3, 1), 1107.58m, false, true);

            Assert.AreEqual(0m, repayEvent.Fees.Value);
            Assert.AreEqual(107.58m, repayEvent.Interests.Value);
            Assert.AreEqual(1000m, repayEvent.Principal.Value);

            Assert.AreEqual(30m, myContract.GetInstallment(0).InterestsRepayment.Value);
            Assert.AreEqual(0m, myContract.GetInstallment(0).CapitalRepayment.Value);
            Assert.AreEqual(1000m, myContract.GetInstallment(0).OLB.Value);
            Assert.AreEqual(0m, myContract.GetInstallment(0).PaidCapital.Value);
            Assert.AreEqual(30m, myContract.GetInstallment(0).PaidInterests.Value);

            Assert.AreEqual(30m, myContract.GetInstallment(1).InterestsRepayment.Value);
            Assert.AreEqual(154.60m, myContract.GetInstallment(1).CapitalRepayment.Value);
            Assert.AreEqual(1000m, myContract.GetInstallment(1).OLB.Value);
            Assert.AreEqual(154.60m, myContract.GetInstallment(1).PaidCapital.Value);
            Assert.AreEqual(30m, myContract.GetInstallment(1).PaidInterests.Value);

            Assert.AreEqual(25.36m, myContract.GetInstallment(2).InterestsRepayment.Value);
            Assert.AreEqual(159.24m, myContract.GetInstallment(2).CapitalRepayment.Value);
            Assert.AreEqual(845.40m, myContract.GetInstallment(2).OLB.Value);
            Assert.AreEqual(159.24m, myContract.GetInstallment(2).PaidCapital.Value);
            Assert.AreEqual(25.36m, myContract.GetInstallment(2).PaidInterests.Value);

            Assert.AreEqual(20.58m, myContract.GetInstallment(3).InterestsRepayment.Value);
            Assert.AreEqual(164.02m, myContract.GetInstallment(3).CapitalRepayment.Value);
            Assert.AreEqual(686.16m, myContract.GetInstallment(3).OLB.Value);
            Assert.AreEqual(164.02m, myContract.GetInstallment(3).PaidCapital.Value);
            Assert.AreEqual(20.58m, myContract.GetInstallment(3).PaidInterests.Value);

            Assert.AreEqual(15.66m, myContract.GetInstallment(4).InterestsRepayment.Value);
            Assert.AreEqual(168.93m, myContract.GetInstallment(4).CapitalRepayment.Value);
            Assert.AreEqual(522.14m, myContract.GetInstallment(4).OLB.Value);
            Assert.AreEqual(168.93m, myContract.GetInstallment(4).PaidCapital.Value);
            Assert.AreEqual(15.66m, myContract.GetInstallment(4).PaidInterests.Value);

            Assert.AreEqual(10.60m, myContract.GetInstallment(5).InterestsRepayment.Value);
            Assert.AreEqual(173.99m, myContract.GetInstallment(5).CapitalRepayment.Value);
            Assert.AreEqual(353.21m, myContract.GetInstallment(5).OLB.Value);
            Assert.AreEqual(173.99m, myContract.GetInstallment(5).PaidCapital.Value);
            Assert.AreEqual(10.60m, myContract.GetInstallment(5).PaidInterests.Value);

            Assert.AreEqual(5.38m, myContract.GetInstallment(6).InterestsRepayment.Value);
            Assert.AreEqual(179.22m, myContract.GetInstallment(6).CapitalRepayment.Value);
            Assert.AreEqual(179.22m, myContract.GetInstallment(6).OLB.Value);
            Assert.AreEqual(179.22m, myContract.GetInstallment(6).PaidCapital.Value);
            Assert.AreEqual(5.38m, myContract.GetInstallment(6).PaidInterests.Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:72,代码来源:TestCreditContractRepayment.cs

示例15: TestBadLoanAndGoBackToNormal

        public void TestBadLoanAndGoBackToNormal()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);

            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, 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.OLB = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties = 0.01;

            CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
            CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 15), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
            Assert.AreEqual(1194, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));
            Assert.AreEqual(386.00m, Math.Round(cCR.MaximumAmountToRegradingLoan.Value, 2));

            RepaymentEvent rPE = myContract.Repay(1,new DateTime(2006,3,15),386,false,true);
            Assert.AreEqual(126,rPE.Fees.Value);
            Assert.AreEqual(60,rPE.Interests.Value);
            Assert.AreEqual(200,rPE.Principal.Value);
        }
开发者ID:BillTheBest,项目名称:opencbs,代码行数:28,代码来源:TestCreditContract.cs


注:本文中的OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.CreditContractRepayment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。