27if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
28 define(
'CSRFCHECK_WITH_TOKEN',
'1');
32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
39$langs->loadLangs(array(
'orders',
'bills',
'companies'));
43$action =
GETPOST(
'action',
'aZ09');
44$backtopage =
GETPOST(
'backtopage',
'alpha');
48if ($user->socid > 0) {
49 $socid = $user->socid;
53if ($user->socid > 0) {
56$result =
restrictedArea($user,
'societe', $id,
'&societe',
'',
'fk_soc',
'rowid', 0);
58$permissiontocreate = ($user->rights->societe->creer || $user->rights->facture->creer);
66if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
67 header(
"Location: ".$backtopage);
71if ($action ==
'confirm_split' &&
GETPOST(
"confirm",
"alpha") ==
'yes' && $permissiontocreate) {
75 $amount_ttc_1 =
GETPOST(
'amount_ttc_1',
'alpha');
77 $amount_ttc_2 =
GETPOST(
'amount_ttc_2',
'alpha');
83 $res = $discount->fetch($remid);
86 setEventMessages($langs->trans(
"ErrorFailedToLoadDiscount"),
null,
'errors');
88 if (!$error &&
price2num($amount_ttc_1 + $amount_ttc_2) != $discount->amount_ttc) {
90 setEventMessages($langs->trans(
"TotalOfTwoDiscountMustEqualsOriginal"),
null,
'errors');
92 if (!$error && $discount->fk_facture_line) {
94 setEventMessages($langs->trans(
"ErrorCantSplitAUsedDiscount"),
null,
'errors');
99 $newdiscount1->fk_facture_source = $discount->fk_facture_source;
100 $newdiscount2->fk_facture_source = $discount->fk_facture_source;
101 $newdiscount1->fk_facture = $discount->fk_facture;
102 $newdiscount2->fk_facture = $discount->fk_facture;
103 $newdiscount1->fk_facture_line = $discount->fk_facture_line;
104 $newdiscount2->fk_facture_line = $discount->fk_facture_line;
105 $newdiscount1->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
106 $newdiscount2->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
107 $newdiscount1->fk_invoice_supplier = $discount->fk_invoice_supplier;
108 $newdiscount2->fk_invoice_supplier = $discount->fk_invoice_supplier;
109 $newdiscount1->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
110 $newdiscount2->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
111 if ($discount->description ==
'(CREDIT_NOTE)' || $discount->description ==
'(DEPOSIT)') {
112 $newdiscount1->description = $discount->description;
113 $newdiscount2->description = $discount->description;
115 $newdiscount1->description = $discount->description.
' (1)';
116 $newdiscount2->description = $discount->description.
' (2)';
119 $newdiscount1->fk_user = $discount->fk_user;
120 $newdiscount2->fk_user = $discount->fk_user;
121 $newdiscount1->fk_soc = $discount->fk_soc;
122 $newdiscount2->fk_soc = $discount->fk_soc;
123 $newdiscount1->discount_type = $discount->discount_type;
124 $newdiscount2->discount_type = $discount->discount_type;
125 $newdiscount1->datec = $discount->datec;
126 $newdiscount2->datec = $discount->datec;
127 $newdiscount1->tva_tx = $discount->tva_tx;
128 $newdiscount2->tva_tx = $discount->tva_tx;
129 $newdiscount1->vat_src_code = $discount->vat_src_code;
130 $newdiscount2->vat_src_code = $discount->vat_src_code;
131 $newdiscount1->amount_ttc = $amount_ttc_1;
132 $newdiscount2->amount_ttc =
price2num($discount->amount_ttc - $newdiscount1->amount_ttc);
133 $newdiscount1->amount_ht =
price2num($newdiscount1->amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
134 $newdiscount2->amount_ht =
price2num($newdiscount2->amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
135 $newdiscount1->amount_tva =
price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht);
136 $newdiscount2->amount_tva =
price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht);
138 $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc);
139 $newdiscount2->multicurrency_amount_ttc =
price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc);
140 $newdiscount1->multicurrency_amount_ht =
price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
141 $newdiscount2->multicurrency_amount_ht =
price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
142 $newdiscount1->multicurrency_amount_tva =
price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht);
143 $newdiscount2->multicurrency_amount_tva =
price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht);
146 $discount->fk_facture_source = 0;
148 $discount->fk_invoice_supplier_source = 0;
149 $res = $discount->delete($user);
150 $newid1 = $newdiscount1->create($user);
151 $newid2 = $newdiscount2->create($user);
152 if ($res > 0 && $newid1 > 0 && $newid2 > 0) {
154 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id.($backtopage ?
'&backtopage='.urlencode($backtopage) :
''));
162if ($action ==
'setremise' && $permissiontocreate) {
167 $desc =
GETPOST(
'desc',
'alpha');
168 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
169 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
170 $price_base_type =
GETPOST(
'price_base_type',
'alpha');
175 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ReasonDiscount")),
null,
'errors');
182 $discountid = $soc->set_remise_except($amount, $user, $desc, $tva_tx, $discount_type, $price_base_type);
184 if ($discountid > 0) {
185 if (!empty($backtopage)) {
186 header(
"Location: ".$backtopage.
'&discountid='.((
int) $discountid));
189 header(
"Location: remx.php?id=".((
int) $id));
198 setEventMessages($langs->trans(
"ErrorFieldFormat", $langs->transnoentitiesnoconv(
"AmountHT")),
null,
'errors');
202if (
GETPOST(
'action',
'aZ09') ==
'confirm_remove' &&
GETPOST(
"confirm") ==
'yes' && $permissiontocreate) {
209 $result = $discount->fetch(
GETPOSTINT(
"remid"));
210 $result = $discount->delete($user);
213 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
226$form =
new Form($db);
227$facturestatic =
new Facture($db);
229$tmpuser =
new User($db);
231llxHeader(
'', $langs->trans(
"GlobalDiscount"));
236 $object->fetch($socid);
238 $isCustomer = $object->client == 1 || $object->client == 3;
239 $isSupplier = $object->fournisseur == 1;
245 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'">';
246 print
'<input type="hidden" name="token" value="'.newToken().
'">';
247 print
'<input type="hidden" name="action" value="setremise">';
248 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
250 print
dol_get_fiche_head($head,
'absolutediscount', $langs->trans(
"ThirdParty"), -1,
'company');
252 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
254 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
256 print
'<div class="fichecenter">';
258 print
'<div class="underbanner clearboth"></div>';
260 if (!$isCustomer && !$isSupplier) {
261 print
'<p class="opacitymedium">'.$langs->trans(
'ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').
'</p>';
273 print
'<div class="div-table-responsive-no-min">';
274 print
'<table class="border centpercent tableforfield borderbottom">';
277 $remise_all = $remise_user = 0;
278 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
279 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
280 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
281 $sql .=
" AND rc.entity = ".((int) $conf->entity);
282 $sql .=
" AND discount_type = 0";
283 $sql .=
" AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
284 $sql .=
" GROUP BY rc.fk_user";
285 $resql = $db->query($sql);
287 $obj = $db->fetch_object($resql);
288 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
289 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
290 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
296 print
'<tr><td>'.$langs->trans(
"CustomerAbsoluteDiscountAllUsers").
'</td>';
297 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT");
298 if (empty($user->fk_soc)) {
299 print $form->textwithpicto(
'', $langs->trans(
"CustomerAbsoluteDiscountMy").
': '.
price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT"));
306 $remise_all = $remise_user = 0;
307 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
308 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
309 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
310 $sql .=
" AND rc.entity = ".((int) $conf->entity);
311 $sql .=
" AND discount_type = 1";
312 $sql .=
" AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
313 $sql .=
" GROUP BY rc.fk_user";
314 $resql = $db->query($sql);
316 $obj = $db->fetch_object($resql);
317 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
318 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
319 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
325 print
'<tr><td>'.$langs->trans(
"SupplierAbsoluteDiscountAllUsers").
'</td>';
326 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT");
327 if (empty($user->fk_soc)) {
328 print $form->textwithpicto(
'', $langs->trans(
"SupplierAbsoluteDiscountMy").
' : '.
price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT"));
341 if ($action ==
'create_remise') {
342 if ($user->hasRight(
'societe',
'creer')) {
345 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
346 if ($isCustomer && $isSupplier) {
347 $discounttypelabel = $discount_type == 1 ?
'NewSupplierGlobalDiscount' :
'NewClientGlobalDiscount';
349 $discounttypelabel =
'NewGlobalDiscount';
354 if ($isSupplier && $discount_type == 1) {
355 print
'<input type="hidden" name="discount_type" value="1" />';
357 print
'<input type="hidden" name="discount_type" value="0" />';
363 print
'<div class="div-table-responsive-no-min">';
364 print
'<table class="border centpercent">';
373 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Amount").
'</td>';
374 print
'<td><input type="text" size="5" name="amount" value="'.price2num(
GETPOST(
"amount")).
'" autofocus>';
375 print
'<span class="hideonsmartphone"> '.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
378 print
'<tr><td class="titlefield">'.$langs->trans(
"PriceBase").
'</td>';
380 print $form->selectPriceBaseType(
GETPOST(
"price_base_type"),
"price_base_type");
384 print
'<tr><td>'.$langs->trans(
"VAT").
'</td>';
386 print $form->load_tva(
'tva_tx', GETPOSTISSET(
'tva_tx') ?
GETPOST(
'tva_tx',
'alpha') : 0, $mysoc, $object, 0, 0,
'', 0, 1);
388 print
'<tr><td class="fieldrequired" >'.$langs->trans(
"NoteReason").
'</td>';
389 print
'<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST(
'desc',
'alphanohtml').
'"></td></tr>';
397 if ($user->hasRight(
'societe',
'creer')) {
398 print
'<div class="center">';
399 print
'<input type="submit" class="button" name="submit" value="'.$langs->trans(
"AddGlobalDiscount").
'">';
400 if (!empty($backtopage)) {
401 print
' ';
402 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
413 if ($action ==
'remove') {
414 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
422 if ($isCustomer && !$isSupplier) {
423 $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());
424 } elseif (!$isCustomer && $isSupplier) {
425 $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());
430 print
load_fiche_titre($langs->trans(
"DiscountStillRemaining"), $newcardbutton);
433 $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());
435 print
'<div class="fichecenter">';
436 print
'<div class="fichehalfleft fichehalfleft-lg">';
437 print
load_fiche_titre($langs->trans(
"CustomerDiscounts"), $newcardbutton,
'');
440 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
441 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
442 $sql .=
" rc.datec as dc, rc.description,";
443 $sql .=
" rc.fk_facture_source,";
444 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
445 $sql .=
" fa.ref as ref, fa.type as type";
446 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
447 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
448 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
449 $sql .=
" AND rc.entity = ".((int) $conf->entity);
450 $sql .=
" AND u.rowid = rc.fk_user";
451 $sql .=
" AND rc.discount_type = 0";
452 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
453 $sql .=
" ORDER BY rc.datec DESC";
455 $resql = $db->query($sql);
457 print
'<div class="div-table-responsive-no-min">';
458 print
'<table class="noborder centpercent">';
459 print
'<tr class="liste_titre">';
460 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
461 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
462 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
463 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
464 if (isModEnabled(
'multicompany')) {
465 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
467 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
468 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
469 if (isModEnabled(
'multicompany')) {
470 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
472 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
473 print
'<td width="50"> </td>';
476 $showconfirminfo = array();
479 $num = $db->num_rows($resql);
482 $obj = $db->fetch_object($resql);
484 $tmpuser->id = $obj->user_id;
485 $tmpuser->login = $obj->login;
486 $tmpuser->firstname = $obj->firstname;
487 $tmpuser->lastname = $obj->lastname;
488 $tmpuser->photo = $obj->photo;
489 $tmpuser->status = $obj->status;
491 print
'<tr class="oddeven">';
493 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
495 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
496 print
'<td class="tdoverflowmax100">';
497 $facturestatic->id = $obj->fk_facture_source;
498 $facturestatic->ref = $obj->ref;
499 $facturestatic->type = $obj->type;
500 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
502 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
503 print
'<td class="tdoverflowmax100">';
504 $facturestatic->id = $obj->fk_facture_source;
505 $facturestatic->ref = $obj->ref;
506 $facturestatic->type = $obj->type;
507 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
509 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
510 print
'<td class="tdoverflowmax100">';
511 $facturestatic->id = $obj->fk_facture_source;
512 $facturestatic->ref = $obj->ref;
513 $facturestatic->type = $obj->type;
514 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
' '.$facturestatic->getNomURl(1);
517 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
522 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
524 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
526 if (isModEnabled(
'multicompany')) {
527 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
529 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
530 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
531 if (isModEnabled(
'multicompany')) {
532 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
534 print
'<td class="tdoverflowmax100">';
536 print $tmpuser->getNomUrl(-1);
539 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
540 print
'<td class="center nowrap">';
541 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>';
542 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>';
545 print
'<td> </td>';
549 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
550 $showconfirminfo[
'rowid'] = $obj->rowid;
551 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
557 if (isModEnabled(
'multicompany')) {
560 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
566 if (count($showconfirminfo)) {
567 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
568 $amount2 = ($showconfirminfo[
'amount_ttc'] - $amount1);
569 $formquestion = array(
570 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
571 array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
572 array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
574 $langs->load(
"dict");
575 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);
584 $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());
586 print
'<div class="fichehalfright fichehalfright-lg">';
587 print
load_fiche_titre($langs->trans(
"SupplierDiscounts"), $newcardbutton,
'');
593 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
594 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
595 $sql .=
" rc.datec as dc, rc.description,";
596 $sql .=
" rc.fk_invoice_supplier_source,";
597 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
598 $sql .=
" fa.ref, fa.type as type";
599 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
600 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
601 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
602 $sql .=
" AND rc.entity = ".((int) $conf->entity);
603 $sql .=
" AND u.rowid = rc.fk_user";
604 $sql .=
" AND rc.discount_type = 1";
605 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
606 $sql .=
" ORDER BY rc.datec DESC";
608 $resql = $db->query($sql);
610 print
'<div class="div-table-responsive-no-min">';
611 print
'<table class="noborder centpercent">';
612 print
'<tr class="liste_titre">';
613 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
614 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
615 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
616 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
617 if (isModEnabled(
'multicompany')) {
618 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
620 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
621 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
622 if (isModEnabled(
'multicompany')) {
623 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
625 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
626 print
'<td width="50"> </td>';
629 $showconfirminfo = array();
632 $num = $db->num_rows($resql);
635 $obj = $db->fetch_object($resql);
637 $tmpuser->id = $obj->user_id;
638 $tmpuser->login = $obj->login;
639 $tmpuser->firstname = $obj->firstname;
640 $tmpuser->lastname = $obj->lastname;
641 $tmpuser->photo = $obj->photo;
642 $tmpuser->status = $obj->status;
644 print
'<tr class="oddeven">';
645 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
646 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
647 print
'<td class="tdoverflowmax100">';
648 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
649 $facturefournstatic->ref = $obj->ref;
650 $facturefournstatic->type = $obj->type;
651 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
653 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
654 print
'<td class="tdoverflowmax100">';
655 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
656 $facturefournstatic->ref = $obj->ref;
657 $facturefournstatic->type = $obj->type;
658 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
660 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
661 print
'<td class="tdoverflowmax100">';
662 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
663 $facturefournstatic->ref = $obj->ref;
664 $facturefournstatic->type = $obj->type;
665 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
668 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
672 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
673 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
674 if (isModEnabled(
'multicompany')) {
675 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
677 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
678 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
679 if (isModEnabled(
'multicompany')) {
680 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
682 print
'<td class="tdoverflowmax100">';
683 print $tmpuser->getNomUrl(-1);
686 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
687 print
'<td class="center nowrap">';
688 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>';
689 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>';
692 print
'<td> </td>';
696 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
697 $showconfirminfo[
'rowid'] = $obj->rowid;
698 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
704 if (isModEnabled(
'multicompany')) {
707 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
713 if (count($showconfirminfo)) {
714 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
715 $amount2 = ($showconfirminfo[
'amount_ttc'] - $amount1);
716 $formquestion = array(
717 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
718 array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
719 array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
721 $langs->load(
"dict");
722 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);
734 print
'<div class="clearboth"></div><br><br>';
744 print
'<div class="fichecenter">';
745 print
'<div class="fichehalfleft fichehalfleft-lg">';
750 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
751 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
752 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
753 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
754 $sql .=
" f.rowid as invoiceid, f.ref,";
755 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
756 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
757 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
758 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
759 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
760 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
761 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
762 $sql .=
" AND rc.fk_facture_line = fc.rowid";
763 $sql .=
" AND fc.fk_facture = f.rowid";
764 $sql .=
" AND rc.fk_user = u.rowid";
765 $sql .=
" AND rc.discount_type = 0";
766 $sql .=
" ORDER BY dc DESC";
769 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
770 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
771 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
772 $sql2 .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
773 $sql2 .=
" f.rowid as invoiceid, f.ref,";
774 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
775 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
776 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
777 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
778 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
779 $sql2 .=
" WHERE rc.fk_soc = ".((int) $object->id);
780 $sql2 .=
" AND rc.fk_facture = f.rowid";
781 $sql2 .=
" AND rc.fk_user = u.rowid";
782 $sql2 .=
" AND rc.discount_type = 0";
783 $sql2 .=
" ORDER BY dc DESC";
785 $resql = $db->query($sql);
788 $resql2 = $db->query($sql2);
791 print
'<div class="div-table-responsive-no-min">';
792 print
'<table class="noborder centpercent">';
793 print
'<tr class="liste_titre">';
794 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
795 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
796 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
797 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
798 if (isModEnabled(
'multicompany')) {
799 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
801 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
802 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
803 if (isModEnabled(
'multicompany')) {
804 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
806 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
807 print
'<td width="50"> </td>';
810 $tab_sqlobj = array();
811 $tab_sqlobjOrder = array();
812 $num = $db->num_rows($resql);
814 for ($i = 0; $i < $num; $i++) {
815 $sqlobj = $db->fetch_object($resql);
816 $tab_sqlobj[] = $sqlobj;
817 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
822 $num = $db->num_rows($resql2);
823 for ($i = 0; $i < $num; $i++) {
824 $sqlobj = $db->fetch_object($resql2);
825 $tab_sqlobj[] = $sqlobj;
826 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
829 $array1_sort_order = SORT_DESC;
830 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
832 $num = count($tab_sqlobj);
836 $obj = array_shift($tab_sqlobj);
838 $tmpuser->id = $obj->user_id;
839 $tmpuser->login = $obj->login;
840 $tmpuser->firstname = $obj->firstname;
841 $tmpuser->lastname = $obj->lastname;
842 $tmpuser->photo = $obj->photo;
843 $tmpuser->status = $obj->status;
845 print
'<tr class="oddeven">';
846 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
847 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
848 print
'<td class="tdoverflowmax100">';
849 $facturestatic->id = $obj->fk_facture_source;
850 $facturestatic->ref = $obj->invoice_source_ref;
851 $facturestatic->type = $obj->type;
852 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
854 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
855 print
'<td class="tdoverflowmax100">';
856 $facturestatic->id = $obj->fk_facture_source;
857 $facturestatic->ref = $obj->invoice_source_ref;
858 $facturestatic->type = $obj->type;
859 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
861 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
862 print
'<td class="tdoverflowmax100">';
863 $facturestatic->id = $obj->fk_facture_source;
864 $facturestatic->ref = $obj->invoice_source_ref;
865 $facturestatic->type = $obj->type;
866 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturestatic->getNomURl(1);
869 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
873 print
'<td class="left nowrap">';
874 if ($obj->invoiceid) {
875 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
878 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
879 if (isModEnabled(
'multicompany')) {
880 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
882 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
883 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
884 if (isModEnabled(
'multicompany')) {
885 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
887 print
'<td class="tdoverflowmax100">';
888 print $tmpuser->getNomUrl(-1);
891 print
'<td> </td>';
897 if (isModEnabled(
'multicompany')) {
900 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
913 print
'<div class="fichehalfright fichehalfright-lg">';
918 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
919 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
920 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
921 $sql .=
" rc.fk_invoice_supplier_source,";
922 $sql .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
923 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
924 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
925 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
926 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
927 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
928 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
929 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
930 $sql .=
" WHERE rc.fk_soc = ".((int) $object->id);
931 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
932 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
933 $sql .=
" AND rc.fk_user = u.rowid";
934 $sql .=
" AND rc.discount_type = 1";
935 $sql .=
" ORDER BY dc DESC";
938 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
939 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
940 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
941 $sql2 .=
" rc.fk_invoice_supplier_source,";
942 $sql2 .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
943 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
944 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
945 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
946 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
947 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
948 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
949 $sql2 .=
" WHERE rc.fk_soc = ".((int) $object->id);
950 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
951 $sql2 .=
" AND rc.fk_user = u.rowid";
952 $sql2 .=
" AND rc.discount_type = 1";
953 $sql2 .=
" ORDER BY dc DESC";
955 $resql = $db->query($sql);
958 $resql2 = $db->query($sql2);
961 print
'<div class="div-table-responsive-no-min">';
962 print
'<table class="noborder centpercent">';
963 print
'<tr class="liste_titre">';
964 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
965 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
966 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
967 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
968 if (isModEnabled(
'multicompany')) {
969 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
971 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
972 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
973 if (isModEnabled(
'multicompany')) {
974 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
976 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
977 print
'<td width="50"> </td>';
980 $tab_sqlobj = array();
981 $tab_sqlobjOrder = array();
982 $num = $db->num_rows($resql);
984 for ($i = 0; $i < $num; $i++) {
985 $sqlobj = $db->fetch_object($resql);
986 $tab_sqlobj[] = $sqlobj;
987 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
992 $num = $db->num_rows($resql2);
993 for ($i = 0; $i < $num; $i++) {
994 $sqlobj = $db->fetch_object($resql2);
995 $tab_sqlobj[] = $sqlobj;
996 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
999 $array1_sort_order = SORT_DESC;
1000 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
1002 $num = count($tab_sqlobj);
1006 $obj = array_shift($tab_sqlobj);
1008 $tmpuser->id = $obj->user_id;
1009 $tmpuser->login = $obj->login;
1010 $tmpuser->firstname = $obj->firstname;
1011 $tmpuser->lastname = $obj->lastname;
1012 $tmpuser->photo = $obj->photo;
1013 $tmpuser->status = $obj->status;
1015 print
'<tr class="oddeven">';
1016 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
1017 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
1018 print
'<td class="tdoverflowmax100">';
1019 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1020 $facturefournstatic->ref = $obj->invoice_source_ref;
1021 $facturefournstatic->type = $obj->type;
1022 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1024 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
1025 print
'<td class="tdoverflowmax100">';
1026 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1027 $facturefournstatic->ref = $obj->invoice_source_ref;
1028 $facturefournstatic->type = $obj->type;
1029 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1031 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
1032 print
'<td class="tdoverflowmax100">';
1033 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1034 $facturefournstatic->ref = $obj->invoice_source_ref;
1035 $facturefournstatic->type = $obj->type;
1036 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1039 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
1043 print
'<td class="left nowrap">';
1044 if ($obj->invoiceid) {
1045 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
1048 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
1049 if (isModEnabled(
'multicompany')) {
1050 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
1052 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
1053 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
1054 if (isModEnabled(
'multicompany')) {
1055 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
1057 print
'<td class="tdoverflowmax100">';
1058 print $tmpuser->getNomUrl(-1);
1061 print
'<td> </td>';
1068 if (isModEnabled(
'multicompany')) {
1071 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...)
Class to manage Dolibarr users.
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.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
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.