dolibarr 24.0.1
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// Check the user is allowed on the supplier invoice this payment page is opened for. Same check as
130// compta/paiement.php does for customer invoices, and as fourn/facture/card.php does for this object.
131// Without it, the page displays and lets a payment be posted on any supplier invoice of any third
132// party, since FactureFournisseur::fetch() does not filter on the entity nor on the assigned customers.
133$invoicetocheck = new FactureFournisseur($db);
134if ($facid > 0 && $invoicetocheck->fetch($facid) > 0) {
135 restrictedArea($user, 'fournisseur', $invoicetocheck->id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', (($invoicetocheck->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0));
136}
137
138
139/*
140 * Actions
141 */
142$error = 0;
143
144if ($cancel) {
145 if (!empty($backtopageforcancel)) {
146 header("Location: ".$backtopageforcancel);
147 exit;
148 } elseif (!empty($backtopage)) {
149 header("Location: ".$backtopage);
150 exit;
151 }
152 header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php');
153 exit;
154}
155
156if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
157 $search_ref = "";
158 $search_account = "";
159 $search_amount = "";
160 $search_paymenttype = "";
161 $search_payment_num = "";
162 $search_company = "";
163 $day = '';
164 $year = '';
165 $month = '';
166 $search_array_options = array();
167}
168
169$parameters = array('socid' => $socid);
170$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
171if ($reshook < 0) {
172 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
173}
174
175$formquestion = array();
176if (empty($reshook)) {
177 if (($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $permissiontoadd) {
178 $datepaye = GETPOSTDATE('re', '12:00:00');
179 $paiement_id = 0;
180 $totalpayment = 0;
181 $atleastonepaymentnotnull = 0;
182 $multicurrency_totalpayment = 0;
183
184 // Generate payment array and check if there is payment higher than invoice and payment date before invoice date
185 $tmpinvoice = new FactureFournisseur($db);
186 $i = 0;
187 foreach ($_POST as $key => $value) {
188 if (substr($key, 0, 7) == 'amount_') {
189 $cursorfacid = (int) substr($key, 7);
190 $amounts[$cursorfacid] = price2num(GETPOST($key));
191 if (!empty($amounts[$cursorfacid])) {
192 $atleastonepaymentnotnull++;
193 if (is_numeric($amounts[$cursorfacid])) {
194 $totalpayment += (float) $amounts[$cursorfacid];
195 } else {
196 setEventMessages($langs->transnoentities("InputValueIsNotAnNumber", GETPOST($key)), null, 'warnings');
197 }
198 }
199 $result = $tmpinvoice->fetch($cursorfacid);
200 if ($result <= 0) {
202 }
203 // The id comes from the name of a POST field, so it can name an invoice other than $facid
204 restrictedArea($user, 'fournisseur', $tmpinvoice->id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', (($tmpinvoice->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0));
205 $amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
206 if ($amounts[$cursorfacid]) {
207 // Check amount
208 if ((abs((float) $amounts[$cursorfacid]) > abs((float) $amountsresttopay[$cursorfacid]))) {
209 $addwarning = 1;
210 $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
211 }
212 // Check date
213 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
214 $langs->load("errors");
215 //$error++;
216 setEventMessages($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye, 'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), null, 'warnings');
217 }
218 }
219
220 $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key));
221 } elseif (substr($key, 0, 21) == 'multicurrency_amount_') {
222 $cursorfacid = (int) substr($key, 21);
223 $multicurrency_amounts[$cursorfacid] = (GETPOST($key) ? price2num(GETPOST($key)) : 0);
224 $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
225 if (!empty($multicurrency_amounts[$cursorfacid])) {
226 $atleastonepaymentnotnull++;
227 }
228 $result = $tmpinvoice->fetch($cursorfacid);
229 if ($result <= 0) {
231 }
232 // The id comes from the name of a POST field, so it can name an invoice other than $facid
233 restrictedArea($user, 'fournisseur', $tmpinvoice->id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', (($tmpinvoice->status == FactureFournisseur::STATUS_DRAFT) ? 1 : 0));
234 $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
235 if ($multicurrency_amounts[$cursorfacid]) {
236 // Check amount
237 if ((abs((float) $multicurrency_amounts[$cursorfacid]) > abs((float) $multicurrency_amountsresttopay[$cursorfacid]))) {
238 $addwarning = 1;
239 $formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
240 }
241 // Check date
242 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
243 $langs->load("errors");
244 //$error++;
245 setEventMessages($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye, 'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), null, 'warnings');
246 }
247 }
248
249 $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOSTFLOAT($key));
250 }
251 }
252
253 // Check parameters
254 if (GETPOST('paiementid') <= 0) {
255 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('PaymentMode')), null, 'errors');
256 $error++;
257 }
258
259 if (isModEnabled("bank")) {
260 // If bank module is on, account is required to enter a payment
261 if (GETPOST('accountid') <= 0) {
262 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('AccountToCredit')), null, 'errors');
263 $error++;
264 }
265 }
266
267 if (empty($totalpayment) && empty($multicurrency_totalpayment) && empty($atleastonepaymentnotnull)) {
268 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->trans('PaymentAmount')), null, 'errors');
269 $error++;
270 }
271
272 if (empty($datepaye)) {
273 setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
274 $error++;
275 }
276
277 // Check if payments in both currency
278 if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
279 setEventMessages($langs->transnoentities('ErrorPaymentInBothCurrency'), null, 'errors');
280 $error++;
281 }
282 }
283
284 /*
285 * Action add_paiement
286 */
287 if ($action == 'add_paiement') { // Test on permission not required
288 if ($error) {
289 $action = 'create';
290 }
291 // All the next of this action is displayed at the page's bottom.
292 }
293
294
295 /*
296 * Action confirm_paiement
297 */
298 if ($action == 'confirm_paiement' && $confirm == 'yes' && $permissiontoadd) {
299 $datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
300
301 $multicurrency_code = array();
302 $multicurrency_tx = array();
303
304 // Clean parameters amount if payment is for a credit note
305 foreach ($amounts as $key => $value) { // How payment is dispatched
306 $tmpinvoice = new FactureFournisseur($db);
307 $tmpinvoice->fetch($key);
308 if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
309 $newvalue = price2num($value, 'MT');
310 $amounts[$key] = - abs((float) $newvalue);
311 }
312 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
313 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
314 }
315
316 foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
317 $tmpinvoice = new FactureFournisseur($db);
318 $tmpinvoice->fetch($key);
319 if ($tmpinvoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
320 $newvalue = price2num($value, 'MT');
321 $multicurrency_amounts[$key] = - abs((float) $newvalue);
322 }
323 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
324 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
325 }
326
327 if (!$error) {
328 $db->begin();
329
330 $thirdparty = new Societe($db);
331 if ($socid > 0) {
332 $thirdparty->fetch($socid);
333 }
334
335 // Creation of payment line
336 $paiement = new PaiementFourn($db);
337 $paiement->datepaye = $datepaye;
338
339 $correctedAmounts = [];
340 foreach ($amounts as $key => $value) {
341 $correctedAmounts[$key] = (float) $value;
342 }
343
344 $paiement->amounts = $correctedAmounts; // Array of amounts
345 $paiement->multicurrency_amounts = $multicurrency_amounts;
346 $paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
347 $paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
348 $paiement->paiementid = GETPOSTINT('paiementid');
349 $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml');
350 $paiement->note_private = GETPOST('comment', 'alpha');
351 $paiement->fk_account = GETPOSTINT('accountid');
352
353 // Create payment and update this->multicurrency_amounts if this->amounts filled or
354 // this->amounts if this->multicurrency_amounts filled.
355 // This also set ->amount and ->multicurrency_amount
356 $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty);
357 if ($paiement_id < 0) {
358 setEventMessages($paiement->error, $paiement->errors, 'errors');
359 $error++;
360 }
361
362 if (!$error) {
363 $result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, GETPOST('chqemetteur'), GETPOST('chqbank'));
364 if ($result < 0) {
365 setEventMessages($paiement->error, $paiement->errors, 'errors');
366 $error++;
367 }
368 }
369
370 if (!$error) {
371 $db->commit();
372
373 // If payment dispatching on more than one invoice, we stay on summary page, otherwise go on invoice card
374 $invoiceid = 0;
375 foreach ($paiement->amounts as $key => $amount) {
376 $facid = $key;
377 if (is_numeric($amount) && $amount != 0) {
378 if ($invoiceid != 0) {
379 $invoiceid = -1; // There is more than one invoice paid by this payment
380 } else {
381 $invoiceid = $facid;
382 }
383 }
384 }
385 if ($invoiceid > 0) {
386 $loc = DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$invoiceid;
387 } else {
388 $loc = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$paiement_id;
389 }
390 header('Location: '.$loc);
391 exit;
392 } else {
393 $db->rollback();
394 }
395 }
396 }
397}
398
399
400/*
401 * View
402 */
403
404$form = new Form($db);
405$formother = new FormOther($db);
406
407$supplierstatic = new Societe($db);
408$invoicesupplierstatic = new FactureFournisseur($db);
409
410llxHeader('', $langs->trans('ListPayment'), '', '', 0, 0, '', '', '', 'mod-fourn-facture page-paiement');
411
412if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement') {
414 $result = $object->fetch($facid);
415
416 $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
417 $dateinvoice = ($datefacture == '' ? (getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1) : $datefacture);
418
419 $sql = 'SELECT s.nom as name, s.rowid as socid,';
420 $sql .= ' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
421 if (!$user->hasRight("societe", "client", "voir") && !$socid) {
422 $sql .= ", sc.fk_soc, sc.fk_user ";
423 }
424 $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f';
425 if (!$user->hasRight("societe", "client", "voir") && !$socid) {
426 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
427 }
428 $sql .= ' WHERE f.fk_soc = s.rowid';
429 $sql .= ' AND f.rowid = '.((int) $facid);
430 if (!$user->hasRight("societe", "client", "voir") && !$socid) {
431 $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
432 }
433 $resql = $db->query($sql);
434 if ($resql) {
435 $totalnboflines = $num = $db->num_rows($resql);
436 if ($num) {
437 $obj = $db->fetch_object($resql);
438 $total = $obj->total;
439
440 print load_fiche_titre($langs->trans('DoPayment'));
441
442 // Add realtime total information
443 if (!empty($conf->use_javascript_ajax)) {
444 print "\n".'<script type="text/javascript">';
445 print '$(document).ready(function () {
446
447 function _elemToJson(selector)
448 {
449 var subJson = {};
450 $.map(selector.serializeArray(), function(n,i)
451 {
452 subJson[n["name"]] = n["value"];
453 });
454
455 return subJson;
456 }
457 function callForResult(imgId)
458 {
459 console.log("callForResult Calculate total of payment");
460 var json = {};
461 var form = $("#payment_form");
462
463 json["invoice_type"] = $("#invoice_type").val();
464 json["amountPayment"] = $("#amountpayment").attr("value");
465 json["amounts"] = _elemToJson(form.find("input.amount"));
466 json["remains"] = _elemToJson(form.find("input.remain"));
467 json["token"] = "'.currentToken().'";
468 if (imgId != null) {
469 json["imgClicked"] = imgId;
470 }
471
472 $.post("'.DOL_URL_ROOT.'/compta/ajaxpayment.php", json, function(data)
473 {
474 json = $.parseJSON(data);
475
476 form.data(json);
477
478 for (var key in json)
479 {
480 if (key == "result") {
481 if (json["makeRed"]) {
482 $("#"+key).addClass("error");
483 } else {
484 $("#"+key).removeClass("error");
485 }
486 json[key]=json["label"]+" "+json[key];
487 $("#"+key).text(json[key]);
488 } else {console.log(key);
489 form.find("input[name*=\""+key+"\"]").each(function() {
490 $(this).attr("value", json[key]);
491 });
492 }
493 }
494 });
495 }
496 callForResult();
497 $("#payment_form").find("input.amount").change(function() {
498 callForResult();
499 });
500 $("#payment_form").find("input.amount").keyup(function() {
501 callForResult();
502 });
503 ';
504
505 print ' });'."\n";
506
507 //Add js for AutoFill
508 print ' $(document).ready(function () {';
509 print ' $(".AutoFillAmount").on(\'click touchstart\', function(e){
510 e.preventDefault();
511 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change");
512 });';
513 print ' });'."\n";
514
515 print ' </script>'."\n";
516 }
517
518 print '<form id="payment_form" name="addpaiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
519 print '<input type="hidden" name="token" value="'.newToken().'">';
520 print '<input type="hidden" name="action" value="add_paiement">';
521 print '<input type="hidden" name="display-all-invoices" value="'.(int) $displayAllInvoices.'">';
522 print '<input type="hidden" name="facid" value="'.$facid.'">';
523 print '<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.'">';
524 print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
525 print '<input type="hidden" name="type" id="invoice_type" value="'.$object->type.'">';
526 print '<input type="hidden" name="societe" value="'.$obj->name.'">';
527
528 print dol_get_fiche_head([]);
529
530 print '<table class="border centpercent">';
531
532 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans('Company').'</td><td>';
533 $supplierstatic->id = $obj->socid;
534 $supplierstatic->name = $obj->name;
535 print $supplierstatic->getNomUrl(1, 'supplier');
536 print '</td></tr>';
537
538 print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
539 // $object is default vendor invoice
540 $adddateof = array(array('adddateof' => $object->date));
541 $adddateof[] = array('adddateof' => $object->date_echeance, 'labeladddateof' => $langs->transnoentities('DateDue'));
542 print $form->selectDate($dateinvoice, '', 0, 0, 0, "addpaiement", 1, 1, 0, '', '', $adddateof);
543 print '</td></tr>';
544 print '<tr><td class="fieldrequired">'.$langs->trans('PaymentMode').'</td><td>';
545 $form->select_types_paiements(!GETPOST('paiementid') ? $obj->fk_mode_reglement : GETPOST('paiementid'), 'paiementid');
546 print '</td>';
547 if (isModEnabled("bank")) {
548 print '<tr><td class="fieldrequired">'.$langs->trans('Account').'</td><td>';
549 print img_picto('', 'bank_account', 'class="pictofixedwidth"');
550 print $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1);
551 print '</td></tr>';
552 } else {
553 print '<tr><td>&nbsp;</td></tr>';
554 }
555 print '<tr><td>'.$langs->trans('Numero').'</td><td><input name="num_paiement" type="text" value="'.(!GETPOST('num_paiement') ? '' : GETPOST('num_paiement')).'"></td></tr>';
556 print '<tr><td>'.$langs->trans('Comments').'</td>';
557 print '<td class="tdtop">';
558 print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(!GETPOST('comment') ? '' : GETPOST('comment')).'</textarea></td></tr>';
559 print '</table>';
560 print dol_get_fiche_end();
561
562 $parameters = array(
563 'facid' => $facid,
564 'ref' => $obj->ref
565 );
566 $reshook = $hookmanager->executeHooks('paymentsupplierinvoices', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
567 $error = $hookmanager->error;
568 $errors = $hookmanager->errors;
569 if (empty($reshook)) {
570 /*
571 * All unpaid supplier invoices
572 */
573 $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
574 $sql .= ' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
575 $sql .= ' f.datef as df, f.date_lim_reglement as dlr,';
576 $sql .= ' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
577 $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
578 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
579 $sql .= ' WHERE f.entity = '.((int) $conf->entity);
580 $sql .= ' AND (f.fk_soc = '.((int) $object->socid);
581 $aux = $object->fetch_thirdparty();
582 // Can pay invoices of all child of parent company
583 if (getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') && !empty($object->thirdparty->parent)) {
584 $sql .= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.((int) $object->thirdparty->parent).')';
585 }
586 // Can pay invoices of all child of myself
587 if (getDolGlobalString('FACTURE_PAYMENTS_ON_SUBSIDIARY_COMPANIES')) {
588 $sql .= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.((int) $object->thirdparty->id).')';
589 }
590 $sql .= ') AND f.paye = 0';
591 $sql .= ' AND f.fk_statut = 1'; // Status=0 => unvalidated, Status=2 => canceled
592
593 if (!$displayAllInvoices) {
595 $sql .= ' AND f.type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation
596 } else {
597 $sql .= ' AND f.type = 2'; // If paying back a credit note, we show all credit notes
598 }
599 }
600
601 // Group by because we have a total
602 $sql .= ' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
603 $sql .= ' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
604 $sql .= ' f.datef, f.date_lim_reglement';
605 // Sort invoices by date and serial number: the older one comes first
606 $sql .= ' ORDER BY f.datef ASC, f.ref ASC';
607
608 $resql = $db->query($sql);
609 if ($resql) {
610 $num = $db->num_rows($resql);
611 if ($num > 0) {
612 $i = 0;
613 print '<br>';
614
615 if (!empty($conf->use_javascript_ajax)) {
616 //Add js for AutoFill
617 print "\n".'<script type="text/javascript">';
618 print ' $(document).ready(function () {';
619 print ' $(".AutoFillAmount").on(\'click touchstart\', function(e){
620 e.preventDefault();
621 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
622 });';
623 print ' });'."\n";
624 print ' </script>'."\n";
625 }
626
627 $moreHtmlRight = '';
628 if ($action == 'create') {
629 $urlToggleDisplayMod = $_SERVER["PHP_SELF"].'?facid='.((int) $facid).'&action='.urlencode($action).'&accountid='.((int) $accountid).'&display-all-invoices=' . (intval(!$displayAllInvoices));
630
631 if (empty($displayAllInvoices)) {
632 $btnTitle = $langs->trans('DisplayOtherInvoicesToo');
634 $btnTitle = $langs->trans('DisplayCreditNotesToo');
635 }
636 } else {
637 $btnTitle = $langs->trans('HideOtherInvoices');
639 $btnTitle = $langs->trans('HideCreditNotes');
640 }
641 }
642
643 $btnIcon = empty($displayAllInvoices) ? 'fa fa-eye' : 'fa fa-eye-slash';
644 $moreHtmlRight.= dolGetButtonTitle($btnTitle, '', $btnIcon, $urlToggleDisplayMod);
645 }
646
647 print_barre_liste($langs->trans('Invoices'), 0, $_SERVER["PHP_SELF"], '', '', '', '', $num, $totalnboflines, 'bill', 0, $moreHtmlRight, '', 0, 0, 0, 1);
648
649
650 print '<div class="div-table-responsive-no-min">';
651 print '<table id="fourn-invoices-paiments-list" data-display-all-invoices="' . (int) $displayAllInvoices . '" class="tagtable liste" >'."\n";
652 print '<thead>';
653 print '<tr class="liste_titre">';
654 print '<th>'.$langs->trans('Invoice').'</th>';
655 //print '<th>'.$langs->trans('RefSupplier').'</th>';
656 if ($displayAllInvoices) {
657 print '<th class="center">' . $langs->trans('Type') . '</th>';
658 }
659 print '<th class="center">'.$langs->trans('Date').'</th>';
660 print '<th class="center">'.$langs->trans('DateDue').'</th>';
661 if (isModEnabled("multicurrency")) {
662 $langs->load("multicurrency");
663 $labeltoshow = '<span class="small nowraponall">'.$langs->trans("MulticurrencyOriginalCurrency").'</span>';
664 print '<th>'.$langs->trans('Currency').'</th>';
665 print '<th class="right">'.$langs->trans('AmountTTC').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
666 print '<th class="right">'.$langs->trans('AlreadyPaid').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
667 print '<th class="right">'.$langs->trans('RemainderToPay').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
668 print '<th class="center">'.$langs->trans('PaymentAmount').' <span class="opacitymedium">('.$labeltoshow.')</span></th>';
669 }
670 print '<th class="right">'.$langs->trans('AmountTTC').'</th>';
671 print '<th class="right">'.$langs->trans('AlreadyPaid').'</th>';
672 print '<th class="right">'.$langs->trans('RemainderToPay').'</th>';
673 print '<th class="center">'.$langs->trans('PaymentAmount').'</th>';
674 print '</tr>';
675 print '</thead>';
676
677 print '<tbody>';
678 $total = 0;
679 $total_ttc = 0;
680 $totalrecu = 0;
681 $totalrecucreditnote = 0; // PHP Warning: Undefined variable $totalrecucreditnote
682 $totalrecudeposits = 0; // PHP Warning: Undefined variable $totalrecudeposits
683 while ($i < $num) {
684 $objp = $db->fetch_object($resql);
685
686 $sign = 1;
687 if ($objp->type == FactureFournisseur::TYPE_CREDIT_NOTE && !$displayAllInvoices) {
688 $sign = -1;
689 }
690
691 $invoice = new FactureFournisseur($db);
692 $invoice->fetch($objp->facid);
693
694 $invoicesupplierstatic->ref = $objp->ref;
695 $invoicesupplierstatic->id = $objp->facid;
696
697 $paiement = $invoice->getSommePaiement();
698 $creditnotes = $invoice->getSumCreditNotesUsed();
699 $deposits = $invoice->getSumDepositsUsed();
700 $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
701 $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
702
703 // Multicurrency Price
704 $multicurrency_payment = 0;
705 $multicurrency_creditnotes = 0;
706 $multicurrency_deposits = 0;
707 $multicurrency_remaintopay = 0;
708 if (isModEnabled("multicurrency")) {
709 $multicurrency_payment = $invoice->getSommePaiement(1);
710 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
711 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
712 $multicurrency_alreadypayed = (float) price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits, 'MT');
713 $multicurrency_remaintopay = (float) price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT');
714 }
715
716 print '<tr data-row-type="'.$objp->type.'" class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
717
718 // Ref
719 print '<td data-col="object-name" class="nowraponall">';
720 print '<div class="inline-block lineheightsmall">';
721 print $invoicesupplierstatic->getNomUrl(1);
722 print '<br><span class="opacitymedium spantitle" title="'.$langs->trans("RefSupplier").'">';
723 print dolPrintHTML($objp->ref_supplier);
724 print '</span>';
725 print '</div>';
726 print '</td>';
727
728 // Ref supplier
729 //print '<td data-col="ref-supplier" >'.$objp->ref_supplier.'</td>';
730
731 // type
732 if ($displayAllInvoices) {
733 $typearray = [
734 FactureFournisseur::TYPE_STANDARD => $langs->trans("InvoiceStandard"),
735 FactureFournisseur::TYPE_REPLACEMENT => $langs->trans("InvoiceReplacement"),
736 FactureFournisseur::TYPE_CREDIT_NOTE => $langs->trans("InvoiceAvoir"),
737 FactureFournisseur::TYPE_DEPOSIT => $langs->trans("InvoiceDeposit"),
738 ];
739 // Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9
740 print '<td class="center nowraponall">' . $typearray[$objp->type] . '</td>';
741 }
742
743 // Date
744 if ($objp->df > 0) {
745 print '<td data-col="datef" data-col-value="'.$db->jdate($objp->df).'" class="center nowraponall">';
746 print dol_print_date($db->jdate($objp->df), 'day').'</td>';
747 } else {
748 print '<td data-col="datef" data-col-value="" class="center"><b>!!!</b></td>';
749 }
750
751 // Date Max Payment
752 if ($objp->dlr > 0) {
753 print '<td data-col="dater" data-col-value="'.$db->jdate($objp->dlr).'" class="center nowraponall">';
754 print dol_print_date($db->jdate($objp->dlr), 'day');
755
756 if ($invoice->hasDelay()) {
757 print img_warning($langs->trans('Late'));
758 }
759
760 print '</td>';
761 } else {
762 print '<td data-col="dater" data-col-value="" class="center"><b>--</b></td>';
763 }
764
765 // Multicurrency
766 if (isModEnabled("multicurrency")) {
767 // Currency
768 print '<td data-col="multicurrency-code" class="center">'.$objp->multicurrency_code."</td>\n";
769
770 print '<td data-col="multicurrency-total-ttc" class="right">';
771 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
772 print price($objp->multicurrency_total_ttc);
773 }
774 print '</td>';
775
776 print '<td data-col="multicurrency-payment" class="right">';
777 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
778 print price($sign * $multicurrency_payment);
779 if ($multicurrency_creditnotes) {
780 print '+'.price($multicurrency_creditnotes);
781 }
782 if ($multicurrency_deposits) {
783 print '+'.price($multicurrency_deposits);
784 }
785 }
786 print '</td>';
787
788 print '<td data-col="remain-to-pay" class="right">';
789 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
790 print price($sign * (float) $multicurrency_remaintopay);
791 }
792 print '</td>';
793
794 print '<td data-col="remain-to-pay-multicurrency-amount" class="right">';
795 // Add remind multicurrency amount
796 $namef = 'multicurrency_amount_'.$objp->facid;
797 $nameRemain = 'multicurrency_remain_'.$objp->facid;
798
799 $min = $max = '';
800 if ($displayAllInvoices) {
801 if ($objp->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
802 $max = ' max="0" ';
803 } else {
804 $min = ' min="0" ';
805 }
806 }
807
808 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
809 if ($action != 'add_paiement') {
810 if (!empty($conf->use_javascript_ajax)) {
811 print '<button class="btn-low-emphasis --btn-icon AutoFillAmount" data-rowname="'.$namef.'" data-value="'.($sign * (float) $multicurrency_remaintopay).'">';
812 print img_picto("Auto fill", 'rightarrow.png');
813 print '</button>';
814 }
815 print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
816 print '<input '.$min.' '.$max.' type="text" class="multicurrency_amount width100" name="'.$namef.'" value="'.GETPOST($namef).'">';
817 } else {
818 print '<input type="text" class="width100" name="'.$namef.'_disabled" value="'.GETPOST($namef).'" disabled>';
819 print '<input type="hidden" name="'.$namef.'" value="'.GETPOST($namef).'">';
820 }
821 }
822 print "</td>";
823 }
824
825 print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
826
827 print '<td class="right">'.price($sign * $objp->am);
828 if ($creditnotes) {
829 print '+'.price($creditnotes);
830 }
831 if ($deposits) {
832 print '+'.price($deposits);
833 }
834 print '</td>';
835
836 print '<td class="right">';
837 print price($sign * (float) $remaintopay);
838 if (isModEnabled('paymentbybanktransfer')) {
839 $numdirectdebitopen = 0;
840 $totaldirectdebit = 0;
841 $sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
842 $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
843 $sql .= " WHERE fk_facture_fourn = ".((int) $objp->facid);
844 $sql .= " AND pfd.traite = 0";
845 $sql .= " AND pfd.ext_payment_id IS NULL";
846
847 $result_sql = $db->query($sql);
848 if ($result_sql) {
849 $obj = $db->fetch_object($result_sql);
850 $numdirectdebitopen = $obj->nb;
851 $totaldirectdebit = $obj->amount;
852 } else {
854 }
855 if ($numdirectdebitopen) {
856 $langs->load("withdrawals");
857 print img_warning($langs->trans("WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen, price(price2num($totaldirectdebit, 'MT'), 0, $langs, 1, -1, -1, $conf->currency)), '', 'classfortooltip');
858 }
859 }
860 print '</td>';
861
862 // Amount
863 print '<td class="center nowraponall">';
864
865 $namef = 'amount_'.$objp->facid;
866 $nameRemain = 'remain_'.$objp->facid;
867
868 $min = $max = '';
869 if ($displayAllInvoices) {
870 if ($objp->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
871 $max = ' max="0" ';
872 } else {
873 $min = ' min="0" ';
874 }
875 }
876
877 if ($action != 'add_paiement') {
878 if (!empty($conf->use_javascript_ajax)) {
879 print '<button class="btn-low-emphasis --btn-icon AutoFillAmount" data-rowname="'.$namef.'" data-value="'.($sign * (float) $remaintopay).'">';
880 print img_picto("Auto fill", 'rightarrow.png');
881 print '</button>';
882 }
883 print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
884 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();
885 } else {
886 print '<input type="text" class="width100" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
887 print '<input type="hidden" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is required to be used by javascript callForResult();
888 }
889 print "</td>";
890
891 print "</tr>\n";
892 $total += $objp->total_ht;
893 $total_ttc += $objp->total_ttc;
894 $totalrecu += $objp->am;
895 $totalrecucreditnote += $creditnotes;
896 $totalrecudeposits += $deposits;
897 $i++;
898 }
899 //print '</tbody>';
900
901 if ($i > 1) {
902 //print '<tfoot>';
903
904 // Print total
905 print '<tr class="liste_total">';
906 $colspan = 3;
907
908 // type
909 if ($displayAllInvoices) {
910 $colspan++;
911 }
912
913 print '<td colspan="'.$colspan.'" class="left" scope="row">'.$langs->trans('TotalTTC').':</td>';
914 if (isModEnabled("multicurrency")) {
915 print '<td>&nbsp;</td>';
916 print '<td>&nbsp;</td>';
917 print '<td>&nbsp;</td>';
918 print '<td>&nbsp;</td>';
919 print '<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
920 }
921 print '<td class="right"><b>'.price($total_ttc).'</b></td>';
922 print '<td class="right"><b>'.price($totalrecu);
923 if ($totalrecucreditnote) {
924 print '+'.price($totalrecucreditnote);
925 }
926 if ($totalrecudeposits) {
927 print '+'.price($totalrecudeposits);
928 }
929 print '</b></td>';
930 print '<td class="right"><b>'.price((float) price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>';
931 print '<td class="center" id="result" style="font-weight: bold;"></td>'; // Autofilled
932 print "</tr>\n";
933 //print '</tfoot>';
934 }
935 print '</tbody>';
936
937 print "</table>\n";
938
939 print "</div>";
940 }
941 $db->free($resql);
942 } else {
944 }
945 }
946
947 // Save + Cancel Buttons
948 if ($action != 'add_paiement') {
949 print '<br><div class="center">';
950 print '<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices" class="marginrightonly"><label for="closepaidinvoices" class="opacitymedium">'.$langs->trans("ClosePaidInvoicesAutomatically").'</label><br>';
951 print '<input type="submit" class="button" value="'.$langs->trans('ToMakePayment').'">';
952 print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
953 print '</div>';
954 }
955
956 // Form to confirm payment
957 if ($action == 'add_paiement') {
958 $preselectedchoice = $addwarning ? 'no' : 'yes';
959
960 print '<br>';
961 $text = '';
962 if (!empty($totalpayment)) {
963 $text = $langs->trans('ConfirmSupplierPayment', price($totalpayment), $langs->transnoentitiesnoconv("Currency".$conf->currency));
964 }
965 if (!empty($multicurrency_totalpayment)) {
966 $text .= '<br>'.$langs->trans('ConfirmSupplierPayment', price($multicurrency_totalpayment), $langs->transnoentitiesnoconv("paymentInInvoiceCurrency"));
967 }
968 if (GETPOST('closepaidinvoices')) {
969 $text .= '<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");
970 print '<input type="hidden" name="closepaidinvoices" value="'.GETPOST('closepaidinvoices').'">';
971 }
972 print $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id.'&socid='.$object->socid.'&type='.$object->type, $langs->trans('PayedSuppliersPayments'), $text, 'confirm_paiement', $formquestion, $preselectedchoice);
973 }
974
975 print '</form>';
976 }
977 } else {
979 }
980}
981
982// End of page
983llxFooter();
984$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.
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 '.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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
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.