32 require_once DOL_DOCUMENT_ROOT.
'/core/modules/propale/modules_propale.php';
33 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
62 public $update_main_doc_field;
73 public $phpmin = array(7, 0);
79 public $version =
'dolibarr';
104 public $marge_droite;
135 global $conf, $langs, $mysoc;
138 $langs->loadLangs(array(
"main",
"bills"));
141 $this->
name =
"cyan";
142 $this->
description = $langs->trans(
'DocModelCyanDescription');
143 $this->update_main_doc_field = 1;
148 $this->page_largeur = $formatarray[
'width'];
149 $this->page_hauteur = $formatarray[
'height'];
150 $this->format = array($this->page_largeur, $this->page_hauteur);
156 $this->option_logo = 1;
157 $this->option_tva = 1;
158 $this->option_modereg = 1;
159 $this->option_condreg = 1;
160 $this->option_multilang = 1;
161 $this->option_escompte = 0;
162 $this->option_credit_note = 0;
163 $this->option_freetext = 1;
164 $this->option_draft_watermark = 1;
165 $this->watermark =
'';
168 $this->emetteur = $mysoc;
169 if (empty($this->emetteur->country_code)) {
170 $this->emetteur->country_code = substr($langs->defaultlang, -2);
174 $this->posxdesc = $this->marge_gauche + 1;
177 $this->tabTitleHeight = 5;
181 $this->tva = array();
182 $this->tva_array = array();
183 $this->localtax1 = array();
184 $this->localtax2 = array();
185 $this->atleastoneratenotnull = 0;
186 $this->atleastonediscount = 0;
201 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
204 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
206 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
208 if (!is_object($outputlangs)) {
209 $outputlangs = $langs;
212 if (!empty($conf->global->MAIN_USE_FPDF)) {
213 $outputlangs->charset_output =
'ISO-8859-1';
217 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
220 if ($object->statut == $object::STATUS_DRAFT &&
getDolGlobalString(
'PROPALE_DRAFT_WATERMARK')) {
224 global $outputlangsbis;
225 $outputlangsbis =
null;
226 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
227 $outputlangsbis =
new Translate(
'', $conf);
228 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
229 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
232 $nblines = count($object->lines);
235 if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
236 $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
240 $realpatharray = array();
241 $this->atleastonephoto =
false;
242 if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) {
245 for ($i = 0; $i < $nblines; $i++) {
246 if (empty($object->lines[$i]->fk_product)) {
250 $objphoto->fetch($object->lines[$i]->fk_product);
253 $pdir[0] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
254 $pdir[1] =
get_exdir(0, 0, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
256 $pdir[0] =
get_exdir(0, 0, 0, 0, $objphoto,
'product');
257 $pdir[1] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
261 foreach ($pdir as $midir) {
263 if ($conf->entity != $objphoto->entity) {
264 $dir = $conf->product->multidir_output[$objphoto->entity].
'/'.$midir;
266 $dir = $conf->product->dir_output.
'/'.$midir;
269 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
271 if ($obj[
'photo_vignette']) {
272 $filename = $obj[
'photo_vignette'];
274 $filename = $obj[
'photo'];
277 $filename = $obj[
'photo'];
280 $realpath = $dir.$filename;
282 $this->atleastonephoto =
true;
287 if ($realpath && $arephoto) {
288 $realpatharray[$i] = $realpath;
293 if (count($realpatharray) == 0) {
294 $this->posxpicture = $this->posxtva;
297 if ($conf->propal->multidir_output[$conf->entity]) {
298 $object->fetch_thirdparty();
303 if ($object->specimen) {
304 $dir = $conf->propal->multidir_output[$conf->entity];
305 $file = $dir.
"/SPECIMEN.pdf";
308 $dir = $conf->propal->multidir_output[$object->entity].
"/".$objectref;
309 $file = $dir.
"/".$objectref.
".pdf";
312 if (!file_exists($dir)) {
314 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
319 if (file_exists($dir)) {
321 if (!is_object($hookmanager)) {
322 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
325 $hookmanager->initHooks(array(
'pdfgeneration'));
326 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
328 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
331 $nblines = count($object->lines);
337 $pdf->SetAutoPageBreak(1, 0);
339 if (class_exists(
'TCPDF')) {
340 $pdf->setPrintHeader(
false);
341 $pdf->setPrintFooter(
false);
345 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
346 $logodir = $conf->mycompany->dir_output;
347 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
348 $logodir = $conf->mycompany->multidir_output[$object->entity];
350 $pagecount = $pdf->setSourceFile($logodir.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
351 $tplidx = $pdf->importPage(1);
356 $pdf->SetDrawColor(128, 128, 128);
358 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
359 $pdf->SetSubject($outputlangs->transnoentities(
"PdfCommercialProposalTitle"));
360 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
361 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
362 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PdfCommercialProposalTitle").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
364 $pdf->SetCompression(
false);
367 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
370 for ($i = 0; $i < $nblines; $i++) {
371 if ($object->lines[$i]->remise_percent) {
372 $this->atleastonediscount++;
379 if (!empty($tplidx)) {
380 $pdf->useTemplate($tplidx);
384 $heightforinfotot = 40;
385 $heightforsignature = empty($conf->global->PROPAL_DISABLE_SIGNATURE) ? (
pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities(
"ProposalCustomerSignature")) + 10) : 0;
386 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
387 $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22);
390 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
391 $pdf->SetFont(
'',
'', $default_font_size - 1);
392 $pdf->MultiCell(0, 3,
'');
393 $pdf->SetTextColor(0, 0, 0);
396 $tab_top = 90 + $top_shift;
397 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
401 $height_incoterms = 0;
403 $desc_incoterms = $object->getIncotermsForPDF();
404 if ($desc_incoterms) {
407 $pdf->SetFont(
'',
'', $default_font_size - 1);
408 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
409 $nexY = max($pdf->GetY(), $nexY);
410 $height_incoterms = $nexY - $tab_top;
413 $pdf->SetDrawColor(192, 192, 192);
414 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
416 $tab_top = $nexY + 6;
417 $height_incoterms += 4;
422 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
423 if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
425 if (is_object($object->thirdparty)) {
426 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
427 $salerepobj =
new User($this->
db);
428 $salerepobj->fetch($salereparray[0][
'id']);
429 if (!empty($salerepobj->signature)) {
430 $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
436 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
437 if (!empty($extranote)) {
441 if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) {
442 $tmpuser =
new User($this->
db);
443 $tmpuser->fetch($object->user_author_id);
445 $creator_info = $langs->trans(
"CaseFollowedBy").
' '.$tmpuser->getFullName($langs);
446 if ($tmpuser->email) $creator_info .=
', '.$langs->trans(
"EMail").
': '.$tmpuser->email;
447 if ($tmpuser->office_phone) $creator_info .=
', '.$langs->trans(
"Phone").
': '.$tmpuser->office_phone;
452 $tab_height = $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter;
454 $pagenb = $pdf->getPage();
458 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
459 $pageposbeforenote = $pagenb;
466 $pdf->startTransaction();
468 $pdf->SetFont(
'',
'', $default_font_size - 1);
469 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
471 $pageposafternote = $pdf->getPage();
472 $posyafter = $pdf->GetY();
474 if ($pageposafternote > $pageposbeforenote) {
475 $pdf->rollbackTransaction(
true);
478 while ($pagenb < $pageposafternote) {
481 if (!empty($tplidx)) {
482 $pdf->useTemplate($tplidx);
485 $this->
_pagehead($pdf, $object, 0, $outputlangs);
488 $pdf->setTopMargin($tab_top_newpage);
490 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
494 $pdf->setPage($pageposbeforenote);
495 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
496 $pdf->SetFont(
'',
'', $default_font_size - 1);
497 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
498 $pageposafternote = $pdf->getPage();
500 $posyafter = $pdf->GetY();
502 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
503 $pdf->AddPage(
'',
'',
true);
506 $pdf->setPage($pageposafternote);
507 $pdf->setTopMargin($tab_top_newpage);
509 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
515 $i = $pageposbeforenote;
516 while ($i < $pageposafternote) {
520 $pdf->SetDrawColor(128, 128, 128);
522 if ($i > $pageposbeforenote) {
523 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
524 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
526 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
527 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
531 $pdf->setPageOrientation(
'', 1, 0);
532 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
538 $pdf->setPage($pageposafternote);
539 if (!empty($tplidx)) {
540 $pdf->useTemplate($tplidx);
543 $this->
_pagehead($pdf, $object, 0, $outputlangs);
545 $height_note = $posyafter - $tab_top_newpage;
546 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
549 $pdf->commitTransaction();
550 $posyafter = $pdf->GetY();
551 $height_note = $posyafter - $tab_top;
552 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
555 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
557 $pdf->AddPage(
'',
'',
true);
560 $pdf->setPage($pageposafternote);
561 if (!empty($tplidx)) {
562 $pdf->useTemplate($tplidx);
565 $this->
_pagehead($pdf, $object, 0, $outputlangs);
568 $posyafter = $tab_top_newpage;
571 $tab_height = $tab_height - $height_note;
572 $tab_top = $posyafter + 6;
581 $pdf->startTransaction();
582 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
583 $pdf->rollbackTransaction(
true);
585 $nexY = $tab_top + $this->tabTitleHeight;
588 $pageposbeforeprintlines = $pdf->getPage();
589 $pagenb = $pageposbeforeprintlines;
590 for ($i = 0; $i < $nblines; $i++) {
592 $pdf->SetFont(
'',
'', $default_font_size - 1);
593 $pdf->SetTextColor(0, 0, 0);
596 $imglinesize = array();
597 if (!empty($realpatharray[$i])) {
601 $pdf->setTopMargin($tab_top_newpage);
602 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot);
603 $pageposbefore = $pdf->getPage();
605 $showpricebeforepagebreak = 1;
607 $posYAfterDescription = 0;
611 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) {
612 $pdf->AddPage(
'',
'',
true);
613 if (!empty($tplidx)) {
614 $pdf->useTemplate($tplidx);
616 $pdf->setPage($pageposbefore + 1);
618 $curY = $tab_top_newpage;
621 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
622 $showpricebeforepagebreak = 1;
624 $showpricebeforepagebreak = 0;
629 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
630 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
632 $posYAfterImage = $curY + $imglinesize[
'height'];
638 $pdf->startTransaction();
640 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
641 $pageposafter = $pdf->getPage();
643 if ($pageposafter > $pageposbefore) {
644 $pdf->rollbackTransaction(
true);
646 $pdf->setPageOrientation(
'', 1, $heightforfooter);
648 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
650 $pageposafter = $pdf->getPage();
651 $posyafter = $pdf->GetY();
653 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) {
654 if ($i == ($nblines - 1)) {
655 $pdf->AddPage(
'',
'',
true);
656 if (!empty($tplidx)) {
657 $pdf->useTemplate($tplidx);
659 $pdf->setPage($pageposafter + 1);
664 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
665 $showpricebeforepagebreak = 1;
667 $showpricebeforepagebreak = 0;
672 $pdf->commitTransaction();
674 $posYAfterDescription = $pdf->GetY();
677 $nexY = $pdf->GetY();
678 $pageposafter = $pdf->getPage();
680 $pdf->setPage($pageposbefore);
681 $pdf->setTopMargin($this->marge_haute);
682 $pdf->setPageOrientation(
'', 1, 0);
685 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
686 $pdf->setPage($pageposafter);
687 $curY = $tab_top_newpage;
690 $pdf->SetFont(
'',
'', $default_font_size - 1);
696 $nexY = max($pdf->GetY(), $nexY);
703 $nexY = max($pdf->GetY(), $nexY);
711 $nexY = max($pdf->GetY(), $nexY);
717 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
719 $nexY = max($pdf->GetY(), $nexY);
723 if ($this->
getColumnStatus(
'discount') && $object->lines[$i]->remise_percent) {
726 $nexY = max($pdf->GetY(), $nexY);
733 $nexY = max($pdf->GetY(), $nexY);
740 $nexY = max($pdf->GetY(), $nexY);
744 if (!empty($object->lines[$i]->array_options)) {
745 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
747 $extrafieldValue = $this->
getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
749 $nexY = max($pdf->GetY(), $nexY);
760 'outputlangs' => $outputlangs,
761 'hidedetails' => $hidedetails
763 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
767 if (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
768 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
770 $tvaligne = $object->lines[$i]->total_tva;
773 $localtax1ligne = $object->lines[$i]->total_localtax1;
774 $localtax2ligne = $object->lines[$i]->total_localtax2;
775 $localtax1_rate = $object->lines[$i]->localtax1_tx;
776 $localtax2_rate = $object->lines[$i]->localtax2_tx;
777 $localtax1_type = $object->lines[$i]->localtax1_type;
778 $localtax2_type = $object->lines[$i]->localtax2_type;
780 if ($object->remise_percent) {
781 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
783 if ($object->remise_percent) {
784 $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
786 if ($object->remise_percent) {
787 $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
790 $vatrate = (string) $object->lines[$i]->tva_tx;
793 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
794 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
796 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
797 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
801 if ($localtax1_type && $localtax1ligne != 0) {
802 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
804 if ($localtax2_type && $localtax2ligne != 0) {
805 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
808 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
813 if (!isset($this->tva[$vatrate])) {
814 $this->tva[$vatrate] = 0;
816 $this->tva[$vatrate] += $tvaligne;
817 $vatcode = $object->lines[$i]->vat_src_code;
818 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
819 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
821 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate'=>$vatrate,
'vatcode'=>$vatcode,
'amount'=> $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
823 if ($posYAfterImage > $posYAfterDescription) {
824 $nexY = max($nexY, $posYAfterImage);
828 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
829 $pdf->setPage($pageposafter);
830 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
832 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
833 $pdf->SetLineStyle(array(
'dash'=>0));
839 while ($pagenb < $pageposafter) {
840 $pdf->setPage($pagenb);
841 if ($pagenb == $pageposbeforeprintlines) {
842 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
844 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
846 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
848 $pdf->setPage($pagenb);
849 $pdf->setPageOrientation(
'', 1, 0);
851 $this->
_pagehead($pdf, $object, 0, $outputlangs);
853 if (!empty($tplidx)) {
854 $pdf->useTemplate($tplidx);
858 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
859 if ($pagenb == $pageposafter) {
860 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
862 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
864 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
867 if (!empty($tplidx)) {
868 $pdf->useTemplate($tplidx);
872 $this->
_pagehead($pdf, $object, 0, $outputlangs);
878 if ($pagenb == $pageposbeforeprintlines) {
879 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
880 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
882 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
883 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
887 $posy = $this->
drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs);
890 $posy = $this->
drawTotalTable($pdf, $object, 0, $bottomlasttab, $outputlangs);
901 if (empty($conf->global->PROPAL_DISABLE_SIGNATURE)) {
906 $this->
_pagefoot($pdf, $object, $outputlangs);
907 if (method_exists($pdf,
'AliasNbPages')) {
908 $pdf->AliasNbPages();
912 if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) {
913 require_once DOL_DOCUMENT_ROOT.
'/product/class/propalmergepdfproduct.class.php';
915 $already_merged = array();
916 foreach ($object->lines as $line) {
917 if (!empty($line->fk_product) && !(in_array($line->fk_product, $already_merged))) {
922 $filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang);
924 $filetomerge->fetch_by_product($line->fk_product);
927 $already_merged[] = $line->fk_product;
930 $product->fetch($line->fk_product);
932 if ($product->entity != $conf->entity) {
933 $entity_product_file = $product->entity;
935 $entity_product_file = $conf->entity;
939 if (count($filetomerge->lines) > 0) {
940 foreach ($filetomerge->lines as $linefile) {
941 if (!empty($linefile->id) && !empty($linefile->file_name)) {
944 $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].
'/'.
get_exdir($product->id, 2, 0, 0, $product,
'product').$product->id.
"/photos";
946 $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].
'/'.
get_exdir($product->id, 2, 0, 0, $product,
'product').$product->id.
"/photos";
950 $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].
'/'.
get_exdir(0, 0, 0, 0, $product,
'product');
952 $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].
'/'.
get_exdir(0, 0, 0, 0, $product,
'product');
956 dol_syslog(get_class($this).
':: upload_dir='.$filetomerge_dir, LOG_DEBUG);
958 $infile = $filetomerge_dir.
'/'.$linefile->file_name;
959 if (file_exists($infile) && is_readable($infile)) {
960 $pagecount = $pdf->setSourceFile($infile);
961 for ($i = 1; $i <= $pagecount; $i++) {
962 $tplIdx = $pdf->importPage($i);
963 if ($tplIdx !==
false) {
964 $s = $pdf->getTemplatesize($tplIdx);
965 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
966 $pdf->useTemplate($tplIdx);
968 setEventMessages(
null, array($infile.
' cannot be added, probably protected PDF'),
'warnings');
981 $pdf->Output($file,
'F');
984 $hookmanager->initHooks(array(
'pdfgeneration'));
985 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
987 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
989 $this->error = $hookmanager->error;
990 $this->errors = $hookmanager->errors;
993 if (!empty($conf->global->MAIN_UMASK)) {
994 @chmod($file, octdec($conf->global->MAIN_UMASK));
997 $this->result = array(
'fullpath'=>$file);
1001 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
1005 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"PROP_OUTPUTDIR");
1034 global $conf, $mysoc;
1037 $pdf->SetFont(
'',
'', $default_font_size - 1);
1040 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
1041 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1042 $pdf->SetXY($this->marge_gauche, $posy);
1043 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
1045 $posy = $pdf->GetY() + 4;
1049 if (!empty($conf->global->MAIN_PDF_DATE_TEXT)) {
1050 $displaydate =
"daytext";
1052 $displaydate =
"day";
1056 if (!empty($object->delivery_date)) {
1057 $outputlangs->load(
"sendings");
1058 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1059 $pdf->SetXY($this->marge_gauche, $posy);
1060 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
1061 $pdf->MultiCell(80, 4, $titre, 0,
'L');
1062 $pdf->SetFont(
'',
'', $default_font_size - 2);
1063 $pdf->SetXY($posxval, $posy);
1064 $dlp =
dol_print_date($object->delivery_date, $displaydate,
false, $outputlangs,
true);
1065 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
1067 $posy = $pdf->GetY() + 1;
1068 } elseif ($object->availability_code || $object->availability) {
1069 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1070 $pdf->SetXY($this->marge_gauche, $posy);
1071 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
1072 $pdf->MultiCell(80, 4, $titre, 0,
'L');
1073 $pdf->SetTextColor(0, 0, 0);
1074 $pdf->SetFont(
'',
'', $default_font_size - 2);
1075 $pdf->SetXY($posxval, $posy);
1076 $lib_availability = $outputlangs->transnoentities(
"AvailabilityType".$object->availability_code) != (
'AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities(
"AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability);
1077 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
1078 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
1080 $posy = $pdf->GetY() + 1;
1084 if (empty($conf->global->PROPOSAL_PDF_HIDE_DELIVERYMODE) && $object->shipping_method_id > 0) {
1085 $outputlangs->load(
"sendings");
1087 $shipping_method_id = $object->shipping_method_id;
1088 if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($this->emetteur->shipping_method_id)) {
1089 $shipping_method_id = $this->emetteur->shipping_method_id;
1091 $shipping_method_code =
dol_getIdFromCode($this->
db, $shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
1092 $shipping_method_label =
dol_getIdFromCode($this->
db, $shipping_method_id,
'c_shipment_mode',
'rowid',
'libelle');
1094 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1095 $pdf->SetXY($this->marge_gauche, $posy);
1096 $titre = $outputlangs->transnoentities(
"SendingMethod").
':';
1097 $pdf->MultiCell(43, 4, $titre, 0,
'L');
1099 $pdf->SetFont(
'',
'', $default_font_size - 2);
1100 $pdf->SetXY($posxval, $posy);
1101 $lib_condition_paiement = ($outputlangs->transnoentities(
"SendingMethod".strtoupper($shipping_method_code)) !=
"SendingMethod".strtoupper($shipping_method_code)) ? $outputlangs->trans(
"SendingMethod".strtoupper($shipping_method_code)) : $shipping_method_label;
1102 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
1103 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
1105 $posy = $pdf->GetY() + 1;
1109 if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && $object->cond_reglement_code) {
1110 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1111 $pdf->SetXY($this->marge_gauche, $posy);
1112 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
1113 $pdf->MultiCell(43, 4, $titre, 0,
'L');
1115 $pdf->SetFont(
'',
'', $default_font_size - 2);
1116 $pdf->SetXY($posxval, $posy);
1117 $lib_condition_paiement = $outputlangs->transnoentities(
"PaymentCondition".$object->cond_reglement_code) != (
'PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities(
"PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
1118 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
1119 if ($object->deposit_percent > 0) {
1120 $lib_condition_paiement = str_replace(
'__DEPOSIT_PERCENT__', $object->deposit_percent, $lib_condition_paiement);
1122 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
1124 $posy = $pdf->GetY() + 3;
1127 if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE)) {
1129 if ($object->mode_reglement_code
1130 && $object->mode_reglement_code !=
'CHQ'
1131 && $object->mode_reglement_code !=
'VIR') {
1132 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1133 $pdf->SetXY($this->marge_gauche, $posy);
1134 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
1135 $pdf->MultiCell(80, 5, $titre, 0,
'L');
1136 $pdf->SetFont(
'',
'', $default_font_size - 2);
1137 $pdf->SetXY($posxval, $posy);
1138 $lib_mode_reg = $outputlangs->transnoentities(
"PaymentType".$object->mode_reglement_code) != (
'PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities(
"PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
1139 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
1141 $posy = $pdf->GetY() + 2;
1145 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'CHQ') {
1147 if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
1148 $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
1150 if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
1152 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
1154 $pdf->SetXY($this->marge_gauche, $posy);
1155 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
1156 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->proprio), 0,
'L', 0);
1157 $posy = $pdf->GetY() + 1;
1159 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
1160 $pdf->SetXY($this->marge_gauche, $posy);
1161 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
1162 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
1163 $posy = $pdf->GetY() + 2;
1166 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
1167 $pdf->SetXY($this->marge_gauche, $posy);
1168 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
1169 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
1170 $posy = $pdf->GetY() + 1;
1172 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
1173 $pdf->SetXY($this->marge_gauche, $posy);
1174 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
1175 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
1176 $posy = $pdf->GetY() + 2;
1183 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'VIR') {
1184 if ($object->fk_account > 0 || $object->fk_bank > 0 ||
getDolGlobalInt(
'FACTURE_RIB_NUMBER')) {
1185 $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
1186 if ($object->fk_bank > 0) {
1187 $bankid = $object->fk_bank;
1190 $account->fetch($bankid);
1192 $curx = $this->marge_gauche;
1195 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
1217 protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis =
null)
1219 global $conf, $mysoc, $hookmanager;
1223 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
1224 $outputlangsbis =
new Translate(
'', $conf);
1225 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
1226 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
1227 $default_font_size--;
1232 $pdf->SetFont(
'',
'', $default_font_size - 1);
1237 if ($this->page_largeur < 210) {
1240 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
1246 $pdf->SetFillColor(255, 255, 255);
1247 $pdf->SetXY($col1x, $tab2_top);
1248 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHT") :
''), 0,
'L', 1);
1250 $total_ht = ((
isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
1251 $pdf->SetXY($col2x, $tab2_top);
1252 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0,
'R', 1);
1255 $pdf->SetFillColor(248, 248, 248);
1257 $total_ttc = (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
1259 $this->atleastoneratenotnull = 0;
1260 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
1261 $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000'])) ?
true :
false);
1262 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) {
1268 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1269 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1273 foreach ($localtax_rate as $tvakey => $tvaval) {
1278 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1281 if (preg_match(
'/\*/', $tvakey)) {
1282 $tvakey = str_replace(
'*',
'', $tvakey);
1283 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1285 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1", $mysoc->country_code) :
'');
1287 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1288 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1290 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1291 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1299 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1300 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1304 foreach ($localtax_rate as $tvakey => $tvaval) {
1311 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1314 if (preg_match(
'/\*/', $tvakey)) {
1315 $tvakey = str_replace(
'*',
'', $tvakey);
1316 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1318 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2", $mysoc->country_code) :
'');
1320 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1321 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1323 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1324 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1331 foreach ($this->tva as $tvakey => $tvaval) {
1333 $this->atleastoneratenotnull++;
1336 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1339 if (preg_match(
'/\*/', $tvakey)) {
1340 $tvakey = str_replace(
'*',
'', $tvakey);
1341 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1343 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalVAT", $mysoc->country_code) :
'');
1345 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
1346 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1348 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1349 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1356 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1357 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1361 foreach ($localtax_rate as $tvakey => $tvaval) {
1366 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1369 if (preg_match(
'/\*/', $tvakey)) {
1370 $tvakey = str_replace(
'*',
'', $tvakey);
1371 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1373 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1", $mysoc->country_code) :
'');
1376 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1377 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1378 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1379 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1387 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1388 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1392 foreach ($localtax_rate as $tvakey => $tvaval) {
1398 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1401 if (preg_match(
'/\*/', $tvakey)) {
1402 $tvakey = str_replace(
'*',
'', $tvakey);
1403 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1405 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2", $mysoc->country_code) :
'');
1408 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1409 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1411 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1412 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1420 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1421 $pdf->SetTextColor(0, 0, 60);
1422 $pdf->SetFillColor(224, 224, 224);
1423 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalTTC") :
''), $useborder,
'L', 1);
1425 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1426 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1430 $pdf->SetTextColor(0, 0, 0);
1438 if ($deja_regle > 0) {
1442 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1443 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L', 0);
1445 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1446 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R', 0);
1465 $pdf->SetTextColor(0, 0, 60);
1466 $pdf->SetFillColor(224, 224, 224);
1467 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1468 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"RemainderToPay") :
''), $useborder,
'L', 1);
1470 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1471 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
1473 $pdf->SetFont(
'',
'', $default_font_size - 1);
1474 $pdf->SetTextColor(0, 0, 0);
1478 return ($tab2_top + ($tab2_hl * $index));
1496 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
1506 $currency = !empty($currency) ? $currency : $conf->currency;
1510 $pdf->SetTextColor(0, 0, 0);
1511 $pdf->SetFont(
'',
'', $default_font_size - 2);
1513 if (empty($hidetop)) {
1514 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1515 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
1516 $titre .=
' - '.$outputlangsbis->transnoentities(
"AmountInCurrency", $outputlangsbis->transnoentitiesnoconv(
"Currency".$currency));
1519 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1520 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1523 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1524 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight,
'F',
null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1528 $pdf->SetDrawColor(128, 128, 128);
1529 $pdf->SetFont(
'',
'', $default_font_size - 1);
1532 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1534 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
1536 if (empty($hidetop)) {
1537 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
1552 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis =
null)
1554 global $conf, $langs;
1556 $ltrdirection =
'L';
1557 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') $ltrdirection =
'R';
1560 $outputlangs->loadLangs(array(
"main",
"propal",
"companies",
"bills"));
1566 $pdf->SetTextColor(0, 0, 60);
1567 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1571 $posy = $this->marge_haute;
1572 $posx = $this->page_largeur - $this->marge_droite - $w;
1574 $pdf->SetXY($this->marge_gauche, $posy);
1578 if ($this->emetteur->logo) {
1579 $logodir = $conf->mycompany->dir_output;
1580 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1581 $logodir = $conf->mycompany->multidir_output[$object->entity];
1584 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1586 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1588 if (is_readable($logo)) {
1590 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1592 $pdf->SetTextColor(200, 0, 0);
1593 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1594 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1595 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1598 $text = $this->emetteur->name;
1599 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1603 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1604 $pdf->SetXY($posx, $posy);
1605 $pdf->SetTextColor(0, 0, 60);
1606 $title = $outputlangs->transnoentities(
"PdfCommercialProposalTitle");
1607 $title .=
' '.$outputlangs->convToOutputCharset($object->ref);
1608 if ($object->statut == $object::STATUS_DRAFT) {
1609 $pdf->SetTextColor(128, 0, 0);
1610 $title .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1613 $pdf->MultiCell($w, 4, $title,
'',
'R');
1615 $pdf->SetFont(
'',
'B', $default_font_size);
1630 $pdf->SetFont(
'',
'', $default_font_size - 2);
1632 if ($object->ref_client) {
1634 $pdf->SetXY($posx, $posy);
1635 $pdf->SetTextColor(0, 0, 60);
1636 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65),
'',
'R');
1639 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
1640 $object->fetch_projet();
1641 if (!empty($object->project->ref)) {
1643 $pdf->SetXY($posx, $posy);
1644 $pdf->SetTextColor(0, 0, 60);
1645 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->project->title),
'',
'R');
1649 if (!empty($conf->global->PDF_SHOW_PROJECT)) {
1650 $object->fetch_projet();
1651 if (!empty($object->project->ref)) {
1652 $outputlangs->load(
"projects");
1654 $pdf->SetXY($posx, $posy);
1655 $pdf->SetTextColor(0, 0, 60);
1656 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
1660 if (!empty($conf->global->MAIN_PDF_DATE_TEXT)) {
1661 $displaydate =
"daytext";
1663 $displaydate =
"day";
1667 $pdf->SetXY($posx, $posy);
1668 $pdf->SetTextColor(0, 0, 60);
1669 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date, $displaydate,
false, $outputlangs,
true),
'',
'R');
1672 $pdf->SetXY($posx, $posy);
1673 $pdf->SetTextColor(0, 0, 60);
1675 $title = $outputlangs->transnoentities(
"DateEndPropal");
1676 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
1677 $title .=
' - '.$outputlangsbis->transnoentities(
"DateEndPropal");
1679 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date($object->fin_validite, $displaydate,
false, $outputlangs,
true),
'',
'R');
1681 if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
1683 $pdf->SetXY($posx, $posy);
1684 $pdf->SetTextColor(0, 0, 60);
1685 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
1689 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1690 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1691 if (count($arrayidcontact) > 0) {
1692 $usertmp =
new User($this->
db);
1693 $usertmp->fetch($arrayidcontact[0]);
1695 $pdf->SetXY($posx, $posy);
1696 $pdf->SetTextColor(0, 0, 60);
1697 $pdf->MultiCell($w, 3, $langs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1705 $current_y = $pdf->getY();
1706 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3,
'R', $default_font_size);
1707 if ($current_y < $pdf->getY()) {
1708 $top_shift = $pdf->getY() - $current_y;
1713 $carac_emetteur =
'';
1715 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1716 if (count($arrayidcontact) > 0) {
1717 $object->fetch_user($arrayidcontact[0]);
1718 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1719 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
" ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1722 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1725 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1726 $posy += $top_shift;
1727 $posx = $this->marge_gauche;
1728 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1729 $posx = $this->page_largeur - $this->marge_droite - 80;
1732 $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
1733 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
1736 if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
1737 $pdf->SetTextColor(0, 0, 0);
1738 $pdf->SetFont(
'',
'', $default_font_size - 2);
1739 $pdf->SetXY($posx, $posy - 5);
1740 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1741 $pdf->SetXY($posx, $posy);
1742 $pdf->SetFillColor(230, 230, 230);
1743 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1744 $pdf->SetTextColor(0, 0, 60);
1748 if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
1749 $pdf->SetXY($posx + 2, $posy + 3);
1750 $pdf->SetFont(
'',
'B', $default_font_size);
1751 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1752 $posy = $pdf->getY();
1756 $pdf->SetXY($posx + 2, $posy);
1757 $pdf->SetFont(
'',
'', $default_font_size - 1);
1758 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1762 $usecontact =
false;
1763 $arrayidcontact = $object->getIdContact(
'external',
'CUSTOMER');
1764 if (count($arrayidcontact) > 0) {
1766 $result = $object->fetch_contact($arrayidcontact[0]);
1770 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)))) {
1771 $thirdparty = $object->contact;
1773 $thirdparty = $object->thirdparty;
1779 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact, $mode, $object);
1782 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
1783 if ($this->page_largeur < 210) {
1786 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1787 $posy += $top_shift;
1788 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1789 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1790 $posx = $this->marge_gauche;
1794 if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
1795 $pdf->SetTextColor(0, 0, 0);
1796 $pdf->SetFont(
'',
'', $default_font_size - 2);
1797 $pdf->SetXY($posx + 2, $posy - 5);
1798 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1799 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1803 $pdf->SetXY($posx + 2, $posy + 3);
1804 $pdf->SetFont(
'',
'B', $default_font_size);
1805 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1807 $posy = $pdf->getY();
1810 $pdf->SetFont(
'',
'', $default_font_size - 1);
1811 $pdf->SetXY($posx + 2, $posy);
1812 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1815 $pdf->SetTextColor(0, 0, 0);
1829 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1831 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1832 return pdf_pagefoot($pdf, $outputlangs,
'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
1848 $tab_top = $posy + 4;
1852 $largcol = ($this->page_largeur - $this->marge_droite - $posx);
1856 $pdf->SetFillColor(255, 255, 255);
1857 $pdf->SetXY($posx, $tab_top);
1858 $pdf->SetFont(
'',
'', $default_font_size - 2);
1859 $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities(
"ProposalCustomerSignature"), 0,
'L', 1);
1861 $pdf->SetXY($posx, $tab_top + $tab_hl);
1862 $pdf->MultiCell($largcol, $tab_hl * 3,
'', 1,
'R');
1863 if (!empty($conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING)) {
1864 $pdf->addEmptySignatureAppearance($posx, $tab_top + $tab_hl, $largcol, $tab_hl * 3);
1867 return ($tab_hl * 7);
1881 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1883 global $conf, $hookmanager;
1886 $this->defaultContentsFieldsStyle = array(
1888 'padding' => array(1, 0.5, 1, 0.5),
1892 $this->defaultTitlesFieldsStyle = array(
1894 'padding' => array(0.5, 0, 0.5, 0),
1916 $this->cols[
'desc'] = array(
1921 'textkey' =>
'Designation',
1925 'padding' => array(0.5, 0.5, 0.5, 0.5),
1929 'padding' => array(1, 0.5, 1, 1.5),
1935 $this->cols[
'photo'] = array(
1937 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
1940 'textkey' =>
'Photo',
1944 'padding' => array(0, 0, 0, 0),
1946 'border-left' =>
false,
1949 if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE) && !empty($this->atleastonephoto)) {
1950 $this->cols[
'photo'][
'status'] =
true;
1955 $this->cols[
'vat'] = array(
1962 'border-left' =>
true,
1965 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
1966 $this->cols[
'vat'][
'status'] =
true;
1970 $this->cols[
'subprice'] = array(
1975 'textkey' =>
'PriceUHT'
1977 'border-left' =>
true,
1982 $nblines = count($object->lines);
1983 for ($i = 0; $i < $nblines; $i++) {
1985 $tmpwidth = max($tmpwidth, $tmpwidth2);
1987 if ($tmpwidth > 10) {
1988 $this->cols[
'subprice'][
'width'] += (2 * ($tmpwidth - 10));
1992 $this->cols[
'qty'] = array(
1999 'border-left' =>
true,
2003 $this->cols[
'unit'] = array(
2010 'border-left' =>
true,
2013 $this->cols[
'unit'][
'status'] =
true;
2017 $this->cols[
'discount'] = array(
2022 'textkey' =>
'ReductionShort'
2024 'border-left' =>
true,
2026 if ($this->atleastonediscount) {
2027 $this->cols[
'discount'][
'status'] =
true;
2030 $rank = $rank + 1000;
2031 $this->cols[
'totalexcltax'] = array(
2034 'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ?
true :
false,
2036 'textkey' =>
'TotalHT'
2038 'border-left' =>
true,
2041 $rank = $rank + 1010;
2042 $this->cols[
'totalincltax'] = array(
2045 'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ?
false :
true,
2047 'textkey' =>
'TotalTTC'
2049 'border-left' =>
true,
2053 if (!empty($object->lines)) {
2054 $line = reset($object->lines);
2058 $parameters = array(
2059 'object' => $object,
2060 'outputlangs' => $outputlangs,
2061 'hidedetails' => $hidedetails,
2062 'hidedesc' => $hidedesc,
2063 'hideref' => $hideref
2066 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
2069 } elseif (empty($reshook)) {
2070 $this->cols = array_replace($this->cols, $hookmanager->resArray);
2072 $this->cols = $hookmanager->resArray;
Class to manage bank accounts.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
getColumnStatus($colKey)
get column status from column key
printStdColumnContent($pdf, &$curY, $colKey, $columnText='')
print standard column content
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
getExtrafieldContent($object, $extrafieldKey, $outputlangs=null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
Classe mere des modeles de propale.
Class to manage products or services.
Put here description of your class.
Class to manage translations.
Class to manage Dolibarr users.
Class to generate PDF proposal Cyan.
drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis=null)
Show total to pay.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='', $outputlangsbis=null)
Show table for lines.
__construct($db)
Constructor.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis=null)
Show top header of page.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
drawSignatureArea(&$pdf, $object, $posy, $outputlangs)
Show area for the customer to sign.
drawInfoTable(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
Show payments table.
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.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
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_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.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails=0)
Return line total including tax.
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).
pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
Function to try to calculate height of a HTML Content.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank informations 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.