Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        public InstallmentPlan GetAllInstallmentPlan()
        {
            InstallmentPlan  result = new InstallmentPlan();
            PaymentPlanModel pm     = new PaymentPlanModel();

            result.plans        = pm.getAllInstallmentPlan();
            result.total_values = pm.getPaymentStatusValues();
            return(result);
        }
Ejemplo n.º 3
0
        public List <DueListItem> ConfirmPaymentPlan(PaymentPlan plan)
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.confirmPaymentPlan(plan));
        }
Ejemplo n.º 4
0
        public int AddNewPaymentPlan(PaymentPlan plan)
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.AddNewPaymentPlan(plan));
        }
Ejemplo n.º 5
0
        public IEnumerable <DashboardTableData> GetDueInfoByCustomerIDAndInovice(SearchByIdAndInvoice search)
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.getDueInfoByCustomerIDAndInovice(search.customer_id, search.invoice_no));
        }
Ejemplo n.º 6
0
        public IEnumerable <Invoice> GetInvoiceListByCustomerID(SearchById search)
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.getInvoiceListByCustomerID(search.id));
        }
Ejemplo n.º 7
0
        public InstallmentPlanDetail GetOneInstallmentPlanDetailById(SearchById search)
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.getPaymentPlanDetail(search.id));
        }
Ejemplo n.º 8
0
        public PaymentPlanDisplay GetOnePaymentPlanById(SearchById search)
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.getOnePaymentPlanById(search.id));
        }
Ejemplo n.º 9
0
        public IEnumerable <PaymentPlanDisplay> GetAllPaymentPlan()
        {
            PaymentPlanModel pm = new PaymentPlanModel();

            return(pm.getAllPaymentPlan());
        }