151 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
154 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
156 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
158 if (!is_object($outputlangs)) {
159 $outputlangs = $langs;
163 $outputlangs->charset_output =
'ISO-8859-1';
167 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
169 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
170 global $outputlangsbis;
171 $outputlangsbis =
new Translate(
'', $conf);
172 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
173 $outputlangsbis->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
176 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
180 $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
184 $realpatharray = array();
185 $this->atleastonephoto =
false;
239 if ($conf->asset->dir_output.
'/asset') {
240 $object->fetch_thirdparty();
243 if ($object->specimen) {
244 $dir = $conf->asset->dir_output.
'/asset';
245 $file = $dir.
"/SPECIMEN.pdf";
248 $dir = $conf->asset->dir_output.
'/asset/'.$objectref;
249 $file = $dir.
"/".$objectref.
".pdf";
251 if (!file_exists($dir)) {
253 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
258 if (file_exists($dir)) {
260 if (!is_object($hookmanager)) {
261 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
264 $hookmanager->initHooks(array(
'pdfgeneration'));
265 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
267 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
270 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
275 $pdf->SetAutoPageBreak(1, 0);
277 $heightforinfotot = 50;
278 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
279 $heightforfooter = $this->marge_basse + (!
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);
281 if (class_exists(
'TCPDF')) {
282 $pdf->setPrintHeader(
false);
283 $pdf->setPrintFooter(
false);
289 $logodir = $conf->mycompany->dir_output;
290 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
291 $logodir = $conf->mycompany->multidir_output[$object->entity];
293 $pagecount = $pdf->setSourceFile($logodir .
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
294 $tplidx = $pdf->importPage(1);
299 $pdf->SetDrawColor(128, 128, 128);
301 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
302 $pdf->SetSubject($outputlangs->transnoentities(
"PdfTitle"));
303 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
304 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
305 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PdfTitle").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
307 $pdf->SetCompression(
false);
311 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
319 'Name' => $this->emetteur->name,
320 'Location' =>
getCountry($this->emetteur->country_code, 0),
322 'ContactInfo' => $this->emetteur->email
324 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
327 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
331 if (!empty($tplidx)) {
332 $pdf->useTemplate($tplidx);
336 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
337 $pdf->SetFont(
'',
'', $default_font_size - 1);
338 $pdf->MultiCell(0, 3,
'');
339 $pdf->SetTextColor(0, 0, 0);
341 $tab_top = 90 + $top_shift;
342 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
343 $tab_height = 130 - $top_shift;
344 $tab_height_newpage = 150;
346 $tab_height_newpage -= $top_shift;
349 $nexY = $tab_top - 1;
352 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
354 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
355 if (!empty($extranote)) {
359 $pagenb = $pdf->getPage();
363 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
364 $pageposbeforenote = $pagenb;
371 $pdf->startTransaction();
373 $pdf->SetFont(
'',
'', $default_font_size - 1);
374 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
376 $pageposafternote = $pdf->getPage();
377 $posyafter = $pdf->GetY();
379 if ($pageposafternote > $pageposbeforenote) {
380 $pdf->rollbackTransaction(
true);
383 while ($pagenb < $pageposafternote) {
386 if (!empty($tplidx)) {
387 $pdf->useTemplate($tplidx);
390 $this->
_pagehead($pdf, $object, 0, $outputlangs);
393 $pdf->setTopMargin($tab_top_newpage);
395 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
399 $pdf->setPage($pageposbeforenote);
400 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
401 $pdf->SetFont(
'',
'', $default_font_size - 1);
402 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
403 $pageposafternote = $pdf->getPage();
405 $posyafter = $pdf->GetY();
407 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
408 $pdf->AddPage(
'',
'',
true);
411 $pdf->setPage($pageposafternote);
412 $pdf->setTopMargin($tab_top_newpage);
414 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
420 $i = $pageposbeforenote;
421 while ($i < $pageposafternote) {
425 $pdf->SetDrawColor(128, 128, 128);
427 if ($i > $pageposbeforenote) {
428 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
429 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
431 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
432 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
436 $pdf->setPageOrientation(
'', 1, 0);
437 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
443 $pdf->setPage($pageposafternote);
444 if (!empty($tplidx)) {
445 $pdf->useTemplate($tplidx);
448 $this->
_pagehead($pdf, $object, 0, $outputlangs);
450 $height_note = $posyafter - $tab_top_newpage;
451 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
453 $pdf->commitTransaction();
454 $posyafter = $pdf->GetY();
455 $height_note = $posyafter - $tab_top;
456 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
459 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
461 $pdf->AddPage(
'',
'',
true);
464 $pdf->setPage($pageposafternote);
465 if (!empty($tplidx)) {
466 $pdf->useTemplate($tplidx);
469 $this->
_pagehead($pdf, $object, 0, $outputlangs);
472 $posyafter = $tab_top_newpage;
476 $tab_height = $tab_height - $height_note;
477 $tab_top = $posyafter + 6;
486 $pdf->startTransaction();
487 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
488 $pdf->rollbackTransaction(
true);
490 $nexY = $tab_top + $this->tabTitleHeight;
493 $pageposbeforeprintlines = $pdf->getPage();
494 $pagenb = $pageposbeforeprintlines;
495 for ($i = 0; $i < $nblines; $i++) {
497 $pdf->SetFont(
'',
'', $default_font_size - 1);
498 $pdf->SetTextColor(0, 0, 0);
501 $imglinesize = array();
502 if (!empty($realpatharray[$i])) {
506 $pdf->setTopMargin($tab_top_newpage);
507 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
508 $pageposbefore = $pdf->getPage();
510 $showpricebeforepagebreak = 1;
515 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
516 $pdf->AddPage(
'',
'',
true);
517 if (!empty($tplidx)) {
518 $pdf->useTemplate($tplidx);
520 $pdf->setPage($pageposbefore + 1);
522 $curY = $tab_top_newpage;
526 $showpricebeforepagebreak = 1;
528 $showpricebeforepagebreak = 0;
532 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
533 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
535 $posYAfterImage = $curY + $imglinesize[
'height'];
541 $pdf->startTransaction();
543 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
544 $pageposafter = $pdf->getPage();
546 if ($pageposafter > $pageposbefore) {
547 $pdf->rollbackTransaction(
true);
548 $pdf->setPageOrientation(
'', 1, $heightforfooter);
550 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
552 $pageposafter = $pdf->getPage();
553 $posyafter = $pdf->GetY();
555 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
556 if ($i == ($nblines - 1)) {
557 $pdf->AddPage(
'',
'',
true);
558 if (!empty($tplidx)) {
559 $pdf->useTemplate($tplidx);
561 $pdf->setPage($pageposafter + 1);
567 $showpricebeforepagebreak = 1;
569 $showpricebeforepagebreak = 0;
573 $pdf->commitTransaction();
577 $nexY = $pdf->GetY();
578 $pageposafter = $pdf->getPage();
579 $pdf->setPage($pageposbefore);
580 $pdf->setTopMargin($this->marge_haute);
581 $pdf->setPageOrientation(
'', 1, 0);
584 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
585 $pdf->setPage($pageposafter);
586 $curY = $tab_top_newpage;
589 $pdf->SetFont(
'',
'', $default_font_size - 1);
596 $nexY = max($pdf->GetY(), $nexY);
600 if (!empty($object->lines[$i]->array_options)) {
601 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
603 $extrafieldValue = $this->
getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
605 $nexY = max($pdf->GetY(), $nexY);
617 'outputlangs' => $outputlangs,
618 'hidedetails' => $hidedetails
620 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
625 $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
626 if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) {
627 if (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
628 $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
630 $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
633 if (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
634 $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva;
636 $tvaligne = $sign * $object->lines[$i]->total_tva;
640 $localtax1ligne = $object->lines[$i]->total_localtax1;
641 $localtax2ligne = $object->lines[$i]->total_localtax2;
642 $localtax1_rate = $object->lines[$i]->localtax1_tx;
643 $localtax2_rate = $object->lines[$i]->localtax2_tx;
644 $localtax1_type = $object->lines[$i]->localtax1_type;
645 $localtax2_type = $object->lines[$i]->localtax2_type;
658 $vatrate = (string) $object->lines[$i]->tva_tx;
661 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
662 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
664 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
665 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
669 if ($localtax1_type && $localtax1ligne != 0) {
670 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
671 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
673 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
676 if ($localtax2_type && $localtax2ligne != 0) {
677 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
678 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
680 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
684 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
687 if (!isset($this->tva[$vatrate])) {
688 $this->tva[$vatrate] = 0;
690 $this->tva[$vatrate] += $tvaligne;
692 $nexY = max($nexY, $posYAfterImage);
696 $pdf->setPage($pageposafter);
697 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
699 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
700 $pdf->SetLineStyle(array(
'dash'=>0));
704 while ($pagenb < $pageposafter) {
705 $pdf->setPage($pagenb);
706 if ($pagenb == $pageposbeforeprintlines) {
707 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
709 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
711 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
713 $pdf->setPage($pagenb);
714 $pdf->setPageOrientation(
'', 1, 0);
716 $this->
_pagehead($pdf, $object, 0, $outputlangs);
720 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
721 if ($pagenb == $pageposafter) {
722 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
724 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
726 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
729 if (!empty($tplidx)) {
730 $pdf->useTemplate($tplidx);
734 $this->
_pagehead($pdf, $object, 0, $outputlangs);
740 if ($pagenb == $pageposbeforeprintlines) {
741 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
742 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
744 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
745 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
763 $this->
_pagefoot($pdf, $object, $outputlangs);
764 if (method_exists($pdf,
'AliasNbPages')) {
765 $pdf->AliasNbPages();
770 $pdf->Output($file,
'F');
773 $hookmanager->initHooks(array(
'pdfgeneration'));
774 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
776 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
778 $this->error = $hookmanager->error;
779 $this->errors = $hookmanager->errors;
784 $this->result = array(
'fullpath'=>$file);
788 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
792 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
883 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis =
null)
885 global $conf, $langs;
888 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
895 if ($object->statut == $object::STATUS_DRAFT && (
getDolGlobalString(
'FACTURE_DRAFT_WATERMARK'))) {
896 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
899 $pdf->SetTextColor(0, 0, 60);
900 $pdf->SetFont(
'',
'B', $default_font_size + 3);
904 $posy = $this->marge_haute;
905 $posx = $this->page_largeur - $this->marge_droite - $w;
907 $pdf->SetXY($this->marge_gauche, $posy);
911 if ($this->emetteur->logo) {
912 $logodir = $conf->mycompany->dir_output;
913 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
914 $logodir = $conf->mycompany->multidir_output[$object->entity];
917 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
919 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
921 if (is_readable($logo)) {
923 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
925 $pdf->SetTextColor(200, 0, 0);
926 $pdf->SetFont(
'',
'B', $default_font_size - 2);
927 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
928 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
931 $text = $this->emetteur->name;
932 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
936 $pdf->SetFont(
'',
'B', $default_font_size + 3);
937 $pdf->SetXY($posx, $posy);
938 $pdf->SetTextColor(0, 0, 60);
939 $title = $outputlangs->transnoentities(
"PdfTitle");
942 $title .= $outputlangsbis->transnoentities(
"PdfTitle");
944 $pdf->MultiCell($w, 3, $title,
'',
'R');
946 $pdf->SetFont(
'',
'B', $default_font_size);
949 $pdf->SetXY($posx, $posy);
950 $pdf->SetTextColor(0, 0, 60);
951 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref);
952 if ($object->statut == $object::STATUS_DRAFT) {
953 $pdf->SetTextColor(128, 0, 0);
954 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
956 $pdf->MultiCell($w, 4, $textref,
'',
'R');
959 $pdf->SetFont(
'',
'', $default_font_size - 2);
961 if ($object->ref_client) {
963 $pdf->SetXY($posx, $posy);
964 $pdf->SetTextColor(0, 0, 60);
965 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset($object->ref_client),
'',
'R');
969 $object->fetch_projet();
970 if (!empty($object->project->ref)) {
972 $pdf->SetXY($posx, $posy);
973 $pdf->SetTextColor(0, 0, 60);
974 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->projet->title),
'',
'R');
979 $object->fetch_projet();
980 if (!empty($object->project->ref)) {
981 $outputlangs->load(
"projects");
983 $pdf->SetXY($posx, $posy);
984 $pdf->SetTextColor(0, 0, 60);
985 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
990 $pdf->SetXY($posx, $posy);
991 $pdf->SetTextColor(0, 0, 60);
993 $title = $outputlangs->transnoentities(
"Date");
995 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
997 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date($object->date,
"day",
false, $outputlangs),
'',
'R');
999 if ($object->thirdparty->code_client) {
1001 $pdf->SetXY($posx, $posy);
1002 $pdf->SetTextColor(0, 0, 60);
1003 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
1008 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1009 if (count($arrayidcontact) > 0) {
1010 $usertmp =
new User($this->db);
1011 $usertmp->fetch($arrayidcontact[0]);
1013 $pdf->SetXY($posx, $posy);
1014 $pdf->SetTextColor(0, 0, 60);
1015 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1023 $current_y = $pdf->getY();
1024 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3,
'R', $default_font_size);
1025 if ($current_y < $pdf->getY()) {
1026 $top_shift = $pdf->getY() - $current_y;
1031 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1035 $posy += $top_shift;
1036 $posx = $this->marge_gauche;
1038 $posx = $this->page_largeur - $this->marge_droite - 80;
1046 $pdf->SetTextColor(0, 0, 0);
1047 $pdf->SetFont(
'',
'', $default_font_size - 2);
1048 $pdf->SetXY($posx, $posy - 5);
1049 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
1050 $pdf->SetXY($posx, $posy);
1051 $pdf->SetFillColor(230, 230, 230);
1052 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1053 $pdf->SetTextColor(0, 0, 60);
1056 $pdf->SetXY($posx + 2, $posy + 3);
1057 $pdf->SetFont(
'',
'B', $default_font_size);
1058 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1059 $posy = $pdf->getY();
1062 $pdf->SetXY($posx + 2, $posy);
1063 $pdf->SetFont(
'',
'', $default_font_size - 1);
1064 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1067 $usecontact =
false;
1068 $arrayidcontact = $object->getIdContact(
'external',
'BILLING');
1069 if (count($arrayidcontact) > 0) {
1071 $result = $object->fetch_contact($arrayidcontact[0]);
1075 if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT'))) {
1076 $thirdparty = $object->contact;
1078 $thirdparty = $object->thirdparty;
1081 if (is_object($thirdparty)) {
1085 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
1089 if ($this->page_largeur < 210) {
1093 $posy += $top_shift;
1094 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1096 $posx = $this->marge_gauche;
1100 $pdf->SetTextColor(0, 0, 0);
1101 $pdf->SetFont(
'',
'', $default_font_size - 2);
1102 $pdf->SetXY($posx + 2, $posy - 5);
1103 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo").
":", 0,
'L');
1104 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1107 $pdf->SetXY($posx + 2, $posy + 3);
1108 $pdf->SetFont(
'',
'B', $default_font_size);
1109 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1111 $posy = $pdf->getY();
1114 $pdf->SetFont(
'',
'', $default_font_size - 1);
1115 $pdf->SetXY($posx + 2, $posy);
1116 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1119 $pdf->SetTextColor(0, 0, 0);