184 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
187 global $user, $langs, $conf,
$mysoc, $db, $hookmanager, $nblines;
189 if (!is_object($outputlangs)) {
190 $outputlangs = $langs;
194 $outputlangs->charset_output =
'ISO-8859-1';
198 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"compta"));
205 global $outputlangsbis;
206 $outputlangsbis =
null;
208 $outputlangsbis =
new Translate(
'', $conf);
210 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"sendings",
"compta"));
213 $nblines = count(
$object->lines);
215 if ($conf->commande->multidir_output[$conf->entity]) {
222 $dir = $conf->commande->multidir_output[$conf->entity];
223 $file = $dir.
"/SPECIMEN.pdf";
233 $dir = $conf->commande->multidir_output[
$object->entity ?? $conf->entity].
"/".$objectref;
234 $file = $dir.
"/".$objectref.$suffix.
".pdf";
237 if (!file_exists($dir)) {
239 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
244 if (file_exists($dir)) {
246 if (!is_object($hookmanager)) {
247 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
250 $hookmanager->initHooks(array(
'pdfgeneration'));
251 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
253 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
256 $nblines = count(
$object->lines);
261 $pdf->setAutoPageBreak(
true, 0);
263 $heightforinfotot = 40;
265 $heightforfooter = $this->marge_basse + 8;
267 $heightforfooter += 6;
270 if (class_exists(
'TCPDF')) {
271 $pdf->setPrintHeader(
false);
272 $pdf->setPrintFooter(
false);
277 $logodir = $conf->mycompany->dir_output;
278 if (!empty($conf->mycompany->multidir_output[
$object->entity ?? $conf->entity])) {
279 $logodir = $conf->mycompany->multidir_output[
$object->entity ?? $conf->entity];
281 $pagecount = $pdf->setSourceFile($logodir.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
282 $tplidx = $pdf->importPage(1);
287 $pdf->SetDrawColor(128, 128, 128);
289 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
290 $pdf->SetSubject($outputlangs->transnoentities(
"PdfOrderTitle"));
291 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
292 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
293 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfOrderTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
295 $pdf->SetCompression(
false);
299 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
302 for ($i = 0; $i < $nblines; $i++) {
303 if (
$object->lines[$i]->remise_percent) {
304 $this->atleastonediscount++;
307 if (empty($this->atleastonediscount)) {
308 $delta = ($this->postotalht - $this->posxdiscount);
309 $this->posxpicture += $delta;
310 $this->posxtva += $delta;
311 $this->posxup += $delta;
312 $this->posxqty += $delta;
313 $this->posxunit += $delta;
314 $this->posxdiscount += $delta;
320 if (!empty($tplidx)) {
321 $pdf->useTemplate($tplidx);
324 $pagehead = $this->
_pagehead($pdf,
$object, 1, $outputlangs, (is_object($outputlangsbis) ? $outputlangsbis :
null));
325 $top_shift = $pagehead[
'top_shift'];
326 $shipp_shift = $pagehead[
'shipp_shift'];
327 $pdf->SetFont(
'',
'', $default_font_size - 1);
328 $pdf->MultiCell(0, 3,
'');
329 $pdf->SetTextColor(0, 0, 0);
331 $tab_top = 90 + $top_shift + $shipp_shift;
332 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
335 $height_incoterms = 0;
337 $desc_incoterms =
$object->getIncotermsForPDF();
338 if ($desc_incoterms) {
341 $pdf->SetFont(
'',
'', $default_font_size - 1);
342 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
343 $nexY = $pdf->GetY();
344 $height_incoterms = $nexY - $tab_top;
347 $pdf->SetDrawColor(192, 192, 192);
348 $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');
350 $tab_top = $nexY + 6;
355 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
358 if (is_object(
$object->thirdparty)) {
359 $salereparray =
$object->thirdparty->getSalesRepresentatives($user);
360 $salerepobj =
new User($this->db);
361 $salerepobj->fetch($salereparray[0][
'id']);
362 if (!empty($salerepobj->signature)) {
363 $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
368 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
369 if (!empty($extranote)) {
381 $pdf->SetFont(
'',
'', $default_font_size - 1);
382 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($notetoshow), 0, 1);
383 $nexY = $pdf->GetY();
384 $height_note = $nexY - $tab_top;
387 $pdf->SetDrawColor(192, 192, 192);
388 $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');
390 $tab_top = $nexY + 6;
393 $iniY = $tab_top + 7;
394 $curY = $tab_top + 7;
395 $nexY = $tab_top + 7;
398 for ($i = 0; $i < $nblines; $i++) {
400 $pdf->SetFont(
'',
'', $default_font_size - 1);
401 $pdf->SetTextColor(0, 0, 0);
403 $pdf->setTopMargin($tab_top_newpage);
404 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
405 $pageposbefore = $pdf->getPage();
408 $curX = $this->posxdesc - 1;
410 $showpricebeforepagebreak = 1;
412 $pdf->startTransaction();
414 $pageposafter = $pdf->getPage();
415 if ($pageposafter > $pageposbefore) {
416 $pdf->rollbackTransaction(
true);
417 $pageposafter = $pageposbefore;
419 $pdf->setPageOrientation(
'',
true, $heightforfooter);
421 $pageposafter = $pdf->getPage();
422 $posyafter = $pdf->GetY();
423 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
424 if ($i == ($nblines - 1)) {
425 $pdf->AddPage(
'',
'',
true);
426 if (!empty($tplidx)) {
427 $pdf->useTemplate($tplidx);
432 $pdf->setPage($pageposafter + 1);
438 $showpricebeforepagebreak = 1;
440 $showpricebeforepagebreak = 0;
444 $pdf->commitTransaction();
446 $posYAfterDescription = $pdf->GetY();
448 $nexY = $pdf->GetY();
449 $pageposafter = $pdf->getPage();
451 $pdf->setPage($pageposbefore);
452 $pdf->setTopMargin($this->marge_haute);
453 $pdf->setPageOrientation(
'',
true, 0);
456 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
457 $pdf->setPage($pageposafter);
458 $curY = $tab_top_newpage;
461 $pdf->SetFont(
'',
'', $default_font_size - 1);
466 $pdf->SetXY($this->posxtva - 5, $curY);
467 $pdf->MultiCell($this->posxup - $this->posxtva + 4, 3, $vat_rate, 0,
'R');
472 $pdf->SetXY($this->posxup, $curY);
473 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0,
'R',
false);
477 $pdf->SetXY($this->posxqty, $curY);
478 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
483 $pdf->SetXY($this->posxunit, $curY);
484 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
488 $pdf->SetXY($this->posxdiscount, $curY);
489 if (
$object->lines[$i]->remise_percent) {
490 $pdf->SetXY($this->posxdiscount - 2, $curY);
492 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0,
'R');
497 $pdf->SetXY($this->postotalht, $curY);
498 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0,
'R',
false);
502 $tvaligne =
$object->lines[$i]->multicurrency_total_tva;
504 $tvaligne =
$object->lines[$i]->total_tva;
507 $localtax1ligne =
$object->lines[$i]->total_localtax1;
508 $localtax2ligne =
$object->lines[$i]->total_localtax2;
509 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
510 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
511 $localtax1_type =
$object->lines[$i]->localtax1_type;
512 $localtax2_type =
$object->lines[$i]->localtax2_type;
525 $vatrate = (string)
$object->lines[$i]->tva_tx;
528 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
529 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
531 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
532 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
536 if ($localtax1_type && $localtax1ligne != 0) {
537 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
538 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
540 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
543 if ($localtax2_type && $localtax2ligne != 0) {
544 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
545 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
547 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
551 if ((
$object->lines[$i]->info_bits & 0x01) == 0x01) {
556 if (!isset($this->tva[$vatrate])) {
557 $this->tva[$vatrate] = 0;
559 $this->tva[$vatrate] += $tvaligne;
560 $vatcode =
$object->lines[$i]->vat_src_code;
561 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
562 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
564 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
568 $pdf->setPage($pageposafter);
569 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
571 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
572 $pdf->SetLineStyle(array(
'dash' => 0));
578 while ($pagenb < $pageposafter) {
579 $pdf->setPage($pagenb);
581 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object->multicurrency_code);
583 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
587 $pdf->setPage($pagenb);
588 $pdf->setPageOrientation(
'',
true, 0);
592 if (!empty($tplidx)) {
593 $pdf->useTemplate($tplidx);
596 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
598 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object->multicurrency_code);
600 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
605 if (!empty($tplidx)) {
606 $pdf->useTemplate($tplidx);
617 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0,
$object->multicurrency_code);
619 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code);
621 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
639 if (method_exists($pdf,
'AliasNbPages')) {
640 $pdf->AliasNbPages();
645 if (
getDolGlobalInt(
'MAIN_PDF_ADD_TERMSOFSALE_ORDER') && $termsofsalefilename) {
646 $termsofsale = $conf->order->dir_output.
'/'.$termsofsalefilename;
647 if (!empty($conf->order->multidir_output[$conf->entity])) {
648 $termsofsale = $conf->order->multidir_output[$conf->entity].
'/'.$termsofsalefilename;
650 if (file_exists($termsofsale) && is_readable($termsofsale)) {
651 $pagecount = $pdf->setSourceFile($termsofsale);
652 for ($i = 1; $i <= $pagecount; $i++) {
653 $tplIdx = $pdf->importPage($i);
654 if ($tplIdx !==
false) {
655 $s = $pdf->getTemplatesize($tplIdx);
656 $pdf->AddPage($s[
'h'] > $s[
'w'] ?
'P' :
'L');
657 $pdf->useTemplate($tplIdx);
659 setEventMessages(
null, array($termsofsale.
' cannot be added, probably protected PDF'),
'warnings');
667 $pdf->Output($file,
'F');
670 $hookmanager->initHooks(array(
'pdfgeneration'));
671 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
673 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
674 $this->warnings = $hookmanager->warnings;
676 $this->error = $hookmanager->error;
677 $this->errors = $hookmanager->errors;
684 $this->result = array(
'fullpath' => $file);
688 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
692 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"COMMANDE_OUTPUTDIR");
731 $pdf->SetFont(
'',
'', $default_font_size - 1);
736 if ($this->emetteur->country_code ==
'FR' && empty(
$mysoc->tva_assuj)) {
737 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
738 $pdf->SetXY($this->marge_gauche, $posy);
739 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L',
false);
741 $posy = $pdf->GetY() + 4;
750 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
751 $pdf->SetXY($this->marge_gauche, $posy);
752 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
753 $pdf->MultiCell(43, 4, $titre, 0,
'L');
755 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
756 $pdf->SetXY($posxval, $posy);
757 $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);
758 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
759 if (
$object->deposit_percent > 0) {
760 $lib_condition_paiement = str_replace(
'__DEPOSIT_PERCENT__', (
string)
$object->deposit_percent, $lib_condition_paiement);
762 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
764 $posy = $pdf->GetY() + 3;
795 if (!empty(
$object->delivery_date)) {
796 $outputlangs->load(
"sendings");
797 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
798 $pdf->SetXY($this->marge_gauche, $posy);
799 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
800 $pdf->MultiCell(80, 4, $titre, 0,
'L');
801 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
802 $pdf->SetXY($posxval, $posy);
804 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
806 $posy = $pdf->GetY() + 1;
809 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
810 $pdf->SetXY($this->marge_gauche, $posy);
811 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
812 $pdf->MultiCell(80, 4, $titre, 0,
'L');
813 $pdf->SetTextColor(0, 0, 0);
814 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
815 $pdf->SetXY($posxval, $posy);
816 $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 :
'');
817 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
818 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
820 $posy = $pdf->GetY() + 1;
824 if (
$object->mode_reglement_code
825 &&
$object->mode_reglement_code !=
'CHQ'
826 &&
$object->mode_reglement_code !=
'VIR') {
827 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
828 $pdf->SetXY($this->marge_gauche, $posy);
829 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
830 $pdf->MultiCell(80, 5, $titre, 0,
'L');
832 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
833 $pdf->SetXY($posxval, $posy);
834 $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);
835 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
837 $posy = $pdf->GetY() + 2;
841 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'CHQ') {
845 $account =
new Account($this->db);
848 $pdf->SetXY($this->marge_gauche, $posy);
849 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
850 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->owner_name), 0,
'L',
false);
851 $posy = $pdf->GetY() + 1;
854 $pdf->SetXY($this->marge_gauche, $posy);
855 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
856 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L',
false);
857 $posy = $pdf->GetY() + 2;
861 $pdf->SetXY($this->marge_gauche, $posy);
862 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
863 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L',
false);
864 $posy = $pdf->GetY() + 1;
867 $pdf->SetXY($this->marge_gauche, $posy);
868 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
869 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L',
false);
870 $posy = $pdf->GetY() + 2;
877 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'VIR') {
879 $bankid = (
$object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER :
$object->fk_account);
883 $account =
new Account($this->db);
884 $account->fetch($bankid);
886 $curx = $this->marge_gauche;
889 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
914 global $conf,
$mysoc, $hookmanager;
919 $outputlangsbis =
new Translate(
'', $conf);
921 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal",
"sendings"));
922 $default_font_size--;
927 $pdf->SetFont(
'',
'', $default_font_size - 1);
932 if ($this->page_largeur < 210) {
935 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
944 $total_discount_on_lines = 0;
945 $multicurrency_total_discount_on_lines = 0;
946 foreach (
$object->lines as $i => $line) {
950 $total_discount_on_lines += (is_numeric($resdiscount) ? $resdiscount : 0);
951 $multicurrency_total_discount_on_lines += (is_numeric($multicurrency_resdiscount) ? $multicurrency_resdiscount : 0);
953 if ($line->total_ht < 0) {
954 $total_discount_on_lines += -$line->total_ht;
955 $multicurrency_total_discount_on_lines += -$line->multicurrency_total_ht;
959 if ($total_discount_on_lines > 0) {
961 $pdf->SetFillColor(255, 255, 255);
962 $pdf->SetXY($col1x, $tab2_top);
963 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHTBeforeDiscount").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHTBeforeDiscount") :
''), 0,
'L',
true);
964 $pdf->SetXY($col2x, $tab2_top);
966 $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));
967 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_before_discount_to_show, 0, $outputlangs), 0,
'R',
true);
971 $pdf->SetFillColor(255, 255, 255);
972 $pdf->SetXY($col1x, $tab2_top + $tab2_hl);
973 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalDiscount").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalDiscount") :
''), 0,
'L',
true);
974 $pdf->SetXY($col2x, $tab2_top + $tab2_hl);
976 $total_discount_to_show = ((
isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) ? $multicurrency_total_discount_on_lines : $total_discount_on_lines);
977 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_discount_to_show, 0, $outputlangs), 0,
'R',
true);
983 $pdf->SetFillColor(255, 255, 255);
984 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
985 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHT") :
''), 0,
'L',
true);
988 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
989 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty(
$object->remise) ?
$object->remise : 0), 0, $outputlangs), 0,
'R',
true);
992 $pdf->SetFillColor(248, 248, 248);
996 $this->atleastoneratenotnull = 0;
998 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000']));
1003 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1004 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1007 foreach ($localtax_rate as $tvakey => $tvaval) {
1012 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1015 if (preg_match(
'/\*/', (
string) $tvakey)) {
1016 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1017 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1019 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1",
$mysoc->country_code) :
'');
1023 $totalvat .= $tvacompl;
1025 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1028 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1032 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1033 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1039 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1040 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1043 foreach ($localtax_rate as $tvakey => $tvaval) {
1048 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1051 if (preg_match(
'/\*/', (
string) $tvakey)) {
1052 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1053 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1055 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2",
$mysoc->country_code) :
'');
1059 $totalvat .= $tvacompl;
1061 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1064 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1068 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1069 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1075 foreach ($this->tva_array as $tvakey => $tvaval) {
1077 $this->atleastoneratenotnull++;
1080 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1083 if (preg_match(
'/\*/', $tvakey)) {
1084 $tvakey = str_replace(
'*',
'', $tvakey);
1085 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1087 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalVAT",
$mysoc->country_code) :
'');
1090 $totalvat .=
vatrate((
string) $tvaval[
'vatrate'],
true).$tvacompl;
1092 $totalvat .= $tvaval[
'vatcode'].$tvacompl;
1094 $totalvat .= $tvacompl;
1096 $totalvat .=
vatrate((
string) $tvaval[
'vatrate'],
true).($tvaval[
'vatcode'] ?
' ('.$tvaval[
'vatcode'].
')' :
'').$tvacompl;
1098 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1100 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1101 $pdf->MultiCell($largcol2, $tab2_hl,
price(
price2num($tvaval[
'amount'],
'MT'), 0, $outputlangs), 0,
'R',
true);
1108 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1109 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1113 foreach ($localtax_rate as $tvakey => $tvaval) {
1118 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1121 if (preg_match(
'/\*/', (
string) $tvakey)) {
1122 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1123 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1125 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1",
$mysoc->country_code) :
'');
1129 $totalvat .= $tvacompl;
1131 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1134 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1138 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1139 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1147 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1148 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1152 foreach ($localtax_rate as $tvakey => $tvaval) {
1158 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1161 if (preg_match(
'/\*/', (
string) $tvakey)) {
1162 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1163 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1165 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2",
$mysoc->country_code) :
'');
1169 $totalvat .= $tvacompl;
1171 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
1174 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
1178 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1179 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R',
true);
1187 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1188 $pdf->SetTextColor(0, 0, 60);
1189 $pdf->SetFillColor(224, 224, 224);
1190 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalTTC",
$mysoc->country_code) :
''), $useborder,
'L',
true);
1192 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1193 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R',
true);
1197 $pdf->SetTextColor(0, 0, 0);
1199 $creditnoteamount = 0;
1200 $depositsamount = 0;
1204 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1209 if ($deja_regle > 0) {
1213 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1214 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L',
false);
1215 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1216 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R',
false);
1219 $pdf->SetTextColor(0, 0, 60);
1220 $pdf->SetFillColor(224, 224, 224);
1221 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1222 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L',
true);
1224 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1225 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R',
true);
1227 $pdf->SetFont(
'',
'', $default_font_size - 1);
1228 $pdf->SetTextColor(0, 0, 0);
1232 return ($tab2_top + ($tab2_hl * $index));
1250 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
1264 $pdf->SetTextColor(0, 0, 0);
1265 $pdf->SetFont(
'',
'', $default_font_size - 2);
1267 if (empty($hidetop)) {
1268 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1269 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1270 $titre .=
' - '.$outputlangsbis->transnoentities(
"AmountInCurrency", $outputlangsbis->transnoentitiesnoconv(
"Currency".$currency));
1273 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1274 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1278 $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')));
1282 $pdf->SetDrawColor(128, 128, 128);
1283 $pdf->SetFont(
'',
'', $default_font_size - 1);
1286 $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');
1288 if (empty($hidetop)) {
1289 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1291 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1292 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1296 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1297 if (empty($hidetop)) {
1298 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1299 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1303 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1304 if (empty($hidetop)) {
1305 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1306 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1309 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1310 if (empty($hidetop)) {
1311 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1312 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1316 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1317 if (empty($hidetop)) {
1318 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1319 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1323 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1324 if (empty($hidetop)) {
1325 if ($this->atleastonediscount) {
1326 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1327 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1331 if ($this->atleastonediscount) {
1332 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1334 if (empty($hidetop)) {
1335 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1336 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1353 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null, $titlekey =
"PdfOrderTitle")
1356 global $conf, $langs, $hookmanager;
1358 $ltrdirection =
'L';
1359 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1360 $ltrdirection =
'R';
1364 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1370 $pdf->SetTextColor(0, 0, 60);
1371 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1375 $posy = $this->marge_haute;
1376 $posx = $this->page_largeur - $this->marge_droite - $w;
1378 $pdf->SetXY($this->marge_gauche, $posy);
1382 if ($this->emetteur->logo) {
1383 $logodir = $conf->mycompany->dir_output;
1384 if (!empty($conf->mycompany->multidir_output[
$object->entity ?? $conf->entity])) {
1385 $logodir = $conf->mycompany->multidir_output[
$object->entity ?? $conf->entity];
1388 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1390 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1392 if (is_readable($logo)) {
1394 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1396 $pdf->SetTextColor(200, 0, 0);
1397 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1398 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1399 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1402 $text = $this->emetteur->name;
1403 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1407 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1408 $pdf->SetXY($posx, $posy);
1409 $pdf->SetTextColor(0, 0, 60);
1410 $title = $outputlangs->transnoentities($titlekey);
1411 $title .=
' '.$outputlangs->convToOutputCharset(
$object->ref);
1412 if (
$object->statut == $object::STATUS_DRAFT) {
1413 $pdf->SetTextColor(128, 0, 0);
1414 $title .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1416 $pdf->MultiCell($w, 3, $title,
'',
'R');
1418 $pdf->SetFont(
'',
'B', $default_font_size);
1428 $pdf->SetFont(
'',
'', $default_font_size - 1);
1432 $pdf->SetXY($posx, $posy);
1433 $pdf->SetTextColor(0, 0, 60);
1434 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset(
$object->ref_client),
'',
'R');
1439 if (!empty(
$object->project->ref)) {
1440 $posy = $pdf->GetY();
1441 $pdf->SetXY($posx, $posy);
1442 $pdf->SetTextColor(0, 0, 60);
1443 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1449 if (!empty(
$object->project->ref)) {
1450 $outputlangs->load(
"projects");
1451 $posy = $pdf->GetY();
1452 $pdf->SetXY($posx, $posy);
1453 $pdf->SetTextColor(0, 0, 60);
1454 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1458 $posy = $pdf->GetY();
1459 $pdf->SetXY($posx, $posy);
1460 $pdf->SetTextColor(0, 0, 60);
1461 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date(
$object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1464 $posy = $pdf->GetY();
1465 $pdf->SetXY($posx, $posy);
1466 $pdf->SetTextColor(0, 0, 60);
1467 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1472 $pdf->SetXY($posx, $posy);
1473 $pdf->SetTextColor(0, 0, 60);
1474 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_compta_client),
'',
'R');
1479 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1480 if (count($arrayidcontact) > 0) {
1481 $usertmp =
new User($this->db);
1482 $usertmp->fetch($arrayidcontact[0]);
1484 $pdf->SetXY($posx, $posy);
1485 $pdf->SetTextColor(0, 0, 60);
1486 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1495 $current_y = $pdf->getY();
1497 if ($current_y < $pdf->getY()) {
1498 $top_shift = $pdf->getY() - $current_y;
1503 $carac_emetteur =
'';
1505 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1506 if (count($arrayidcontact) > 0) {
1507 $object->fetch_user($arrayidcontact[0]);
1508 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1509 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
" ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1511 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1515 $carac_emetteur .=
"\n";
1521 $posy = 42 + $top_shift;
1522 $posx = $this->marge_gauche;
1524 $posx = $this->page_largeur - $this->marge_droite - 80;
1530 $pdf->SetTextColor(0, 0, 0);
1531 $pdf->SetFont(
'',
'', $default_font_size - 2);
1532 $pdf->SetXY($posx, $posy - 5);
1533 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1534 $pdf->SetXY($posx, $posy);
1535 $pdf->SetFillColor(230, 230, 230);
1536 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius,
'1234',
'F');
1537 $pdf->SetTextColor(0, 0, 60);
1542 $pdf->SetXY($posx + 2, $posy + 3);
1543 $pdf->SetFont(
'',
'B', $default_font_size);
1544 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1545 $posy = $pdf->getY();
1549 $pdf->SetXY($posx + 2, $posy);
1550 $pdf->SetFont(
'',
'', $default_font_size - 1);
1551 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1555 $usecontact =
false;
1556 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1557 if (count($arrayidcontact) > 0) {
1559 $result =
$object->fetch_contact($arrayidcontact[0]);
1563 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1564 $thirdparty =
$object->contact;
1566 $thirdparty =
$object->thirdparty;
1576 if ($this->page_largeur < 210) {
1580 $posy += $top_shift;
1581 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1583 $posx = $this->marge_gauche;
1588 $pdf->SetTextColor(0, 0, 0);
1589 $pdf->SetFont(
'',
'', $default_font_size - 2);
1590 $pdf->SetXY($posx + 2, $posy - 5);
1591 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1592 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1596 $pdf->SetXY($posx + 2, $posy + 3);
1597 $pdf->SetFont(
'',
'B', $default_font_size);
1599 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1601 $posy = $pdf->getY();
1604 $pdf->SetFont(
'',
'', $default_font_size - 1);
1605 $pdf->SetXY($posx + 2, $posy);
1607 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1611 $idaddressshipping =
$object->getIdContact(
'external',
'SHIPPING');
1613 if (!empty($idaddressshipping)) {
1614 $contactshipping =
$object->fetch_Contact($idaddressshipping[0]);
1615 $companystatic =
new Societe($this->db);
1616 $companystatic->fetch(
$object->contact->fk_soc);
1623 if (!empty($carac_client_shipping)) {
1624 $posy += $hautcadre;
1629 $pdf->SetXY($posx + 2, $posy - 5);
1630 $pdf->SetFont(
'',
'', $default_font_size - 2);
1631 $pdf->MultiCell($widthrecbox, 0, $outputlangs->transnoentities(
'ShippingTo'), 0,
'L',
false);
1632 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1635 $pdf->SetXY($posx + 2, $posy + 1);
1636 $pdf->SetFont(
'',
'B', $default_font_size);
1637 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping,
'',
'L');
1639 $posy = $pdf->getY();
1642 $pdf->SetXY($posx + 2, $posy);
1643 $pdf->SetFont(
'',
'', $default_font_size - 1);
1644 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping,
'',
'L');
1646 $shipp_shift += $hautcadre + 10;
1651 $pdf->SetTextColor(0, 0, 0);
1653 $pagehead = array(
'top_shift' => $top_shift,
'shipp_shift' => $shipp_shift);