dolibarr  16.0.5
calcmens.php
Go to the documentation of this file.
1 <?php
2 /* TVI
3  * Copyright (C) 2015 Florian HENRY <florian.henry@open-concept.pro>
4  * Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 if (!defined('NOTOKENRENEWAL')) {
27  define('NOTOKENRENEWAL', '1'); // Disables token renewal
28 }
29 if (!defined('NOREQUIREMENU')) {
30  define('NOREQUIREMENU', '1');
31 }
32 if (!defined('NOREQUIREAJAX')) {
33  define('NOREQUIREAJAX', '1');
34 }
35 
36 require '../main.inc.php';
37 require DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
38 
39 $mens = price2num(GETPOST('mens'));
40 $capital = price2num(GETPOST('capital'));
41 $rate = price2num(GETPOST('rate'));
42 $echance = GETPOST('echeance', 'int');
43 $nbterm = GETPOST('nbterm', 'int');
44 
45 top_httphead();
46 
47 $output = array();
48 
49 $output = loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm);
50 
51 echo json_encode($output);
loanCalcMonthlyPayment
loanCalcMonthlyPayment($mens, $capital, $rate, $numactualloadterm, $nbterm)
Calculate remaining loan mensuality and interests.
Definition: loan.lib.php:100
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
top_httphead
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1407
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661