dolibarr 24.0.0-beta
paiement.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
4 * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
6 * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
7 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
8 * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
9 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
10 * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
11 * Copyright (C) 2017 Alexandre Spangaro <alexandre@inovea-conseil.com>
12 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
13 * Copyright (C) 2021 Charlene Benke <charlene@patas-monkey.com>
14 * Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
15 * Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
16 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 3 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <https://www.gnu.org/licenses/>.
30 */
31
38// Load Dolibarr environment
39require '../../main.inc.php';
40
49require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
50require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
51require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
53require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
54require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
55
56// Load translation files required by the page
57$langs->loadLangs(array('companies', 'bills', 'banks', 'compta'));
58
59$action = GETPOST('action', 'alpha');
60$confirm = GETPOST('confirm', 'alpha');
61$optioncss = GETPOST('optioncss', 'alpha');
62$cancel = GETPOST('cancel', 'alpha');
63$backtopage = GETPOST('backtopage', 'alpha');
64$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
65
66$facid = GETPOSTINT('facid');
67$socid = GETPOSTINT('socid');
68$accountid = GETPOSTINT('accountid');
69$day = GETPOSTINT('day');
70$month = GETPOSTINT('month');
71$year = GETPOSTINT('year');
72
73$search_ref = GETPOST('search_ref', 'alpha');
74$search_account = GETPOST('search_account', 'alpha');
75$search_paymenttype = GETPOST('search_paymenttype');
76$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on "< x"
77$search_company = GETPOST('search_company', 'alpha');
78$search_payment_num = GETPOST('search_payment_num', 'alpha');
79
80$displayAllInvoices = getDolGlobalInt('MAIN_PAIMENTS_SHOW_ALL_INVOICE_TYPES', 0);
81if (GETPOSTISSET('display-all-invoices')) {
82 $displayAllInvoices = GETPOSTINT('display-all-invoices');
83}
84
85$limit = GETPOSTINT('limit') ? GETPOST('limit') : $conf->liste_limit;
86$sortfield = GETPOST('sortfield', 'aZ09comma');
87$sortorder = GETPOST('sortorder', 'aZ09comma');
88$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
89if (empty($page) || $page == -1) {
90 $page = 0;
91} // If $page is not defined, or '' or -1
92$offset = $limit * $page;
93$pageprev = $page - 1;
94$pagenext = $page + 1;
95if (!$sortorder) {
96 $sortorder = "DESC";
97}
98if (!$sortfield) {
99 $sortfield = "p.rowid";
100}
101
102$amounts = array();
103$amountsresttopay = array();
104$addwarning = 0;
105
106$multicurrency_amounts = array();
107$multicurrency_amountsresttopay = array();
108
109// Security check
110if ($user->socid > 0) {
111 $socid = $user->socid;
112}
113
115
116// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
117$hookmanager->initHooks(array('paymentsupplierlist'));
118$extrafields = new ExtraFields($db);
119
120// fetch optionals attributes and labels
121$extrafields->fetch_name_optionals_label($object->table_element);
122
123$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
124
125$arrayfields = array();
126
127$permissiontoadd = ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"));
128
129
130/*
131 * Actions
132 */
133$error = 0;
134
135if ($cancel) {
136 if (!empty($backtopageforcancel)) {
137 header("Location: ".$backtopageforcancel);
138 exit;
139 } elseif (!empty($backtopage)) {
140 header("Location: ".$backtopage);
141 exit;
142 }
143 header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php');
144 exit;
145}
146
147if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
148 $search_ref = "";
149 $search_account = "";
150 $search_amount = "";
151 $search_paymenttype = "";
152 $search_payment_num = "";
153 $search_company = "";
154 $day = '';
155 $year = '';
156 $month = '';
157 $search_array_options = array();
158}
159
160$parameters = array('socid' => $socid);
161$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
162if ($reshook < 0) {
163 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
164}
165
166$formquestion = array();
167if (empty($reshook)) {
168 if (($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $permissiontoadd) {
169 $datepaye = GETPOSTDATE('re', '12:00:00');
170 $paiement_id = 0;
171 $totalpayment = 0;
172 $atleastonepaymentnotnull = 0;
173 $multicurrency_totalpayment = 0;
174
175 // Generate payment array and check if there is payment higher than invoice and payment date before invoice date
176 $tmpinvoice = new FactureFournisseur($db);
177 $i = 0;
178 foreach ($_POST as $key => $value) {
179 if (substr($key, 0, 7) == 'amount_') {
180 $cursorfacid = (int) substr($key, 7);
181 $amounts[$cursorfacid] = price2num(GETPOST($key));
182 if (!empty($amounts[$cursorfacid])) {
183 $atleastonepaymentnotnull++;
184 if (is_numeric($amounts[$cursorfacid])) {
185 $totalpayment += (float) $amounts[$cursorfacid];
186 } else {
187 setEventMessages($langs->transnoentities("InputValueIsNotAnNumber", GETPOST($key)), null, 'warnings');
188 }
189 }
190 $result = $tmpinvoice->fetch($cursorfacid);
191 if ($result <= 0) {
193 }
194 $amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
195 if ($amounts[$cursorfacid]) {
196 // Check amount
197 if ((abs((float) $amounts[$cursorfacid]) > abs((float) $amountsresttopay[$cursorfacid]))) {
198 $addwarning = 1;
199 $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
200 }
201 // Check date
202 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
203 $langs->load("errors");
204 //$error++;
205 setEventMessages($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye, 'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), null, 'warnings');
206 }
207 }
208
209 $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key));
210 } elseif (substr($key, 0, 21) == 'multicurrency_amount_') {
211 $cursorfacid = (int) substr($key, 21);
212 $multicurrency_amounts[$cursorfacid] = (GETPOST($key) ? price2num(GETPOST($key)) : 0);
213 $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
214 if (!empty($multicurrency_amounts[$cursorfacid])) {
215 $atleastonepaymentnotnull++;
216 }
217 $result = $tmpinvoice->fetch($cursorfacid);
218 if ($result <= 0) {
220 }
221 $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
222 if ($multicurrency_amounts[$cursorfacid]) {
223 // Check amount
224 if ((abs((float) $multicurrency_amounts[$cursorfacid]) > abs((float) $multicurrency_amountsresttopay[$cursorfacid]))) {
225 $addwarning = 1;
226 $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
227 }
228 // Check date
229 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
230 $langs->load("errors");
231 //$error++;
232 setEventMessages($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye, 'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), null, 'warnings');
233 }
234 }
235
236 $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOSTFLOAT($key));
237 }
238 }
239
240 // Check parameters
241 if (GETPOST('paiementid') <= 0) {
242 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('PaymentMode')), null, 'errors');
243 $error++;
244 }
245
246 if (isModEnabled("bank")) {
247 // If bank module is on, account is required to enter a payment
248 if (GETPOST('accountid') <= 0) {
249 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('AccountToCredit')), null, 'errors');
250 $error++;
251 }
252 }
253
254 if (empty($totalpayment) && empty($multicurrency_totalpayment) && empty($atleastonepaymentnotnull)) {
255 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->trans('PaymentAmount')), null, 'errors');
256 $error++;
257 }
258
259 if (empty($datepaye)) {
260 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
261 $error++;
262 }
263
264 // Check if payments in both currency
265 if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
266 setEventMessages($langs->transnoentities('ErrorPaymentInBothCurrency'), null, 'errors');
267 $error++;
268 }
269 }
270
271 /*
272 * Action add_paiement
273 */
274 if ($action == 'add_paiement') { // Test on permission not required
275 if ($error) {
276 $action = 'create';
277 }
278 // All the next of this action is displayed at the page's bottom.
279 }
280
281
282 /*
283 * Action confirm_paiement
284 */
285 if ($action == 'confirm_paiement' && $confirm == 'yes' && $permissiontoadd) {
286 $datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
287
288 $multicurrency_code = array();
289 $multicurrency_tx = array();
290
291 // Clean parameters amount if payment is for a credit note
292 foreach ($amounts as $key => $value) { // How payment is dispatched
293 $tmpinvoice = new FactureFournisseur($db);
294 $tmpinvoice->fetch($key);
295 if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
296 $newvalue = price2num($value, 'MT');
297 $amounts[$key] = - abs((float) $newvalue);
298 }
299 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
300 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
301 }
302
303 foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
304 $tmpinvoice = new FactureFournisseur($db);
305 $tmpinvoice->fetch($key);
306 if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
307 $newvalue = price2num($value, 'MT');
308 $multicurrency_amounts[$key] = - abs((float) $newvalue);
309 }
310 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
311 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
312 }
313
314 if (!$error) {
315 $db->begin();
316
317 $thirdparty = new Societe($db);
318 if ($socid > 0) {
319 $thirdparty->fetch($socid);
320 }
321
322 // Creation of payment line
323 $paiement = new PaiementFourn($db);
324 $paiement->datepaye = $datepaye;
325
326 $correctedAmounts = [];
327 foreach ($amounts as $key => $value) {
328 $correctedAmounts[$key] = (float) $value;
329 }
330
331 $paiement->amounts = $correctedAmounts; // Array of amounts
332 $paiement->multicurrency_amounts = $multicurrency_amounts;
333 $paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
334 $paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
335 $paiement->paiementid = GETPOSTINT('paiementid');
336 $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml');
337 $paiement->note_private = GETPOST('comment', 'alpha');
338 $paiement->fk_account = GETPOSTINT('accountid');
339
340 // Create payment and update this->multicurrency_amounts if this->amounts filled or
341 // this->amounts if this->multicurrency_amounts filled.
342 // This also set ->amount and ->multicurrency_amount
343 $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty);
344 if ($paiement_id < 0) {
345 setEventMessages($paiement->error, $paiement->errors, 'errors');
346 $error++;
347 }
348
349 if (!$error) {
350 $result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, GETPOST('chqemetteur'), GETPOST('chqbank'));
351 if ($result < 0) {
352 setEventMessages($paiement->error, $paiement->errors, 'errors');
353 $error++;
354 }
355 }
356
357 if (!$error) {
358 $db->commit();
359
360 // If payment dispatching on more than one invoice, we stay on summary page, otherwise go on invoice card
361 $invoiceid = 0;
362 foreach ($paiement->amounts as $key => $amount) {
363 $facid = $key;
364 if (is_numeric($amount) && $amount != 0) {
365 if ($invoiceid != 0) {
366 $invoiceid = -1; // There is more than one invoice paid by this payment
367 } else {
368 $invoiceid = $facid;
369 }
370 }
371 }
372 if ($invoiceid > 0) {
373 $loc = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$invoiceid;
374 } else {
375 $loc = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$paiement_id;
376 }
377 header('Location: '.$loc);
378 exit;
379 } else {
380 $db->rollback();
381 }
382 }
383 }
384}
385
386
387/*
388 * View
389 */
390
391$form = new Form($db);
392$formother = new FormOther($db);
393
394$supplierstatic = new Societe($db);
395$invoicesupplierstatic = new FactureFournisseur($db);
396
397llxHeader('', $langs->trans('ListPayment'), '', '', 0, 0, '', '', '', 'mod-fourn-facture page-paiement');
398
399if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement') {
401 $result = $object->fetch($facid);
402
403 $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
404 $dateinvoice = ($datefacture == '' ? (getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1) : $datefacture);
405
406 $sql = 'SELECT s.nom as name, s.rowid as socid,';
407 $sql .= ' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
408 if (!$user->hasRight("societe", "client", "voir") && !$socid) {
409 $sql .= ", sc.fk_soc, sc.fk_user ";
410 }
411 $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f';
412 if (!$user->hasRight("societe", "client", "voir") && !$socid) {
413 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
414 }
415 $sql .= ' WHERE f.fk_soc = s.rowid';
416 $sql .= ' AND f.rowid = '.((int) $facid);
417 if (!$user->hasRight("societe", "client", "voir") && !$socid) {
418 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
419 }
420 $resql = $db->query($sql);
421 if ($resql) {
422 $totalnboflines = $num = $db->num_rows($resql);
423 if ($num) {
424 $obj = $db->fetch_object($resql);
425 $total = $obj->total;
426
427 print load_fiche_titre($langs->trans('DoPayment'));
428
429 // Add realtime total information
430 if (!empty($conf->use_javascript_ajax)) {
431 print "\n".'<script type="text/javascript">';
432 print '$(document).ready(function () {
433
434 function _elemToJson(selector)
435 {
436 var subJson = {};
437 $.map(selector.serializeArray(), function(n,i)
438 {
439 subJson[n["name"]] = n["value"];
440 });
441
442 return subJson;
443 }
444 function callForResult(imgId)
445 {
446 console.log("callForResult Calculate total of payment");
447 var json = {};
448 var form = $("#payment_form");
449
450 json["invoice_type"] = $("#invoice_type").val();
451 json["amountPayment"] = $("#amountpayment").attr("value");
452 json["amounts"] = _elemToJson(form.find("input.amount"));
453 json["remains"] = _elemToJson(form.find("input.remain"));
454 json["token"] = "'.currentToken().'";
455 if (imgId != null) {
456 json["imgClicked"] = imgId;
457 }
458
459 $.post("'.DOL_URL_ROOT.'/compta/ajaxpayment.php", json, function(data)
460 {
461 json = $.parseJSON(data);
462
463 form.data(json);
464
465 for (var key in json)
466 {
467 if (key == "result") {
468 if (json["makeRed"]) {
469 $("#"+key).addClass("error");
470 } else {
471 $("#"+key).removeClass("error");
472 }
473 json[key]=json["label"]+" "+json[key];
474 $("#"+key).text(json[key]);
475 } else {console.log(key);
476 form.find("input[name*=\""+key+"\"]").each(function() {
477 $(this).attr("value", json[key]);
478 });
479 }
480 }
481 });
482 }
483 callForResult();
484 $("#payment_form").find("input.amount").change(function() {
485 callForResult();
486 });
487 $("#payment_form").find("input.amount").keyup(function() {
488 callForResult();
489 });
490 ';
491
492 print ' });'."\n";
493
494 //Add js for AutoFill
495 print ' $(document).ready(function () {';
496 print ' $(".AutoFillAmount").on(\'click touchstart\', function(e){
497 e.preventDefault();
498 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change");
499 });';
500 print ' });'."\n";
501
502 print ' </script>'."\n";
503 }
504
505 print '<form id="payment_form" name="addpaiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
506 print '<input type="hidden" name="token" value="'.newToken().'">';
507 print '<input type="hidden" name="action" value="add_paiement">';
508 print '<input type="hidden" name="display-all-invoices" value="'.(int) $displayAllInvoices.'">';
509 print '<input type="hidden" name="facid" value="'.$facid.'">';
510 print '<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.'">';
511 print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
512 print '<input type="hidden" name="type" id="invoice_type" value="'.$object->type.'">';
513 print '<input type="hidden" name="societe" value="'.$obj->name.'">';
514
515 print dol_get_fiche_head([]);
516
517 print '<table class="border centpercent">';
518
519 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans('Company').'</td><td>';
520 $supplierstatic->id = $obj->socid;
521 $supplierstatic->name = $obj->name;
522 print $supplierstatic->getNomUrl(1, 'supplier');
523 print '</td></tr>';
524
525 print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
526 // $object is default vendor invoice
527 $adddateof = array(array('adddateof' => $object->date));
528 $adddateof[] = array('adddateof' => $object->date_echeance, 'labeladddateof' => $langs->transnoentities('DateDue'));
529 print $form->selectDate($dateinvoice, '', 0, 0, 0, "addpaiement", 1, 1, 0, '', '', $adddateof);
530 print '</td></tr>';
531 print '<tr><td class="fieldrequired">'.$langs->trans('PaymentMode').'</td><td>';
532 $form->select_types_paiements(!GETPOST('paiementid') ? $obj->fk_mode_reglement : GETPOST('paiementid'), 'paiementid');
533 print '</td>';
534 if (isModEnabled("bank")) {
535 print '<tr><td class="fieldrequired">'.$langs->trans('Account').'</td><td>';
536 print img_picto('', 'bank_account', 'class="pictofixedwidth"');
537 print $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1);
538 print '</td></tr>';
539 } else {
540 print '<tr><td>&nbsp;</td></tr>';
541 }
542 print '<tr><td>'.$langs->trans('Numero').'</td><td><input name="num_paiement" type="text" value="'.(!GETPOST('num_paiement') ? '' : GETPOST('num_paiement')).'"></td></tr>';
543 print '<tr><td>'.$langs->trans('Comments').'</td>';
544 print '<td class="tdtop">';
545 print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(!GETPOST('comment') ? '' : GETPOST('comment')).'</textarea></td></tr>';
546 print '</table>';
547 print dol_get_fiche_end();
548
549 $parameters = array(
550 'facid' => $facid,
551 'ref' => $obj->ref
552 );
553 $reshook = $hookmanager->executeHooks('paymentsupplierinvoices', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
554 $error = $hookmanager->error;
555 $errors = $hookmanager->errors;
556 if (empty($reshook)) {
557 /*
558 * All unpaid supplier invoices
559 */
560 $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
561 $sql .= ' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
562 $sql .= ' f.datef as df, f.date_lim_reglement as dlr,';
563 $sql .= ' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
564 $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
565 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
566 $sql .= ' WHERE f.entity = '.((int) $conf->entity);
567 $sql .= ' AND (f.fk_soc = '.((int) $object->socid);
568 $aux = $object->fetch_thirdparty();
569 // Can pay invoices of all child of parent company
570 if (getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') && !empty($object->thirdparty->parent)) {
571 $sql .= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.((int) $object->thirdparty->parent).')';
572 }
573 // Can pay invoices of all child of myself
574 if (getDolGlobalString('FACTURE_PAYMENTS_ON_SUBSIDIARY_COMPANIES')) {
575 $sql .= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.((int) $object->thirdparty->id).')';
576 }
577 $sql .= ') AND f.paye = 0';
578 $sql .= ' AND f.fk_statut = 1'; // Status=0 => unvalidated, Status=2 => canceled
579
580 if (!$displayAllInvoices) {
582 $sql .= ' AND f.type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation
583 } else {
584 $sql .= ' AND f.type = 2'; // If paying back a credit note, we show all credit notes
585 }
586 }
587
588 // Group by because we have a total
589 $sql .= ' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
590 $sql .= ' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
591 $sql .= ' f.datef, f.date_lim_reglement';
592 // Sort invoices by date and serial number: the older one comes first
593 $sql .= ' ORDER BY f.datef ASC, f.ref ASC';
594
595 $resql = $db->query($sql);
596 if ($resql) {
597 $num = $db->num_rows($resql);
598 if ($num > 0) {
599 $i = 0;
600 print '<br>';
601
602 if (!empty($conf->use_javascript_ajax)) {
603 //Add js for AutoFill
604 print "\n".'<script type="text/javascript">';
605 print ' $(document).ready(function () {';
606 print ' $(".AutoFillAmount").on(\'click touchstart\', function(e){
607 e.preventDefault();
608 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
609 });';
610 print ' });'."\n";
611 print ' </script>'."\n";
612 }
613
614 $moreHtmlRight = '';
615 if ($action == 'create') {
616 $urlToggleDisplayMod = $_SERVER["PHP_SELF"].'?facid='.((int) $facid).'&action='.urlencode($action).'&accountid='.((int) $accountid).'&display-all-invoices=' . (intval(!$displayAllInvoices));
617
618 if (empty($displayAllInvoices)) {
619 $btnTitle = $langs->trans('DisplayOtherInvoicesToo');
621 $btnTitle = $langs->trans('DisplayCreditNotesToo');
622 }
623 } else {
624 $btnTitle = $langs->trans('HideOtherInvoices');
626 $btnTitle = $langs->trans('HideCreditNotes');
627 }
628 }
629
630 $btnIcon = empty($displayAllInvoices) ? 'fa fa-eye' : 'fa fa-eye-slash';
631 $moreHtmlRight.= dolGetButtonTitle($btnTitle, '', $btnIcon, $urlToggleDisplayMod);
632 }
633
634 print_barre_liste($langs->trans('Invoices'), 0, $_SERVER["PHP_SELF"], '', '', '', '', $num, $totalnboflines, 'bill', 0, $moreHtmlRight, '', 0, 0, 0, 1);
635
636
637 print '<div class="div-table-responsive-no-min">';
638 print '<table id="fourn-invoices-paiments-list" data-display-all-invoices="' . (int) $displayAllInvoices . '" class="tagtable liste" >'."\n";
639 print '<thead>';
640 print '<tr class="liste_titre">';
641 print '<th>'.$langs->trans('Invoice').'</th>';
642 //print '<th>'.$langs->trans('RefSupplier').'</th>';
643 if ($displayAllInvoices) {
644 print '<th class="center">' . $langs->trans('Type') . '</th>';
645 }
646 print '<th class="center">'.$langs->trans('Date').'</th>';
647 print '<th class="center">'.$langs->trans('DateMaxPayment').'</th>';
648 if (isModEnabled("multicurrency")) {
649 $langs->load("multicurrency");
650 $labeltoshow = '<span class="small nowraponall">'.$langs->trans("MulticurrencyOriginalCurrency").'</span>';
651 print '<th>'.$langs->trans('Currency').'</th>';
652 print '<th class="right">'.$langs->trans('AmountTTC').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
653 print '<th class="right">'.$langs->trans('AlreadyPaid').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
654 print '<th class="right">'.$langs->trans('RemainderToPay').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
655 print '<th class="center">'.$langs->trans('PaymentAmount').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
656 }
657 print '<th class="right">'.$langs->trans('AmountTTC').'</th>';
658 print '<th class="right">'.$langs->trans('AlreadyPaid').'</th>';
659 print '<th class="right">'.$langs->trans('RemainderToPay').'</th>';
660 print '<th class="center">'.$langs->trans('PaymentAmount').'</th>';
661 print '</tr>';
662 print '</thead>';
663
664 print '<tbody>';
665 $total = 0;
666 $total_ttc = 0;
667 $totalrecu = 0;
668 $totalrecucreditnote = 0; // PHP Warning: Undefined variable $totalrecucreditnote
669 $totalrecudeposits = 0; // PHP Warning: Undefined variable $totalrecudeposits
670 while ($i < $num) {
671 $objp = $db->fetch_object($resql);
672
673 $sign = 1;
674 if ($objp->type == FactureFournisseur::TYPE_CREDIT_NOTE && !$displayAllInvoices) {
675 $sign = -1;
676 }
677
678 $invoice = new FactureFournisseur($db);
679 $invoice->fetch($objp->facid);
680
681 $invoicesupplierstatic->ref = $objp->ref;
682 $invoicesupplierstatic->id = $objp->facid;
683
684 $paiement = $invoice->getSommePaiement();
685 $creditnotes = $invoice->getSumCreditNotesUsed();
686 $deposits = $invoice->getSumDepositsUsed();
687 $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
688 $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
689
690 // Multicurrency Price
691 $multicurrency_payment = 0;
692 $multicurrency_creditnotes = 0;
693 $multicurrency_deposits = 0;
694 $multicurrency_remaintopay = 0;
695 if (isModEnabled("multicurrency")) {
696 $multicurrency_payment = $invoice->getSommePaiement(1);
697 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
698 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
699 $multicurrency_alreadypayed = price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits, 'MT');
700 $multicurrency_remaintopay = price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT');
701 }
702
703 print '<tr data-row-type="'.$objp->type.'" class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
704
705 // Ref
706 print '<td data-col="object-name" class="nowraponall">';
707 print '<div class="inline-block lineheightsmall">';
708 print $invoicesupplierstatic->getNomUrl(1);
709 print '<br><span class="opacitymedium small" title="'.$langs->trans("RefSupplier").'">';
710 print dolPrintHTML($objp->ref_supplier);
711 print '</span>';
712 print '</div>';
713 print '</td>';
714
715 // Ref supplier
716 //print '<td data-col="ref-supplier" >'.$objp->ref_supplier.'</td>';
717
718 // type
719 if ($displayAllInvoices) {
720 $typearray = [
721 FactureFournisseur::TYPE_STANDARD => $langs->trans("InvoiceStandard"),
722 FactureFournisseur::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"),
723 FactureFournisseur::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"),
724 FactureFournisseur::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"),
725 ];
726 // Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9
727 print '<td class="center nowraponall">' . $typearray[$objp->type] . '</td>';
728 }
729
730 // Date
731 if ($objp->df > 0) {
732 print '<td data-col="datef" data-col-value="'.$db->jdate($objp->df).'" class="center nowraponall">';
733 print dol_print_date($db->jdate($objp->df), 'day').'</td>';
734 } else {
735 print '<td data-col="datef" data-col-value="" class="center"><b>!!!</b></td>';
736 }
737
738 // Date Max Payment
739 if ($objp->dlr > 0) {
740 print '<td data-col="dater" data-col-value="'.$db->jdate($objp->dlr).'" class="center nowraponall">';
741 print dol_print_date($db->jdate($objp->dlr), 'day');
742
743 if ($invoice->hasDelay()) {
744 print img_warning($langs->trans('Late'));
745 }
746
747 print '</td>';
748 } else {
749 print '<td data-col="dater" data-col-value="" class="center"><b>--</b></td>';
750 }
751
752 // Multicurrency
753 if (isModEnabled("multicurrency")) {
754 // Currency
755 print '<td data-col="multicurrency-code" class="center">'.$objp->multicurrency_code."</td>\n";
756
757 print '<td data-col="multicurrency-total-ttc" class="right">';
758 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
759 print price($objp->multicurrency_total_ttc);
760 }
761 print '</td>';
762
763 print '<td data-col="multicurrency-payment" class="right">';
764 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
765 print price($sign * $multicurrency_payment);
766 if ($multicurrency_creditnotes) {
767 print '+'.price($multicurrency_creditnotes);
768 }
769 if ($multicurrency_deposits) {
770 print '+'.price($multicurrency_deposits);
771 }
772 }
773 print '</td>';
774
775 print '<td data-col="remain-to-pay" class="right">';
776 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
777 print price($sign * (float) $multicurrency_remaintopay);
778 }
779 print '</td>';
780
781 print '<td data-col="remain-to-pay-multicurrency-amount" class="right">';
782 // Add remind multicurrency amount
783 $namef = 'multicurrency_amount_'.$objp->facid;
784 $nameRemain = 'multicurrency_remain_'.$objp->facid;
785
786 $min = $max = '';
787 if ($displayAllInvoices) {
788 if ($objp->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
789 $max = ' max="0" ';
790 } else {
791 $min = ' min="0" ';
792 }
793 }
794
795 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
796 if ($action != 'add_paiement') {
797 if (!empty($conf->use_javascript_ajax)) {
798 print '<button class="btn-low-emphasis --btn-icon AutoFillAmount" data-rowname="'.$namef.'" data-value="'.($sign * (float) $multicurrency_remaintopay).'">';
799 print img_picto("Auto fill", 'rightarrow.png');
800 print '</button>';
801 }
802 print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
803 print '<input '.$min.' '.$max.' type="text" class="multicurrency_amount width100" name="'.$namef.'" value="'.GETPOST($namef).'">';
804 } else {
805 print '<input type="text" class="width100" name="'.$namef.'_disabled" value="'.GETPOST($namef).'" disabled>';
806 print '<input type="hidden" name="'.$namef.'" value="'.GETPOST($namef).'">';
807 }
808 }
809 print "</td>";
810 }
811
812 print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
813
814 print '<td class="right">'.price($sign * $objp->am);
815 if ($creditnotes) {
816 print '+'.price($creditnotes);
817 }
818 if ($deposits) {
819 print '+'.price($deposits);
820 }
821 print '</td>';
822
823 print '<td class="right">';
824 print price($sign * (float) $remaintopay);
825 if (isModEnabled('paymentbybanktransfer')) {
826 $numdirectdebitopen = 0;
827 $totaldirectdebit = 0;
828 $sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
829 $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
830 $sql .= " WHERE fk_facture_fourn = ".((int) $objp->facid);
831 $sql .= " AND pfd.traite = 0";
832 $sql .= " AND pfd.ext_payment_id IS NULL";
833
834 $result_sql = $db->query($sql);
835 if ($result_sql) {
836 $obj = $db->fetch_object($result_sql);
837 $numdirectdebitopen = $obj->nb;
838 $totaldirectdebit = $obj->amount;
839 } else {
841 }
842 if ($numdirectdebitopen) {
843 $langs->load("withdrawals");
844 print img_warning($langs->trans("WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen, price(price2num($totaldirectdebit, 'MT'), 0, $langs, 1, -1, -1, $conf->currency)), '', 'classfortooltip');
845 }
846 }
847 print '</td>';
848
849 // Amount
850 print '<td class="center nowraponall">';
851
852 $namef = 'amount_'.$objp->facid;
853 $nameRemain = 'remain_'.$objp->facid;
854
855 $min = $max = '';
856 if ($displayAllInvoices) {
857 if ($objp->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
858 $max = ' max="0" ';
859 } else {
860 $min = ' min="0" ';
861 }
862 }
863
864 if ($action != 'add_paiement') {
865 if (!empty($conf->use_javascript_ajax)) {
866 print '<button class="btn-low-emphasis --btn-icon AutoFillAmount" data-rowname="'.$namef.'" data-value="'.($sign * (float) $remaintopay).'">';
867 print img_picto("Auto fill", 'rightarrow.png');
868 print '</button>';
869 }
870 print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
871 print '<input '.$max.' '.$min.' type="text" class="amount width100" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is required to be used by javascript callForResult();
872 } else {
873 print '<input type="text" class="width100" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
874 print '<input type="hidden" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is required to be used by javascript callForResult();
875 }
876 print "</td>";
877
878 print "</tr>\n";
879 $total += $objp->total_ht;
880 $total_ttc += $objp->total_ttc;
881 $totalrecu += $objp->am;
882 $totalrecucreditnote += $creditnotes;
883 $totalrecudeposits += $deposits;
884 $i++;
885 }
886 //print '</tbody>';
887
888 if ($i > 1) {
889 //print '<tfoot>';
890
891 // Print total
892 print '<tr class="liste_total">';
893 $colspan = 3;
894
895 // type
896 if ($displayAllInvoices) {
897 $colspan++;
898 }
899
900 print '<td colspan="'.$colspan.'" class="left" scope="row">'.$langs->trans('TotalTTC').':</td>';
901 if (isModEnabled("multicurrency")) {
902 print '<td>&nbsp;</td>';
903 print '<td>&nbsp;</td>';
904 print '<td>&nbsp;</td>';
905 print '<td>&nbsp;</td>';
906 print '<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
907 }
908 print '<td class="right"><b>'.price($total_ttc).'</b></td>';
909 print '<td class="right"><b>'.price($totalrecu);
910 if ($totalrecucreditnote) {
911 print '+'.price($totalrecucreditnote);
912 }
913 if ($totalrecudeposits) {
914 print '+'.price($totalrecudeposits);
915 }
916 print '</b></td>';
917 print '<td class="right"><b>'.price((float) price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>';
918 print '<td class="center" id="result" style="font-weight: bold;"></td>'; // Autofilled
919 print "</tr>\n";
920 //print '</tfoot>';
921 }
922 print '</tbody>';
923
924 print "</table>\n";
925
926 print "</div>";
927 }
928 $db->free($resql);
929 } else {
931 }
932 }
933
934 // Save + Cancel Buttons
935 if ($action != 'add_paiement') {
936 print '<br><div class="center">';
937 print '<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices" class="marginrightonly"><label for="closepaidinvoices" class="opacitymedium">'.$langs->trans("ClosePaidInvoicesAutomatically").'</label><br>';
938 print '<input type="submit" class="button" value="'.$langs->trans('ToMakePayment').'">';
939 print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
940 print '</div>';
941 }
942
943 // Form to confirm payment
944 if ($action == 'add_paiement') {
945 $preselectedchoice = $addwarning ? 'no' : 'yes';
946
947 print '<br>';
948 $text = '';
949 if (!empty($totalpayment)) {
950 $text = $langs->trans('ConfirmSupplierPayment', price($totalpayment), $langs->transnoentitiesnoconv("Currency".$conf->currency));
951 }
952 if (!empty($multicurrency_totalpayment)) {
953 $text .= '<br>'.$langs->trans('ConfirmSupplierPayment', price($multicurrency_totalpayment), $langs->transnoentitiesnoconv("paymentInInvoiceCurrency"));
954 }
955 if (GETPOST('closepaidinvoices')) {
956 $text .= '<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");
957 print '<input type="hidden" name="closepaidinvoices" value="'.GETPOST('closepaidinvoices').'">';
958 }
959 print $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id.'&socid='.$object->socid.'&type='.$object->type, $langs->trans('PayedSuppliersPayments'), $text, 'confirm_paiement', $formquestion, $preselectedchoice);
960 }
961
962 print '</form>';
963 }
964 } else {
966 }
967}
968
969// End of page
970llxFooter();
971$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class to manage standard extra fields.
Class to manage suppliers invoices.
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
const TYPE_REPLACEMENT
Replacement invoice.
const TYPE_STANDARD
Standard invoice.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Class to manage payments for supplier invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
Definition receipt.php:487