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) != $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($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 $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);
301 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"CustomerAbsoluteDiscountAllUsers").
'</td>';
302 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT");
303 if (empty($user->fk_soc)) {
304 print $form->textwithpicto(
'', $langs->trans(
"CustomerAbsoluteDiscountMy").
': '.
price($remise_user, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT"));
311 $remise_all = $remise_user = 0;
312 $sql =
"SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
313 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
314 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
315 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
316 $sql .=
" AND discount_type = 1";
317 $sql .=
" AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
318 $sql .=
" GROUP BY rc.fk_user";
319 $resql = $db->query($sql);
321 $obj = $db->fetch_object($resql);
322 $remise_all += (!empty($obj->amount) ? $obj->amount : 0);
323 if (!empty($obj->fk_user) && $obj->fk_user == $user->id) {
324 $remise_user += (!empty($obj->amount) ? $obj->amount : 0);
330 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"SupplierAbsoluteDiscountAllUsers").
'</td>';
331 print
'<td class="amount">'.price($remise_all, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT");
332 if (empty($user->fk_soc)) {
333 print $form->textwithpicto(
'', $langs->trans(
"SupplierAbsoluteDiscountMy").
' : '.
price($remise_user, 1, $langs, 1, -1, -1,
$conf->currency).
' '.$langs->trans(
"HT"));
346 if ($action ==
'create_remise') {
347 if ($user->hasRight(
'societe',
'creer')) {
350 $discount_type = GETPOSTISSET(
'discount_type') ?
GETPOST(
'discount_type',
'alpha') : 0;
351 if ($isCustomer && $isSupplier) {
352 $discounttypelabel = $discount_type == 1 ?
'NewSupplierGlobalDiscount' :
'NewClientGlobalDiscount';
354 $discounttypelabel =
'NewGlobalDiscount';
359 if ($isSupplier && $discount_type == 1) {
360 print
'<input type="hidden" name="discount_type" value="1" />';
362 print
'<input type="hidden" name="discount_type" value="0" />';
368 print
'<div class="div-table-responsive-no-min">';
369 print
'<table class="border centpercent">';
378 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Amount").
'</td>';
379 print
'<td><input type="text" size="5" name="amount" value="'.price2num(
GETPOST(
"amount")).
'" autofocus>';
380 print
'<span class="hideonsmartphone"> '.$langs->trans(
"Currency".
$conf->currency).
'</span></td></tr>';
383 print
'<tr><td class="titlefield">'.$langs->trans(
"PriceBase").
'</td>';
385 print $form->selectPriceBaseType(
GETPOST(
"price_base_type"),
"price_base_type");
389 print
'<tr><td>'.$langs->trans(
"VAT").
'</td>';
391 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);
393 print
'<tr><td class="fieldrequired" >'.$langs->trans(
"NoteReason").
'</td>';
394 print
'<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST(
'desc',
'alphanohtml').
'"></td></tr>';
402 if ($user->hasRight(
'societe',
'creer')) {
403 print
'<div class="center">';
404 print
'<input type="submit" class="button" name="submit" value="'.$langs->trans(
"AddGlobalDiscount").
'">';
405 if (!empty($backtopage)) {
407 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
419 if ($action ==
'remove') {
420 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
428 if ($isCustomer && !$isSupplier) {
429 $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());
430 } elseif (!$isCustomer && $isSupplier) {
431 $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());
436 print
load_fiche_titre($langs->trans(
"DiscountStillRemaining"), $newcardbutton);
439 $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());
441 print
'<div class="fichecenter">';
442 print
'<div class="fichehalfleft fichehalfleft-lg">';
443 print
load_fiche_titre($langs->trans(
"CustomerDiscounts"), $newcardbutton,
'');
446 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
447 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
448 $sql .=
" rc.datec as dc, rc.description,";
449 $sql .=
" rc.fk_facture_source,";
450 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
451 $sql .=
" fa.ref as ref, fa.type as type";
452 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
453 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
454 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
455 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
456 $sql .=
" AND u.rowid = rc.fk_user";
457 $sql .=
" AND rc.discount_type = 0";
458 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
459 $sql .=
" ORDER BY rc.datec DESC";
461 $resql = $db->query($sql);
463 print
'<div class="div-table-responsive-no-min">';
464 print
'<table class="noborder centpercent">';
465 print
'<tr class="liste_titre">';
466 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
467 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
468 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
469 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
470 if (isModEnabled(
'multicompany')) {
471 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
473 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
474 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
475 if (isModEnabled(
'multicompany')) {
476 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
478 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
479 print
'<td width="50"> </td>';
482 $showconfirminfo = array();
485 $num = $db->num_rows($resql);
488 $obj = $db->fetch_object($resql);
490 $tmpuser->id = $obj->user_id;
491 $tmpuser->login = $obj->login;
492 $tmpuser->firstname = $obj->firstname;
493 $tmpuser->lastname = $obj->lastname;
494 $tmpuser->photo = $obj->photo;
495 $tmpuser->status = $obj->status;
497 print
'<tr class="oddeven">';
499 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
501 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
502 print
'<td class="tdoverflowmax100">';
503 $facturestatic->id = $obj->fk_facture_source;
504 $facturestatic->ref = $obj->ref;
505 $facturestatic->type = $obj->type;
506 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
508 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
509 print
'<td class="tdoverflowmax100">';
510 $facturestatic->id = $obj->fk_facture_source;
511 $facturestatic->ref = $obj->ref;
512 $facturestatic->type = $obj->type;
513 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
515 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
516 print
'<td class="tdoverflowmax100">';
517 $facturestatic->id = $obj->fk_facture_source;
518 $facturestatic->ref = $obj->ref;
519 $facturestatic->type = $obj->type;
520 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
' '.$facturestatic->getNomURl(1);
523 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
528 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
530 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
532 if (isModEnabled(
'multicompany')) {
533 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
535 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
536 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
537 if (isModEnabled(
'multicompany')) {
538 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
540 print
'<td class="tdoverflowmax100">';
542 print $tmpuser->getNomUrl(-1);
545 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
546 print
'<td class="center nowraponall">';
547 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>';
548 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>';
551 print
'<td> </td>';
555 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
556 $showconfirminfo[
'rowid'] = $obj->rowid;
557 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
563 if (isModEnabled(
'multicompany')) {
566 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
572 if (count($showconfirminfo)) {
573 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
574 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
575 $formquestion = array(
576 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
577 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
578 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
580 $langs->load(
"dict");
581 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);
590 $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());
592 print
'<div class="fichehalfright fichehalfright-lg">';
593 print
load_fiche_titre($langs->trans(
"SupplierDiscounts"), $newcardbutton,
'');
599 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
600 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
601 $sql .=
" rc.datec as dc, rc.description,";
602 $sql .=
" rc.fk_invoice_supplier_source,";
603 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
604 $sql .=
" fa.ref, fa.type as type";
605 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
606 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
607 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
608 $sql .=
" AND rc.entity = ".((int)
$conf->entity);
609 $sql .=
" AND u.rowid = rc.fk_user";
610 $sql .=
" AND rc.discount_type = 1";
611 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
612 $sql .=
" ORDER BY rc.datec DESC";
614 $resql = $db->query($sql);
616 print
'<div class="div-table-responsive-no-min">';
617 print
'<table class="noborder centpercent">';
618 print
'<tr class="liste_titre">';
619 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
620 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
621 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
622 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
623 if (isModEnabled(
'multicompany')) {
624 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
626 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
627 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
628 if (isModEnabled(
'multicompany')) {
629 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
631 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
632 print
'<td width="50"> </td>';
635 $showconfirminfo = array();
638 $num = $db->num_rows($resql);
641 $obj = $db->fetch_object($resql);
643 $tmpuser->id = $obj->user_id;
644 $tmpuser->login = $obj->login;
645 $tmpuser->firstname = $obj->firstname;
646 $tmpuser->lastname = $obj->lastname;
647 $tmpuser->photo = $obj->photo;
648 $tmpuser->status = $obj->status;
650 print
'<tr class="oddeven">';
651 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
652 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
653 print
'<td class="tdoverflowmax100">';
654 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
655 $facturefournstatic->ref = $obj->ref;
656 $facturefournstatic->type = $obj->type;
657 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
659 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
660 print
'<td class="tdoverflowmax100">';
661 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
662 $facturefournstatic->ref = $obj->ref;
663 $facturefournstatic->type = $obj->type;
664 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
666 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
667 print
'<td class="tdoverflowmax100">';
668 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
669 $facturefournstatic->ref = $obj->ref;
670 $facturefournstatic->type = $obj->type;
671 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
674 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
678 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
679 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
680 if (isModEnabled(
'multicompany')) {
681 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
683 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
684 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
685 if (isModEnabled(
'multicompany')) {
686 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
688 print
'<td class="tdoverflowmax100">';
689 print $tmpuser->getNomUrl(-1);
692 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
693 print
'<td class="center nowraponall">';
694 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>';
695 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>';
698 print
'<td> </td>';
702 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
703 $showconfirminfo[
'rowid'] = $obj->rowid;
704 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
710 if (isModEnabled(
'multicompany')) {
713 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
719 if (count($showconfirminfo)) {
720 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
721 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
722 $formquestion = array(
723 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
724 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
725 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
727 $langs->load(
"dict");
728 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);
740 print
'<div class="clearboth"></div><br><br>';
750 print
'<div class="fichecenter">';
751 print
'<div class="fichehalfleft fichehalfleft-lg">';
756 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
757 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
758 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
759 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
760 $sql .=
" f.rowid as invoiceid, f.ref,";
761 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
762 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
763 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
764 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
765 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
766 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
767 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
768 $sql .=
" AND rc.fk_facture_line = fc.rowid";
769 $sql .=
" AND fc.fk_facture = f.rowid";
770 $sql .=
" AND rc.fk_user = u.rowid";
771 $sql .=
" AND rc.discount_type = 0";
772 $sql .=
" ORDER BY dc DESC";
775 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
776 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
777 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
778 $sql2 .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
779 $sql2 .=
" f.rowid as invoiceid, f.ref,";
780 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
781 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
782 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
783 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
784 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
785 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
786 $sql2 .=
" AND rc.fk_facture = f.rowid";
787 $sql2 .=
" AND rc.fk_user = u.rowid";
788 $sql2 .=
" AND rc.discount_type = 0";
789 $sql2 .=
" ORDER BY dc DESC";
791 $resql = $db->query($sql);
794 $resql2 = $db->query($sql2);
797 print
'<div class="div-table-responsive-no-min">';
798 print
'<table class="noborder centpercent">';
799 print
'<tr class="liste_titre">';
800 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
801 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
802 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
803 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
804 if (isModEnabled(
'multicompany')) {
805 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
807 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
808 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
809 if (isModEnabled(
'multicompany')) {
810 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
812 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
813 print
'<td width="50"> </td>';
816 $tab_sqlobj = array();
817 $tab_sqlobjOrder = array();
818 $num = $db->num_rows($resql);
820 for ($i = 0; $i < $num; $i++) {
821 $sqlobj = $db->fetch_object($resql);
822 $tab_sqlobj[] = $sqlobj;
823 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
828 $num = $db->num_rows($resql2);
829 for ($i = 0; $i < $num; $i++) {
830 $sqlobj = $db->fetch_object($resql2);
831 $tab_sqlobj[] = $sqlobj;
832 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
835 $array1_sort_order = SORT_DESC;
836 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
838 $num = count($tab_sqlobj);
842 $obj = array_shift($tab_sqlobj);
844 $tmpuser->id = $obj->user_id;
845 $tmpuser->login = $obj->login;
846 $tmpuser->firstname = $obj->firstname;
847 $tmpuser->lastname = $obj->lastname;
848 $tmpuser->photo = $obj->photo;
849 $tmpuser->status = $obj->status;
851 print
'<tr class="oddeven">';
852 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
853 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
854 print
'<td class="tdoverflowmax100">';
855 $facturestatic->id = $obj->fk_facture_source;
856 $facturestatic->ref = $obj->invoice_source_ref;
857 $facturestatic->type = $obj->type;
858 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
860 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
861 print
'<td class="tdoverflowmax100">';
862 $facturestatic->id = $obj->fk_facture_source;
863 $facturestatic->ref = $obj->invoice_source_ref;
864 $facturestatic->type = $obj->type;
865 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
867 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
868 print
'<td class="tdoverflowmax100">';
869 $facturestatic->id = $obj->fk_facture_source;
870 $facturestatic->ref = $obj->invoice_source_ref;
871 $facturestatic->type = $obj->type;
872 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturestatic->getNomURl(1);
875 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
879 print
'<td class="left nowrap">';
880 if ($obj->invoiceid) {
881 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
884 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
885 if (isModEnabled(
'multicompany')) {
886 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
888 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
889 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
890 if (isModEnabled(
'multicompany')) {
891 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
893 print
'<td class="tdoverflowmax100">';
894 print $tmpuser->getNomUrl(-1);
897 print
'<td> </td>';
903 if (isModEnabled(
'multicompany')) {
906 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
919 print
'<div class="fichehalfright fichehalfright-lg">';
924 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
925 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
926 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
927 $sql .=
" rc.fk_invoice_supplier_source,";
928 $sql .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
929 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
930 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
931 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
932 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
933 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
934 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
935 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
936 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
937 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
938 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
939 $sql .=
" AND rc.fk_user = u.rowid";
940 $sql .=
" AND rc.discount_type = 1";
941 $sql .=
" ORDER BY dc DESC";
944 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
945 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
946 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
947 $sql2 .=
" rc.fk_invoice_supplier_source,";
948 $sql2 .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
949 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
950 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
951 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
952 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
953 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
954 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
955 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
956 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
957 $sql2 .=
" AND rc.fk_user = u.rowid";
958 $sql2 .=
" AND rc.discount_type = 1";
959 $sql2 .=
" ORDER BY dc DESC";
961 $resql = $db->query($sql);
964 $resql2 = $db->query($sql2);
967 print
'<div class="div-table-responsive-no-min">';
968 print
'<table class="noborder centpercent">';
969 print
'<tr class="liste_titre">';
970 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
971 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
972 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
973 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
974 if (isModEnabled(
'multicompany')) {
975 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
977 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
978 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
979 if (isModEnabled(
'multicompany')) {
980 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
982 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
983 print
'<td width="50"> </td>';
986 $tab_sqlobj = array();
987 $tab_sqlobjOrder = array();
988 $num = $db->num_rows($resql);
990 for ($i = 0; $i < $num; $i++) {
991 $sqlobj = $db->fetch_object($resql);
992 $tab_sqlobj[] = $sqlobj;
993 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
998 $num = $db->num_rows($resql2);
999 for ($i = 0; $i < $num; $i++) {
1000 $sqlobj = $db->fetch_object($resql2);
1001 $tab_sqlobj[] = $sqlobj;
1002 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
1005 $array1_sort_order = SORT_DESC;
1006 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
1008 $num = count($tab_sqlobj);
1012 $obj = array_shift($tab_sqlobj);
1014 $tmpuser->id = $obj->user_id;
1015 $tmpuser->login = $obj->login;
1016 $tmpuser->firstname = $obj->firstname;
1017 $tmpuser->lastname = $obj->lastname;
1018 $tmpuser->photo = $obj->photo;
1019 $tmpuser->status = $obj->status;
1021 print
'<tr class="oddeven">';
1022 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
1023 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
1024 print
'<td class="tdoverflowmax100">';
1025 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1026 $facturefournstatic->ref = $obj->invoice_source_ref;
1027 $facturefournstatic->type = $obj->type;
1028 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1030 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
1031 print
'<td class="tdoverflowmax100">';
1032 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1033 $facturefournstatic->ref = $obj->invoice_source_ref;
1034 $facturefournstatic->type = $obj->type;
1035 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1037 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
1038 print
'<td class="tdoverflowmax100">';
1039 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1040 $facturefournstatic->ref = $obj->invoice_source_ref;
1041 $facturefournstatic->type = $obj->type;
1042 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1045 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
1049 print
'<td class="left nowrap">';
1050 if ($obj->invoiceid) {
1051 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
1054 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
1055 if (isModEnabled(
'multicompany')) {
1056 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
1058 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
1059 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
1060 if (isModEnabled(
'multicompany')) {
1061 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
1063 print
'<td class="tdoverflowmax100">';
1064 print $tmpuser->getNomUrl(-1);
1067 print
'<td> </td>';
1074 if (isModEnabled(
'multicompany')) {
1077 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($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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
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.
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.