26 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonincoterm.class.php';
97 public $totaldeposits;
98 public $totalcreditnotes;
101 public $sumpayed_multicurrency;
103 public $sumdeposit_multicurrency;
104 public $sumcreditnote;
105 public $sumcreditnote_multicurrency;
123 $remaintopay =
price2num($this->total_ttc - $alreadypaid,
'MT');
124 if ($this->statut == self::STATUS_CLOSED && $this->close_code ==
'discount_vat') {
139 $table =
'paiement_facture';
140 $field =
'fk_facture';
141 if ($this->element ==
'facture_fourn' || $this->element ==
'invoice_supplier') {
142 $table =
'paiementfourn_facturefourn';
143 $field =
'fk_facturefourn';
146 $sql =
"SELECT sum(amount) as amount, sum(multicurrency_amount) as multicurrency_amount";
147 $sql .=
" FROM ".$this->db->prefix().$table;
148 $sql .=
" WHERE ".$field.
" = ".((int) $this->
id);
150 dol_syslog(get_class($this).
"::getSommePaiement", LOG_DEBUG);
153 $obj = $this->
db->fetch_object(
$resql);
156 if ($multicurrency) {
157 $this->sumpayed_multicurrency = $obj->multicurrency_amount;
158 return $obj->multicurrency_amount;
160 $this->sumpayed = $obj->amount;
164 $this->error = $this->
db->lasterror();
184 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
187 $result = $discountstatic->getSumDepositsUsed($this, $multicurrency);
190 if ($multicurrency) {
191 $this->sumdeposit_multicurrency = $result;
193 $this->sumdeposit = $result;
198 $this->error = $discountstatic->error;
211 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
214 $result = $discountstatic->getSumCreditNotesUsed($this, $multicurrency);
216 if ($multicurrency) {
217 $this->sumcreditnote_multicurrency = $result;
219 $this->sumcreditnote = $result;
224 $this->error = $discountstatic->error;
237 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
240 $result = $discountstatic->getSumFromThisCreditNotesNotUsed($this, $multicurrency);
244 $this->error = $discountstatic->error;
258 $sql =
"SELECT rowid";
259 $sql .=
" FROM ".$this->db->prefix().$this->table_element;
260 $sql .=
" WHERE fk_facture_source = ".((int) $this->
id);
261 $sql .=
" AND type = 2";
267 $row = $this->
db->fetch_row(
$resql);
268 $idarray[] = $row[0];
285 $sql =
"SELECT rowid";
286 $sql .=
" FROM ".$this->db->prefix().$this->table_element;
287 $sql .=
" WHERE fk_facture_source = ".((int) $this->
id);
288 $sql .=
" AND type < 2";
289 if ($option ==
'validated') {
290 $sql .=
' AND fk_statut = 1';
297 $sql .=
" ORDER BY fk_statut DESC";
301 $obj = $this->
db->fetch_object(
$resql);
324 $table =
'paiement_facture';
325 $table2 =
'paiement';
326 $field =
'fk_facture';
327 $field2 =
'fk_paiement';
328 $field3 =
', p.ref_ext';
329 $sharedentity =
'facture';
330 if ($this->element ==
'facture_fourn' || $this->element ==
'invoice_supplier') {
331 $table =
'paiementfourn_facturefourn';
332 $table2 =
'paiementfourn';
333 $field =
'fk_facturefourn';
334 $field2 =
'fk_paiementfourn';
336 $sharedentity =
'facture_fourn';
339 $sql =
"SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3;
340 $sql .=
" FROM ".$this->db->prefix().$table.
" as pf, ".$this->
db->prefix().$table2.
" as p, ".$this->
db->prefix().
"c_paiement as t";
341 $sql .=
" WHERE pf.".$field.
" = ".((int) $this->
id);
342 $sql .=
" AND pf.".$field2.
" = p.rowid";
343 $sql .=
' AND p.fk_paiement = t.id';
344 $sql .=
' AND p.entity IN ('.getEntity($sharedentity).
')';
346 $sql .=
" AND t.code='PRE'";
349 dol_syslog(get_class($this).
"::getListOfPayments", LOG_DEBUG);
355 $obj = $this->
db->fetch_object(
$resql);
356 $tmp = array(
'amount'=>$obj->amount,
'type'=>$obj->code,
'date'=>$obj->datep,
'num'=>$obj->num,
'ref'=>$obj->ref);
357 if (!empty($field3)) {
358 $tmp[
'ref_ext'] = $obj->ref_ext;
367 if ($this->element ==
'facture' || $this->element ==
'invoice') {
368 $sql =
"SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type";
369 $sql .=
' FROM '.$this->db->prefix().
'societe_remise_except as rc, '.$this->
db->prefix().
'facture as f';
370 $sql .=
' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $this->
id);
371 $sql .=
' AND (f.type = 2 OR f.type = 0 OR f.type = 3)';
372 } elseif ($this->element ==
'facture_fourn' || $this->element ==
'invoice_supplier') {
373 $sql =
"SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type";
374 $sql .=
' FROM '.$this->db->prefix().
'societe_remise_except as rc, '.$this->
db->prefix().
'facture_fourn as f';
375 $sql .=
' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $this->
id);
376 $sql .=
' AND (f.type = 2 OR f.type = 0 OR f.type = 3)';
385 $obj = $this->
db->fetch_object(
$resql);
386 if ($multicurrency) {
387 $retarray[] = array(
'amount'=>$obj->multicurrency_amount,
'type'=>$obj->type,
'date'=>$obj->date,
'num'=>
'0',
'ref'=>$obj->ref);
389 $retarray[] = array(
'amount'=>$obj->amount,
'type'=>$obj->type,
'date'=>$obj->date,
'num'=>
'',
'ref'=>$obj->ref);
394 $this->error = $this->
db->lasterror();
403 $this->error = $this->
db->lasterror();
430 $tmppart = substr($this->
ref, 1, 4);
432 if ($this->statut == self::STATUS_DRAFT && $tmppart ===
'PROV') {
436 if (!empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) {
441 if ($tmppart !==
'PROV') {
443 if ($ventilExportCompta != 0) {
448 if ($this->element !=
'invoice_supplier') {
449 if (empty($this->thirdparty)) {
452 $maxref = $this->getNextNumRef($this->thirdparty,
'last');
456 if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $maxref !=
'' && $maxref != $this->ref) {
463 if ($this->situation_cycle_ref && method_exists($this,
'is_last_in_cycle')) {
464 $last = $this->is_last_in_cycle();
473 if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $this->getSommePaiement() > 0) {
487 $alreadydispatched = 0;
489 $type =
'customer_invoice';
490 if ($this->element ==
'invoice_supplier') {
491 $type =
'supplier_invoice';
494 $sql =
" SELECT COUNT(ab.rowid) as nb FROM ".$this->db->prefix().
"accounting_bookkeeping as ab WHERE ab.doc_type='".$this->
db->escape($type).
"' AND ab.fk_doc = ".((int) $this->
id);
497 $obj = $this->
db->fetch_object(
$resql);
499 $alreadydispatched = $obj->nb;
502 $this->error = $this->
db->lasterror();
506 if ($alreadydispatched) {
522 return $langs->trans(
"InvoiceStandard");
524 return $langs->trans(
"InvoiceReplacement");
526 return $langs->trans(
"InvoiceAvoir");
528 return $langs->trans(
"InvoiceDeposit");
530 return $langs->trans(
"InvoiceProForma");
532 return $langs->trans(
"InvoiceSituation");
534 return $langs->trans(
"Unknown");
546 return $this->
LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->
type);
560 public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
564 $langs->load(
'bills');
570 $statusType =
'status0';
574 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusDraft');
575 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusDraft');
576 } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
578 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusCanceled');
579 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusCanceled');
581 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedUnpaid');
582 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedUnpaid');
584 $statusType =
'status5';
585 } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
586 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedPaidPartially');
587 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedPaidPartially');
588 $statusType =
'status9';
589 } elseif ($alreadypaid == 0) {
590 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
591 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusNotPaid');
592 $statusType =
'status1';
594 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusStarted');
595 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusStarted');
596 $statusType =
'status3';
599 $statusType =
'status6';
601 if ($type == self::TYPE_CREDIT_NOTE) {
602 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaidBackOrConverted');
603 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaidBackOrConverted');
604 } elseif ($type == self::TYPE_DEPOSIT) {
605 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusConverted');
606 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusConverted');
608 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaid');
609 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaid');
613 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
627 if (!$cond_reglement) {
628 $cond_reglement = $this->cond_reglement_code;
630 if (!$cond_reglement) {
631 $cond_reglement = $this->cond_reglement_id;
638 $sqltemp =
"SELECT c.type_cdr, c.nbjour, c.decalage";
639 $sqltemp .=
" FROM ".$this->db->prefix().
"c_payment_term as c";
640 if (is_numeric($cond_reglement)) {
641 $sqltemp .=
" WHERE c.rowid=".((int) $cond_reglement);
643 $sqltemp .=
" WHERE c.entity IN (".getEntity(
'c_payment_term').
")";
644 $sqltemp .=
" AND c.code = '".$this->db->escape($cond_reglement).
"'";
647 dol_syslog(get_class($this).
'::calculate_date_lim_reglement', LOG_DEBUG);
648 $resqltemp = $this->
db->query($sqltemp);
650 if ($this->
db->num_rows($resqltemp)) {
651 $obj = $this->
db->fetch_object($resqltemp);
652 $cdr_nbjour = $obj->nbjour;
653 $cdr_type = $obj->type_cdr;
654 $cdr_decalage = $obj->decalage;
657 $this->error = $this->
db->error();
660 $this->
db->free($resqltemp);
665 if ($cdr_type == 0) {
666 $datelim = $this->date + ($cdr_nbjour * 3600 * 24);
668 $datelim += ($cdr_decalage * 3600 * 24);
669 } elseif ($cdr_type == 1) {
671 $datelim = $this->date + ($cdr_nbjour * 3600 * 24);
673 $mois = date(
'm', $datelim);
674 $annee = date(
'Y', $datelim);
682 $datelim =
dol_mktime(12, 0, 0, $mois, 1, $annee);
683 $datelim -= (3600 * 24);
685 $datelim += ($cdr_decalage * 3600 * 24);
686 } elseif ($cdr_type == 2 && !empty($cdr_decalage)) {
688 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
689 $datelim = $this->date + ($cdr_nbjour * 3600 * 24);
691 $date_piece =
dol_mktime(0, 0, 0, date(
'm', $datelim), date(
'd', $datelim), date(
'Y', $datelim));
692 $date_lim_current =
dol_mktime(0, 0, 0, date(
'm', $datelim), $cdr_decalage, date(
'Y', $datelim));
695 $diff = $date_piece - $date_lim_current;
698 $datelim = $date_lim_current;
700 $datelim = $date_lim_next;
703 return 'Bad value for type_cdr in database for record cond_reglement = '.$cond_reglement;
727 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
729 if ($this->statut > self::STATUS_DRAFT && $this->paye == 0) {
730 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
732 $bac->fetch(0, $this->socid);
734 $sql =
"SELECT count(*)";
735 $sql .=
" FROM ".$this->db->prefix().
"prelevement_facture_demande";
736 if ($type ==
'bank-transfer') {
737 $sql .=
" WHERE fk_facture_fourn = ".((int) $this->
id);
739 $sql .=
" WHERE fk_facture = ".((int) $this->
id);
741 $sql .=
" AND ext_payment_id IS NULL";
742 $sql .=
" AND traite = 0";
744 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
747 $row = $this->
db->fetch_row(
$resql);
760 if (empty($amount)) {
761 $amount =
price2num($this->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits,
'MT');
764 if (is_numeric($amount) && $amount != 0) {
765 $sql =
'INSERT INTO '.$this->db->prefix().
'prelevement_facture_demande(';
766 if ($type ==
'bank-transfer') {
767 $sql .=
'fk_facture_fourn, ';
769 $sql .=
'fk_facture, ';
771 $sql .=
' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)';
772 $sql .=
" VALUES (".((int) $this->
id);
773 $sql .=
", ".((float)
price2num($amount));
774 $sql .=
", '".$this->db->idate($now).
"'";
775 $sql .=
", ".((int) $fuser->id);
776 $sql .=
", '".$this->db->escape($bac->code_banque).
"'";
777 $sql .=
", '".$this->db->escape($bac->code_guichet).
"'";
778 $sql .=
", '".$this->db->escape($bac->number).
"'";
779 $sql .=
", '".$this->db->escape($bac->cle_rib).
"'";
780 $sql .=
", '".$this->db->escape($sourcetype).
"'";
781 $sql .=
", ".((int) $conf->entity);
784 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
787 $this->error = $this->
db->lasterror();
788 dol_syslog(get_class($this).
'::demandeprelevement Erreur');
792 $this->error =
'WithdrawRequestErrorNilAmount';
793 dol_syslog(get_class($this).
'::demandeprelevement WithdrawRequestErrorNilAmount');
799 $payment_mode_id =
dol_getIdFromCode($this->
db, ($type ==
'bank-transfer' ?
'VIR' :
'PRE'),
'c_paiement',
'code',
'id', 1);
800 if ($payment_mode_id > 0) {
810 $this->error =
"A request already exists";
811 dol_syslog(get_class($this).
'::demandeprelevement Impossible de creer une demande, demande deja en cours');
815 $this->error = $this->
db->error();
816 dol_syslog(get_class($this).
'::demandeprelevement Erreur -2');
820 $this->error =
"Status of invoice does not allow this";
821 dol_syslog(get_class($this).
"::demandeprelevement ".$this->error.
" $this->statut, $this->paye, $this->mode_reglement_id");
837 $sql =
'DELETE FROM '.$this->db->prefix().
'prelevement_facture_demande';
838 $sql .=
' WHERE rowid = '.((int) $did);
839 $sql .=
' AND traite = 0';
840 if ($this->
db->query($sql)) {
843 $this->error = $this->
db->lasterror();
844 dol_syslog(get_class($this).
'::demande_prelevement_delete Error '.$this->error);
857 global $conf, $mysoc;
860 $tmplang->setDefaultLang(
'en_US');
861 $tmplang->load(
"main");
866 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
867 $pricetaxstring =
price2num($this->total_tva, 2, 1);
894 $s = pack(
'C1', 1).pack(
'C1', strlen($mysoc->name)).$mysoc->name;
895 $s .= pack(
'C1', 2).pack(
'C1', strlen($mysoc->tva_intra)).$mysoc->tva_intra;
896 $s .= pack(
'C1', 3).pack(
'C1', strlen($datestring)).$datestring;
897 $s .= pack(
'C1', 4).pack(
'C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
898 $s .= pack(
'C1', 5).pack(
'C1', strlen($pricetaxstring)).$pricetaxstring;
904 $s = base64_encode($s);
917 global $conf, $mysoc;
920 $tmplang->setDefaultLang(
'en_US');
921 $tmplang->load(
"main");
923 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
924 $pricetaxstring =
price2num($this->total_tva, 2, 1);
926 $complementaryinfo =
'';
940 $complementaryinfo =
'//S1/10/'.str_replace(
'/',
'', $this->
ref).
'/11/'.$datestring;
941 if ($this->ref_client) {
942 $complementaryinfo .=
'/20/'.$this->ref_client;
944 if ($this->thirdparty->vat_number) {
945 $complementaryinfo .=
'/30/'.$this->thirdparty->vat_number;
952 if ($this->fk_account > 0) {
956 $bankaccount->fetch($this->fk_account);
957 $s .= $bankaccount->iban.
"\n";
963 $s .=
dol_trunc($mysoc->name, 70,
'right',
'UTF-8', 1).
"\n";
964 $addresslinearray = explode(
"\n", $mysoc->address);
965 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
966 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
967 $s .=
dol_trunc($mysoc->zip, 16,
'right',
'UTF-8', 1).
"\n";
968 $s .=
dol_trunc($mysoc->town, 35,
'right',
'UTF-8', 1).
"\n";
969 $s .=
dol_trunc($mysoc->country_code, 2,
'right',
'UTF-8', 1).
"\n";
979 $s .=
price($pricewithtaxstring, 0,
'none', 0, 0, 2).
"\n";
980 $s .= ($this->multicurrency_code ? $this->multicurrency_code : $conf->currency).
"\n";
983 $s .=
dol_trunc($this->thirdparty->name, 70,
'right',
'UTF-8', 1).
"\n";
984 $addresslinearray = explode(
"\n", $this->thirdparty->address);
985 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
986 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
987 $s .=
dol_trunc($this->thirdparty->zip, 16,
'right',
'UTF-8', 1).
"\n";
988 $s .=
dol_trunc($this->thirdparty->town, 35,
'right',
'UTF-8', 1).
"\n";
989 $s .=
dol_trunc($this->thirdparty->country_code, 2,
'right',
'UTF-8', 1).
"\n";
993 if ($complementaryinfo) {
994 $s .= $complementaryinfo.
"\n";
1007 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1035 public $product_type = 0;
1041 public $product_ref;
1047 public $product_label;
1053 public $product_desc;
1084 public $vat_src_code;
1096 public $localtax1_tx;
1102 public $localtax2_tx;
1108 public $localtax1_type;
1114 public $localtax2_type;
1120 public $remise_percent;
1145 public $total_localtax1;
1151 public $total_localtax2;
1159 public $date_start_fill;
1160 public $date_end_fill;
1162 public $buy_price_ht;
1175 public $info_bits = 0;
1177 public $special_code = 0;
1179 public $fk_multicurrency;
1180 public $multicurrency_code;
1181 public $multicurrency_subprice;
1182 public $multicurrency_total_ht;
1183 public $multicurrency_total_tva;
1184 public $multicurrency_total_ttc;
1186 public $fk_user_author;
1187 public $fk_user_modif;
1189 public $fk_accounting_account;
calculate_date_lim_reglement($cond_reglement=0)
Returns an invoice payment deadline based on the invoice settlement conditions and billing date...
const STATUS_CLOSED
Classified paid.
const TYPE_STANDARD
Standard invoice.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
getSumFromThisCreditNotesNotUsed($multicurrency=0)
Return amount (with tax) of all converted amount for this credit note.
buildZATCAQRString()
Build string for ZATCA QR Code (Arabi Saudia)
is_erasable()
Return if an invoice can be deleted Rule is: If invoice is draft and has a temporary ref -> yes (1) I...
$conf db
API class for accounts.
getListOfPayments($filtertype= '')
Return list of payments.
dol_now($mode= 'auto')
Return date for now.
demande_prelevement_delete($fuser, $did)
Remove a direct debit request or a credit transfer request.
buildSwitzerlandQRString()
Build string for QR-Bill (Switzerland)
Class to manage bank accounts description of third parties.
getLibStatut($mode=0, $alreadypaid=-1)
Return label of object status.
$label
Custom label of line.
fetch_thirdparty($force_thirdparty_id=0)
Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0, $filters= '')
Return an id or code from a code or id.
Parent class of all other business classes for details of elements (invoices, contracts, proposals, orders, ...)
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
getListIdAvoirFromInvoice()
Returns array of credit note ids from the invoice.
Class to manage bank accounts.
const TYPE_PROFORMA
Proforma invoice.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
demande_prelevement($fuser, $amount=0, $type= 'direct-debit', $sourcetype= 'facture')
Create a withdrawal request for a direct debit order or a credit transfer order.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
getLibType()
Return label of type of invoice.
const TYPE_REPLACEMENT
Replacement invoice.
getRemainToPay($multicurrency=0)
Return remain amount to pay.
getSommePaiement($multicurrency=0)
Return amount of payments already done.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
getSumCreditNotesUsed($multicurrency=0)
Return amount (with tax) of all credit notes invoices + excess received used by invoice.
const STATUS_DRAFT
Draft status.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage translations.
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.
Superclass for invoices classes.
setPaymentMethods($id)
Change the payments methods.
trait CommonIncoterm
Superclass for incoterm classes.
const STATUS_ABANDONED
Classified abandoned and no payment done.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getSumDepositsUsed($multicurrency=0)
Return amount (with tax) of all deposits invoices used by invoice.
const TYPE_SITUATION
Situation invoice.
getIdReplacingInvoice($option= '')
Returns the id of the invoice that replaces it.
getVentilExportCompta()
Return if an invoice was dispatched into bookkeeping.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage absolute discounts.
const STATUS_VALIDATED
Validated (need to be paid)
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. ...
dolGetStatus($statusLabel= '', $statusLabelShort= '', $html= '', $statusType= 'status0', $displayMode=0, $url= '', $params=array())
Output the badge of a status.
const TYPE_DEPOSIT
Deposit invoice.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
LibStatut($paye, $status, $mode=0, $alreadypaid=-1, $type=-1)
Return label of a status.
const TYPE_CREDIT_NOTE
Credit note invoice.