187 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
190 global $user, $langs,
$conf,
$mysoc, $db, $hookmanager, $nblines;
192 if (!is_object($outputlangs)) {
193 $outputlangs = $langs;
197 $outputlangs->charset_output =
'ISO-8859-1';
201 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"compta"));
208 global $outputlangsbis;
209 $outputlangsbis =
null;
213 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"sendings",
"compta"));
216 $nblines = count(
$object->lines);
218 if (
$conf->commande->multidir_output[
$conf->entity]) {
225 $dir =
$conf->commande->multidir_output[
$conf->entity];
226 $file = $dir.
"/SPECIMEN.pdf";
236 $dir =
$conf->commande->multidir_output[
$object->entity ??
$conf->entity].
"/".$objectref;
237 $file = $dir.
"/".$objectref.$suffix.
".pdf";
240 if (!file_exists($dir)) {
242 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
247 if (file_exists($dir)) {
249 if (!is_object($hookmanager)) {
250 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
253 $hookmanager->initHooks(array(
'pdfgeneration'));
254 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
256 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
259 $nblines = count(
$object->lines);
264 $pdf->setAutoPageBreak(
true, 0);
266 $heightforinfotot = 40;
268 $heightforfooter = $this->marge_basse + 8;
270 $heightforfooter += 6;
273 if (class_exists(
'TCPDF')) {
274 $pdf->setPrintHeader(
false);
275 $pdf->setPrintFooter(
false);
280 $logodir =
$conf->mycompany->dir_output;
281 if (!empty(
$conf->mycompany->multidir_output[
$object->entity ??
$conf->entity])) {
284 $pagecount = $pdf->setSourceFile($logodir.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
285 $tplidx = $pdf->importPage(1);
290 $pdf->SetDrawColor(128, 128, 128);
292 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
293 $pdf->SetSubject($outputlangs->transnoentities(
"PdfOrderTitle"));
294 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
295 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
296 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfOrderTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
298 $pdf->SetCompression(
false);
302 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
305 for ($i = 0; $i < $nblines; $i++) {
306 if (
$object->lines[$i]->remise_percent) {
307 $this->atleastonediscount++;
310 if (empty($this->atleastonediscount)) {
311 $delta = ($this->postotalht - $this->posxdiscount);
312 $this->posxpicture += $delta;
313 $this->posxtva += $delta;
314 $this->posxup += $delta;
315 $this->posxqty += $delta;
316 $this->posxunit += $delta;
317 $this->posxdiscount += $delta;
323 if (!empty($tplidx)) {
324 $pdf->useTemplate($tplidx);
327 $pagehead = $this->
_pagehead($pdf,
$object, 1, $outputlangs, (is_object($outputlangsbis) ? $outputlangsbis :
null));
328 $top_shift = $pagehead[
'top_shift'];
329 $shipp_shift = $pagehead[
'shipp_shift'];
330 $pdf->SetFont(
'',
'', $default_font_size - 1);
331 $pdf->MultiCell(0, 3,
'');
332 $pdf->SetTextColor(0, 0, 0);
334 $tab_top = 90 + $top_shift + $shipp_shift;
335 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
338 $height_incoterms = 0;
340 $desc_incoterms =
$object->getIncotermsForPDF();
341 if ($desc_incoterms) {
344 $pdf->SetFont(
'',
'', $default_font_size - 1);
345 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
346 $nexY = $pdf->GetY();
347 $height_incoterms = $nexY - $tab_top;
350 $pdf->SetDrawColor(192, 192, 192);
351 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 3, $this->corner_radius,
'1234',
'D');
353 $tab_top = $nexY + 6;
358 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
361 if (is_object(
$object->thirdparty)) {
362 $salereparray =
$object->thirdparty->getSalesRepresentatives($user);
363 $salerepobj =
new User($this->db);
364 $salerepobj->fetch($salereparray[0][
'id']);
365 if (!empty($salerepobj->signature)) {
366 $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
371 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
372 if (!empty($extranote)) {
384 $pdf->SetFont(
'',
'', $default_font_size - 1);
385 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($notetoshow), 0, 1);
386 $nexY = $pdf->GetY();
387 $height_note = $nexY - $tab_top;
390 $pdf->SetDrawColor(192, 192, 192);
391 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1, $this->corner_radius,
'1234',
'D');
393 $tab_top = $nexY + 6;
396 $iniY = $tab_top + 7;
397 $curY = $tab_top + 7;
398 $nexY = $tab_top + 7;
401 for ($i = 0; $i < $nblines; $i++) {
403 $pdf->SetFont(
'',
'', $default_font_size - 1);
404 $pdf->SetTextColor(0, 0, 0);
406 $pdf->setTopMargin($tab_top_newpage);
407 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
408 $pageposbefore = $pdf->getPage();
411 $curX = $this->posxdesc - 1;
413 $showpricebeforepagebreak = 1;
415 $pdf->startTransaction();
417 $pageposafter = $pdf->getPage();
418 if ($pageposafter > $pageposbefore) {
419 $pdf->rollbackTransaction(
true);
420 $pageposafter = $pageposbefore;
422 $pdf->setPageOrientation(
'',
true, $heightforfooter);
424 $pageposafter = $pdf->getPage();
425 $posyafter = $pdf->GetY();
426 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
427 if ($i == ($nblines - 1)) {
428 $pdf->AddPage(
'',
'',
true);
429 if (!empty($tplidx)) {
430 $pdf->useTemplate($tplidx);
435 $pdf->setPage($pageposafter + 1);
441 $showpricebeforepagebreak = 1;
443 $showpricebeforepagebreak = 0;
447 $pdf->commitTransaction();
449 $posYAfterDescription = $pdf->GetY();
451 $nexY = $pdf->GetY();
452 $pageposafter = $pdf->getPage();
454 $pdf->setPage($pageposbefore);
455 $pdf->setTopMargin($this->marge_haute);
456 $pdf->setPageOrientation(
'',
true, 0);
459 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
460 $pdf->setPage($pageposafter);
461 $curY = $tab_top_newpage;
464 $pdf->SetFont(
'',
'', $default_font_size - 1);
469 $pdf->SetXY($this->posxtva - 5, $curY);
470 $pdf->MultiCell($this->posxup - $this->posxtva + 4, 3, $vat_rate, 0,
'R');
475 $pdf->SetXY($this->posxup, $curY);
476 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0,
'R',
false);
480 $pdf->SetXY($this->posxqty, $curY);
481 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
486 $pdf->SetXY($this->posxunit, $curY);
487 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
491 $pdf->SetXY($this->posxdiscount, $curY);
492 if (
$object->lines[$i]->remise_percent) {
493 $pdf->SetXY($this->posxdiscount - 2, $curY);
495 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0,
'R');
500 $pdf->SetXY($this->postotalht, $curY);
501 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0,
'R',
false);
505 $tvaligne =
$object->lines[$i]->multicurrency_total_tva;
507 $tvaligne =
$object->lines[$i]->total_tva;
510 $localtax1ligne =
$object->lines[$i]->total_localtax1;
511 $localtax2ligne =
$object->lines[$i]->total_localtax2;
512 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
513 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
514 $localtax1_type =
$object->lines[$i]->localtax1_type;
515 $localtax2_type =
$object->lines[$i]->localtax2_type;
531 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
532 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
534 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
535 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
539 if ($localtax1_type && $localtax1ligne != 0) {
540 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
541 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
543 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
546 if ($localtax2_type && $localtax2ligne != 0) {
547 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
548 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
550 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
554 if ((
$object->lines[$i]->info_bits & 0x01) == 0x01) {
559 if (!isset($this->tva[$vatrate])) {
560 $this->tva[$vatrate] = 0;
562 $this->tva[$vatrate] += $tvaligne;
563 $vatcode =
$object->lines[$i]->vat_src_code;
564 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
565 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
567 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
571 $pdf->setPage($pageposafter);
572 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
574 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
575 $pdf->SetLineStyle(array(
'dash' => 0));
581 while ($pagenb < $pageposafter) {
582 $pdf->setPage($pagenb);
584 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object->multicurrency_code);
586 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
590 $pdf->setPage($pagenb);
591 $pdf->setPageOrientation(
'',
true, 0);
595 if (!empty($tplidx)) {
596 $pdf->useTemplate($tplidx);
599 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
601 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object->multicurrency_code);
603 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
608 if (!empty($tplidx)) {
609 $pdf->useTemplate($tplidx);
620 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0,
$object->multicurrency_code);
622 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code);
624 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
642 if (method_exists($pdf,
'AliasNbPages')) {
643 $pdf->AliasNbPages();
648 if (
getDolGlobalInt(
'MAIN_PDF_ADD_TERMSOFSALE_ORDER') && $termsofsalefilename) {
649 $termsofsale =
$conf->order->dir_output.
'/'.$termsofsalefilename;
650 if (!empty(
$conf->order->multidir_output[
$conf->entity])) {
651 $termsofsale =
$conf->order->multidir_output[
$conf->entity].
'/'.$termsofsalefilename;
653 if (file_exists($termsofsale) && is_readable($termsofsale)) {
654 $pagecount = $pdf->setSourceFile($termsofsale);
655 for ($i = 1; $i <= $pagecount; $i++) {
656 $tplIdx = $pdf->importPage($i);
657 if ($tplIdx !==
false) {
658 $s = $pdf->getTemplatesize($tplIdx);
659 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
660 $pdf->useTemplate($tplIdx);
662 setEventMessages(
null, array($termsofsale.
' cannot be added, probably protected PDF'),
'warnings');
670 $pdf->Output($file,
'F');
673 $hookmanager->initHooks(array(
'pdfgeneration'));
674 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
676 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
677 $this->warnings = $hookmanager->warnings;
679 $this->error = $hookmanager->error;
680 $this->errors = $hookmanager->errors;
687 $this->result = array(
'fullpath' => $file);
691 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
695 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"COMMANDE_OUTPUTDIR");
734 $pdf->SetFont(
'',
'', $default_font_size - 1);
739 if ($this->emetteur->country_code ==
'FR' && empty(
$mysoc->tva_assuj)) {
740 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
741 $pdf->SetXY($this->marge_gauche, $posy);
742 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L',
false);
744 $posy = $pdf->GetY() + 4;
753 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
754 $pdf->SetXY($this->marge_gauche, $posy);
755 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
756 $pdf->MultiCell(43, 4, $titre, 0,
'L');
758 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
759 $pdf->SetXY($posxval, $posy);
760 $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);
761 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
762 if (
$object->deposit_percent > 0) {
763 $lib_condition_paiement = str_replace(
'__DEPOSIT_PERCENT__', (
string)
$object->deposit_percent, $lib_condition_paiement);
765 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
767 $posy = $pdf->GetY() + 3;
798 if (!empty(
$object->delivery_date)) {
799 $outputlangs->load(
"sendings");
800 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
801 $pdf->SetXY($this->marge_gauche, $posy);
802 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
803 $pdf->MultiCell(80, 4, $titre, 0,
'L');
804 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
805 $pdf->SetXY($posxval, $posy);
807 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
809 $posy = $pdf->GetY() + 1;
812 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
813 $pdf->SetXY($this->marge_gauche, $posy);
814 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
815 $pdf->MultiCell(80, 4, $titre, 0,
'L');
816 $pdf->SetTextColor(0, 0, 0);
817 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
818 $pdf->SetXY($posxval, $posy);
819 $lib_availability = $outputlangs->transnoentities(
"AvailabilityType".
$object->availability_code) !=
'AvailabilityType'.$object->availability_code ? $outputlangs->transnoentities(
"AvailabilityType".
$object->availability_code) : $outputlangs->convToOutputCharset(isset(
$object->availability) ?
$object->availability :
'');
820 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
821 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
823 $posy = $pdf->GetY() + 1;
827 if (
$object->mode_reglement_code
828 &&
$object->mode_reglement_code !=
'CHQ'
829 &&
$object->mode_reglement_code !=
'VIR') {
830 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
831 $pdf->SetXY($this->marge_gauche, $posy);
832 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
833 $pdf->MultiCell(80, 5, $titre, 0,
'L');
835 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
836 $pdf->SetXY($posxval, $posy);
837 $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);
838 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
840 $posy = $pdf->GetY() + 2;
844 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'CHQ') {
848 $account =
new Account($this->db);
851 $pdf->SetXY($this->marge_gauche, $posy);
852 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
853 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->owner_name), 0,
'L',
false);
854 $posy = $pdf->GetY() + 1;
857 $pdf->SetXY($this->marge_gauche, $posy);
858 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
859 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L',
false);
860 $posy = $pdf->GetY() + 2;
864 $pdf->SetXY($this->marge_gauche, $posy);
865 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
866 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L',
false);
867 $posy = $pdf->GetY() + 1;
870 $pdf->SetXY($this->marge_gauche, $posy);
871 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
872 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L',
false);
873 $posy = $pdf->GetY() + 2;
880 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'VIR') {
882 $bankid = (
$object->fk_account <= 0 ?
$conf->global->FACTURE_RIB_NUMBER :
$object->fk_account);
886 $account =
new Account($this->db);
887 $account->fetch($bankid);
889 $curx = $this->marge_gauche;
892 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
924 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal",
"sendings"));
925 $default_font_size--;
930 $pdf->SetFont(
'',
'', $default_font_size - 1);
935 if ($this->page_largeur < 210) {
938 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
947 $total_discount_on_lines = 0;
948 $multicurrency_total_discount_on_lines = 0;
949 foreach (
$object->lines as $i => $line) {
953 $total_discount_on_lines += (is_numeric($resdiscount) ? $resdiscount : 0);
954 $multicurrency_total_discount_on_lines += (is_numeric($multicurrency_resdiscount) ? $multicurrency_resdiscount : 0);
956 if ($line->total_ht < 0) {
957 $total_discount_on_lines += -$line->total_ht;
958 $multicurrency_total_discount_on_lines += -$line->multicurrency_total_ht;
962 if ($total_discount_on_lines > 0) {
963 if ($this->showAmountBeforeDiscount) {
965 $pdf->SetFillColor(255, 255, 255);
966 $pdf->SetXY($col1x, $tab2_top);
967 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHTBeforeDiscount") . (is_object($outputlangsbis) ?
' / ' . $outputlangsbis->transnoentities(
"TotalHTBeforeDiscount") :
''), 0,
'L',
true);
968 $pdf->SetXY($col2x, $tab2_top);
970 $total_before_discount_to_show = ((
isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) ? (
$object->multicurrency_total_ht + $multicurrency_total_discount_on_lines) : (
$object->total_ht + $total_discount_on_lines));
971 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_before_discount_to_show, 0, $outputlangs), 0,
'R',
true);
976 if ($this->showDiscountAmount) {
977 $pdf->SetFillColor(255, 255, 255);
978 $pdf->SetXY($col1x, $tab2_top + $tab2_hl);
979 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalDiscount") . (is_object($outputlangsbis) ?
' / ' . $outputlangsbis->transnoentities(
"TotalDiscount") :
''), 0,
'L',
true);
980 $pdf->SetXY($col2x, $tab2_top + $tab2_hl);
982 $total_discount_to_show = ((
isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) ? $multicurrency_total_discount_on_lines : $total_discount_on_lines);
983 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_discount_to_show, 0, $outputlangs), 0,
'R',
true);
990 $pdf->SetFillColor(255, 255, 255);
991 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
992 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHT") :
''), 0,
'L',
true);
995 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
996 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty(
$object->remise) ?
$object->remise : 0), 0, $outputlangs), 0,
'R',
true);
999 $pdf->SetFillColor(248, 248, 248);
1003 $this->atleastoneratenotnull = 0;
1005 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000']));
1006 if (
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) {
1010 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1011 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1014 foreach ($localtax_rate as $tvakey => $tvaval) {
1019 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1022 if (preg_match(
'/\*/', (
string) $tvakey)) {
1023 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1024 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1026 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1",
$mysoc->country_code) :
'');
1030 $totalvat .= $tvacompl;
1032 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1035 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1039 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1040 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1046 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1047 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1050 foreach ($localtax_rate as $tvakey => $tvaval) {
1055 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1058 if (preg_match(
'/\*/', (
string) $tvakey)) {
1059 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1060 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1062 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2",
$mysoc->country_code) :
'');
1066 $totalvat .= $tvacompl;
1068 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1071 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1075 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1076 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1082 foreach ($this->tva_array as $tvakey => $tvaval) {
1084 $this->atleastoneratenotnull++;
1087 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1090 if (preg_match(
'/\*/', $tvakey)) {
1091 $tvakey = str_replace(
'*',
'', $tvakey);
1092 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1094 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalVAT",
$mysoc->country_code) :
'');
1097 $totalvat .=
vatrate((
string) $tvaval[
'vatrate'],
true).$tvacompl;
1099 $totalvat .= $tvaval[
'vatcode'].$tvacompl;
1101 $totalvat .= $tvacompl;
1103 $totalvat .=
vatrate((
string) $tvaval[
'vatrate'],
true).($tvaval[
'vatcode'] ?
' ('.$tvaval[
'vatcode'].
')' :
'').$tvacompl;
1105 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1107 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1108 $pdf->MultiCell($largcol2, $tab2_hl,
price(
price2num($tvaval[
'amount'],
'MT'), 0, $outputlangs), 0,
'R',
true);
1115 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1116 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1120 foreach ($localtax_rate as $tvakey => $tvaval) {
1125 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1128 if (preg_match(
'/\*/', (
string) $tvakey)) {
1129 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1130 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1132 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1",
$mysoc->country_code) :
'');
1136 $totalvat .= $tvacompl;
1138 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1141 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1145 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1146 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1154 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1155 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1159 foreach ($localtax_rate as $tvakey => $tvaval) {
1165 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1168 if (preg_match(
'/\*/', (
string) $tvakey)) {
1169 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1170 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1172 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2",
$mysoc->country_code) :
'');
1176 $totalvat .= $tvacompl;
1178 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1181 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1185 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1186 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1194 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1195 $pdf->SetTextColor(0, 0, 60);
1196 $pdf->SetFillColor(224, 224, 224);
1197 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalTTC",
$mysoc->country_code) :
''), $useborder,
'L',
true);
1199 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1200 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R',
true);
1204 $pdf->SetTextColor(0, 0, 0);
1206 $creditnoteamount = 0;
1207 $depositsamount = 0;
1211 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1216 if ($deja_regle > 0) {
1220 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1221 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L',
false);
1222 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1223 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R',
false);
1226 $pdf->SetTextColor(0, 0, 60);
1227 $pdf->SetFillColor(224, 224, 224);
1228 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1229 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L',
true);
1231 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1232 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R',
true);
1234 $pdf->SetFont(
'',
'', $default_font_size - 1);
1235 $pdf->SetTextColor(0, 0, 0);
1239 return ($tab2_top + ($tab2_hl * $index));
1257 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
1271 $pdf->SetTextColor(0, 0, 0);
1272 $pdf->SetFont(
'',
'', $default_font_size - 2);
1274 if (empty($hidetop)) {
1275 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1276 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1277 $titre .=
' - '.$outputlangsbis->transnoentities(
"AmountInCurrency", $outputlangsbis->transnoentitiesnoconv(
"Currency".$currency));
1280 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1281 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1285 $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius,
'1001',
'F', array(), explode(
',',
getDolGlobalString(
'MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1289 $pdf->SetDrawColor(128, 128, 128);
1290 $pdf->SetFont(
'',
'', $default_font_size - 1);
1293 $this->
printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom,
'D');
1295 if (empty($hidetop)) {
1296 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1298 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1299 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1303 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1304 if (empty($hidetop)) {
1305 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1306 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1310 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1311 if (empty($hidetop)) {
1312 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1313 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1316 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1317 if (empty($hidetop)) {
1318 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1319 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1323 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1324 if (empty($hidetop)) {
1325 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1326 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1330 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1331 if (empty($hidetop)) {
1332 if ($this->atleastonediscount) {
1333 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1334 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1338 if ($this->atleastonediscount) {
1339 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1341 if (empty($hidetop)) {
1342 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1343 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1360 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null, $titlekey =
"PdfOrderTitle")
1363 global
$conf, $langs, $hookmanager;
1365 $ltrdirection =
'L';
1366 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1367 $ltrdirection =
'R';
1371 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1377 $pdf->SetTextColor(0, 0, 60);
1378 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1382 $posy = $this->marge_haute;
1383 $posx = $this->page_largeur - $this->marge_droite - $w;
1385 $pdf->SetXY($this->marge_gauche, $posy);
1389 if ($this->emetteur->logo) {
1390 $logodir =
$conf->mycompany->dir_output;
1391 if (!empty(
$conf->mycompany->multidir_output[
$object->entity ??
$conf->entity])) {
1395 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1397 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1399 if (is_readable($logo)) {
1401 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1403 $pdf->SetTextColor(200, 0, 0);
1404 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1405 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1406 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1409 $text = $this->emetteur->name;
1410 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1414 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1415 $pdf->SetXY($posx, $posy);
1416 $pdf->SetTextColor(0, 0, 60);
1417 $title = $outputlangs->transnoentities($titlekey);
1418 $title .=
' '.$outputlangs->convToOutputCharset(
$object->ref);
1419 if (
$object->statut == $object::STATUS_DRAFT) {
1420 $pdf->SetTextColor(128, 0, 0);
1421 $title .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1423 $pdf->MultiCell($w, 3, $title,
'',
'R');
1425 $pdf->SetFont(
'',
'B', $default_font_size);
1435 $pdf->SetFont(
'',
'', $default_font_size - 1);
1439 $pdf->SetXY($posx, $posy);
1440 $pdf->SetTextColor(0, 0, 60);
1441 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset(
$object->ref_client),
'',
'R');
1446 if (!empty(
$object->project->ref)) {
1447 $posy = $pdf->GetY();
1448 $pdf->SetXY($posx, $posy);
1449 $pdf->SetTextColor(0, 0, 60);
1450 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1456 if (!empty(
$object->project->ref)) {
1457 $outputlangs->load(
"projects");
1458 $posy = $pdf->GetY();
1459 $pdf->SetXY($posx, $posy);
1460 $pdf->SetTextColor(0, 0, 60);
1461 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1465 $posy = $pdf->GetY();
1466 $pdf->SetXY($posx, $posy);
1467 $pdf->SetTextColor(0, 0, 60);
1468 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date(
$object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1471 $posy = $pdf->GetY();
1472 $pdf->SetXY($posx, $posy);
1473 $pdf->SetTextColor(0, 0, 60);
1474 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_client),
'',
'R');
1479 $pdf->SetXY($posx, $posy);
1480 $pdf->SetTextColor(0, 0, 60);
1481 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_compta_client),
'',
'R');
1486 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1487 if (count($arrayidcontact) > 0) {
1488 $usertmp =
new User($this->db);
1489 $usertmp->fetch($arrayidcontact[0]);
1491 $pdf->SetXY($posx, $posy);
1492 $pdf->SetTextColor(0, 0, 60);
1493 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1502 $current_y = $pdf->getY();
1504 if ($current_y < $pdf->getY()) {
1505 $top_shift = $pdf->getY() - $current_y;
1510 $carac_emetteur =
'';
1512 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1513 if (count($arrayidcontact) > 0) {
1514 $object->fetch_user($arrayidcontact[0]);
1515 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1516 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
" ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1518 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1522 $carac_emetteur .=
"\n";
1528 $posy = 42 + $top_shift;
1529 $posx = $this->marge_gauche;
1531 $posx = $this->page_largeur - $this->marge_droite - 80;
1537 $pdf->SetTextColor(0, 0, 0);
1538 $pdf->SetFont(
'',
'', $default_font_size - 2);
1539 $pdf->SetXY($posx, $posy - 5);
1540 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1541 $pdf->SetXY($posx, $posy);
1542 $pdf->SetFillColor(230, 230, 230);
1543 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius,
'1234',
'F');
1544 $pdf->SetTextColor(0, 0, 60);
1549 $pdf->SetXY($posx + 2, $posy + 3);
1550 $pdf->SetFont(
'',
'B', $default_font_size);
1551 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1552 $posy = $pdf->getY();
1556 $pdf->SetXY($posx + 2, $posy);
1557 $pdf->SetFont(
'',
'', $default_font_size - 1);
1558 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1562 $usecontact =
false;
1563 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1564 if (count($arrayidcontact) > 0) {
1566 $result =
$object->fetch_contact($arrayidcontact[0]);
1570 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset(
$conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1571 $thirdparty =
$object->contact;
1573 $thirdparty =
$object->thirdparty;
1583 if ($this->page_largeur < 210) {
1587 $posy += $top_shift;
1588 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1590 $posx = $this->marge_gauche;
1595 $pdf->SetTextColor(0, 0, 0);
1596 $pdf->SetFont(
'',
'', $default_font_size - 2);
1597 $pdf->SetXY($posx + 2, $posy - 5);
1598 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1599 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1603 $pdf->SetXY($posx + 2, $posy + 3);
1604 $pdf->SetFont(
'',
'B', $default_font_size);
1606 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1608 $posy = $pdf->getY();
1611 $pdf->SetFont(
'',
'', $default_font_size - 1);
1612 $pdf->SetXY($posx + 2, $posy);
1614 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1618 $idaddressshipping =
$object->getIdContact(
'external',
'SHIPPING');
1620 if (!empty($idaddressshipping)) {
1621 $contactshipping =
$object->fetch_Contact($idaddressshipping[0]);
1622 $companystatic =
new Societe($this->db);
1623 $companystatic->fetch(
$object->contact->fk_soc);
1630 if (!empty($carac_client_shipping)) {
1631 $posy += $hautcadre;
1636 $pdf->SetXY($posx + 2, $posy - 5);
1637 $pdf->SetFont(
'',
'', $default_font_size - 2);
1638 $pdf->MultiCell($widthrecbox, 0, $outputlangs->transnoentities(
'ShippingTo'), 0,
'L',
false);
1639 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1642 $pdf->SetXY($posx + 2, $posy + 1);
1643 $pdf->SetFont(
'',
'B', $default_font_size);
1644 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping,
'',
'L');
1646 $posy = $pdf->getY();
1649 $pdf->SetXY($posx + 2, $posy);
1650 $pdf->SetFont(
'',
'', $default_font_size - 1);
1651 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping,
'',
'L');
1653 $shipp_shift += $hautcadre + 10;
1658 $pdf->SetTextColor(0, 0, 0);
1660 $pagehead = array(
'top_shift' => $top_shift,
'shipp_shift' => $shipp_shift);