dolibarr  17.0.3
paymentvat.class.php
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) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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/tva/class/tva.class.php';
28 
29 
33 class PaymentVAT extends CommonObject
34 {
38  public $element = 'payment_vat';
39 
43  public $table_element = 'payment_vat';
44 
48  public $picto = 'payment';
49 
53  public $fk_tva;
54 
55  public $datec = '';
56  public $tms = '';
57  public $datep = '';
58 
63  public $total;
64 
65  public $amount; // Total amount of payment
66  public $amounts = array(); // Array of amounts
67 
71  public $fk_typepaiement;
72 
77  public $num_paiement;
78 
82  public $num_payment;
83 
87  public $fk_bank;
88 
92  public $fk_user_creat;
93 
97  public $fk_user_modif;
98 
102  public $chid;
103 
109  public $lib;
110 
114  public $datepaye;
115 
119  public $paiementtype;
120 
126  public function __construct($db)
127  {
128  $this->db = $db;
129  }
130 
139  public function create($user, $closepaidcontrib = 0)
140  {
141  global $conf, $langs;
142 
143  $error = 0;
144 
145  $now = dol_now();
146 
147  dol_syslog(get_class($this)."::create", LOG_DEBUG);
148 
149  // Validate parametres
150  if (!$this->datepaye) {
151  $this->error = 'ErrorBadValueForParameterCreatePaymentVAT';
152  return -1;
153  }
154 
155  // Clean parameters
156  if (isset($this->fk_tva)) {
157  $this->fk_tva = (int) $this->fk_tva;
158  }
159  if (isset($this->amount)) {
160  $this->amount = trim($this->amount);
161  }
162  if (isset($this->fk_typepaiement)) {
163  $this->fk_typepaiement = (int) $this->fk_typepaiement;
164  }
165  if (isset($this->num_paiement)) {
166  $this->num_paiement = trim($this->num_paiement); // deprecated
167  }
168  if (isset($this->num_payment)) {
169  $this->num_payment = trim($this->num_payment);
170  }
171  if (isset($this->note)) {
172  $this->note = trim($this->note);
173  }
174  if (isset($this->fk_bank)) {
175  $this->fk_bank = (int) $this->fk_bank;
176  }
177  if (isset($this->fk_user_creat)) {
178  $this->fk_user_creat = (int) $this->fk_user_creat;
179  }
180  if (isset($this->fk_user_modif)) {
181  $this->fk_user_modif = (int) $this->fk_user_modif;
182  }
183 
184  $totalamount = 0;
185  foreach ($this->amounts as $key => $value) { // How payment is dispatch
186  $newvalue = price2num($value, 'MT');
187  $this->amounts[$key] = $newvalue;
188  $totalamount += $newvalue;
189  }
190  $totalamount = price2num($totalamount);
191 
192  // Check parameters
193  if ($totalamount == 0) {
194  return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
195  }
196 
197 
198  $this->db->begin();
199 
200  if ($totalamount != 0) {
201  $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_vat (fk_tva, datec, datep, amount,";
202  $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
203  $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
204  $sql .= " '".$this->db->idate($this->datepaye)."',";
205  $sql .= " ".((float) $totalamount).",";
206  $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
207  $sql .= " 0)";
208 
209  $resql = $this->db->query($sql);
210  if ($resql) {
211  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_vat");
212 
213  // Insere tableau des montants / factures
214  foreach ($this->amounts as $key => $amount) {
215  $contribid = $key;
216  if (is_numeric($amount) && $amount <> 0) {
217  $amount = price2num($amount);
218 
219  // If we want to closed payed invoices
220  if ($closepaidcontrib) {
221  $contrib = new Tva($this->db);
222  $contrib->fetch($contribid);
223  $paiement = $contrib->getSommePaiement();
224  //$creditnotes=$contrib->getSumCreditNotesUsed();
225  $creditnotes = 0;
226  //$deposits=$contrib->getSumDepositsUsed();
227  $deposits = 0;
228  $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
229  $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
230  if ($remaintopay == 0) {
231  $result = $contrib->setPaid($user);
232  } else {
233  dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
234  }
235  }
236  }
237  }
238  } else {
239  $error++;
240  }
241  }
242 
243  $result = $this->call_trigger('PAYMENTVAT_CREATE', $user);
244  if ($result < 0) {
245  $error++;
246  }
247 
248  if ($totalamount != 0 && !$error) {
249  $this->amount = $totalamount;
250  $this->total = $totalamount; // deprecated
251  $this->db->commit();
252  return $this->id;
253  } else {
254  $this->error = $this->db->error();
255  $this->db->rollback();
256  return -1;
257  }
258  }
259 
266  public function fetch($id)
267  {
268  global $langs;
269  $sql = "SELECT";
270  $sql .= " t.rowid,";
271  $sql .= " t.fk_tva,";
272  $sql .= " t.datec,";
273  $sql .= " t.tms,";
274  $sql .= " t.datep,";
275  $sql .= " t.amount,";
276  $sql .= " t.fk_typepaiement,";
277  $sql .= " t.num_paiement as num_payment,";
278  $sql .= " t.note,";
279  $sql .= " t.fk_bank,";
280  $sql .= " t.fk_user_creat,";
281  $sql .= " t.fk_user_modif,";
282  $sql .= " pt.code as type_code, pt.libelle as type_label,";
283  $sql .= ' b.fk_account';
284  $sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
285  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
286  $sql .= " WHERE t.rowid = ".((int) $id);
287  // TODO link on entity of tax;
288 
289  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
290  $resql = $this->db->query($sql);
291  if ($resql) {
292  if ($this->db->num_rows($resql)) {
293  $obj = $this->db->fetch_object($resql);
294 
295  $this->id = $obj->rowid;
296  $this->ref = $obj->rowid;
297 
298  $this->fk_tva = $obj->fk_tva;
299  $this->datec = $this->db->jdate($obj->datec);
300  $this->tms = $this->db->jdate($obj->tms);
301  $this->datep = $this->db->jdate($obj->datep);
302  $this->amount = $obj->amount;
303  $this->fk_typepaiement = $obj->fk_typepaiement;
304  $this->num_paiement = $obj->num_payment;
305  $this->num_payment = $obj->num_payment;
306  $this->note = $obj->note;
307  $this->fk_bank = $obj->fk_bank;
308  $this->fk_user_creat = $obj->fk_user_creat;
309  $this->fk_user_modif = $obj->fk_user_modif;
310 
311  $this->type_code = $obj->type_code;
312  $this->type_label = $obj->type_label;
313 
314  $this->bank_account = $obj->fk_account;
315  $this->bank_line = $obj->fk_bank;
316  }
317  $this->db->free($resql);
318 
319  return 1;
320  } else {
321  $this->error = "Error ".$this->db->lasterror();
322  return -1;
323  }
324  }
325 
326 
334  public function update($user = null, $notrigger = 0)
335  {
336  global $conf, $langs;
337  $error = 0;
338 
339  // Clean parameters
340 
341  if (isset($this->fk_tva)) {
342  $this->fk_tva = (int) $this->fk_tva;
343  }
344  if (isset($this->amount)) {
345  $this->amount = trim($this->amount);
346  }
347  if (isset($this->fk_typepaiement)) {
348  $this->fk_typepaiement = (int) $this->fk_typepaiement;
349  }
350  if (isset($this->num_paiement)) {
351  $this->num_paiement = trim($this->num_paiement); // deprecated
352  }
353  if (isset($this->num_payment)) {
354  $this->num_payment = trim($this->num_payment);
355  }
356  if (isset($this->note)) {
357  $this->note = trim($this->note);
358  }
359  if (isset($this->fk_bank)) {
360  $this->fk_bank = (int) $this->fk_bank;
361  }
362  if (isset($this->fk_user_creat)) {
363  $this->fk_user_creat = (int) $this->fk_user_creat;
364  }
365  if (isset($this->fk_user_modif)) {
366  $this->fk_user_modif = (int) $this->fk_user_modif;
367  }
368 
369 
370 
371  // Check parameters
372  // Put here code to add control on parameters values
373 
374  // Update request
375  $sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET";
376 
377  $sql .= " fk_tva=".(isset($this->fk_tva) ? $this->fk_tva : "null").",";
378  $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
379  $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
380  $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
381  $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").",";
382  $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").",";
383  $sql .= " num_paiement=".(isset($this->num_paiement) ? "'".$this->db->escape($this->num_paiement)."'" : "null").",";
384  $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
385  $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
386  $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").",";
387  $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
388 
389 
390  $sql .= " WHERE rowid=".((int) $this->id);
391 
392  $this->db->begin();
393 
394  dol_syslog(get_class($this)."::update", LOG_DEBUG);
395  $resql = $this->db->query($sql);
396  if (!$resql) {
397  $error++;
398  $this->errors[] = "Error ".$this->db->lasterror();
399  }
400 
401  // Commit or rollback
402  if ($error) {
403  foreach ($this->errors as $errmsg) {
404  dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
405  $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
406  }
407  $this->db->rollback();
408  return -1 * $error;
409  } else {
410  $this->db->commit();
411  return 1;
412  }
413  }
414 
415 
423  public function delete($user, $notrigger = 0)
424  {
425  global $conf, $langs;
426  $error = 0;
427 
428  dol_syslog(get_class($this)."::delete");
429 
430  $this->db->begin();
431 
432  if ($this->bank_line > 0) {
433  $accline = new AccountLine($this->db);
434  $accline->fetch($this->bank_line);
435  $result = $accline->delete();
436  if ($result < 0) {
437  $this->errors[] = $accline->error;
438  $error++;
439  }
440  }
441 
442  if (!$error) {
443  $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_vat";
444  $sql .= " WHERE rowid=".((int) $this->id);
445 
446  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
447  $resql = $this->db->query($sql);
448  if (!$resql) {
449  $error++;
450  $this->errors[] = "Error ".$this->db->lasterror();
451  }
452  }
453 
454  // Commit or rollback
455  if ($error) {
456  foreach ($this->errors as $errmsg) {
457  dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
458  $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
459  }
460  $this->db->rollback();
461  return -1 * $error;
462  } else {
463  $this->db->commit();
464  return 1;
465  }
466  }
467 
468 
469 
477  public function createFromClone(User $user, $fromid)
478  {
479  $error = 0;
480 
481  $object = new PaymentSocialContribution($this->db);
482 
483  $this->db->begin();
484 
485  // Load source object
486  $object->fetch($fromid);
487  $object->id = 0;
488  $object->statut = 0;
489 
490  // Clear fields
491  // ...
492 
493  // Create clone
494  $object->context['createfromclone'] = 'createfromclone';
495  $result = $object->create($user);
496 
497  // Other options
498  if ($result < 0) {
499  $this->error = $object->error;
500  $error++;
501  }
502 
503  unset($object->context['createfromclone']);
504 
505  // End
506  if (!$error) {
507  $this->db->commit();
508  return $object->id;
509  } else {
510  $this->db->rollback();
511  return -1;
512  }
513  }
514 
515 
523  public function initAsSpecimen()
524  {
525  $this->id = 0;
526 
527  $this->fk_tva = 0;
528  $this->datec = '';
529  $this->tms = '';
530  $this->datep = '';
531  $this->amount = '';
532  $this->fk_typepaiement = '';
533  $this->num_payment = '';
534  $this->note_private = '';
535  $this->note_public = '';
536  $this->fk_bank = 0;
537  $this->fk_user_creat = 0;
538  $this->fk_user_modif = 0;
539  }
540 
541 
554  public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
555  {
556  global $conf;
557 
558  // Clean data
559  $this->num_payment = trim($this->num_payment ? $this->num_payment : $this->num_paiement);
560 
561  $error = 0;
562 
563  if (isModEnabled("banque")) {
564  include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
565 
566  $acc = new Account($this->db);
567  $acc->fetch($accountid);
568 
570  if ($mode == 'payment_vat') {
571  $total = -$total;
572  }
573 
574  // Insert payment into llx_bank
575  $bank_line_id = $acc->addline(
576  $this->datepaye,
577  $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
578  $label,
579  $total,
580  $this->num_payment,
581  '',
582  $user,
583  $emetteur_nom,
584  $emetteur_banque
585  );
586 
587  // Mise a jour fk_bank dans llx_paiement.
588  // On connait ainsi le paiement qui a genere l'ecriture bancaire
589  if ($bank_line_id > 0) {
590  $result = $this->update_fk_bank($bank_line_id);
591  if ($result <= 0) {
592  $error++;
593  dol_print_error($this->db);
594  }
595 
596  // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
597  $url = '';
598  if ($mode == 'payment_vat') {
599  $url = DOL_URL_ROOT.'/compta/payment_vat/card.php?id=';
600  }
601  if ($url) {
602  $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
603  if ($result <= 0) {
604  $error++;
605  dol_print_error($this->db);
606  }
607  }
608 
609  // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
610  $linkaddedforthirdparty = array();
611  foreach ($this->amounts as $key => $value) {
612  if ($mode == 'payment_vat') {
613  $tva = new Tva($this->db);
614  $tva->fetch($key);
615  $result = $acc->add_url_line($bank_line_id, $tva->id, DOL_URL_ROOT.'/compta/tva/card.php?id=', '('.$tva->label.')', 'vat');
616  if ($result <= 0) {
617  dol_print_error($this->db);
618  }
619  }
620  }
621  } else {
622  $this->error = $acc->error;
623  $error++;
624  }
625  }
626 
627  if (!$error) {
628  return 1;
629  } else {
630  return -1;
631  }
632  }
633 
634 
635  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
642  public function update_fk_bank($id_bank)
643  {
644  // phpcs:enable
645  $sql = "UPDATE ".MAIN_DB_PREFIX."payment_vat SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
646 
647  dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
648  $result = $this->db->query($sql);
649  if ($result) {
650  return 1;
651  } else {
652  $this->error = $this->db->error();
653  return 0;
654  }
655  }
656 
657 
664  public function getLibStatut($mode = 0)
665  {
666  return $this->LibStatut($this->statut, $mode);
667  }
668 
669  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
677  public function LibStatut($status, $mode = 0)
678  {
679  // phpcs:enable
680  global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
681 
682  $langs->load('compta');
683  /*if ($mode == 0)
684  {
685  if ($status == 0) return $langs->trans('ToValidate');
686  if ($status == 1) return $langs->trans('Validated');
687  }
688  if ($mode == 1)
689  {
690  if ($status == 0) return $langs->trans('ToValidate');
691  if ($status == 1) return $langs->trans('Validated');
692  }
693  if ($mode == 2)
694  {
695  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
696  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
697  }
698  if ($mode == 3)
699  {
700  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
701  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
702  }
703  if ($mode == 4)
704  {
705  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
706  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
707  }
708  if ($mode == 5)
709  {
710  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
711  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
712  }
713  if ($mode == 6)
714  {
715  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
716  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
717  }*/
718  return '';
719  }
720 
728  public function getNomUrl($withpicto = 0, $maxlen = 0)
729  {
730  global $langs;
731 
732  $result = '';
733 
734  if (empty($this->ref)) {
735  $this->ref = $this->lib;
736  }
737 
738  $label = img_picto('', $this->picto).' <u>'.$langs->trans("VATPayment").'</u>';
739  $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
740  if (!empty($this->label)) {
741  $labeltoshow = $this->label;
742  $reg = array();
743  if (preg_match('/^\((.*)\)$/i', $this->label, $reg)) {
744  // Label generique car entre parentheses. On l'affiche en le traduisant
745  if ($reg[1] == 'paiement') {
746  $reg[1] = 'Payment';
747  }
748  $labeltoshow = $langs->trans($reg[1]);
749  }
750  $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
751  }
752  if ($this->datep) {
753  $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
754  }
755 
756  if (!empty($this->id)) {
757  $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_vat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
758  $linkend = '</a>';
759 
760  if ($withpicto) {
761  $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
762  }
763  if ($withpicto && $withpicto != 2) {
764  $result .= ' ';
765  }
766  if ($withpicto != 2) {
767  $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
768  }
769  }
770 
771  return $result;
772  }
773 }
PaymentVAT\update_fk_bank
update_fk_bank($id_bank)
Mise a jour du lien entre le paiement de tva et la ligne dans llx_bank generee.
Definition: paymentvat.class.php:642
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:1493
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:3949
PaymentVAT\update
update($user=null, $notrigger=0)
Update database.
Definition: paymentvat.class.php:334
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:4993
ref
$object ref
Definition: info.php:78
PaymentVAT
Class to manage payments of social contributions.
Definition: paymentvat.class.php:33
PaymentVAT\createFromClone
createFromClone(User $user, $fromid)
Load an object from its id and create a new one in database.
Definition: paymentvat.class.php:477
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:44
PaymentVAT\$total
$total
Definition: paymentvat.class.php:63
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5823
PaymentVAT\fetch
fetch($id)
Load object in memory from database.
Definition: paymentvat.class.php:266
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:2550
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:4024
PaymentVAT\__construct
__construct($db)
Constructor.
Definition: paymentvat.class.php:126
PaymentVAT\getLibStatut
getLibStatut($mode=0)
Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
Definition: paymentvat.class.php:664
PaymentVAT\LibStatut
LibStatut($status, $mode=0)
Renvoi le libelle d'un statut donne.
Definition: paymentvat.class.php:677
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1628
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:137
PaymentVAT\create
create($user, $closepaidcontrib=0)
Create payment of social contribution into database.
Definition: paymentvat.class.php:139
User
Class to manage Dolibarr users.
Definition: user.class.php:46
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:2951
PaymentVAT\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: paymentvat.class.php:554
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5818
PaymentVAT\getNomUrl
getNomUrl($withpicto=0, $maxlen=0)
Return clicable name (with picto eventually)
Definition: paymentvat.class.php:728
PaymentVAT\initAsSpecimen
initAsSpecimen()
Initialise an instance with random values.
Definition: paymentvat.class.php:523
Account
Class to manage bank accounts.
Definition: account.class.php:39
Tva
Put here description of your class.
Definition: tva.class.php:35