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",
"deliveries",
"compta"));
205 global $outputlangsbis;
206 $outputlangsbis =
null;
208 $outputlangsbis =
new Translate(
'', $conf);
210 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"deliveries",
"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].
"/".$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(1, 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])) {
279 $logodir = $conf->mycompany->multidir_output[
$object->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;
336 if (isModEnabled(
'incoterm')) {
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(
'', 1, $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(
'', 1, $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(
'', 1, 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', 0);
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', 0);
501 if (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) {
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(
'', 1, 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 $pdf->Output($file,
'F');
648 $hookmanager->initHooks(array(
'pdfgeneration'));
649 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
651 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
653 $this->error = $hookmanager->error;
654 $this->errors = $hookmanager->errors;
659 $this->result = array(
'fullpath' => $file);
663 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
667 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"COMMANDE_OUTPUTDIR");
703 global $conf, $mysoc;
706 $pdf->SetFont(
'',
'', $default_font_size - 1);
708 $diffsizetitle = (!
getDolGlobalString(
'PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
711 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
712 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
713 $pdf->SetXY($this->marge_gauche, $posy);
714 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
716 $posy = $pdf->GetY() + 4;
721 $diffsizetitle = (!
getDolGlobalString(
'PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
725 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
726 $pdf->SetXY($this->marge_gauche, $posy);
727 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
728 $pdf->MultiCell(43, 4, $titre, 0,
'L');
730 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
731 $pdf->SetXY($posxval, $posy);
732 $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);
733 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
734 if (
$object->deposit_percent > 0) {
735 $lib_condition_paiement = str_replace(
'__DEPOSIT_PERCENT__', (
string)
$object->deposit_percent, $lib_condition_paiement);
737 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
739 $posy = $pdf->GetY() + 3;
770 if (!empty(
$object->delivery_date)) {
771 $outputlangs->load(
"sendings");
772 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
773 $pdf->SetXY($this->marge_gauche, $posy);
774 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
775 $pdf->MultiCell(80, 4, $titre, 0,
'L');
776 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
777 $pdf->SetXY($posxval, $posy);
779 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
781 $posy = $pdf->GetY() + 1;
784 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
785 $pdf->SetXY($this->marge_gauche, $posy);
786 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
787 $pdf->MultiCell(80, 4, $titre, 0,
'L');
788 $pdf->SetTextColor(0, 0, 0);
789 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
790 $pdf->SetXY($posxval, $posy);
791 $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 :
'');
792 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
793 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
795 $posy = $pdf->GetY() + 1;
799 if (
$object->mode_reglement_code
800 &&
$object->mode_reglement_code !=
'CHQ'
801 &&
$object->mode_reglement_code !=
'VIR') {
802 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
803 $pdf->SetXY($this->marge_gauche, $posy);
804 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
805 $pdf->MultiCell(80, 5, $titre, 0,
'L');
807 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
808 $pdf->SetXY($posxval, $posy);
809 $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);
810 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
812 $posy = $pdf->GetY() + 2;
816 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'CHQ') {
820 $account =
new Account($this->db);
823 $pdf->SetXY($this->marge_gauche, $posy);
824 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
825 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->owner_name), 0,
'L', 0);
826 $posy = $pdf->GetY() + 1;
829 $pdf->SetXY($this->marge_gauche, $posy);
830 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
831 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
832 $posy = $pdf->GetY() + 2;
835 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
836 $pdf->SetXY($this->marge_gauche, $posy);
837 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
838 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
839 $posy = $pdf->GetY() + 1;
842 $pdf->SetXY($this->marge_gauche, $posy);
843 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
844 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
845 $posy = $pdf->GetY() + 2;
852 if (empty(
$object->mode_reglement_code) ||
$object->mode_reglement_code ==
'VIR') {
854 $bankid = (
$object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER :
$object->fk_account);
858 $account =
new Account($this->db);
859 $account->fetch($bankid);
861 $curx = $this->marge_gauche;
864 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
889 global $conf, $mysoc, $hookmanager;
894 $outputlangsbis =
new Translate(
'', $conf);
896 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
897 $default_font_size--;
902 $pdf->SetFont(
'',
'', $default_font_size - 1);
907 if ($this->page_largeur < 210) {
910 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
916 $total_ht = (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1 ?
$object->multicurrency_total_ht :
$object->total_ht);
919 $total_line_remise = 0;
920 foreach (
$object->lines as $i => $line) {
922 $total_line_remise += (is_numeric($resdiscount) ? $resdiscount : 0);
924 if ($line->total_ht < 0) {
925 $total_line_remise += -$line->total_ht;
928 if ($total_line_remise > 0) {
929 $pdf->SetFillColor(255, 255, 255);
930 $pdf->SetXY($col1x, $tab2_top + $tab2_hl);
931 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalDiscount").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalDiscount") :
''), 0,
'L', 1);
932 $pdf->SetXY($col2x, $tab2_top + $tab2_hl);
933 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_line_remise, 0, $outputlangs), 0,
'R', 1);
938 $pdf->SetFillColor(255, 255, 255);
939 $pdf->SetXY($col1x, $tab2_top);
940 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHTBeforeDiscount").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHTBeforeDiscount") :
''), 0,
'L', 1);
941 $pdf->SetXY($col2x, $tab2_top);
942 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_line_remise + $total_ht, 0, $outputlangs), 0,
'R', 1);
948 $pdf->SetFillColor(255, 255, 255);
949 $pdf->SetXY($col1x, $tab2_top+ $tab2_hl * $index);
950 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHT") :
''), 0,
'L', 1);
952 $total_ht = ((isModEnabled(
"multicurrency") && isset(
$object->multicurrency_tx) &&
$object->multicurrency_tx != 1) ?
$object->multicurrency_total_ht :
$object->total_ht);
953 $pdf->SetXY($col2x, $tab2_top+ $tab2_hl * $index);
954 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty(
$object->remise) ?
$object->remise : 0), 0, $outputlangs), 0,
'R', 1);
957 $pdf->SetFillColor(248, 248, 248);
959 $total_ttc = (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) ?
$object->multicurrency_total_ttc :
$object->total_ttc;
961 $this->atleastoneratenotnull = 0;
963 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000']));
968 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
969 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
972 foreach ($localtax_rate as $tvakey => $tvaval) {
977 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
980 if (preg_match(
'/\*/', (
string) $tvakey)) {
981 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
982 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
984 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1", $mysoc->country_code) :
'');
988 $totalvat .= $tvacompl;
990 $totalvat .=
vatrate((
string) abs((
float) $tvakey), 1).$tvacompl;
993 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
995 $total_localtax = ((isModEnabled(
"multicurrency") && isset(
$object->multicurrency_tx) &&
$object->multicurrency_tx != 1) ?
price2num($tvaval *
$object->multicurrency_tx,
'MT') : $tvaval);
997 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
998 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
1004 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1005 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
1008 foreach ($localtax_rate as $tvakey => $tvaval) {
1013 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1016 if (preg_match(
'/\*/', (
string) $tvakey)) {
1017 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1018 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1020 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2", $mysoc->country_code) :
'');
1024 $totalvat .= $tvacompl;
1026 $totalvat .=
vatrate((
string) abs((
float) $tvakey), 1).$tvacompl;
1029 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1031 $total_localtax = ((isModEnabled(
"multicurrency") && isset(
$object->multicurrency_tx) &&
$object->multicurrency_tx != 1) ?
price2num($tvaval *
$object->multicurrency_tx,
'MT') : $tvaval);
1033 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1034 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
1040 foreach ($this->tva_array as $tvakey => $tvaval) {
1042 $this->atleastoneratenotnull++;
1045 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1048 if (preg_match(
'/\*/', $tvakey)) {
1049 $tvakey = str_replace(
'*',
'', $tvakey);
1050 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1052 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalVAT", $mysoc->country_code) :
'');
1055 $totalvat .=
vatrate($tvaval[
'vatrate'], 1).$tvacompl;
1057 $totalvat .= $tvaval[
'vatcode'].$tvacompl;
1059 $totalvat .= $tvacompl;
1061 $totalvat .=
vatrate($tvaval[
'vatrate'], 1).($tvaval[
'vatcode'] ?
' ('.$tvaval[
'vatcode'].
')' :
'').$tvacompl;
1063 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1065 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1066 $pdf->MultiCell($largcol2, $tab2_hl,
price(
price2num($tvaval[
'amount'],
'MT'), 0, $outputlangs), 0,
'R', 1);
1073 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1074 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1078 foreach ($localtax_rate as $tvakey => $tvaval) {
1083 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1086 if (preg_match(
'/\*/', (
string) $tvakey)) {
1087 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1088 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1090 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1", $mysoc->country_code) :
'');
1094 $totalvat .= $tvacompl;
1096 $totalvat .=
vatrate((
string) abs((
float) $tvakey), 1).$tvacompl;
1099 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1101 $total_localtax = ((isModEnabled(
"multicurrency") && isset(
$object->multicurrency_tx) &&
$object->multicurrency_tx != 1) ?
price2num($tvaval *
$object->multicurrency_tx,
'MT') : $tvaval);
1103 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1104 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
1112 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1113 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1117 foreach ($localtax_rate as $tvakey => $tvaval) {
1123 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1126 if (preg_match(
'/\*/', (
string) $tvakey)) {
1127 $tvakey = str_replace(
'*',
'', (
string) $tvakey);
1128 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1130 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2", $mysoc->country_code) :
'');
1134 $totalvat .= $tvacompl;
1136 $totalvat .=
vatrate((
string) abs((
float) $tvakey), 1).$tvacompl;
1139 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1141 $total_localtax = ((isModEnabled(
"multicurrency") && isset(
$object->multicurrency_tx) &&
$object->multicurrency_tx != 1) ?
price2num($tvaval *
$object->multicurrency_tx,
'MT') : $tvaval);
1143 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1144 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
1152 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1153 $pdf->SetTextColor(0, 0, 60);
1154 $pdf->SetFillColor(224, 224, 224);
1155 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalTTC", $mysoc->country_code) :
''), $useborder,
'L', 1);
1157 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1158 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1162 $pdf->SetTextColor(0, 0, 0);
1164 $creditnoteamount = 0;
1165 $depositsamount = 0;
1169 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1174 if ($deja_regle > 0) {
1178 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1179 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L', 0);
1180 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1181 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R', 0);
1184 $pdf->SetTextColor(0, 0, 60);
1185 $pdf->SetFillColor(224, 224, 224);
1186 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1187 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L', 1);
1189 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1190 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
1192 $pdf->SetFont(
'',
'', $default_font_size - 1);
1193 $pdf->SetTextColor(0, 0, 0);
1197 return ($tab2_top + ($tab2_hl * $index));
1215 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
1225 $currency = !empty($currency) ? $currency : $conf->currency;
1229 $pdf->SetTextColor(0, 0, 0);
1230 $pdf->SetFont(
'',
'', $default_font_size - 2);
1232 if (empty($hidetop)) {
1233 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1234 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1235 $titre .=
' - '.$outputlangsbis->transnoentities(
"AmountInCurrency", $outputlangsbis->transnoentitiesnoconv(
"Currency".$currency));
1238 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1239 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1243 $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius,
'1001',
'F',
null, explode(
',',
getDolGlobalString(
'MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1247 $pdf->SetDrawColor(128, 128, 128);
1248 $pdf->SetFont(
'',
'', $default_font_size - 1);
1251 $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');
1253 if (empty($hidetop)) {
1254 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1256 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1257 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1261 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1262 if (empty($hidetop)) {
1263 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1264 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1268 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1269 if (empty($hidetop)) {
1270 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1271 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1274 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1275 if (empty($hidetop)) {
1276 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1277 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1281 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1282 if (empty($hidetop)) {
1283 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1284 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1288 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1289 if (empty($hidetop)) {
1290 if ($this->atleastonediscount) {
1291 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1292 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1296 if ($this->atleastonediscount) {
1297 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1299 if (empty($hidetop)) {
1300 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1301 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1318 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null, $titlekey =
"PdfOrderTitle")
1321 global $conf, $langs, $hookmanager;
1323 $ltrdirection =
'L';
1324 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1325 $ltrdirection =
'R';
1329 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1335 $pdf->SetTextColor(0, 0, 60);
1336 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1340 $posy = $this->marge_haute;
1341 $posx = $this->page_largeur - $this->marge_droite - $w;
1343 $pdf->SetXY($this->marge_gauche, $posy);
1347 if ($this->emetteur->logo) {
1348 $logodir = $conf->mycompany->dir_output;
1349 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
1350 $logodir = $conf->mycompany->multidir_output[
$object->entity];
1353 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1355 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1357 if (is_readable($logo)) {
1359 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1361 $pdf->SetTextColor(200, 0, 0);
1362 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1363 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1364 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1367 $text = $this->emetteur->name;
1368 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1372 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1373 $pdf->SetXY($posx, $posy);
1374 $pdf->SetTextColor(0, 0, 60);
1375 $title = $outputlangs->transnoentities($titlekey);
1376 $title .=
' '.$outputlangs->convToOutputCharset(
$object->ref);
1377 if (
$object->statut == $object::STATUS_DRAFT) {
1378 $pdf->SetTextColor(128, 0, 0);
1379 $title .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1381 $pdf->MultiCell($w, 3, $title,
'',
'R');
1383 $pdf->SetFont(
'',
'B', $default_font_size);
1393 $pdf->SetFont(
'',
'', $default_font_size - 1);
1397 $pdf->SetXY($posx, $posy);
1398 $pdf->SetTextColor(0, 0, 60);
1399 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset(
$object->ref_client),
'',
'R');
1404 if (!empty(
$object->project->ref)) {
1406 $pdf->SetXY($posx, $posy);
1407 $pdf->SetTextColor(0, 0, 60);
1408 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1414 if (!empty(
$object->project->ref)) {
1415 $outputlangs->load(
"projects");
1417 $pdf->SetXY($posx, $posy);
1418 $pdf->SetTextColor(0, 0, 60);
1419 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1424 $pdf->SetXY($posx, $posy);
1425 $pdf->SetTextColor(0, 0, 60);
1426 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date(
$object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1430 $pdf->SetXY($posx, $posy);
1431 $pdf->SetTextColor(0, 0, 60);
1432 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1437 $pdf->SetXY($posx, $posy);
1438 $pdf->SetTextColor(0, 0, 60);
1439 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_compta_client),
'',
'R');
1444 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1445 if (count($arrayidcontact) > 0) {
1446 $usertmp =
new User($this->db);
1447 $usertmp->fetch($arrayidcontact[0]);
1449 $pdf->SetXY($posx, $posy);
1450 $pdf->SetTextColor(0, 0, 60);
1451 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1460 $current_y = $pdf->getY();
1462 if ($current_y < $pdf->getY()) {
1463 $top_shift = $pdf->getY() - $current_y;
1468 $carac_emetteur =
'';
1470 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1471 if (count($arrayidcontact) > 0) {
1472 $object->fetch_user($arrayidcontact[0]);
1473 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1474 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
" ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1476 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1480 $carac_emetteur .=
"\n";
1486 $posy = 42 + $top_shift;
1487 $posx = $this->marge_gauche;
1489 $posx = $this->page_largeur - $this->marge_droite - 80;
1495 $pdf->SetTextColor(0, 0, 0);
1496 $pdf->SetFont(
'',
'', $default_font_size - 2);
1497 $pdf->SetXY($posx, $posy - 5);
1498 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1499 $pdf->SetXY($posx, $posy);
1500 $pdf->SetFillColor(230, 230, 230);
1501 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius,
'1234',
'F');
1502 $pdf->SetTextColor(0, 0, 60);
1507 $pdf->SetXY($posx + 2, $posy + 3);
1508 $pdf->SetFont(
'',
'B', $default_font_size);
1509 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1510 $posy = $pdf->getY();
1514 $pdf->SetXY($posx + 2, $posy);
1515 $pdf->SetFont(
'',
'', $default_font_size - 1);
1516 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1520 $usecontact =
false;
1521 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1522 if (count($arrayidcontact) > 0) {
1524 $result =
$object->fetch_contact($arrayidcontact[0]);
1528 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1529 $thirdparty =
$object->contact;
1531 $thirdparty =
$object->thirdparty;
1541 if ($this->page_largeur < 210) {
1545 $posy += $top_shift;
1546 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1548 $posx = $this->marge_gauche;
1553 $pdf->SetTextColor(0, 0, 0);
1554 $pdf->SetFont(
'',
'', $default_font_size - 2);
1555 $pdf->SetXY($posx + 2, $posy - 5);
1556 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1557 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1561 $pdf->SetXY($posx + 2, $posy + 3);
1562 $pdf->SetFont(
'',
'B', $default_font_size);
1564 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1566 $posy = $pdf->getY();
1569 $pdf->SetFont(
'',
'', $default_font_size - 1);
1570 $pdf->SetXY($posx + 2, $posy);
1572 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1576 $idaddressshipping =
$object->getIdContact(
'external',
'SHIPPING');
1578 if (!empty($idaddressshipping)) {
1579 $contactshipping =
$object->fetch_Contact($idaddressshipping[0]);
1580 $companystatic =
new Societe($this->db);
1581 $companystatic->fetch(
$object->contact->fk_soc);
1583 $carac_client_shipping =
pdf_build_address($outputlangs, $this->emetteur, $companystatic,
$object->contact, ($usecontact ? 1 : 0),
'target',
$object);
1588 if (!empty($carac_client_shipping)) {
1589 $posy += $hautcadre;
1594 $pdf->SetXY($posx + 2, $posy - 5);
1595 $pdf->SetFont(
'',
'', $default_font_size - 2);
1596 $pdf->MultiCell($widthrecbox,
'', $outputlangs->transnoentities(
'ShippingTo'), 0,
'L', 0);
1597 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1600 $pdf->SetXY($posx + 2, $posy + 1);
1601 $pdf->SetFont(
'',
'B', $default_font_size);
1602 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping,
'',
'L');
1604 $posy = $pdf->getY();
1607 $pdf->SetXY($posx + 2, $posy);
1608 $pdf->SetFont(
'',
'', $default_font_size - 1);
1609 $pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping,
'',
'L');
1611 $shipp_shift += $hautcadre + 10;
1616 $pdf->SetTextColor(0, 0, 0);
1618 $pagehead = array(
'top_shift' => $top_shift,
'shipp_shift' => $shipp_shift);