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';
65 public $phpmin = array(5, 6);
71 public $version =
'dolibarr';
122 global $conf, $langs, $mysoc;
125 $langs->loadLangs(array(
"main",
"bills"));
128 $this->
name =
"aurore";
129 $this->
description = $langs->trans(
'DocModelAuroreDescription');
134 $this->page_largeur = $formatarray[
'width'];
135 $this->page_hauteur = $formatarray[
'height'];
136 $this->format = array($this->page_largeur, $this->page_hauteur);
137 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
138 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
139 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
140 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
142 $this->option_logo = 1;
143 $this->option_tva = 1;
144 $this->option_modereg = 1;
145 $this->option_condreg = 1;
146 $this->option_codeproduitservice = 1;
147 $this->option_multilang = 1;
148 $this->option_escompte = 1;
149 $this->option_credit_note = 1;
150 $this->option_freetext = 1;
151 $this->option_draft_watermark = 1;
154 $this->emetteur = $mysoc;
155 if (empty($this->emetteur->country_code)) {
156 $this->emetteur->country_code = substr($langs->defaultlang, -2);
160 $this->posxdesc = $this->marge_gauche + 1;
161 $this->posxdiscount = 162;
162 $this->postotalht = 174;
164 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
165 $this->posxtva = 101;
167 $this->posxqty = 135;
168 $this->posxunit = 151;
170 $this->posxtva = 102;
172 $this->posxqty = 145;
173 $this->posxunit = 162;
176 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
177 $this->posxup = $this->posxtva;
179 $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
180 if ($this->page_largeur < 210) {
181 $this->posxpicture -= 20;
182 $this->posxtva -= 20;
184 $this->posxqty -= 20;
185 $this->posxunit -= 20;
186 $this->posxdiscount -= 20;
187 $this->postotalht -= 20;
190 $this->tva = array();
191 $this->localtax1 = array();
192 $this->localtax2 = array();
193 $this->atleastoneratenotnull = 0;
194 $this->atleastonediscount = 0;
209 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
212 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
214 if (!is_object($outputlangs)) {
215 $outputlangs = $langs;
218 if (!empty($conf->global->MAIN_USE_FPDF)) {
219 $outputlangs->charset_output =
'ISO-8859-1';
223 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"supplier_proposal"));
225 $nblines = count($object->lines);
228 $realpatharray = array();
229 if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
230 for ($i = 0; $i < $nblines; $i++) {
231 if (empty($object->lines[$i]->fk_product)) {
236 $objphoto->fetch($object->lines[$i]->fk_product);
238 if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
239 $pdir =
get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
240 $dir = $conf->product->dir_output.
'/'.$pdir;
242 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
243 $dir = $conf->product->dir_output.
'/'.$pdir;
247 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
248 $filename = $obj[
'photo'];
250 $realpath = $dir.$filename;
255 $realpatharray[$i] = $realpath;
259 if (count($realpatharray) == 0) {
260 $this->posxpicture = $this->posxtva;
263 if ($conf->supplier_proposal->dir_output) {
264 $object->fetch_thirdparty();
269 if ($object->specimen) {
270 $dir = $conf->supplier_proposal->dir_output;
271 $file = $dir.
"/SPECIMEN.pdf";
274 $dir = $conf->supplier_proposal->dir_output.
"/".$objectref;
275 $file = $dir.
"/".$objectref.
".pdf";
278 if (!file_exists($dir)) {
280 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
285 if (file_exists($dir)) {
287 if (!is_object($hookmanager)) {
288 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
291 $hookmanager->initHooks(array(
'pdfgeneration'));
292 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
294 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
299 $heightforinfotot = 50;
300 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
301 $heightforfooter = $this->marge_basse + 8;
302 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
303 $heightforfooter += 6;
305 $pdf->SetAutoPageBreak(1, 0);
307 if (class_exists(
'TCPDF')) {
308 $pdf->setPrintHeader(
false);
309 $pdf->setPrintFooter(
false);
313 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
314 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
315 $tplidx = $pdf->importPage(1);
320 $pdf->SetDrawColor(128, 128, 128);
322 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
323 $pdf->SetSubject($outputlangs->transnoentities(
"CommercialAsk"));
324 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
325 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
326 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"CommercialAsk").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
327 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
328 $pdf->SetCompression(
false);
331 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
334 for ($i = 0; $i < $nblines; $i++) {
335 if ($object->lines[$i]->remise_percent) {
336 $this->atleastonediscount++;
339 if (empty($this->atleastonediscount)) {
340 $delta = ($this->postotalht - $this->posxdiscount);
341 $this->posxpicture += $delta;
342 $this->posxtva += $delta;
343 $this->posxup += $delta;
344 $this->posxqty += $delta;
345 $this->posxunit += $delta;
346 $this->posxdiscount += $delta;
352 if (!empty($tplidx)) {
353 $pdf->useTemplate($tplidx);
356 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
357 $pdf->SetFont(
'',
'', $default_font_size - 1);
358 $pdf->MultiCell(0, 3,
'');
359 $pdf->SetTextColor(0, 0, 0);
361 $tab_top = 90 + $top_shift;
362 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
365 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
366 if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
368 if (is_object($object->thirdparty)) {
369 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
370 $salerepobj =
new User($this->
db);
371 $salerepobj->fetch($salereparray[0][
'id']);
372 if (!empty($salerepobj->signature)) {
373 $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
385 $pdf->SetFont(
'',
'', $default_font_size - 1);
386 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($notetoshow), 0, 1);
387 $nexY = $pdf->GetY();
388 $height_note = $nexY - $tab_top;
391 $pdf->SetDrawColor(192, 192, 192);
392 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
394 $tab_top = $nexY + 6;
397 $iniY = $tab_top + 7;
398 $curY = $tab_top + 7;
399 $nexY = $tab_top + 7;
402 for ($i = 0; $i < $nblines; $i++) {
404 $pdf->SetFont(
'',
'', $default_font_size - 1);
405 $pdf->SetTextColor(0, 0, 0);
408 $imglinesize = array();
409 if (!empty($realpatharray[$i])) {
413 $pdf->setTopMargin($tab_top_newpage);
414 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
415 $pageposbefore = $pdf->getPage();
417 $showpricebeforepagebreak = 1;
419 $posYAfterDescription = 0;
422 if (!empty($imglinesize[
'width']) && !empty($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
423 $pdf->AddPage(
'',
'',
true);
424 if (!empty($tplidx)) {
425 $pdf->useTemplate($tplidx);
427 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
428 $this->
_pagehead($pdf, $object, 0, $outputlangs);
430 $pdf->setPage($pageposbefore + 1);
432 $curY = $tab_top_newpage;
435 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
436 $showpricebeforepagebreak = 1;
438 $showpricebeforepagebreak = 0;
442 if (!empty($imglinesize[
'width']) && !empty($imglinesize[
'height'])) {
443 $curX = $this->posxpicture - 1;
444 $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
446 $posYAfterImage = $curY + $imglinesize[
'height'];
450 $curX = $this->posxdesc - 1;
452 $pdf->startTransaction();
453 if ($posYAfterImage > 0) {
454 $descWidth = $this->posxpicture - $curX;
456 $descWidth = $this->posxtva - $curX;
458 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
460 $pageposafter = $pdf->getPage();
461 if ($pageposafter > $pageposbefore) {
462 $pdf->rollbackTransaction(
true);
463 $pageposafter = $pageposbefore;
465 $pdf->setPageOrientation(
'', 1, $heightforfooter);
466 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc);
468 $pageposafter = $pdf->getPage();
469 $posyafter = $pdf->GetY();
471 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
472 if ($i == ($nblines - 1)) {
473 $pdf->AddPage(
'',
'',
true);
474 if (!empty($tplidx)) {
475 $pdf->useTemplate($tplidx);
477 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
478 $this->
_pagehead($pdf, $object, 0, $outputlangs);
480 $pdf->setPage($pageposafter + 1);
485 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
486 $showpricebeforepagebreak = 1;
488 $showpricebeforepagebreak = 0;
493 $pdf->commitTransaction();
495 $posYAfterDescription = $pdf->GetY();
497 $nexY = $pdf->GetY();
498 $pageposafter = $pdf->getPage();
500 $pdf->setPage($pageposbefore);
501 $pdf->setTopMargin($this->marge_haute);
502 $pdf->setPageOrientation(
'', 1, 0);
505 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
506 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
509 $pdf->SetFont(
'',
'', $default_font_size - 1);
529 $pdf->SetXY($this->posxqty, $curY);
530 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
533 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
534 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
535 $pdf->SetXY($this->posxunit, $curY);
536 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
556 if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) {
557 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
559 $tvaligne = $object->lines[$i]->total_tva;
562 $localtax1ligne = $object->lines[$i]->total_localtax1;
563 $localtax2ligne = $object->lines[$i]->total_localtax2;
564 $localtax1_rate = $object->lines[$i]->localtax1_tx;
565 $localtax2_rate = $object->lines[$i]->localtax2_tx;
566 $localtax1_type = $object->lines[$i]->localtax1_type;
567 $localtax2_type = $object->lines[$i]->localtax2_type;
569 if ($object->remise_percent) {
570 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
572 if ($object->remise_percent) {
573 $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
575 if ($object->remise_percent) {
576 $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
579 $vatrate = (string) $object->lines[$i]->tva_tx;
582 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
583 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
585 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
586 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
590 if ($localtax1_type && $localtax1ligne != 0) {
591 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
593 if ($localtax2_type && $localtax2ligne != 0) {
594 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
597 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
600 if (!isset($this->tva[$vatrate])) {
601 $this->tva[$vatrate] = 0;
603 $this->tva[$vatrate] += $tvaligne;
605 if ($posYAfterImage > $posYAfterDescription) {
606 $nexY = $posYAfterImage;
610 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
611 $pdf->setPage($pageposafter);
612 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
614 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
615 $pdf->SetLineStyle(array(
'dash'=>0));
621 while ($pagenb < $pageposafter) {
622 $pdf->setPage($pagenb);
624 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
626 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
628 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
630 $pdf->setPage($pagenb);
631 $pdf->setPageOrientation(
'', 1, 0);
632 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
633 $this->
_pagehead($pdf, $object, 0, $outputlangs);
636 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
638 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
640 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
642 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
645 if (!empty($tplidx)) {
646 $pdf->useTemplate($tplidx);
649 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
650 $this->
_pagehead($pdf, $object, 0, $outputlangs);
657 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
658 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
660 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
661 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
665 $posy = $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
679 $this->
_pagefoot($pdf, $object, $outputlangs);
680 if (method_exists($pdf,
'AliasNbPages')) {
681 $pdf->AliasNbPages();
686 $pdf->Output($file,
'F');
689 $hookmanager->initHooks(array(
'pdfgeneration'));
690 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
692 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
694 $this->error = $hookmanager->error;
695 $this->errors = $hookmanager->errors;
698 if (!empty($conf->global->MAIN_UMASK)) {
699 @chmod($file, octdec($conf->global->MAIN_UMASK));
702 $this->result = array(
'fullpath'=>$file);
706 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
710 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_PROPOSAL_OUTPUTDIR");
748 $pdf->SetFont(
'',
'', $default_font_size - 1);
753 if (!empty($object->delivery_date)) {
754 $outputlangs->load(
"sendings");
755 $pdf->SetFont(
'',
'B', $default_font_size - 2);
756 $pdf->SetXY($this->marge_gauche, $posy);
757 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
758 $pdf->MultiCell(80, 4, $titre, 0,
'L');
759 $pdf->SetFont(
'',
'', $default_font_size - 2);
760 $pdf->SetXY($posxval, $posy);
761 $dlp =
dol_print_date($object->delivery_date,
"daytext",
false, $outputlangs,
true);
762 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
764 $posy = $pdf->GetY() + 1;
766 $outputlangs->load(
"sendings");
767 $pdf->SetFont(
'',
'B', $default_font_size - 2);
768 $pdf->SetXY($this->marge_gauche, $posy);
769 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
770 $pdf->MultiCell(80, 4, $titre, 0,
'L');
771 $pdf->SetFont(
'',
'', $default_font_size - 2);
772 $pdf->SetXY($posxval, $posy);
774 $pdf->MultiCell(80, 4,
'', 0,
'L');
776 $posy = $pdf->GetY() + 1;
796 if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) {
797 $pdf->SetFont(
'',
'B', $default_font_size - 2);
798 $pdf->SetXY($this->marge_gauche, $posy);
799 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
800 $pdf->MultiCell(80, 4, $titre, 0,
'L');
802 $pdf->SetFont(
'',
'', $default_font_size - 2);
803 $pdf->SetXY($posxval, $posy);
804 $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);
805 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
806 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0,
'L');
808 $posy = $pdf->GetY() + 3;
811 if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) {
813 if ($object->mode_reglement_code
814 && $object->mode_reglement_code !=
'CHQ'
815 && $object->mode_reglement_code !=
'VIR') {
816 $pdf->SetFont(
'',
'B', $default_font_size - 2);
817 $pdf->SetXY($this->marge_gauche, $posy - 2);
818 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
819 $pdf->MultiCell(80, 5, $titre, 0,
'L');
820 $pdf->SetFont(
'',
'', $default_font_size - 2);
821 $pdf->SetXY($posxval, $posy - 2);
822 $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);
823 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
825 $posy = $pdf->GetY() + 2;
829 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'CHQ') {
831 if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
832 $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
834 if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
836 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
838 $pdf->SetXY($this->marge_gauche, $posy);
839 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
840 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->proprio), 0,
'L', 0);
841 $posy = $pdf->GetY() + 1;
843 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
844 $pdf->SetXY($this->marge_gauche, $posy);
845 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
846 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
847 $posy = $pdf->GetY() + 2;
850 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
851 $pdf->SetXY($this->marge_gauche, $posy);
852 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
853 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
854 $posy = $pdf->GetY() + 1;
856 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
857 $pdf->SetXY($this->marge_gauche, $posy);
858 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
859 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
860 $posy = $pdf->GetY() + 2;
867 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'VIR') {
868 if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) {
869 $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
871 $account->fetch($bankid);
873 $curx = $this->marge_gauche;
876 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
898 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
901 global $conf, $mysoc;
906 $pdf->SetFont(
'',
'', $default_font_size - 1);
909 $col1x = 120; $col2x = 170;
910 if ($this->page_largeur < 210) {
913 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
919 $pdf->SetFillColor(255, 255, 255);
920 $pdf->SetXY($col1x, $tab2_top + 0);
921 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
923 $pdf->SetXY($col2x, $tab2_top + 0);
924 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0,
'R', 1);
927 $pdf->SetFillColor(248, 248, 248);
929 $this->atleastoneratenotnull = 0;
930 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
931 $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000'])) ?
true :
false);
932 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) {
938 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
939 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
943 foreach ($localtax_rate as $tvakey => $tvaval) {
948 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
951 if (preg_match(
'/\*/', $tvakey)) {
952 $tvakey = str_replace(
'*',
'', $tvakey);
953 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
955 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
956 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
957 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
959 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
960 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
968 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
969 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
973 foreach ($localtax_rate as $tvakey => $tvaval) {
980 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
983 if (preg_match(
'/\*/', $tvakey)) {
984 $tvakey = str_replace(
'*',
'', $tvakey);
985 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
987 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
988 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
989 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
991 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
992 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
998 foreach ($this->tva as $tvakey => $tvaval) {
1000 $this->atleastoneratenotnull++;
1003 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1006 if (preg_match(
'/\*/', $tvakey)) {
1007 $tvakey = str_replace(
'*',
'', $tvakey);
1008 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1010 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
1011 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
1012 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1014 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1015 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1022 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1023 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1027 foreach ($localtax_rate as $tvakey => $tvaval) {
1032 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1035 if (preg_match(
'/\*/', $tvakey)) {
1036 $tvakey = str_replace(
'*',
'', $tvakey);
1037 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1039 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
1041 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1042 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1043 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1044 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1052 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1053 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1057 foreach ($localtax_rate as $tvakey => $tvaval) {
1063 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1066 if (preg_match(
'/\*/', $tvakey)) {
1067 $tvakey = str_replace(
'*',
'', $tvakey);
1068 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1070 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
1072 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1073 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1075 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1076 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1084 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1085 $pdf->SetTextColor(0, 0, 60);
1086 $pdf->SetFillColor(224, 224, 224);
1087 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
1089 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1090 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1094 $pdf->SetTextColor(0, 0, 0);
1096 $resteapayer = $object->total_ttc - $deja_regle;
1097 if (!empty($object->paye)) {
1101 if ($deja_regle > 0) {
1104 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1105 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L', 0);
1107 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1108 $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 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
1199 $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height);
1201 if (empty($hidetop)) {
1202 $pdf->SetXY($this->posxtva - 5, $tab_top + 1);
1203 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1207 $pdf->line($this->posxup - 3, $tab_top, $this->posxup - 3, $tab_top + $tab_height);
1208 if (empty($hidetop)) {
1209 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1210 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1213 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1214 if (empty($hidetop)) {
1215 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1216 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1219 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1220 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1221 if (empty($hidetop)) {
1222 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1223 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1227 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1228 if (empty($hidetop)) {
1229 if ($this->atleastonediscount) {
1230 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1231 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1234 if ($this->atleastonediscount) {
1235 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1237 if (empty($hidetop)) {
1238 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1239 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHT"),
'',
'C');
1253 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1255 global $conf, $langs;
1258 $outputlangs->loadLangs(array(
"main",
"bills",
"supplier_proposal",
"companies"));
1265 if ($object->statut == 0 && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
1266 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK);
1269 $pdf->SetTextColor(0, 0, 60);
1270 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1272 $posy = $this->marge_haute;
1273 $posx = $this->page_largeur - $this->marge_droite - 100;
1275 $pdf->SetXY($this->marge_gauche, $posy);
1278 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1279 if ($this->emetteur->logo) {
1280 if (is_readable($logo)) {
1282 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1284 $pdf->SetTextColor(200, 0, 0);
1285 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1286 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1287 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1290 $text = $this->emetteur->name;
1291 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1294 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1295 $pdf->SetXY($posx, $posy);
1296 $pdf->SetTextColor(0, 0, 60);
1297 $title = $outputlangs->transnoentities(
"CommercialAsk");
1298 $pdf->MultiCell(100, 4, $title,
'',
'R');
1300 $pdf->SetFont(
'',
'B', $default_font_size);
1303 $pdf->SetXY($posx, $posy);
1304 $pdf->SetTextColor(0, 0, 60);
1305 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
1308 $pdf->SetFont(
'',
'', $default_font_size - 2);
1310 if ($object->ref_client) {
1312 $pdf->SetXY($posx, $posy);
1313 $pdf->SetTextColor(0, 0, 60);
1314 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset($object->ref_client),
'',
'R');
1323 if ($object->thirdparty->code_fournisseur) {
1325 $pdf->SetXY($posx, $posy);
1326 $pdf->SetTextColor(0, 0, 60);
1327 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
1331 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1332 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1333 if (count($arrayidcontact) > 0) {
1334 $usertmp =
new User($this->
db);
1335 $usertmp->fetch($arrayidcontact[0]);
1337 $pdf->SetXY($posx, $posy);
1338 $pdf->SetTextColor(0, 0, 60);
1339 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1347 $current_y = $pdf->getY();
1348 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1349 if ($current_y < $pdf->getY()) {
1350 $top_shift = $pdf->getY() - $current_y;
1355 $carac_emetteur =
'';
1357 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1358 if (count($arrayidcontact) > 0) {
1359 $object->fetch_user($arrayidcontact[0]);
1360 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1361 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1364 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1367 $posy = 42 + $top_shift;
1368 $posx = $this->marge_gauche;
1369 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1370 $posx = $this->page_largeur - $this->marge_droite - 80;
1375 $pdf->SetTextColor(0, 0, 0);
1376 $pdf->SetFont(
'',
'', $default_font_size - 2);
1377 $pdf->SetXY($posx, $posy - 5);
1378 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
1379 $pdf->SetXY($posx, $posy);
1380 $pdf->SetFillColor(230, 230, 230);
1381 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1382 $pdf->SetTextColor(0, 0, 60);
1385 $pdf->SetXY($posx + 2, $posy + 3);
1386 $pdf->SetFont(
'',
'B', $default_font_size);
1387 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1388 $posy = $pdf->getY();
1391 $pdf->SetXY($posx + 2, $posy);
1392 $pdf->SetFont(
'',
'', $default_font_size - 1);
1393 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1397 $usecontact =
false;
1398 $arrayidcontact = $object->getIdContact(
'external',
'CUSTOMER');
1399 if (count($arrayidcontact) > 0) {
1401 $result = $object->fetch_contact($arrayidcontact[0]);
1405 if (!empty($usecontact)) {
1406 if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1407 $socname = $object->contact;
1409 $socname = $object->thirdparty;
1412 $socname = $object->thirdparty;
1417 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
1421 if ($this->page_largeur < 210) {
1424 $posy = 42 + $top_shift;
1425 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1426 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1427 $posx = $this->marge_gauche;
1431 $pdf->SetTextColor(0, 0, 0);
1432 $pdf->SetFont(
'',
'', $default_font_size - 2);
1433 $pdf->SetXY($posx + 2, $posy - 5);
1434 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo").
":", 0,
'L');
1435 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1438 $pdf->SetXY($posx + 2, $posy + 3);
1439 $pdf->SetFont(
'',
'B', $default_font_size);
1440 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
1443 $pdf->SetFont(
'',
'', $default_font_size - 1);
1444 $pdf->SetXY($posx + 2, $posy + 4 + (
dol_nboflines_bis($carac_client_name, 50) * 4));
1445 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1448 $pdf->SetTextColor(0, 0, 0);
1462 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1465 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1466 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
__construct($db)
Constructor.
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...
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank informations for PDF generation.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency= '')
Show table for lines.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Class to manage products or services.
Class to manage Dolibarr users.
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...
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
Classe mere des modeles de propale.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
$conf db name
Only used if Module[ID]Name translation string is not found.
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...
$conf db
API class for accounts.
Class to manage bank accounts.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
Class to generate PDF supplier proposal Aurore.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
write_file($object, $outputlangs, $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany= '', $targetcontact= '', $usecontact=0, $mode= 'source', $object=null)
Return a string with full address formated for output on documents.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...