176 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
179 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
181 if (!is_object($outputlangs)) {
182 $outputlangs = $langs;
186 $outputlangs->charset_output =
'ISO-8859-1';
190 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"deliveries"));
193 if ($object->statut == $object::STATUS_DRAFT &&
getDolGlobalString(
'COMMANDE_DRAFT_WATERMARK')) {
197 global $outputlangsbis;
198 $outputlangsbis =
null;
199 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
200 $outputlangsbis =
new Translate(
'', $conf);
201 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
202 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"deliveries"));
205 $nblines = count($object->lines);
207 if ($conf->commande->multidir_output[$conf->entity]) {
208 $object->fetch_thirdparty();
213 if ($object->specimen) {
214 $dir = $conf->commande->multidir_output[$conf->entity];
215 $file = $dir.
"/SPECIMEN.pdf";
220 $suffix = (
GETPOST(
'model', 2)==
'proforma') ? $conf->global->PROFORMA_PDF_WITH_SUFFIX :
'';
225 $dir = $conf->commande->multidir_output[$object->entity].
"/".$objectref;
226 $file = $dir.
"/".$objectref.$suffix.
".pdf";
229 if (!file_exists($dir)) {
231 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
236 if (file_exists($dir)) {
238 if (!is_object($hookmanager)) {
239 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
242 $hookmanager->initHooks(array(
'pdfgeneration'));
243 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
245 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
248 $nblines = count($object->lines);
253 $pdf->SetAutoPageBreak(1, 0);
255 $heightforinfotot = 40;
256 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
257 $heightforfooter = $this->marge_basse + 8;
259 $heightforfooter += 6;
262 if (class_exists(
'TCPDF')) {
263 $pdf->setPrintHeader(
false);
264 $pdf->setPrintFooter(
false);
269 $logodir = $conf->mycompany->dir_output;
270 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
271 $logodir = $conf->mycompany->multidir_output[$object->entity];
273 $pagecount = $pdf->setSourceFile($logodir.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
274 $tplidx = $pdf->importPage(1);
279 $pdf->SetDrawColor(128, 128, 128);
281 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
282 $pdf->SetSubject($outputlangs->transnoentities(
"PdfOrderTitle"));
283 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
284 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
285 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PdfOrderTitle").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
287 $pdf->SetCompression(
false);
290 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
293 for ($i = 0; $i < $nblines; $i++) {
294 if ($object->lines[$i]->remise_percent) {
295 $this->atleastonediscount++;
298 if (empty($this->atleastonediscount)) {
299 $delta = ($this->postotalht - $this->posxdiscount);
300 $this->posxpicture += $delta;
301 $this->posxtva += $delta;
302 $this->posxup += $delta;
303 $this->posxqty += $delta;
304 $this->posxunit += $delta;
305 $this->posxdiscount += $delta;
311 if (!empty($tplidx)) {
312 $pdf->useTemplate($tplidx);
315 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs, (is_object($outputlangsbis) ? $outputlangsbis :
null));
316 $pdf->SetFont(
'',
'', $default_font_size - 1);
317 $pdf->MultiCell(0, 3,
'');
318 $pdf->SetTextColor(0, 0, 0);
321 $tab_top = 90 + $top_shift;
322 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
325 $height_incoterms = 0;
326 if (isModEnabled(
'incoterm')) {
327 $desc_incoterms = $object->getIncotermsForPDF();
328 if ($desc_incoterms) {
331 $pdf->SetFont(
'',
'', $default_font_size - 1);
332 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
333 $nexY = $pdf->GetY();
334 $height_incoterms = $nexY - $tab_top;
337 $pdf->SetDrawColor(192, 192, 192);
338 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
340 $tab_top = $nexY + 6;
345 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
348 if (is_object($object->thirdparty)) {
349 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
350 $salerepobj =
new User($this->db);
351 $salerepobj->fetch($salereparray[0][
'id']);
352 if (!empty($salerepobj->signature)) {
353 $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
358 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
359 if (!empty($extranote)) {
371 $pdf->SetFont(
'',
'', $default_font_size - 1);
372 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($notetoshow), 0, 1);
373 $nexY = $pdf->GetY();
374 $height_note = $nexY - $tab_top;
377 $pdf->SetDrawColor(192, 192, 192);
378 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
380 $tab_top = $nexY + 6;
383 $iniY = $tab_top + 7;
384 $curY = $tab_top + 7;
385 $nexY = $tab_top + 7;
388 for ($i = 0; $i < $nblines; $i++) {
390 $pdf->SetFont(
'',
'', $default_font_size - 1);
391 $pdf->SetTextColor(0, 0, 0);
393 $pdf->setTopMargin($tab_top_newpage);
394 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
395 $pageposbefore = $pdf->getPage();
398 $curX = $this->posxdesc - 1;
400 $showpricebeforepagebreak = 1;
402 $pdf->startTransaction();
403 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc);
404 $pageposafter = $pdf->getPage();
405 if ($pageposafter > $pageposbefore) {
406 $pdf->rollbackTransaction(
true);
407 $pageposafter = $pageposbefore;
409 $pdf->setPageOrientation(
'', 1, $heightforfooter);
410 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc);
411 $pageposafter = $pdf->getPage();
412 $posyafter = $pdf->GetY();
413 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
414 if ($i == ($nblines - 1)) {
415 $pdf->AddPage(
'',
'',
true);
416 if (!empty($tplidx)) {
417 $pdf->useTemplate($tplidx);
420 $this->
_pagehead($pdf, $object, 0, $outputlangs);
422 $pdf->setPage($pageposafter + 1);
428 $showpricebeforepagebreak = 1;
430 $showpricebeforepagebreak = 0;
434 $pdf->commitTransaction();
436 $posYAfterDescription = $pdf->GetY();
438 $nexY = $pdf->GetY();
439 $pageposafter = $pdf->getPage();
441 $pdf->setPage($pageposbefore);
442 $pdf->setTopMargin($this->marge_haute);
443 $pdf->setPageOrientation(
'', 1, 0);
446 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
447 $pdf->setPage($pageposafter);
448 $curY = $tab_top_newpage;
451 $pdf->SetFont(
'',
'', $default_font_size - 1);
456 $pdf->SetXY($this->posxtva - 5, $curY);
457 $pdf->MultiCell($this->posxup - $this->posxtva + 4, 3, $vat_rate, 0,
'R');
462 $pdf->SetXY($this->posxup, $curY);
463 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0,
'R', 0);
467 $pdf->SetXY($this->posxqty, $curY);
468 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
472 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
473 $pdf->SetXY($this->posxunit, $curY);
474 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
478 $pdf->SetXY($this->posxdiscount, $curY);
479 if ($object->lines[$i]->remise_percent) {
480 $pdf->SetXY($this->posxdiscount - 2, $curY);
482 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0,
'R');
487 $pdf->SetXY($this->postotalht, $curY);
488 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0,
'R', 0);
491 if (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
492 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
494 $tvaligne = $object->lines[$i]->total_tva;
497 $localtax1ligne = $object->lines[$i]->total_localtax1;
498 $localtax2ligne = $object->lines[$i]->total_localtax2;
499 $localtax1_rate = $object->lines[$i]->localtax1_tx;
500 $localtax2_rate = $object->lines[$i]->localtax2_tx;
501 $localtax1_type = $object->lines[$i]->localtax1_type;
502 $localtax2_type = $object->lines[$i]->localtax2_type;
515 $vatrate = (string) $object->lines[$i]->tva_tx;
518 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
519 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
521 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
522 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
526 if ($localtax1_type && $localtax1ligne != 0) {
527 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
528 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
530 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
533 if ($localtax2_type && $localtax2ligne != 0) {
534 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
535 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
537 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
541 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
546 if (!isset($this->tva[$vatrate])) {
547 $this->tva[$vatrate] = 0;
549 $this->tva[$vatrate] += $tvaligne;
550 $vatcode = $object->lines[$i]->vat_src_code;
551 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
552 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
554 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate'=>$vatrate,
'vatcode'=>$vatcode,
'amount'=> $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
558 $pdf->setPage($pageposafter);
559 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
561 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
562 $pdf->SetLineStyle(array(
'dash'=>0));
568 while ($pagenb < $pageposafter) {
569 $pdf->setPage($pagenb);
571 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
573 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
575 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
577 $pdf->setPage($pagenb);
578 $pdf->setPageOrientation(
'', 1, 0);
580 $this->
_pagehead($pdf, $object, 0, $outputlangs);
582 if (!empty($tplidx)) {
583 $pdf->useTemplate($tplidx);
586 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
588 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
590 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
592 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
595 if (!empty($tplidx)) {
596 $pdf->useTemplate($tplidx);
600 $this->
_pagehead($pdf, $object, 0, $outputlangs);
607 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
609 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
611 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
614 $posy = $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
617 $posy = $this->
_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
628 $this->
_pagefoot($pdf, $object, $outputlangs);
629 if (method_exists($pdf,
'AliasNbPages')) {
630 $pdf->AliasNbPages();
635 $pdf->Output($file,
'F');
638 $hookmanager->initHooks(array(
'pdfgeneration'));
639 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
641 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
643 $this->error = $hookmanager->error;
644 $this->errors = $hookmanager->errors;
649 $this->result = array(
'fullpath'=>$file);
653 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
657 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"COMMANDE_OUTPUTDIR");
693 global $conf, $mysoc;
696 $pdf->SetFont(
'',
'', $default_font_size - 1);
698 $diffsizetitle = (!
getDolGlobalString(
'PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
701 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
702 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
703 $pdf->SetXY($this->marge_gauche, $posy);
704 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
706 $posy = $pdf->GetY() + 4;
711 $diffsizetitle = (!
getDolGlobalString(
'PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
714 if ($object->cond_reglement_code || $object->cond_reglement) {
715 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
716 $pdf->SetXY($this->marge_gauche, $posy);
717 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
718 $pdf->MultiCell(43, 4, $titre, 0,
'L');
720 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
721 $pdf->SetXY($posxval, $posy);
722 $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);
723 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
724 if ($object->deposit_percent > 0) {
725 $lib_condition_paiement = str_replace(
'__DEPOSIT_PERCENT__', $object->deposit_percent, $lib_condition_paiement);
727 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
729 $posy = $pdf->GetY() + 3;
760 if (!empty($object->delivery_date)) {
761 $outputlangs->load(
"sendings");
762 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
763 $pdf->SetXY($this->marge_gauche, $posy);
764 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
765 $pdf->MultiCell(80, 4, $titre, 0,
'L');
766 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
767 $pdf->SetXY($posxval, $posy);
768 $dlp =
dol_print_date($object->delivery_date,
"daytext",
false, $outputlangs,
true);
769 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
771 $posy = $pdf->GetY() + 1;
772 } elseif ($object->availability_code || $object->availability) {
774 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
775 $pdf->SetXY($this->marge_gauche, $posy);
776 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
777 $pdf->MultiCell(80, 4, $titre, 0,
'L');
778 $pdf->SetTextColor(0, 0, 0);
779 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
780 $pdf->SetXY($posxval, $posy);
781 $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 :
'');
782 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
783 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
785 $posy = $pdf->GetY() + 1;
789 if ($object->mode_reglement_code
790 && $object->mode_reglement_code !=
'CHQ'
791 && $object->mode_reglement_code !=
'VIR') {
792 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
793 $pdf->SetXY($this->marge_gauche, $posy);
794 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
795 $pdf->MultiCell(80, 5, $titre, 0,
'L');
797 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
798 $pdf->SetXY($posxval, $posy);
799 $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);
800 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
802 $posy = $pdf->GetY() + 2;
806 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'CHQ') {
810 $account =
new Account($this->db);
811 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
813 $pdf->SetXY($this->marge_gauche, $posy);
814 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
815 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->proprio), 0,
'L', 0);
816 $posy = $pdf->GetY() + 1;
819 $pdf->SetXY($this->marge_gauche, $posy);
820 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
821 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
822 $posy = $pdf->GetY() + 2;
825 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
826 $pdf->SetXY($this->marge_gauche, $posy);
827 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
828 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
829 $posy = $pdf->GetY() + 1;
832 $pdf->SetXY($this->marge_gauche, $posy);
833 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
834 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
835 $posy = $pdf->GetY() + 2;
842 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'VIR') {
843 if ($object->fk_account > 0 || $object->fk_bank > 0 ||
getDolGlobalInt(
'FACTURE_RIB_NUMBER')) {
844 $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
845 if ($object->fk_bank > 0) {
846 $bankid = $object->fk_bank;
848 $account =
new Account($this->db);
849 $account->fetch($bankid);
851 $curx = $this->marge_gauche;
854 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
876 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis =
null)
879 global $conf, $mysoc, $hookmanager;
883 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
884 $outputlangsbis =
new Translate(
'', $conf);
885 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
886 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
887 $default_font_size--;
892 $pdf->SetFont(
'',
'', $default_font_size - 1);
897 if ($this->page_largeur < 210) {
900 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
906 $pdf->SetFillColor(255, 255, 255);
907 $pdf->SetXY($col1x, $tab2_top);
908 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"TotalHT") :
''), 0,
'L', 1);
910 $total_ht = ((isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
911 $pdf->SetXY($col2x, $tab2_top);
912 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0,
'R', 1);
915 $pdf->SetFillColor(248, 248, 248);
917 $total_ttc = (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
919 $this->atleastoneratenotnull = 0;
921 $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva[
'0.000']) && is_float($this->tva[
'0.000'])) ?
true :
false);
928 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
929 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
932 foreach ($localtax_rate as $tvakey => $tvaval) {
937 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
940 if (preg_match(
'/\*/', $tvakey)) {
941 $tvakey = str_replace(
'*',
'', $tvakey);
942 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
944 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1", $mysoc->country_code) :
'');
946 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
947 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
949 $total_localtax = ((isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ?
price2num($tvaval * $object->multicurrency_tx,
'MT') : $tvaval);
951 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
952 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
960 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
961 if (in_array((
string) $localtax_type, array(
'1',
'3',
'5'))) {
964 foreach ($localtax_rate as $tvakey => $tvaval) {
969 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
972 if (preg_match(
'/\*/', $tvakey)) {
973 $tvakey = str_replace(
'*',
'', $tvakey);
974 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
976 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2", $mysoc->country_code) :
'');
978 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
979 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
981 $total_localtax = ((isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ?
price2num($tvaval * $object->multicurrency_tx,
'MT') : $tvaval);
983 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
984 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
991 foreach ($this->tva_array as $tvakey => $tvaval) {
993 $this->atleastoneratenotnull++;
996 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
999 if (preg_match(
'/\*/', $tvakey)) {
1000 $tvakey = str_replace(
'*',
'', $tvakey);
1001 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1003 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalVAT", $mysoc->country_code) :
'');
1006 $totalvat .=
vatrate($tvaval[
'vatrate'], 1).$tvacompl;
1008 $totalvat .= $tvaval[
'vatcode'].$tvacompl;
1010 $totalvat .=
vatrate($tvaval[
'vatrate'], 1).($tvaval[
'vatcode'] ?
' ('.$tvaval[
'vatcode'].
')' :
'').$tvacompl;
1012 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1014 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1015 $pdf->MultiCell($largcol2, $tab2_hl,
price(
price2num($tvaval[
'amount'],
'MT'), 0, $outputlangs), 0,
'R', 1);
1022 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1023 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1027 foreach ($localtax_rate as $tvakey => $tvaval) {
1032 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1035 if (preg_match(
'/\*/', $tvakey)) {
1036 $tvakey = str_replace(
'*',
'', $tvakey);
1037 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1039 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT1", $mysoc->country_code) :
'');
1042 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1043 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1045 $total_localtax = ((isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ?
price2num($tvaval * $object->multicurrency_tx,
'MT') : $tvaval);
1047 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1048 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
1056 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1057 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1061 foreach ($localtax_rate as $tvakey => $tvaval) {
1067 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1070 if (preg_match(
'/\*/', $tvakey)) {
1071 $tvakey = str_replace(
'*',
'', $tvakey);
1072 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1074 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalLT2", $mysoc->country_code) :
'');
1077 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1078 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1080 $total_localtax = ((isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ?
price2num($tvaval * $object->multicurrency_tx,
'MT') : $tvaval);
1082 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1083 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_localtax, 0, $outputlangs), 0,
'R', 1);
1091 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1092 $pdf->SetTextColor(0, 0, 60);
1093 $pdf->SetFillColor(224, 224, 224);
1094 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"TotalTTC", $mysoc->country_code) :
''), $useborder,
'L', 1);
1096 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1097 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1101 $pdf->SetTextColor(0, 0, 0);
1103 $creditnoteamount = 0;
1104 $depositsamount = 0;
1108 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1109 if (!empty($object->paye)) {
1113 if ($deja_regle > 0) {
1117 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1118 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L', 0);
1119 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1120 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R', 0);
1123 $pdf->SetTextColor(0, 0, 60);
1124 $pdf->SetFillColor(224, 224, 224);
1125 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1126 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L', 1);
1128 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1129 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
1131 $pdf->SetFont(
'',
'', $default_font_size - 1);
1132 $pdf->SetTextColor(0, 0, 0);
1136 return ($tab2_top + ($tab2_hl * $index));
1154 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
1164 $currency = !empty($currency) ? $currency : $conf->currency;
1168 $pdf->SetTextColor(0, 0, 0);
1169 $pdf->SetFont(
'',
'', $default_font_size - 2);
1171 if (empty($hidetop)) {
1172 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1173 if (
getDolGlobalString(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1174 $titre .=
' - '.$outputlangsbis->transnoentities(
"AmountInCurrency", $outputlangsbis->transnoentitiesnoconv(
"Currency".$currency));
1177 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1178 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1182 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5,
'F',
null, explode(
',',
getDolGlobalString(
'MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1186 $pdf->SetDrawColor(128, 128, 128);
1187 $pdf->SetFont(
'',
'', $default_font_size - 1);
1190 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1192 if (empty($hidetop)) {
1193 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1195 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1196 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1200 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1201 if (empty($hidetop)) {
1202 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1203 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1207 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1208 if (empty($hidetop)) {
1209 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1210 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1213 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1214 if (empty($hidetop)) {
1215 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1216 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1220 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1221 if (empty($hidetop)) {
1222 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1223 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1227 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1228 if (empty($hidetop)) {
1229 if ($this->atleastonediscount) {
1230 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1231 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1235 if ($this->atleastonediscount) {
1236 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1238 if (empty($hidetop)) {
1239 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1240 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1257 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis =
null, $titlekey =
"PdfOrderTitle")
1260 global $conf, $langs, $hookmanager;
1262 $ltrdirection =
'L';
1263 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1264 $ltrdirection =
'R';
1268 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1274 $pdf->SetTextColor(0, 0, 60);
1275 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1279 $posy = $this->marge_haute;
1280 $posx = $this->page_largeur - $this->marge_droite - $w;
1282 $pdf->SetXY($this->marge_gauche, $posy);
1286 if ($this->emetteur->logo) {
1287 $logodir = $conf->mycompany->dir_output;
1288 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1289 $logodir = $conf->mycompany->multidir_output[$object->entity];
1292 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1294 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1296 if (is_readable($logo)) {
1298 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1300 $pdf->SetTextColor(200, 0, 0);
1301 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1302 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1303 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1306 $text = $this->emetteur->name;
1307 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1311 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1312 $pdf->SetXY($posx, $posy);
1313 $pdf->SetTextColor(0, 0, 60);
1314 $title = $outputlangs->transnoentities($titlekey);
1315 $title .=
' '.$outputlangs->convToOutputCharset($object->ref);
1316 if ($object->statut == $object::STATUS_DRAFT) {
1317 $pdf->SetTextColor(128, 0, 0);
1318 $title .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1320 $pdf->MultiCell($w, 3, $title,
'',
'R');
1322 $pdf->SetFont(
'',
'B', $default_font_size);
1332 $pdf->SetFont(
'',
'', $default_font_size - 1);
1334 if ($object->ref_client) {
1336 $pdf->SetXY($posx, $posy);
1337 $pdf->SetTextColor(0, 0, 60);
1338 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset($object->ref_client),
'',
'R');
1342 $object->fetch_projet();
1343 if (!empty($object->project->ref)) {
1345 $pdf->SetXY($posx, $posy);
1346 $pdf->SetTextColor(0, 0, 60);
1347 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->project->title),
'',
'R');
1352 $object->fetch_projet();
1353 if (!empty($object->project->ref)) {
1354 $outputlangs->load(
"projects");
1356 $pdf->SetXY($posx, $posy);
1357 $pdf->SetTextColor(0, 0, 60);
1358 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
1363 $pdf->SetXY($posx, $posy);
1364 $pdf->SetTextColor(0, 0, 60);
1365 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1367 if (!
getDolGlobalString(
'MAIN_PDF_HIDE_CUSTOMER_CODE') && !empty($object->thirdparty->code_client)) {
1369 $pdf->SetXY($posx, $posy);
1370 $pdf->SetTextColor(0, 0, 60);
1371 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
1376 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1377 if (count($arrayidcontact) > 0) {
1378 $usertmp =
new User($this->db);
1379 $usertmp->fetch($arrayidcontact[0]);
1381 $pdf->SetXY($posx, $posy);
1382 $pdf->SetTextColor(0, 0, 60);
1383 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1391 $current_y = $pdf->getY();
1392 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3,
'R', $default_font_size);
1393 if ($current_y < $pdf->getY()) {
1394 $top_shift = $pdf->getY() - $current_y;
1399 $carac_emetteur =
'';
1401 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1402 if (count($arrayidcontact) > 0) {
1403 $object->fetch_user($arrayidcontact[0]);
1404 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1405 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
" ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
1407 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone :
'';
1409 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email :
'';
1411 $carac_emetteur .=
"\n";
1414 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1417 $posy = 42 + $top_shift;
1418 $posx = $this->marge_gauche;
1420 $posx = $this->page_largeur - $this->marge_droite - 80;
1426 $pdf->SetTextColor(0, 0, 0);
1427 $pdf->SetFont(
'',
'', $default_font_size - 2);
1428 $pdf->SetXY($posx, $posy - 5);
1429 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1430 $pdf->SetXY($posx, $posy);
1431 $pdf->SetFillColor(230, 230, 230);
1432 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1433 $pdf->SetTextColor(0, 0, 60);
1438 $pdf->SetXY($posx + 2, $posy + 3);
1439 $pdf->SetFont(
'',
'B', $default_font_size);
1440 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1441 $posy = $pdf->getY();
1445 $pdf->SetXY($posx + 2, $posy);
1446 $pdf->SetFont(
'',
'', $default_font_size - 1);
1447 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1451 $usecontact =
false;
1452 $arrayidcontact = $object->getIdContact(
'external',
'CUSTOMER');
1453 if (count($arrayidcontact) > 0) {
1455 $result = $object->fetch_contact($arrayidcontact[0]);
1459 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1460 $thirdparty = $object->contact;
1462 $thirdparty = $object->thirdparty;
1468 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact, $mode, $object);
1472 if ($this->page_largeur < 210) {
1476 $posy += $top_shift;
1477 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1479 $posx = $this->marge_gauche;
1484 $pdf->SetTextColor(0, 0, 0);
1485 $pdf->SetFont(
'',
'', $default_font_size - 2);
1486 $pdf->SetXY($posx + 2, $posy - 5);
1487 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1488 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1492 $pdf->SetXY($posx + 2, $posy + 3);
1493 $pdf->SetFont(
'',
'B', $default_font_size);
1494 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1496 $posy = $pdf->getY();
1499 $pdf->SetFont(
'',
'', $default_font_size - 1);
1500 $pdf->SetXY($posx + 2, $posy);
1501 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1504 $pdf->SetTextColor(0, 0, 0);