dolibarr  9.0.0
tva.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
5  * Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
6  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
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 <http://www.gnu.org/licenses/>.
20  */
21 
28 // Put here all includes required by your class file
29 require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30 
31 
35 class Tva extends CommonObject
36 {
40  public $element='tva';
41 
45  public $table_element='tva';
46 
50  public $picto='payment';
51 
52  public $tms;
53  public $datep;
54  public $datev;
55  public $amount;
56  public $type_payment;
57  public $num_payment;
58 
62  public $label;
63 
67  public $fk_bank;
68 
72  public $fk_user_creat;
73 
77  public $fk_user_modif;
78 
84  function __construct($db)
85  {
86  $this->db = $db;
87  }
88 
89 
96  function create($user)
97  {
98  global $conf, $langs;
99 
100  $error=0;
101  $now=dol_now();
102 
103  // Clean parameters
104  $this->amount=trim($this->amount);
105  $this->label=trim($this->label);
106  $this->note=trim($this->note);
107  $this->fk_bank = (int) $this->fk_bank;
108  $this->fk_user_creat = (int) $this->fk_user_creat;
109  $this->fk_user_modif = (int) $this->fk_user_modif;
110 
111  // Check parameters
112  // Put here code to add control on parameters values
113 
114  $this->db->begin();
115 
116  // Insert request
117  $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
118  $sql.= "datec,";
119  $sql.= "datep,";
120  $sql.= "datev,";
121  $sql.= "amount,";
122  $sql.= "label,";
123  $sql.= "note,";
124  $sql.= "fk_bank,";
125  $sql.= "fk_user_creat,";
126  $sql.= "fk_user_modif";
127  $sql.= ") VALUES (";
128  $sql.= " '".$this->db->idate($now)."',";
129  $sql.= " '".$this->db->idate($this->datep)."',";
130  $sql.= " '".$this->db->idate($this->datev)."',";
131  $sql.= " '".$this->db->escape($this->amount)."',";
132  $sql.= " '".$this->db->escape($this->label)."',";
133  $sql.= " '".$this->db->escape($this->note)."',";
134  $sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->db->escape($this->fk_bank)."'").",";
135  $sql.= " '".$this->db->escape($this->fk_user_creat)."',";
136  $sql.= " '".$this->db->escape($this->fk_user_modif)."'";
137  $sql.= ")";
138 
139  dol_syslog(get_class($this)."::create", LOG_DEBUG);
140  $resql=$this->db->query($sql);
141  if ($resql)
142  {
143  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva");
144 
145  // Call trigger
146  $result=$this->call_trigger('TVA_CREATE',$user);
147  if ($result < 0) $error++;
148  // End call triggers
149 
150  if (! $error)
151  {
152  $this->db->commit();
153  return $this->id;
154  }
155  else
156  {
157  $this->db->rollback();
158  return -1;
159  }
160  }
161  else
162  {
163  $this->error="Error ".$this->db->lasterror();
164  $this->db->rollback();
165  return -1;
166  }
167  }
168 
176  function update($user, $notrigger=0)
177  {
178  global $conf, $langs;
179 
180  $error=0;
181 
182  // Clean parameters
183  $this->amount=trim($this->amount);
184  $this->label=trim($this->label);
185  $this->note=trim($this->note);
186  $this->fk_bank = (int) $this->fk_bank;
187  $this->fk_user_creat = (int) $this->fk_user_creat;
188  $this->fk_user_modif = (int) $this->fk_user_modif;
189 
190  // Check parameters
191  // Put here code to add control on parameters values
192 
193  $this->db->begin();
194 
195  // Update request
196  $sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
197  $sql.= " tms='".$this->db->idate($this->tms)."',";
198  $sql.= " datep='".$this->db->idate($this->datep)."',";
199  $sql.= " datev='".$this->db->idate($this->datev)."',";
200  $sql.= " amount=".price2num($this->amount).",";
201  $sql.= " label='".$this->db->escape($this->label)."',";
202  $sql.= " note='".$this->db->escape($this->note)."',";
203  $sql.= " fk_bank=".$this->fk_bank.",";
204  $sql.= " fk_user_creat=".$this->fk_user_creat.",";
205  $sql.= " fk_user_modif=".($this->fk_user_modif>0?$this->fk_user_modif:$user->id)."";
206  $sql.= " WHERE rowid=".$this->id;
207 
208  dol_syslog(get_class($this)."::update", LOG_DEBUG);
209  $resql = $this->db->query($sql);
210  if (! $resql)
211  {
212  $this->error="Error ".$this->db->lasterror();
213  $error++;
214  }
215 
216  if (! $error && ! $notrigger)
217  {
218  // Call trigger
219  $result=$this->call_trigger('TVA_MODIFY',$user);
220  if ($result < 0) $error++;
221  // End call triggers
222  }
223 
224  if (! $error)
225  {
226  $this->db->commit();
227  return 1;
228  }
229  else
230  {
231  $this->db->rollback();
232  return -1;
233  }
234  }
235 
236 
244  function fetch($id, $user=null)
245  {
246  global $langs;
247  $sql = "SELECT";
248  $sql.= " t.rowid,";
249 
250  $sql.= " t.tms,";
251  $sql.= " t.datep,";
252  $sql.= " t.datev,";
253  $sql.= " t.amount,";
254  $sql.= " t.fk_typepayment,";
255  $sql.= " t.num_payment,";
256  $sql.= " t.label,";
257  $sql.= " t.note,";
258  $sql.= " t.fk_bank,";
259  $sql.= " t.fk_user_creat,";
260  $sql.= " t.fk_user_modif,";
261  $sql.= " b.fk_account,";
262  $sql.= " b.fk_type,";
263  $sql.= " b.rappro";
264 
265  $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
266  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
267  $sql.= " WHERE t.rowid = ".$id;
268 
269  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
270  $resql=$this->db->query($sql);
271  if ($resql)
272  {
273  if ($this->db->num_rows($resql))
274  {
275  $obj = $this->db->fetch_object($resql);
276 
277  $this->id = $obj->rowid;
278  $this->ref = $obj->rowid;
279  $this->tms = $this->db->jdate($obj->tms);
280  $this->datep = $this->db->jdate($obj->datep);
281  $this->datev = $this->db->jdate($obj->datev);
282  $this->amount = $obj->amount;
283  $this->type_payment = $obj->fk_typepayment;
284  $this->num_payment = $obj->num_payment;
285  $this->label = $obj->label;
286  $this->note = $obj->note;
287  $this->fk_bank = $obj->fk_bank;
288  $this->fk_user_creat = $obj->fk_user_creat;
289  $this->fk_user_modif = $obj->fk_user_modif;
290  $this->fk_account = $obj->fk_account;
291  $this->fk_type = $obj->fk_type;
292  $this->rappro = $obj->rappro;
293  }
294  $this->db->free($resql);
295 
296  return 1;
297  }
298  else
299  {
300  $this->error="Error ".$this->db->lasterror();
301  return -1;
302  }
303  }
304 
305 
312  function delete($user)
313  {
314  global $conf, $langs;
315 
316  $error=0;
317 
318  // Call trigger
319  $result=$this->call_trigger('TVA_DELETE',$user);
320  if ($result < 0) return -1;
321  // End call triggers
322 
323  $sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
324  $sql.= " WHERE rowid=".$this->id;
325 
326  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
327  $resql = $this->db->query($sql);
328  if (! $resql)
329  {
330  $this->error="Error ".$this->db->lasterror();
331  return -1;
332  }
333 
334 
335  return 1;
336  }
337 
338 
346  function initAsSpecimen()
347  {
348  $this->id=0;
349 
350  $this->tms='';
351  $this->datep='';
352  $this->datev='';
353  $this->amount='';
354  $this->label='';
355  $this->note='';
356  $this->fk_bank='';
357  $this->fk_user_creat='';
358  $this->fk_user_modif='';
359  }
360 
361 
368  function solde($year = 0)
369  {
370 
371  $reglee = $this->tva_sum_reglee($year);
372 
373  $payee = $this->tva_sum_payee($year);
374  $collectee = $this->tva_sum_collectee($year);
375 
376  $solde = $reglee - ($collectee - $payee);
377 
378  return $solde;
379  }
380 
381  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
388  function tva_sum_collectee($year = 0)
389  {
390  // phpcs:enable
391 
392  $sql = "SELECT sum(f.tva) as amount";
393  $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
394  if ($year)
395  {
396  $sql .= " AND f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' ";
397  }
398 
399  $result = $this->db->query($sql);
400  if ($result)
401  {
402  if ($this->db->num_rows($result))
403  {
404  $obj = $this->db->fetch_object($result);
405  $ret = $obj->amount;
406  $this->db->free($result);
407  return $ret;
408  }
409  else
410  {
411  $this->db->free($result);
412  return 0;
413  }
414  }
415  else
416  {
417  print $this->db->lasterror();
418  return -1;
419  }
420  }
421 
422  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
429  function tva_sum_payee($year = 0)
430  {
431  // phpcs:enable
432 
433  $sql = "SELECT sum(f.total_tva) as total_tva";
434  $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
435  if ($year)
436  {
437  $sql .= " WHERE f.datef >= '".$year."-01-01' AND f.datef <= '".$year."-12-31' ";
438  }
439 
440  $result = $this->db->query($sql);
441  if ($result)
442  {
443  if ($this->db->num_rows($result))
444  {
445  $obj = $this->db->fetch_object($result);
446  $ret = $obj->total_tva;
447  $this->db->free($result);
448  return $ret;
449  }
450  else
451  {
452  $this->db->free($result);
453  return 0;
454  }
455  }
456  else
457  {
458  print $this->db->lasterror();
459  return -1;
460  }
461  }
462 
463 
464  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
471  function tva_sum_reglee($year = 0)
472  {
473  // phpcs:enable
474 
475  $sql = "SELECT sum(f.amount) as amount";
476  $sql .= " FROM ".MAIN_DB_PREFIX."tva as f";
477 
478  if ($year)
479  {
480  $sql .= " WHERE f.datev >= '".$year."-01-01' AND f.datev <= '".$year."-12-31' ";
481  }
482 
483  $result = $this->db->query($sql);
484  if ($result)
485  {
486  if ($this->db->num_rows($result))
487  {
488  $obj = $this->db->fetch_object($result);
489  $ret = $obj->amount;
490  $this->db->free($result);
491  return $ret;
492  }
493  else
494  {
495  $this->db->free($result);
496  return 0;
497  }
498  }
499  else
500  {
501  print $this->db->lasterror();
502  return -1;
503  }
504  }
505 
506 
513  function addPayment($user)
514  {
515  global $conf,$langs;
516 
517  $this->db->begin();
518 
519  // Clean parameters
520  $this->amount=price2num(trim($this->amount));
521  $this->label=trim($this->label);
522  $this->note=trim($this->note);
523  $this->fk_bank = (int) $this->fk_bank;
524  $this->fk_user_creat = (int) $this->fk_user_creat;
525  $this->fk_user_modif = (int) $this->fk_user_modif;
526  if (empty($this->datec)) $this->datec = dol_now();
527 
528  // Check parameters
529  if (! $this->label)
530  {
531  $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
532  return -3;
533  }
534  if ($this->amount == '')
535  {
536  $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
537  return -4;
538  }
539  if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
540  {
541  $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
542  return -5;
543  }
544  if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
545  {
546  $this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
547  return -5;
548  }
549 
550  // Insert into llx_tva
551  $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (";
552  $sql.= "datec";
553  $sql.= ", datep";
554  $sql.= ", datev";
555  $sql.= ", amount";
556  $sql.= ", fk_typepayment";
557  $sql.= ", num_payment";
558  if ($this->note) $sql.= ", note";
559  if ($this->label) $sql.= ", label";
560  $sql.= ", fk_user_creat";
561  $sql.= ", fk_bank";
562  $sql.= ", entity";
563  $sql.= ") ";
564  $sql.= " VALUES (";
565  $sql.= " '".$this->db->idate($this->datec)."'";
566  $sql.= ", '".$this->db->idate($this->datep)."'";
567  $sql.= ", '".$this->db->idate($this->datev)."'";
568  $sql.= ", ".$this->amount;
569  $sql.= ", '".$this->db->escape($this->type_payment)."'";
570  $sql.= ", '".$this->db->escape($this->num_payment)."'";
571  if ($this->note) $sql.=", '".$this->db->escape($this->note)."'";
572  if ($this->label) $sql.=", '".$this->db->escape($this->label)."'";
573  $sql.= ", '".$this->db->escape($user->id)."'";
574  $sql.= ", NULL";
575  $sql.= ", ".$conf->entity;
576  $sql.= ")";
577 
578  dol_syslog(get_class($this)."::addPayment", LOG_DEBUG);
579  $result = $this->db->query($sql);
580  if ($result)
581  {
582  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO should be called 'payment_vat'
583 
584  // Call trigger
585  //XXX: Should be done just befor commit no ?
586  $result=$this->call_trigger('TVA_ADDPAYMENT',$user);
587  if ($result < 0)
588  {
589  $this->id = 0;
590  $ok = 0;
591  }
592  // End call triggers
593 
594  if ($this->id > 0)
595  {
596  $ok=1;
597  if (! empty($conf->banque->enabled) && ! empty($this->amount))
598  {
599  // Insert into llx_bank
600  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
601 
602  $acc = new Account($this->db);
603  $result=$acc->fetch($this->accountid);
604  if ($result <= 0) dol_print_error($this->db);
605 
606  if ($this->amount > 0) {
607  $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user);
608  } else {
609  $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), '', '', $user);
610  }
611 
612  // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction
613  if ($bank_line_id > 0)
614  {
615  $this->update_fk_bank($bank_line_id);
616  }
617  else
618  {
619  $this->error=$acc->error;
620  $ok=0;
621  }
622 
623  // Update links
624  $result=$acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/compta/tva/card.php?id=', "(VATPayment)", "payment_vat");
625  if ($result < 0)
626  {
627  $this->error=$acc->error;
628  $ok=0;
629  }
630  }
631 
632  if ($ok)
633  {
634  $this->db->commit();
635  return $this->id;
636  }
637  else
638  {
639  $this->db->rollback();
640  return -3;
641  }
642  }
643  else
644  {
645  $this->db->rollback();
646  return -2;
647  }
648  }
649  else
650  {
651  $this->error=$this->db->error();
652  $this->db->rollback();
653  return -1;
654  }
655  }
656 
657  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
664  function update_fk_bank($id_bank)
665  {
666  // phpcs:enable
667  $sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.(int) $id_bank;
668  $sql.= ' WHERE rowid = '.(int) $this->id;
669  $result = $this->db->query($sql);
670  if ($result)
671  {
672  return 1;
673  }
674  else
675  {
676  dol_print_error($this->db);
677  return -1;
678  }
679  }
680 
690  function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='')
691  {
692  global $langs, $conf;
693 
694  if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
695 
696  $result='';
697  $label=$langs->trans("ShowVatPayment").': '.$this->ref;
698 
699  $url = DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id;
700 
701  $linkclose='';
702  if (empty($notooltip))
703  {
704 
705 
706 
707  if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
708  {
709  $label=$langs->trans("ShowMyObject");
710  $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
711  }
712  $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
713  $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
714  }
715  else $linkclose = ($morecss?' class="'.$morecss.'"':'');
716 
717  $linkstart = '<a href="'.$url.'"';
718  $linkstart.=$linkclose.'>';
719  $linkend ='</a>';
720 
721  $picto='payment';
722 
723  $result .= $linkstart;
724  if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
725  if ($withpicto != 2) $result.= $this->ref;
726  $result .= $linkend;
727 
728  return $result;
729  }
730 
736  function getSommePaiement()
737  {
738  $table='paiementcharge';
739  $field='fk_charge';
740 
741  $sql = 'SELECT sum(amount) as amount';
742  $sql.= ' FROM '.MAIN_DB_PREFIX.$table;
743  $sql.= ' WHERE '.$field.' = '.$this->id;
744 
745  dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
746  $resql=$this->db->query($sql);
747  if ($resql)
748  {
749  $amount=0;
750 
751  $obj = $this->db->fetch_object($resql);
752  if ($obj) $amount=$obj->amount?$obj->amount:0;
753 
754  $this->db->free($resql);
755  return $amount;
756  }
757  else
758  {
759  return -1;
760  }
761  }
762 
769  function info($id)
770  {
771  $sql = "SELECT t.rowid, t.tms, t.fk_user_modif, t.datec, t.fk_user_creat";
772  $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
773  $sql.= " WHERE t.rowid = ".(int) $id;
774 
775  dol_syslog(get_class($this)."::info", LOG_DEBUG);
776  $result=$this->db->query($sql);
777  if ($result)
778  {
779  if ($this->db->num_rows($result))
780  {
781  $obj = $this->db->fetch_object($result);
782 
783  $this->id = $obj->rowid;
784 
785  if ($obj->fk_user_creat) {
786  $cuser = new User($this->db);
787  $cuser->fetch($obj->fk_user_creat);
788  $this->user_creation = $cuser;
789  }
790 
791  if ($obj->fk_user_modif) {
792  $muser = new User($this->db);
793  $muser->fetch($obj->fk_user_modif);
794  $this->user_modification = $muser;
795  }
796 
797  $this->date_creation = $this->db->jdate($obj->datec);
798  $this->date_modification = $this->db->jdate($obj->tms);
799  $this->import_key = $obj->import_key;
800  }
801 
802  $this->db->free($result);
803  }
804  else
805  {
806  dol_print_error($this->db);
807  }
808  }
809 
816  function getLibStatut($mode=0)
817  {
818  return $this->LibStatut($this->statut,$mode);
819  }
820 
821  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
829  function LibStatut($status,$mode=0)
830  {
831  // phpcs:enable
832  global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
833 
834  return '';
835  }
836 }
print $object label
hash of file content (md5_file(dol_osencode($destfull))
Definition: edit.php:153
addPayment($user)
Create in database.
Definition: tva.class.php:513
__construct($db)
Constructor.
Definition: tva.class.php:84
print
Draft customers invoices.
Definition: index.php:91
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
update($user, $notrigger=0)
Update database.
Definition: tva.class.php:176
tva_sum_payee($year=0)
VAT payed.
Definition: tva.class.php:429
LibStatut($status, $mode=0)
Renvoi le libelle d&#39;un statut donne.
Definition: tva.class.php:829
if(! empty($search_group)) natural_search(array("g.nom" g note
Definition: list.php:123
Class to manage Dolibarr users.
Definition: user.class.php:41
info($id)
Informations of vat payment object.
Definition: tva.class.php:769
initAsSpecimen()
Initialise an instance with random values.
Definition: tva.class.php:346
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
tva_sum_collectee($year=0)
Total of the VAT from invoices emitted by the thirdparty.
Definition: tva.class.php:388
Class to manage bank accounts.
Put here description of your class.
Definition: tva.class.php:35
solde($year=0)
Balance of VAT.
Definition: tva.class.php:368
getLibStatut($mode=0)
Retourne le libelle du statut d&#39;une facture (brouillon, validee, abandonnee, payee) ...
Definition: tva.class.php:816
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='')
Send name clicable (with possibly the picto)
Definition: tva.class.php:690
fetch($id, $user=null)
Load object in memory from database.
Definition: tva.class.php:244
dol_now($mode='gmt')
Return date for now.
create($user)
Create in database.
Definition: tva.class.php:96
getSommePaiement()
Return amount of payments already done.
Definition: tva.class.php:736
tva_sum_reglee($year=0)
Total of the VAT payed.
Definition: tva.class.php:471
update_fk_bank($id_bank)
Update link between payment tva and line generate into llx_bank.
Definition: tva.class.php:664
call_trigger($trigger_name, $user)
Call trigger based on this instance.
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)