178 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
181 global $user, $conf, $langs, $hookmanager;
187 if (!is_object($outputlangs)) {
188 $outputlangs = $langs;
192 $outputlangs->charset_output =
'ISO-8859-1';
196 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"stocks",
"stocktransfer@stocktransfer"));
198 global $outputlangsbis;
199 $outputlangsbis =
null;
201 $outputlangsbis =
new Translate(
'', $conf);
203 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
209 $realpatharray = array();
210 $this->atleastonephoto =
false;
212 $objphoto =
new Product($this->db);
214 for ($i = 0; $i < $nblines; $i++) {
215 if (empty(
$object->lines[$i]->fk_product)) {
219 $objphoto =
new Product($this->db);
220 $objphoto->fetch(
$object->lines[$i]->fk_product);
222 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
223 $dir = $conf->product->dir_output.
'/'.$pdir;
225 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
226 $dir = $conf->product->dir_output.
'/'.$pdir;
231 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
234 if ($obj[
'photo_vignette']) {
235 $filename = $obj[
'photo_vignette'];
237 $filename = $obj[
'photo'];
240 $filename = $obj[
'photo'];
243 $realpath = $dir.$filename;
244 $this->atleastonephoto =
true;
249 $realpatharray[$i] = $realpath;
254 if (count($realpatharray) == 0) {
255 $this->posxpicture = $this->posxweightvol;
260 $this->posxpicture = $this->posxlot;
262 $this->posxpicture -=
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20);
266 if ($conf->stocktransfer->dir_output) {
269 $dir = $conf->stocktransfer->dir_output;
270 $file = $dir.
"/SPECIMEN.pdf";
273 $dir = $conf->stocktransfer->dir_output.
'/'.
$object->element.
"/".$stocktransferref;
274 $file = $dir.
"/".$stocktransferref.
".pdf";
277 if (!file_exists($dir)) {
279 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
284 if (file_exists($dir)) {
286 if (!is_object($hookmanager)) {
287 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
290 $hookmanager->initHooks(array(
'pdfgeneration'));
291 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
293 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
300 $heightforinfotot = 8;
301 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
302 $heightforfooter = $this->marge_basse + 8;
304 $heightforfooter += 6;
306 $pdf->SetAutoPageBreak(1, 0);
308 if (class_exists(
'TCPDF')) {
309 $pdf->setPrintHeader(
false);
310 $pdf->setPrintFooter(
false);
315 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
316 $tplidx = $pdf->importPage(1);
321 $pdf->SetDrawColor(128, 128, 128);
323 if (method_exists($pdf,
'AliasNbPages')) {
324 $pdf->AliasNbPages();
327 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
328 $pdf->SetSubject($outputlangs->transnoentities(
"StockTransfer"));
329 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
330 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
331 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"StockTransfer"));
333 $pdf->SetCompression(
false);
337 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
341 if (!empty($tplidx)) {
342 $pdf->useTemplate($tplidx);
346 $pdf->SetFont(
'',
'', $default_font_size - 1);
347 $pdf->MultiCell(0, 3,
'');
348 $pdf->SetTextColor(0, 0, 0);
351 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift: 10);
353 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
355 $tab_height_newpage = 150;
358 $height_incoterms = 0;
359 if (isModEnabled(
'incoterm')) {
360 $desc_incoterms =
$object->getIncotermsForPDF();
361 if ($desc_incoterms) {
364 $pdf->SetFont(
'',
'', $default_font_size - 1);
365 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
366 $nexY = $pdf->GetY();
367 $height_incoterms = $nexY - $tab_top;
370 $pdf->SetDrawColor(192, 192, 192);
371 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
373 $tab_top = $nexY + 6;
374 $height_incoterms += 4;
379 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
380 $tab_top_alt = $tab_top;
385 if (!empty(
$object->tracking_number)) {
386 $height_trackingnumber = 4;
388 $pdf->SetFont(
'',
'B', $default_font_size - 2);
389 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
390 $tab_top_alt = $pdf->GetY();
393 if (!empty(
$object->tracking_url)) {
394 if (
$object->shipping_method_id > 0) {
396 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
399 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
401 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
405 $label .=
$object->tracking_url;
408 $height_trackingnumber += 4;
409 $pdf->SetFont(
'',
'B', $default_font_size - 2);
410 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
413 $tab_top = $pdf->GetY();
417 if (!empty(
$object->note_public)) {
418 $pdf->SetFont(
'',
'', $default_font_size - 1);
422 $nexY = $pdf->GetY();
423 $height_note = $nexY - $tab_top;
426 $pdf->SetDrawColor(192, 192, 192);
427 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
429 $tab_height = $tab_height - $height_note;
430 $tab_top = $nexY + 6;
439 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
441 $encoding =
'QRCODE';
445 if ($module->encodingIsSupported($encoding)) {
446 $result = $module->writeBarCode(
$object->ref, $encoding);
450 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
451 $newcode =
dol_hash($newcode,
'md5');
453 $barcode_path = $conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
459 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
461 $nexY = $pdf->GetY();
462 $height_barcode = 20;
466 $this->error =
'Failed to generate barcode';
470 $iniY = $tab_top + 7;
471 $curY = $tab_top + 7;
472 $nexY = $tab_top + 7;
474 $TCacheEntrepots = array();
476 for ($i = 0; $i < $nblines; $i++) {
478 $pdf->SetFont(
'',
'', $default_font_size - 1);
479 $pdf->SetTextColor(0, 0, 0);
482 $imglinesize = array();
483 if (!empty($realpatharray[$i])) {
487 $pdf->setTopMargin($tab_top_newpage);
488 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
489 $pageposbefore = $pdf->getPage();
491 $showpricebeforepagebreak = 1;
493 $posYAfterDescription = 0;
494 $heightforsignature = 0;
497 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
498 $pdf->AddPage(
'',
'',
true);
499 if (!empty($tplidx)) {
500 $pdf->useTemplate($tplidx);
505 $pdf->setPage($pageposbefore + 1);
507 $curY = $tab_top_newpage;
511 $showpricebeforepagebreak = 1;
513 $showpricebeforepagebreak = 0;
517 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
518 $curX = $this->posxpicture - 1;
519 $pdf->Image($realpatharray[$i], $curX + (($this->posxqty - $this->posxweightvol - $imglinesize[
'width']
520 + (
getDolGlobalString(
'STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME') ?
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20) : 0)) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
522 $posYAfterImage = $curY + $imglinesize[
'height'];
526 $curX = $this->posxdesc - 1;
528 $pdf->startTransaction();
529 if (method_exists(
$object->lines[$i],
'fetch_product')) {
530 $object->lines[$i]->fetch_product();
532 $object->lines[$i]->description =
$object->lines[$i]->product->description;
534 $object->lines[$i]->weight_units =
$object->lines[$i]->product->weight_units;
536 $object->lines[$i]->length_units =
$object->lines[$i]->product->length_units;
537 $object->lines[$i]->surface =
$object->lines[$i]->product->surface;
538 $object->lines[$i]->surface_units =
$object->lines[$i]->product->surface_units;
540 $object->lines[$i]->volume_units =
$object->lines[$i]->product->volume_units;
541 $object->lines[$i]->fk_unit =
$object->lines[$i]->product->fk_unit;
545 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
547 $pageposafter = $pdf->getPage();
548 if ($pageposafter > $pageposbefore) {
549 $pdf->rollbackTransaction(
true);
550 $pageposafter = $pageposbefore;
552 $pdf->setPageOrientation(
'', 1, $heightforfooter);
553 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
555 $pageposafter = $pdf->getPage();
556 $posyafter = $pdf->GetY();
558 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
559 if ($i == ($nblines - 1)) {
560 $pdf->AddPage(
'',
'',
true);
561 if (!empty($tplidx)) {
562 $pdf->useTemplate($tplidx);
567 $pdf->setPage($pageposafter + 1);
574 $showpricebeforepagebreak = 1;
576 $showpricebeforepagebreak = 0;
580 $pdf->commitTransaction();
582 $posYAfterDescription = $pdf->GetY();
584 $nexY = max($pdf->GetY(), $posYAfterImage);
585 $pageposafter = $pdf->getPage();
587 $pdf->setPage($pageposbefore);
588 $pdf->setTopMargin($this->marge_haute);
589 $pdf->setPageOrientation(
'', 1, 0);
592 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
593 $pdf->setPage($pageposafter);
594 $curY = $tab_top_newpage;
598 if ($pageposafter > $pageposbefore) {
599 $pdf->setPage($pageposafter);
600 $curY = $tab_top_newpage;
603 $pdf->SetFont(
'',
'', $default_font_size - 1);
606 if (isModEnabled(
'productbatch')) {
607 $pdf->SetXY($this->posxlot, $curY);
608 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 3,
$object->lines[$i]->batch,
'',
'C');
613 $pdf->SetXY($this->posxweightvol, $curY);
615 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
619 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
625 $pdf->writeHTMLCell($this->posxqty - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
630 $pdf->SetXY($this->posxqty, $curY);
631 $pdf->writeHTMLCell($this->posxwarehousesource - $this->posxqty + 2, 3, $this->posxqty - 1, $curY,
$object->lines[$i]->qty, 0, 0,
false,
true,
'C');
635 $wh_source =
new Entrepot($this->db);
636 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source])) {
637 $wh_source = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source];
639 $wh_source->fetch(
$object->lines[$i]->fk_warehouse_source);
640 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_source] = $wh_source;
642 $pdf->SetXY($this->posxwarehousesource, $curY);
643 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 3, $wh_source->ref.(!empty($wh_source->lieu) ?
' - '.$wh_source->lieu :
''),
'',
'C');
646 $wh_destination =
new Entrepot($this->db);
647 if (!empty($TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination])) {
648 $wh_destination = $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination];
650 $wh_destination->fetch(
$object->lines[$i]->fk_warehouse_destination);
651 $TCacheEntrepots[
$object->lines[$i]->fk_warehouse_destination] = $wh_destination;
653 $pdf->SetXY($this->posxwarehousedestination, $curY);
654 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination), 3, $wh_destination->ref.(!empty($wh_destination->lieu) ?
' - '.$wh_destination->lieu :
''),
'',
'C');
657 $pdf->SetXY($this->posxpuht, $curY);
658 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
660 $pdf->SetXY($this->posxtotalht, $curY);
661 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price(
$object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
665 if ($weighttxt && $voltxt) {
671 $pdf->setPage($pageposafter);
672 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
674 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
675 $pdf->SetLineStyle(array(
'dash' => 0));
679 while ($pagenb < $pageposafter) {
680 $pdf->setPage($pagenb);
682 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
684 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
688 $pdf->setPage($pagenb);
689 $pdf->setPageOrientation(
'', 1, 0);
693 if (!empty($tplidx)) {
694 $pdf->useTemplate($tplidx);
697 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
699 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
701 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
706 if (!empty($tplidx)) {
707 $pdf->useTemplate($tplidx);
718 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
719 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
721 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
722 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
730 if (method_exists($pdf,
'AliasNbPages')) {
731 $pdf->AliasNbPages();
736 $pdf->Output($file,
'F');
739 $hookmanager->initHooks(array(
'pdfgeneration'));
740 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
742 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
744 $this->error = $hookmanager->error;
745 $this->errors = $hookmanager->errors;
750 $this->result = array(
'fullpath' => $file);
754 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
758 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"STOCKTRANSFER_OUTPUTDIR");
890 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
904 $pdf->SetTextColor(0, 0, 0);
905 $pdf->SetFont(
'',
'', $default_font_size - 2);
908 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
910 $pdf->SetDrawColor(128, 128, 128);
911 $pdf->SetFont(
'',
'', $default_font_size - 1);
914 if (empty($hidetop)) {
915 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
917 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
918 $pdf->MultiCell($this->posxlot - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
922 $pdf->line($this->posxlot - 1, $tab_top, $this->posxlot - 1, $tab_top + $tab_height);
923 if (empty($hidetop)) {
924 $pdf->SetXY($this->posxlot, $tab_top + 1);
925 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 2, $outputlangs->transnoentities(
"Batch"),
'',
'C');
930 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
931 if (empty($hidetop)) {
932 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
933 $pdf->MultiCell(($this->posxqty - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
937 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
938 if (empty($hidetop)) {
939 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
940 $pdf->MultiCell(($this->posxwarehousesource - $this->posxqty), 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
943 $pdf->line($this->posxwarehousesource - 1, $tab_top, $this->posxwarehousesource - 1, $tab_top + $tab_height);
944 if (empty($hidetop)) {
945 $pdf->SetXY($this->posxwarehousesource - 1, $tab_top + 1);
946 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 2, $outputlangs->transnoentities(
"WarehouseSource"),
'',
'C');
950 $pdf->line($this->posxwarehousedestination - 1, $tab_top, $this->posxwarehousedestination - 1, $tab_top + $tab_height);
951 if (empty($hidetop)) {
952 $pdf->SetXY($this->posxwarehousedestination - 2.5, $tab_top + 1);
953 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination + 4), 2, $outputlangs->transnoentities(
"WarehouseTarget"),
'',
'C');
1011 global $conf, $langs;
1014 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1022 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->SHIPPING_DRAFT_WATERMARK);
1026 $pdf->SetTextColor(0, 0, 60);
1027 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1031 $posy = $this->marge_haute;
1032 $posx = $this->page_largeur - $this->marge_droite - $w;
1034 $pdf->SetXY($this->marge_gauche, $posy);
1037 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1038 if ($this->emetteur->logo) {
1039 if (is_readable($logo)) {
1041 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1043 $pdf->SetTextColor(200, 0, 0);
1044 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1045 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1046 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1049 $text = $this->emetteur->name;
1050 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1053 $pdf->SetDrawColor(128, 128, 128);
1055 $posx = $this->page_largeur - $w - $this->marge_droite;
1056 $posy = $this->marge_haute;
1058 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1059 $pdf->SetXY($posx, $posy);
1060 $pdf->SetTextColor(0, 0, 60);
1061 $title = $outputlangs->transnoentities(
"StockTransferSheet").
' '.
$object->ref;
1062 $pdf->MultiCell($w, 4, $title,
'',
'R');
1064 $pdf->SetFont(
'',
'', $default_font_size + 1);
1067 if (!empty(
$object->date_prevue_depart)) {
1069 $pdf->SetXY($posx, $posy);
1070 $pdf->SetTextColor(0, 0, 60);
1071 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date(
$object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1075 if (!empty(
$object->date_prevue_arrivee)) {
1077 $pdf->SetXY($posx, $posy);
1078 $pdf->SetTextColor(0, 0, 60);
1079 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date(
$object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1083 if (!empty(
$object->date_reelle_depart)) {
1085 $pdf->SetXY($posx, $posy);
1086 $pdf->SetTextColor(0, 0, 60);
1087 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date(
$object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1091 if (!empty(
$object->date_reelle_arrivee)) {
1093 $pdf->SetXY($posx, $posy);
1094 $pdf->SetTextColor(0, 0, 60);
1095 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date(
$object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1098 if (!empty(
$object->thirdparty->code_client)) {
1100 $pdf->SetXY($posx, $posy);
1101 $pdf->SetTextColor(0, 0, 60);
1102 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1106 $pdf->SetFont(
'',
'', $default_font_size + 3);
1111 $origin_id =
$object->origin_id;
1114 if (isModEnabled($origin)) {
1115 $outputlangs->load(
'orders');
1117 $classname = ucfirst($origin);
1118 $linkedobject =
new $classname($this->db);
1119 $result = $linkedobject->fetch($origin_id);
1123 $pdf->SetFont(
'',
'', $default_font_size - 2);
1124 $text = $linkedobject->ref;
1125 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1126 $text .=
' ('.$linkedobject->ref_client.
')';
1129 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1130 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1132 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1133 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1141 $carac_emetteur =
'';
1143 $arrayidcontact = array();
1144 $arrayidcontact =
$object->getIdContact(
'external',
'STFROM');
1146 $usecontact =
false;
1147 if (count($arrayidcontact) > 0) {
1151 $result =
$object->fetch_contact($arrayidcontact[0]);
1155 $thirdparty =
$object->contact;
1157 $thirdparty = $this->emetteur;
1160 if (!empty($thirdparty)) {
1172 $posx = $this->marge_gauche;
1174 $posx = $this->page_largeur - $this->marge_droite - 80;
1181 $pdf->SetTextColor(0, 0, 0);
1182 $pdf->SetFont(
'',
'', $default_font_size - 2);
1183 $pdf->SetXY($posx, $posy - 5);
1184 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1185 $pdf->SetXY($posx, $posy);
1186 $pdf->SetFillColor(230, 230, 230);
1187 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1188 $pdf->SetTextColor(0, 0, 60);
1189 $pdf->SetFillColor(255, 255, 255);
1192 $pdf->SetXY($posx + 2, $posy + 3);
1193 $pdf->SetFont(
'',
'B', $default_font_size);
1194 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1195 $posy = $pdf->getY();
1198 $pdf->SetXY($posx + 2, $posy);
1199 $pdf->SetFont(
'',
'', $default_font_size - 1);
1200 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1204 $usecontact =
false;
1205 $arrayidcontact =
$object->getIdContact(
'external',
'STDEST');
1206 if (count($arrayidcontact) > 0) {
1208 $result =
$object->fetch_contact($arrayidcontact[0]);
1214 $thirdparty =
$object->contact;
1216 $thirdparty =
$object->thirdparty;
1219 $carac_client_name =
'';
1220 if (!empty($thirdparty)) {
1228 if ($this->page_largeur < 210) {
1232 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1234 $posx = $this->marge_gauche;
1238 $pdf->SetTextColor(0, 0, 0);
1239 $pdf->SetFont(
'',
'', $default_font_size - 2);
1240 $pdf->SetXY($posx + 2, $posy - 5);
1241 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1242 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1245 $pdf->SetXY($posx + 2, $posy + 3);
1246 $pdf->SetFont(
'',
'B', $default_font_size);
1247 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1249 $posy = $pdf->getY();
1252 $pdf->SetXY($posx + 2, $posy);
1253 $pdf->SetFont(
'',
'', $default_font_size - 1);
1254 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1257 $pdf->SetTextColor(0, 0, 0);