2017-06-02 17:48:29 +02:00
|
|
|
<?php
|
|
|
|
|
/* TVI
|
|
|
|
|
* Copyright (C) 2015 Florian HENRY <florian.henry@open-concept.pro>
|
2020-06-02 14:42:57 +02:00
|
|
|
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
|
2017-06-02 17:48:29 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2021-11-09 03:01:48 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2017-06-02 17:48:29 +02:00
|
|
|
* (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
|
2021-11-09 03:01:48 +01:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2017-06-02 17:48:29 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2019-12-11 20:11:53 +01:00
|
|
|
* \file htdocs/loan/calcmens.php
|
|
|
|
|
* \ingroup loan
|
|
|
|
|
* \brief File to calculate loan monthly payments
|
2017-06-02 17:48:29 +02:00
|
|
|
*/
|
|
|
|
|
|
2021-02-26 18:20:21 +01:00
|
|
|
if (!defined('NOTOKENRENEWAL')) {
|
|
|
|
|
define('NOTOKENRENEWAL', '1'); // Disables token renewal
|
|
|
|
|
}
|
|
|
|
|
if (!defined('NOREQUIREMENU')) {
|
|
|
|
|
define('NOREQUIREMENU', '1');
|
|
|
|
|
}
|
|
|
|
|
if (!defined('NOREQUIREAJAX')) {
|
|
|
|
|
define('NOREQUIREAJAX', '1');
|
|
|
|
|
}
|
2017-06-02 17:48:29 +02:00
|
|
|
|
|
|
|
|
require '../main.inc.php';
|
2020-06-02 14:42:57 +02:00
|
|
|
require DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
|
2017-06-02 17:48:29 +02:00
|
|
|
|
2021-03-29 14:11:51 +02:00
|
|
|
$mens = price2num(GETPOST('mens'));
|
|
|
|
|
$capital = price2num(GETPOST('capital'));
|
|
|
|
|
$rate = price2num(GETPOST('rate'));
|
|
|
|
|
$echance = GETPOST('echeance', 'int');
|
|
|
|
|
$nbterm = GETPOST('nbterm', 'int');
|
2017-06-02 17:48:29 +02:00
|
|
|
|
|
|
|
|
top_httphead();
|
|
|
|
|
|
2019-11-14 12:09:15 +01:00
|
|
|
$output = array();
|
2017-06-02 17:48:29 +02:00
|
|
|
|
2020-06-12 16:58:51 +02:00
|
|
|
$output = loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm);
|
2017-06-02 17:48:29 +02:00
|
|
|
|
|
|
|
|
echo json_encode($output);
|