27if (! defined(
'CSRFCHECK_WITH_TOKEN')) define(
'CSRFCHECK_WITH_TOKEN',
'1');
30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
34require_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');
46if ($user->socid > 0) {
47 $socid = $user->socid;
51if ($user->socid > 0) {
54$result =
restrictedArea($user,
'societe', $id,
'&societe',
'',
'fk_soc',
'rowid', 0);
56$permissiontocreate = ($user->rights->societe->creer || $user->rights->facture->creer);
64if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
65 header(
"Location: ".$backtopage);
69if ($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) :
''));
160if ($action ==
'setremise' && $permissiontocreate) {
165 $desc =
GETPOST(
'desc',
'alpha');
166 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
167 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
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');
200if (
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);
224$form =
new Form($db);
225$facturestatic =
new Facture($db);
228llxHeader(
'', $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 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
251 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
253 print
'<div class="fichecenter">';
255 print
'<div class="underbanner clearboth"></div>';
257 if (!$isCustomer && !$isSupplier) {
258 print
'<p class="opacitymedium">'.$langs->trans(
'ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').
'</p>';
270 print
'<div class="div-table-responsive-no-min">';
271 print
'<table class="border centpercent tableforfield borderbottom">';
274 $remise_all = $remise_user = 0;
275 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
276 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
277 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
278 $sql .=
" AND rc.entity = ".((int) $conf->entity);
279 $sql .=
" AND discount_type = 0";
280 $sql .=
" AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
281 $sql .=
" GROUP BY rc.fk_user";
282 $resql = $db->query($sql);
284 $obj = $db->fetch_object($resql);
285 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
286 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
287 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
293 print
'<tr><td>'.$langs->trans(
"CustomerAbsoluteDiscountAllUsers").
'</td>';
294 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT");
295 if (empty($user->fk_soc)) {
296 print $form->textwithpicto(
'', $langs->trans(
"CustomerAbsoluteDiscountMy").
': '.
price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT"));
303 $remise_all = $remise_user = 0;
304 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
305 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
306 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
307 $sql .=
" AND rc.entity = ".((int) $conf->entity);
308 $sql .=
" AND discount_type = 1";
309 $sql .=
" AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
310 $sql .=
" GROUP BY rc.fk_user";
311 $resql = $db->query($sql);
313 $obj = $db->fetch_object($resql);
314 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
315 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
316 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
322 print
'<tr><td>'.$langs->trans(
"SupplierAbsoluteDiscountAllUsers").
'</td>';
323 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT");
324 if (empty($user->fk_soc)) {
325 print $form->textwithpicto(
'', $langs->trans(
"SupplierAbsoluteDiscountMy").
' : '.
price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT"));
338 if ($action ==
'create_remise') {
339 if ($user->rights->societe->creer) {
342 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
343 if ($isCustomer && $isSupplier) {
344 $discounttypelabel = $discount_type == 1 ?
'NewSupplierGlobalDiscount' :
'NewClientGlobalDiscount';
346 $discounttypelabel =
'NewGlobalDiscount';
351 if ($isSupplier && $discount_type == 1) {
352 print
'<input type="hidden" name="discount_type" value="1" />';
354 print
'<input type="hidden" name="discount_type" value="0" />';
360 print
'<div class="div-table-responsive-no-min">';
361 print
'<table class="border centpercent">';
370 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Amount").
'</td>';
371 print
'<td><input type="text" size="5" name="amount" value="'.price2num(
GETPOST(
"amount")).
'" autofocus>';
372 print
'<span class="hideonsmartphone"> '.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
375 print
'<tr><td class="titlefield">'.$langs->trans(
"PriceBase").
'</td>';
377 print $form->selectPriceBaseType(
GETPOST(
"price_base_type"),
"price_base_type");
381 print
'<tr><td>'.$langs->trans(
"VAT").
'</td>';
383 print $form->load_tva(
'tva_tx', GETPOSTISSET(
'tva_tx') ?
GETPOST(
'tva_tx',
'alpha') : 0, $mysoc, $object, 0, 0,
'', 0, 1);
385 print
'<tr><td class="fieldrequired" >'.$langs->trans(
"NoteReason").
'</td>';
386 print
'<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST(
'desc',
'alphanohtml').
'"></td></tr>';
394 if ($user->rights->societe->creer) {
395 print
'<div class="center">';
396 print
'<input type="submit" class="button" name="submit" value="'.$langs->trans(
"AddGlobalDiscount").
'">';
397 if (!empty($backtopage)) {
398 print
' ';
399 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
410 if ($action ==
'remove') {
411 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
419 if ($isCustomer && !$isSupplier) {
420 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.$id.
'&discount_type=0&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&token='.newToken());
421 } elseif (!$isCustomer && $isSupplier) {
422 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.$id.
'&discount_type=1&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&token='.newToken());
427 print
load_fiche_titre($langs->trans(
"DiscountStillRemaining"), $newcardbutton);
430 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewClientGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.$id.
'&discount_type=0&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&token='.newToken());
432 print
'<div class="fichecenter">';
433 print
'<div class="fichehalfleft fichehalfleft-lg">';
434 print
load_fiche_titre($langs->trans(
"CustomerDiscounts"), $newcardbutton,
'');
437 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
438 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
439 $sql .=
" rc.datec as dc, rc.description,";
440 $sql .=
" rc.fk_facture_source,";
441 $sql .=
" u.login, u.rowid as user_id,";
442 $sql .=
" fa.ref as ref, fa.type as type";
443 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
444 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
445 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
446 $sql .=
" AND rc.entity = ".((int) $conf->entity);
447 $sql .=
" AND u.rowid = rc.fk_user";
448 $sql .=
" AND rc.discount_type = 0";
449 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
450 $sql .=
" ORDER BY rc.datec DESC";
452 $resql = $db->query($sql);
454 print
'<div class="div-table-responsive-no-min">';
455 print
'<table class="noborder centpercent">';
456 print
'<tr class="liste_titre">';
457 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
458 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
459 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
460 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
461 if (isModEnabled(
'multicompany')) {
462 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
464 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
465 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
466 if (isModEnabled(
'multicompany')) {
467 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
469 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
470 print
'<td width="50"> </td>';
473 $showconfirminfo = array();
476 $num = $db->num_rows($resql);
479 $obj = $db->fetch_object($resql);
481 print
'<tr class="oddeven">';
483 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
485 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
486 print
'<td class="tdoverflowmax100">';
487 $facturestatic->id = $obj->fk_facture_source;
488 $facturestatic->ref = $obj->ref;
489 $facturestatic->type = $obj->type;
490 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
492 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
493 print
'<td class="tdoverflowmax100">';
494 $facturestatic->id = $obj->fk_facture_source;
495 $facturestatic->ref = $obj->ref;
496 $facturestatic->type = $obj->type;
497 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
499 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
500 print
'<td class="tdoverflowmax100">';
501 $facturestatic->id = $obj->fk_facture_source;
502 $facturestatic->ref = $obj->ref;
503 $facturestatic->type = $obj->type;
504 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
' '.$facturestatic->getNomURl(1);
507 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
512 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
514 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
516 if (isModEnabled(
'multicompany')) {
517 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
519 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
520 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
521 if (isModEnabled(
'multicompany')) {
522 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
524 print
'<td class="center">';
525 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
527 if ($user->rights->societe->creer || $user->rights->facture->creer) {
528 print
'<td class="center nowrap">';
529 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>';
530 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>';
533 print
'<td> </td>';
537 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
538 $showconfirminfo[
'rowid'] = $obj->rowid;
539 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
545 if (isModEnabled(
'multicompany')) {
548 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
554 if (count($showconfirminfo)) {
555 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
556 $amount2 = ($showconfirminfo[
'amount_ttc'] - $amount1);
557 $formquestion = array(
558 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
559 array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
560 array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
562 $langs->load(
"dict");
563 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);
572 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewSupplierGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.$id.
'&discount_type=1&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'&token='.newToken());
574 print
'<div class="fichehalfright fichehalfright-lg">';
575 print
load_fiche_titre($langs->trans(
"SupplierDiscounts"), $newcardbutton,
'');
581 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
582 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
583 $sql .=
" rc.datec as dc, rc.description,";
584 $sql .=
" rc.fk_invoice_supplier_source,";
585 $sql .=
" u.login, u.rowid as user_id,";
586 $sql .=
" fa.ref, fa.type as type";
587 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
588 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
589 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
590 $sql .=
" AND rc.entity = ".((int) $conf->entity);
591 $sql .=
" AND u.rowid = rc.fk_user";
592 $sql .=
" AND rc.discount_type = 1";
593 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
594 $sql .=
" ORDER BY rc.datec DESC";
596 $resql = $db->query($sql);
598 print
'<div class="div-table-responsive-no-min">';
599 print
'<table class="noborder centpercent">';
600 print
'<tr class="liste_titre">';
601 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
602 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
603 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
604 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
605 if (isModEnabled(
'multicompany')) {
606 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
608 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
609 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
610 if (isModEnabled(
'multicompany')) {
611 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
613 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
614 print
'<td width="50"> </td>';
617 $showconfirminfo = array();
620 $num = $db->num_rows($resql);
623 $obj = $db->fetch_object($resql);
625 print
'<tr class="oddeven">';
626 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
627 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
628 print
'<td class="tdoverflowmax100">';
629 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
630 $facturefournstatic->ref = $obj->ref;
631 $facturefournstatic->type = $obj->type;
632 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
634 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
635 print
'<td class="tdoverflowmax100">';
636 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
637 $facturefournstatic->ref = $obj->ref;
638 $facturefournstatic->type = $obj->type;
639 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
641 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
642 print
'<td class="tdoverflowmax100">';
643 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
644 $facturefournstatic->ref = $obj->ref;
645 $facturefournstatic->type = $obj->type;
646 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
649 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
653 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
654 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
655 if (isModEnabled(
'multicompany')) {
656 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
658 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
659 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
660 if (isModEnabled(
'multicompany')) {
661 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
663 print
'<td class="center">';
664 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
666 if ($user->rights->societe->creer || $user->rights->facture->creer) {
667 print
'<td class="center nowrap">';
668 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>';
669 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>';
672 print
'<td> </td>';
676 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
677 $showconfirminfo[
'rowid'] = $obj->rowid;
678 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
684 if (isModEnabled(
'multicompany')) {
687 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
693 if (count($showconfirminfo)) {
694 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
695 $amount2 = ($showconfirminfo[
'amount_ttc'] - $amount1);
696 $formquestion = array(
697 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
698 array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
699 array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
701 $langs->load(
"dict");
702 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);
714 print
'<div class="clearboth"></div><br><br>';
724 print
'<div class="fichecenter">';
725 print
'<div class="fichehalfleft fichehalfleft-lg">';
730 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
731 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
732 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
733 $sql .=
" u.login, u.rowid as user_id,";
734 $sql .=
" f.rowid as invoiceid, f.ref,";
735 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
736 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
737 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
738 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
739 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
740 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
741 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
742 $sql .=
" AND rc.fk_facture_line = fc.rowid";
743 $sql .=
" AND fc.fk_facture = f.rowid";
744 $sql .=
" AND rc.fk_user = u.rowid";
745 $sql .=
" AND rc.discount_type = 0";
746 $sql .=
" ORDER BY dc DESC";
749 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
750 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
751 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
752 $sql2 .=
" u.login, u.rowid as user_id,";
753 $sql2 .=
" f.rowid as invoiceid, f.ref,";
754 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
755 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
756 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
757 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
758 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
759 $sql2 .=
" WHERE rc.fk_soc = ".((int) $object->id);
760 $sql2 .=
" AND rc.fk_facture = f.rowid";
761 $sql2 .=
" AND rc.fk_user = u.rowid";
762 $sql2 .=
" AND rc.discount_type = 0";
763 $sql2 .=
" ORDER BY dc DESC";
765 $resql = $db->query($sql);
768 $resql2 = $db->query($sql2);
771 print
'<div class="div-table-responsive-no-min">';
772 print
'<table class="noborder centpercent">';
773 print
'<tr class="liste_titre">';
774 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
775 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
776 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
777 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
778 if (isModEnabled(
'multicompany')) {
779 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
781 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
782 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
783 if (isModEnabled(
'multicompany')) {
784 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
786 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
787 print
'<td width="50"> </td>';
790 $tab_sqlobj = array();
791 $tab_sqlobjOrder = array();
792 $num = $db->num_rows($resql);
794 for ($i = 0; $i < $num; $i++) {
795 $sqlobj = $db->fetch_object($resql);
796 $tab_sqlobj[] = $sqlobj;
797 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
802 $num = $db->num_rows($resql2);
803 for ($i = 0; $i < $num; $i++) {
804 $sqlobj = $db->fetch_object($resql2);
805 $tab_sqlobj[] = $sqlobj;
806 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
809 $array1_sort_order = SORT_DESC;
810 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
812 $num = count($tab_sqlobj);
816 $obj = array_shift($tab_sqlobj);
817 print
'<tr class="oddeven">';
818 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
819 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
820 print
'<td class="tdoverflowmax100">';
821 $facturestatic->id = $obj->fk_facture_source;
822 $facturestatic->ref = $obj->invoice_source_ref;
823 $facturestatic->type = $obj->type;
824 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
826 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
827 print
'<td class="tdoverflowmax100">';
828 $facturestatic->id = $obj->fk_facture_source;
829 $facturestatic->ref = $obj->invoice_source_ref;
830 $facturestatic->type = $obj->type;
831 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
833 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
834 print
'<td class="tdoverflowmax100">';
835 $facturestatic->id = $obj->fk_facture_source;
836 $facturestatic->ref = $obj->invoice_source_ref;
837 $facturestatic->type = $obj->type;
838 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturestatic->getNomURl(1);
841 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
845 print
'<td class="left nowrap">';
846 if ($obj->invoiceid) {
847 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
850 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
851 if (isModEnabled(
'multicompany')) {
852 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
854 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
855 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
856 if (isModEnabled(
'multicompany')) {
857 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
859 print
'<td class="center">';
860 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
862 print
'<td> </td>';
868 if (isModEnabled(
'multicompany')) {
871 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
884 print
'<div class="fichehalfright fichehalfright-lg">';
889 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
890 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
891 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
892 $sql .=
" rc.fk_invoice_supplier_source,";
893 $sql .=
" u.login, u.rowid as user_id,";
894 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
895 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
896 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
897 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
898 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
899 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
900 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
901 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
902 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
903 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
904 $sql .=
" AND rc.fk_user = u.rowid";
905 $sql .=
" AND rc.discount_type = 1";
906 $sql .=
" ORDER BY dc DESC";
909 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
910 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
911 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
912 $sql2 .=
" rc.fk_invoice_supplier_source,";
913 $sql2 .=
" u.login, u.rowid as user_id,";
914 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
915 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
916 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
917 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
918 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
919 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
920 $sql2 .=
" WHERE rc.fk_soc = ".((int) $object->id);
921 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
922 $sql2 .=
" AND rc.fk_user = u.rowid";
923 $sql2 .=
" AND rc.discount_type = 1";
924 $sql2 .=
" ORDER BY dc DESC";
926 $resql = $db->query($sql);
929 $resql2 = $db->query($sql2);
932 print
'<div class="div-table-responsive-no-min">';
933 print
'<table class="noborder centpercent">';
934 print
'<tr class="liste_titre">';
935 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
936 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
937 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
938 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
939 if (isModEnabled(
'multicompany')) {
940 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
942 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
943 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
944 if (isModEnabled(
'multicompany')) {
945 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
947 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
948 print
'<td width="50"> </td>';
951 $tab_sqlobj = array();
952 $tab_sqlobjOrder = array();
953 $num = $db->num_rows($resql);
955 for ($i = 0; $i < $num; $i++) {
956 $sqlobj = $db->fetch_object($resql);
957 $tab_sqlobj[] = $sqlobj;
958 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
963 $num = $db->num_rows($resql2);
964 for ($i = 0; $i < $num; $i++) {
965 $sqlobj = $db->fetch_object($resql2);
966 $tab_sqlobj[] = $sqlobj;
967 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
970 $array1_sort_order = SORT_DESC;
971 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
973 $num = count($tab_sqlobj);
977 $obj = array_shift($tab_sqlobj);
978 print
'<tr class="oddeven">';
979 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
980 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
981 print
'<td class="tdoverflowmax100">';
982 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
983 $facturefournstatic->ref = $obj->invoice_source_ref;
984 $facturefournstatic->type = $obj->type;
985 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
987 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
988 print
'<td class="tdoverflowmax100">';
989 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
990 $facturefournstatic->ref = $obj->invoice_source_ref;
991 $facturefournstatic->type = $obj->type;
992 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
994 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
995 print
'<td class="tdoverflowmax100">';
996 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
997 $facturefournstatic->ref = $obj->invoice_source_ref;
998 $facturefournstatic->type = $obj->type;
999 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1002 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
1006 print
'<td class="left nowrap">';
1007 if ($obj->invoiceid) {
1008 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
1011 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
1012 if (isModEnabled(
'multicompany')) {
1013 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
1015 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
1016 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
1017 if (isModEnabled(
'multicompany')) {
1018 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
1020 print
'<td class="center">';
1021 print
'<a href="'.DOL_URL_ROOT.
'/user/card.php?id='.$obj->user_id.
'">'.
img_object($langs->trans(
"ShowUser"),
'user').
' '.$obj->login.
'</a>';
1023 print
'<td> </td>';
1029 if (isModEnabled(
'multicompany')) {
1032 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></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.
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.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
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...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.