23 if (!defined(
'NOTOKENRENEWAL')) {
24 define(
'NOTOKENRENEWAL',
'1');
26 if (!defined(
'NOREQUIREMENU')) {
27 define(
'NOREQUIREMENU',
'1');
29 if (!defined(
'NOREQUIREAJAX')) {
30 define(
'NOREQUIREAJAX',
'1');
32 if (!defined(
'NOREQUIRESOC')) {
33 define(
'NOREQUIRESOC',
'1');
37 require
'../../main.inc.php';
39 $output =
GETPOST(
'output',
'alpha');
41 $tva_tx = str_replace(
'*',
'',
GETPOST(
'tva_tx',
'alpha'));
52 if (!empty($output) && isset($amount) && isset($tva_tx)) {
56 if (is_numeric($amount) && $amount !=
'') {
57 if ($output ==
'price_ttc') {
58 $price =
price2num($amount * (1 + ($tva_tx / 100)),
'MU');
59 $return[
'price_ht'] = $amount;
60 $return[
'price_ttc'] = (isset($price) && $price !=
'' ?
price($price) :
'');
61 } elseif ($output ==
'price_ht') {
62 $price =
price2num($amount / (1 + ($tva_tx / 100)),
'MU');
63 $return[
'price_ht'] = (isset($price) && $price !=
'' ?
price($price) :
'');
64 $return[
'price_ttc'] = ($tva_tx == 0 ? $price : $amount);
68 echo json_encode($return);
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.