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 = 80 + $this->marge_haute + $top_shift + $shipp_shift;
335 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 32 + $this->marge_haute + $top_shift : $this->marge_haute);
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;
520 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
521 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
523 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
524 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
528 if ($localtax1_type && $localtax1ligne != 0) {
529 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
530 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
532 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
535 if ($localtax2_type && $localtax2ligne != 0) {
536 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
537 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
539 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
543 if ((
$object->lines[$i]->info_bits & 0x01) == 0x01) {
548 if (!isset($this->tva[$vatrate])) {
549 $this->tva[$vatrate] = 0;
551 $this->tva[$vatrate] += $tvaligne;
552 $vatcode =
$object->lines[$i]->vat_src_code;
553 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
554 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
556 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
560 $pdf->setPage($pageposafter);
561 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
563 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
564 $pdf->SetLineStyle(array(
'dash' => 0));
570 while ($pagenb < $pageposafter) {
571 $pdf->setPage($pagenb);
573 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object->multicurrency_code);
575 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
579 $pdf->setPage($pagenb);
580 $pdf->setPageOrientation(
'',
true, 0);
584 if (!empty($tplidx)) {
585 $pdf->useTemplate($tplidx);
588 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
590 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object->multicurrency_code);
592 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
597 if (!empty($tplidx)) {
598 $pdf->useTemplate($tplidx);
609 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0,
$object->multicurrency_code);
611 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code);
613 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
631 if (method_exists($pdf,
'AliasNbPages')) {
632 $pdf->AliasNbPages();
637 if (
getDolGlobalInt(
'MAIN_PDF_ADD_TERMSOFSALE_ORDER') && $termsofsalefilename) {
638 $termsofsale =
$conf->order->dir_output.
'/'.$termsofsalefilename;
639 if (!empty(
$conf->order->multidir_output[
$conf->entity])) {
640 $termsofsale =
$conf->order->multidir_output[
$conf->entity].
'/'.$termsofsalefilename;
642 if (file_exists($termsofsale) && is_readable($termsofsale)) {
643 $pagecount = $pdf->setSourceFile($termsofsale);
644 for ($i = 1; $i <= $pagecount; $i++) {
645 $tplIdx = $pdf->importPage($i);
646 if ($tplIdx !==
false) {
647 $s = $pdf->getTemplatesize($tplIdx);
648 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
649 $pdf->useTemplate($tplIdx);
651 setEventMessages(
null, array($termsofsale.
' cannot be added, probably protected PDF'),
'warnings');
659 $pdf->Output($file,
'F');
662 $hookmanager->initHooks(array(
'pdfgeneration'));
663 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
665 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
666 $this->warnings = $hookmanager->warnings;
668 $this->error = $hookmanager->error;
669 $this->errors = $hookmanager->errors;
676 $this->result = array(
'fullpath' => $file);
680 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
684 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"COMMANDE_OUTPUTDIR");
723 $pdf->SetFont(
'',
'', $default_font_size - 1);
728 if ($this->emetteur->country_code ==
'FR' && empty(
$mysoc->tva_assuj)) {
729 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
730 $pdf->SetXY($this->marge_gauche, $posy);
731 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L',
false);
733 $posy = $pdf->GetY() + 4;
742 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
743 $pdf->SetXY($this->marge_gauche, $posy);
744 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
745 $pdf->MultiCell(43, 4, $titre, 0,
'L');
747 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
748 $pdf->SetXY($posxval, $posy);
749 $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);
750 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
751 if (
$object->deposit_percent > 0) {
752 $lib_condition_paiement = str_replace(
'__DEPOSIT_PERCENT__', (
string)
$object->deposit_percent, $lib_condition_paiement);
754 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
756 $posy = $pdf->GetY() + 3;
787 if (!empty(
$object->delivery_date)) {
788 $outputlangs->load(
"sendings");
789 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
790 $pdf->SetXY($this->marge_gauche, $posy);
791 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
792 $pdf->MultiCell(80, 4, $titre, 0,
'L');
793 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
794 $pdf->SetXY($posxval, $posy);
796 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
798 $posy = $pdf->GetY() + 1;
801 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
802 $pdf->SetXY($this->marge_gauche, $posy);
803 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
804 $pdf->MultiCell(80, 4, $titre, 0,
'L');
805 $pdf->SetTextColor(0, 0, 0);
806 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
807 $pdf->SetXY($posxval, $posy);
808 $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 :
'');
809 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
810 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
812 $posy = $pdf->GetY() + 1;
816 if (
$object->mode_reglement_code
817 &&
$object->mode_reglement_code !=
'CHQ'
818 &&
$object->mode_reglement_code !=
'VIR') {
819 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
820 $pdf->SetXY($this->marge_gauche, $posy);
821 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
822 $pdf->MultiCell(80, 5, $titre, 0,
'L');
824 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
825 $pdf->SetXY($posxval, $posy);
826 $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);
827 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
829 $posy = $pdf->GetY() + 2;
833 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'CHQ') {
837 $account =
new Account($this->db);
840 $pdf->SetXY($this->marge_gauche, $posy);
841 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
842 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->owner_name), 0,
'L',
false);
843 $posy = $pdf->GetY() + 1;
846 $pdf->SetXY($this->marge_gauche, $posy);
847 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
848 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L',
false);
849 $posy = $pdf->GetY() + 2;
853 $pdf->SetXY($this->marge_gauche, $posy);
854 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
855 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L',
false);
856 $posy = $pdf->GetY() + 1;
859 $pdf->SetXY($this->marge_gauche, $posy);
860 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
861 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L',
false);
862 $posy = $pdf->GetY() + 2;
869 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'VIR') {
871 $bankid = (
$object->fk_account <= 0 ?
$conf->global->FACTURE_RIB_NUMBER :
$object->fk_account);
875 $account =
new Account($this->db);
876 $account->fetch($bankid);
878 $curx = $this->marge_gauche;
881 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
913 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal",
"sendings"));
914 $default_font_size--;
919 $pdf->SetFont(
'',
'', $default_font_size - 1);
924 if ($this->page_largeur < 210) {
927 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
936 $total_discount_on_lines = 0;
937 $multicurrency_total_discount_on_lines = 0;
938 foreach (
$object->lines as $i => $line) {
942 $total_discount_on_lines += (is_numeric($resdiscount) ? $resdiscount : 0);
943 $multicurrency_total_discount_on_lines += (is_numeric($multicurrency_resdiscount) ? $multicurrency_resdiscount : 0);
945 if ($line->total_ht < 0) {
946 $total_discount_on_lines += -$line->total_ht;
947 $multicurrency_total_discount_on_lines += -$line->multicurrency_total_ht;
951 if ($total_discount_on_lines > 0) {
952 if ($this->showAmountBeforeDiscount) {
954 $pdf->SetFillColor(255, 255, 255);
955 $pdf->SetXY($col1x, $tab2_top);
956 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHTBeforeDiscount") . (is_object($outputlangsbis) ?
' / ' . $outputlangsbis->transnoentities(
"TotalHTBeforeDiscount") :
''), 0,
'L',
true);
957 $pdf->SetXY($col2x, $tab2_top);
959 $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));
960 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_before_discount_to_show, 0, $outputlangs), 0,
'R',
true);
965 if ($this->showDiscountAmount) {
966 $pdf->SetFillColor(255, 255, 255);
967 $pdf->SetXY($col1x, $tab2_top + $tab2_hl);
968 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalDiscount") . (is_object($outputlangsbis) ?
' / ' . $outputlangsbis->transnoentities(
"TotalDiscount") :
''), 0,
'L',
true);
969 $pdf->SetXY($col2x, $tab2_top + $tab2_hl);
971 $total_discount_to_show = ((
isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) ? $multicurrency_total_discount_on_lines : $total_discount_on_lines);
972 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_discount_to_show, 0, $outputlangs), 0,
'R',
true);
979 $pdf->SetFillColor(255, 255, 255);
980 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
981 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHT") :
''), 0,
'L',
true);
984 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
985 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty(
$object->remise) ?
$object->remise : 0), 0, $outputlangs), 0,
'R',
true);
988 $pdf->SetFillColor(248, 248, 248);
992 $this->atleastoneratenotnull = 0;
994 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000']));
999 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1000 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1003 foreach ($localtax_rate as $tvakey => $tvaval) {
1008 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1011 if (preg_match(
'/\*/', (
string) $tvakey)) {
1012 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1013 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1015 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1",
$mysoc->country_code) :
'');
1019 $totalvat .= $tvacompl;
1021 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1024 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1028 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1029 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1035 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1036 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1039 foreach ($localtax_rate as $tvakey => $tvaval) {
1044 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1047 if (preg_match(
'/\*/', (
string) $tvakey)) {
1048 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1049 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1051 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2",
$mysoc->country_code) :
'');
1055 $totalvat .= $tvacompl;
1057 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1060 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1064 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1065 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1071 foreach ($this->tva_array as $tvakey => $tvaval) {
1073 $this->atleastoneratenotnull++;
1076 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1079 if (preg_match(
'/\*/', $tvakey)) {
1080 $tvakey = str_replace(
'*',
'', $tvakey);
1081 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1083 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalVAT",
$mysoc->country_code) :
'');
1086 $totalvat .=
vatrate((
string) $tvaval[
'vatrate'],
true).$tvacompl;
1088 $totalvat .= $tvaval[
'vatcode'].$tvacompl;
1090 $totalvat .= $tvacompl;
1092 $totalvat .=
vatrate((
string) $tvaval[
'vatrate'],
true).($tvaval[
'vatcode'] ?
' ('.$tvaval[
'vatcode'].
')' :
'').$tvacompl;
1094 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1096 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1097 $pdf->MultiCell($largcol2, $tab2_hl,
price(
price2num($tvaval[
'amount'],
'MT'), 0, $outputlangs), 0,
'R',
true);
1104 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1105 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1109 foreach ($localtax_rate as $tvakey => $tvaval) {
1114 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1117 if (preg_match(
'/\*/', (
string) $tvakey)) {
1118 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1119 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1121 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1",
$mysoc->country_code) :
'');
1125 $totalvat .= $tvacompl;
1127 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1130 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1134 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1135 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1143 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1144 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1148 foreach ($localtax_rate as $tvakey => $tvaval) {
1154 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1157 if (preg_match(
'/\*/', (
string) $tvakey)) {
1158 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1159 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1161 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2",
$mysoc->country_code) :
'');
1165 $totalvat .= $tvacompl;
1167 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1170 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1174 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1175 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1183 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1184 $pdf->SetTextColor(0, 0, 60);
1185 $pdf->SetFillColor(224, 224, 224);
1186 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalTTC",
$mysoc->country_code) :
''), $useborder,
'L',
true);
1188 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1189 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R',
true);
1193 $pdf->SetTextColor(0, 0, 0);
1195 $creditnoteamount = 0;
1196 $depositsamount = 0;
1200 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1205 if ($deja_regle > 0) {
1209 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1210 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L',
false);
1211 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1212 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R',
false);
1215 $pdf->SetTextColor(0, 0, 60);
1216 $pdf->SetFillColor(224, 224, 224);
1217 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1218 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L',
true);
1220 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1221 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R',
true);
1223 $pdf->SetFont(
'',
'', $default_font_size - 1);
1224 $pdf->SetTextColor(0, 0, 0);
1228 return ($tab2_top + ($tab2_hl * $index));
1246 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
1260 $pdf->SetTextColor(0, 0, 0);
1261 $pdf->SetFont(
'',
'', $default_font_size - 2);
1263 if (empty($hidetop)) {
1264 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1265 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1266 $titre .=
' - '.$outputlangsbis->transnoentities(
"AmountInCurrency", $outputlangsbis->transnoentitiesnoconv(
"Currency".$currency));
1269 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1270 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1274 $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')));
1278 $pdf->SetDrawColor(128, 128, 128);
1279 $pdf->SetFont(
'',
'', $default_font_size - 1);
1282 $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');
1284 if (empty($hidetop)) {
1285 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1287 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1288 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1292 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1293 if (empty($hidetop)) {
1294 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1295 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1299 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1300 if (empty($hidetop)) {
1301 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1302 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1305 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1306 if (empty($hidetop)) {
1307 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1308 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1312 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1313 if (empty($hidetop)) {
1314 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1315 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1319 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1320 if (empty($hidetop)) {
1321 if ($this->atleastonediscount) {
1322 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1323 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1327 if ($this->atleastonediscount) {
1328 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1330 if (empty($hidetop)) {
1331 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1332 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1349 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null, $titlekey =
"PdfOrderTitle")
1352 global
$conf, $langs, $hookmanager;
1354 $ltrdirection =
'L';
1355 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1356 $ltrdirection =
'R';
1360 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1366 $pdf->SetTextColor(0, 0, 60);
1367 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1371 $posy = $this->marge_haute;
1372 $posx = $this->page_largeur - $this->marge_droite - $w;
1374 $pdf->SetXY($this->marge_gauche, $posy);
1377 $logodir =
$conf->mycompany->dir_output;
1378 if (!empty(
$conf->mycompany->multidir_output[
$object->entity ??
$conf->entity])) {
1381 pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
1383 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1384 $pdf->SetXY($posx, $posy);
1385 $pdf->SetTextColor(0, 0, 60);
1386 $title = $outputlangs->transnoentities($titlekey);
1387 $title .=
' '.$outputlangs->convToOutputCharset(
$object->ref);
1388 if (
$object->statut == $object::STATUS_DRAFT) {
1389 $pdf->SetTextColor(128, 0, 0);
1390 $title .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1392 $pdf->MultiCell($w, 3, $title,
'',
'R');
1394 $pdf->SetFont(
'',
'B', $default_font_size);
1404 $pdf->SetFont(
'',
'', $default_font_size - 1);
1408 $pdf->SetXY($posx, $posy);
1409 $pdf->SetTextColor(0, 0, 60);
1410 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset(
$object->ref_client),
'',
'R');
1415 if (!empty(
$object->project->ref)) {
1416 $posy = $pdf->GetY();
1417 $pdf->SetXY($posx, $posy);
1418 $pdf->SetTextColor(0, 0, 60);
1419 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1425 if (!empty(
$object->project->ref)) {
1426 $outputlangs->load(
"projects");
1427 $posy = $pdf->GetY();
1428 $pdf->SetXY($posx, $posy);
1429 $pdf->SetTextColor(0, 0, 60);
1430 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1434 $posy = $pdf->GetY();
1435 $pdf->SetXY($posx, $posy);
1436 $pdf->SetTextColor(0, 0, 60);
1437 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date(
$object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1440 $posy = $pdf->GetY();
1441 $pdf->SetXY($posx, $posy);
1442 $pdf->SetTextColor(0, 0, 60);
1443 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_client),
'',
'R');
1448 $pdf->SetXY($posx, $posy);
1449 $pdf->SetTextColor(0, 0, 60);
1450 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_compta_client),
'',
'R');
1455 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1456 if (count($arrayidcontact) > 0) {
1457 $usertmp =
new User($this->db);
1458 $usertmp->fetch($arrayidcontact[0]);
1460 $pdf->SetXY($posx, $posy);
1461 $pdf->SetTextColor(0, 0, 60);
1462 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1471 $current_y = $pdf->getY();
1473 if ($current_y < $pdf->getY()) {
1474 $top_shift = $pdf->getY() - $current_y;
1479 $carac_emetteur =
'';
1481 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1482 if (count($arrayidcontact) > 0) {
1483 $object->fetch_user($arrayidcontact[0]);
1484 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1485 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
" ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1487 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1491 $carac_emetteur .=
"\n";
1497 $posy = 32 + $top_shift + $this->marge_haute;
1498 $posx = $this->marge_gauche;
1500 $posx = $this->page_largeur - $this->marge_droite - 80;
1506 $pdf->SetTextColor(0, 0, 0);
1507 $pdf->SetFont(
'',
'', $default_font_size - 2);
1508 $pdf->SetXY($posx, $posy - 5);
1509 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1510 $pdf->SetXY($posx, $posy);
1511 $pdf->SetFillColor(230, 230, 230);
1512 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius,
'1234',
'F');
1513 $pdf->SetTextColor(0, 0, 60);
1518 $pdf->SetXY($posx + 2, $posy + 3);
1519 $pdf->SetFont(
'',
'B', $default_font_size);
1520 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1521 $posy = $pdf->getY();
1525 $pdf->SetXY($posx + 2, $posy);
1526 $pdf->SetFont(
'',
'', $default_font_size - 1);
1527 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1531 $usecontact =
false;
1532 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1533 if (count($arrayidcontact) > 0) {
1535 $result =
$object->fetch_contact($arrayidcontact[0]);
1539 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset(
$conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1540 $thirdparty =
$object->contact;
1542 $thirdparty =
$object->thirdparty;
1552 if ($this->page_largeur < 210) {
1556 $posy += $top_shift + $this->marge_haute;
1557 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1559 $posx = $this->marge_gauche;
1564 $pdf->SetTextColor(0, 0, 0);
1565 $pdf->SetFont(
'',
'', $default_font_size - 2);
1566 $pdf->SetXY($posx + 2, $posy - 5);
1567 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1568 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1572 $pdf->SetXY($posx + 2, $posy + 3);
1573 $pdf->SetFont(
'',
'B', $default_font_size);
1575 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1577 $posy = $pdf->getY();
1580 $pdf->SetFont(
'',
'', $default_font_size - 1);
1581 $pdf->SetXY($posx + 2, $posy);
1583 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1587 $idaddressshipping =
$object->getIdContact(
'external',
'SHIPPING');
1589 if (!empty($idaddressshipping)) {
1590 $contactshipping =
$object->fetch_Contact($idaddressshipping[0]);
1591 $companystatic =
new Societe($this->db);
1592 $companystatic->fetch(
$object->contact->fk_soc);
1599 if (!empty($carac_client_shipping)) {
1600 $posy += $hautcadre;
1605 $pdf->SetXY($posx + 2, $posy - 5);
1606 $pdf->SetFont(
'',
'', $default_font_size - 2);
1607 $pdf->MultiCell($widthrecbox, 0, $outputlangs->transnoentities(
'ShippingTo'), 0,
'L',
false);
1608 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1611 $pdf->SetXY($posx + 2, $posy + 1);
1612 $pdf->SetFont(
'',
'B', $default_font_size);
1613 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping,
'',
'L');
1615 $posy = $pdf->getY();
1618 $pdf->SetXY($posx + 2, $posy);
1619 $pdf->SetFont(
'',
'', $default_font_size - 1);
1620 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping,
'',
'L');
1622 $shipp_shift += $hautcadre + 10;
1627 $pdf->SetTextColor(0, 0, 0);
1629 $pagehead = array(
'top_shift' => $top_shift,
'shipp_shift' => $shipp_shift);