28if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
29 define(
'CSRFCHECK_WITH_TOKEN',
'1');
33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
49$langs->loadLangs(array(
'orders',
'bills',
'companies'));
53$action =
GETPOST(
'action',
'aZ09');
54$backtopage =
GETPOST(
'backtopage',
'alpha');
59if ($user->socid > 0) {
60 $socid = $user->socid;
64if ($user->socid > 0) {
67$result =
restrictedArea($user,
'societe', $id,
'&societe',
'',
'fk_soc',
'rowid', 0);
69$permissiontocreate = ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer'));
77if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
78 header(
"Location: ".$backtopage);
82if ($action ==
'confirm_split' &&
GETPOST(
"confirm",
"alpha") ==
'yes' && $permissiontocreate) {
83 $amount_ttc_1 =
GETPOST(
'amount_ttc_1',
'alpha');
85 $amount_ttc_2 =
GETPOST(
'amount_ttc_2',
'alpha');
91 $res = $discount->fetch($remid);
94 setEventMessages($langs->trans(
"ErrorFailedToLoadDiscount"),
null,
'errors');
96 if (!$error &&
price2num((
float) $amount_ttc_1 + (
float) $amount_ttc_2,
'MT') != $discount->amount_ttc) {
98 setEventMessages($langs->trans(
"TotalOfTwoDiscountMustEqualsOriginal"),
null,
'errors');
100 if (!$error && $discount->fk_facture_line) {
102 setEventMessages($langs->trans(
"ErrorCantSplitAUsedDiscount"),
null,
'errors');
107 $newdiscount1->fk_facture_source = $discount->fk_facture_source;
108 $newdiscount2->fk_facture_source = $discount->fk_facture_source;
109 $newdiscount1->fk_facture = $discount->fk_facture;
110 $newdiscount2->fk_facture = $discount->fk_facture;
111 $newdiscount1->fk_facture_line = $discount->fk_facture_line;
112 $newdiscount2->fk_facture_line = $discount->fk_facture_line;
113 $newdiscount1->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
114 $newdiscount2->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
115 $newdiscount1->fk_invoice_supplier = $discount->fk_invoice_supplier;
116 $newdiscount2->fk_invoice_supplier = $discount->fk_invoice_supplier;
117 $newdiscount1->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
118 $newdiscount2->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
119 if ($discount->description ==
'(CREDIT_NOTE)' || $discount->description ==
'(DEPOSIT)') {
120 $newdiscount1->description = $discount->description;
121 $newdiscount2->description = $discount->description;
123 $newdiscount1->description = $discount->description.
' (1)';
124 $newdiscount2->description = $discount->description.
' (2)';
127 $newdiscount1->fk_user = $discount->fk_user;
128 $newdiscount2->fk_user = $discount->fk_user;
129 $newdiscount1->fk_soc = $discount->fk_soc;
130 $newdiscount1->socid = $discount->socid;
131 $newdiscount2->fk_soc = $discount->fk_soc;
132 $newdiscount2->socid = $discount->socid;
133 $newdiscount1->discount_type = $discount->discount_type;
134 $newdiscount2->discount_type = $discount->discount_type;
135 $newdiscount1->datec = $discount->datec;
136 $newdiscount2->datec = $discount->datec;
137 $newdiscount1->tva_tx = $discount->tva_tx;
138 $newdiscount2->tva_tx = $discount->tva_tx;
139 $newdiscount1->vat_src_code = $discount->vat_src_code;
140 $newdiscount2->vat_src_code = $discount->vat_src_code;
141 $newdiscount1->amount_ttc = $amount_ttc_1;
142 $newdiscount2->amount_ttc =
price2num($discount->amount_ttc - $newdiscount1->amount_ttc);
143 $newdiscount1->amount_ht =
price2num($newdiscount1->amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
144 $newdiscount2->amount_ht =
price2num($newdiscount2->amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
145 $newdiscount1->amount_tva =
price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht);
146 $newdiscount2->amount_tva =
price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht);
148 $newdiscount1->multicurrency_amount_ttc = (float) $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc);
149 $newdiscount2->multicurrency_amount_ttc =
price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc);
150 $newdiscount1->multicurrency_amount_ht =
price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
151 $newdiscount2->multicurrency_amount_ht =
price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
152 $newdiscount1->multicurrency_amount_tva =
price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht);
153 $newdiscount2->multicurrency_amount_tva =
price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht);
157 $discount->fk_facture_source = 0;
159 $discount->fk_invoice_supplier_source = 0;
160 $res = $discount->delete($user);
161 $newid1 = $newdiscount1->create($user);
162 $newid2 = $newdiscount2->create($user);
163 if ($res > 0 && $newid1 > 0 && $newid2 > 0) {
165 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.
$id.($backtopage ?
'&backtopage='.urlencode($backtopage) :
''));
173if ($action ==
'setremise' && $permissiontocreate) {
175 $desc =
GETPOST(
'desc',
'alpha');
176 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
177 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
178 $price_base_type =
GETPOST(
'price_base_type',
'alpha');
183 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ReasonDiscount")),
null,
'errors');
190 $discountid = $soc->set_remise_except((
float) $amount, $user, $desc, $tva_tx, $discount_type, $price_base_type);
192 if ($discountid > 0) {
193 if (!empty($backtopage)) {
194 header(
"Location: ".$backtopage.
'&discountid='.((
int) $discountid));
197 header(
"Location: remx.php?id=".((
int) $id));
206 setEventMessages($langs->trans(
"ErrorFieldFormat", $langs->transnoentitiesnoconv(
"AmountHT")),
null,
'errors');
210if (
GETPOST(
'action',
'aZ09') ==
'confirm_remove' &&
GETPOST(
"confirm") ==
'yes' && $permissiontocreate) {
214 $result = $discount->fetch(
GETPOSTINT(
"remid"));
215 $result = $discount->delete($user);
218 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
231$form =
new Form($db);
232$facturestatic =
new Facture($db);
234$tmpuser =
new User($db);
236llxHeader(
'', $langs->trans(
"GlobalDiscount"));
244 $isSupplier =
$object->fournisseur == 1;
250 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
251 print
'<input type="hidden" name="token" value="'.newToken().
'">';
252 print
'<input type="hidden" name="action" value="setremise">';
253 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
255 print
dol_get_fiche_head($head,
'absolutediscount', $langs->trans(
"ThirdParty"), -1,
'company');
257 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
259 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
261 print
'<div class="fichecenter">';
263 print
'<div class="underbanner clearboth"></div>';
265 if (!$isCustomer && !$isSupplier) {
266 print
'<p class="opacitymedium">'.$langs->trans(
'ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').
'</p>';
278 print
'<div class="div-table-responsive-no-min">';
279 print
'<table class="border centpercent tableforfield borderbottom">';
282 $remise_all = $remise_user = 0;
283 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
284 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
285 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
286 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
287 $sql .=
" AND discount_type = 0";
288 $sql .=
" AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
289 $sql .=
" GROUP BY rc.fk_user";
290 $resql = $db->query($sql);
292 while ($obj = $db->fetch_object($resql)) {
293 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
294 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
295 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
302 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomerAbsoluteDiscountAllUsers").
'</td>';
303 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT");
304 if (empty($user->fk_soc)) {
305 print $form->textwithpicto(
'', $langs->trans(
"CustomerAbsoluteDiscountMy").
': '.
price($remise_user, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT"));
312 $remise_all = $remise_user = 0;
313 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
314 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
315 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
316 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
317 $sql .=
" AND discount_type = 1";
318 $sql .=
" AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
319 $sql .=
" GROUP BY rc.fk_user";
320 $resql = $db->query($sql);
322 while ($obj = $db->fetch_object($resql)) {
323 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
324 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
325 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
332 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SupplierAbsoluteDiscountAllUsers").
'</td>';
333 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT");
334 if (empty($user->fk_soc)) {
335 print $form->textwithpicto(
'', $langs->trans(
"SupplierAbsoluteDiscountMy").
' : '.
price($remise_user, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT"));
348 if ($action ==
'create_remise') {
349 if ($user->hasRight(
'societe',
'creer')) {
352 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
353 if ($isCustomer && $isSupplier) {
354 $discounttypelabel = $discount_type == 1 ?
'NewSupplierGlobalDiscount' :
'NewClientGlobalDiscount';
356 $discounttypelabel =
'NewGlobalDiscount';
361 if ($isSupplier && $discount_type == 1) {
362 print
'<input type="hidden" name="discount_type" value="1" />';
364 print
'<input type="hidden" name="discount_type" value="0" />';
370 print
'<div class="div-table-responsive-no-min">';
371 print
'<table class="border centpercent">';
380 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Amount").
'</td>';
381 print
'<td><input type="text" size="5" name="amount" value="'.price2num(
GETPOST(
"amount")).
'" autofocus>';
382 print
'<span class="hideonsmartphone"> '.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
385 print
'<tr><td class="titlefield">'.$langs->trans(
"PriceBase").
'</td>';
387 print $form->selectPriceBaseType(
GETPOST(
"price_base_type"),
"price_base_type");
391 print
'<tr><td>'.$langs->trans(
"VAT").
'</td>';
393 print $form->load_tva(
'tva_tx', (GETPOSTISSET(
'tva_tx') ?
GETPOST(
'tva_tx',
'alpha') :
getDolGlobalString(
'MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS', 0)), $mysoc,
$object, 0, 0,
'', false, 1);
395 print
'<tr><td class="fieldrequired" >'.$langs->trans(
"NoteReason").
'</td>';
396 print
'<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST(
'desc',
'alphanohtml').
'"></td></tr>';
404 if ($user->hasRight(
'societe',
'creer')) {
405 print
'<div class="center">';
406 print
'<input type="submit" class="button" name="submit" value="'.$langs->trans(
"AddGlobalDiscount").
'">';
407 if (!empty($backtopage)) {
409 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
421 if ($action ==
'remove') {
422 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
430 if ($isCustomer && !$isSupplier) {
431 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.
$id.
'&discount_type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'&token='.
newToken());
432 } elseif (!$isCustomer && $isSupplier) {
433 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.
$id.
'&discount_type=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'&token='.
newToken());
438 print
load_fiche_titre($langs->trans(
"DiscountStillRemaining"), $newcardbutton);
441 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewClientGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.
$id.
'&discount_type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$id).
'&token='.
newToken());
443 print
'<div class="fichecenter">';
444 print
'<div class="fichehalfleft fichehalfleft-lg">';
445 print
load_fiche_titre($langs->trans(
"CustomerDiscounts"), $newcardbutton,
'');
448 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
449 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
450 $sql .=
" rc.datec as dc, rc.description,";
451 $sql .=
" rc.fk_facture_source,";
452 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
453 $sql .=
" fa.ref as ref, fa.type as type";
454 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
455 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
456 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
457 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
458 $sql .=
" AND u.rowid = rc.fk_user";
459 $sql .=
" AND rc.discount_type = 0";
460 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
461 $sql .=
" ORDER BY rc.datec DESC";
463 $resql = $db->query($sql);
465 print
'<div class="div-table-responsive-no-min">';
466 print
'<table class="noborder centpercent">';
467 print
'<tr class="liste_titre">';
468 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
469 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
470 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
471 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
472 if (isModEnabled(
'multicompany')) {
473 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
475 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
476 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
477 if (isModEnabled(
'multicompany')) {
478 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
480 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
481 print
'<td width="50"> </td>';
484 $showconfirminfo = array();
487 $num = $db->num_rows($resql);
490 $obj = $db->fetch_object($resql);
492 $tmpuser->id = $obj->user_id;
493 $tmpuser->login = $obj->login;
494 $tmpuser->firstname = $obj->firstname;
495 $tmpuser->lastname = $obj->lastname;
496 $tmpuser->photo = $obj->photo;
497 $tmpuser->status = $obj->status;
499 print
'<tr class="oddeven">';
501 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
503 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
504 print
'<td class="tdoverflowmax100">';
505 $facturestatic->id = $obj->fk_facture_source;
506 $facturestatic->ref = $obj->ref;
507 $facturestatic->type = $obj->type;
508 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
'<br>'.$facturestatic->getNomURl(1);
510 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
511 print
'<td class="tdoverflowmax100">';
512 $facturestatic->id = $obj->fk_facture_source;
513 $facturestatic->ref = $obj->ref;
514 $facturestatic->type = $obj->type;
515 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
'<br>'.$facturestatic->getNomURl(1);
517 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
518 print
'<td class="tdoverflowmax100">';
519 $facturestatic->id = $obj->fk_facture_source;
520 $facturestatic->ref = $obj->ref;
521 $facturestatic->type = $obj->type;
522 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
'<br>'.$facturestatic->getNomURl(1);
525 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
530 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
532 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
534 if (isModEnabled(
'multicompany')) {
535 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
537 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
538 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
539 if (isModEnabled(
'multicompany')) {
540 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
542 print
'<td class="tdoverflowmax100">';
544 print $tmpuser->getNomUrl(-1);
547 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
548 print
'<td class="center nowraponall">';
549 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>';
550 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>';
553 print
'<td> </td>';
557 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
558 $showconfirminfo[
'rowid'] = $obj->rowid;
559 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
565 if (isModEnabled(
'multicompany')) {
568 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
574 if (count($showconfirminfo)) {
575 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
576 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
577 $formquestion = array(
578 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
579 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
580 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
582 $langs->load(
"dict");
583 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);
592 $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());
594 print
'<div class="fichehalfright fichehalfright-lg">';
595 print
load_fiche_titre($langs->trans(
"SupplierDiscounts"), $newcardbutton,
'');
601 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
602 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
603 $sql .=
" rc.datec as dc, rc.description,";
604 $sql .=
" rc.fk_invoice_supplier_source,";
605 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
606 $sql .=
" fa.ref, fa.type as type";
607 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
608 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
609 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
610 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
611 $sql .=
" AND u.rowid = rc.fk_user";
612 $sql .=
" AND rc.discount_type = 1";
613 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
614 $sql .=
" ORDER BY rc.datec DESC";
616 $resql = $db->query($sql);
618 print
'<div class="div-table-responsive-no-min">';
619 print
'<table class="noborder centpercent">';
620 print
'<tr class="liste_titre">';
621 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
622 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
623 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
624 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
625 if (isModEnabled(
'multicompany')) {
626 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
628 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
629 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
630 if (isModEnabled(
'multicompany')) {
631 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
633 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
634 print
'<td width="50"> </td>';
637 $showconfirminfo = array();
640 $num = $db->num_rows($resql);
643 $obj = $db->fetch_object($resql);
645 $tmpuser->id = $obj->user_id;
646 $tmpuser->login = $obj->login;
647 $tmpuser->firstname = $obj->firstname;
648 $tmpuser->lastname = $obj->lastname;
649 $tmpuser->photo = $obj->photo;
650 $tmpuser->status = $obj->status;
652 print
'<tr class="oddeven">';
653 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
654 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
655 print
'<td class="tdoverflowmax100">';
656 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
657 $facturefournstatic->ref = $obj->ref;
658 $facturefournstatic->type = $obj->type;
659 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
'<br>'.$facturefournstatic->getNomURl(1);
661 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
662 print
'<td class="tdoverflowmax100">';
663 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
664 $facturefournstatic->ref = $obj->ref;
665 $facturefournstatic->type = $obj->type;
666 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
'<br>'.$facturefournstatic->getNomURl(1);
668 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
669 print
'<td class="tdoverflowmax100">';
670 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
671 $facturefournstatic->ref = $obj->ref;
672 $facturefournstatic->type = $obj->type;
673 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
'<br>'.$facturefournstatic->getNomURl(1);
676 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
680 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
681 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
682 if (isModEnabled(
'multicompany')) {
683 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
685 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
686 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
687 if (isModEnabled(
'multicompany')) {
688 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
690 print
'<td class="tdoverflowmax100">';
691 print $tmpuser->getNomUrl(-1);
694 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
695 print
'<td class="center nowraponall">';
696 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>';
697 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>';
700 print
'<td> </td>';
704 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
705 $showconfirminfo[
'rowid'] = $obj->rowid;
706 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
712 if (isModEnabled(
'multicompany')) {
715 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
721 if (count($showconfirminfo)) {
722 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
723 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
724 $formquestion = array(
725 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
726 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
727 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
729 $langs->load(
"dict");
730 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);
742 print
'<div class="clearboth"></div><br><br>';
752 print
'<div class="fichecenter">';
753 print
'<div class="fichehalfleft fichehalfleft-lg">';
758 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
759 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
760 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
761 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
762 $sql .=
" f.rowid as invoiceid, f.ref,";
763 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
764 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
765 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
766 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
767 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
768 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
769 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
770 $sql .=
" AND rc.fk_facture_line = fc.rowid";
771 $sql .=
" AND fc.fk_facture = f.rowid";
772 $sql .=
" AND rc.fk_user = u.rowid";
773 $sql .=
" AND rc.discount_type = 0";
774 $sql .=
" ORDER BY dc DESC";
777 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
778 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
779 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
780 $sql2 .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
781 $sql2 .=
" f.rowid as invoiceid, f.ref,";
782 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
783 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
784 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
785 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
786 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
787 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
788 $sql2 .=
" AND rc.fk_facture = f.rowid";
789 $sql2 .=
" AND rc.fk_user = u.rowid";
790 $sql2 .=
" AND rc.discount_type = 0";
791 $sql2 .=
" ORDER BY dc DESC";
793 $resql = $db->query($sql);
796 $resql2 = $db->query($sql2);
799 print
'<div class="div-table-responsive-no-min">';
800 print
'<table class="noborder centpercent">';
801 print
'<tr class="liste_titre">';
802 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
803 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
804 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
805 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
806 if (isModEnabled(
'multicompany')) {
807 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
809 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
810 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
811 if (isModEnabled(
'multicompany')) {
812 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
814 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
815 print
'<td width="50"> </td>';
818 $tab_sqlobj = array();
819 $tab_sqlobjOrder = array();
820 $num = $db->num_rows($resql);
822 for ($i = 0; $i < $num; $i++) {
823 $sqlobj = $db->fetch_object($resql);
824 $tab_sqlobj[] = $sqlobj;
825 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
830 $num = $db->num_rows($resql2);
831 for ($i = 0; $i < $num; $i++) {
832 $sqlobj = $db->fetch_object($resql2);
833 $tab_sqlobj[] = $sqlobj;
834 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
837 $array1_sort_order = SORT_DESC;
838 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
840 $num = count($tab_sqlobj);
844 $obj = array_shift($tab_sqlobj);
846 $tmpuser->id = $obj->user_id;
847 $tmpuser->login = $obj->login;
848 $tmpuser->firstname = $obj->firstname;
849 $tmpuser->lastname = $obj->lastname;
850 $tmpuser->photo = $obj->photo;
851 $tmpuser->status = $obj->status;
853 print
'<tr class="oddeven">';
854 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
855 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
856 print
'<td class="tdoverflowmax100">';
857 $facturestatic->id = $obj->fk_facture_source;
858 $facturestatic->ref = $obj->invoice_source_ref;
859 $facturestatic->type = $obj->type;
860 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
'<br>'.$facturestatic->getNomURl(1);
862 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
863 print
'<td class="tdoverflowmax100">';
864 $facturestatic->id = $obj->fk_facture_source;
865 $facturestatic->ref = $obj->invoice_source_ref;
866 $facturestatic->type = $obj->type;
867 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
'<br>'.$facturestatic->getNomURl(1);
869 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
870 print
'<td class="tdoverflowmax100">';
871 $facturestatic->id = $obj->fk_facture_source;
872 $facturestatic->ref = $obj->invoice_source_ref;
873 $facturestatic->type = $obj->type;
874 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
'<br>'.$facturestatic->getNomURl(1);
877 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
881 print
'<td class="left nowrap">';
882 if ($obj->invoiceid) {
883 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
886 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
887 if (isModEnabled(
'multicompany')) {
888 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
890 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
891 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
892 if (isModEnabled(
'multicompany')) {
893 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
895 print
'<td class="tdoverflowmax100">';
896 print $tmpuser->getNomUrl(-1);
899 print
'<td> </td>';
905 if (isModEnabled(
'multicompany')) {
908 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
921 print
'<div class="fichehalfright fichehalfright-lg">';
926 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
927 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
928 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
929 $sql .=
" rc.fk_invoice_supplier_source,";
930 $sql .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
931 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
932 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
933 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
934 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
935 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
936 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
937 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
938 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
939 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
940 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
941 $sql .=
" AND rc.fk_user = u.rowid";
942 $sql .=
" AND rc.discount_type = 1";
943 $sql .=
" ORDER BY dc DESC";
946 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
947 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
948 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
949 $sql2 .=
" rc.fk_invoice_supplier_source,";
950 $sql2 .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
951 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
952 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
953 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
954 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
955 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
956 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
957 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
958 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
959 $sql2 .=
" AND rc.fk_user = u.rowid";
960 $sql2 .=
" AND rc.discount_type = 1";
961 $sql2 .=
" ORDER BY dc DESC";
963 $resql = $db->query($sql);
966 $resql2 = $db->query($sql2);
969 print
'<div class="div-table-responsive-no-min">';
970 print
'<table class="noborder centpercent">';
971 print
'<tr class="liste_titre">';
972 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
973 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
974 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
975 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
976 if (isModEnabled(
'multicompany')) {
977 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
979 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
980 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
981 if (isModEnabled(
'multicompany')) {
982 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
984 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
985 print
'<td width="50"> </td>';
988 $tab_sqlobj = array();
989 $tab_sqlobjOrder = array();
990 $num = $db->num_rows($resql);
992 for ($i = 0; $i < $num; $i++) {
993 $sqlobj = $db->fetch_object($resql);
994 $tab_sqlobj[] = $sqlobj;
995 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
1000 $num = $db->num_rows($resql2);
1001 for ($i = 0; $i < $num; $i++) {
1002 $sqlobj = $db->fetch_object($resql2);
1003 $tab_sqlobj[] = $sqlobj;
1004 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
1007 $array1_sort_order = SORT_DESC;
1008 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
1010 $num = count($tab_sqlobj);
1014 $obj = array_shift($tab_sqlobj);
1016 $tmpuser->id = $obj->user_id;
1017 $tmpuser->login = $obj->login;
1018 $tmpuser->firstname = $obj->firstname;
1019 $tmpuser->lastname = $obj->lastname;
1020 $tmpuser->photo = $obj->photo;
1021 $tmpuser->status = $obj->status;
1023 print
'<tr class="oddeven">';
1024 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
1025 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
1026 print
'<td class="tdoverflowmax100">';
1027 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1028 $facturefournstatic->ref = $obj->invoice_source_ref;
1029 $facturefournstatic->type = $obj->type;
1030 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
'<br>'.$facturefournstatic->getNomURl(1);
1032 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
1033 print
'<td class="tdoverflowmax100">';
1034 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1035 $facturefournstatic->ref = $obj->invoice_source_ref;
1036 $facturefournstatic->type = $obj->type;
1037 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
'<br>'.$facturefournstatic->getNomURl(1);
1039 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
1040 print
'<td class="tdoverflowmax100">';
1041 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1042 $facturefournstatic->ref = $obj->invoice_source_ref;
1043 $facturefournstatic->type = $obj->type;
1044 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
'<br>'.$facturefournstatic->getNomURl(1);
1047 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
1051 print
'<td class="left nowrap">';
1052 if ($obj->invoiceid) {
1053 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
1056 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
1057 if (isModEnabled(
'multicompany')) {
1058 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
1060 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
1061 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
1062 if (isModEnabled(
'multicompany')) {
1063 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
1065 print
'<td class="tdoverflowmax100">';
1066 print $tmpuser->getNomUrl(-1);
1069 print
'<td> </td>';
1076 if (isModEnabled(
'multicompany')) {
1079 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.