186 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
189 global $user,
$conf, $langs, $hookmanager;
195 if (!is_object($outputlangs)) {
196 $outputlangs = $langs;
200 $outputlangs->charset_output =
'ISO-8859-1';
204 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"stocks",
"stocktransfer@stocktransfer"));
206 global $outputlangsbis;
207 $outputlangsbis =
null;
211 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
217 $realpatharray = array();
218 $this->atleastonephoto =
false;
220 $objphoto =
new Product($this->db);
222 for ($i = 0; $i < $nblines; $i++) {
223 if (empty(
$object->lines[$i]->fk_product)) {
227 $objphoto =
new Product($this->db);
228 $objphoto->fetch(
$object->lines[$i]->fk_product);
230 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
231 $dir =
$conf->product->dir_output.
'/'.$pdir;
233 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
234 $dir =
$conf->product->dir_output.
'/'.$pdir;
239 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
242 if ($obj[
'photo_vignette']) {
243 $filename = $obj[
'photo_vignette'];
245 $filename = $obj[
'photo'];
248 $filename = $obj[
'photo'];
251 $realpath = $dir.$filename;
252 $this->atleastonephoto =
true;
257 $realpatharray[$i] = $realpath;
262 if (count($realpatharray) == 0) {
263 $this->posxpicture = $this->posxweightvol;
268 $this->posxpicture = $this->posxlot;
270 $this->posxpicture -=
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20);
274 if (
$conf->stocktransfer->dir_output) {
277 $dir =
$conf->stocktransfer->dir_output;
278 $file = $dir.
"/SPECIMEN.pdf";
281 $dir =
$conf->stocktransfer->dir_output.
'/'.
$object->element.
"/".$stocktransferref;
282 $file = $dir.
"/".$stocktransferref.
".pdf";
285 if (!file_exists($dir)) {
287 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
292 if (file_exists($dir)) {
294 if (!is_object($hookmanager)) {
295 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
298 $hookmanager->initHooks(array(
'pdfgeneration'));
299 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
301 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
308 $heightforinfotot = 8;
310 $heightforfooter = $this->marge_basse + 8;
312 $heightforfooter += 6;
314 $pdf->setAutoPageBreak(
true, 0);
316 if (class_exists(
'TCPDF')) {
317 $pdf->setPrintHeader(
false);
318 $pdf->setPrintFooter(
false);
323 $pagecount = $pdf->setSourceFile(
$conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
324 $tplidx = $pdf->importPage(1);
329 $pdf->SetDrawColor(128, 128, 128);
331 if (method_exists($pdf,
'AliasNbPages')) {
332 $pdf->AliasNbPages();
335 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
336 $pdf->SetSubject($outputlangs->transnoentities(
"StockTransfer"));
337 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
338 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
339 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"StockTransfer"));
341 $pdf->SetCompression(
false);
345 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
349 if (!empty($tplidx)) {
350 $pdf->useTemplate($tplidx);
354 $pdf->SetFont(
'',
'', $default_font_size - 1);
355 $pdf->MultiCell(0, 3,
'');
356 $pdf->SetTextColor(0, 0, 0);
359 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
361 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
363 $tab_height_newpage = 150;
366 $height_incoterms = 0;
367 if (isModEnabled(
'incoterm')) {
368 $desc_incoterms =
$object->getIncotermsForPDF();
369 if ($desc_incoterms) {
372 $pdf->SetFont(
'',
'', $default_font_size - 1);
373 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
374 $nexY = $pdf->GetY();
375 $height_incoterms = $nexY - $tab_top;
378 $pdf->SetDrawColor(192, 192, 192);
379 $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');
381 $tab_top = $nexY + 6;
382 $height_incoterms += 4;
387 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
388 $tab_top_alt = $tab_top;
393 if (!empty(
$object->tracking_number)) {
394 $height_trackingnumber = 4;
396 $pdf->SetFont(
'',
'B', $default_font_size - 2);
397 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
398 $tab_top_alt = $pdf->GetY();
401 if (!empty(
$object->tracking_url)) {
402 if (
$object->shipping_method_id > 0) {
404 $code = $outputlangs->getLabelFromKey($this->db, (
string)
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
407 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
409 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
413 $label .=
$object->tracking_url;
416 $height_trackingnumber += 4;
417 $pdf->SetFont(
'',
'B', $default_font_size - 2);
418 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
421 $tab_top = $pdf->GetY();
425 if (!empty(
$object->note_public)) {
426 $pdf->SetFont(
'',
'', $default_font_size - 1);
430 $nexY = $pdf->GetY();
431 $height_note = $nexY - $tab_top;
434 $pdf->SetDrawColor(192, 192, 192);
435 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius,
'1234',
'D');
437 $tab_height -= $height_note;
438 $tab_top = $nexY + 6;
447 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
449 $encoding =
'QRCODE';
453 if ($module->encodingIsSupported($encoding)) {
454 $result = $module->writeBarCode(
$object->ref, $encoding);
458 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
459 $newcode =
dol_hash($newcode,
'md5');
461 $barcode_path =
$conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
467 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
469 $nexY = $pdf->GetY();
470 $height_barcode = 20;
474 $this->error =
'Failed to generate barcode';
478 $iniY = $tab_top + 7;
479 $curY = $tab_top + 7;
480 $nexY = $tab_top + 7;
482 $TCacheEntrepots = array();
484 for ($i = 0; $i < $nblines; $i++) {
486 $pdf->SetFont(
'',
'', $default_font_size - 1);
487 $pdf->SetTextColor(0, 0, 0);
490 $imglinesize = array();
491 if (!empty($realpatharray[$i])) {
495 $pdf->setTopMargin($tab_top_newpage);
496 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
497 $pageposbefore = $pdf->getPage();
499 $showpricebeforepagebreak = 1;
501 $posYAfterDescription = 0;
502 $heightforsignature = 0;
505 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
506 $pdf->AddPage(
'',
'',
true);
507 if (!empty($tplidx)) {
508 $pdf->useTemplate($tplidx);
513 $pdf->setPage($pageposbefore + 1);
515 $curY = $tab_top_newpage;
519 $showpricebeforepagebreak = 1;
521 $showpricebeforepagebreak = 0;
525 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
526 $curX = $this->posxpicture - 1;
527 $pdf->Image($realpatharray[$i], $curX + (($this->posxqty - $this->posxweightvol - $imglinesize[
'width']
528 + (
getDolGlobalString(
'STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME') ?
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20) : 0)) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
530 $posYAfterImage = $curY + $imglinesize[
'height'];
534 $curX = $this->posxdesc - 1;
536 $pdf->startTransaction();
537 if (method_exists(
$object->lines[$i],
'fetch_product')) {
538 $object->lines[$i]->fetch_product();
540 $object->lines[$i]->description =
$object->lines[$i]->product->description;
542 $object->lines[$i]->weight_units =
$object->lines[$i]->product->weight_units;
544 $object->lines[$i]->length_units =
$object->lines[$i]->product->length_units;
545 $object->lines[$i]->surface =
$object->lines[$i]->product->surface;
546 $object->lines[$i]->surface_units =
$object->lines[$i]->product->surface_units;
548 $object->lines[$i]->volume_units =
$object->lines[$i]->product->volume_units;
549 $object->lines[$i]->fk_unit =
$object->lines[$i]->product->fk_unit;
553 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
555 $pageposafter = $pdf->getPage();
556 if ($pageposafter > $pageposbefore) {
557 $pdf->rollbackTransaction(
true);
558 $pageposafter = $pageposbefore;
560 $pdf->setPageOrientation(
'',
true, $heightforfooter);
561 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
563 $pageposafter = $pdf->getPage();
564 $posyafter = $pdf->GetY();
566 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
567 if ($i == ($nblines - 1)) {
568 $pdf->AddPage(
'',
'',
true);
569 if (!empty($tplidx)) {
570 $pdf->useTemplate($tplidx);
575 $pdf->setPage($pageposafter + 1);
582 $showpricebeforepagebreak = 1;
584 $showpricebeforepagebreak = 0;
588 $pdf->commitTransaction();
590 $posYAfterDescription = $pdf->GetY();
592 $nexY = max($pdf->GetY(), $posYAfterImage);
593 $pageposafter = $pdf->getPage();
595 $pdf->setPage($pageposbefore);
596 $pdf->setTopMargin($this->marge_haute);
597 $pdf->setPageOrientation(
'',
true, 0);
600 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
601 $pdf->setPage($pageposafter);
602 $curY = $tab_top_newpage;
606 if ($pageposafter > $pageposbefore) {
607 $pdf->setPage($pageposafter);
608 $curY = $tab_top_newpage;
611 $pdf->SetFont(
'',
'', $default_font_size - 1);
614 if (isModEnabled(
'productbatch')) {
615 $pdf->SetXY($this->posxlot, $curY);
616 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 3,
$object->lines[$i]->batch,
'',
'C');
621 $pdf->SetXY($this->posxweightvol, $curY);
623 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
627 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
633 $pdf->writeHTMLCell($this->posxqty - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
638 $pdf->SetXY($this->posxqty, $curY);
639 $pdf->writeHTMLCell($this->posxwarehousesource - $this->posxqty + 2, 3, $this->posxqty - 1, $curY, (
string)
$object->lines[$i]->qty, 0, 0,
false,
true,
'C');
643 $wh_source =
new Entrepot($this->db);
644 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source])) {
645 $wh_source = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source];
647 $wh_source->fetch(
$object->lines[$i]->fk_warehouse_source);
648 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source] = $wh_source;
650 $pdf->SetXY($this->posxwarehousesource, $curY);
651 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 3, $wh_source->ref.(!empty($wh_source->lieu) ?
' - '.$wh_source->lieu :
''),
'',
'C');
654 $wh_destination =
new Entrepot($this->db);
655 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination])) {
656 $wh_destination = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination];
658 $wh_destination->fetch(
$object->lines[$i]->fk_warehouse_destination);
659 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination] = $wh_destination;
661 $pdf->SetXY($this->posxwarehousedestination, $curY);
662 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination), 3, $wh_destination->ref.(!empty($wh_destination->lieu) ?
' - '.$wh_destination->lieu :
''),
'',
'C');
665 $pdf->SetXY($this->posxpuht, $curY);
666 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
668 $pdf->SetXY($this->posxtotalht, $curY);
669 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price(
$object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
673 if ($weighttxt && $voltxt) {
679 $pdf->setPage($pageposafter);
680 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
682 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
683 $pdf->SetLineStyle(array(
'dash' => 0));
687 while ($pagenb < $pageposafter) {
688 $pdf->setPage($pagenb);
690 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
692 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
696 $pdf->setPage($pagenb);
697 $pdf->setPageOrientation(
'',
true, 0);
701 if (!empty($tplidx)) {
702 $pdf->useTemplate($tplidx);
705 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
707 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
709 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
714 if (!empty($tplidx)) {
715 $pdf->useTemplate($tplidx);
726 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
727 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
729 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
730 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
738 if (method_exists($pdf,
'AliasNbPages')) {
739 $pdf->AliasNbPages();
744 $pdf->Output($file,
'F');
747 $hookmanager->initHooks(array(
'pdfgeneration'));
748 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
750 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
752 $this->error = $hookmanager->error;
753 $this->errors = $hookmanager->errors;
758 $this->result = array(
'fullpath' => $file);
762 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
766 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"STOCKTRANSFER_OUTPUTDIR");
898 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
912 $pdf->SetTextColor(0, 0, 0);
913 $pdf->SetFont(
'',
'', $default_font_size - 2);
916 $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');
918 $pdf->SetDrawColor(128, 128, 128);
919 $pdf->SetFont(
'',
'', $default_font_size - 1);
922 if (empty($hidetop)) {
923 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
925 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
926 $pdf->MultiCell($this->posxlot - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
930 $pdf->line($this->posxlot - 1, $tab_top, $this->posxlot - 1, $tab_top + $tab_height);
931 if (empty($hidetop)) {
932 $pdf->SetXY($this->posxlot, $tab_top + 1);
933 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 2, $outputlangs->transnoentities(
"Batch"),
'',
'C');
938 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
939 if (empty($hidetop)) {
940 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
941 $pdf->MultiCell(($this->posxqty - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
945 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
946 if (empty($hidetop)) {
947 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
948 $pdf->MultiCell(($this->posxwarehousesource - $this->posxqty), 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
951 $pdf->line($this->posxwarehousesource - 1, $tab_top, $this->posxwarehousesource - 1, $tab_top + $tab_height);
952 if (empty($hidetop)) {
953 $pdf->SetXY($this->posxwarehousesource - 1, $tab_top + 1);
954 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 2, $outputlangs->transnoentities(
"WarehouseSource"),
'',
'C');
958 $pdf->line($this->posxwarehousedestination - 1, $tab_top, $this->posxwarehousedestination - 1, $tab_top + $tab_height);
959 if (empty($hidetop)) {
960 $pdf->SetXY($this->posxwarehousedestination - 2.5, $tab_top + 1);
961 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination + 4), 2, $outputlangs->transnoentities(
"WarehouseTarget"),
'',
'C');
1019 global
$conf, $langs;
1022 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1030 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm',
$conf->global->SHIPPING_DRAFT_WATERMARK);
1034 $pdf->SetTextColor(0, 0, 60);
1035 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1039 $posy = $this->marge_haute;
1040 $posx = $this->page_largeur - $this->marge_droite - $w;
1042 $pdf->SetXY($this->marge_gauche, $posy);
1045 $logo =
$conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1046 if ($this->emetteur->logo) {
1047 if (is_readable($logo)) {
1049 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1051 $pdf->SetTextColor(200, 0, 0);
1052 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1053 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1054 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1057 $text = $this->emetteur->name;
1058 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1061 $pdf->SetDrawColor(128, 128, 128);
1063 $posx = $this->page_largeur - $w - $this->marge_droite;
1064 $posy = $this->marge_haute;
1066 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1067 $pdf->SetXY($posx, $posy);
1068 $pdf->SetTextColor(0, 0, 60);
1069 $title = $outputlangs->transnoentities(
"StockTransferSheet").
' '.
$object->ref;
1070 $pdf->MultiCell($w, 4, $title,
'',
'R');
1072 $pdf->SetFont(
'',
'', $default_font_size + 1);
1075 if (!empty(
$object->date_prevue_depart)) {
1077 $pdf->SetXY($posx, $posy);
1078 $pdf->SetTextColor(0, 0, 60);
1079 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date(
$object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1083 if (!empty(
$object->date_prevue_arrivee)) {
1085 $pdf->SetXY($posx, $posy);
1086 $pdf->SetTextColor(0, 0, 60);
1087 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date(
$object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1091 if (!empty(
$object->date_reelle_depart)) {
1093 $pdf->SetXY($posx, $posy);
1094 $pdf->SetTextColor(0, 0, 60);
1095 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date(
$object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1099 if (!empty(
$object->date_reelle_arrivee)) {
1101 $pdf->SetXY($posx, $posy);
1102 $pdf->SetTextColor(0, 0, 60);
1103 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date(
$object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1106 if (!empty(
$object->thirdparty->code_client)) {
1108 $pdf->SetXY($posx, $posy);
1109 $pdf->SetTextColor(0, 0, 60);
1110 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1114 $pdf->SetFont(
'',
'', $default_font_size + 3);
1119 $origin_id =
$object->origin_id;
1122 if (isModEnabled($origin)) {
1123 $outputlangs->load(
'orders');
1125 $classname = ucfirst($origin);
1126 $linkedobject =
new $classname($this->db);
1127 '@phan-var-force CommonObject $linkedobject';
1128 $result = $linkedobject->fetch($origin_id);
1132 $pdf->SetFont(
'',
'', $default_font_size - 2);
1133 $text = $linkedobject->ref;
1134 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1135 $text .=
' ('.$linkedobject->ref_client.
')';
1138 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1139 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1141 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1142 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1150 $carac_emetteur =
'';
1152 $arrayidcontact = array();
1153 $arrayidcontact =
$object->getIdContact(
'external',
'STFROM');
1155 $usecontact =
false;
1156 if (count($arrayidcontact) > 0) {
1160 $result =
$object->fetch_contact($arrayidcontact[0]);
1164 $thirdparty =
$object->contact;
1166 $thirdparty = $this->emetteur;
1169 if (!empty($thirdparty)) {
1172 $carac_emetteur_name =
'';
1183 $posx = $this->marge_gauche;
1185 $posx = $this->page_largeur - $this->marge_droite - 80;
1192 $pdf->SetTextColor(0, 0, 0);
1193 $pdf->SetFont(
'',
'', $default_font_size - 2);
1194 $pdf->SetXY($posx, $posy - 5);
1195 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1196 $pdf->SetXY($posx, $posy);
1197 $pdf->SetFillColor(230, 230, 230);
1198 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'F');
1199 $pdf->SetTextColor(0, 0, 60);
1200 $pdf->SetFillColor(255, 255, 255);
1203 $pdf->SetXY($posx + 2, $posy + 3);
1204 $pdf->SetFont(
'',
'B', $default_font_size);
1205 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1206 $posy = $pdf->getY();
1209 $pdf->SetXY($posx + 2, $posy);
1210 $pdf->SetFont(
'',
'', $default_font_size - 1);
1211 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1215 $usecontact =
false;
1216 $arrayidcontact =
$object->getIdContact(
'external',
'STDEST');
1217 if (count($arrayidcontact) > 0) {
1219 $result =
$object->fetch_contact($arrayidcontact[0]);
1225 $thirdparty =
$object->contact;
1227 $thirdparty =
$object->thirdparty;
1230 $carac_client_name =
'';
1231 if (!empty($thirdparty)) {
1239 if ($this->page_largeur < 210) {
1243 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1245 $posx = $this->marge_gauche;
1249 $pdf->SetTextColor(0, 0, 0);
1250 $pdf->SetFont(
'',
'', $default_font_size - 2);
1251 $pdf->SetXY($posx + 2, $posy - 5);
1252 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1253 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1256 $pdf->SetXY($posx + 2, $posy + 3);
1257 $pdf->SetFont(
'',
'B', $default_font_size);
1258 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1260 $posy = $pdf->getY();
1263 $pdf->SetXY($posx + 2, $posy);
1264 $pdf->SetFont(
'',
'', $default_font_size - 1);
1265 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1268 $pdf->SetTextColor(0, 0, 0);