dolibarr 21.0.0-beta
limits.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
5 * Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
32
41// Load translation files required by the page
42$langs->loadLangs(array('companies', 'products', 'admin'));
43
44$action = GETPOST('action', 'aZ09');
45$cancel = GETPOST('cancel', 'aZ09');
46$currencycode = GETPOST('currencycode', 'alpha');
47
48if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
49 // When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
50 $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
51}
52
53$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
54$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
55$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : '');
56$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
57
58$valmainmaxdecimalsunit = GETPOSTINT($mainmaxdecimalsunit);
59$valmainmaxdecimalstot = GETPOSTINT($mainmaxdecimalstot);
60$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
61$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
62
63if (!$user->admin) {
65}
66
67
68/*
69 * Actions
70 */
71
72if ($action == 'update' && !$cancel) {
73 $error = 0;
74 $MAXDEC = 8;
75 if ($valmainmaxdecimalsunit > $MAXDEC
76 || $valmainmaxdecimalstot > $MAXDEC
77 || $valmainmaxdecimalsshown > $MAXDEC) {
78 $error++;
79 setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
80 $action = 'edit';
81 }
82
83 if ($valmainmaxdecimalsunit < 0
84 || $valmainmaxdecimalstot < 0
85 || $valmainmaxdecimalsshown < 0) {
86 $langs->load("errors");
87 $error++;
88 setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
89 $action = 'edit';
90 }
91
92 if ($valmainroundingruletot) {
93 if ((float) $valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) {
94 $langs->load("errors");
95 $error++;
96 setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
97 $action = 'edit';
98 }
99 }
100
101 if ((float) $valmainmaxdecimalsshown == 0) {
102 $langs->load("errors");
103 $error++;
104 setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
105 $action = 'edit';
106 }
107 if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
108 $langs->load("errors");
109 $error++;
110 setEventMessages($langs->trans("ErrorValueForTooLow", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
111 $action = 'edit';
112 }
113
114 if (!$error) {
115 dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
116 dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
117 dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
118
119 dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
120
121 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : ''));
122 exit;
123 }
124}
125
126
127/*
128 * View
129 */
130
131$form = new Form($db);
132
133$title = $langs->trans("LimitsSetup");
134$help_url = '';
135
136llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-limits');
137
138print load_fiche_titre($title, '', 'title_setup');
139
140$aCurrencies = array($conf->currency); // Default currency always first position
141
142if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
143 require_once DOL_DOCUMENT_ROOT . '/core/lib/multicurrency.lib.php';
144
145 $sql = "SELECT rowid, code FROM " . MAIN_DB_PREFIX . "multicurrency";
146 $sql .= " WHERE entity = " . ((int) $conf->entity);
147 $sql .= " AND code <> '" . $db->escape($conf->currency) . "'"; // Default currency always first position
148 $resql = $db->query($sql);
149 if ($resql) {
150 while ($obj = $db->fetch_object($resql)) {
151 $aCurrencies[] = $obj->code;
152 }
153 }
154
155 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
156 $head = multicurrencyLimitPrepareHead($aCurrencies);
157
158 print dol_get_fiche_head($head, $currencycode, '', -1, '');
159 }
160}
161
162print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n";
163print "<br>\n";
164
165if ($action == 'edit') {
166 print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
167 print '<input type="hidden" name="token" value="' . newToken() . '">';
168 print '<input type="hidden" name="action" value="update">';
169 if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
170 print '<input type="hidden" name="currencycode" value="' . $currencycode . '">';
171 }
172
173 clearstatcache();
174
175 print '<table class="noborder centpercent">';
176 print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
177
178 print '<tr class="oddeven"><td>';
179 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
180 print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
181
182 print '<tr class="oddeven"><td>';
183 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
184 print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
185
186 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
187 print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
188
189 print '<tr class="oddeven"><td>';
190 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
191 print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
192
193 print '</table>';
194
195 print '<div class="center">';
196 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
197 print ' &nbsp; ';
198 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
199 print '</div>';
200 print '<br>';
201
202 print '</form>';
203 print '<br>';
204} else {
205 print '<div class="div-table-responsive-no-min">';
206 print '<table class="noborder centpercent">';
207 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
208
209 print '<tr class="oddeven"><td>';
210 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
211 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'</td></tr>';
212
213 print '<tr class="oddeven"><td>';
214 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
215 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'</td></tr>';
216
217 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
218 print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'</td></tr>';
219
220 print '<tr class="oddeven"><td>';
221 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
222 print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (getDolGlobalString('MAIN_ROUNDING_RULE_TOT') ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'</td></tr>';
223
224 print '</table>';
225 print '</div>';
226
227 print '<div class="tabsAction">';
228 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
229 print '</div>';
230}
231
232if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
233 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
234 print dol_get_fiche_end();
235 }
236}
237
238if (empty($mysoc->country_code)) {
239 $langs->load("errors");
240 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
241 print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
242} else {
243 // Show examples
244 print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
245
246 print '<span class="opacitymedium">'.$langs->trans("NumberFormatForATotalPrice", '1234.56789').':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
247
248 // Always show vat rates with vat 0
249 $s = 2 / 3;
250 $qty = 1;
251 $vat = 0;
252 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
253 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
254 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
255 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
256 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
257
258 $s = 10 / 3;
259 $qty = 1;
260 $vat = 0;
261 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
262 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
263 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
264 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
265 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
266
267 $s = 10 / 3;
268 $qty = 2;
269 $vat = 0;
270 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
271 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
272 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
273 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
274 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
275
276 // Add vat rates examples specific to country
277 $vat_rates = array();
278
279 $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
280 $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
281 $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
282 $sql .= " AND t.entity IN (".getEntity('c_tva').")";
283 $sql .= " ORDER BY t.taux ASC";
284 $resql = $db->query($sql);
285 if ($resql) {
286 $num = $db->num_rows($resql);
287 if ($num) {
288 for ($i = 0; $i < $num; $i++) {
289 $obj = $db->fetch_object($resql);
290 $vat_rates[] = array('vat_rate' => $obj->vat_rate, 'code' => $obj->vat_code, 'localtax_rate1' => $obj->localtax_rate1, 'locltax_rate2' => $obj->localtax_rate2);
291 }
292 }
293 } else {
294 dol_print_error($db);
295 }
296
297 if (count($vat_rates)) {
298 foreach ($vat_rates as $vatarray) {
299 $vat = $vatarray['vat_rate'];
300 for ($qty = 1; $qty <= 2; $qty++) {
301 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
302
303 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
304
305 $s = 10 / 3;
306 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
307 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
308 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
309 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
310 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
311 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
312 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
313 print "<br>\n";
314 }
315
316 if (getDolGlobalString('MAIN_ADD_MORE_EXAMPLE_IN_ACCURANCY_SETUP')) {
317 $qty = 1.234;
318 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
319
320 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
321
322 $s = 10 / 3;
323 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
324 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
325 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
326 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
327 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
328 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
329 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
330 print "<br>\n";
331 }
332 }
333 } else {
334 // More examples if not specific vat rate found
335 // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
336 // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
337
338 $localtax_array = array();
339
340 $s = 10 / 3;
341 $qty = 1;
342 $vat = 10;
343 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
344 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
345 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
346 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
347 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
348
349 $s = 10 / 3;
350 $qty = 2;
351 $vat = 10;
352 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
353 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
354 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
355 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
356 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
357 }
358}
359
360// End of page
361llxFooter();
362$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
multicurrencyLimitPrepareHead($aCurrencies)
Prepare array with list of currency tabs.
calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller='', $localtaxes_array=[], $progress=100, $multicurrency_tx=1, $pu_devise=0, $multicurrency_code='')
Calculate totals (net, vat, ...) of a line.
Definition price.lib.php:90
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.