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(5, 6);
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');
140 $this->page_largeur = $formatarray[
'width'];
141 $this->page_hauteur = $formatarray[
'height'];
142 $this->format = array($this->page_largeur, $this->page_hauteur);
143 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
144 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
145 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
146 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
148 $this->option_logo = 1;
149 $this->option_tva = 1;
150 $this->option_modereg = 1;
151 $this->option_condreg = 1;
152 $this->option_codeproduitservice = 1;
153 $this->option_multilang = 1;
156 $this->posxdesc = $this->marge_gauche + 1;
157 $this->posxtva = 112;
159 $this->posxqty = 145;
160 $this->posxunit = 162;
161 $this->posxdiscount = 162;
162 $this->postotalht = 174;
164 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
167 $this->posxqty = 130;
168 $this->posxunit = 147;
171 $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
172 if ($this->page_largeur < 210)
174 $this->posxpicture -= 20;
175 $this->posxtva -= 20;
177 $this->posxqty -= 20;
178 $this->posxunit -= 20;
179 $this->posxdiscount -= 20;
180 $this->postotalht -= 20;
183 $this->tva = array();
184 $this->localtax1 = array();
185 $this->localtax2 = array();
186 $this->atleastoneratenotnull = 0;
187 $this->atleastonediscount = 0;
203 public function write_file($object, $outputlangs =
'', $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
206 global $user, $langs, $conf, $mysoc, $hookmanager, $nblines;
209 if (!is_object($object->thirdparty)) $object->fetch_thirdparty();
210 if (!is_object($object->thirdparty)) $object->thirdparty = $mysoc;
211 $this->emetteur = $object->thirdparty;
212 if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2);
214 if (!is_object($outputlangs)) $outputlangs = $langs;
216 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
219 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products"));
221 $nblines = count($object->lines);
223 if ($conf->fournisseur->facture->dir_output)
225 $object->fetch_thirdparty();
227 $deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
228 $amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
229 $amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
232 if ($object->specimen)
234 $dir = $conf->fournisseur->facture->dir_output;
235 $file = $dir.
"/SPECIMEN.pdf";
239 $dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($object->id, 2, 0, 0, $object,
'invoice_supplier').$objectref;
240 $file = $dir.
"/".$objectref.
".pdf";
241 if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir.
"/".$objectref.($objectrefsupplier ?
"_".$objectrefsupplier :
"").
".pdf";
244 if (!file_exists($dir))
248 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
253 if (file_exists($dir))
256 if (!is_object($hookmanager))
258 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
261 $hookmanager->initHooks(array(
'pdfgeneration'));
262 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
264 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
267 $nblines = count($object->lines);
268 $nbpayments = count($object->getListOfPayments());
273 $pdf->SetAutoPageBreak(1, 0);
275 $heightforinfotot = 50 + (4 * $nbpayments);
276 if ($heightforinfotot > 220) {
277 $heightforinfotot = 220;
279 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
280 $heightforfooter = $this->marge_basse + 8;
281 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
283 if (class_exists(
'TCPDF'))
285 $pdf->setPrintHeader(
false);
286 $pdf->setPrintFooter(
false);
290 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
292 $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
293 $tplidx = $pdf->importPage(1);
298 $pdf->SetDrawColor(128, 128, 128);
300 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
301 $pdf->SetSubject($outputlangs->transnoentities(
"PdfInvoiceTitle"));
302 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
303 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
304 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PdfInvoiceTitle").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
305 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
307 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
310 for ($i = 0; $i < $nblines; $i++)
312 if ($object->lines[$i]->remise_percent)
314 $this->atleastonediscount++;
317 if (empty($this->atleastonediscount))
319 $delta = ($this->postotalht - $this->posxdiscount);
320 $this->posxpicture += $delta;
321 $this->posxtva += $delta;
322 $this->posxup += $delta;
323 $this->posxqty += $delta;
324 $this->posxunit += $delta;
325 $this->posxdiscount += $delta;
331 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
333 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
334 $pdf->SetFont(
'',
'', $default_font_size - 1);
335 $pdf->MultiCell(0, 3,
'');
336 $pdf->SetTextColor(0, 0, 0);
338 $tab_top = 90 + $top_shift;
339 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
342 if (!empty($conf->incoterm->enabled))
344 $desc_incoterms = $object->getIncotermsForPDF();
349 $pdf->SetFont(
'',
'', $default_font_size - 1);
350 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
351 $nexY = $pdf->GetY();
352 $height_incoterms = $nexY - $tab_top;
355 $pdf->SetDrawColor(192, 192, 192);
356 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
358 $tab_top = $nexY + 6;
363 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
374 $pdf->SetFont(
'',
'', $default_font_size - 1);
375 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($object->note_public), 0, 1);
376 $nexY = $pdf->GetY();
377 $height_note = $nexY - $tab_top;
380 $pdf->SetDrawColor(192, 192, 192);
381 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
383 $tab_top = $nexY + 6;
386 $iniY = $tab_top + 7;
387 $curY = $tab_top + 7;
388 $nexY = $tab_top + 7;
391 for ($i = 0; $i < $nblines; $i++)
394 $pdf->SetFont(
'',
'', $default_font_size - 1);
395 $pdf->SetTextColor(0, 0, 0);
398 $imglinesize = array();
401 $pdf->setTopMargin($tab_top_newpage);
402 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
403 $pageposbefore = $pdf->getPage();
405 $showpricebeforepagebreak = 1;
409 $curX = $this->posxdesc - 1;
411 $pdf->startTransaction();
412 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc, 1);
413 $pageposafter = $pdf->getPage();
414 if ($pageposafter > $pageposbefore)
416 $pdf->rollbackTransaction(
true);
417 $pageposafter = $pageposbefore;
419 $pdf->setPageOrientation(
'', 1, $heightforfooter);
420 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc, 1);
421 $posyafter = $pdf->GetY();
422 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
424 if ($i == ($nblines - 1))
426 $pdf->AddPage(
'',
'',
true);
427 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
428 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
429 $pdf->setPage($pageposafter + 1);
434 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
435 $showpricebeforepagebreak = 1;
436 else $showpricebeforepagebreak = 0;
440 $pdf->commitTransaction();
442 $posYAfterDescription = $pdf->GetY();
444 $nexY = $pdf->GetY();
445 $pageposafter = $pdf->getPage();
446 $pdf->setPage($pageposbefore);
447 $pdf->setTopMargin($this->marge_haute);
448 $pdf->setPageOrientation(
'', 1, 0);
451 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
452 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
455 $pdf->SetFont(
'',
'', $default_font_size - 1);
458 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
461 $pdf->SetXY($this->posxtva, $curY);
462 $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0,
'R');
467 $pdf->SetXY($this->posxup, $curY);
468 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0,
'R', 0);
472 $pdf->SetXY($this->posxqty, $curY);
473 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
476 if (!empty($conf->global->PRODUCT_USE_UNITS))
478 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
479 $pdf->SetXY($this->posxunit, $curY);
480 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
484 if ($object->lines[$i]->remise_percent)
486 $pdf->SetXY($this->posxdiscount - 2, $curY);
488 $pdf->MultiCell($this->postotalht - $this->posxdiscount - 1, 3, $remise_percent, 0,
'R');
493 $pdf->SetXY($this->postotalht, $curY);
494 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0,
'R', 0);
497 if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
498 else $tvaligne = $object->lines[$i]->total_tva;
500 $localtax1ligne = $object->lines[$i]->total_localtax1;
501 $localtax2ligne = $object->lines[$i]->total_localtax2;
503 if (!empty($object->remise_percent)) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
505 $vatrate = (string) $object->lines[$i]->tva_tx;
506 $localtax1rate = (
string) $object->lines[$i]->localtax1_tx;
507 $localtax2rate = (string) $object->lines[$i]->localtax2_tx;
509 if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .=
'*';
510 if (empty($this->tva[$vatrate])) $this->tva[$vatrate] = 0;
511 if (empty($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate] = 0;
512 if (empty($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate] = 0;
513 $this->tva[$vatrate] += $tvaligne;
514 $this->localtax1[$localtax1rate] += $localtax1ligne;
515 $this->localtax2[$localtax2rate] += $localtax2ligne;
517 if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage;
520 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
522 $pdf->setPage($pageposafter);
523 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
525 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
526 $pdf->SetLineStyle(array(
'dash'=>0));
532 while ($pagenb < $pageposafter)
534 $pdf->setPage($pagenb);
537 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
539 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
541 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
543 $pdf->setPage($pagenb);
544 $pdf->setPageOrientation(
'', 1, 0);
545 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
547 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
551 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
553 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
555 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
558 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
560 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
567 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
568 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
570 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
571 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
575 $posy = $this->
_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
577 $amount_credit_notes_included = 0;
578 $amount_deposits_included = 0;
581 if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->SUPPLIER_INVOICE_NO_PAYMENT_DETAILS))
587 $this->
_pagefoot($pdf, $object, $outputlangs);
588 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
592 $pdf->Output($file,
'F');
595 $hookmanager->initHooks(array(
'pdfgeneration'));
596 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
598 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
601 $this->error = $hookmanager->error;
602 $this->errors = $hookmanager->errors;
605 if (!empty($conf->global->MAIN_UMASK))
606 @chmod($file, octdec($conf->global->MAIN_UMASK));
608 $this->result = array(
'fullpath'=>$file);
612 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
616 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
633 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
636 global $conf, $mysoc;
639 if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
645 $pdf->SetFont(
'',
'', $default_font_size - 1);
648 $col1x = 120; $col2x = 170;
649 if ($this->page_largeur < 210)
653 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
659 $pdf->SetFillColor(255, 255, 255);
660 $pdf->SetXY($col1x, $tab2_top + 0);
661 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
663 $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
664 $pdf->SetXY($col2x, $tab2_top + 0);
665 $pdf->MultiCell($largcol2, $tab2_hl,
price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0,
'R', 1);
668 $pdf->SetFillColor(248, 248, 248);
670 $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
672 $this->atleastoneratenotnull = 0;
673 foreach ($this->tva as $tvakey => $tvaval)
677 $this->atleastoneratenotnull++;
680 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
684 if (preg_match(
'/\*/', $tvakey))
686 $tvakey = str_replace(
'*',
'', $tvakey);
687 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
690 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
691 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
692 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
694 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
695 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
698 if (!$this->atleastoneratenotnull)
701 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
702 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code), 0,
'L', 1);
703 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
704 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_tva, 0, $outputlangs), 0,
'R', 1);
707 if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION ==
'localtax1on' && $object->total_localtax1 > 0)
710 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
711 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code), 0,
'L', 1);
712 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
713 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax1, 0, $outputlangs), 0,
'R', 1);
717 if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION ==
'localtax2on' && $object->total_localtax2 > 0)
720 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
721 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code), 0,
'L', 1);
722 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
723 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax2, 0, $outputlangs), 0,
'R', 1);
729 foreach ($this->localtax1 as $tvakey => $tvaval) {
735 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
738 if (preg_match(
'/\*/', $tvakey))
740 $tvakey = str_replace(
'*',
'', $tvakey);
741 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
743 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
744 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
745 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
747 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
748 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
756 foreach ($this->localtax2 as $tvakey => $tvaval) {
762 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
765 if (preg_match(
'/\*/', $tvakey))
767 $tvakey = str_replace(
'*',
'', $tvakey);
768 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
770 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $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 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
784 $pdf->SetTextColor(0, 0, 60);
785 $pdf->SetFillColor(224, 224, 224);
786 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
788 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
789 $pdf->MultiCell($largcol2, $tab2_hl,
price($sign * $total_ttc, 0, $outputlangs), $useborder,
'R', 1);
791 $pdf->SetTextColor(0, 0, 0);
792 $creditnoteamount = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
793 $depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
795 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
796 if (!empty($object->paye)) $resteapayer = 0;
798 if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
802 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
803 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Paid"), 0,
'L', 0);
804 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
805 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle + $depositsamount, 0, $outputlangs), 0,
'R', 0);
808 if ($creditnoteamount)
810 $labeltouse = ($outputlangs->transnoentities(
"CreditNotesOrExcessReceived") !=
"CreditNotesOrExcessReceived") ? $outputlangs->transnoentities(
"CreditNotesOrExcessReceived") : $outputlangs->transnoentities(
"CreditNotes");
812 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
813 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0,
'L', 0);
814 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
815 $pdf->MultiCell($largcol2, $tab2_hl,
price($creditnoteamount, 0, $outputlangs), 0,
'R', 0);
819 if ($object->close_code == FactureFournisseur::CLOSECODE_DISCOUNTVAT)
822 $pdf->SetFillColor(255, 255, 255);
824 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
825 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"EscompteOfferedShort"), $useborder,
'L', 1);
826 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
827 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder,
'R', 1);
833 $pdf->SetTextColor(0, 0, 60);
834 $pdf->SetFillColor(224, 224, 224);
835 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
836 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L', 1);
838 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
839 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
840 $pdf->SetFont(
'',
'', $default_font_size - 1);
841 $pdf->SetTextColor(0, 0, 0);
845 return ($tab2_top + ($tab2_hl * $index));
862 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
868 if ($hidetop) $hidetop = -1;
870 $currency = !empty($currency) ? $currency : $conf->currency;
874 $pdf->SetTextColor(0, 0, 0);
875 $pdf->SetFont(
'',
'', $default_font_size - 2);
879 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
880 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
881 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
884 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $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));
887 $pdf->SetDrawColor(128, 128, 128);
888 $pdf->SetFont(
'',
'', $default_font_size - 1);
891 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
895 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
897 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
898 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
901 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
903 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
906 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
907 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
911 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
914 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
915 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
918 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
921 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
922 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
925 if (!empty($conf->global->PRODUCT_USE_UNITS))
927 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
928 if (empty($hidetop)) {
929 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
930 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
935 if ($this->atleastonediscount)
937 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
940 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
941 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
945 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
948 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
949 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
970 if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1;
973 $tab3_top = $posy + 8;
976 if ($this->page_largeur < 210)
983 $pdf->SetFont(
'',
'', $default_font_size - 3);
984 $pdf->SetXY($tab3_posx, $tab3_top - 4);
985 $pdf->MultiCell(60, 3, $outputlangs->transnoentities(
"PaymentsAlreadyDone"), 0,
'L', 0);
987 $pdf->line($tab3_posx, $tab3_top, $tab3_posx + $tab3_width, $tab3_top);
989 $pdf->SetFont(
'',
'', $default_font_size - 4);
990 $pdf->SetXY($tab3_posx, $tab3_top);
991 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Payment"), 0,
'L', 0);
992 $pdf->SetXY($tab3_posx + 21, $tab3_top);
993 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Amount"), 0,
'L', 0);
994 $pdf->SetXY($tab3_posx + 40, $tab3_top);
995 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Type"), 0,
'L', 0);
996 $pdf->SetXY($tab3_posx + 58, $tab3_top);
997 $pdf->MultiCell(20, 3, $outputlangs->transnoentities(
"Num"), 0,
'L', 0);
999 $pdf->line($tab3_posx, $tab3_top - 1 + $tab3_height, $tab3_posx + $tab3_width, $tab3_top - 1 + $tab3_height);
1003 $pdf->SetFont(
'',
'', $default_font_size - 4);
1009 $sql =
"SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,";
1011 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX.
"paiementfourn as p";
1012 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON p.fk_paiement = cp.id";
1013 $sql .=
" WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id;
1014 $sql .=
" ORDER BY p.datep";
1018 $num = $this->
db->num_rows(
$resql);
1022 $row = $this->
db->fetch_object(
$resql);
1024 $pdf->SetXY($tab3_posx, $tab3_top + $y);
1025 $pdf->MultiCell(20, 3,
dol_print_date($this->
db->jdate($row->date),
'day',
false, $outputlangs,
true), 0,
'L', 0);
1026 $pdf->SetXY($tab3_posx + 21, $tab3_top + $y);
1027 $pdf->MultiCell(20, 3,
price($sign * ((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0,
'L', 0);
1028 $pdf->SetXY($tab3_posx + 40, $tab3_top + $y);
1029 $oper = $outputlangs->transnoentitiesnoconv(
"PaymentTypeShort".$row->code);
1031 $pdf->MultiCell(20, 3, $oper, 0,
'L', 0);
1032 $pdf->SetXY($tab3_posx + 58, $tab3_top + $y);
1033 $pdf->MultiCell(30, 3, $row->num, 0,
'L', 0);
1035 $pdf->line($tab3_posx, $tab3_top + $y + 3, $tab3_posx + $tab3_width, $tab3_top + $y + 3);
1040 $this->error = $this->
db->lasterror();
1055 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1057 global $langs, $conf, $mysoc;
1060 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills"));
1067 $pdf->SetTextColor(0, 0, 60);
1068 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1070 $posy = $this->marge_haute;
1071 $posx = $this->page_largeur - $this->marge_droite - 100;
1073 $pdf->SetXY($this->marge_gauche, $posy);
1095 $text = $this->emetteur->name;
1096 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1099 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1100 $pdf->SetXY($posx, $posy);
1101 $pdf->SetTextColor(0, 0, 60);
1102 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierInvoice").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
1105 if ($object->ref_supplier)
1108 $pdf->SetFont(
'',
'B', $default_font_size);
1109 $pdf->SetXY($posx, $posy);
1110 $pdf->SetTextColor(0, 0, 60);
1111 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"RefSupplier").
" : ".$object->ref_supplier,
'',
'R');
1115 $pdf->SetFont(
'',
'', $default_font_size - 1);
1117 if (!empty($conf->global->PDF_SHOW_PROJECT))
1119 $object->fetch_projet();
1120 if (!empty($object->project->ref))
1123 $pdf->SetXY($posx, $posy);
1124 $langs->load(
"projects");
1125 $pdf->SetTextColor(0, 0, 60);
1126 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->ref) ?
'' : $object->projet->ref),
'',
'R');
1133 $pdf->SetXY($posx, $posy);
1134 $pdf->SetTextColor(0, 0, 60);
1135 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1138 $pdf->SetXY($posx, $posy);
1139 $pdf->SetTextColor(255, 0, 0);
1140 $pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities(
"OrderToProcess")),
'',
'R');
1143 if ($object->thirdparty->code_fournisseur)
1146 $pdf->SetXY($posx, $posy);
1147 $pdf->SetTextColor(0, 0, 60);
1148 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
1152 $pdf->SetTextColor(0, 0, 60);
1156 $current_y = $pdf->getY();
1157 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1158 if ($current_y < $pdf->getY())
1160 $top_shift = $pdf->getY() - $current_y;
1166 $carac_emetteur =
'';
1168 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1169 if (count($arrayidcontact) > 0)
1171 $object->fetch_user($arrayidcontact[0]);
1172 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1175 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1178 $posy = 42 + $top_shift;
1179 $posx = $this->marge_gauche;
1180 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1184 $pdf->SetTextColor(0, 0, 0);
1185 $pdf->SetFont(
'',
'', $default_font_size - 2);
1186 $pdf->SetXY($posx, $posy - 5);
1187 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
1188 $pdf->SetXY($posx, $posy);
1189 $pdf->SetFillColor(230, 230, 230);
1190 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1191 $pdf->SetTextColor(0, 0, 60);
1194 $pdf->SetXY($posx + 2, $posy + 3);
1195 $pdf->SetFont(
'',
'B', $default_font_size);
1196 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1197 $posy = $pdf->getY();
1200 $pdf->SetXY($posx + 2, $posy);
1201 $pdf->SetFont(
'',
'', $default_font_size - 1);
1202 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1207 $usecontact =
false;
1208 $arrayidcontact = $object->getIdContact(
'internal',
'BILLING');
1209 if (count($arrayidcontact) > 0)
1212 $result = $object->fetch_contact($arrayidcontact[0]);
1216 if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1217 $thirdparty = $object->contact;
1219 $thirdparty = $mysoc;
1224 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact,
'target', $object);
1228 if ($this->page_largeur < 210) $widthrecbox = 84;
1229 $posy = 42 + $top_shift;
1230 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1231 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1234 $pdf->SetTextColor(0, 0, 0);
1235 $pdf->SetFont(
'',
'', $default_font_size - 2);
1236 $pdf->SetXY($posx + 2, $posy - 5);
1237 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo").
":", 0,
'L');
1238 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1241 $pdf->SetXY($posx + 2, $posy + 3);
1242 $pdf->SetFont(
'',
'B', $default_font_size);
1243 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
1245 $posy = $pdf->getY();
1248 $pdf->SetFont(
'',
'', $default_font_size - 1);
1249 $pdf->SetXY($posx + 2, $posy);
1250 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1266 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1269 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1270 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
write_file($object, $outputlangs= '', $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
__construct($db)
Constructor.
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...
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
$conf db name
Only used if Module[ID]Name translation string is not found.
Parent class for supplier invoices models.
$conf db
API class for accounts.
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...
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency= '')
Show table for lines.
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
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)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany= '', $targetcontact= '', $usecontact=0, $mode= 'source', $object=null)
Return a string with full address formated for output on documents.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->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)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Class to generate the supplier invoices PDF with the template canelle.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
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...