dolibarr 23.0.4
paymentsocialcontribution.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
5 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
30
31
36{
40 public $element = 'paiementcharge';
41
45 public $table_element = 'paiementcharge';
46
50 public $picto = 'payment';
51
55 public $label;
56
60 public $fk_charge;
61
62 public $datec = '';
63 public $datep = '';
64
68 public $type_code;
69
73 public $type_label;
74
78 public $bank_account;
79
83 public $bank_line;
84
90 public $total;
91
95 public $amount; // Total amount of payment
99 public $amounts = array(); // Array of amounts
100
104 public $fk_typepaiement;
105
111 public $num_paiement;
112
117 public $num_payment;
118
122 public $fk_bank;
123
127 public $fk_user_creat;
128
132 public $fk_user_modif;
133
137 public $chid;
138
142 public $datepaye;
143
147 public $paiementtype;
148
149
155 public function __construct(DoliDB $db)
156 {
157 $this->db = $db;
158 }
159
168 public function create($user, $closepaidcontrib = 0)
169 {
170 $error = 0;
171
172 $now = dol_now();
173
174 dol_syslog(get_class($this)."::create", LOG_DEBUG);
175
176 // Validate parameters
177 if (!$this->datepaye) {
178 $this->error = 'ErrorBadValueForParameterCreatePaymentSocialContrib';
179 return -1;
180 }
181
182 // Clean parameters
183 if (isset($this->fk_charge)) {
184 $this->fk_charge = (int) $this->fk_charge;
185 }
186 if (isset($this->amount)) {
187 $this->amount = (float) $this->amount;
188 }
189 if (isset($this->fk_typepaiement)) {
190 $this->fk_typepaiement = (int) $this->fk_typepaiement;
191 }
192 if (isset($this->num_payment)) {
193 $this->num_payment = trim($this->num_payment);
194 }
195 if (isset($this->note_private)) {
196 $this->note_private = trim($this->note_private);
197 }
198 if (isset($this->fk_bank)) {
199 $this->fk_bank = (int) $this->fk_bank;
200 }
201 if (isset($this->fk_user_creat)) {
202 $this->fk_user_creat = (int) $this->fk_user_creat;
203 }
204 if (isset($this->fk_user_modif)) {
205 $this->fk_user_modif = (int) $this->fk_user_modif;
206 }
207
208 $totalamount = 0;
209 foreach ($this->amounts as $key => $value) { // How payment is dispatch
210 $newvalue = (float) price2num($value, 'MT');
211 $this->amounts[$key] = $newvalue;
212 $totalamount += $newvalue;
213 }
214 $totalamount = (float) price2num($totalamount);
215
216 // Check parameters
217 if ($totalamount == 0) {
218 $this->error = 'ErrorPaymentAmountMustNotBeNull';
219 return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
220 }
221
222
223 $this->db->begin();
224
225 if ($totalamount != 0) {
226 $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,";
227 $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
228 $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
229 $sql .= " '".$this->db->idate($this->datepaye)."',";
230 $sql .= " ".((float) $totalamount).",";
231 $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
232 $sql .= " 0)";
233
234 $resql = $this->db->query($sql);
235 if ($resql) {
236 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."paiementcharge");
237
238 // Insere tableau des montants / factures
239 foreach ($this->amounts as $key => $amount) {
240 $contribid = $key;
241 if (is_numeric($amount) && $amount != 0) {
242 $amount = (float) price2num($amount);
243
244 // If we want to closed paid invoices
245 if ($closepaidcontrib) {
246 $contrib = new ChargeSociales($this->db);
247 $contrib->fetch($contribid);
248 $paiement = $contrib->getSommePaiement();
249 //$creditnotes=$contrib->getSumCreditNotesUsed();
250 $creditnotes = 0;
251 //$deposits=$contrib->getSumDepositsUsed();
252 $deposits = 0;
253 $alreadypayed = (float) price2num($paiement + $creditnotes + $deposits, 'MT');
254 $remaintopay = (float) price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
255 if ($remaintopay == 0) {
256 $result = $contrib->setPaid($user);
257 } else {
258 dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
259 }
260 }
261 }
262 }
263 } else {
264 $error++;
265 }
266 }
267
268 if (!$error) {
269 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
270 if ($result < 0) {
271 $error++;
272 }
273 }
274
275 if ($totalamount != 0 && !$error) {
276 $this->amount = $totalamount;
277 $this->total = $totalamount; // deprecated
278 $this->db->commit();
279 return $this->id;
280 } else {
281 $this->error = $this->db->error();
282 $this->db->rollback();
283 return -1;
284 }
285 }
286
293 public function fetch($id)
294 {
295 $sql = "SELECT";
296 $sql .= " t.rowid,";
297 $sql .= " t.fk_charge,";
298 $sql .= " t.datec,";
299 $sql .= " t.tms,";
300 $sql .= " t.datep,";
301 $sql .= " t.amount,";
302 $sql .= " t.fk_typepaiement,";
303 $sql .= " t.num_paiement as num_payment,";
304 $sql .= " t.note as note_private,";
305 $sql .= " t.fk_bank,";
306 $sql .= " t.fk_user_creat,";
307 $sql .= " t.fk_user_modif,";
308 $sql .= " pt.code as type_code, pt.libelle as type_label,";
309 $sql .= ' b.fk_account';
310 $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
311 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
312 $sql .= " WHERE t.rowid = ".((int) $id);
313 // TODO link on entity of tax;
314
315 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
316 $resql = $this->db->query($sql);
317 if ($resql) {
318 if ($this->db->num_rows($resql)) {
319 $obj = $this->db->fetch_object($resql);
320
321 $this->id = $obj->rowid;
322 $this->ref = $obj->rowid;
323
324 $this->fk_charge = $obj->fk_charge;
325 $this->datec = $this->db->jdate($obj->datec);
326 $this->tms = $this->db->jdate($obj->tms);
327 $this->datep = $this->db->jdate($obj->datep);
328 $this->amount = $obj->amount;
329 $this->total = $obj->amount;
330 $this->fk_typepaiement = $obj->fk_typepaiement;
331 $this->num_payment = $obj->num_payment;
332 $this->num_paiement = $obj->num_payment;
333 $this->note_private = $obj->note_private;
334 $this->fk_bank = $obj->fk_bank;
335 $this->fk_user_creat = $obj->fk_user_creat;
336 $this->fk_user_modif = $obj->fk_user_modif;
337
338 $this->type_code = $obj->type_code;
339 $this->type_label = $obj->type_label;
340
341 $this->bank_account = $obj->fk_account;
342 $this->bank_line = $obj->fk_bank;
343 }
344 $this->db->free($resql);
345
346 return 1;
347 } else {
348 $this->error = "Error ".$this->db->lasterror();
349 return -1;
350 }
351 }
352
353
361 public function update($user = null, $notrigger = 0)
362 {
363 global $conf, $langs;
364 $error = 0;
365
366 // Clean parameters
367
368 if (isset($this->fk_charge)) {
369 $this->fk_charge = (int) $this->fk_charge;
370 }
371 if (isset($this->amount)) {
372 $this->amount = (float) $this->amount;
373 }
374 if (isset($this->fk_typepaiement)) {
375 $this->fk_typepaiement = (int) $this->fk_typepaiement;
376 }
377 if (isset($this->num_payment)) {
378 $this->num_payment = trim($this->num_payment);
379 }
380 if (isset($this->note_private)) {
381 $this->note_private = trim($this->note_private);
382 }
383 if (isset($this->fk_bank)) {
384 $this->fk_bank = (int) $this->fk_bank;
385 }
386 if (isset($this->fk_user_creat)) {
387 $this->fk_user_creat = (int) $this->fk_user_creat;
388 }
389 if (isset($this->fk_user_modif)) {
390 $this->fk_user_modif = (int) $this->fk_user_modif;
391 }
392
393
394
395 // Check parameters
396 // Put here code to add control on parameters values
397
398 // Update request
399 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
400 $sql .= " fk_charge=".(isset($this->fk_charge) ? ((int) $this->fk_charge) : "null").",";
401 $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
402 $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
403 $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
404 $sql .= " amount=".(isset($this->amount) ? price2num($this->amount) : "null").",";
405 $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").",";
406 $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").",";
407 $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
408 $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").",";
409 $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").",";
410 $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null");
411 $sql .= " WHERE rowid=".((int) $this->id);
412
413 $this->db->begin();
414
415 dol_syslog(get_class($this)."::update", LOG_DEBUG);
416 $resql = $this->db->query($sql);
417 if (!$resql) {
418 $error++;
419 $this->errors[] = "Error ".$this->db->lasterror();
420 }
421
422 // Commit or rollback
423 if ($error) {
424 foreach ($this->errors as $errmsg) {
425 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
426 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
427 }
428 $this->db->rollback();
429 return -1 * $error;
430 } else {
431 $this->db->commit();
432 return 1;
433 }
434 }
435
436
444 public function delete($user, $notrigger = 0)
445 {
446 $error = 0;
447
448 dol_syslog(get_class($this)."::delete");
449
450 $this->db->begin();
451
452 if ($this->bank_line > 0) {
453 $accline = new AccountLine($this->db);
454 $accline->fetch($this->bank_line);
455 $result = $accline->delete($user);
456 if ($result < 0) {
457 $this->errors[] = $accline->error;
458 $error++;
459 }
460 }
461
462 if (!$error) {
463 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
464 $sql .= " WHERE rowid=".((int) $this->id);
465
466 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
467 $resql = $this->db->query($sql);
468 if (!$resql) {
469 $error++;
470 $this->errors[] = "Error ".$this->db->lasterror();
471 }
472 }
473
474 // Commit or rollback
475 if ($error) {
476 foreach ($this->errors as $errmsg) {
477 dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
478 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
479 }
480 $this->db->rollback();
481 return -1 * $error;
482 } else {
483 $this->db->commit();
484 return 1;
485 }
486 }
487
488
489
497 public function createFromClone(User $user, $fromid)
498 {
499 $error = 0;
500
501 $object = new PaymentSocialContribution($this->db);
502
503 $this->db->begin();
504
505 // Load source object
506 $object->fetch($fromid);
507 $object->id = 0;
508 $object->statut = 0;
509 $object->status = 0;
510
511 // Clear fields
512 // ...
513
514 // Create clone
515 $object->context['createfromclone'] = 'createfromclone';
516 $result = $object->create($user);
517
518 // Other options
519 if ($result < 0) {
521 $error++;
522 }
523
524 unset($object->context['createfromclone']);
525
526 // End
527 if (!$error) {
528 $this->db->commit();
529 return $object->id;
530 } else {
531 $this->db->rollback();
532 return -1;
533 }
534 }
535
536
544 public function initAsSpecimen()
545 {
546 $this->id = 0;
547 $this->fk_charge = 0;
548 $this->datec = dol_now();
549 $this->tms = dol_now();
550 $this->datep = dol_now();
551 $this->amount = 100;
552 $this->fk_typepaiement = 0;
553 $this->num_payment = 'ABC123';
554 $this->note_private = '';
555 $this->note_public = '';
556 $this->fk_bank = 0;
557 $this->fk_user_creat = 0;
558 $this->fk_user_modif = 0;
559
560 return 1;
561 }
562
563
576 public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
577 {
578 global $conf, $langs;
579
580 // Clean data
581 $this->num_payment = trim($this->num_payment);
582
583 $error = 0;
584
585 if (isModEnabled("bank")) {
586 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
587
588 $acc = new Account($this->db);
589 $acc->fetch($accountid);
590
591 $total = $this->amount;
592 if ($mode == 'payment_sc') {
593 $total = -$total;
594 }
595
596 // Insert payment into llx_bank
597 $bank_line_id = $acc->addline(
598 $this->datepaye,
599 $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
600 $label,
601 $total,
602 $this->num_payment,
603 0,
604 $user,
605 $emetteur_nom,
606 $emetteur_banque
607 );
608
609 // Mise a jour fk_bank dans llx_paiement.
610 // On connait ainsi le paiement qui a genere l'ecriture bancaire
611 if ($bank_line_id > 0) {
612 $result = $this->update_fk_bank($bank_line_id);
613 if ($result <= 0) {
614 $error++;
615 }
616
617 // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
618 $url = '';
619 if ($mode == 'payment_sc') {
620 $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
621 }
622 if ($url) {
623 $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
624 if ($result <= 0) {
625 $error++;
626 $this->setErrorsFromObject($acc);
627 }
628 }
629
630 // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
631 $linkaddedforthirdparty = array();
632 foreach ($this->amounts as $key => $value) {
633 if ($mode == 'payment_sc') {
634 $socialcontrib = new ChargeSociales($this->db);
635 $socialcontrib->fetch($key);
636 $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
637 if ($result <= 0) {
638 $this->setErrorsFromObject($acc);
639 $error++;
640 }
641
642 if ($socialcontrib->fk_user) {
643 $fuser = new User($this->db);
644 $fuser->fetch($socialcontrib->fk_user);
645
646 // Add link 'user' in bank_url between operation and bank transaction
647 $result = $acc->add_url_line(
648 $bank_line_id,
649 $socialcontrib->fk_user,
650 DOL_URL_ROOT.'/user/card.php?id=',
651 $fuser->getFullName($langs),
652 'user'
653 );
654
655 if ($result <= 0) {
656 $this->setErrorsFromObject($acc);
657 $error++;
658 }
659 }
660 }
661 }
662 } else {
663 $this->setErrorsFromObject($acc);
664 $error++;
665 }
666 }
667
668 if (!$error) {
669 return 1;
670 } else {
671 return -1;
672 }
673 }
674
675
676 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
683 public function update_fk_bank($id_bank)
684 {
685 // phpcs:enable
686 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
687
688 dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
689 $result = $this->db->query($sql);
690 if ($result) {
691 return 1;
692 } else {
693 $this->error = $this->db->error();
694 return 0;
695 }
696 }
697
698
705 public function getLibStatut($mode = 0)
706 {
707 return $this->LibStatut($this->statut, $mode);
708 }
709
710 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
718 public function LibStatut($status, $mode = 0)
719 {
720 // phpcs:enable
721 global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
722
723 $langs->load('compta');
724 /*if ($mode == 0)
725 {
726 if ($status == 0) return $langs->trans('ToValidate');
727 if ($status == 1) return $langs->trans('Validated');
728 }
729 if ($mode == 1)
730 {
731 if ($status == 0) return $langs->trans('ToValidate');
732 if ($status == 1) return $langs->trans('Validated');
733 }
734 if ($mode == 2)
735 {
736 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
737 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
738 }
739 if ($mode == 3)
740 {
741 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
742 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
743 }
744 if ($mode == 4)
745 {
746 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
747 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
748 }
749 if ($mode == 5)
750 {
751 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
752 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
753 }
754 if ($mode == 6)
755 {
756 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
757 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
758 }*/
759 return '';
760 }
761
769 public function getNomUrl($withpicto = 0, $maxlen = 0)
770 {
771 global $langs;
772
773 $result = '';
774
775 if (empty($this->ref)) {
776 $this->ref = $this->label;
777 }
778
779 $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
780 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
781 if (!empty($this->label)) {
782 $labeltoshow = $this->label;
783 $reg = array();
784 if (preg_match('/^\‍((.*)\‍)$/i', $this->label, $reg)) {
785 // Label generique car entre parentheses. On l'affiche en le traduisant
786 if ($reg[1] == 'paiement') {
787 $reg[1] = 'Payment';
788 }
789 $labeltoshow = $langs->trans($reg[1]);
790 }
791 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
792 }
793 if ($this->datep) {
794 $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
795 }
796
797 if (!empty($this->id)) {
798 $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
799 $linkend = '</a>';
800
801 if ($withpicto) {
802 $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
803 }
804 if ($withpicto && $withpicto != 2) {
805 $result .= ' ';
806 }
807 if ($withpicto != 2) {
808 $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
809 }
810 }
811
812 return $result;
813 }
814
815
822 public function getVentilExportCompta($mode = 0)
823 {
824 $alreadydispatched = 0;
825
826 $type = 'bank';
827
828 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
829 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
830 $sql .= " WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
831
832 $resql = $this->db->query($sql);
833 if ($resql) {
834 $obj = $this->db->fetch_object($resql);
835 if ($obj) {
836 $alreadydispatched = $obj->nb;
837 }
838 } else {
839 $this->error = $this->db->lasterror();
840 return -1;
841 }
842
843 if ($alreadydispatched) {
844 return $alreadydispatched;
845 }
846 return 0;
847 }
848}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$object ref
Definition info.php:90
Class to manage bank accounts.
Class to manage bank transaction lines.
Class for managing the social charges.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
setErrorsFromObject($object)
setErrorsFromObject
Class to manage Dolibarr database access.
Class to manage payments of social contributions.
getLibStatut($mode=0)
Return the label of the status.
fetch($id)
Load object in memory from database.
getNomUrl($withpicto=0, $maxlen=0)
Return clickable name (with picto eventually)
getVentilExportCompta($mode=0)
Return if object was dispatched into bookkeeping, or return the array of bookkeeping id.
create($user, $closepaidcontrib=0)
Create payment of social contribution into database.
addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
Add record into bank for payment with links between this bank record and invoices of payment.
LibStatut($status, $mode=0)
Return the label of a given status.
update($user=null, $notrigger=0)
Update database.
createFromClone(User $user, $fromid)
Load an object from its id and create a new one in database.
update_fk_bank($id_bank)
Update the link between the Payment and the line generated in llx_bank.
initAsSpecimen()
Initialise an instance with random values.
Class to manage Dolibarr users.
dol_now($mode='gmt')
Return date for now.
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)
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left 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 PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
Definition receipt.php:471