29 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
30 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
59 public $update_main_doc_field;
70 public $phpmin = array(7, 0);
76 public $version =
'dolibarr';
101 public $marge_droite;
127 global $conf, $langs, $mysoc;
130 $langs->loadLangs(array(
"main",
"bills"));
133 $this->
name =
"aurore";
134 $this->
description = $langs->trans(
'DocModelAuroreDescription');
135 $this->update_main_doc_field = 1;
140 $this->page_largeur = $formatarray[
'width'];
141 $this->page_hauteur = $formatarray[
'height'];
142 $this->format = array($this->page_largeur, $this->page_hauteur);
148 $this->option_logo = 1;
149 $this->option_tva = 1;
150 $this->option_modereg = 1;
151 $this->option_condreg = 1;
152 $this->option_multilang = 1;
153 $this->option_escompte = 1;
154 $this->option_credit_note = 1;
155 $this->option_freetext = 1;
156 $this->option_draft_watermark = 1;
157 $this->watermark =
'';
160 $this->emetteur = $mysoc;
161 if (empty($this->emetteur->country_code)) {
162 $this->emetteur->country_code = substr($langs->defaultlang, -2);
166 $this->posxdesc = $this->marge_gauche + 1;
167 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
170 $this->posxqty = 135;
171 $this->posxunit = 151;
175 $this->posxqty = 145;
176 $this->posxunit = 162;
178 $this->posxdiscount = 162;
179 $this->postotalht = 174;
181 $this->posxpicture = $this->posxup - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
182 if ($this->page_largeur < 210) {
183 $this->posxpicture -= 20;
185 $this->posxqty -= 20;
186 $this->posxunit -= 20;
187 $this->posxdiscount -= 20;
188 $this->postotalht -= 20;
191 $this->tva = array();
192 $this->tva_array = array();
193 $this->localtax1 = array();
194 $this->localtax2 = array();
195 $this->atleastoneratenotnull = 0;
196 $this->atleastonediscount = 0;
211 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
214 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
216 if (!is_object($outputlangs)) {
217 $outputlangs = $langs;
220 if (!empty($conf->global->MAIN_USE_FPDF)) {
221 $outputlangs->charset_output =
'ISO-8859-1';
225 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"supplier_proposal"));
228 if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
229 $this->watermark = $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK;
232 $nblines = count($object->lines);
235 $realpatharray = array();
236 if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
237 for ($i = 0; $i < $nblines; $i++) {
238 if (empty($object->lines[$i]->fk_product)) {
243 $objphoto->fetch($object->lines[$i]->fk_product);
246 $pdir =
get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
247 $dir = $conf->product->dir_output.
'/'.$pdir;
249 $pdir =
get_exdir(0, 0, 0, 0, $objphoto,
'product');
250 $dir = $conf->product->dir_output.
'/'.$pdir;
254 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
256 if ($obj[
'photo_vignette']) {
257 $filename = $obj[
'photo_vignette'];
259 $filename = $obj[
'photo'];
262 $filename = $obj[
'photo'];
264 $realpath = $dir.$filename;
269 $realpatharray[$i] = $realpath;
273 if (count($realpatharray) == 0) {
274 $this->posxpicture = $this->posxup;
277 if ($conf->supplier_proposal->dir_output) {
278 $object->fetch_thirdparty();
283 if ($object->specimen) {
284 $dir = $conf->supplier_proposal->dir_output;
285 $file = $dir.
"/SPECIMEN.pdf";
288 $dir = $conf->supplier_proposal->dir_output.
"/".$objectref;
289 $file = $dir.
"/".$objectref.
".pdf";
292 if (!file_exists($dir)) {
294 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
299 if (file_exists($dir)) {
301 if (!is_object($hookmanager)) {
302 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
305 $hookmanager->initHooks(array(
'pdfgeneration'));
306 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
308 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
313 $heightforinfotot = 50;
314 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
315 $heightforfooter = $this->marge_basse + 8;
316 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
317 $heightforfooter += 6;
319 $pdf->SetAutoPageBreak(1, 0);
321 if (class_exists(
'TCPDF')) {
322 $pdf->setPrintHeader(
false);
323 $pdf->setPrintFooter(
false);
327 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
328 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
329 $tplidx = $pdf->importPage(1);
334 $pdf->SetDrawColor(128, 128, 128);
336 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
337 $pdf->SetSubject($outputlangs->transnoentities(
"CommercialAsk"));
338 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
339 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
340 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"CommercialAsk").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
342 $pdf->SetCompression(
false);
345 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
348 for ($i = 0; $i < $nblines; $i++) {
349 if ($object->lines[$i]->remise_percent) {
350 $this->atleastonediscount++;
353 if (empty($this->atleastonediscount)) {
354 $delta = ($this->postotalht - $this->posxdiscount);
355 $this->posxpicture += $delta;
356 $this->posxup += $delta;
357 $this->posxqty += $delta;
358 $this->posxunit += $delta;
359 $this->posxdiscount += $delta;
365 if (!empty($tplidx)) {
366 $pdf->useTemplate($tplidx);
369 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
370 $pdf->SetFont(
'',
'', $default_font_size - 1);
371 $pdf->MultiCell(0, 3,
'');
372 $pdf->SetTextColor(0, 0, 0);
374 $tab_top = 90 + $top_shift;
375 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
378 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
379 if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
381 if (is_object($object->thirdparty)) {
382 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
383 $salerepobj =
new User($this->
db);
384 $salerepobj->fetch($salereparray[0][
'id']);
385 if (!empty($salerepobj->signature)) {
386 $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
392 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
393 if (!empty($extranote)) {
405 $pdf->SetFont(
'',
'', $default_font_size - 1);
406 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($notetoshow), 0, 1);
407 $nexY = $pdf->GetY();
408 $height_note = $nexY - $tab_top;
411 $pdf->SetDrawColor(192, 192, 192);
412 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
414 $tab_top = $nexY + 6;
417 $iniY = $tab_top + 7;
418 $curY = $tab_top + 7;
419 $nexY = $tab_top + 7;
422 for ($i = 0; $i < $nblines; $i++) {
424 $pdf->SetFont(
'',
'', $default_font_size - 1);
425 $pdf->SetTextColor(0, 0, 0);
428 $imglinesize = array();
429 if (!empty($realpatharray[$i])) {
433 $pdf->setTopMargin($tab_top_newpage);
434 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
435 $pageposbefore = $pdf->getPage();
437 $showpricebeforepagebreak = 1;
439 $posYAfterDescription = 0;
442 if (!empty($imglinesize[
'width']) && !empty($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
443 $pdf->AddPage(
'',
'',
true);
444 if (!empty($tplidx)) {
445 $pdf->useTemplate($tplidx);
448 $this->
_pagehead($pdf, $object, 0, $outputlangs);
450 $pdf->setPage($pageposbefore + 1);
452 $curY = $tab_top_newpage;
455 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
456 $showpricebeforepagebreak = 1;
458 $showpricebeforepagebreak = 0;
462 if (!empty($imglinesize[
'width']) && !empty($imglinesize[
'height'])) {
463 $curX = $this->posxpicture - 1;
464 $pdf->Image($realpatharray[$i], $curX + (($this->posxup - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
466 $posYAfterImage = $curY + $imglinesize[
'height'];
470 $curX = $this->posxdesc - 1;
472 $pdf->startTransaction();
473 if ($posYAfterImage > 0) {
474 $descWidth = $this->posxpicture - $curX;
476 $descWidth = $this->posxup - $curX;
478 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
480 $pageposafter = $pdf->getPage();
481 if ($pageposafter > $pageposbefore) {
482 $pdf->rollbackTransaction(
true);
483 $pageposafter = $pageposbefore;
485 $pdf->setPageOrientation(
'', 1, $heightforfooter);
486 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
488 $pageposafter = $pdf->getPage();
489 $posyafter = $pdf->GetY();
491 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
492 if ($i == ($nblines - 1)) {
493 $pdf->AddPage(
'',
'',
true);
494 if (!empty($tplidx)) {
495 $pdf->useTemplate($tplidx);
498 $this->
_pagehead($pdf, $object, 0, $outputlangs);
500 $pdf->setPage($pageposafter + 1);
505 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
506 $showpricebeforepagebreak = 1;
508 $showpricebeforepagebreak = 0;
513 $pdf->commitTransaction();
515 $posYAfterDescription = $pdf->GetY();
517 $nexY = $pdf->GetY();
518 $pageposafter = $pdf->getPage();
520 $pdf->setPage($pageposbefore);
521 $pdf->setTopMargin($this->marge_haute);
522 $pdf->setPageOrientation(
'', 1, 0);
525 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
526 $pdf->setPage($pageposafter);
527 $curY = $tab_top_newpage;
530 $pdf->SetFont(
'',
'', $default_font_size - 1);
534 $pdf->SetXY($this->posxqty, $curY);
535 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
538 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
539 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
540 $pdf->SetXY($this->posxunit, $curY);
541 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
561 if (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
562 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
564 $tvaligne = $object->lines[$i]->total_tva;
567 $localtax1ligne = $object->lines[$i]->total_localtax1;
568 $localtax2ligne = $object->lines[$i]->total_localtax2;
569 $localtax1_rate = $object->lines[$i]->localtax1_tx;
570 $localtax2_rate = $object->lines[$i]->localtax2_tx;
571 $localtax1_type = $object->lines[$i]->localtax1_type;
572 $localtax2_type = $object->lines[$i]->localtax2_type;
574 if ($object->remise_percent) {
575 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
577 if ($object->remise_percent) {
578 $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
580 if ($object->remise_percent) {
581 $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
584 $vatrate = (string) $object->lines[$i]->tva_tx;
587 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
588 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
590 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
591 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
595 if ($localtax1_type && $localtax1ligne != 0) {
596 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
598 if ($localtax2_type && $localtax2ligne != 0) {
599 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
602 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
607 if (!isset($this->tva[$vatrate])) {
608 $this->tva[$vatrate] = 0;
610 $this->tva[$vatrate] += $tvaligne;
611 $vatcode = $object->lines[$i]->vat_src_code;
612 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
613 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
615 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate'=>$vatrate,
'vatcode'=>$vatcode,
'amount'=> $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
617 if ($posYAfterImage > $posYAfterDescription) {
618 $nexY = $posYAfterImage;
622 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
623 $pdf->setPage($pageposafter);
624 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
626 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
627 $pdf->SetLineStyle(array(
'dash'=>0));
633 while ($pagenb < $pageposafter) {
634 $pdf->setPage($pagenb);
636 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
638 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
640 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
642 $pdf->setPage($pagenb);
643 $pdf->setPageOrientation(
'', 1, 0);
645 $this->
_pagehead($pdf, $object, 0, $outputlangs);
647 if (!empty($tplidx)) {
648 $pdf->useTemplate($tplidx);
651 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
653 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
655 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
657 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
660 if (!empty($tplidx)) {
661 $pdf->useTemplate($tplidx);
665 $this->
_pagehead($pdf, $object, 0, $outputlangs);
672 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
673 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
675 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
676 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
680 $posy = $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
694 $this->
_pagefoot($pdf, $object, $outputlangs);
695 if (method_exists($pdf,
'AliasNbPages')) {
696 $pdf->AliasNbPages();
701 $pdf->Output($file,
'F');
704 $hookmanager->initHooks(array(
'pdfgeneration'));
705 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
707 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
709 $this->error = $hookmanager->error;
710 $this->errors = $hookmanager->errors;
713 if (!empty($conf->global->MAIN_UMASK)) {
714 @chmod($file, octdec($conf->global->MAIN_UMASK));
717 $this->result = array(
'fullpath'=>$file);
721 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
725 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_PROPOSAL_OUTPUTDIR");
763 $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
765 $pdf->SetFont(
'',
'', $default_font_size - 1);
770 if (!empty($object->delivery_date)) {
771 $outputlangs->load(
"sendings");
772 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
773 $pdf->SetXY($this->marge_gauche, $posy);
774 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
775 $pdf->MultiCell(80, 4, $titre, 0,
'L');
776 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
777 $pdf->SetXY($posxval, $posy);
778 $dlp =
dol_print_date($object->delivery_date,
"daytext",
false, $outputlangs,
true);
779 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
781 $posy = $pdf->GetY() + 1;
783 $outputlangs->load(
"sendings");
784 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
785 $pdf->SetXY($this->marge_gauche, $posy);
786 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
787 $pdf->MultiCell(80, 4, $titre, 0,
'L');
788 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
789 $pdf->SetXY($posxval, $posy);
791 $pdf->MultiCell(80, 4,
'', 0,
'L');
793 $posy = $pdf->GetY() + 1;
813 if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) {
814 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
815 $pdf->SetXY($this->marge_gauche, $posy);
816 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
817 $pdf->MultiCell(80, 4, $titre, 0,
'L');
819 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
820 $pdf->SetXY($posxval, $posy);
821 $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);
822 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
823 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0,
'L');
825 $posy = $pdf->GetY() + 3;
828 if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) {
830 if ($object->mode_reglement_code
831 && $object->mode_reglement_code !=
'CHQ'
832 && $object->mode_reglement_code !=
'VIR') {
833 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
834 $pdf->SetXY($this->marge_gauche, $posy - 2);
835 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
836 $pdf->MultiCell(80, 5, $titre, 0,
'L');
837 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
838 $pdf->SetXY($posxval, $posy - 2);
839 $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);
840 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
842 $posy = $pdf->GetY() + 2;
846 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'CHQ') {
848 if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
849 if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
851 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
853 $pdf->SetXY($this->marge_gauche, $posy);
854 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
855 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->proprio), 0,
'L', 0);
856 $posy = $pdf->GetY() + 1;
858 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
859 $pdf->SetXY($this->marge_gauche, $posy);
860 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
861 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
862 $posy = $pdf->GetY() + 2;
865 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
866 $pdf->SetXY($this->marge_gauche, $posy);
867 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
868 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
869 $posy = $pdf->GetY() + 1;
871 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
872 $pdf->SetXY($this->marge_gauche, $posy);
873 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
874 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
875 $posy = $pdf->GetY() + 2;
882 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'VIR') {
883 if (!empty($object->fk_bank) ||
getDolGlobalInt(
'FACTURE_RIB_NUMBER')) {
884 $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
886 $account->fetch($bankid);
888 $curx = $this->marge_gauche;
891 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
913 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
916 global $conf, $mysoc;
921 $pdf->SetFont(
'',
'', $default_font_size - 1);
926 if ($this->page_largeur < 210) {
929 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
935 $pdf->SetFillColor(255, 255, 255);
936 $pdf->SetXY($col1x, $tab2_top + 0);
937 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
939 $pdf->SetXY($col2x, $tab2_top + 0);
940 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0,
'R', 1);
943 $pdf->SetFillColor(248, 248, 248);
945 $this->atleastoneratenotnull = 0;
946 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
947 $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000'])) ?
true :
false);
948 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) {
954 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
955 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
959 foreach ($localtax_rate as $tvakey => $tvaval) {
964 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
967 if (preg_match(
'/\*/', $tvakey)) {
968 $tvakey = str_replace(
'*',
'', $tvakey);
969 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
971 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
972 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
973 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
975 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
976 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
984 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
985 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
989 foreach ($localtax_rate as $tvakey => $tvaval) {
996 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
999 if (preg_match(
'/\*/', $tvakey)) {
1000 $tvakey = str_replace(
'*',
'', $tvakey);
1001 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1003 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
1004 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1005 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1007 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1008 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1014 foreach ($this->tva as $tvakey => $tvaval) {
1016 $this->atleastoneratenotnull++;
1019 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1022 if (preg_match(
'/\*/', $tvakey)) {
1023 $tvakey = str_replace(
'*',
'', $tvakey);
1024 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1026 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
1027 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
1028 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1030 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1031 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1038 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1039 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1043 foreach ($localtax_rate as $tvakey => $tvaval) {
1048 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1051 if (preg_match(
'/\*/', $tvakey)) {
1052 $tvakey = str_replace(
'*',
'', $tvakey);
1053 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1055 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
1057 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1058 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1059 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1060 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1068 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1069 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1073 foreach ($localtax_rate as $tvakey => $tvaval) {
1079 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1082 if (preg_match(
'/\*/', $tvakey)) {
1083 $tvakey = str_replace(
'*',
'', $tvakey);
1084 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1086 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
1088 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1089 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1091 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1092 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1100 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1101 $pdf->SetTextColor(0, 0, 60);
1102 $pdf->SetFillColor(224, 224, 224);
1103 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
1105 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1106 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1110 $pdf->SetTextColor(0, 0, 0);
1112 $resteapayer = $object->total_ttc - $deja_regle;
1113 if (!empty($object->paye)) {
1117 if ($deja_regle > 0) {
1120 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1121 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L', 0);
1123 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1124 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R', 0);
1127 $pdf->SetTextColor(0, 0, 60);
1128 $pdf->SetFillColor(224, 224, 224);
1129 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1130 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L', 1);
1132 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1133 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
1135 $pdf->SetFont(
'',
'', $default_font_size - 1);
1136 $pdf->SetTextColor(0, 0, 0);
1140 return ($tab2_top + ($tab2_hl * $index));
1157 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
1167 $currency = !empty($currency) ? $currency : $conf->currency;
1171 $pdf->SetTextColor(0, 0, 0);
1172 $pdf->SetFont(
'',
'', $default_font_size - 2);
1174 if (empty($hidetop)) {
1175 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1176 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1177 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1180 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1181 $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));
1185 $pdf->SetDrawColor(128, 128, 128);
1186 $pdf->SetFont(
'',
'', $default_font_size - 1);
1189 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1191 if (empty($hidetop)) {
1192 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1194 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1195 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1198 $pdf->line($this->posxup + 1, $tab_top, $this->posxup + 1, $tab_top + $tab_height);
1199 if (empty($hidetop)) {
1200 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1201 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1204 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1205 if (empty($hidetop)) {
1206 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1207 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1210 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1211 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1212 if (empty($hidetop)) {
1213 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1214 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1218 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1219 if (empty($hidetop)) {
1220 if ($this->atleastonediscount) {
1221 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1222 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1225 if ($this->atleastonediscount) {
1226 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1228 if (empty($hidetop)) {
1229 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1230 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1244 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1246 global $conf, $langs;
1249 $outputlangs->loadLangs(array(
"main",
"bills",
"supplier_proposal",
"companies"));
1255 $pdf->SetTextColor(0, 0, 60);
1256 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1258 $posy = $this->marge_haute;
1259 $posx = $this->page_largeur - $this->marge_droite - 100;
1261 $pdf->SetXY($this->marge_gauche, $posy);
1264 if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
1265 if ($this->emetteur->logo) {
1266 $logodir = $conf->mycompany->dir_output;
1267 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1268 $logodir = $conf->mycompany->multidir_output[$object->entity];
1270 if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
1271 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1273 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1275 if (is_readable($logo)) {
1277 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1279 $pdf->SetTextColor(200, 0, 0);
1280 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1281 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1282 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1285 $text = $this->emetteur->name;
1286 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0);
1290 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1291 $pdf->SetXY($posx, $posy);
1292 $pdf->SetTextColor(0, 0, 60);
1293 $title = $outputlangs->transnoentities(
"CommercialAsk");
1294 $pdf->MultiCell(100, 4, $title,
'',
'R');
1296 $pdf->SetFont(
'',
'B', $default_font_size);
1299 $pdf->SetXY($posx, $posy);
1300 $pdf->SetTextColor(0, 0, 60);
1301 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
1304 $pdf->SetFont(
'',
'', $default_font_size - 2);
1306 if ($object->ref_fourn) {
1308 $pdf->SetXY($posx, $posy);
1309 $pdf->SetTextColor(0, 0, 60);
1310 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefSupplier").
" : ".
dol_trunc($outputlangs->convToOutputCharset($object->ref_fourn), 65),
'',
'R');
1313 if ($object->thirdparty->code_fournisseur) {
1315 $pdf->SetXY($posx, $posy);
1316 $pdf->SetTextColor(0, 0, 60);
1317 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
1321 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1322 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1323 if (count($arrayidcontact) > 0) {
1324 $usertmp =
new User($this->
db);
1325 $usertmp->fetch($arrayidcontact[0]);
1327 $pdf->SetXY($posx, $posy);
1328 $pdf->SetTextColor(0, 0, 60);
1329 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1337 $current_y = $pdf->getY();
1338 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1339 if ($current_y < $pdf->getY()) {
1340 $top_shift = $pdf->getY() - $current_y;
1345 $carac_emetteur =
'';
1347 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1348 if (count($arrayidcontact) > 0) {
1349 $object->fetch_user($arrayidcontact[0]);
1350 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1351 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1354 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1357 $posy = 42 + $top_shift;
1358 $posx = $this->marge_gauche;
1359 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1360 $posx = $this->page_largeur - $this->marge_droite - 80;
1365 $pdf->SetTextColor(0, 0, 0);
1366 $pdf->SetFont(
'',
'', $default_font_size - 2);
1367 $pdf->SetXY($posx, $posy - 5);
1368 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0,
'L');
1369 $pdf->SetXY($posx, $posy);
1370 $pdf->SetFillColor(230, 230, 230);
1371 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1372 $pdf->SetTextColor(0, 0, 60);
1375 $pdf->SetXY($posx + 2, $posy + 3);
1376 $pdf->SetFont(
'',
'B', $default_font_size);
1377 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1378 $posy = $pdf->getY();
1381 $pdf->SetXY($posx + 2, $posy);
1382 $pdf->SetFont(
'',
'', $default_font_size - 1);
1383 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1387 $usecontact =
false;
1388 $arrayidcontact = $object->getIdContact(
'external',
'CUSTOMER');
1389 if (count($arrayidcontact) > 0) {
1391 $result = $object->fetch_contact($arrayidcontact[0]);
1395 if (!empty($usecontact)) {
1396 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)))) {
1397 $socname = $object->contact;
1399 $socname = $object->thirdparty;
1402 $socname = $object->thirdparty;
1407 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
1411 if ($this->page_largeur < 210) {
1414 $posy = 42 + $top_shift;
1415 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1416 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1417 $posx = $this->marge_gauche;
1421 $pdf->SetTextColor(0, 0, 0);
1422 $pdf->SetFont(
'',
'', $default_font_size - 2);
1423 $pdf->SetXY($posx + 2, $posy - 5);
1424 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0,
'L');
1425 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1428 $pdf->SetXY($posx + 2, $posy + 3);
1429 $pdf->SetFont(
'',
'B', $default_font_size);
1430 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
1433 $pdf->SetFont(
'',
'', $default_font_size - 1);
1434 $pdf->SetXY($posx + 2, $posy + 4 + (
dol_nboflines_bis($carac_client_name, 50) * 4));
1435 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1438 $pdf->SetTextColor(0, 0, 0);
1452 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1454 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1455 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
Class to manage bank accounts.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Classe mere des modeles de propale.
Class to manage products or services.
Class to manage Dolibarr users.
Class to generate PDF supplier proposal Aurore.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_tableau_versements(&$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.
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.
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_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_nboflines_bis($text, $maxlinesize=0, $charset='UTF-8')
Return nb of lines of a formated text with and (WARNING: string must not have mixed and br sepa...
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_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_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_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.