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)) {
398 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
410 if ($action ==
'remove') {
411 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&remid='.
GETPOST(
'remid'), $langs->trans(
'RemoveDiscount'), $langs->trans(
'ConfirmRemoveDiscount'),
'confirm_remove',
'', 0, 1);
419 if ($isCustomer && !$isSupplier) {
420 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.
$id.
'&discount_type=0&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&token='.
newToken());
421 } elseif (!$isCustomer && $isSupplier) {
422 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.
$id.
'&discount_type=1&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&token='.
newToken());
427 print
load_fiche_titre($langs->trans(
"DiscountStillRemaining"), $newcardbutton);
430 $newcardbutton =
dolGetButtonTitle($langs->trans(
"NewClientGlobalDiscount"),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create_remise&id='.
$id.
'&discount_type=0&backtopage='.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&token='.
newToken());
432 print
'<div class="fichecenter">';
433 print
'<div class="fichehalfleft fichehalfleft-lg">';
434 print
load_fiche_titre($langs->trans(
"CustomerDiscounts"), $newcardbutton,
'');
437 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
438 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
439 $sql .=
" rc.datec as dc, rc.description,";
440 $sql .=
" rc.fk_facture_source,";
441 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
442 $sql .=
" fa.ref as ref, fa.type as type";
443 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
444 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
445 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
446 $sql .=
" AND rc.entity = ".((int) $conf->entity);
447 $sql .=
" AND u.rowid = rc.fk_user";
448 $sql .=
" AND rc.discount_type = 0";
449 $sql .=
" AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
450 $sql .=
" ORDER BY rc.datec DESC";
452 $resql = $db->query($sql);
454 print
'<div class="div-table-responsive-no-min">';
455 print
'<table class="noborder centpercent">';
456 print
'<tr class="liste_titre">';
457 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
458 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
459 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
460 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
461 if (isModEnabled(
'multicompany')) {
462 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
464 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
465 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
466 if (isModEnabled(
'multicompany')) {
467 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
469 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
470 print
'<td width="50"> </td>';
473 $showconfirminfo = array();
476 $num = $db->num_rows($resql);
479 $obj = $db->fetch_object($resql);
481 $tmpuser->id = $obj->user_id;
482 $tmpuser->login = $obj->login;
483 $tmpuser->firstname = $obj->firstname;
484 $tmpuser->lastname = $obj->lastname;
485 $tmpuser->photo = $obj->photo;
486 $tmpuser->status = $obj->status;
488 print
'<tr class="oddeven">';
490 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
492 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
493 print
'<td class="tdoverflowmax100">';
494 $facturestatic->id = $obj->fk_facture_source;
495 $facturestatic->ref = $obj->ref;
496 $facturestatic->type = $obj->type;
497 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
499 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
500 print
'<td class="tdoverflowmax100">';
501 $facturestatic->id = $obj->fk_facture_source;
502 $facturestatic->ref = $obj->ref;
503 $facturestatic->type = $obj->type;
504 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
506 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
507 print
'<td class="tdoverflowmax100">';
508 $facturestatic->id = $obj->fk_facture_source;
509 $facturestatic->ref = $obj->ref;
510 $facturestatic->type = $obj->type;
511 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"ExcessReceived"), $obj->description).
' '.$facturestatic->getNomURl(1);
514 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
519 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
521 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
523 if (isModEnabled(
'multicompany')) {
524 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
526 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
527 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
528 if (isModEnabled(
'multicompany')) {
529 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
531 print
'<td class="tdoverflowmax100">';
533 print $tmpuser->getNomUrl(-1);
536 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
537 print
'<td class="center nowraponall">';
538 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>';
539 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>';
542 print
'<td> </td>';
546 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
547 $showconfirminfo[
'rowid'] = $obj->rowid;
548 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
554 if (isModEnabled(
'multicompany')) {
557 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
563 if (count($showconfirminfo)) {
564 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
565 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
566 $formquestion = array(
567 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
568 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
569 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
571 $langs->load(
"dict");
572 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);
581 $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());
583 print
'<div class="fichehalfright fichehalfright-lg">';
584 print
load_fiche_titre($langs->trans(
"SupplierDiscounts"), $newcardbutton,
'');
590 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
591 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
592 $sql .=
" rc.datec as dc, rc.description,";
593 $sql .=
" rc.fk_invoice_supplier_source,";
594 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
595 $sql .=
" fa.ref, fa.type as type";
596 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user as u, ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
597 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
598 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
599 $sql .=
" AND rc.entity = ".((int) $conf->entity);
600 $sql .=
" AND u.rowid = rc.fk_user";
601 $sql .=
" AND rc.discount_type = 1";
602 $sql .=
" AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
603 $sql .=
" ORDER BY rc.datec DESC";
605 $resql = $db->query($sql);
607 print
'<div class="div-table-responsive-no-min">';
608 print
'<table class="noborder centpercent">';
609 print
'<tr class="liste_titre">';
610 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
611 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
612 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
613 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
614 if (isModEnabled(
'multicompany')) {
615 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
617 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
618 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
619 if (isModEnabled(
'multicompany')) {
620 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
622 print
'<td width="100" class="center">'.$langs->trans(
"DiscountOfferedBy").
'</td>';
623 print
'<td width="50"> </td>';
626 $showconfirminfo = array();
629 $num = $db->num_rows($resql);
632 $obj = $db->fetch_object($resql);
634 $tmpuser->id = $obj->user_id;
635 $tmpuser->login = $obj->login;
636 $tmpuser->firstname = $obj->firstname;
637 $tmpuser->lastname = $obj->lastname;
638 $tmpuser->photo = $obj->photo;
639 $tmpuser->status = $obj->status;
641 print
'<tr class="oddeven">';
642 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour',
'tzuserrel').
'</td>';
643 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
644 print
'<td class="tdoverflowmax100">';
645 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
646 $facturefournstatic->ref = $obj->ref;
647 $facturefournstatic->type = $obj->type;
648 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
650 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
651 print
'<td class="tdoverflowmax100">';
652 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
653 $facturefournstatic->ref = $obj->ref;
654 $facturefournstatic->type = $obj->type;
655 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
657 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
658 print
'<td class="tdoverflowmax100">';
659 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
660 $facturefournstatic->ref = $obj->ref;
661 $facturefournstatic->type = $obj->type;
662 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"ExcessPaid"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
665 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
669 print
'<td class="nowrap"><span class="opacitymedium">'.$langs->trans(
"NotConsumed").
'</span></td>';
670 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
671 if (isModEnabled(
'multicompany')) {
672 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
674 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
675 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
676 if (isModEnabled(
'multicompany')) {
677 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
679 print
'<td class="tdoverflowmax100">';
680 print $tmpuser->getNomUrl(-1);
683 if ($user->hasRight(
'societe',
'creer') || $user->hasRight(
'facture',
'creer')) {
684 print
'<td class="center nowraponall">';
685 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>';
686 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>';
689 print
'<td> </td>';
693 if ($action ==
'split' &&
GETPOST(
'remid') == $obj->rowid) {
694 $showconfirminfo[
'rowid'] = $obj->rowid;
695 $showconfirminfo[
'amount_ttc'] = $obj->amount_ttc;
701 if (isModEnabled(
'multicompany')) {
704 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
710 if (count($showconfirminfo)) {
711 $amount1 =
price2num($showconfirminfo[
'amount_ttc'] / 2,
'MT');
712 $amount2 = ($showconfirminfo[
'amount_ttc'] - (float) $amount1);
713 $formquestion = array(
714 'text' => $langs->trans(
'TypeAmountOfEachNewDiscount'),
715 0 => array(
'type' =>
'text',
'name' =>
'amount_ttc_1',
'label' => $langs->trans(
"AmountTTC").
' 1',
'value' => $amount1,
'size' =>
'5'),
716 1 => array(
'type' =>
'text',
'name' =>
'amount_ttc_2',
'label' => $langs->trans(
"AmountTTC").
' 2',
'value' => $amount2,
'size' =>
'5')
718 $langs->load(
"dict");
719 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);
731 print
'<div class="clearboth"></div><br><br>';
741 print
'<div class="fichecenter">';
742 print
'<div class="fichehalfleft fichehalfleft-lg">';
747 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
748 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
749 $sql .=
" rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
750 $sql .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
751 $sql .=
" f.rowid as invoiceid, f.ref,";
752 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
753 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
754 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
755 $sql .=
" , ".MAIN_DB_PREFIX.
"facturedet as fc";
756 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
757 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
758 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
759 $sql .=
" AND rc.fk_facture_line = fc.rowid";
760 $sql .=
" AND fc.fk_facture = f.rowid";
761 $sql .=
" AND rc.fk_user = u.rowid";
762 $sql .=
" AND rc.discount_type = 0";
763 $sql .=
" ORDER BY dc DESC";
766 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
767 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
768 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,";
769 $sql2 .=
" u.login, u.rowid as user_id, u.statut as status, u.firstname, u.lastname, u.photo,";
770 $sql2 .=
" f.rowid as invoiceid, f.ref,";
771 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
772 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture as f";
773 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
774 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
775 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as fa ON rc.fk_facture_source = fa.rowid";
776 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
777 $sql2 .=
" AND rc.fk_facture = f.rowid";
778 $sql2 .=
" AND rc.fk_user = u.rowid";
779 $sql2 .=
" AND rc.discount_type = 0";
780 $sql2 .=
" ORDER BY dc DESC";
782 $resql = $db->query($sql);
785 $resql2 = $db->query($sql2);
788 print
'<div class="div-table-responsive-no-min">';
789 print
'<table class="noborder centpercent">';
790 print
'<tr class="liste_titre">';
791 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
792 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
793 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
794 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
795 if (isModEnabled(
'multicompany')) {
796 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
798 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
799 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
800 if (isModEnabled(
'multicompany')) {
801 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
803 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
804 print
'<td width="50"> </td>';
807 $tab_sqlobj = array();
808 $tab_sqlobjOrder = array();
809 $num = $db->num_rows($resql);
811 for ($i = 0; $i < $num; $i++) {
812 $sqlobj = $db->fetch_object($resql);
813 $tab_sqlobj[] = $sqlobj;
814 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
819 $num = $db->num_rows($resql2);
820 for ($i = 0; $i < $num; $i++) {
821 $sqlobj = $db->fetch_object($resql2);
822 $tab_sqlobj[] = $sqlobj;
823 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
826 $array1_sort_order = SORT_DESC;
827 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
829 $num = count($tab_sqlobj);
833 $obj = array_shift($tab_sqlobj);
835 $tmpuser->id = $obj->user_id;
836 $tmpuser->login = $obj->login;
837 $tmpuser->firstname = $obj->firstname;
838 $tmpuser->lastname = $obj->lastname;
839 $tmpuser->photo = $obj->photo;
840 $tmpuser->status = $obj->status;
842 print
'<tr class="oddeven">';
843 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
844 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
845 print
'<td class="tdoverflowmax100">';
846 $facturestatic->id = $obj->fk_facture_source;
847 $facturestatic->ref = $obj->invoice_source_ref;
848 $facturestatic->type = $obj->type;
849 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturestatic->getNomURl(1);
851 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
852 print
'<td class="tdoverflowmax100">';
853 $facturestatic->id = $obj->fk_facture_source;
854 $facturestatic->ref = $obj->invoice_source_ref;
855 $facturestatic->type = $obj->type;
856 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturestatic->getNomURl(1);
858 } elseif (preg_match(
'/\(EXCESS RECEIVED\)/', $obj->description)) {
859 print
'<td class="tdoverflowmax100">';
860 $facturestatic->id = $obj->fk_facture_source;
861 $facturestatic->ref = $obj->invoice_source_ref;
862 $facturestatic->type = $obj->type;
863 print preg_replace(
'/\(EXCESS RECEIVED\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturestatic->getNomURl(1);
866 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
870 print
'<td class="left nowrap">';
871 if ($obj->invoiceid) {
872 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
875 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
876 if (isModEnabled(
'multicompany')) {
877 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
879 print
'<td class="right nowraponall">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
880 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
881 if (isModEnabled(
'multicompany')) {
882 print
'<td class="right">'.price($obj->multicurrency_amount_ttc).
'</td>';
884 print
'<td class="tdoverflowmax100">';
885 print $tmpuser->getNomUrl(-1);
888 print
'<td> </td>';
894 if (isModEnabled(
'multicompany')) {
897 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
910 print
'<div class="fichehalfright fichehalfright-lg">';
915 $sql =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
916 $sql .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
917 $sql .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,";
918 $sql .=
" rc.fk_invoice_supplier_source,";
919 $sql .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
920 $sql .=
" f.rowid as invoiceid, f.ref as ref,";
921 $sql .=
" fa.ref as invoice_source_ref, fa.type as type";
922 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
923 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
924 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn_det as fc";
925 $sql .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
926 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
927 $sql .=
" WHERE rc.fk_soc = ".((int)
$object->id);
928 $sql .=
" AND rc.fk_invoice_supplier_line = fc.rowid";
929 $sql .=
" AND fc.fk_facture_fourn = f.rowid";
930 $sql .=
" AND rc.fk_user = u.rowid";
931 $sql .=
" AND rc.discount_type = 1";
932 $sql .=
" ORDER BY dc DESC";
935 $sql2 =
"SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,";
936 $sql2 .=
" rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
937 $sql2 .=
" rc.datec as dc, rc.description, rc.fk_invoice_supplier,";
938 $sql2 .=
" rc.fk_invoice_supplier_source,";
939 $sql2 .=
" u.login, u.rowid as user_id, u.statut as user_status, u.firstname, u.lastname, u.photo,";
940 $sql2 .=
" f.rowid as invoiceid, f.ref as ref,";
941 $sql2 .=
" fa.ref as invoice_source_ref, fa.type as type";
942 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f";
943 $sql2 .=
" , ".MAIN_DB_PREFIX.
"user as u";
944 $sql2 .=
" , ".MAIN_DB_PREFIX.
"societe_remise_except as rc";
945 $sql2 .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
946 $sql2 .=
" WHERE rc.fk_soc = ".((int)
$object->id);
947 $sql2 .=
" AND rc.fk_invoice_supplier = f.rowid";
948 $sql2 .=
" AND rc.fk_user = u.rowid";
949 $sql2 .=
" AND rc.discount_type = 1";
950 $sql2 .=
" ORDER BY dc DESC";
952 $resql = $db->query($sql);
955 $resql2 = $db->query($sql2);
958 print
'<div class="div-table-responsive-no-min">';
959 print
'<table class="noborder centpercent">';
960 print
'<tr class="liste_titre">';
961 print
'<td class="widthdate">'.$langs->trans(
"Date").
'</td>';
962 print
'<td>'.$langs->trans(
"ReasonDiscount").
'</td>';
963 print
'<td class="nowrap">'.$langs->trans(
"ConsumedBy").
'</td>';
964 print
'<td class="right">'.$langs->trans(
"AmountHT").
'</td>';
965 if (isModEnabled(
'multicompany')) {
966 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountHT")).
'">'.$langs->trans(
"MulticurrencyAmountHT").
'</td>';
968 print
'<td class="right">'.$langs->trans(
"VATRate").
'</td>';
969 print
'<td class="right">'.$langs->trans(
"AmountTTC").
'</td>';
970 if (isModEnabled(
'multicompany')) {
971 print
'<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans(
"MulticurrencyAmountTTC")).
'">'.$langs->trans(
"MulticurrencyAmountTTC").
'</td>';
973 print
'<td width="100" class="center">'.$langs->trans(
"Author").
'</td>';
974 print
'<td width="50"> </td>';
977 $tab_sqlobj = array();
978 $tab_sqlobjOrder = array();
979 $num = $db->num_rows($resql);
981 for ($i = 0; $i < $num; $i++) {
982 $sqlobj = $db->fetch_object($resql);
983 $tab_sqlobj[] = $sqlobj;
984 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
989 $num = $db->num_rows($resql2);
990 for ($i = 0; $i < $num; $i++) {
991 $sqlobj = $db->fetch_object($resql2);
992 $tab_sqlobj[] = $sqlobj;
993 $tab_sqlobjOrder[] = $db->jdate($sqlobj->dc);
996 $array1_sort_order = SORT_DESC;
997 array_multisort($tab_sqlobjOrder, $array1_sort_order, $tab_sqlobj);
999 $num = count($tab_sqlobj);
1003 $obj = array_shift($tab_sqlobj);
1005 $tmpuser->id = $obj->user_id;
1006 $tmpuser->login = $obj->login;
1007 $tmpuser->firstname = $obj->firstname;
1008 $tmpuser->lastname = $obj->lastname;
1009 $tmpuser->photo = $obj->photo;
1010 $tmpuser->status = $obj->status;
1012 print
'<tr class="oddeven">';
1013 print
'<td>'.dol_print_date($db->jdate($obj->dc),
'dayhour').
'</td>';
1014 if (preg_match(
'/\(CREDIT_NOTE\)/', $obj->description)) {
1015 print
'<td class="tdoverflowmax100">';
1016 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1017 $facturefournstatic->ref = $obj->invoice_source_ref;
1018 $facturefournstatic->type = $obj->type;
1019 print preg_replace(
'/\(CREDIT_NOTE\)/', $langs->trans(
"CreditNote"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1021 } elseif (preg_match(
'/\(DEPOSIT\)/', $obj->description)) {
1022 print
'<td class="tdoverflowmax100">';
1023 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1024 $facturefournstatic->ref = $obj->invoice_source_ref;
1025 $facturefournstatic->type = $obj->type;
1026 print preg_replace(
'/\(DEPOSIT\)/', $langs->trans(
"InvoiceDeposit"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1028 } elseif (preg_match(
'/\(EXCESS PAID\)/', $obj->description)) {
1029 print
'<td class="tdoverflowmax100">';
1030 $facturefournstatic->id = $obj->fk_invoice_supplier_source;
1031 $facturefournstatic->ref = $obj->invoice_source_ref;
1032 $facturefournstatic->type = $obj->type;
1033 print preg_replace(
'/\(EXCESS PAID\)/', $langs->trans(
"Invoice"), $obj->description).
' '.$facturefournstatic->getNomURl(1);
1036 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->description).
'">';
1040 print
'<td class="left nowrap">';
1041 if ($obj->invoiceid) {
1042 print
'<a href="'.DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$obj->invoiceid.
'">'.
img_object($langs->trans(
"ShowBill"),
'bill').
' '.$obj->ref.
'</a>';
1045 print
'<td class="right nowraponall amount">'.price($obj->amount_ht).
'</td>';
1046 if (isModEnabled(
'multicompany')) {
1047 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ht).
'</td>';
1049 print
'<td class="right">'.vatrate($obj->tva_tx.($obj->vat_src_code ?
' ('.$obj->vat_src_code.
')' :
''), true).
'</td>';
1050 print
'<td class="right nowraponall amount">'.price($obj->amount_ttc).
'</td>';
1051 if (isModEnabled(
'multicompany')) {
1052 print
'<td class="right nowraponall amount">'.price($obj->multicurrency_amount_ttc).
'</td>';
1054 print
'<td class="tdoverflowmax100">';
1055 print $tmpuser->getNomUrl(-1);
1058 print
'<td> </td>';
1065 if (isModEnabled(
'multicompany')) {
1068 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...
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.