當前位置: 首頁>>代碼示例>>C#>>正文


C# Loan.CalculatePastDueSinceLastRepayment方法代碼示例

本文整理匯總了C#中OpenCBS.CoreDomain.Contracts.Loans.Loan.CalculatePastDueSinceLastRepayment方法的典型用法代碼示例。如果您正苦於以下問題:C# Loan.CalculatePastDueSinceLastRepayment方法的具體用法?C# Loan.CalculatePastDueSinceLastRepayment怎麽用?C# Loan.CalculatePastDueSinceLastRepayment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenCBS.CoreDomain.Contracts.Loans.Loan的用法示例。


在下文中一共展示了Loan.CalculatePastDueSinceLastRepayment方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestCalculatePastDueSinceLastRepaymentWhenSameYearAndLimitBypassed

        public void TestCalculatePastDueSinceLastRepaymentWhenSameYearAndLimitBypassed()
        {
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.Flat,
                                          ChargeInterestWithinGracePeriod = true,
                                          Currency = new Currency { Id = 1 },
                                          KeepExpectedInstallment = false
                                      };
            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()));

            myContract.Repay(1, new DateTime(2006, 2, 1), 30, true, false);
            DateTime limit = new DateTime(2006, 5, 1);

            Assert.AreEqual(61, myContract.CalculatePastDueSinceLastRepayment(limit));
        }
開發者ID:BillTheBest,項目名稱:opencbs,代碼行數:17,代碼來源:TestCreditContract.cs

示例2: TestCalculatePastDueSinceLastRepayment

        public void TestCalculatePastDueSinceLastRepayment()
        {
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.Flat,
                                          ChargeInterestWithinGracePeriod = true,
                                          KeepExpectedInstallment = false,
                                          Currency = new Currency { Id = 1 }
                                      };
            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()));

            //before repayment
            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 1)));
            Assert.AreEqual(14, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 15)));
            Assert.AreEqual(59, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 4, 1)));
            Assert.AreEqual(152, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 7, 3)));

            //partially repayment
            PaymentMethod paymentMethod = new PaymentMethod(1, "Cash", "", false);
            myContract.Repay(1, new DateTime(2006, 2, 1), 30, true, 0, 0, false, 0, false, false, false, paymentMethod);
            myContract.Repay(2, new DateTime(2006, 3, 6), 10, true, 0, 0, false, 0, false, false, false, paymentMethod);

            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 1)));
            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 15)));
            Assert.AreEqual(28, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 4, 3)));
            Assert.AreEqual(119, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 7, 3)));

            //totally repayment
            myContract.Repay(2, new DateTime(2006, 3, 6), 20, true, 0, 0, false, 0, false, false, false, paymentMethod);
            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 1)));
            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 15)));
            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 4, 3)));
            Assert.AreEqual(91, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 7, 3)));
        }
開發者ID:BillTheBest,項目名稱:opencbs,代碼行數:35,代碼來源:TestCreditContract.cs

示例3: TestCalculatePastDueSinceLastRepayment2

        public void TestCalculatePastDueSinceLastRepayment2()
        {
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.Flat,
                                          ChargeInterestWithinGracePeriod = true,
                                          KeepExpectedInstallment = false,
                                          Currency = new Currency { Id = 1 }
                                      };
            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()));
            PaymentMethod paymentMethod = new PaymentMethod(1, "Cash", "", false);
            myContract.Repay(1, new DateTime(2006, 6, 1), 30, true, 0, 0, false, 0, true, false, false, paymentMethod);

            Assert.IsTrue(myContract.GetInstallment(0).IsRepaid);

            Assert.AreEqual(122, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 7, 1)));
        }
開發者ID:BillTheBest,項目名稱:opencbs,代碼行數:18,代碼來源:TestCreditContract.cs

示例4: TestIfPastDueIsEqualToZeroWhenAllInstallmentsAreRepaid

        public void TestIfPastDueIsEqualToZeroWhenAllInstallmentsAreRepaid()
        {
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.Flat,
                                          ChargeInterestWithinGracePeriod = true,
                                          Currency = new Currency { Id = 1 }
                                      };
            package.KeepExpectedInstallment = false;
            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()));

            myContract.Repay(1, new DateTime(2006, 2, 1), 30, true, false);
            myContract.Repay(2, new DateTime(2006, 3, 1), 30, true, false);
            myContract.Repay(3, new DateTime(2006, 4, 1), 280, true, false);
            myContract.Repay(4, new DateTime(2006, 5, 1), 280, true, false);
            myContract.Repay(5, new DateTime(2006, 6, 1), 280, true, false);
            myContract.Repay(6, new DateTime(2006, 7, 1), 280, true, false);

            Assert.AreEqual(0, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2005, 8, 7)));
        }
開發者ID:BillTheBest,項目名稱:opencbs,代碼行數:21,代碼來源:TestCreditContract.cs

示例5: TestIfPastDueCorrectlyCalculatedWhenYearAreDifferentAndDifferenceLowerThanOneYear

        public void TestIfPastDueCorrectlyCalculatedWhenYearAreDifferentAndDifferenceLowerThanOneYear()
        {
            LoanProduct package = new LoanProduct
                                      {
                                          InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
                                          LoanType = OLoanTypes.Flat,
                                          ChargeInterestWithinGracePeriod = true,
                                          Currency = new Currency { Id = 1 }
                                      };
            package.KeepExpectedInstallment = false;
            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()));

            DateTime limit = new DateTime(2007,1,1);

            Assert.AreEqual(334,myContract.CalculatePastDueSinceLastRepayment(limit));
        }
開發者ID:BillTheBest,項目名稱:opencbs,代碼行數:16,代碼來源:TestCreditContract.cs

示例6: TestRepayFlatLoanWhenCalculateFeesWithDelta

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

            var 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;
            var myContract = new Loan(package, 1000, 0.03m, 5, 0, new DateTime(2006, 1, 1), new User(),
                ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
                ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            myContract.BadLoan = false;
            myContract.NonRepaymentPenalties.OLB = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties = 0;

            Assert.AreEqual(14, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 15)));
            RepaymentEvent rPE = myContract.Repay(1, new DateTime(2006, 2, 15), 80, false, false);
            Assert.AreEqual(42m, rPE.Fees.Value);
            Assert.AreEqual(30, rPE.Interests.Value);
            Assert.AreEqual(8, rPE.Principal.Value);

            Assert.AreEqual(13, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 28)));
            RepaymentEvent rPE2 = myContract.Repay(1, new DateTime(2006, 2, 28), 231m, false, false);

            Assert.AreEqual(38.69, rPE2.Fees.Value);
            Assert.AreEqual(0.31, rPE2.Interests.Value);
            Assert.AreEqual(192m, rPE2.Principal.Value);
            Assert.IsTrue(myContract.GetInstallment(0).IsRepaid);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:35,代碼來源:TestCreditContractRepayment.cs

示例7: 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

示例8: TestCalculatePastDue

        public void TestCalculatePastDue()
        {
            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, 5, 0, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
            myContract.BadLoan = false;
            myContract.NonRepaymentPenalties.InitialAmount = 0.003;
            myContract.AnticipatedTotalRepaymentPenalties = 0;

            Assert.AreEqual(14, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 15)));
            myContract.Repay(1,new DateTime(2006, 2, 15), 80, false, false);

            Assert.AreEqual(13, myContract.CalculatePastDueSinceLastRepayment(new DateTime(2006, 2, 28)));
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:22,代碼來源:TestCreditContractRepayment.cs


注:本文中的OpenCBS.CoreDomain.Contracts.Loans.Loan.CalculatePastDueSinceLastRepayment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。