dolibarr  16.0.5
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  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
28 
29 
34 {
38  public $element = 'paiementcharge';
39 
43  public $table_element = 'paiementcharge';
44 
48  public $picto = 'payment';
49 
53  public $label;
54 
58  public $fk_charge;
59 
60  public $datec = '';
61  public $tms = '';
62  public $datep = '';
63 
68  public $total;
69 
70  public $amount; // Total amount of payment
71  public $amounts = array(); // Array of amounts
72 
76  public $fk_typepaiement;
77 
82  public $num_paiement;
83 
87  public $num_payment;
88 
92  public $fk_bank;
93 
97  public $fk_user_creat;
98 
102  public $fk_user_modif;
103 
107  public $chid;
108 
112  public $datepaye;
113 
117  public $paiementtype;
118 
119 
125  public function __construct(DoliDB $db)
126  {
127  $this->db = $db;
128  }
129 
138  public function create($user, $closepaidcontrib = 0)
139  {
140  global $conf, $langs;
141 
142  $error = 0;
143 
144  $now = dol_now();
145 
146  dol_syslog(get_class($this)."::create", LOG_DEBUG);
147 
148  // Validate parametres
149  if (!$this->datepaye) {
150  $this->error = 'ErrorBadValueForParameterCreatePaymentSocialContrib';
151  return -1;
152  }
153 
154  // Clean parameters
155  if (isset($this->fk_charge)) {
156  $this->fk_charge = (int) $this->fk_charge;
157  }
158  if (isset($this->amount)) {
159  $this->amount = trim($this->amount);
160  }
161  if (isset($this->fk_typepaiement)) {
162  $this->fk_typepaiement = (int) $this->fk_typepaiement;
163  }
164  if (isset($this->num_payment)) {
165  $this->num_payment = trim($this->num_payment);
166  }
167  if (isset($this->note_private)) {
168  $this->note_private = trim($this->note_private);
169  }
170  if (isset($this->fk_bank)) {
171  $this->fk_bank = (int) $this->fk_bank;
172  }
173  if (isset($this->fk_user_creat)) {
174  $this->fk_user_creat = (int) $this->fk_user_creat;
175  }
176  if (isset($this->fk_user_modif)) {
177  $this->fk_user_modif = (int) $this->fk_user_modif;
178  }
179 
180  $totalamount = 0;
181  foreach ($this->amounts as $key => $value) { // How payment is dispatch
182  $newvalue = price2num($value, 'MT');
183  $this->amounts[$key] = $newvalue;
184  $totalamount += $newvalue;
185  }
186  $totalamount = price2num($totalamount);
187 
188  // Check parameters
189  if ($totalamount == 0) {
190  return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
191  }
192 
193 
194  $this->db->begin();
195 
196  if ($totalamount != 0) {
197  $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,";
198  $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
199  $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
200  $sql .= " '".$this->db->idate($this->datepaye)."',";
201  $sql .= " ".((float) $totalamount).",";
202  $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
203  $sql .= " 0)";
204 
205  $resql = $this->db->query($sql);
206  if ($resql) {
207  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."paiementcharge");
208 
209  // Insere tableau des montants / factures
210  foreach ($this->amounts as $key => $amount) {
211  $contribid = $key;
212  if (is_numeric($amount) && $amount <> 0) {
213  $amount = price2num($amount);
214 
215  // If we want to closed paid invoices
216  if ($closepaidcontrib) {
217  $contrib = new ChargeSociales($this->db);
218  $contrib->fetch($contribid);
219  $paiement = $contrib->getSommePaiement();
220  //$creditnotes=$contrib->getSumCreditNotesUsed();
221  $creditnotes = 0;
222  //$deposits=$contrib->getSumDepositsUsed();
223  $deposits = 0;
224  $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
225  $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
226  if ($remaintopay == 0) {
227  $result = $contrib->setPaid($user);
228  } else {
229  dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
230  }
231  }
232  }
233  }
234  } else {
235  $error++;
236  }
237  }
238 
239  $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
240  if ($result < 0) {
241  $error++;
242  }
243 
244  if ($totalamount != 0 && !$error) {
245  $this->amount = $totalamount;
246  $this->total = $totalamount; // deprecated
247  $this->db->commit();
248  return $this->id;
249  } else {
250  $this->error = $this->db->error();
251  $this->db->rollback();
252  return -1;
253  }
254  }
255 
262  public function fetch($id)
263  {
264  global $langs;
265  $sql = "SELECT";
266  $sql .= " t.rowid,";
267  $sql .= " t.fk_charge,";
268  $sql .= " t.datec,";
269  $sql .= " t.tms,";
270  $sql .= " t.datep,";
271  $sql .= " t.amount,";
272  $sql .= " t.fk_typepaiement,";
273  $sql .= " t.num_paiement as num_payment,";
274  $sql .= " t.note,";
275  $sql .= " t.fk_bank,";
276  $sql .= " t.fk_user_creat,";
277  $sql .= " t.fk_user_modif,";
278  $sql .= " pt.code as type_code, pt.libelle as type_label,";
279  $sql .= ' b.fk_account';
280  $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
281  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
282  $sql .= " WHERE t.rowid = ".((int) $id);
283  // TODO link on entity of tax;
284 
285  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
286  $resql = $this->db->query($sql);
287  if ($resql) {
288  if ($this->db->num_rows($resql)) {
289  $obj = $this->db->fetch_object($resql);
290 
291  $this->id = $obj->rowid;
292  $this->ref = $obj->rowid;
293 
294  $this->fk_charge = $obj->fk_charge;
295  $this->datec = $this->db->jdate($obj->datec);
296  $this->tms = $this->db->jdate($obj->tms);
297  $this->datep = $this->db->jdate($obj->datep);
298  $this->amount = $obj->amount;
299  $this->fk_typepaiement = $obj->fk_typepaiement;
300  $this->num_payment = $obj->num_payment;
301  $this->note_private = $obj->note;
302  $this->fk_bank = $obj->fk_bank;
303  $this->fk_user_creat = $obj->fk_user_creat;
304  $this->fk_user_modif = $obj->fk_user_modif;
305 
306  $this->type_code = $obj->type_code;
307  $this->type_label = $obj->type_label;
308 
309  $this->bank_account = $obj->fk_account;
310  $this->bank_line = $obj->fk_bank;
311  }
312  $this->db->free($resql);
313 
314  return 1;
315  } else {
316  $this->error = "Error ".$this->db->lasterror();
317  return -1;
318  }
319  }
320 
321 
329  public function update($user = null, $notrigger = 0)
330  {
331  global $conf, $langs;
332  $error = 0;
333 
334  // Clean parameters
335 
336  if (isset($this->fk_charge)) {
337  $this->fk_charge = (int) $this->fk_charge;
338  }
339  if (isset($this->amount)) {
340  $this->amount = trim($this->amount);
341  }
342  if (isset($this->fk_typepaiement)) {
343  $this->fk_typepaiement = (int) $this->fk_typepaiement;
344  }
345  if (isset($this->num_payment)) {
346  $this->num_payment = trim($this->num_payment);
347  }
348  if (isset($this->note_private)) {
349  $this->note_private = trim($this->note_private);
350  }
351  if (isset($this->fk_bank)) {
352  $this->fk_bank = (int) $this->fk_bank;
353  }
354  if (isset($this->fk_user_creat)) {
355  $this->fk_user_creat = (int) $this->fk_user_creat;
356  }
357  if (isset($this->fk_user_modif)) {
358  $this->fk_user_modif = (int) $this->fk_user_modif;
359  }
360 
361 
362 
363  // Check parameters
364  // Put here code to add control on parameters values
365 
366  // Update request
367  $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
368 
369  $sql .= " fk_charge=".(isset($this->fk_charge) ? $this->fk_charge : "null").",";
370  $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
371  $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
372  $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
373  $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").",";
374  $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").",";
375  $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").",";
376  $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
377  $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
378  $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").",";
379  $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
380 
381 
382  $sql .= " WHERE rowid=".((int) $this->id);
383 
384  $this->db->begin();
385 
386  dol_syslog(get_class($this)."::update", LOG_DEBUG);
387  $resql = $this->db->query($sql);
388  if (!$resql) {
389  $error++;
390  $this->errors[] = "Error ".$this->db->lasterror();
391  }
392 
393  // Commit or rollback
394  if ($error) {
395  foreach ($this->errors as $errmsg) {
396  dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
397  $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
398  }
399  $this->db->rollback();
400  return -1 * $error;
401  } else {
402  $this->db->commit();
403  return 1;
404  }
405  }
406 
407 
415  public function delete($user, $notrigger = 0)
416  {
417  global $conf, $langs;
418  $error = 0;
419 
420  dol_syslog(get_class($this)."::delete");
421 
422  $this->db->begin();
423 
424  if ($this->bank_line > 0) {
425  $accline = new AccountLine($this->db);
426  $accline->fetch($this->bank_line);
427  $result = $accline->delete();
428  if ($result < 0) {
429  $this->errors[] = $accline->error;
430  $error++;
431  }
432  }
433 
434  if (!$error) {
435  $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
436  $sql .= " WHERE rowid=".((int) $this->id);
437 
438  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
439  $resql = $this->db->query($sql);
440  if (!$resql) {
441  $error++;
442  $this->errors[] = "Error ".$this->db->lasterror();
443  }
444  }
445 
446  // Commit or rollback
447  if ($error) {
448  foreach ($this->errors as $errmsg) {
449  dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
450  $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
451  }
452  $this->db->rollback();
453  return -1 * $error;
454  } else {
455  $this->db->commit();
456  return 1;
457  }
458  }
459 
460 
461 
469  public function createFromClone(User $user, $fromid)
470  {
471  $error = 0;
472 
473  $object = new PaymentSocialContribution($this->db);
474 
475  $this->db->begin();
476 
477  // Load source object
478  $object->fetch($fromid);
479  $object->id = 0;
480  $object->statut = 0;
481 
482  // Clear fields
483  // ...
484 
485  // Create clone
486  $object->context['createfromclone'] = 'createfromclone';
487  $result = $object->create($user);
488 
489  // Other options
490  if ($result < 0) {
491  $this->error = $object->error;
492  $error++;
493  }
494 
495  unset($object->context['createfromclone']);
496 
497  // End
498  if (!$error) {
499  $this->db->commit();
500  return $object->id;
501  } else {
502  $this->db->rollback();
503  return -1;
504  }
505  }
506 
507 
515  public function initAsSpecimen()
516  {
517  $this->id = 0;
518 
519  $this->fk_charge = '';
520  $this->datec = '';
521  $this->tms = '';
522  $this->datep = '';
523  $this->amount = '';
524  $this->fk_typepaiement = '';
525  $this->num_payment = '';
526  $this->note_private = '';
527  $this->note_public = '';
528  $this->fk_bank = '';
529  $this->fk_user_creat = '';
530  $this->fk_user_modif = '';
531  }
532 
533 
546  public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
547  {
548  global $conf, $langs;
549 
550  // Clean data
551  $this->num_payment = trim($this->num_payment);
552 
553  $error = 0;
554 
555  if (isModEnabled('banque')) {
556  include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
557 
558  $acc = new Account($this->db);
559  $acc->fetch($accountid);
560 
562  if ($mode == 'payment_sc') {
563  $total = -$total;
564  }
565 
566  // Insert payment into llx_bank
567  $bank_line_id = $acc->addline(
568  $this->datepaye,
569  $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
570  $label,
571  $total,
572  $this->num_payment,
573  '',
574  $user,
575  $emetteur_nom,
576  $emetteur_banque
577  );
578 
579  // Mise a jour fk_bank dans llx_paiement.
580  // On connait ainsi le paiement qui a genere l'ecriture bancaire
581  if ($bank_line_id > 0) {
582  $result = $this->update_fk_bank($bank_line_id);
583  if ($result <= 0) {
584  $error++;
585  dol_print_error($this->db);
586  }
587 
588  // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
589  $url = '';
590  if ($mode == 'payment_sc') {
591  $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
592  }
593  if ($url) {
594  $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
595  if ($result <= 0) {
596  $error++;
597  dol_print_error($this->db);
598  }
599  }
600 
601  // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
602  $linkaddedforthirdparty = array();
603  foreach ($this->amounts as $key => $value) {
604  if ($mode == 'payment_sc') {
605  $socialcontrib = new ChargeSociales($this->db);
606  $socialcontrib->fetch($key);
607  $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');
608  if ($result <= 0) {
609  dol_print_error($this->db);
610  }
611 
612  if ($socialcontrib->fk_user) {
613  $fuser = new User($this->db);
614  $fuser->fetch($socialcontrib->fk_user);
615 
616  // Add link 'user' in bank_url between operation and bank transaction
617  $result = $acc->add_url_line(
618  $bank_line_id,
619  $socialcontrib->fk_user,
620  DOL_URL_ROOT.'/user/card.php?id=',
621  $fuser->getFullName($langs),
622  'user'
623  );
624 
625  if ($result <= 0) {
626  $this->error = $acc->error;
627  $error++;
628  }
629  }
630  }
631  }
632  } else {
633  $this->error = $acc->error;
634  $error++;
635  }
636  }
637 
638  if (!$error) {
639  return 1;
640  } else {
641  return -1;
642  }
643  }
644 
645 
646  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
653  public function update_fk_bank($id_bank)
654  {
655  // phpcs:enable
656  $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
657 
658  dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
659  $result = $this->db->query($sql);
660  if ($result) {
661  return 1;
662  } else {
663  $this->error = $this->db->error();
664  return 0;
665  }
666  }
667 
668 
675  public function getLibStatut($mode = 0)
676  {
677  return $this->LibStatut($this->statut, $mode);
678  }
679 
680  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
688  public function LibStatut($status, $mode = 0)
689  {
690  // phpcs:enable
691  global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
692 
693  $langs->load('compta');
694  /*if ($mode == 0)
695  {
696  if ($status == 0) return $langs->trans('ToValidate');
697  if ($status == 1) return $langs->trans('Validated');
698  }
699  if ($mode == 1)
700  {
701  if ($status == 0) return $langs->trans('ToValidate');
702  if ($status == 1) return $langs->trans('Validated');
703  }
704  if ($mode == 2)
705  {
706  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
707  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
708  }
709  if ($mode == 3)
710  {
711  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
712  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
713  }
714  if ($mode == 4)
715  {
716  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
717  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
718  }
719  if ($mode == 5)
720  {
721  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
722  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
723  }
724  if ($mode == 6)
725  {
726  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
727  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
728  }*/
729  return '';
730  }
731 
739  public function getNomUrl($withpicto = 0, $maxlen = 0)
740  {
741  global $langs;
742 
743  $result = '';
744 
745  if (empty($this->ref)) {
746  $this->ref = $this->label;
747  }
748 
749  $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
750  $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
751  if (!empty($this->label)) {
752  $labeltoshow = $this->label;
753  $reg = array();
754  if (preg_match('/^\((.*)\)$/i', $this->label, $reg)) {
755  // Label generique car entre parentheses. On l'affiche en le traduisant
756  if ($reg[1] == 'paiement') {
757  $reg[1] = 'Payment';
758  }
759  $labeltoshow = $langs->trans($reg[1]);
760  }
761  $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
762  }
763  if ($this->datep) {
764  $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
765  }
766 
767  if (!empty($this->id)) {
768  $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
769  $linkend = '</a>';
770 
771  if ($withpicto) {
772  $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
773  }
774  if ($withpicto && $withpicto != 2) {
775  $result .= ' ';
776  }
777  if ($withpicto != 2) {
778  $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
779  }
780  }
781 
782  return $result;
783  }
784 
785 
791  public function getVentilExportCompta()
792  {
793  $alreadydispatched = 0;
794 
795  $type = 'bank';
796 
797  $sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
798  $resql = $this->db->query($sql);
799  if ($resql) {
800  $obj = $this->db->fetch_object($resql);
801  if ($obj) {
802  $alreadydispatched = $obj->nb;
803  }
804  } else {
805  $this->error = $this->db->lasterror();
806  return -1;
807  }
808 
809  if ($alreadydispatched) {
810  return 1;
811  }
812  return 0;
813  }
814 }
db
$conf db
API class for accounts.
Definition: inc.php:41
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
dol_trunc
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.
Definition: functions.lib.php:3805
DoliDB
Class to manage Dolibarr database access.
Definition: DoliDB.class.php:30
ChargeSociales
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
Definition: chargesociales.class.php:34
PaymentSocialContribution
Class to manage payments of social contributions.
Definition: paymentsocialcontribution.class.php:33
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
ref
$object ref
Definition: info.php:77
PaymentSocialContribution\update
update($user=null, $notrigger=0)
Update database.
Definition: paymentsocialcontribution.class.php:329
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:44
PaymentSocialContribution\LibStatut
LibStatut($status, $mode=0)
Renvoi le libelle d'un statut donne.
Definition: paymentsocialcontribution.class.php:688
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
PaymentSocialContribution\getLibStatut
getLibStatut($mode=0)
Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
Definition: paymentsocialcontribution.class.php:675
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
PaymentSocialContribution\$total
$total
Definition: paymentsocialcontribution.class.php:68
PaymentSocialContribution\getNomUrl
getNomUrl($withpicto=0, $maxlen=0)
Return clicable name (with picto eventually)
Definition: paymentsocialcontribution.class.php:739
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
PaymentSocialContribution\initAsSpecimen
initAsSpecimen()
Initialise an instance with random values.
Definition: paymentsocialcontribution.class.php:515
PaymentSocialContribution\update_fk_bank
update_fk_bank($id_bank)
Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee.
Definition: paymentsocialcontribution.class.php:653
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
User
Class to manage Dolibarr users.
Definition: user.class.php:44
AccountLine
Class to manage bank transaction lines.
Definition: account.class.php:1779
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
PaymentSocialContribution\getVentilExportCompta
getVentilExportCompta()
Return if object was dispatched into bookkeeping.
Definition: paymentsocialcontribution.class.php:791
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5791
PaymentSocialContribution\__construct
__construct(DoliDB $db)
Constructor.
Definition: paymentsocialcontribution.class.php:125
PaymentSocialContribution\fetch
fetch($id)
Load object in memory from database.
Definition: paymentsocialcontribution.class.php:262
PaymentSocialContribution\createFromClone
createFromClone(User $user, $fromid)
Load an object from its id and create a new one in database.
Definition: paymentsocialcontribution.class.php:469
Account
Class to manage bank accounts.
Definition: account.class.php:38
PaymentSocialContribution\create
create($user, $closepaidcontrib=0)
Create payment of social contribution into database.
Definition: paymentsocialcontribution.class.php:138
PaymentSocialContribution\addPaymentToBank
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.
Definition: paymentsocialcontribution.class.php:546