dolibarr 23.0.3
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 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
269 if ($result < 0) {
270 $error++;
271 }
272
273 if ($totalamount != 0 && !$error) {
274 $this->amount = $totalamount;
275 $this->total = $totalamount; // deprecated
276 $this->db->commit();
277 return $this->id;
278 } else {
279 $this->error = $this->db->error();
280 $this->db->rollback();
281 return -1;
282 }
283 }
284
291 public function fetch($id)
292 {
293 $sql = "SELECT";
294 $sql .= " t.rowid,";
295 $sql .= " t.fk_charge,";
296 $sql .= " t.datec,";
297 $sql .= " t.tms,";
298 $sql .= " t.datep,";
299 $sql .= " t.amount,";
300 $sql .= " t.fk_typepaiement,";
301 $sql .= " t.num_paiement as num_payment,";
302 $sql .= " t.note as note_private,";
303 $sql .= " t.fk_bank,";
304 $sql .= " t.fk_user_creat,";
305 $sql .= " t.fk_user_modif,";
306 $sql .= " pt.code as type_code, pt.libelle as type_label,";
307 $sql .= ' b.fk_account';
308 $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
309 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
310 $sql .= " WHERE t.rowid = ".((int) $id);
311 // TODO link on entity of tax;
312
313 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
314 $resql = $this->db->query($sql);
315 if ($resql) {
316 if ($this->db->num_rows($resql)) {
317 $obj = $this->db->fetch_object($resql);
318
319 $this->id = $obj->rowid;
320 $this->ref = $obj->rowid;
321
322 $this->fk_charge = $obj->fk_charge;
323 $this->datec = $this->db->jdate($obj->datec);
324 $this->tms = $this->db->jdate($obj->tms);
325 $this->datep = $this->db->jdate($obj->datep);
326 $this->amount = $obj->amount;
327 $this->total = $obj->amount;
328 $this->fk_typepaiement = $obj->fk_typepaiement;
329 $this->num_payment = $obj->num_payment;
330 $this->num_paiement = $obj->num_payment;
331 $this->note_private = $obj->note_private;
332 $this->fk_bank = $obj->fk_bank;
333 $this->fk_user_creat = $obj->fk_user_creat;
334 $this->fk_user_modif = $obj->fk_user_modif;
335
336 $this->type_code = $obj->type_code;
337 $this->type_label = $obj->type_label;
338
339 $this->bank_account = $obj->fk_account;
340 $this->bank_line = $obj->fk_bank;
341 }
342 $this->db->free($resql);
343
344 return 1;
345 } else {
346 $this->error = "Error ".$this->db->lasterror();
347 return -1;
348 }
349 }
350
351
359 public function update($user = null, $notrigger = 0)
360 {
361 global $conf, $langs;
362 $error = 0;
363
364 // Clean parameters
365
366 if (isset($this->fk_charge)) {
367 $this->fk_charge = (int) $this->fk_charge;
368 }
369 if (isset($this->amount)) {
370 $this->amount = (float) $this->amount;
371 }
372 if (isset($this->fk_typepaiement)) {
373 $this->fk_typepaiement = (int) $this->fk_typepaiement;
374 }
375 if (isset($this->num_payment)) {
376 $this->num_payment = trim($this->num_payment);
377 }
378 if (isset($this->note_private)) {
379 $this->note_private = trim($this->note_private);
380 }
381 if (isset($this->fk_bank)) {
382 $this->fk_bank = (int) $this->fk_bank;
383 }
384 if (isset($this->fk_user_creat)) {
385 $this->fk_user_creat = (int) $this->fk_user_creat;
386 }
387 if (isset($this->fk_user_modif)) {
388 $this->fk_user_modif = (int) $this->fk_user_modif;
389 }
390
391
392
393 // Check parameters
394 // Put here code to add control on parameters values
395
396 // Update request
397 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
398 $sql .= " fk_charge=".(isset($this->fk_charge) ? ((int) $this->fk_charge) : "null").",";
399 $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
400 $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
401 $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
402 $sql .= " amount=".(isset($this->amount) ? price2num($this->amount) : "null").",";
403 $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").",";
404 $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").",";
405 $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
406 $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").",";
407 $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").",";
408 $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null");
409 $sql .= " WHERE rowid=".((int) $this->id);
410
411 $this->db->begin();
412
413 dol_syslog(get_class($this)."::update", LOG_DEBUG);
414 $resql = $this->db->query($sql);
415 if (!$resql) {
416 $error++;
417 $this->errors[] = "Error ".$this->db->lasterror();
418 }
419
420 // Commit or rollback
421 if ($error) {
422 foreach ($this->errors as $errmsg) {
423 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
424 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
425 }
426 $this->db->rollback();
427 return -1 * $error;
428 } else {
429 $this->db->commit();
430 return 1;
431 }
432 }
433
434
442 public function delete($user, $notrigger = 0)
443 {
444 $error = 0;
445
446 dol_syslog(get_class($this)."::delete");
447
448 $this->db->begin();
449
450 if ($this->bank_line > 0) {
451 $accline = new AccountLine($this->db);
452 $accline->fetch($this->bank_line);
453 $result = $accline->delete($user);
454 if ($result < 0) {
455 $this->errors[] = $accline->error;
456 $error++;
457 }
458 }
459
460 if (!$error) {
461 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
462 $sql .= " WHERE rowid=".((int) $this->id);
463
464 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
465 $resql = $this->db->query($sql);
466 if (!$resql) {
467 $error++;
468 $this->errors[] = "Error ".$this->db->lasterror();
469 }
470 }
471
472 // Commit or rollback
473 if ($error) {
474 foreach ($this->errors as $errmsg) {
475 dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
476 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
477 }
478 $this->db->rollback();
479 return -1 * $error;
480 } else {
481 $this->db->commit();
482 return 1;
483 }
484 }
485
486
487
495 public function createFromClone(User $user, $fromid)
496 {
497 $error = 0;
498
499 $object = new PaymentSocialContribution($this->db);
500
501 $this->db->begin();
502
503 // Load source object
504 $object->fetch($fromid);
505 $object->id = 0;
506 $object->statut = 0;
507 $object->status = 0;
508
509 // Clear fields
510 // ...
511
512 // Create clone
513 $object->context['createfromclone'] = 'createfromclone';
514 $result = $object->create($user);
515
516 // Other options
517 if ($result < 0) {
519 $error++;
520 }
521
522 unset($object->context['createfromclone']);
523
524 // End
525 if (!$error) {
526 $this->db->commit();
527 return $object->id;
528 } else {
529 $this->db->rollback();
530 return -1;
531 }
532 }
533
534
542 public function initAsSpecimen()
543 {
544 $this->id = 0;
545 $this->fk_charge = 0;
546 $this->datec = dol_now();
547 $this->tms = dol_now();
548 $this->datep = dol_now();
549 $this->amount = 100;
550 $this->fk_typepaiement = 0;
551 $this->num_payment = 'ABC123';
552 $this->note_private = '';
553 $this->note_public = '';
554 $this->fk_bank = 0;
555 $this->fk_user_creat = 0;
556 $this->fk_user_modif = 0;
557
558 return 1;
559 }
560
561
574 public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
575 {
576 global $conf, $langs;
577
578 // Clean data
579 $this->num_payment = trim($this->num_payment);
580
581 $error = 0;
582
583 if (isModEnabled("bank")) {
584 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
585
586 $acc = new Account($this->db);
587 $acc->fetch($accountid);
588
589 $total = $this->amount;
590 if ($mode == 'payment_sc') {
591 $total = -$total;
592 }
593
594 // Insert payment into llx_bank
595 $bank_line_id = $acc->addline(
596 $this->datepaye,
597 $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
598 $label,
599 $total,
600 $this->num_payment,
601 0,
602 $user,
603 $emetteur_nom,
604 $emetteur_banque
605 );
606
607 // Mise a jour fk_bank dans llx_paiement.
608 // On connait ainsi le paiement qui a genere l'ecriture bancaire
609 if ($bank_line_id > 0) {
610 $result = $this->update_fk_bank($bank_line_id);
611 if ($result <= 0) {
612 $error++;
613 }
614
615 // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
616 $url = '';
617 if ($mode == 'payment_sc') {
618 $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
619 }
620 if ($url) {
621 $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
622 if ($result <= 0) {
623 $error++;
624 $this->setErrorsFromObject($acc);
625 }
626 }
627
628 // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
629 $linkaddedforthirdparty = array();
630 foreach ($this->amounts as $key => $value) {
631 if ($mode == 'payment_sc') {
632 $socialcontrib = new ChargeSociales($this->db);
633 $socialcontrib->fetch($key);
634 $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');
635 if ($result <= 0) {
636 $this->setErrorsFromObject($acc);
637 $error++;
638 }
639
640 if ($socialcontrib->fk_user) {
641 $fuser = new User($this->db);
642 $fuser->fetch($socialcontrib->fk_user);
643
644 // Add link 'user' in bank_url between operation and bank transaction
645 $result = $acc->add_url_line(
646 $bank_line_id,
647 $socialcontrib->fk_user,
648 DOL_URL_ROOT.'/user/card.php?id=',
649 $fuser->getFullName($langs),
650 'user'
651 );
652
653 if ($result <= 0) {
654 $this->setErrorsFromObject($acc);
655 $error++;
656 }
657 }
658 }
659 }
660 } else {
661 $this->setErrorsFromObject($acc);
662 $error++;
663 }
664 }
665
666 if (!$error) {
667 return 1;
668 } else {
669 return -1;
670 }
671 }
672
673
674 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
681 public function update_fk_bank($id_bank)
682 {
683 // phpcs:enable
684 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
685
686 dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
687 $result = $this->db->query($sql);
688 if ($result) {
689 return 1;
690 } else {
691 $this->error = $this->db->error();
692 return 0;
693 }
694 }
695
696
703 public function getLibStatut($mode = 0)
704 {
705 return $this->LibStatut($this->statut, $mode);
706 }
707
708 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
716 public function LibStatut($status, $mode = 0)
717 {
718 // phpcs:enable
719 global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
720
721 $langs->load('compta');
722 /*if ($mode == 0)
723 {
724 if ($status == 0) return $langs->trans('ToValidate');
725 if ($status == 1) return $langs->trans('Validated');
726 }
727 if ($mode == 1)
728 {
729 if ($status == 0) return $langs->trans('ToValidate');
730 if ($status == 1) return $langs->trans('Validated');
731 }
732 if ($mode == 2)
733 {
734 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
735 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
736 }
737 if ($mode == 3)
738 {
739 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
740 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
741 }
742 if ($mode == 4)
743 {
744 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
745 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
746 }
747 if ($mode == 5)
748 {
749 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
750 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
751 }
752 if ($mode == 6)
753 {
754 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
755 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
756 }*/
757 return '';
758 }
759
767 public function getNomUrl($withpicto = 0, $maxlen = 0)
768 {
769 global $langs;
770
771 $result = '';
772
773 if (empty($this->ref)) {
774 $this->ref = $this->label;
775 }
776
777 $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
778 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
779 if (!empty($this->label)) {
780 $labeltoshow = $this->label;
781 $reg = array();
782 if (preg_match('/^\‍((.*)\‍)$/i', $this->label, $reg)) {
783 // Label generique car entre parentheses. On l'affiche en le traduisant
784 if ($reg[1] == 'paiement') {
785 $reg[1] = 'Payment';
786 }
787 $labeltoshow = $langs->trans($reg[1]);
788 }
789 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
790 }
791 if ($this->datep) {
792 $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
793 }
794
795 if (!empty($this->id)) {
796 $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
797 $linkend = '</a>';
798
799 if ($withpicto) {
800 $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
801 }
802 if ($withpicto && $withpicto != 2) {
803 $result .= ' ';
804 }
805 if ($withpicto != 2) {
806 $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
807 }
808 }
809
810 return $result;
811 }
812
813
820 public function getVentilExportCompta($mode = 0)
821 {
822 $alreadydispatched = 0;
823
824 $type = 'bank';
825
826 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
827 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
828 $sql .= " WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
829
830 $resql = $this->db->query($sql);
831 if ($resql) {
832 $obj = $this->db->fetch_object($resql);
833 if ($obj) {
834 $alreadydispatched = $obj->nb;
835 }
836 } else {
837 $this->error = $this->db->lasterror();
838 return -1;
839 }
840
841 if ($alreadydispatched) {
842 return $alreadydispatched;
843 }
844 return 0;
845 }
846}
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:466