/// <summary> /// Creates a payment plan for a series loan. /// </summary> /// <param name="borrowedAmmount">The amount the loan is for</param> /// <param name="numberOfYears">Number of years the user wishes to spend paying back the loan</param> /// <param name="interestRate">The interest rate for the loan</param> /// <returns>A list as a payment plan. The first term will be empty except for the borrowed amount</returns> public override IEnumerable <PaymentPlanModel> CalculatePaymentPlan(double borrowedAmmount, int numberOfYears, double interestRate) { var model = new List <PaymentPlanModel>(); model.Add(new PaymentPlanModel() { OutstandingDebt = borrowedAmmount }); var termPayment = CalculateTermDeduction(borrowedAmmount, numberOfYears); for (int i = 0; i < numberOfYears * 12; i++) { var interest = CalculateInterest(borrowedAmmount, interestRate); if (borrowedAmmount < termPayment) { termPayment = borrowedAmmount; } borrowedAmmount -= termPayment; var payment = new PaymentPlanModel() { Term = i + 1, TermTotalAmount = termPayment + interest, Interest = interest, Principal = termPayment, OutstandingDebt = borrowedAmmount }; model.Add(payment); } return(model); }
public InstallmentPlan GetAllInstallmentPlan() { InstallmentPlan result = new InstallmentPlan(); PaymentPlanModel pm = new PaymentPlanModel(); result.plans = pm.getAllInstallmentPlan(); result.total_values = pm.getPaymentStatusValues(); return(result); }
public List <DueListItem> ConfirmPaymentPlan(PaymentPlan plan) { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.confirmPaymentPlan(plan)); }
public int AddNewPaymentPlan(PaymentPlan plan) { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.AddNewPaymentPlan(plan)); }
public IEnumerable <DashboardTableData> GetDueInfoByCustomerIDAndInovice(SearchByIdAndInvoice search) { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.getDueInfoByCustomerIDAndInovice(search.customer_id, search.invoice_no)); }
public IEnumerable <Invoice> GetInvoiceListByCustomerID(SearchById search) { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.getInvoiceListByCustomerID(search.id)); }
public InstallmentPlanDetail GetOneInstallmentPlanDetailById(SearchById search) { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.getPaymentPlanDetail(search.id)); }
public PaymentPlanDisplay GetOnePaymentPlanById(SearchById search) { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.getOnePaymentPlanById(search.id)); }
public IEnumerable <PaymentPlanDisplay> GetAllPaymentPlan() { PaymentPlanModel pm = new PaymentPlanModel(); return(pm.getAllPaymentPlan()); }