185 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
188 global $user,
$conf, $langs, $hookmanager;
194 if (!is_object($outputlangs)) {
195 $outputlangs = $langs;
199 $outputlangs->charset_output =
'ISO-8859-1';
203 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"stocks",
"stocktransfer@stocktransfer"));
205 global $outputlangsbis;
206 $outputlangsbis =
null;
210 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
216 $realpatharray = array();
217 $this->atleastonephoto =
false;
219 $objphoto =
new Product($this->db);
221 for ($i = 0; $i < $nblines; $i++) {
222 if (empty(
$object->lines[$i]->fk_product)) {
226 $objphoto =
new Product($this->db);
227 $objphoto->fetch(
$object->lines[$i]->fk_product);
229 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
230 $dir =
$conf->product->dir_output.
'/'.$pdir;
232 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
233 $dir =
$conf->product->dir_output.
'/'.$pdir;
238 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
241 if ($obj[
'photo_vignette']) {
242 $filename = $obj[
'photo_vignette'];
244 $filename = $obj[
'photo'];
247 $filename = $obj[
'photo'];
250 $realpath = $dir.$filename;
251 $this->atleastonephoto =
true;
256 $realpatharray[$i] = $realpath;
261 if (count($realpatharray) == 0) {
262 $this->posxpicture = $this->posxweightvol;
267 $this->posxpicture = $this->posxlot;
269 $this->posxpicture -=
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20);
273 if (
$conf->stocktransfer->dir_output) {
276 $dir =
$conf->stocktransfer->dir_output;
277 $file = $dir.
"/SPECIMEN.pdf";
280 $dir =
$conf->stocktransfer->dir_output.
'/'.
$object->element.
"/".$stocktransferref;
281 $file = $dir.
"/".$stocktransferref.
".pdf";
284 if (!file_exists($dir)) {
286 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
291 if (file_exists($dir)) {
293 if (!is_object($hookmanager)) {
294 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
297 $hookmanager->initHooks(array(
'pdfgeneration'));
298 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
300 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
307 $heightforinfotot = 8;
309 $heightforfooter = $this->marge_basse + 8;
311 $heightforfooter += 6;
313 $pdf->SetAutoPageBreak(1, 0);
315 if (class_exists(
'TCPDF')) {
316 $pdf->setPrintHeader(
false);
317 $pdf->setPrintFooter(
false);
322 $pagecount = $pdf->setSourceFile(
$conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
323 $tplidx = $pdf->importPage(1);
328 $pdf->SetDrawColor(128, 128, 128);
330 if (method_exists($pdf,
'AliasNbPages')) {
331 $pdf->AliasNbPages();
334 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
335 $pdf->SetSubject($outputlangs->transnoentities(
"StockTransfer"));
336 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
337 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
338 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"StockTransfer"));
340 $pdf->SetCompression(
false);
344 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
348 if (!empty($tplidx)) {
349 $pdf->useTemplate($tplidx);
353 $pdf->SetFont(
'',
'', $default_font_size - 1);
354 $pdf->MultiCell(0, 3,
'');
355 $pdf->SetTextColor(0, 0, 0);
358 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
360 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
362 $tab_height_newpage = 150;
365 $height_incoterms = 0;
366 if (isModEnabled(
'incoterm')) {
367 $desc_incoterms =
$object->getIncotermsForPDF();
368 if ($desc_incoterms) {
371 $pdf->SetFont(
'',
'', $default_font_size - 1);
372 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
373 $nexY = $pdf->GetY();
374 $height_incoterms = $nexY - $tab_top;
377 $pdf->SetDrawColor(192, 192, 192);
378 $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');
380 $tab_top = $nexY + 6;
381 $height_incoterms += 4;
386 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
387 $tab_top_alt = $tab_top;
392 if (!empty(
$object->tracking_number)) {
393 $height_trackingnumber = 4;
395 $pdf->SetFont(
'',
'B', $default_font_size - 2);
396 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
397 $tab_top_alt = $pdf->GetY();
400 if (!empty(
$object->tracking_url)) {
401 if (
$object->shipping_method_id > 0) {
403 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
406 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
408 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
412 $label .=
$object->tracking_url;
415 $height_trackingnumber += 4;
416 $pdf->SetFont(
'',
'B', $default_font_size - 2);
417 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
420 $tab_top = $pdf->GetY();
424 if (!empty(
$object->note_public)) {
425 $pdf->SetFont(
'',
'', $default_font_size - 1);
429 $nexY = $pdf->GetY();
430 $height_note = $nexY - $tab_top;
433 $pdf->SetDrawColor(192, 192, 192);
434 $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');
436 $tab_height -= $height_note;
437 $tab_top = $nexY + 6;
446 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
448 $encoding =
'QRCODE';
452 if ($module->encodingIsSupported($encoding)) {
453 $result = $module->writeBarCode(
$object->ref, $encoding);
457 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
458 $newcode =
dol_hash($newcode,
'md5');
460 $barcode_path =
$conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
466 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
468 $nexY = $pdf->GetY();
469 $height_barcode = 20;
473 $this->error =
'Failed to generate barcode';
477 $iniY = $tab_top + 7;
478 $curY = $tab_top + 7;
479 $nexY = $tab_top + 7;
481 $TCacheEntrepots = array();
483 for ($i = 0; $i < $nblines; $i++) {
485 $pdf->SetFont(
'',
'', $default_font_size - 1);
486 $pdf->SetTextColor(0, 0, 0);
489 $imglinesize = array();
490 if (!empty($realpatharray[$i])) {
494 $pdf->setTopMargin($tab_top_newpage);
495 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
496 $pageposbefore = $pdf->getPage();
498 $showpricebeforepagebreak = 1;
500 $posYAfterDescription = 0;
501 $heightforsignature = 0;
504 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
505 $pdf->AddPage(
'',
'',
true);
506 if (!empty($tplidx)) {
507 $pdf->useTemplate($tplidx);
512 $pdf->setPage($pageposbefore + 1);
514 $curY = $tab_top_newpage;
518 $showpricebeforepagebreak = 1;
520 $showpricebeforepagebreak = 0;
524 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
525 $curX = $this->posxpicture - 1;
526 $pdf->Image($realpatharray[$i], $curX + (($this->posxqty - $this->posxweightvol - $imglinesize[
'width']
527 + (
getDolGlobalString(
'STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME') ?
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20) : 0)) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
529 $posYAfterImage = $curY + $imglinesize[
'height'];
533 $curX = $this->posxdesc - 1;
535 $pdf->startTransaction();
536 if (method_exists(
$object->lines[$i],
'fetch_product')) {
537 $object->lines[$i]->fetch_product();
539 $object->lines[$i]->description =
$object->lines[$i]->product->description;
541 $object->lines[$i]->weight_units =
$object->lines[$i]->product->weight_units;
543 $object->lines[$i]->length_units =
$object->lines[$i]->product->length_units;
544 $object->lines[$i]->surface =
$object->lines[$i]->product->surface;
545 $object->lines[$i]->surface_units =
$object->lines[$i]->product->surface_units;
547 $object->lines[$i]->volume_units =
$object->lines[$i]->product->volume_units;
548 $object->lines[$i]->fk_unit =
$object->lines[$i]->product->fk_unit;
552 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
554 $pageposafter = $pdf->getPage();
555 if ($pageposafter > $pageposbefore) {
556 $pdf->rollbackTransaction(
true);
557 $pageposafter = $pageposbefore;
559 $pdf->setPageOrientation(
'', 1, $heightforfooter);
560 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
562 $pageposafter = $pdf->getPage();
563 $posyafter = $pdf->GetY();
565 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
566 if ($i == ($nblines - 1)) {
567 $pdf->AddPage(
'',
'',
true);
568 if (!empty($tplidx)) {
569 $pdf->useTemplate($tplidx);
574 $pdf->setPage($pageposafter + 1);
581 $showpricebeforepagebreak = 1;
583 $showpricebeforepagebreak = 0;
587 $pdf->commitTransaction();
589 $posYAfterDescription = $pdf->GetY();
591 $nexY = max($pdf->GetY(), $posYAfterImage);
592 $pageposafter = $pdf->getPage();
594 $pdf->setPage($pageposbefore);
595 $pdf->setTopMargin($this->marge_haute);
596 $pdf->setPageOrientation(
'', 1, 0);
599 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
600 $pdf->setPage($pageposafter);
601 $curY = $tab_top_newpage;
605 if ($pageposafter > $pageposbefore) {
606 $pdf->setPage($pageposafter);
607 $curY = $tab_top_newpage;
610 $pdf->SetFont(
'',
'', $default_font_size - 1);
613 if (isModEnabled(
'productbatch')) {
614 $pdf->SetXY($this->posxlot, $curY);
615 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 3,
$object->lines[$i]->batch,
'',
'C');
620 $pdf->SetXY($this->posxweightvol, $curY);
622 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
626 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
632 $pdf->writeHTMLCell($this->posxqty - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
637 $pdf->SetXY($this->posxqty, $curY);
638 $pdf->writeHTMLCell($this->posxwarehousesource - $this->posxqty + 2, 3, $this->posxqty - 1, $curY,
$object->lines[$i]->qty, 0, 0,
false,
true,
'C');
642 $wh_source =
new Entrepot($this->db);
643 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source])) {
644 $wh_source = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source];
646 $wh_source->fetch(
$object->lines[$i]->fk_warehouse_source);
647 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source] = $wh_source;
649 $pdf->SetXY($this->posxwarehousesource, $curY);
650 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 3, $wh_source->ref.(!empty($wh_source->lieu) ?
' - '.$wh_source->lieu :
''),
'',
'C');
653 $wh_destination =
new Entrepot($this->db);
654 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination])) {
655 $wh_destination = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination];
657 $wh_destination->fetch(
$object->lines[$i]->fk_warehouse_destination);
658 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination] = $wh_destination;
660 $pdf->SetXY($this->posxwarehousedestination, $curY);
661 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination), 3, $wh_destination->ref.(!empty($wh_destination->lieu) ?
' - '.$wh_destination->lieu :
''),
'',
'C');
664 $pdf->SetXY($this->posxpuht, $curY);
665 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
667 $pdf->SetXY($this->posxtotalht, $curY);
668 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price(
$object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
672 if ($weighttxt && $voltxt) {
678 $pdf->setPage($pageposafter);
679 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
681 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
682 $pdf->SetLineStyle(array(
'dash' => 0));
686 while ($pagenb < $pageposafter) {
687 $pdf->setPage($pagenb);
689 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
691 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
695 $pdf->setPage($pagenb);
696 $pdf->setPageOrientation(
'', 1, 0);
700 if (!empty($tplidx)) {
701 $pdf->useTemplate($tplidx);
704 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
706 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
708 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
713 if (!empty($tplidx)) {
714 $pdf->useTemplate($tplidx);
725 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
726 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
728 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
729 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
737 if (method_exists($pdf,
'AliasNbPages')) {
738 $pdf->AliasNbPages();
743 $pdf->Output($file,
'F');
746 $hookmanager->initHooks(array(
'pdfgeneration'));
747 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
749 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
751 $this->error = $hookmanager->error;
752 $this->errors = $hookmanager->errors;
757 $this->result = array(
'fullpath' => $file);
761 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
765 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"STOCKTRANSFER_OUTPUTDIR");
897 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
911 $pdf->SetTextColor(0, 0, 0);
912 $pdf->SetFont(
'',
'', $default_font_size - 2);
915 $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');
917 $pdf->SetDrawColor(128, 128, 128);
918 $pdf->SetFont(
'',
'', $default_font_size - 1);
921 if (empty($hidetop)) {
922 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
924 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
925 $pdf->MultiCell($this->posxlot - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
929 $pdf->line($this->posxlot - 1, $tab_top, $this->posxlot - 1, $tab_top + $tab_height);
930 if (empty($hidetop)) {
931 $pdf->SetXY($this->posxlot, $tab_top + 1);
932 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 2, $outputlangs->transnoentities(
"Batch"),
'',
'C');
937 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
938 if (empty($hidetop)) {
939 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
940 $pdf->MultiCell(($this->posxqty - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
944 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
945 if (empty($hidetop)) {
946 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
947 $pdf->MultiCell(($this->posxwarehousesource - $this->posxqty), 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
950 $pdf->line($this->posxwarehousesource - 1, $tab_top, $this->posxwarehousesource - 1, $tab_top + $tab_height);
951 if (empty($hidetop)) {
952 $pdf->SetXY($this->posxwarehousesource - 1, $tab_top + 1);
953 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 2, $outputlangs->transnoentities(
"WarehouseSource"),
'',
'C');
957 $pdf->line($this->posxwarehousedestination - 1, $tab_top, $this->posxwarehousedestination - 1, $tab_top + $tab_height);
958 if (empty($hidetop)) {
959 $pdf->SetXY($this->posxwarehousedestination - 2.5, $tab_top + 1);
960 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination + 4), 2, $outputlangs->transnoentities(
"WarehouseTarget"),
'',
'C');
1018 global
$conf, $langs;
1021 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1029 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm',
$conf->global->SHIPPING_DRAFT_WATERMARK);
1033 $pdf->SetTextColor(0, 0, 60);
1034 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1038 $posy = $this->marge_haute;
1039 $posx = $this->page_largeur - $this->marge_droite - $w;
1041 $pdf->SetXY($this->marge_gauche, $posy);
1044 $logo =
$conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1045 if ($this->emetteur->logo) {
1046 if (is_readable($logo)) {
1048 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1050 $pdf->SetTextColor(200, 0, 0);
1051 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1052 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1053 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1056 $text = $this->emetteur->name;
1057 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1060 $pdf->SetDrawColor(128, 128, 128);
1062 $posx = $this->page_largeur - $w - $this->marge_droite;
1063 $posy = $this->marge_haute;
1065 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1066 $pdf->SetXY($posx, $posy);
1067 $pdf->SetTextColor(0, 0, 60);
1068 $title = $outputlangs->transnoentities(
"StockTransferSheet").
' '.
$object->ref;
1069 $pdf->MultiCell($w, 4, $title,
'',
'R');
1071 $pdf->SetFont(
'',
'', $default_font_size + 1);
1074 if (!empty(
$object->date_prevue_depart)) {
1076 $pdf->SetXY($posx, $posy);
1077 $pdf->SetTextColor(0, 0, 60);
1078 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date(
$object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1082 if (!empty(
$object->date_prevue_arrivee)) {
1084 $pdf->SetXY($posx, $posy);
1085 $pdf->SetTextColor(0, 0, 60);
1086 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date(
$object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1090 if (!empty(
$object->date_reelle_depart)) {
1092 $pdf->SetXY($posx, $posy);
1093 $pdf->SetTextColor(0, 0, 60);
1094 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date(
$object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1098 if (!empty(
$object->date_reelle_arrivee)) {
1100 $pdf->SetXY($posx, $posy);
1101 $pdf->SetTextColor(0, 0, 60);
1102 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date(
$object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1105 if (!empty(
$object->thirdparty->code_client)) {
1107 $pdf->SetXY($posx, $posy);
1108 $pdf->SetTextColor(0, 0, 60);
1109 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1113 $pdf->SetFont(
'',
'', $default_font_size + 3);
1118 $origin_id =
$object->origin_id;
1121 if (isModEnabled($origin)) {
1122 $outputlangs->load(
'orders');
1124 $classname = ucfirst($origin);
1125 $linkedobject =
new $classname($this->db);
1126 '@phan-var-force CommonObject $linkedobject';
1127 $result = $linkedobject->fetch($origin_id);
1131 $pdf->SetFont(
'',
'', $default_font_size - 2);
1132 $text = $linkedobject->ref;
1133 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1134 $text .=
' ('.$linkedobject->ref_client.
')';
1137 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1138 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1140 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1141 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1149 $carac_emetteur =
'';
1151 $arrayidcontact = array();
1152 $arrayidcontact =
$object->getIdContact(
'external',
'STFROM');
1154 $usecontact =
false;
1155 if (count($arrayidcontact) > 0) {
1159 $result =
$object->fetch_contact($arrayidcontact[0]);
1163 $thirdparty =
$object->contact;
1165 $thirdparty = $this->emetteur;
1168 if (!empty($thirdparty)) {
1180 $posx = $this->marge_gauche;
1182 $posx = $this->page_largeur - $this->marge_droite - 80;
1189 $pdf->SetTextColor(0, 0, 0);
1190 $pdf->SetFont(
'',
'', $default_font_size - 2);
1191 $pdf->SetXY($posx, $posy - 5);
1192 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1193 $pdf->SetXY($posx, $posy);
1194 $pdf->SetFillColor(230, 230, 230);
1195 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'F');
1196 $pdf->SetTextColor(0, 0, 60);
1197 $pdf->SetFillColor(255, 255, 255);
1200 $pdf->SetXY($posx + 2, $posy + 3);
1201 $pdf->SetFont(
'',
'B', $default_font_size);
1202 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1203 $posy = $pdf->getY();
1206 $pdf->SetXY($posx + 2, $posy);
1207 $pdf->SetFont(
'',
'', $default_font_size - 1);
1208 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1212 $usecontact =
false;
1213 $arrayidcontact =
$object->getIdContact(
'external',
'STDEST');
1214 if (count($arrayidcontact) > 0) {
1216 $result =
$object->fetch_contact($arrayidcontact[0]);
1222 $thirdparty =
$object->contact;
1224 $thirdparty =
$object->thirdparty;
1227 $carac_client_name =
'';
1228 if (!empty($thirdparty)) {
1236 if ($this->page_largeur < 210) {
1240 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1242 $posx = $this->marge_gauche;
1246 $pdf->SetTextColor(0, 0, 0);
1247 $pdf->SetFont(
'',
'', $default_font_size - 2);
1248 $pdf->SetXY($posx + 2, $posy - 5);
1249 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1250 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1253 $pdf->SetXY($posx + 2, $posy + 3);
1254 $pdf->SetFont(
'',
'B', $default_font_size);
1255 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1257 $posy = $pdf->getY();
1260 $pdf->SetXY($posx + 2, $posy);
1261 $pdf->SetFont(
'',
'', $default_font_size - 1);
1262 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1265 $pdf->SetTextColor(0, 0, 0);