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';
40$langs->loadLangs(array(
'orders',
'bills',
'companies'));
44$action =
GETPOST(
'action',
'aZ09');
45$backtopage =
GETPOST(
'backtopage',
'alpha');
50if ($user->socid > 0) {
51 $socid = $user->socid;
55if ($user->socid > 0) {
58$result =
restrictedArea($user,
'societe', $id,
'&societe',
'',
'fk_soc',
'rowid', 0);
60$permissiontocreate = ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer'));
68if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
69 header(
"Location: ".$backtopage);
73if ($action ==
'confirm_split' &&
GETPOST(
"confirm",
"alpha") ==
'yes' && $permissiontocreate) {
74 $amount_ttc_1 =
GETPOST(
'amount_ttc_1',
'alpha');
76 $amount_ttc_2 =
GETPOST(
'amount_ttc_2',
'alpha');
82 $res = $discount->fetch($remid);
85 setEventMessages($langs->trans(
"ErrorFailedToLoadDiscount"),
null,
'errors');
87 if (!$error &&
price2num((
float) $amount_ttc_1 + (
float) $amount_ttc_2) != $discount->amount_ttc) {
89 setEventMessages($langs->trans(
"TotalOfTwoDiscountMustEqualsOriginal"),
null,
'errors');
91 if (!$error && $discount->fk_facture_line) {
93 setEventMessages($langs->trans(
"ErrorCantSplitAUsedDiscount"),
null,
'errors');
98 $newdiscount1->fk_facture_source = $discount->fk_facture_source;
99 $newdiscount2->fk_facture_source = $discount->fk_facture_source;
100 $newdiscount1->fk_facture = $discount->fk_facture;
101 $newdiscount2->fk_facture = $discount->fk_facture;
102 $newdiscount1->fk_facture_line = $discount->fk_facture_line;
103 $newdiscount2->fk_facture_line = $discount->fk_facture_line;
104 $newdiscount1->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
105 $newdiscount2->fk_invoice_supplier_source = $discount->fk_invoice_supplier_source;
106 $newdiscount1->fk_invoice_supplier = $discount->fk_invoice_supplier;
107 $newdiscount2->fk_invoice_supplier = $discount->fk_invoice_supplier;
108 $newdiscount1->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
109 $newdiscount2->fk_invoice_supplier_line = $discount->fk_invoice_supplier_line;
110 if ($discount->description ==
'(CREDIT_NOTE)' || $discount->description ==
'(DEPOSIT)') {
111 $newdiscount1->description = $discount->description;
112 $newdiscount2->description = $discount->description;
114 $newdiscount1->description = $discount->description.
' (1)';
115 $newdiscount2->description = $discount->description.
' (2)';
118 $newdiscount1->fk_user = $discount->fk_user;
119 $newdiscount2->fk_user = $discount->fk_user;
120 $newdiscount1->fk_soc = $discount->fk_soc;
121 $newdiscount1->socid = $discount->socid;
122 $newdiscount2->fk_soc = $discount->fk_soc;
123 $newdiscount2->socid = $discount->socid;
124 $newdiscount1->discount_type = $discount->discount_type;
125 $newdiscount2->discount_type = $discount->discount_type;
126 $newdiscount1->datec = $discount->datec;
127 $newdiscount2->datec = $discount->datec;
128 $newdiscount1->tva_tx = $discount->tva_tx;
129 $newdiscount2->tva_tx = $discount->tva_tx;
130 $newdiscount1->vat_src_code = $discount->vat_src_code;
131 $newdiscount2->vat_src_code = $discount->vat_src_code;
132 $newdiscount1->amount_ttc = $amount_ttc_1;
133 $newdiscount2->amount_ttc =
price2num($discount->amount_ttc - $newdiscount1->amount_ttc);
134 $newdiscount1->amount_ht =
price2num($newdiscount1->amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
135 $newdiscount2->amount_ht =
price2num($newdiscount2->amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
136 $newdiscount1->amount_tva =
price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht);
137 $newdiscount2->amount_tva =
price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht);
139 $newdiscount1->multicurrency_amount_ttc = (float) $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc);
140 $newdiscount2->multicurrency_amount_ttc =
price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc);
141 $newdiscount1->multicurrency_amount_ht =
price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100),
'MT');
142 $newdiscount2->multicurrency_amount_ht =
price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100),
'MT');
143 $newdiscount1->multicurrency_amount_tva =
price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht);
144 $newdiscount2->multicurrency_amount_tva =
price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht);
148 $discount->fk_facture_source = 0;
150 $discount->fk_invoice_supplier_source = 0;
151 $res = $discount->delete($user);
152 $newid1 = $newdiscount1->create($user);
153 $newid2 = $newdiscount2->create($user);
154 if ($res > 0 && $newid1 > 0 && $newid2 > 0) {
156 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id.($backtopage ?
'&backtopage='.urlencode($backtopage) :
''));
164if ($action ==
'setremise' && $permissiontocreate) {
166 $desc =
GETPOST(
'desc',
'alpha');
167 $tva_tx =
GETPOST(
'tva_tx',
'alpha');
168 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
169 $price_base_type =
GETPOST(
'price_base_type',
'alpha');
174 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ReasonDiscount")),
null,
'errors');
181 $discountid = $soc->set_remise_except($amount, $user, $desc, $tva_tx, $discount_type, $price_base_type);
183 if ($discountid > 0) {
184 if (!empty($backtopage)) {
185 header(
"Location: ".$backtopage.
'&discountid='.((
int) $discountid));
188 header(
"Location: remx.php?id=".((
int) $id));
197 setEventMessages($langs->trans(
"ErrorFieldFormat", $langs->transnoentitiesnoconv(
"AmountHT")),
null,
'errors');
201if (
GETPOST(
'action',
'aZ09') ==
'confirm_remove' &&
GETPOST(
"confirm") ==
'yes' && $permissiontocreate) {
205 $result = $discount->fetch(
GETPOSTINT(
"remid"));
206 $result = $discount->delete($user);
209 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?id='.$id);
222$form =
new Form($db);
223$facturestatic =
new Facture($db);
225$tmpuser =
new User($db);
227llxHeader(
'', $langs->trans(
"GlobalDiscount"));
235 $isSupplier =
$object->fournisseur == 1;
241 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'">';
242 print
'<input type="hidden" name="token" value="'.newToken().
'">';
243 print
'<input type="hidden" name="action" value="setremise">';
244 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
246 print
dol_get_fiche_head($head,
'absolutediscount', $langs->trans(
"ThirdParty"), -1,
'company');
248 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
250 dol_banner_tab(
$object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
252 print
'<div class="fichecenter">';
254 print
'<div class="underbanner clearboth"></div>';
256 if (!$isCustomer && !$isSupplier) {
257 print
'<p class="opacitymedium">'.$langs->trans(
'ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').
'</p>';
269 print
'<div class="div-table-responsive-no-min">';
270 print
'<table class="border centpercent tableforfield borderbottom">';
273 $remise_all = $remise_user = 0;
274 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
275 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
276 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
277 $sql .=
" AND rc.entity = ".((int) $conf->entity);
278 $sql .=
" AND discount_type = 0";
279 $sql .=
" AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
280 $sql .=
" GROUP BY rc.fk_user";
281 $resql = $db->query($sql);
283 $obj = $db->fetch_object($resql);
284 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
285 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
286 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
292 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomerAbsoluteDiscountAllUsers").
'</td>';
293 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT");
294 if (empty($user->fk_soc)) {
295 print $form->textwithpicto(
'', $langs->trans(
"CustomerAbsoluteDiscountMy").
': '.
price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT"));
302 $remise_all = $remise_user = 0;
303 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
304 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
305 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
306 $sql .=
" AND rc.entity = ".((int) $conf->entity);
307 $sql .=
" AND discount_type = 1";
308 $sql .=
" AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
309 $sql .=
" GROUP BY rc.fk_user";
310 $resql = $db->query($sql);
312 $obj = $db->fetch_object($resql);
313 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
314 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
315 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
321 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SupplierAbsoluteDiscountAllUsers").
'</td>';
322 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT");
323 if (empty($user->fk_soc)) {
324 print $form->textwithpicto(
'', $langs->trans(
"SupplierAbsoluteDiscountMy").
' : '.
price($remise_user, 1, $langs, 1, -1, -1, $conf->currency).
' '.$langs->trans(
"HT"));
337 if ($action ==
'create_remise') {
338 if ($user->hasRight(
'societe',
'creer')) {
341 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
342 if ($isCustomer && $isSupplier) {
343 $discounttypelabel = $discount_type == 1 ?
'NewSupplierGlobalDiscount' :
'NewClientGlobalDiscount';
345 $discounttypelabel =
'NewGlobalDiscount';
350 if ($isSupplier && $discount_type == 1) {
351 print
'<input type="hidden" name="discount_type" value="1" />';
353 print
'<input type="hidden" name="discount_type" value="0" />';
359 print
'<div class="div-table-responsive-no-min">';
360 print
'<table class="border centpercent">';
369 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Amount").
'</td>';
370 print
'<td><input type="text" size="5" name="amount" value="'.price2num(
GETPOST(
"amount")).
'" autofocus>';
371 print
'<span class="hideonsmartphone"> '.$langs->trans(
"Currency".$conf->currency).
'</span></td></tr>';
374 print
'<tr><td class="titlefield">'.$langs->trans(
"PriceBase").
'</td>';
376 print $form->selectPriceBaseType(
GETPOST(
"price_base_type"),
"price_base_type");
380 print
'<tr><td>'.$langs->trans(
"VAT").
'</td>';
382 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,
'', 0, 1);
384 print
'<tr><td class="fieldrequired" >'.$langs->trans(
"NoteReason").
'</td>';
385 print
'<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST(
'desc',
'alphanohtml').
'"></td></tr>';
393 if ($user->hasRight(
'societe',
'creer')) {
394 print
'<div class="center">';
395 print
'<input type="submit" class="button" name="submit" value="'.$langs->trans(
"AddGlobalDiscount").
'">';
396 if (!empty($backtopage)) {
397 print
' ';
398 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
409 if ($action ==
'remove') {
410 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
418 if ($isCustomer && !$isSupplier) {
419 $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());
420 } elseif (!$isCustomer && $isSupplier) {
421 $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());
426 print
load_fiche_titre($langs->trans(
"DiscountStillRemaining"), $newcardbutton);
429 $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());
431 print
'<div class="fichecenter">';
432 print
'<div class="fichehalfleft fichehalfleft-lg">';
433 print
load_fiche_titre($langs->trans(
"CustomerDiscounts"), $newcardbutton,
'');
436 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
437 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
438 $sql .=
" rc.datec as dc, rc.description,";
439 $sql .=
" rc.fk_facture_source,";
440 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
441 $sql .=
" fa.ref as ref, fa.type as type";
442 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
443 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
444 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
445 $sql .=
" AND rc.entity = ".((int) $conf->entity);
446 $sql .=
" AND u.rowid = rc.fk_user";
447 $sql .=
" AND rc.discount_type = 0";
448 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
449 $sql .=
" ORDER BY rc.datec DESC";
451 $resql = $db->query($sql);
453 print
'<div class="div-table-responsive-no-min">';
454 print
'<table class="noborder centpercent">';
455 print
'<tr class="liste_titre">';
456 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
457 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
458 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
459 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
460 if (isModEnabled(
'multicompany')) {
461 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
463 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
464 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
465 if (isModEnabled(
'multicompany')) {
466 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
468 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
469 print
'<td width="50"> </td>';
472 $showconfirminfo = array();
475 $num = $db->num_rows($resql);
478 $obj = $db->fetch_object($resql);
480 $tmpuser->id = $obj->user_id;
481 $tmpuser->login = $obj->login;
482 $tmpuser->firstname = $obj->firstname;
483 $tmpuser->lastname = $obj->lastname;
484 $tmpuser->photo = $obj->photo;
485 $tmpuser->status = $obj->status;
487 print
'<tr class="oddeven">';
489 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
491 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
492 print
'<td class="tdoverflowmax100">';
493 $facturestatic->id = $obj->fk_facture_source;
494 $facturestatic->ref = $obj->ref;
495 $facturestatic->type = $obj->type;
496 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
498 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
499 print
'<td class="tdoverflowmax100">';
500 $facturestatic->id = $obj->fk_facture_source;
501 $facturestatic->ref = $obj->ref;
502 $facturestatic->type = $obj->type;
503 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
505 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
506 print
'<td class="tdoverflowmax100">';
507 $facturestatic->id = $obj->fk_facture_source;
508 $facturestatic->ref = $obj->ref;
509 $facturestatic->type = $obj->type;
510 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
' '.$facturestatic->getNomURl(1);
513 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
518 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
520 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
522 if (isModEnabled(
'multicompany')) {
523 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
525 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
526 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
527 if (isModEnabled(
'multicompany')) {
528 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
530 print
'<td class="tdoverflowmax100">';
532 print $tmpuser->getNomUrl(-1);
535 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
536 print
'<td class="center nowrap">';
537 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>';
538 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>';
541 print
'<td> </td>';
545 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
546 $showconfirminfo[
'rowid'] = $obj->rowid;
547 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
553 if (isModEnabled(
'multicompany')) {
556 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
562 if (count($showconfirminfo)) {
563 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
564 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
565 $formquestion = array(
566 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
567 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
568 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
570 $langs->load(
"dict");
571 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);
580 $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());
582 print
'<div class="fichehalfright fichehalfright-lg">';
583 print
load_fiche_titre($langs->trans(
"SupplierDiscounts"), $newcardbutton,
'');
589 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
590 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
591 $sql .=
" rc.datec as dc, rc.description,";
592 $sql .=
" rc.fk_invoice_supplier_source,";
593 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
594 $sql .=
" fa.ref, fa.type as type";
595 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
596 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
597 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
598 $sql .=
" AND rc.entity = ".((int) $conf->entity);
599 $sql .=
" AND u.rowid = rc.fk_user";
600 $sql .=
" AND rc.discount_type = 1";
601 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
602 $sql .=
" ORDER BY rc.datec DESC";
604 $resql = $db->query($sql);
606 print
'<div class="div-table-responsive-no-min">';
607 print
'<table class="noborder centpercent">';
608 print
'<tr class="liste_titre">';
609 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
610 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
611 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
612 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
613 if (isModEnabled(
'multicompany')) {
614 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
616 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
617 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
618 if (isModEnabled(
'multicompany')) {
619 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
621 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
622 print
'<td width="50"> </td>';
625 $showconfirminfo = array();
628 $num = $db->num_rows($resql);
631 $obj = $db->fetch_object($resql);
633 $tmpuser->id = $obj->user_id;
634 $tmpuser->login = $obj->login;
635 $tmpuser->firstname = $obj->firstname;
636 $tmpuser->lastname = $obj->lastname;
637 $tmpuser->photo = $obj->photo;
638 $tmpuser->status = $obj->status;
640 print
'<tr class="oddeven">';
641 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
642 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
643 print
'<td class="tdoverflowmax100">';
644 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
645 $facturefournstatic->ref = $obj->ref;
646 $facturefournstatic->type = $obj->type;
647 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
649 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
650 print
'<td class="tdoverflowmax100">';
651 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
652 $facturefournstatic->ref = $obj->ref;
653 $facturefournstatic->type = $obj->type;
654 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
656 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
657 print
'<td class="tdoverflowmax100">';
658 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
659 $facturefournstatic->ref = $obj->ref;
660 $facturefournstatic->type = $obj->type;
661 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
664 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
668 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
669 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
670 if (isModEnabled(
'multicompany')) {
671 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
673 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
674 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
675 if (isModEnabled(
'multicompany')) {
676 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
678 print
'<td class="tdoverflowmax100">';
679 print $tmpuser->getNomUrl(-1);
682 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
683 print
'<td class="center nowrap">';
684 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>';
685 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>';
688 print
'<td> </td>';
692 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
693 $showconfirminfo[
'rowid'] = $obj->rowid;
694 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
700 if (isModEnabled(
'multicompany')) {
703 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
709 if (count($showconfirminfo)) {
710 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
711 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
712 $formquestion = array(
713 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
714 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
715 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
717 $langs->load(
"dict");
718 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);
730 print
'<div class="clearboth"></div><br><br>';
740 print
'<div class="fichecenter">';
741 print
'<div class="fichehalfleft fichehalfleft-lg">';
746 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
747 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
748 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
749 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
750 $sql .=
" f.rowid as invoiceid, f.ref,";
751 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
752 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
753 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
754 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
755 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
756 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
757 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
758 $sql .=
" AND rc.fk_facture_line = fc.rowid";
759 $sql .=
" AND fc.fk_facture = f.rowid";
760 $sql .=
" AND rc.fk_user = u.rowid";
761 $sql .=
" AND rc.discount_type = 0";
762 $sql .=
" ORDER BY dc DESC";
765 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
766 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
767 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
768 $sql2 .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
769 $sql2 .=
" f.rowid as invoiceid, f.ref,";
770 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
771 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
772 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
773 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
774 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
775 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
776 $sql2 .=
" AND rc.fk_facture = f.rowid";
777 $sql2 .=
" AND rc.fk_user = u.rowid";
778 $sql2 .=
" AND rc.discount_type = 0";
779 $sql2 .=
" ORDER BY dc DESC";
781 $resql = $db->query($sql);
784 $resql2 = $db->query($sql2);
787 print
'<div class="div-table-responsive-no-min">';
788 print
'<table class="noborder centpercent">';
789 print
'<tr class="liste_titre">';
790 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
791 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
792 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
793 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
794 if (isModEnabled(
'multicompany')) {
795 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
797 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
798 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
799 if (isModEnabled(
'multicompany')) {
800 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
802 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
803 print
'<td width="50"> </td>';
806 $tab_sqlobj = array();
807 $tab_sqlobjOrder = array();
808 $num = $db->num_rows($resql);
810 for ($i = 0; $i < $num; $i++) {
811 $sqlobj = $db->fetch_object($resql);
812 $tab_sqlobj[] = $sqlobj;
813 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
818 $num = $db->num_rows($resql2);
819 for ($i = 0; $i < $num; $i++) {
820 $sqlobj = $db->fetch_object($resql2);
821 $tab_sqlobj[] = $sqlobj;
822 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
825 $array1_sort_order = SORT_DESC;
826 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
828 $num = count($tab_sqlobj);
832 $obj = array_shift($tab_sqlobj);
834 $tmpuser->id = $obj->user_id;
835 $tmpuser->login = $obj->login;
836 $tmpuser->firstname = $obj->firstname;
837 $tmpuser->lastname = $obj->lastname;
838 $tmpuser->photo = $obj->photo;
839 $tmpuser->status = $obj->status;
841 print
'<tr class="oddeven">';
842 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
843 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
844 print
'<td class="tdoverflowmax100">';
845 $facturestatic->id = $obj->fk_facture_source;
846 $facturestatic->ref = $obj->invoice_source_ref;
847 $facturestatic->type = $obj->type;
848 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
850 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
851 print
'<td class="tdoverflowmax100">';
852 $facturestatic->id = $obj->fk_facture_source;
853 $facturestatic->ref = $obj->invoice_source_ref;
854 $facturestatic->type = $obj->type;
855 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
857 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
858 print
'<td class="tdoverflowmax100">';
859 $facturestatic->id = $obj->fk_facture_source;
860 $facturestatic->ref = $obj->invoice_source_ref;
861 $facturestatic->type = $obj->type;
862 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturestatic->getNomURl(1);
865 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
869 print
'<td class="left nowrap">';
870 if ($obj->invoiceid) {
871 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
874 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
875 if (isModEnabled(
'multicompany')) {
876 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
878 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
879 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
880 if (isModEnabled(
'multicompany')) {
881 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
883 print
'<td class="tdoverflowmax100">';
884 print $tmpuser->getNomUrl(-1);
887 print
'<td> </td>';
893 if (isModEnabled(
'multicompany')) {
896 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
909 print
'<div class="fichehalfright fichehalfright-lg">';
914 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
915 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
916 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
917 $sql .=
" rc.fk_invoice_supplier_source,";
918 $sql .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
919 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
920 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
921 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
922 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
923 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
924 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
925 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
926 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
927 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
928 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
929 $sql .=
" AND rc.fk_user = u.rowid";
930 $sql .=
" AND rc.discount_type = 1";
931 $sql .=
" ORDER BY dc DESC";
934 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
935 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
936 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
937 $sql2 .=
" rc.fk_invoice_supplier_source,";
938 $sql2 .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
939 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
940 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
941 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
942 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
943 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
944 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
945 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
946 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
947 $sql2 .=
" AND rc.fk_user = u.rowid";
948 $sql2 .=
" AND rc.discount_type = 1";
949 $sql2 .=
" ORDER BY dc DESC";
951 $resql = $db->query($sql);
954 $resql2 = $db->query($sql2);
957 print
'<div class="div-table-responsive-no-min">';
958 print
'<table class="noborder centpercent">';
959 print
'<tr class="liste_titre">';
960 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
961 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
962 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
963 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
964 if (isModEnabled(
'multicompany')) {
965 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
967 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
968 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
969 if (isModEnabled(
'multicompany')) {
970 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
972 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
973 print
'<td width="50"> </td>';
976 $tab_sqlobj = array();
977 $tab_sqlobjOrder = array();
978 $num = $db->num_rows($resql);
980 for ($i = 0; $i < $num; $i++) {
981 $sqlobj = $db->fetch_object($resql);
982 $tab_sqlobj[] = $sqlobj;
983 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
988 $num = $db->num_rows($resql2);
989 for ($i = 0; $i < $num; $i++) {
990 $sqlobj = $db->fetch_object($resql2);
991 $tab_sqlobj[] = $sqlobj;
992 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
995 $array1_sort_order = SORT_DESC;
996 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
998 $num = count($tab_sqlobj);
1002 $obj = array_shift($tab_sqlobj);
1004 $tmpuser->id = $obj->user_id;
1005 $tmpuser->login = $obj->login;
1006 $tmpuser->firstname = $obj->firstname;
1007 $tmpuser->lastname = $obj->lastname;
1008 $tmpuser->photo = $obj->photo;
1009 $tmpuser->status = $obj->status;
1011 print
'<tr class="oddeven">';
1012 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
1013 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
1014 print
'<td class="tdoverflowmax100">';
1015 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1016 $facturefournstatic->ref = $obj->invoice_source_ref;
1017 $facturefournstatic->type = $obj->type;
1018 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1020 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
1021 print
'<td class="tdoverflowmax100">';
1022 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1023 $facturefournstatic->ref = $obj->invoice_source_ref;
1024 $facturefournstatic->type = $obj->type;
1025 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1027 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
1028 print
'<td class="tdoverflowmax100">';
1029 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1030 $facturefournstatic->ref = $obj->invoice_source_ref;
1031 $facturefournstatic->type = $obj->type;
1032 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1035 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
1039 print
'<td class="left nowrap">';
1040 if ($obj->invoiceid) {
1041 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
1044 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
1045 if (isModEnabled(
'multicompany')) {
1046 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
1048 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
1049 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
1050 if (isModEnabled(
'multicompany')) {
1051 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
1053 print
'<td class="tdoverflowmax100">';
1054 print $tmpuser->getNomUrl(-1);
1057 print
'<td> </td>';
1064 if (isModEnabled(
'multicompany')) {
1067 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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...
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.