Exemplo n.º 1
0
        public void Calculate()
        {
            MonthlyRate = AnnualRate / 12;

            DataList = new List <CreditCalculatorTableModel>();
            for (int i = 0; i < Months - 1; i++)
            {
                var item = new CreditCalculatorTableModel();
                item.Num = i + 1;

                // Остаток задолженности
                if (i == 0)
                {
                    item.DebtBalance = Sum;
                }
                else
                {
                    item.DebtBalance = DataList[i - 1].DebtBalance - DataList[i - 1].RedemptionSum;
                }

                // Сумма вознаграждения
                item.RemunerationSum = item.DebtBalance * AnnualRate / 100 / DaysInYear * 30;

                // Сумма погашения ОД
                item.RedemptionSum = Delay > 0
                    ? Delay <= item.Num
                        ? Sum / (Months - Delay)
                        : 0
                    : Sum / Months;

                // Итого взнос
                item.TotalPayment = item.RedemptionSum + item.RemunerationSum;

                DataList.Add(item);

                Debug.Print("_____________________________________________");
                Debug.Print("item.Num:" + item.Num);
                Debug.Print("item.DebtBalance:" + item.DebtBalance);
                Debug.Print("item.RedemptionSum:" + item.RedemptionSum);
                Debug.Print("item.RemunerationSum:" + item.RemunerationSum);
                Debug.Print("item.TotalPayment:" + item.TotalPayment);
            }

            SumLoan     = DataList.Sum(i => i.RedemptionSum);
            Overpayment = DataList.Sum(i => i.RemunerationSum);

            SumTotal = SumLoan + Overpayment;

            Debug.Print("");
            Debug.Print("SumLoan:" + SumLoan);
            Debug.Print("Overpayment:" + Overpayment);
            Debug.Print("SumTotal:" + SumTotal);
        }
Exemplo n.º 2
0
        public void Calculate2()
        {
            MonthlyRate2 = AnnualRate2 / 12;
            Annuity2     = Sum2 * MonthlyRate2 / 100 / (1 - Math.Pow(1 + MonthlyRate2 / 100, Months2 * -1));

            DataList2 = new List <CreditCalculatorTableModel>();
            for (int i = 0; i < Months2 + Delay2 - 1; i++)
            {
                var item = new CreditCalculatorTableModel();
                item.Num = i + 1;

                // Остаток задолженности
                if (i == 0)
                {
                    item.DebtBalance = Sum2;
                }
                else
                {
                    item.DebtBalance = DataList2[i - 1].DebtBalance - DataList2[i - 1].RedemptionSum;
                }

                // Итого взнос
                item.TotalPayment = Annuity2;

                // Сумма вознаграждения
                item.RemunerationSum = item.DebtBalance * AnnualRate2 / 100 / DaysInYear2 * 30;

                // Сумма погашения ОД
                item.RedemptionSum = Delay2 - 1 > i
                    ? 0
                    : item.TotalPayment - item.RemunerationSum;

                DataList2.Add(item);

                Debug.Print("_____________________________________________");
                Debug.Print("item.Num:" + item.Num);
                Debug.Print("item.DebtBalance:" + item.DebtBalance);
                Debug.Print("item.RedemptionSum:" + item.RedemptionSum);
                Debug.Print("item.RemunerationSum:" + item.RemunerationSum);
                Debug.Print("item.TotalPayment:" + item.TotalPayment);
            }

            SumLoan2     = DataList2.Sum(i => i.RedemptionSum);
            Overpayment2 = DataList2.Sum(i => i.RemunerationSum);

            SumTotal2 = SumLoan2 + Overpayment2;

            Debug.Print("");
            Debug.Print("SumLoan:" + SumLoan2);
            Debug.Print("Overpayment:" + Overpayment2);
            Debug.Print("SumTotal:" + SumTotal2);
        }
        public void Calculate2()
        {
            MonthlyRate2 = AnnualRate2 / 12;
            Annuity2 = Sum2 * MonthlyRate2 / 100 / (1 - Math.Pow(1 + MonthlyRate2 / 100, Months2 * -1));

            DataList2 = new List<CreditCalculatorTableModel>();
            for (int i = 0; i < Months2 + Delay2 - 1; i++)
            {
                var item = new CreditCalculatorTableModel();
                item.Num = i + 1;

                // Остаток задолженности
                if (i == 0)
                {
                    item.DebtBalance = Sum2;
                }
                else
                {
                    item.DebtBalance = DataList2[i - 1].DebtBalance - DataList2[i - 1].RedemptionSum;
                }

                // Итого взнос
                item.TotalPayment = Annuity2;

                // Сумма вознаграждения
                item.RemunerationSum = item.DebtBalance * AnnualRate2 / 100 / DaysInYear2 * 30;

                // Сумма погашения ОД
                item.RedemptionSum = Delay2 - 1 > i
                    ? 0
                    : item.TotalPayment - item.RemunerationSum;

                DataList2.Add(item);

                Debug.Print("_____________________________________________");
                Debug.Print("item.Num:" + item.Num);
                Debug.Print("item.DebtBalance:" + item.DebtBalance);
                Debug.Print("item.RedemptionSum:" + item.RedemptionSum);
                Debug.Print("item.RemunerationSum:" + item.RemunerationSum);
                Debug.Print("item.TotalPayment:" + item.TotalPayment);
            }

            SumLoan2 = DataList2.Sum(i => i.RedemptionSum);
            Overpayment2 = DataList2.Sum(i => i.RemunerationSum);

            SumTotal2 = SumLoan2 + Overpayment2;

            Debug.Print("");
            Debug.Print("SumLoan:" + SumLoan2);
            Debug.Print("Overpayment:" + Overpayment2);
            Debug.Print("SumTotal:" + SumTotal2);
        }
        public void Calculate()
        {
            MonthlyRate = AnnualRate / 12;

            DataList = new List<CreditCalculatorTableModel>();
            for(int i = 0; i < Months-1; i++)
            {
                var item = new CreditCalculatorTableModel();
                item.Num = i+1;

                // Остаток задолженности
                if (i==0)
                {
                    item.DebtBalance = Sum;
                }
                else
                {
                    item.DebtBalance = DataList[i-1].DebtBalance - DataList[i-1].RedemptionSum;
                }   

                // Сумма вознаграждения
                item.RemunerationSum = item.DebtBalance * AnnualRate / 100 / DaysInYear * 30;

                // Сумма погашения ОД
                item.RedemptionSum = Delay > 0
                    ? Delay <= item.Num
                        ? Sum / (Months - Delay)
                        : 0
                    : Sum / Months;

                // Итого взнос
                item.TotalPayment = item.RedemptionSum + item.RemunerationSum;

                DataList.Add(item);

                Debug.Print("_____________________________________________");
                Debug.Print("item.Num:" + item.Num);
                Debug.Print("item.DebtBalance:" + item.DebtBalance);
                Debug.Print("item.RedemptionSum:" + item.RedemptionSum);
                Debug.Print("item.RemunerationSum:" + item.RemunerationSum);
                Debug.Print("item.TotalPayment:" + item.TotalPayment);
            }

            SumLoan = DataList.Sum(i => i.RedemptionSum);
            Overpayment = DataList.Sum(i => i.RemunerationSum);

            SumTotal = SumLoan + Overpayment;

            Debug.Print("");
            Debug.Print("SumLoan:" + SumLoan);
            Debug.Print("Overpayment:" + Overpayment);
            Debug.Print("SumTotal:" + SumTotal);
        }