28 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_invoice/modules_facturefournisseur.php';
29 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
59 public $update_main_doc_field;
70 public $phpmin = array(7, 0);
76 public $version =
'dolibarr';
101 public $marge_droite;
128 global $conf, $langs, $mysoc;
131 $langs->loadLangs(array(
"main",
"bills"));
134 $this->
name =
"canelle";
135 $this->
description = $langs->trans(
'SuppliersInvoiceModel');
136 $this->update_main_doc_field = 1;
141 $this->page_largeur = $formatarray[
'width'];
142 $this->page_hauteur = $formatarray[
'height'];
143 $this->format = array($this->page_largeur, $this->page_hauteur);
149 $this->option_logo = 1;
150 $this->option_tva = 1;
151 $this->option_modereg = 1;
152 $this->option_condreg = 1;
153 $this->option_multilang = 1;
156 $this->posxdesc = $this->marge_gauche + 1;
158 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
161 $this->posxqty = 130;
162 $this->posxunit = 147;
164 $this->posxtva = 106;
166 $this->posxqty = 145;
167 $this->posxunit = 162;
169 $this->posxdiscount = 162;
170 $this->postotalht = 174;
175 $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
176 if ($this->page_largeur < 210) {
177 $this->posxpicture -= 20;
178 $this->posxtva -= 20;
180 $this->posxqty -= 20;
181 $this->posxunit -= 20;
182 $this->posxdiscount -= 20;
183 $this->postotalht -= 20;
186 $this->tva = array();
187 $this->tva_array = array();
188 $this->localtax1 = array();
189 $this->localtax2 = array();
190 $this->atleastoneratenotnull = 0;
191 $this->atleastonediscount = 0;
207 public function write_file($object, $outputlangs =
'', $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
210 global $user, $langs, $conf, $mysoc, $hookmanager, $nblines;
213 if (!is_object($object->thirdparty)) {
214 $object->fetch_thirdparty();
216 if (!is_object($object->thirdparty)) {
217 $object->thirdparty = $mysoc;
220 $this->emetteur = $object->thirdparty;
221 if (!$this->emetteur->country_code) {
222 $this->emetteur->country_code = substr($langs->defaultlang, -2);
225 if (!is_object($outputlangs)) {
226 $outputlangs = $langs;
229 if (!empty($conf->global->MAIN_USE_FPDF)) {
230 $outputlangs->charset_output =
'ISO-8859-1';
234 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products"));
236 $nblines = count($object->lines);
238 if ($conf->fournisseur->facture->dir_output) {
239 $deja_regle = $object->getSommePaiement((
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
240 $amount_credit_notes_included = $object->getSumCreditNotesUsed((
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
241 $amount_deposits_included = $object->getSumDepositsUsed((
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
244 if ($object->specimen) {
245 $dir = $conf->fournisseur->facture->dir_output;
246 $file = $dir.
"/SPECIMEN.pdf";
250 $dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($object->id, 2, 0, 0, $object,
'invoice_supplier').$objectref;
251 $file = $dir.
"/".$objectref.
".pdf";
252 if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) {
253 $file = $dir.
"/".$objectref.($objectrefsupplier ?
"_".$objectrefsupplier :
"").
".pdf";
257 if (!file_exists($dir)) {
259 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
264 if (file_exists($dir)) {
266 if (!is_object($hookmanager)) {
267 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
270 $hookmanager->initHooks(array(
'pdfgeneration'));
271 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
273 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
276 $nblines = count($object->lines);
277 $nbpayments = count($object->getListOfPayments());
282 $pdf->SetAutoPageBreak(1, 0);
284 $heightforinfotot = 50 + (4 * $nbpayments);
285 if ($heightforinfotot > 220) {
286 $heightforinfotot = 220;
288 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
289 $heightforfooter = $this->marge_basse + 8;
290 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
291 $heightforfooter += 6;
294 if (class_exists(
'TCPDF')) {
295 $pdf->setPrintHeader(
false);
296 $pdf->setPrintFooter(
false);
300 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
301 $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
302 $tplidx = $pdf->importPage(1);
307 $pdf->SetDrawColor(128, 128, 128);
309 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
310 $pdf->SetSubject($outputlangs->transnoentities(
"PdfInvoiceTitle"));
311 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
312 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
313 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PdfInvoiceTitle").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
315 $pdf->SetCompression(
false);
318 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
321 for ($i = 0; $i < $nblines; $i++) {
322 if ($object->lines[$i]->remise_percent) {
323 $this->atleastonediscount++;
326 if (empty($this->atleastonediscount)) {
327 $delta = ($this->postotalht - $this->posxdiscount);
328 $this->posxpicture += $delta;
329 $this->posxtva += $delta;
330 $this->posxup += $delta;
331 $this->posxqty += $delta;
332 $this->posxunit += $delta;
333 $this->posxdiscount += $delta;
339 if (!empty($tplidx)) {
340 $pdf->useTemplate($tplidx);
343 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
344 $pdf->SetFont(
'',
'', $default_font_size - 1);
345 $pdf->MultiCell(0, 3,
'');
346 $pdf->SetTextColor(0, 0, 0);
348 $tab_top = 90 + $top_shift;
349 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
353 $desc_incoterms = $object->getIncotermsForPDF();
354 if ($desc_incoterms) {
357 $pdf->SetFont(
'',
'', $default_font_size - 1);
358 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
359 $nexY = $pdf->GetY();
360 $height_incoterms = $nexY - $tab_top;
363 $pdf->SetDrawColor(192, 192, 192);
364 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
366 $tab_top = $nexY + 6;
371 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
374 if (!empty($conf->global->INVOICE_ADD_EXTRAFIELD_IN_NOTE)) {
375 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
376 if (!empty($extranote)) {
389 $pdf->SetFont(
'',
'', $default_font_size - 1);
390 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($notetoshow), 0, 1);
391 $nexY = $pdf->GetY();
392 $height_note = $nexY - $tab_top;
395 $pdf->SetDrawColor(192, 192, 192);
396 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
398 $tab_top = $nexY + 6;
401 $iniY = $tab_top + 7;
402 $curY = $tab_top + 7;
403 $nexY = $tab_top + 7;
406 for ($i = 0; $i < $nblines; $i++) {
408 $pdf->SetFont(
'',
'', $default_font_size - 1);
409 $pdf->SetTextColor(0, 0, 0);
412 $imglinesize = array();
413 if (!empty($realpatharray[$i])) {
417 $pdf->setTopMargin($tab_top_newpage);
418 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
419 $pageposbefore = $pdf->getPage();
421 $showpricebeforepagebreak = 1;
425 $curX = $this->posxdesc - 1;
427 $pdf->startTransaction();
428 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc, 1);
429 $pageposafter = $pdf->getPage();
430 if ($pageposafter > $pageposbefore) {
431 $pdf->rollbackTransaction(
true);
432 $pageposafter = $pageposbefore;
434 $pdf->setPageOrientation(
'', 1, $heightforfooter);
435 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc, 1);
436 $posyafter = $pdf->GetY();
437 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
438 if ($i == ($nblines - 1)) {
439 $pdf->AddPage(
'',
'',
true);
440 if (!empty($tplidx)) {
441 $pdf->useTemplate($tplidx);
444 $this->
_pagehead($pdf, $object, 0, $outputlangs);
446 $pdf->setPage($pageposafter + 1);
451 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
452 $showpricebeforepagebreak = 1;
454 $showpricebeforepagebreak = 0;
459 $pdf->commitTransaction();
461 $posYAfterDescription = $pdf->GetY();
463 $nexY = $pdf->GetY();
464 $pageposafter = $pdf->getPage();
465 $pdf->setPage($pageposbefore);
466 $pdf->setTopMargin($this->marge_haute);
467 $pdf->setPageOrientation(
'', 1, 0);
470 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
471 $pdf->setPage($pageposafter);
472 $curY = $tab_top_newpage;
475 $pdf->SetFont(
'',
'', $default_font_size - 1);
478 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
480 $pdf->SetXY($this->posxtva, $curY);
481 $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0,
'R');
486 $pdf->SetXY($this->posxup, $curY);
487 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0,
'R', 0);
491 $pdf->SetXY($this->posxqty, $curY);
492 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
495 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
496 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
497 $pdf->SetXY($this->posxunit, $curY);
498 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
502 if ($object->lines[$i]->remise_percent) {
503 $pdf->SetXY($this->posxdiscount - 2, $curY);
505 $pdf->MultiCell($this->postotalht - $this->posxdiscount - 1, 3, $remise_percent, 0,
'R');
510 $pdf->SetXY($this->postotalht, $curY);
511 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0,
'R', 0);
514 if (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
515 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
517 $tvaligne = $object->lines[$i]->total_tva;
520 $localtax1ligne = $object->lines[$i]->total_localtax1;
521 $localtax2ligne = $object->lines[$i]->total_localtax2;
523 if (!empty($object->remise_percent)) {
524 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
527 $vatrate = (string) $object->lines[$i]->tva_tx;
528 $localtax1rate = (
string) $object->lines[$i]->localtax1_tx;
529 $localtax2rate = (string) $object->lines[$i]->localtax2_tx;
531 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
534 if (empty($this->tva[$vatrate])) {
535 $this->tva[$vatrate] = 0;
537 if (empty($this->localtax1[$localtax1rate])) {
538 $this->localtax1[$localtax1rate] = 0;
540 if (empty($this->localtax2[$localtax2rate])) {
541 $this->localtax2[$localtax2rate] = 0;
543 $this->tva[$vatrate] += $tvaligne;
544 $this->localtax1[$localtax1rate] += $localtax1ligne;
545 $this->localtax2[$localtax2rate] += $localtax2ligne;
547 if ($posYAfterImage > $posYAfterDescription) {
548 $nexY = $posYAfterImage;
552 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
553 $pdf->setPage($pageposafter);
554 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
556 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
557 $pdf->SetLineStyle(array(
'dash'=>0));
563 while ($pagenb < $pageposafter) {
564 $pdf->setPage($pagenb);
566 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
568 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
570 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
572 $pdf->setPage($pagenb);
573 $pdf->setPageOrientation(
'', 1, 0);
575 $this->
_pagehead($pdf, $object, 0, $outputlangs);
578 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
580 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
582 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
584 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
587 if (!empty($tplidx)) {
588 $pdf->useTemplate($tplidx);
592 $this->
_pagehead($pdf, $object, 0, $outputlangs);
599 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
600 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
602 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
603 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
607 $posy = $this->
_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
609 $amount_credit_notes_included = 0;
610 $amount_deposits_included = 0;
613 if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->SUPPLIER_INVOICE_NO_PAYMENT_DETAILS)) {
618 $this->
_pagefoot($pdf, $object, $outputlangs);
619 if (method_exists($pdf,
'AliasNbPages')) {
620 $pdf->AliasNbPages();
625 $pdf->Output($file,
'F');
628 $hookmanager->initHooks(array(
'pdfgeneration'));
629 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
631 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
633 $this->error = $hookmanager->error;
634 $this->errors = $hookmanager->errors;
637 if (!empty($conf->global->MAIN_UMASK)) {
638 @chmod($file, octdec($conf->global->MAIN_UMASK));
641 $this->result = array(
'fullpath'=>$file);
645 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
649 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
666 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
669 global $conf, $mysoc;
672 if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) {
680 $pdf->SetFont(
'',
'', $default_font_size - 1);
685 if ($this->page_largeur < 210) {
688 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
694 $pdf->SetFillColor(255, 255, 255);
695 $pdf->SetXY($col1x, $tab2_top + 0);
696 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
698 $total_ht = ((
isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
699 $pdf->SetXY($col2x, $tab2_top + 0);
700 $pdf->MultiCell($largcol2, $tab2_hl,
price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0,
'R', 1);
703 $pdf->SetFillColor(248, 248, 248);
705 $total_ttc = (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
707 $this->atleastoneratenotnull = 0;
708 foreach ($this->tva as $tvakey => $tvaval) {
710 $this->atleastoneratenotnull++;
713 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
717 if (preg_match(
'/\*/', $tvakey)) {
718 $tvakey = str_replace(
'*',
'', $tvakey);
719 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
722 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
723 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
724 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
726 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
727 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
730 if (!$this->atleastoneratenotnull) {
732 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
733 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code), 0,
'L', 1);
734 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
735 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_tva, 0, $outputlangs), 0,
'R', 1);
738 if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION ==
'localtax1on' && $object->total_localtax1 > 0) {
740 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
741 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code), 0,
'L', 1);
742 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
743 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax1, 0, $outputlangs), 0,
'R', 1);
747 if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION ==
'localtax2on' && $object->total_localtax2 > 0) {
749 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
750 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code), 0,
'L', 1);
751 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
752 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax2, 0, $outputlangs), 0,
'R', 1);
758 foreach ($this->localtax1 as $tvakey => $tvaval) {
763 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
766 if (preg_match(
'/\*/', $tvakey)) {
767 $tvakey = str_replace(
'*',
'', $tvakey);
768 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
770 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
771 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
772 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
774 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
775 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
783 foreach ($this->localtax2 as $tvakey => $tvaval) {
788 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
791 if (preg_match(
'/\*/', $tvakey)) {
792 $tvakey = str_replace(
'*',
'', $tvakey);
793 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
795 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
796 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
797 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
799 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
800 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
808 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
809 $pdf->SetTextColor(0, 0, 60);
810 $pdf->SetFillColor(224, 224, 224);
811 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
813 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
814 $pdf->MultiCell($largcol2, $tab2_hl,
price($sign * $total_ttc, 0, $outputlangs), $useborder,
'R', 1);
816 $pdf->SetTextColor(0, 0, 0);
817 $creditnoteamount = $object->getSumCreditNotesUsed((
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
818 $depositsamount = $object->getSumDepositsUsed((
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
820 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
821 if (!empty($object->paye)) {
825 if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) {
828 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
829 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Paid"), 0,
'L', 0);
830 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
831 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle + $depositsamount, 0, $outputlangs), 0,
'R', 0);
834 if ($creditnoteamount) {
835 $labeltouse = ($outputlangs->transnoentities(
"CreditNotesOrExcessReceived") !=
"CreditNotesOrExcessReceived") ? $outputlangs->transnoentities(
"CreditNotesOrExcessReceived") : $outputlangs->transnoentities(
"CreditNotes");
837 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
838 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0,
'L', 0);
839 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
840 $pdf->MultiCell($largcol2, $tab2_hl,
price($creditnoteamount, 0, $outputlangs), 0,
'R', 0);
844 if ($object->close_code == FactureFournisseur::CLOSECODE_DISCOUNTVAT) {
846 $pdf->SetFillColor(255, 255, 255);
848 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
849 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"EscompteOfferedShort"), $useborder,
'L', 1);
850 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
851 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder,
'R', 1);
857 $pdf->SetTextColor(0, 0, 60);
858 $pdf->SetFillColor(224, 224, 224);
859 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
860 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L', 1);
862 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
863 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
864 $pdf->SetFont(
'',
'', $default_font_size - 1);
865 $pdf->SetTextColor(0, 0, 0);
869 return ($tab2_top + ($tab2_hl * $index));
886 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
896 $currency = !empty($currency) ? $currency : $conf->currency;
900 $pdf->SetTextColor(0, 0, 0);
901 $pdf->SetFont(
'',
'', $default_font_size - 2);
903 if (empty($hidetop)) {
904 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
905 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
906 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
909 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
910 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5,
'F',
null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
914 $pdf->SetDrawColor(128, 128, 128);
915 $pdf->SetFont(
'',
'', $default_font_size - 1);
918 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
920 if (empty($hidetop)) {
921 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
923 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
924 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
927 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
928 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
929 if (empty($hidetop)) {
930 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
931 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
935 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
936 if (empty($hidetop)) {
937 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
938 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
941 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
942 if (empty($hidetop)) {
943 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
944 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
947 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
948 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
949 if (empty($hidetop)) {
950 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
952 $this->posxdiscount - $this->posxunit - 1,
954 $outputlangs->transnoentities(
"Unit"),
961 if ($this->atleastonediscount) {
962 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
963 if (empty($hidetop)) {
964 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
965 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
969 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
970 if (empty($hidetop)) {
971 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
972 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
994 if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) {
999 $tab3_top = $posy + 8;
1002 if ($this->page_largeur < 210) {
1008 $pdf->SetFont(
'',
'', $default_font_size - 3);
1009 $pdf->SetXY($tab3_posx, $tab3_top - 4);
1010 $pdf->MultiCell(60, 3, $outputlangs->transnoentities(
"PaymentsAlreadyDone"), 0,
'L', 0);
1012 $pdf->line($tab3_posx, $tab3_top, $tab3_posx + $tab3_width, $tab3_top);
1014 $pdf->SetFont(
'',
'', $default_font_size - 4);
1015 $pdf->SetXY($tab3_posx, $tab3_top);
1016 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Payment"), 0,
'L', 0);
1017 $pdf->SetXY($tab3_posx + 21, $tab3_top);
1018 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Amount"), 0,
'L', 0);
1019 $pdf->SetXY($tab3_posx + 40, $tab3_top);
1020 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Type"), 0,
'L', 0);
1021 $pdf->SetXY($tab3_posx + 58, $tab3_top);
1022 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Num"), 0,
'L', 0);
1024 $pdf->line($tab3_posx, $tab3_top - 1 + $tab3_height, $tab3_posx + $tab3_width, $tab3_top - 1 + $tab3_height);
1028 $pdf->SetFont(
'',
'', $default_font_size - 4);
1034 $sql =
"SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
1036 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX.
"paiementfourn as p";
1037 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
1038 $sql .=
" WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".((int) $object->id);
1039 $sql .=
" ORDER BY p.datep";
1042 $num = $this->
db->num_rows(
$resql);
1046 $row = $this->
db->fetch_object(
$resql);
1048 $pdf->SetXY($tab3_posx, $tab3_top + $y);
1049 $pdf->MultiCell(20, 3,
dol_print_date($this->
db->jdate($row->date),
'day',
false, $outputlangs,
true), 0,
'L', 0);
1050 $pdf->SetXY($tab3_posx + 21, $tab3_top + $y);
1051 $pdf->MultiCell(20, 3,
price($sign * ((
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0,
'L', 0);
1052 $pdf->SetXY($tab3_posx + 40, $tab3_top + $y);
1053 $oper = $outputlangs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
1055 $pdf->MultiCell(20, 3, $oper, 0,
'L', 0);
1056 $pdf->SetXY($tab3_posx + 58, $tab3_top + $y);
1057 $pdf->MultiCell(30, 3, $row->num, 0,
'L', 0);
1059 $pdf->line($tab3_posx, $tab3_top + $y + 3, $tab3_posx + $tab3_width, $tab3_top + $y + 3);
1064 $this->error = $this->
db->lasterror();
1079 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1081 global $langs, $conf, $mysoc;
1084 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills"));
1091 $pdf->SetTextColor(0, 0, 60);
1092 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1094 $posy = $this->marge_haute;
1095 $posx = $this->page_largeur - $this->marge_droite - 100;
1097 $pdf->SetXY($this->marge_gauche, $posy);
1119 $text = $this->emetteur->name;
1120 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1123 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1124 $pdf->SetXY($posx, $posy);
1125 $pdf->SetTextColor(0, 0, 60);
1126 $title = $outputlangs->transnoentities(
"PdfInvoiceTitle");
1127 if ($object->type == 1) {
1128 $title = $outputlangs->transnoentities(
"InvoiceReplacement");
1130 if ($object->type == 2) {
1131 $title = $outputlangs->transnoentities(
"InvoiceAvoir");
1133 if ($object->type == 3) {
1134 $title = $outputlangs->transnoentities(
"InvoiceDeposit");
1136 $pdf->MultiCell(100, 3, $title.
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
1139 if ($object->ref_supplier) {
1141 $pdf->SetFont(
'',
'B', $default_font_size);
1142 $pdf->SetXY($posx, $posy);
1143 $pdf->SetTextColor(0, 0, 60);
1144 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"RefSupplier").
" : ".$object->ref_supplier,
'',
'R');
1148 $pdf->SetFont(
'',
'', $default_font_size - 1);
1150 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
1151 $object->fetch_projet();
1152 if (!empty($object->project->ref)) {
1154 $pdf->SetXY($posx, $posy);
1155 $pdf->SetTextColor(0, 0, 60);
1156 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->project->title),
'',
'R');
1160 if (!empty($conf->global->PDF_SHOW_PROJECT)) {
1161 $object->fetch_projet();
1162 if (!empty($object->project->ref)) {
1163 $outputlangs->load(
"projects");
1165 $pdf->SetXY($posx, $posy);
1166 $langs->load(
"projects");
1167 $pdf->SetTextColor(0, 0, 60);
1168 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
1172 if ($object->date) {
1174 $pdf->SetXY($posx, $posy);
1175 $pdf->SetTextColor(0, 0, 60);
1176 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1179 $pdf->SetXY($posx, $posy);
1180 $pdf->SetTextColor(255, 0, 0);
1181 $pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities(
"OrderToProcess")),
'',
'R');
1184 if ($object->thirdparty->code_fournisseur) {
1186 $pdf->SetXY($posx, $posy);
1187 $pdf->SetTextColor(0, 0, 60);
1188 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
1192 $pdf->SetTextColor(0, 0, 60);
1196 $current_y = $pdf->getY();
1197 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1198 if ($current_y < $pdf->getY()) {
1199 $top_shift = $pdf->getY() - $current_y;
1204 $carac_emetteur =
'';
1206 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1207 if (count($arrayidcontact) > 0) {
1208 $object->fetch_user($arrayidcontact[0]);
1209 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1212 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1215 $posy = 42 + $top_shift;
1216 $posx = $this->marge_gauche;
1217 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1218 $posx = $this->page_largeur - $this->marge_droite - 80;
1223 $pdf->SetTextColor(0, 0, 0);
1224 $pdf->SetFont(
'',
'', $default_font_size - 2);
1225 $pdf->SetXY($posx, $posy - 5);
1226 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0,
'L');
1227 $pdf->SetXY($posx, $posy);
1228 $pdf->SetFillColor(230, 230, 230);
1229 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1230 $pdf->SetTextColor(0, 0, 60);
1233 $pdf->SetXY($posx + 2, $posy + 3);
1234 $pdf->SetFont(
'',
'B', $default_font_size);
1235 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1236 $posy = $pdf->getY();
1239 $pdf->SetXY($posx + 2, $posy);
1240 $pdf->SetFont(
'',
'', $default_font_size - 1);
1241 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1246 $usecontact =
false;
1247 $arrayidcontact = $object->getIdContact(
'internal',
'BILLING');
1248 if (count($arrayidcontact) > 0) {
1250 $result = $object->fetch_contact($arrayidcontact[0]);
1254 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1255 $thirdparty = $object->contact;
1257 $thirdparty = $mysoc;
1262 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact :
null), $usecontact,
'target', $object);
1266 if ($this->page_largeur < 210) {
1269 $posy = 42 + $top_shift;
1270 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1271 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1272 $posx = $this->marge_gauche;
1276 $pdf->SetTextColor(0, 0, 0);
1277 $pdf->SetFont(
'',
'', $default_font_size - 2);
1278 $pdf->SetXY($posx + 2, $posy - 5);
1279 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0,
'L');
1280 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1283 $pdf->SetXY($posx + 2, $posy + 3);
1284 $pdf->SetFont(
'',
'B', $default_font_size);
1285 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
1287 $posy = $pdf->getY();
1290 $pdf->SetFont(
'',
'', $default_font_size - 1);
1291 $pdf->SetXY($posx + 2, $posy);
1292 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1308 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1310 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1311 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Parent class for supplier invoices models.
Class to generate the supplier invoices PDF with the template canelle.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
_tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter=0)
Show payments table.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
__construct($db)
Constructor.
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.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
if(!function_exists('dolEscapeXML')) convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.