dolibarr  9.0.0
remx.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('orders', 'bills', 'companies'));
34 
35 $id=GETPOST('id','int');
36 
37 $action=GETPOST('action','alpha');
38 $backtopage=GETPOST('backtopage','alpha');
39 
40 // Security check
41 $socid = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int');
42 if ($user->societe_id > 0)
43 {
44  $socid = $user->societe_id;
45 }
46 
47 
48 /*
49  * Actions
50  */
51 
52 if (GETPOST('cancel','alpha') && ! empty($backtopage))
53 {
54  header("Location: ".$backtopage);
55  exit;
56 }
57 
58 if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
59 {
60  //if ($user->rights->societe->creer)
61  //if ($user->rights->facture->creer)
62 
63  $amount_ttc_1=GETPOST('amount_ttc_1');
64  $amount_ttc_2=GETPOST('amount_ttc_2');
65 
66  $error=0;
67  $remid=GETPOST("remid")?GETPOST("remid"):0;
68  $discount=new DiscountAbsolute($db);
69  $res=$discount->fetch($remid);
70  if (! $res > 0)
71  {
72  $error++;
73  setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');
74  }
75  if (! $error && price2num($amount_ttc_1+$amount_ttc_2) != $discount->amount_ttc)
76  {
77  $error++;
78  setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors');
79  }
80  if (! $error && $discount->fk_facture_line)
81  {
82  $error++;
83  setEventMessages($langs->trans("ErrorCantSplitAUsedDiscount"), null, 'errors');
84  }
85  if (! $error)
86  {
87  $newdiscount1=new DiscountAbsolute($db);
88  $newdiscount2=new DiscountAbsolute($db);
89  $newdiscount1->fk_facture_source=$discount->fk_facture_source;
90  $newdiscount2->fk_facture_source=$discount->fk_facture_source;
91  $newdiscount1->fk_facture=$discount->fk_facture;
92  $newdiscount2->fk_facture=$discount->fk_facture;
93  $newdiscount1->fk_facture_line=$discount->fk_facture_line;
94  $newdiscount2->fk_facture_line=$discount->fk_facture_line;
95  $newdiscount1->fk_invoice_supplier_source=$discount->fk_invoice_supplier_source;
96  $newdiscount2->fk_invoice_supplier_source=$discount->fk_invoice_supplier_source;
97  $newdiscount1->fk_invoice_supplier=$discount->fk_invoice_supplier;
98  $newdiscount2->fk_invoice_supplier=$discount->fk_invoice_supplier;
99  $newdiscount1->fk_invoice_supplier_line=$discount->fk_invoice_supplier_line;
100  $newdiscount2->fk_invoice_supplier_line=$discount->fk_invoice_supplier_line;
101  if ($discount->description == '(CREDIT_NOTE)' || $discount->description == '(DEPOSIT)')
102  {
103  $newdiscount1->description=$discount->description;
104  $newdiscount2->description=$discount->description;
105  }
106  else
107  {
108  $newdiscount1->description=$discount->description.' (1)';
109  $newdiscount2->description=$discount->description.' (2)';
110  }
111  $newdiscount1->fk_user=$discount->fk_user;
112  $newdiscount2->fk_user=$discount->fk_user;
113  $newdiscount1->fk_soc=$discount->fk_soc;
114  $newdiscount2->fk_soc=$discount->fk_soc;
115  $newdiscount1->discount_type=$discount->discount_type;
116  $newdiscount2->discount_type=$discount->discount_type;
117  $newdiscount1->datec=$discount->datec;
118  $newdiscount2->datec=$discount->datec;
119  $newdiscount1->tva_tx=$discount->tva_tx;
120  $newdiscount2->tva_tx=$discount->tva_tx;
121  $newdiscount1->amount_ttc=$_POST["amount_ttc_1"];
122  $newdiscount2->amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc);
123  $newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT');
124  $newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT');
125  $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount1->amount_ht);
126  $newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht);
127 
128  $db->begin();
129  $discount->fk_facture_source=0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source
130  $res=$discount->delete($user);
131  $newid1=$newdiscount1->create($user);
132  $newid2=$newdiscount2->create($user);
133  if ($res > 0 && $newid1 > 0 && $newid2 > 0)
134  {
135  $db->commit();
136  header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id.($backtopage?'&backtopage='.urlencode($backtopage):'')); // To avoid pb whith back
137  exit;
138  }
139  else
140  {
141  $db->rollback();
142  }
143  }
144 }
145 
146 if ($action == 'setremise' && $user->rights->societe->creer)
147 {
148  //if ($user->rights->societe->creer)
149  //if ($user->rights->facture->creer)
150 
151  $amount_ht=GETPOST('amount_ht');
152  $desc=GETPOST('desc','alpha');
153  $tva_tx=GETPOST('tva_tx','alpha');
154  $discount_type=! empty($_POST['discount_type'])?GETPOST('discount_type','alpha'):0;
155 
156  if (price2num($amount_ht) > 0)
157  {
158  $error=0;
159  if (empty($desc))
160  {
161  setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors');
162  $error++;
163  }
164 
165  if (! $error)
166  {
167  $soc = new Societe($db);
168  $soc->fetch($id);
169  $discountid=$soc->set_remise_except($amount_ht,$user,$desc,$tva_tx,$discount_type);
170 
171  if ($discountid > 0)
172  {
173  if (! empty($backtopage))
174  {
175  header("Location: ".$backtopage.'&discountid='.$discountid);
176  exit;
177  }
178  else
179  {
180  header("Location: remx.php?id=".$id);
181  exit;
182  }
183  }
184  else
185  {
186  $error++;
187  setEventMessages($soc->error, $soc->errors, 'errors');
188  }
189  }
190  }
191  else
192  {
193  setEventMessages($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), null, 'errors');
194  }
195 }
196 
197 if (GETPOST('action','aZ09') == 'confirm_remove' && GETPOST("confirm")=='yes')
198 {
199  //if ($user->rights->societe->creer)
200  //if ($user->rights->facture->creer)
201 
202  $db->begin();
203 
204  $discount = new DiscountAbsolute($db);
205  $result=$discount->fetch(GETPOST("remid"));
206  $result=$discount->delete($user);
207  if ($result > 0)
208  {
209  $db->commit();
210  header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
211  exit;
212  }
213  else
214  {
215  setEventMessages($discount->error, $discount->errors, 'errors');
216  $db->rollback();
217  }
218 }
219 
220 
221 /*
222  * View
223  */
224 
225 $form=new Form($db);
226 $facturestatic=new Facture($db);
227 $facturefournstatic=new FactureFournisseur($db);
228 
229 llxHeader('',$langs->trans("GlobalDiscount"));
230 
231 if ($socid > 0)
232 {
233  // On recupere les donnees societes par l'objet
234  $object = new Societe($db);
235  $object->fetch($socid);
236 
237  $isCustomer = $object->client == 1 || $object->client == 3;
238  $isSupplier = $object->fournisseur == 1;
239 
240  /*
241  * Display tabs
242  */
243  $head = societe_prepare_head($object);
244 
245  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
246  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
247  print '<input type="hidden" name="action" value="setremise">';
248  print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
249 
250  dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company');
251 
252  dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
253 
254  print '<div class="fichecenter">';
255 
256  print '<div class="underbanner clearboth"></div>';
257 
258  if(! $isCustomer && ! $isSupplier) {
259  print '<p class="opacitymedium">'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'</p>';
260 
261  dol_fiche_end();
262 
263  print '</form>';
264 
265  llxFooter();
266  $db->close();
267  exit;
268  }
269 
270 
271  print '<table class="border centpercent">';
272 
273  if($isCustomer) { // Calcul avoirs client en cours
274  $remise_all=$remise_user=0;
275  $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
276  $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
277  $sql.= " WHERE rc.fk_soc = " . $object->id;
278  $sql.= " AND rc.entity = " . $conf->entity;
279  $sql.= " AND discount_type = 0"; // Exclude supplier discounts
280  $sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
281  $sql.= " GROUP BY rc.fk_user";
282  $resql=$db->query($sql);
283  if ($resql)
284  {
285  $obj = $db->fetch_object($resql);
286  $remise_all+=$obj->amount;
287  if ($obj->fk_user == $user->id) $remise_user+=$obj->amount;
288  }
289  else
290  {
291  dol_print_error($db);
292  }
293 
294  print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
295  print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
296 
297  if (! empty($user->fk_soc)) // No need to show this for external users
298  {
299  print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
300  print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
301  }
302  }
303 
304  if($isSupplier) {
305  // Calcul avoirs fournisseur en cours
306  $remise_all=$remise_user=0;
307  $sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
308  $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
309  $sql.= " WHERE rc.fk_soc = " . $object->id;
310  $sql.= " AND rc.entity = " . $conf->entity;
311  $sql.= " AND discount_type = 1"; // Exclude customer discounts
312  $sql.= " AND (fk_invoice_supplier_line IS NULL AND fk_invoice_supplier IS NULL)";
313  $sql.= " GROUP BY rc.fk_user";
314  $resql=$db->query($sql);
315  if ($resql)
316  {
317  $obj = $db->fetch_object($resql);
318  $remise_all+=$obj->amount;
319  if ($obj->fk_user == $user->id) $remise_user+=$obj->amount;
320  }
321  else
322  {
323  dol_print_error($db);
324  }
325 
326  print '<tr><td class="titlefield">'.$langs->trans("SupplierAbsoluteDiscountAllUsers").'</td>';
327  print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
328 
329  if (! empty($user->fk_soc)) // No need to show this for external users
330  {
331  print '<tr><td>'.$langs->trans("SupplierAbsoluteDiscountMy").'</td>';
332  print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
333  }
334  }
335 
336  print '</table>';
337 
338  print '</div>';
339 
340  if ($user->rights->societe->creer)
341  {
342  print '<br>';
343 
344  print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
345 
346  print '<div class="underbanner clearboth"></div>';
347 
348  if($isCustomer && ! $isSupplier) {
349  print '<input type="hidden" name="discount_type" value="0" />';
350  }
351 
352  if(! $isCustomer && $isSupplier) {
353  print '<input type="hidden" name="discount_type" value="1" />';
354  }
355 
356  print '<table class="border" width="100%">';
357  if($isCustomer && $isSupplier) {
358  print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
359  print '<td><input type="radio" name="discount_type" id="discount_type_0" checked="checked" value="0"/> <label for="discount_type_0">'.$langs->trans('Customer').'</label>';
360  print ' &nbsp; <input type="radio" name="discount_type" id="discount_type_1" value="1"/> <label for="discount_type_1">'.$langs->trans('Supplier').'</label>';
361  print '</td></tr>';
362  }
363  print '<tr><td class="titlefield fieldrequired">'.$langs->trans("AmountHT").'</td>';
364  print '<td><input type="text" size="5" name="amount_ht" value="'.price2num(GETPOST("amount_ht")).'">';
365  print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
366  print '<tr><td>'.$langs->trans("VAT").'</td>';
367  print '<td>';
368  print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
369  print '</td></tr>';
370  print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
371  print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc','none').'"></td></tr>';
372 
373  print "</table>";
374  }
375 
376  dol_fiche_end();
377 
378  if ($user->rights->societe->creer)
379  {
380  print '<div class="center">';
381  print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
382  if (! empty($backtopage))
383  {
384  print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
385  print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
386  }
387  print '</div>';
388  }
389 
390  print '</form>';
391 
392 
393  print '<br>';
394 
395  if ($_GET['action'] == 'remove')
396  {
397  print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.GETPOST('remid'), $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
398  }
399 
400 
401  /*
402  * Liste remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
403  */
404 
405  print load_fiche_titre($langs->trans("DiscountStillRemaining"));
406 
407  if($isCustomer) {
408  if($isSupplier) {
409  print '<div class="fichecenter">';
410  print '<div class="fichehalfleft">';
411  print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
412  }
413 
414  $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
415  $sql.= " rc.datec as dc, rc.description,";
416  $sql.= " rc.fk_facture_source,";
417  $sql.= " u.login, u.rowid as user_id,";
418  $sql.= " fa.facnumber as ref, fa.type as type";
419  $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
420  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
421  $sql.= " WHERE rc.fk_soc = " . $object->id;
422  $sql.= " AND rc.entity = " . $conf->entity;
423  $sql.= " AND u.rowid = rc.fk_user";
424  $sql.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
425  $sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
426  $sql.= " ORDER BY rc.datec DESC";
427 
428  $resql=$db->query($sql);
429  if ($resql)
430  {
431  print '<div class="div-table-responsive-no-min">';
432  print '<table width="100%" class="noborder">';
433  print '<tr class="liste_titre">';
434  print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
435  print '<td>'.$langs->trans("ReasonDiscount").'</td>';
436  print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
437  print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
438  print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
439  print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
440  print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
441  print '<td width="50">&nbsp;</td>';
442  print '</tr>';
443 
444  $showconfirminfo=array();
445 
446  $i = 0;
447  $num = $db->num_rows($resql);
448  if ($num > 0)
449  {
450  while ($i < $num)
451  {
452  $obj = $db->fetch_object($resql);
453 
454  print '<tr class="oddeven">';
455  print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
456  if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
457  {
458  print '<td class="nowrap">';
459  $facturestatic->id=$obj->fk_facture_source;
460  $facturestatic->ref=$obj->ref;
461  $facturestatic->type=$obj->type;
462  print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1);
463  print '</td>';
464  }
465  elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
466  {
467  print '<td class="nowrap">';
468  $facturestatic->id=$obj->fk_facture_source;
469  $facturestatic->ref=$obj->ref;
470  $facturestatic->type=$obj->type;
471  print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
472  print '</td>';
473  }
474  elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description))
475  {
476  print '<td class="nowrap">';
477  $facturestatic->id=$obj->fk_facture_source;
478  $facturestatic->ref=$obj->ref;
479  $facturestatic->type=$obj->type;
480  print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("ExcessReceived"),$obj->description).' '.$facturestatic->getNomURl(1);
481  print '</td>';
482  }
483  else
484  {
485  print '<td>';
486  print $obj->description;
487  print '</td>';
488  }
489  print '<td class="nowrap">'.$langs->trans("NotConsumed").'</td>';
490  print '<td align="right">'.price($obj->amount_ht).'</td>';
491  print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
492  print '<td align="right">'.price($obj->amount_ttc).'</td>';
493  print '<td align="center">';
494  print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
495  print '</td>';
496  if ($user->rights->societe->creer || $user->rights->facture->creer)
497  {
498  print '<td class="nowrap">';
499  print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
500  print ' &nbsp; ';
501  print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
502  print '</td>';
503  }
504  else print '<td>&nbsp;</td>';
505  print '</tr>';
506 
507  if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
508  {
509  $showconfirminfo['rowid']=$obj->rowid;
510  $showconfirminfo['amount_ttc']=$obj->amount_ttc;
511  }
512  $i++;
513  }
514  }
515  else
516  {
517  print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
518  }
519  $db->free($resql);
520  print "</table>";
521  print '</div>';
522 
523  if (count($showconfirminfo))
524  {
525  $amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
526  $amount2=($showconfirminfo['amount_ttc']-$amount1);
527  $formquestion=array(
528  'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
529  array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
530  array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
531  );
532  $langs->load("dict");
533  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);
534  }
535  }
536  else
537  {
538  dol_print_error($db);
539  }
540  }
541 
542  if($isSupplier) {
543  if($isCustomer) {
544  print '</div>'; // class="fichehalfleft"
545  print '<div class="fichehalfright">';
546  print '<div class="ficheaddleft">';
547  print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
548  }
549 
550  /*
551  * Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture)
552  */
553  $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
554  $sql.= " rc.datec as dc, rc.description,";
555  $sql.= " rc.fk_invoice_supplier_source,";
556  $sql.= " u.login, u.rowid as user_id,";
557  $sql.= " fa.ref, fa.type as type";
558  $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
559  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
560  $sql.= " WHERE rc.fk_soc = " . $object->id;
561  $sql.= " AND rc.entity = " . $conf->entity;
562  $sql.= " AND u.rowid = rc.fk_user";
563  $sql.= " AND rc.discount_type = 1"; // Eliminate customer discounts
564  $sql.= " AND (rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_line IS NULL)";
565  $sql.= " ORDER BY rc.datec DESC";
566 
567  $resql=$db->query($sql);
568  if ($resql)
569  {
570  print '<div class="div-table-responsive-no-min">';
571  print '<table width="100%" class="noborder">';
572  print '<tr class="liste_titre">';
573  print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
574  print '<td>'.$langs->trans("ReasonDiscount").'</td>';
575  print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
576  print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
577  print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
578  print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
579  print '<td width="100" align="center">'.$langs->trans("DiscountOfferedBy").'</td>';
580  print '<td width="50">&nbsp;</td>';
581  print '</tr>';
582 
583  $showconfirminfo=array();
584 
585  $i = 0;
586  $num = $db->num_rows($resql);
587  if ($num > 0)
588  {
589  while ($i < $num)
590  {
591  $obj = $db->fetch_object($resql);
592 
593  print '<tr class="oddeven">';
594  print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
595  if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
596  {
597  print '<td class="nowrap">';
598  $facturefournstatic->id=$obj->fk_invoice_supplier_source;
599  $facturefournstatic->ref=$obj->ref;
600  $facturefournstatic->type=$obj->type;
601  print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturefournstatic->getNomURl(1);
602  print '</td>';
603  }
604  elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
605  {
606  print '<td class="nowrap">';
607  $facturefournstatic->id=$obj->fk_invoice_supplier_source;
608  $facturefournstatic->ref=$obj->ref;
609  $facturefournstatic->type=$obj->type;
610  print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturefournstatic->getNomURl(1);
611  print '</td>';
612  }
613  elseif (preg_match('/\(EXCESS PAID\)/',$obj->description))
614  {
615  print '<td class="nowrap">';
616  $facturefournstatic->id=$obj->fk_invoice_supplier_source;
617  $facturefournstatic->ref=$obj->ref;
618  $facturefournstatic->type=$obj->type;
619  print preg_replace('/\(EXCESS PAID\)/',$langs->trans("ExcessPaid"),$obj->description).' '.$facturefournstatic->getNomURl(1);
620  print '</td>';
621  }
622  else
623  {
624  print '<td>';
625  print $obj->description;
626  print '</td>';
627  }
628  print '<td class="nowrap">'.$langs->trans("NotConsumed").'</td>';
629  print '<td align="right">'.price($obj->amount_ht).'</td>';
630  print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
631  print '<td align="right">'.price($obj->amount_ttc).'</td>';
632  print '<td align="center">';
633  print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
634  print '</td>';
635  if ($user->rights->societe->creer || $user->rights->facture->creer)
636  {
637  print '<td class="nowrap">';
638  print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
639  print ' &nbsp; ';
640  print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
641  print '</td>';
642  }
643  else print '<td>&nbsp;</td>';
644  print '</tr>';
645 
646  if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid)
647  {
648  $showconfirminfo['rowid']=$obj->rowid;
649  $showconfirminfo['amount_ttc']=$obj->amount_ttc;
650  }
651  $i++;
652  }
653  }
654  else
655  {
656  print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
657  }
658  $db->free($resql);
659  print "</table>";
660  print '</div>';
661 
662  if (count($showconfirminfo))
663  {
664  $amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
665  $amount2=($showconfirminfo['amount_ttc']-$amount1);
666  $formquestion=array(
667  'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
668  array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
669  array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
670  );
671  $langs->load("dict");
672  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);
673  }
674  }
675  else
676  {
677  dol_print_error($db);
678  }
679 
680  if ($isCustomer) {
681  print '</div>'; // class="ficheaddleft"
682  print '</div>'; // class="fichehalfright"
683  print '</div>'; // class="fichecenter"
684  }
685  }
686 
687  print '<div class="clearboth"></div><br>';
688 
689  /*
690  * List discount consumed (=liees a une ligne de facture ou facture)
691  */
692 
693  print load_fiche_titre($langs->trans("DiscountAlreadyCounted"));
694 
695  if($isCustomer) {
696  if($isSupplier) {
697  print '<div class="fichecenter">';
698  print '<div class="fichehalfleft">';
699  print load_fiche_titre($langs->trans("CustomerDiscounts"), '', '');
700  }
701 
702  // Remises liees a lignes de factures
703  $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
704  $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
705  $sql.= " rc.fk_facture_source,";
706  $sql.= " u.login, u.rowid as user_id,";
707  $sql.= " f.rowid, f.facnumber,";
708  $sql.= " fa.facnumber as ref, fa.type as type";
709  $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
710  $sql.= " , ".MAIN_DB_PREFIX."user as u";
711  $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
712  $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
713  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
714  $sql.= " WHERE rc.fk_soc =". $object->id;
715  $sql.= " AND rc.fk_facture_line = fc.rowid";
716  $sql.= " AND fc.fk_facture = f.rowid";
717  $sql.= " AND rc.fk_user = u.rowid";
718  $sql.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
719  $sql.= " ORDER BY dc DESC";
720  //$sql.= " UNION ";
721  // Remises liees a factures
722  $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
723  $sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
724  $sql2.= " rc.fk_facture_source,";
725  $sql2.= " u.login, u.rowid as user_id,";
726  $sql2.= " f.rowid, f.facnumber,";
727  $sql2.= " fa.facnumber as ref, fa.type as type";
728  $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
729  $sql2.= " , ".MAIN_DB_PREFIX."user as u";
730  $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
731  $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
732  $sql2.= " WHERE rc.fk_soc =". $object->id;
733  $sql2.= " AND rc.fk_facture = f.rowid";
734  $sql2.= " AND rc.fk_user = u.rowid";
735  $sql2.= " AND rc.discount_type = 0"; // Eliminate supplier discounts
736  $sql2.= " ORDER BY dc DESC";
737 
738  $resql=$db->query($sql);
739  $resql2=null;
740  if ($resql) $resql2=$db->query($sql2);
741  if ($resql2)
742  {
743  print '<div class="div-table-responsive-no-min">';
744  print '<table class="noborder" width="100%">';
745  print '<tr class="liste_titre">';
746  print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
747  print '<td>'.$langs->trans("ReasonDiscount").'</td>';
748  print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
749  print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
750  print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
751  print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
752  print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
753  print '<td width="50">&nbsp;</td>';
754  print '</tr>';
755 
756  $tab_sqlobj=array();
757  $tab_sqlobjOrder=array();
758  $num = $db->num_rows($resql);
759  if ($num > 0)
760  {
761  for ($i = 0;$i < $num; $i++)
762  {
763  $sqlobj = $db->fetch_object($resql);
764  $tab_sqlobj[] = $sqlobj;
765  $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc);
766  }
767  }
768  $db->free($resql);
769 
770  $num = $db->num_rows($resql2);
771  for ($i = 0;$i < $num;$i++)
772  {
773  $sqlobj = $db->fetch_object($resql2);
774  $tab_sqlobj[] = $sqlobj;
775  $tab_sqlobjOrder[]= $db->jdate($sqlobj->dc);
776  }
777  $db->free($resql2);
778  array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
779 
780  $num = count($tab_sqlobj);
781  if ($num > 0)
782  {
783  $i = 0 ;
784  while ($i < $num )
785  {
786  $obj = array_shift($tab_sqlobj);
787  print '<tr class="oddeven">';
788  print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
789  if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
790  {
791  print '<td class="nowrap">';
792  $facturestatic->id=$obj->fk_facture_source;
793  $facturestatic->ref=$obj->ref;
794  $facturestatic->type=$obj->type;
795  print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1);
796  print '</td>';
797  }
798  elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
799  {
800  print '<td class="nowrap">';
801  $facturestatic->id=$obj->fk_facture_source;
802  $facturestatic->ref=$obj->ref;
803  $facturestatic->type=$obj->type;
804  print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
805  print '</td>';
806  }
807  elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description))
808  {
809  print '<td class="nowrap">';
810  $facturestatic->id=$obj->fk_facture_source;
811  $facturestatic->ref=$obj->ref;
812  $facturestatic->type=$obj->type;
813  print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1);
814  print '</td>';
815  }
816  else
817  {
818  print '<td>';
819  print $obj->description;
820  print '</td>';
821  }
822  print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
823  print '<td align="right">'.price($obj->amount_ht).'</td>';
824  print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
825  print '<td align="right">'.price($obj->amount_ttc).'</td>';
826  print '<td align="center">';
827  print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
828  print '</td>';
829  print '<td>&nbsp;</td>';
830  print '</tr>';
831  $i++;
832  }
833  }
834  else
835  {
836  print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
837  }
838 
839  print "</table>";
840  print '</div>';
841  }
842  else
843  {
844  dol_print_error($db);
845  }
846  }
847 
848  if($isSupplier) {
849  if($isCustomer) {
850  print '</div>'; // class="fichehalfleft"
851  print '<div class="fichehalfright">';
852  print '<div class="ficheaddleft">';
853  print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
854  }
855 
856  // Remises liees a lignes de factures
857  $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
858  $sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
859  $sql.= " rc.fk_invoice_supplier_source,";
860  $sql.= " u.login, u.rowid as user_id,";
861  $sql.= " f.rowid, f.ref as facnumber,";
862  $sql.= " fa.ref, fa.type as type";
863  $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
864  $sql.= " , ".MAIN_DB_PREFIX."user as u";
865  $sql.= " , ".MAIN_DB_PREFIX."facture_fourn_det as fc";
866  $sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
867  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
868  $sql.= " WHERE rc.fk_soc =". $object->id;
869  $sql.= " AND rc.fk_invoice_supplier_line = fc.rowid";
870  $sql.= " AND fc.fk_facture_fourn = f.rowid";
871  $sql.= " AND rc.fk_user = u.rowid";
872  $sql.= " AND rc.discount_type = 1"; // Eliminate customer discounts
873  $sql.= " ORDER BY dc DESC";
874  //$sql.= " UNION ";
875  // Remises liees a factures
876  $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
877  $sql2.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
878  $sql2.= " rc.fk_invoice_supplier_source,";
879  $sql2.= " u.login, u.rowid as user_id,";
880  $sql2.= " f.rowid, f.ref as facnumber,";
881  $sql2.= " fa.ref, fa.type as type";
882  $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
883  $sql2.= " , ".MAIN_DB_PREFIX."user as u";
884  $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
885  $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
886  $sql2.= " WHERE rc.fk_soc =". $object->id;
887  $sql2.= " AND rc.fk_invoice_supplier = f.rowid";
888  $sql2.= " AND rc.fk_user = u.rowid";
889  $sql2.= " AND rc.discount_type = 1"; // Eliminate customer discounts
890  $sql2.= " ORDER BY dc DESC";
891 
892  $resql=$db->query($sql);
893  $resql2=null;
894  if ($resql) $resql2=$db->query($sql2);
895  if ($resql2)
896  {
897  print '<div class="div-table-responsive-no-min">';
898  print '<table class="noborder" width="100%">';
899  print '<tr class="liste_titre">';
900  print '<td class="widthdate">'.$langs->trans("Date").'</td>'; // Need 120+ for format with AM/PM
901  print '<td>'.$langs->trans("ReasonDiscount").'</td>';
902  print '<td width="150" class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
903  print '<td width="120" align="right">'.$langs->trans("AmountHT").'</td>';
904  print '<td width="80" align="right">'.$langs->trans("VATRate").'</td>';
905  print '<td width="120" align="right">'.$langs->trans("AmountTTC").'</td>';
906  print '<td width="100" align="center">'.$langs->trans("Author").'</td>';
907  print '<td width="50">&nbsp;</td>';
908  print '</tr>';
909 
910  $tab_sqlobj=array();
911  $tab_sqlobjOrder=array();
912  $num = $db->num_rows($resql);
913  if ($num > 0)
914  {
915  for ($i = 0;$i < $num; $i++)
916  {
917  $sqlobj = $db->fetch_object($resql);
918  $tab_sqlobj[] = $sqlobj;
919  $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc);
920  }
921  }
922  $db->free($resql);
923 
924  $num = $db->num_rows($resql2);
925  for ($i = 0;$i < $num;$i++)
926  {
927  $sqlobj = $db->fetch_object($resql2);
928  $tab_sqlobj[] = $sqlobj;
929  $tab_sqlobjOrder[]= $db->jdate($sqlobj->dc);
930  }
931  $db->free($resql2);
932  array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj);
933 
934  $num = count($tab_sqlobj);
935  if ($num > 0)
936  {
937  $i = 0 ;
938  while ($i < $num )
939  {
940  $obj = array_shift($tab_sqlobj);
941  print '<tr class="oddeven">';
942  print '<td>'.dol_print_date($db->jdate($obj->dc),'dayhour').'</td>';
943  if (preg_match('/\(CREDIT_NOTE\)/',$obj->description))
944  {
945  print '<td class="nowrap">';
946  $facturefournstatic->id=$obj->fk_invoice_supplier_source;
947  $facturefournstatic->ref=$obj->ref;
948  $facturefournstatic->type=$obj->type;
949  print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturefournstatic->getNomURl(1);
950  print '</td>';
951  }
952  elseif (preg_match('/\(DEPOSIT\)/',$obj->description))
953  {
954  print '<td class="nowrap">';
955  $facturefournstatic->id=$obj->fk_invoice_supplier_source;
956  $facturefournstatic->ref=$obj->ref;
957  $facturefournstatic->type=$obj->type;
958  print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturefournstatic->getNomURl(1);
959  print '</td>';
960  }
961  elseif (preg_match('/\(EXCESS PAID\)/',$obj->description))
962  {
963  print '<td class="nowrap">';
964  $facturefournstatic->id=$obj->fk_invoice_supplier_source;
965  $facturefournstatic->ref=$obj->ref;
966  $facturefournstatic->type=$obj->type;
967  print preg_replace('/\(EXCESS PAID\)/',$langs->trans("Invoice"),$obj->description).' '.$facturefournstatic->getNomURl(1);
968  print '</td>';
969  }
970  else
971  {
972  print '<td>';
973  print $obj->description;
974  print '</td>';
975  }
976  print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
977  print '<td align="right">'.price($obj->amount_ht).'</td>';
978  print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
979  print '<td align="right">'.price($obj->amount_ttc).'</td>';
980  print '<td align="center">';
981  print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a>';
982  print '</td>';
983  print '<td>&nbsp;</td>';
984  print '</tr>';
985  $i++;
986  }
987  }
988  else
989  {
990  print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
991  }
992 
993  print "</table>";
994  print '</div>';
995  }
996  else
997  {
998  dol_print_error($db);
999  }
1000 
1001  if($isCustomer) {
1002  print '</div>'; // class="ficheaddleft"
1003  print '</div>'; // class="fichehalfright"
1004  print '</div>'; // class="fichecenter"
1005  }
1006  }
1007 }
1008 
1009 // End of page
1010 llxFooter();
1011 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to manage suppliers invoices.
img_split($titlealt='default', $other='class="pictosplit"')
Show split logo.
img_delete($titlealt='default', $other='class="pictodelete"')
Show delete logo.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_fiche_end($notab=0)
Show tab footer of a card.
llxHeader()
Empty header.
Definition: wrapper.php:44
if(GETPOST('cancel', 'alpha')) if(! GETPOST( 'confirmmassaction', 'alpha') &&$massaction !='presend' &&$massaction !='confirm_presend')
Draft customers invoices.
Definition: list.php:156
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Definition: company.lib.php:42
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...
Class to manage absolute discounts.
Class to manage invoices.
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)