diff --git a/htdocs/compta/loan/calculator.php b/htdocs/compta/loan/calculator.php
deleted file mode 100644
index 562ce2c27d5..00000000000
--- a/htdocs/compta/loan/calculator.php
+++ /dev/null
@@ -1,223 +0,0 @@
-
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/**
- * \file htdocs/compta/loan/calculator.php
- * \ingroup loan
- * \brief Calculator for loan
- */
-
-require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/loan/class/loan.class.php';
-
-$langs->load("loan");
-$langs->load("compta");
-$langs->load("banks");
-$langs->load("bills");
-
-// Security check
-$socid = isset($GETPOST["socid"])?$GETPOST["socid"]:'';
-if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'loan', '', '', '');
-
-$action=GETPOST("action");
-
-/* Defining Variables */
-$periods = array(
- 52 => $langs->trans("Weekly"),
- 26 => $langs->trans("Bi-weekly"),
- 12 => $langs->trans("Monthly"),
- 6 => $langs->trans("Bi-monthly"),
- 4 => $langs->trans("Quarterly"),
- 2 => $langs->trans("Semi-annually"),
- 1 => $langs->trans("Annually")
- );
-
-$loan_capital = isset($GETPOST("loan_capital")) ? $GETPOST("loan_capital") : 0;
-$loan_length = isset($GETPOST("loan_length")) ? $GETPOST("loan_length") : 0;
-$loan_interest = isset(GETPOST("loan_interest")) ? $GETPOST("loan_interest") : 0;
-$pay_periodicity = isset(GETPOST("pay_periodicity")) ? $GETPOST("pay_periodicity") : 12;
-$periodicity = $periods[$pay_periodicity];
-
-$pay_periods = '';
-foreach($periods as $value => $name)
-{
- $selected = ($pay_periodicity == $value) ? 'selected' : '';
-}
-
-if ($action == 'calculate')
-{
- /* Checking Variables */
- $error = 0;
-
- if(!is_numeric($loan_capital) || $loan_capital <= 0)
- {
- // $this->error="ErrorLoanCapital";
- return -1;
- }
- if(!is_numeric($loan_length) || $loan_length <= 0)
- {
- // $this->error="ErrorLoanLength";
- return -1;
- }
- if(!is_numeric($loan_interest) or $loan_interest <= 0)
- {
- // $this->error="ErrorLoanInterest";
- return -1;
- }
-
- /*
- * Calculating
- */
- if(isset($_GET['action']))
- {
- $c_balance = $loan_capital;
- $total_periods = $loan_length * $pay_periodicity;
- $interest_percent = $loan_interest / 100;
- $period_interest = $interest_percent / $pay_periodicity;
- $c_period_payment = $loan_capital * ($period_interest / (1 - pow((1 + $period_interest), -($total_periods))));
- $total_paid = number_format($c_period_payment * $total_periods, 2, '.', ' ');
- $total_interest = number_format($c_period_payment * $total_periods - $loan_capital, 2, '.', ' ');
- $total_principal = number_format($loan_capital, 2, '.', ' ');
-
- $loan_capital = number_format($loan_capital, 2, '.', ' ');
- $loan_interest = number_format($loan_interest, 2, '.', ' ');
- $period_payment = number_format($c_period_payment, 2, '.', ' ');
-
- for($period = 1; $period <= $total_periods; $period++)
- {
- $c_interest = $c_balance * $period_interest;
- $c_principal = $c_period_payment - $c_interest;
- $c_balance -= $c_principal;
-
- $interest = number_format($c_interest, 2, '.', ' ');
- $principal = number_format($c_principal, 2, '.', ' ');
- $balance = number_format($c_balance, 2, '.', ' ');
-
- $evenrow_row_modifier = ($period % 2) ? '' : 'class=evenrow';
- }
- }
- else
- {
- $amortization_table = '';
- $loan_summary = '';
- }
-}
-
-/*
- * View
- */
-
-$help_url='EN:Module_Loan|FR:Module_Emprunt';
-llxHeader("",$langs->trans("Loan"),$help_url);
-
-print_fiche_titre($langs->trans("CalculatorLoan"));
-
-print '
';
-
-print '
';
-
-print '';
-
-if ($action == 'calculate')
-{
-/*
-
-
-
- | Period | Interest Paid | Principal Paid | Remaining Balance |
-
- {amortization_table_rows}
-
- | Totals: | {total_interest}$ | {total_principal}$ | |
-
-
-
-
-
-
- | {period} |
- {interest}$ |
- {principal}$ |
- {balance}$ |
-
-
-
-
-
-
- | Loan Summary |
-
-
- | Loan amount: |
- {loan_amount}$ |
-
-
- | Loan length: |
- {loan_length} years |
-
-
- | Annual interest: |
- {annual_interest}% |
-
-
- | Pay periodicity: |
- {periodicity} |
-
-
- | {periodicity} payment: |
- {period_payment}$ |
-
-
- | Total paid: |
- {total_paid}$ |
-
-
- | Total interest: |
- {total_interest}$ |
-
-
- | Total periods: |
- {total_periods} |
-
-
-
- */
-}
-else
-{
-
-}
-
-$db->close();
-
-llxFooter();
diff --git a/htdocs/compta/loan/calculator.tpl b/htdocs/compta/loan/calculator.tpl
deleted file mode 100644
index 7efbca9924b..00000000000
--- a/htdocs/compta/loan/calculator.tpl
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
- Loan Calculator
-
-
-
-
-
-
-
-
-
- {error}
-
-
- |
- {loan_summary}
- {loan_parameters_form}
- |
-
- {amortization_table}
- |
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | Period | Interest Paid | Principal Paid | Remaining Balance |
-
- {amortization_table_rows}
-
- | Totals: | {total_interest}$ | {total_principal}$ | |
-
-
-
-
-
-
- | {period} |
- {interest}$ |
- {principal}$ |
- {balance}$ |
-
-
-
-
-
-
- | Loan Summary |
-
-
- | Loan amount: |
- {loan_amount}$ |
-
-
- | Loan length: |
- {loan_length} years |
-
-
- | Annual interest: |
- {annual_interest}% |
-
-
- | Pay periodicity: |
- {periodicity} |
-
-
- | {periodicity} payment: |
- {period_payment}$ |
-
-
- | Total paid: |
- {total_paid}$ |
-
-
- | Total interest: |
- {total_interest}$ |
-
-
- | Total periods: |
- {total_periods} |
-
-
-
-
-
-
-
-
diff --git a/htdocs/compta/loan/card.php b/htdocs/compta/loan/card.php
index c97ca6d84b0..e49aee1b61f 100644
--- a/htdocs/compta/loan/card.php
+++ b/htdocs/compta/loan/card.php
@@ -297,7 +297,7 @@ if ($id > 0)
if ($action == 'edit')
{
- print "