184 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
187 global $user, $conf, $langs, $hookmanager;
193 if (!is_object($outputlangs)) {
194 $outputlangs = $langs;
198 $outputlangs->charset_output =
'ISO-8859-1';
202 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"stocks",
"stocktransfer@stocktransfer"));
204 global $outputlangsbis;
205 $outputlangsbis =
null;
207 $outputlangsbis =
new Translate(
'', $conf);
209 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
215 $realpatharray = array();
216 $this->atleastonephoto =
false;
218 $objphoto =
new Product($this->db);
220 for ($i = 0; $i < $nblines; $i++) {
221 if (empty(
$object->lines[$i]->fk_product)) {
225 $objphoto =
new Product($this->db);
226 $objphoto->fetch(
$object->lines[$i]->fk_product);
228 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
229 $dir = $conf->product->dir_output.
'/'.$pdir;
231 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
232 $dir = $conf->product->dir_output.
'/'.$pdir;
237 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
240 if ($obj[
'photo_vignette']) {
241 $filename = $obj[
'photo_vignette'];
243 $filename = $obj[
'photo'];
246 $filename = $obj[
'photo'];
249 $realpath = $dir.$filename;
250 $this->atleastonephoto =
true;
255 $realpatharray[$i] = $realpath;
260 if (count($realpatharray) == 0) {
261 $this->posxpicture = $this->posxweightvol;
266 $this->posxpicture = $this->posxlot;
268 $this->posxpicture -=
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20);
272 if ($conf->stocktransfer->dir_output) {
275 $dir = $conf->stocktransfer->dir_output;
276 $file = $dir.
"/SPECIMEN.pdf";
279 $dir = $conf->stocktransfer->dir_output.
'/'.
$object->element.
"/".$stocktransferref;
280 $file = $dir.
"/".$stocktransferref.
".pdf";
283 if (!file_exists($dir)) {
285 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
290 if (file_exists($dir)) {
292 if (!is_object($hookmanager)) {
293 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
296 $hookmanager->initHooks(array(
'pdfgeneration'));
297 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
299 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
306 $heightforinfotot = 8;
308 $heightforfooter = $this->marge_basse + 8;
310 $heightforfooter += 6;
312 $pdf->SetAutoPageBreak(1, 0);
314 if (class_exists(
'TCPDF')) {
315 $pdf->setPrintHeader(
false);
316 $pdf->setPrintFooter(
false);
321 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
322 $tplidx = $pdf->importPage(1);
327 $pdf->SetDrawColor(128, 128, 128);
329 if (method_exists($pdf,
'AliasNbPages')) {
330 $pdf->AliasNbPages();
333 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
334 $pdf->SetSubject($outputlangs->transnoentities(
"StockTransfer"));
335 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
336 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
337 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"StockTransfer"));
339 $pdf->SetCompression(
false);
343 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
347 if (!empty($tplidx)) {
348 $pdf->useTemplate($tplidx);
352 $pdf->SetFont(
'',
'', $default_font_size - 1);
353 $pdf->MultiCell(0, 3,
'');
354 $pdf->SetTextColor(0, 0, 0);
357 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
359 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
361 $tab_height_newpage = 150;
364 $height_incoterms = 0;
365 if (isModEnabled(
'incoterm')) {
366 $desc_incoterms =
$object->getIncotermsForPDF();
367 if ($desc_incoterms) {
370 $pdf->SetFont(
'',
'', $default_font_size - 1);
371 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
372 $nexY = $pdf->GetY();
373 $height_incoterms = $nexY - $tab_top;
376 $pdf->SetDrawColor(192, 192, 192);
377 $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');
379 $tab_top = $nexY + 6;
380 $height_incoterms += 4;
385 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
386 $tab_top_alt = $tab_top;
391 if (!empty(
$object->tracking_number)) {
392 $height_trackingnumber = 4;
394 $pdf->SetFont(
'',
'B', $default_font_size - 2);
395 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
396 $tab_top_alt = $pdf->GetY();
399 if (!empty(
$object->tracking_url)) {
400 if (
$object->shipping_method_id > 0) {
402 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
405 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
407 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
411 $label .=
$object->tracking_url;
414 $height_trackingnumber += 4;
415 $pdf->SetFont(
'',
'B', $default_font_size - 2);
416 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
419 $tab_top = $pdf->GetY();
423 if (!empty(
$object->note_public)) {
424 $pdf->SetFont(
'',
'', $default_font_size - 1);
428 $nexY = $pdf->GetY();
429 $height_note = $nexY - $tab_top;
432 $pdf->SetDrawColor(192, 192, 192);
433 $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');
435 $tab_height -= $height_note;
436 $tab_top = $nexY + 6;
445 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
447 $encoding =
'QRCODE';
451 if ($module->encodingIsSupported($encoding)) {
452 $result = $module->writeBarCode(
$object->ref, $encoding);
456 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
457 $newcode =
dol_hash($newcode,
'md5');
459 $barcode_path = $conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
465 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
467 $nexY = $pdf->GetY();
468 $height_barcode = 20;
472 $this->error =
'Failed to generate barcode';
476 $iniY = $tab_top + 7;
477 $curY = $tab_top + 7;
478 $nexY = $tab_top + 7;
480 $TCacheEntrepots = array();
482 for ($i = 0; $i < $nblines; $i++) {
484 $pdf->SetFont(
'',
'', $default_font_size - 1);
485 $pdf->SetTextColor(0, 0, 0);
488 $imglinesize = array();
489 if (!empty($realpatharray[$i])) {
493 $pdf->setTopMargin($tab_top_newpage);
494 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
495 $pageposbefore = $pdf->getPage();
497 $showpricebeforepagebreak = 1;
499 $posYAfterDescription = 0;
500 $heightforsignature = 0;
503 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
504 $pdf->AddPage(
'',
'',
true);
505 if (!empty($tplidx)) {
506 $pdf->useTemplate($tplidx);
511 $pdf->setPage($pageposbefore + 1);
513 $curY = $tab_top_newpage;
517 $showpricebeforepagebreak = 1;
519 $showpricebeforepagebreak = 0;
523 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
524 $curX = $this->posxpicture - 1;
525 $pdf->Image($realpatharray[$i], $curX + (($this->posxqty - $this->posxweightvol - $imglinesize[
'width']
526 + (
getDolGlobalString(
'STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME') ?
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20) : 0)) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
528 $posYAfterImage = $curY + $imglinesize[
'height'];
532 $curX = $this->posxdesc - 1;
534 $pdf->startTransaction();
535 if (method_exists(
$object->lines[$i],
'fetch_product')) {
536 $object->lines[$i]->fetch_product();
538 $object->lines[$i]->description =
$object->lines[$i]->product->description;
540 $object->lines[$i]->weight_units =
$object->lines[$i]->product->weight_units;
542 $object->lines[$i]->length_units =
$object->lines[$i]->product->length_units;
543 $object->lines[$i]->surface =
$object->lines[$i]->product->surface;
544 $object->lines[$i]->surface_units =
$object->lines[$i]->product->surface_units;
546 $object->lines[$i]->volume_units =
$object->lines[$i]->product->volume_units;
547 $object->lines[$i]->fk_unit =
$object->lines[$i]->product->fk_unit;
551 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
553 $pageposafter = $pdf->getPage();
554 if ($pageposafter > $pageposbefore) {
555 $pdf->rollbackTransaction(
true);
556 $pageposafter = $pageposbefore;
558 $pdf->setPageOrientation(
'', 1, $heightforfooter);
559 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
561 $pageposafter = $pdf->getPage();
562 $posyafter = $pdf->GetY();
564 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
565 if ($i == ($nblines - 1)) {
566 $pdf->AddPage(
'',
'',
true);
567 if (!empty($tplidx)) {
568 $pdf->useTemplate($tplidx);
573 $pdf->setPage($pageposafter + 1);
580 $showpricebeforepagebreak = 1;
582 $showpricebeforepagebreak = 0;
586 $pdf->commitTransaction();
588 $posYAfterDescription = $pdf->GetY();
590 $nexY = max($pdf->GetY(), $posYAfterImage);
591 $pageposafter = $pdf->getPage();
593 $pdf->setPage($pageposbefore);
594 $pdf->setTopMargin($this->marge_haute);
595 $pdf->setPageOrientation(
'', 1, 0);
598 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
599 $pdf->setPage($pageposafter);
600 $curY = $tab_top_newpage;
604 if ($pageposafter > $pageposbefore) {
605 $pdf->setPage($pageposafter);
606 $curY = $tab_top_newpage;
609 $pdf->SetFont(
'',
'', $default_font_size - 1);
612 if (isModEnabled(
'productbatch')) {
613 $pdf->SetXY($this->posxlot, $curY);
614 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 3,
$object->lines[$i]->batch,
'',
'C');
619 $pdf->SetXY($this->posxweightvol, $curY);
621 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
625 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
631 $pdf->writeHTMLCell($this->posxqty - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
636 $pdf->SetXY($this->posxqty, $curY);
637 $pdf->writeHTMLCell($this->posxwarehousesource - $this->posxqty + 2, 3, $this->posxqty - 1, $curY,
$object->lines[$i]->qty, 0, 0,
false,
true,
'C');
641 $wh_source =
new Entrepot($this->db);
642 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source])) {
643 $wh_source = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source];
645 $wh_source->fetch(
$object->lines[$i]->fk_warehouse_source);
646 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source] = $wh_source;
648 $pdf->SetXY($this->posxwarehousesource, $curY);
649 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 3, $wh_source->ref.(!empty($wh_source->lieu) ?
' - '.$wh_source->lieu :
''),
'',
'C');
652 $wh_destination =
new Entrepot($this->db);
653 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination])) {
654 $wh_destination = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination];
656 $wh_destination->fetch(
$object->lines[$i]->fk_warehouse_destination);
657 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination] = $wh_destination;
659 $pdf->SetXY($this->posxwarehousedestination, $curY);
660 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination), 3, $wh_destination->ref.(!empty($wh_destination->lieu) ?
' - '.$wh_destination->lieu :
''),
'',
'C');
663 $pdf->SetXY($this->posxpuht, $curY);
664 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
666 $pdf->SetXY($this->posxtotalht, $curY);
667 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price(
$object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
671 if ($weighttxt && $voltxt) {
677 $pdf->setPage($pageposafter);
678 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
680 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
681 $pdf->SetLineStyle(array(
'dash' => 0));
685 while ($pagenb < $pageposafter) {
686 $pdf->setPage($pagenb);
688 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
690 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
694 $pdf->setPage($pagenb);
695 $pdf->setPageOrientation(
'', 1, 0);
699 if (!empty($tplidx)) {
700 $pdf->useTemplate($tplidx);
703 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
705 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
707 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
712 if (!empty($tplidx)) {
713 $pdf->useTemplate($tplidx);
724 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
725 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
727 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
728 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
736 if (method_exists($pdf,
'AliasNbPages')) {
737 $pdf->AliasNbPages();
742 $pdf->Output($file,
'F');
745 $hookmanager->initHooks(array(
'pdfgeneration'));
746 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
748 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
750 $this->error = $hookmanager->error;
751 $this->errors = $hookmanager->errors;
756 $this->result = array(
'fullpath' => $file);
760 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
764 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"STOCKTRANSFER_OUTPUTDIR");
896 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
910 $pdf->SetTextColor(0, 0, 0);
911 $pdf->SetFont(
'',
'', $default_font_size - 2);
914 $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');
916 $pdf->SetDrawColor(128, 128, 128);
917 $pdf->SetFont(
'',
'', $default_font_size - 1);
920 if (empty($hidetop)) {
921 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
923 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
924 $pdf->MultiCell($this->posxlot - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
928 $pdf->line($this->posxlot - 1, $tab_top, $this->posxlot - 1, $tab_top + $tab_height);
929 if (empty($hidetop)) {
930 $pdf->SetXY($this->posxlot, $tab_top + 1);
931 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 2, $outputlangs->transnoentities(
"Batch"),
'',
'C');
936 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
937 if (empty($hidetop)) {
938 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
939 $pdf->MultiCell(($this->posxqty - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
943 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
944 if (empty($hidetop)) {
945 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
946 $pdf->MultiCell(($this->posxwarehousesource - $this->posxqty), 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
949 $pdf->line($this->posxwarehousesource - 1, $tab_top, $this->posxwarehousesource - 1, $tab_top + $tab_height);
950 if (empty($hidetop)) {
951 $pdf->SetXY($this->posxwarehousesource - 1, $tab_top + 1);
952 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 2, $outputlangs->transnoentities(
"WarehouseSource"),
'',
'C');
956 $pdf->line($this->posxwarehousedestination - 1, $tab_top, $this->posxwarehousedestination - 1, $tab_top + $tab_height);
957 if (empty($hidetop)) {
958 $pdf->SetXY($this->posxwarehousedestination - 2.5, $tab_top + 1);
959 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination + 4), 2, $outputlangs->transnoentities(
"WarehouseTarget"),
'',
'C');
1017 global $conf, $langs;
1020 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1028 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->SHIPPING_DRAFT_WATERMARK);
1032 $pdf->SetTextColor(0, 0, 60);
1033 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1037 $posy = $this->marge_haute;
1038 $posx = $this->page_largeur - $this->marge_droite - $w;
1040 $pdf->SetXY($this->marge_gauche, $posy);
1043 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1044 if ($this->emetteur->logo) {
1045 if (is_readable($logo)) {
1047 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1049 $pdf->SetTextColor(200, 0, 0);
1050 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1051 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1052 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1055 $text = $this->emetteur->name;
1056 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1059 $pdf->SetDrawColor(128, 128, 128);
1061 $posx = $this->page_largeur - $w - $this->marge_droite;
1062 $posy = $this->marge_haute;
1064 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1065 $pdf->SetXY($posx, $posy);
1066 $pdf->SetTextColor(0, 0, 60);
1067 $title = $outputlangs->transnoentities(
"StockTransferSheet").
' '.
$object->ref;
1068 $pdf->MultiCell($w, 4, $title,
'',
'R');
1070 $pdf->SetFont(
'',
'', $default_font_size + 1);
1073 if (!empty(
$object->date_prevue_depart)) {
1075 $pdf->SetXY($posx, $posy);
1076 $pdf->SetTextColor(0, 0, 60);
1077 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date(
$object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1081 if (!empty(
$object->date_prevue_arrivee)) {
1083 $pdf->SetXY($posx, $posy);
1084 $pdf->SetTextColor(0, 0, 60);
1085 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date(
$object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1089 if (!empty(
$object->date_reelle_depart)) {
1091 $pdf->SetXY($posx, $posy);
1092 $pdf->SetTextColor(0, 0, 60);
1093 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date(
$object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1097 if (!empty(
$object->date_reelle_arrivee)) {
1099 $pdf->SetXY($posx, $posy);
1100 $pdf->SetTextColor(0, 0, 60);
1101 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date(
$object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1104 if (!empty(
$object->thirdparty->code_client)) {
1106 $pdf->SetXY($posx, $posy);
1107 $pdf->SetTextColor(0, 0, 60);
1108 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1112 $pdf->SetFont(
'',
'', $default_font_size + 3);
1117 $origin_id =
$object->origin_id;
1120 if (isModEnabled($origin)) {
1121 $outputlangs->load(
'orders');
1123 $classname = ucfirst($origin);
1124 $linkedobject =
new $classname($this->db);
1125 '@phan-var-force CommonObject $linkedobject';
1126 $result = $linkedobject->fetch($origin_id);
1130 $pdf->SetFont(
'',
'', $default_font_size - 2);
1131 $text = $linkedobject->ref;
1132 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1133 $text .=
' ('.$linkedobject->ref_client.
')';
1136 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1137 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1139 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1140 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1148 $carac_emetteur =
'';
1150 $arrayidcontact = array();
1151 $arrayidcontact =
$object->getIdContact(
'external',
'STFROM');
1153 $usecontact =
false;
1154 if (count($arrayidcontact) > 0) {
1158 $result =
$object->fetch_contact($arrayidcontact[0]);
1162 $thirdparty =
$object->contact;
1164 $thirdparty = $this->emetteur;
1167 if (!empty($thirdparty)) {
1179 $posx = $this->marge_gauche;
1181 $posx = $this->page_largeur - $this->marge_droite - 80;
1188 $pdf->SetTextColor(0, 0, 0);
1189 $pdf->SetFont(
'',
'', $default_font_size - 2);
1190 $pdf->SetXY($posx, $posy - 5);
1191 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1192 $pdf->SetXY($posx, $posy);
1193 $pdf->SetFillColor(230, 230, 230);
1194 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'F');
1195 $pdf->SetTextColor(0, 0, 60);
1196 $pdf->SetFillColor(255, 255, 255);
1199 $pdf->SetXY($posx + 2, $posy + 3);
1200 $pdf->SetFont(
'',
'B', $default_font_size);
1201 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1202 $posy = $pdf->getY();
1205 $pdf->SetXY($posx + 2, $posy);
1206 $pdf->SetFont(
'',
'', $default_font_size - 1);
1207 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1211 $usecontact =
false;
1212 $arrayidcontact =
$object->getIdContact(
'external',
'STDEST');
1213 if (count($arrayidcontact) > 0) {
1215 $result =
$object->fetch_contact($arrayidcontact[0]);
1221 $thirdparty =
$object->contact;
1223 $thirdparty =
$object->thirdparty;
1226 $carac_client_name =
'';
1227 if (!empty($thirdparty)) {
1235 if ($this->page_largeur < 210) {
1239 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1241 $posx = $this->marge_gauche;
1245 $pdf->SetTextColor(0, 0, 0);
1246 $pdf->SetFont(
'',
'', $default_font_size - 2);
1247 $pdf->SetXY($posx + 2, $posy - 5);
1248 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1249 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1252 $pdf->SetXY($posx + 2, $posy + 3);
1253 $pdf->SetFont(
'',
'B', $default_font_size);
1254 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1256 $posy = $pdf->getY();
1259 $pdf->SetXY($posx + 2, $posy);
1260 $pdf->SetFont(
'',
'', $default_font_size - 1);
1261 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1264 $pdf->SetTextColor(0, 0, 0);