27 if (! defined(
'CSRFCHECK_WITH_TOKEN')) define(
'CSRFCHECK_WITH_TOKEN',
'1');
30 require
'../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
37 $langs->loadLangs(array(
'orders',
'bills',
'companies'));
41 $action =
GETPOST(
'action',
'aZ09');
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
46 if ($user->socid > 0) {
47 $socid = $user->socid;
51 if ($user->socid > 0) {
54 $result =
restrictedArea($user,
'societe', $id,
'&societe',
'',
'fk_soc',
'rowid', 0);
56 $permissiontocreate = ($user->rights->societe->creer || $user->rights->facture->creer);
64 if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
65 header(
"Location: ".$backtopage);
69 if ($action ==
'confirm_split' &&
GETPOST(
"confirm",
"alpha") ==
'yes' && $permissiontocreate) {
73 $amount_ttc_1 =
GETPOST(
'amount_ttc_1',
'alpha');
75 $amount_ttc_2 =
GETPOST(
'amount_ttc_2',
'alpha');
81 $res = $discount->fetch($remid);
84 setEventMessages($langs->trans(
"ErrorFailedToLoadDiscount"),
null,
'errors');
86 if (!$error &&
price2num($amount_ttc_1 + $amount_ttc_2) != $discount->amount_ttc) {
88 setEventMessages($langs->trans(
"TotalOfTwoDiscountMustEqualsOriginal"),
null,
'errors');
90 if (!$error && $discount->fk_facture_line) {
92 setEventMessages($langs->trans(
"ErrorCantSplitAUsedDiscount"),
null,
'errors');
97 $newdiscount1->fk_facture_source = $discount->fk_facture_source;
98 $newdiscount2->fk_facture_source = $discount->fk_facture_source;
99 $newdiscount1->fk_facture = $discount->fk_facture;
100 $newdiscount2->fk_facture = $discount->fk_facture;
101 $newdiscount1->fk_facture_line = $discount->fk_facture_line;
102 $newdiscount2->fk_facture_line = $discount->fk_facture_line;
103 $newdiscount1->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
104 $newdiscount2->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
105 $newdiscount1->fk_invoice_supplier = $discount->fk_invoice_supplier;
106 $newdiscount2->fk_invoice_supplier = $discount->fk_invoice_supplier;
107 $newdiscount1->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
108 $newdiscount2->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
109 if ($discount->description ==
'(CREDIT_NOTE)' || $discount->description ==
'(DEPOSIT)') {
110 $newdiscount1->description = $discount->description;
111 $newdiscount2->description = $discount->description;
113 $newdiscount1->description = $discount->description.
' (1)';
114 $newdiscount2->description = $discount->description.
' (2)';
117 $newdiscount1->fk_user = $discount->fk_user;
118 $newdiscount2->fk_user = $discount->fk_user;
119 $newdiscount1->fk_soc = $discount->fk_soc;
120 $newdiscount2->fk_soc = $discount->fk_soc;
121 $newdiscount1->discount_type = $discount->discount_type;
122 $newdiscount2->discount_type = $discount->discount_type;
123 $newdiscount1->datec = $discount->datec;
124 $newdiscount2->datec = $discount->datec;
125 $newdiscount1->tva_tx = $discount->tva_tx;
126 $newdiscount2->tva_tx = $discount->tva_tx;
127 $newdiscount1->vat_src_code = $discount->vat_src_code;
128 $newdiscount2->vat_src_code = $discount->vat_src_code;
129 $newdiscount1->amount_ttc = $amount_ttc_1;
130 $newdiscount2->amount_ttc =
price2num($discount->amount_ttc - $newdiscount1->amount_ttc);
131 $newdiscount1->amount_ht =
price2num($newdiscount1->amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
132 $newdiscount2->amount_ht =
price2num($newdiscount2->amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
133 $newdiscount1->amount_tva =
price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht);
134 $newdiscount2->amount_tva =
price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht);
136 $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc);
137 $newdiscount2->multicurrency_amount_ttc =
price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc);
138 $newdiscount1->multicurrency_amount_ht =
price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
139 $newdiscount2->multicurrency_amount_ht =
price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
140 $newdiscount1->multicurrency_amount_tva =
price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht);
141 $newdiscount2->multicurrency_amount_tva =
price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht);
144 $discount->fk_facture_source = 0;
146 $discount->fk_invoice_supplier_source = 0;
147 $res = $discount->delete($user);
148 $newid1 = $newdiscount1->create($user);
149 $newid2 = $newdiscount2->create($user);
150 if ($res > 0 && $newid1 > 0 && $newid2 > 0) {
152 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id.($backtopage ?
'&backtopage='.urlencode($backtopage) :
''));
160 if ($action ==
'setremise' && $permissiontocreate) {
165 $desc =
GETPOST(
'desc',
'alpha');
166 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
168 $price_base_type =
GETPOST(
'price_base_type',
'alpha');
173 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ReasonDiscount")),
null,
'errors');
180 $discountid = $soc->set_remise_except($amount, $user, $desc, $tva_tx, $discount_type, $price_base_type);
182 if ($discountid > 0) {
183 if (!empty($backtopage)) {
184 header(
"Location: ".$backtopage.
'&discountid='.((
int) $discountid));
187 header(
"Location: remx.php?id=".((
int) $id));
196 setEventMessages($langs->trans(
"ErrorFieldFormat", $langs->transnoentitiesnoconv(
"AmountHT")),
null,
'errors');
200 if (
GETPOST(
'action',
'aZ09') ==
'confirm_remove' &&
GETPOST(
"confirm") ==
'yes' && $permissiontocreate) {
207 $result = $discount->fetch(
GETPOST(
"remid"));
208 $result = $discount->delete($user);
211 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
225 $facturestatic =
new Facture($db);
228 llxHeader(
'', $langs->trans(
"GlobalDiscount"));
233 $object->fetch($socid);
235 $isCustomer = $object->client == 1 || $object->client == 3;
236 $isSupplier = $object->fournisseur == 1;
242 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'">';
243 print
'<input type="hidden" name="token" value="'.newToken().
'">';
244 print
'<input type="hidden" name="action" value="setremise">';
245 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
247 print
dol_get_fiche_head($head,
'absolutediscount', $langs->trans(
"ThirdParty"), -1,
'company');
249 dol_banner_tab($object,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
251 print
'<div class="fichecenter">';
253 print
'<div class="underbanner clearboth"></div>';
255 if (!$isCustomer && !$isSupplier) {
256 print
'<p class="opacitymedium">'.$langs->trans(
'ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').
'</p>';
268 print
'<div class="div-table-responsive-no-min">';
269 print
'<table class="border centpercent tableforfield borderbottom">';
272 $remise_all = $remise_user = 0;
273 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
274 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
275 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
276 $sql .=
" AND rc.entity = ".((int) $conf->entity);
277 $sql .=
" AND discount_type = 0";
278 $sql .=
" AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
279 $sql .=
" GROUP BY rc.fk_user";
280 $resql = $db->query($sql);
282 $obj = $db->fetch_object(
$resql);
283 $remise_all += $obj->amount;
284 if ($obj->fk_user == $user->id) {
285 $remise_user += $obj->amount;
291 print
'<tr><td class="titlefield">'.$langs->trans(
"CustomerAbsoluteDiscountAllUsers").
'</td>';
292 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT").
'</td></tr>';
294 if (!empty($user->fk_soc)) {
295 print
'<tr><td>'.$langs->trans(
"CustomerAbsoluteDiscountMy").
'</td>';
296 print
'<td class="amount">'.price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT").
'</td></tr>';
302 $remise_all = $remise_user = 0;
303 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
304 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
305 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
306 $sql .=
" AND rc.entity = ".((int) $conf->entity);
307 $sql .=
" AND discount_type = 1";
308 $sql .=
" AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
309 $sql .=
" GROUP BY rc.fk_user";
310 $resql = $db->query($sql);
312 $obj = $db->fetch_object(
$resql);
313 $remise_all += $obj->amount;
314 if ($obj->fk_user == $user->id) {
315 $remise_user += $obj->amount;
321 print
'<tr><td class="titlefield">'.$langs->trans(
"SupplierAbsoluteDiscountAllUsers").
'</td>';
322 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT").
'</td></tr>';
324 if (!empty($user->fk_soc)) {
325 print
'<tr><td>'.$langs->trans(
"SupplierAbsoluteDiscountMy").
'</td>';
326 print
'<td class="amount">'.price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT").
'</td></tr>';
338 if ($user->rights->societe->creer) {
344 if ($isCustomer && !$isSupplier) {
345 print
'<input type="hidden" name="discount_type" value="0" />';
348 if (!$isCustomer && $isSupplier) {
349 print
'<input type="hidden" name="discount_type" value="1" />';
355 print
'<div class="div-table-responsive-no-min">';
356 print
'<table class="border centpercent">';
357 if ($isCustomer && $isSupplier) {
358 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
'DiscountType').
'</td>';
359 print
'<td><input type="radio" name="discount_type" id="discount_type_0" checked="checked" value="0"/> <label for="discount_type_0">'.$langs->trans(
'Customer').
'</label>';
360 print
' <input type="radio" name="discount_type" id="discount_type_1" value="1"/> <label for="discount_type_1">'.$langs->trans(
'Supplier').
'</label>';
365 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Amount").
'</td>';
366 print
'<td><input type="text" size="5" name="amount" value="'.price2num(
GETPOST(
"amount")).
'" autofocus>';
367 print
'<span class="hideonsmartphone"> '.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
370 print
'<tr><td class="titlefield">'.$langs->trans(
"PriceBase").
'</td>';
372 print
$form->selectPriceBaseType(
GETPOST(
"price_base_type"),
"price_base_type");
376 print
'<tr><td>'.$langs->trans(
"VAT").
'</td>';
378 print
$form->load_tva(
'tva_tx',
GETPOSTISSET(
'tva_tx') ?
GETPOST(
'tva_tx',
'alpha') : 0, $mysoc, $object, 0, 0,
'', 0, 1);
380 print
'<tr><td class="fieldrequired" >'.$langs->trans(
"NoteReason").
'</td>';
381 print
'<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST(
'desc',
'alphanohtml').
'"></td></tr>';
389 if ($user->rights->societe->creer) {
390 print
'<div class="center">';
391 print
'<input type="submit" class="button" name="submit" value="'.$langs->trans(
"AddGlobalDiscount").
'">';
392 if (!empty($backtopage)) {
393 print
' ';
394 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
404 if ($action ==
'remove') {
405 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
417 print
'<div class="fichecenter">';
418 print
'<div class="fichehalfleft fichehalfleft-lg">';
422 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
423 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
424 $sql .=
" rc.datec as dc, rc.description,";
425 $sql .=
" rc.fk_facture_source,";
426 $sql .=
" u.login, u.rowid as user_id,";
427 $sql .=
" fa.ref as ref, fa.type as type";
428 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
429 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
430 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
431 $sql .=
" AND rc.entity = ".((int) $conf->entity);
432 $sql .=
" AND u.rowid = rc.fk_user";
433 $sql .=
" AND rc.discount_type = 0";
434 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
435 $sql .=
" ORDER BY rc.datec DESC";
437 $resql = $db->query($sql);
439 print
'<div class="div-table-responsive-no-min">';
440 print
'<table width="100%" class="noborder">';
441 print
'<tr class="liste_titre">';
442 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
443 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
444 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
445 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
447 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
449 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
450 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
452 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
454 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
455 print
'<td width="50"> </td>';
458 $showconfirminfo = array();
461 $num = $db->num_rows(
$resql);
464 $obj = $db->fetch_object(
$resql);
466 print
'<tr class="oddeven">';
467 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
468 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
469 print
'<td class="minwidth100">';
470 $facturestatic->id = $obj->fk_facture_source;
471 $facturestatic->ref = $obj->ref;
472 $facturestatic->type = $obj->type;
473 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
475 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
476 print
'<td class="minwidth100">';
477 $facturestatic->id = $obj->fk_facture_source;
478 $facturestatic->ref = $obj->ref;
479 $facturestatic->type = $obj->type;
480 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
482 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
483 print
'<td class="minwidth100">';
484 $facturestatic->id = $obj->fk_facture_source;
485 $facturestatic->ref = $obj->ref;
486 $facturestatic->type = $obj->type;
487 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
' '.$facturestatic->getNomURl(1);
490 print
'<td class="minwidth100">';
491 print $obj->description;
494 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
495 print
'<td class="right amount">'.price($obj->amount_ht).
'</td>';
497 print
'<td class="right amount">'.price($obj->multicurrency_amount_ht).
'</td>';
499 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''),
true).
'</td>';
500 print
'<td class="right amount">'.price($obj->amount_ttc).
'</td>';
502 print
'<td class="right amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
504 print
'<td class="center">';
505 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
507 if ($user->rights->societe->creer || $user->rights->facture->creer) {
508 print
'<td class="center nowrap">';
509 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=split&token='.
newToken().
'&remid='.$obj->rowid.($backtopage ?
'&backtopage='.urlencode($backtopage) :
'').
'">'.
img_split($langs->trans(
"SplitDiscount")).
'</a>';
510 print
'<a class="reposition marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=remove&token='.
newToken().
'&remid='.$obj->rowid.($backtopage ?
'&backtopage='.urlencode($backtopage) :
'').
'">'.
img_delete($langs->trans(
"RemoveDiscount")).
'</a>';
513 print
'<td> </td>';
517 if ($_GET[
"action"] ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
518 $showconfirminfo[
'rowid'] = $obj->rowid;
519 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
528 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
534 if (count($showconfirminfo)) {
535 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
536 $amount2 = ($showconfirminfo[
'amount_ttc'] - $amount1);
537 $formquestion = array(
538 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
539 array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
540 array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
542 $langs->load(
"dict");
543 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&remid='.$showconfirminfo[
'rowid'].($backtopage ?
'&backtopage='.urlencode($backtopage) :
''), $langs->trans(
'SplitDiscount'), $langs->trans(
'ConfirmSplitDiscount',
price($showconfirminfo[
'amount_ttc']), $langs->transnoentities(
"Currency".$conf->currency)),
'confirm_split', $formquestion,
'', 0);
553 print
'<div class="fichehalfright fichehalfright-lg">';
560 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
561 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
562 $sql .=
" rc.datec as dc, rc.description,";
563 $sql .=
" rc.fk_invoice_supplier_source,";
564 $sql .=
" u.login, u.rowid as user_id,";
565 $sql .=
" fa.ref, fa.type as type";
566 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
567 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
568 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
569 $sql .=
" AND rc.entity = ".((int) $conf->entity);
570 $sql .=
" AND u.rowid = rc.fk_user";
571 $sql .=
" AND rc.discount_type = 1";
572 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
573 $sql .=
" ORDER BY rc.datec DESC";
575 $resql = $db->query($sql);
577 print
'<div class="div-table-responsive-no-min">';
578 print
'<table width="100%" class="noborder">';
579 print
'<tr class="liste_titre">';
580 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
581 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
582 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
583 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
585 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
587 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
588 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
590 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
592 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
593 print
'<td width="50"> </td>';
596 $showconfirminfo = array();
599 $num = $db->num_rows(
$resql);
602 $obj = $db->fetch_object(
$resql);
604 print
'<tr class="oddeven">';
605 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
606 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
607 print
'<td class="minwidth100">';
608 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
609 $facturefournstatic->ref = $obj->ref;
610 $facturefournstatic->type = $obj->type;
611 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
613 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
614 print
'<td class="minwidth100">';
615 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
616 $facturefournstatic->ref = $obj->ref;
617 $facturefournstatic->type = $obj->type;
618 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
620 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
621 print
'<td class="minwidth100">';
622 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
623 $facturefournstatic->ref = $obj->ref;
624 $facturefournstatic->type = $obj->type;
625 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
628 print
'<td class="minwidth100">';
629 print $obj->description;
632 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
633 print
'<td class="right amount">'.price($obj->amount_ht).
'</td>';
635 print
'<td class="right amount">'.price($obj->multicurrency_amount_ht).
'</td>';
637 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''),
true).
'</td>';
638 print
'<td class="right amount">'.price($obj->amount_ttc).
'</td>';
640 print
'<td class="right amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
642 print
'<td class="center">';
643 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
645 if ($user->rights->societe->creer || $user->rights->facture->creer) {
646 print
'<td class="center nowrap">';
647 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=split&token='.
newToken().
'&remid='.$obj->rowid.($backtopage ?
'&backtopage='.urlencode($backtopage) :
'').
'">'.
img_split($langs->trans(
"SplitDiscount")).
'</a>';
648 print
'<a class="reposition marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=remove&token='.
newToken().
'&remid='.$obj->rowid.($backtopage ?
'&backtopage='.urlencode($backtopage) :
'').
'">'.
img_delete($langs->trans(
"RemoveDiscount")).
'</a>';
651 print
'<td> </td>';
655 if ($_GET[
"action"] ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
656 $showconfirminfo[
'rowid'] = $obj->rowid;
657 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
666 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
672 if (count($showconfirminfo)) {
673 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
674 $amount2 = ($showconfirminfo[
'amount_ttc'] - $amount1);
675 $formquestion = array(
676 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
677 array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
678 array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
680 $langs->load(
"dict");
681 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&remid='.$showconfirminfo[
'rowid'].($backtopage ?
'&backtopage='.urlencode($backtopage) :
''), $langs->trans(
'SplitDiscount'), $langs->trans(
'ConfirmSplitDiscount',
price($showconfirminfo[
'amount_ttc']), $langs->transnoentities(
"Currency".$conf->currency)),
'confirm_split', $formquestion, 0, 0);
693 print
'<div class="clearboth"></div><br>';
703 print
'<div class="fichecenter">';
704 print
'<div class="fichehalfleft fichehalfleft-lg">';
709 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
710 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
711 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
712 $sql .=
" u.login, u.rowid as user_id,";
713 $sql .=
" f.rowid as invoiceid, f.ref,";
714 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
715 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
716 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
717 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
718 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
719 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
720 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
721 $sql .=
" AND rc.fk_facture_line = fc.rowid";
722 $sql .=
" AND fc.fk_facture = f.rowid";
723 $sql .=
" AND rc.fk_user = u.rowid";
724 $sql .=
" AND rc.discount_type = 0";
725 $sql .=
" ORDER BY dc DESC";
728 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
729 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
730 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
731 $sql2 .=
" u.login, u.rowid as user_id,";
732 $sql2 .=
" f.rowid as invoiceid, f.ref,";
733 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
734 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
735 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
736 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
737 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
738 $sql2 .=
" WHERE rc.fk_soc = ".((int) $object->id);
739 $sql2 .=
" AND rc.fk_facture = f.rowid";
740 $sql2 .=
" AND rc.fk_user = u.rowid";
741 $sql2 .=
" AND rc.discount_type = 0";
742 $sql2 .=
" ORDER BY dc DESC";
744 $resql = $db->query($sql);
747 $resql2 = $db->query($sql2);
750 print
'<div class="div-table-responsive-no-min">';
751 print
'<table class="noborder centpercent">';
752 print
'<tr class="liste_titre">';
753 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
754 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
755 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
756 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
758 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
760 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
761 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
763 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
765 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
766 print
'<td width="50"> </td>';
769 $tab_sqlobj = array();
770 $tab_sqlobjOrder = array();
771 $num = $db->num_rows(
$resql);
773 for ($i = 0; $i < $num; $i++) {
774 $sqlobj = $db->fetch_object(
$resql);
775 $tab_sqlobj[] = $sqlobj;
776 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
781 $num = $db->num_rows($resql2);
782 for ($i = 0; $i < $num; $i++) {
783 $sqlobj = $db->fetch_object($resql2);
784 $tab_sqlobj[] = $sqlobj;
785 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
788 $array1_sort_order = SORT_DESC;
789 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
791 $num = count($tab_sqlobj);
795 $obj = array_shift($tab_sqlobj);
796 print
'<tr class="oddeven">';
797 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
798 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
799 print
'<td class="minwidth100">';
800 $facturestatic->id = $obj->fk_facture_source;
801 $facturestatic->ref = $obj->invoice_source_ref;
802 $facturestatic->type = $obj->type;
803 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
805 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
806 print
'<td class="minwidth100">';
807 $facturestatic->id = $obj->fk_facture_source;
808 $facturestatic->ref = $obj->invoice_source_ref;
809 $facturestatic->type = $obj->type;
810 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
812 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
813 print
'<td class="minwidth100">';
814 $facturestatic->id = $obj->fk_facture_source;
815 $facturestatic->ref = $obj->invoice_source_ref;
816 $facturestatic->type = $obj->type;
817 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturestatic->getNomURl(1);
820 print
'<td class="minwidth100">';
821 print $obj->description;
824 print
'<td class="left nowrap">';
825 if ($obj->invoiceid) {
826 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
829 print
'<td class="right">'.price($obj->amount_ht).
'</td>';
831 print
'<td class="right">'.price($obj->multicurrency_amount_ht).
'</td>';
833 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''),
true).
'</td>';
834 print
'<td class="right">'.price($obj->amount_ttc).
'</td>';
836 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
838 print
'<td class="center">';
839 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
841 print
'<td> </td>';
850 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
863 print
'<div class="fichehalfright fichehalfright-lg">';
868 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
869 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
870 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
871 $sql .=
" rc.fk_invoice_supplier_source,";
872 $sql .=
" u.login, u.rowid as user_id,";
873 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
874 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
875 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
876 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
877 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
878 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
879 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
880 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
881 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
882 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
883 $sql .=
" AND rc.fk_user = u.rowid";
884 $sql .=
" AND rc.discount_type = 1";
885 $sql .=
" ORDER BY dc DESC";
888 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
889 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
890 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
891 $sql2 .=
" rc.fk_invoice_supplier_source,";
892 $sql2 .=
" u.login, u.rowid as user_id,";
893 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
894 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
895 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
896 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
897 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
898 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
899 $sql2 .=
" WHERE rc.fk_soc = ".((int) $object->id);
900 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
901 $sql2 .=
" AND rc.fk_user = u.rowid";
902 $sql2 .=
" AND rc.discount_type = 1";
903 $sql2 .=
" ORDER BY dc DESC";
905 $resql = $db->query($sql);
908 $resql2 = $db->query($sql2);
911 print
'<div class="div-table-responsive-no-min">';
912 print
'<table class="noborder centpercent">';
913 print
'<tr class="liste_titre">';
914 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
915 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
916 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
917 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
919 print
'<td class="right toverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
921 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
922 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
924 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
926 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
927 print
'<td width="50"> </td>';
930 $tab_sqlobj = array();
931 $tab_sqlobjOrder = array();
932 $num = $db->num_rows(
$resql);
934 for ($i = 0; $i < $num; $i++) {
935 $sqlobj = $db->fetch_object(
$resql);
936 $tab_sqlobj[] = $sqlobj;
937 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
942 $num = $db->num_rows($resql2);
943 for ($i = 0; $i < $num; $i++) {
944 $sqlobj = $db->fetch_object($resql2);
945 $tab_sqlobj[] = $sqlobj;
946 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
949 $array1_sort_order = SORT_DESC;
950 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
952 $num = count($tab_sqlobj);
956 $obj = array_shift($tab_sqlobj);
957 print
'<tr class="oddeven">';
958 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
959 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
960 print
'<td class="minwidth100">';
961 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
962 $facturefournstatic->ref = $obj->invoice_source_ref;
963 $facturefournstatic->type = $obj->type;
964 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
966 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
967 print
'<td class="minwidth100">';
968 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
969 $facturefournstatic->ref = $obj->invoice_source_ref;
970 $facturefournstatic->type = $obj->type;
971 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
973 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
974 print
'<td class="minwidth100">';
975 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
976 $facturefournstatic->ref = $obj->invoice_source_ref;
977 $facturefournstatic->type = $obj->type;
978 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
981 print
'<td class="minwidth100">';
982 print $obj->description;
985 print
'<td class="left nowrap">';
986 if ($obj->invoiceid) {
987 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
990 print
'<td class="right">'.price($obj->amount_ht).
'</td>';
992 print
'<td class="right">'.price($obj->multicurrency_amount_ht).
'</td>';
994 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''),
true).
'</td>';
995 print
'<td class="right">'.price($obj->amount_ttc).
'</td>';
997 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
999 print
'<td class="center">';
1000 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
1002 print
'<td> </td>';
1011 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage absolute discounts.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
img_split($titlealt='default', $other='class="pictosplit"')
Show split logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.