163 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
166 global $db, $user, $conf, $langs, $hookmanager;
168 $object->fetch_thirdparty();
172 if (!is_object($outputlangs)) {
173 $outputlangs = $langs;
177 $outputlangs->charset_output =
'ISO-8859-1';
181 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"stocks",
"stocktransfer@stocktransfer"));
183 $nblines = is_array($object->lines) ? count($object->lines) : 0;
186 $realpatharray = array();
188 $objphoto =
new Product($this->db);
190 for ($i = 0; $i < $nblines; $i++) {
191 if (empty($object->lines[$i]->fk_product)) {
195 $objphoto =
new Product($this->db);
196 $objphoto->fetch($object->lines[$i]->fk_product);
198 $pdir =
get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
199 $dir = $conf->product->dir_output.
'/'.$pdir;
201 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
202 $dir = $conf->product->dir_output.
'/'.$pdir;
207 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
210 if ($obj[
'photo_vignette']) {
211 $filename = $obj[
'photo_vignette'];
213 $filename = $obj[
'photo'];
216 $filename = $obj[
'photo'];
219 $realpath = $dir.$filename;
224 $realpatharray[$i] = $realpath;
229 if (count($realpatharray) == 0) {
230 $this->posxpicture = $this->posxweightvol;
235 $this->posxpicture = $this->posxlot;
237 $this->posxpicture -= (!
getDolGlobalString(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
241 if ($conf->stocktransfer->dir_output) {
243 if ($object->specimen) {
244 $dir = $conf->stocktransfer->dir_output;
245 $file = $dir.
"/SPECIMEN.pdf";
248 $dir = $conf->stocktransfer->dir_output.
'/'.$object->element.
"/".$stocktransferref;
249 $file = $dir.
"/".$stocktransferref.
".pdf";
252 if (!file_exists($dir)) {
254 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
259 if (file_exists($dir)) {
261 if (!is_object($hookmanager)) {
262 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
265 $hookmanager->initHooks(array(
'pdfgeneration'));
266 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
268 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
271 $nblines = is_array($object->lines) ? count($object->lines) : 0;
275 $heightforinfotot = 8;
276 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
277 $heightforfooter = $this->marge_basse + 8;
278 if (
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') > 0) {
279 $heightforfooter += 6;
281 $pdf->SetAutoPageBreak(1, 0);
283 if (class_exists(
'TCPDF')) {
284 $pdf->setPrintHeader(
false);
285 $pdf->setPrintFooter(
false);
290 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
291 $tplidx = $pdf->importPage(1);
296 $pdf->SetDrawColor(128, 128, 128);
298 if (method_exists($pdf,
'AliasNbPages')) {
299 $pdf->AliasNbPages();
302 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
303 $pdf->SetSubject($outputlangs->transnoentities(
"Shipment"));
304 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
305 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
306 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Shipment"));
308 $pdf->SetCompression(
false);
311 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
315 if (!empty($tplidx)) {
316 $pdf->useTemplate($tplidx);
319 $this->
_pagehead($pdf, $object, 1, $outputlangs);
320 $pdf->SetFont(
'',
'', $default_font_size - 1);
321 $pdf->MultiCell(0, 3,
'');
322 $pdf->SetTextColor(0, 0, 0);
325 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
327 $tab_height_newpage = 150;
330 $height_incoterms = 0;
331 if ($conf->incoterm->enabled) {
332 $desc_incoterms = $object->getIncotermsForPDF();
333 if ($desc_incoterms) {
336 $pdf->SetFont(
'',
'', $default_font_size - 1);
337 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
338 $nexY = $pdf->GetY();
339 $height_incoterms = $nexY - $tab_top;
342 $pdf->SetDrawColor(192, 192, 192);
343 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
345 $tab_top = $nexY + 6;
346 $height_incoterms += 4;
350 if (!empty($object->note_public) || !empty($object->tracking_number)) {
351 $tab_top = 88 + $height_incoterms;
352 $tab_top_alt = $tab_top;
354 $pdf->SetFont(
'',
'B', $default_font_size - 2);
359 if (!empty($object->tracking_number)) {
360 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".$object->tracking_number, 0, 1,
false,
true,
'L');
361 $tab_top_alt = $pdf->GetY();
363 $object->getUrlTrackingStatus($object->tracking_number);
364 if (!empty($object->tracking_url)) {
365 if ($object->shipping_method_id > 0) {
367 $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
369 if ($object->tracking_url != $object->tracking_number) {
370 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
372 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
374 if ($object->tracking_url != $object->tracking_number) {
376 $label .= $object->tracking_url;
378 $pdf->SetFont(
'',
'B', $default_font_size - 2);
379 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
381 $tab_top_alt = $pdf->GetY();
387 if (!empty($object->note_public)) {
388 $pdf->SetFont(
'',
'', $default_font_size - 1);
389 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top_alt,
dol_htmlentitiesbr($object->note_public), 0, 1);
392 $nexY = $pdf->GetY();
393 $height_note = $nexY - $tab_top;
396 $pdf->SetDrawColor(192, 192, 192);
397 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
399 $tab_height = $tab_height - $height_note;
400 $tab_top = $nexY + 6;
405 $iniY = $tab_top + 7;
406 $curY = $tab_top + 7;
407 $nexY = $tab_top + 7;
409 $TCacheEntrepots=array();
411 for ($i = 0; $i < $nblines; $i++) {
413 $pdf->SetFont(
'',
'', $default_font_size - 1);
414 $pdf->SetTextColor(0, 0, 0);
417 $imglinesize = array();
418 if (!empty($realpatharray[$i])) {
422 $pdf->setTopMargin($tab_top_newpage);
423 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
424 $pageposbefore = $pdf->getPage();
426 $showpricebeforepagebreak = 1;
428 $posYAfterDescription = 0;
431 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
432 $pdf->AddPage(
'',
'',
true);
433 if (!empty($tplidx)) {
434 $pdf->useTemplate($tplidx);
437 $this->
_pagehead($pdf, $object, 0, $outputlangs);
439 $pdf->setPage($pageposbefore + 1);
441 $curY = $tab_top_newpage;
445 $showpricebeforepagebreak = 1;
447 $showpricebeforepagebreak = 0;
451 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
452 $curX = $this->posxpicture - 1;
453 $pdf->Image($realpatharray[$i], $curX + (($this->posxqty - $this->posxweightvol - $imglinesize[
'width']
454 + (
getDolGlobalString(
'STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME') ? (!
getDolGlobalString(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) : 0)) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
456 $posYAfterImage = $curY + $imglinesize[
'height'];
460 $curX = $this->posxdesc - 1;
462 $pdf->startTransaction();
463 if (method_exists($object->lines[$i],
'fetch_product')) {
464 $object->lines[$i]->fetch_product();
465 $object->lines[$i]->label = $object->lines[$i]->product->label;
466 $object->lines[$i]->description = $object->lines[$i]->product->description;
467 $object->lines[$i]->weight = $object->lines[$i]->product->weight;
468 $object->lines[$i]->weight_units = $object->lines[$i]->product->weight_units;
469 $object->lines[$i]->length = $object->lines[$i]->product->length;
470 $object->lines[$i]->length_units = $object->lines[$i]->product->length_units;
471 $object->lines[$i]->surface = $object->lines[$i]->product->surface;
472 $object->lines[$i]->surface_units = $object->lines[$i]->product->surface_units;
473 $object->lines[$i]->volume = $object->lines[$i]->product->volume;
474 $object->lines[$i]->volume_units = $object->lines[$i]->product->volume_units;
475 $object->lines[$i]->fk_unit = $object->lines[$i]->product->fk_unit;
479 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
481 $pageposafter = $pdf->getPage();
482 if ($pageposafter > $pageposbefore) {
483 $pdf->rollbackTransaction(
true);
484 $pageposafter = $pageposbefore;
486 $pdf->setPageOrientation(
'', 1, $heightforfooter);
487 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
489 $pageposafter = $pdf->getPage();
490 $posyafter = $pdf->GetY();
492 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
493 if ($i == ($nblines - 1)) {
494 $pdf->AddPage(
'',
'',
true);
495 if (!empty($tplidx)) {
496 $pdf->useTemplate($tplidx);
499 $this->
_pagehead($pdf, $object, 0, $outputlangs);
501 $pdf->setPage($pageposafter + 1);
508 $showpricebeforepagebreak = 1;
510 $showpricebeforepagebreak = 0;
514 $pdf->commitTransaction();
516 $posYAfterDescription = $pdf->GetY();
518 $nexY = $pdf->GetY();
519 $pageposafter = $pdf->getPage();
521 $pdf->setPage($pageposbefore);
522 $pdf->setTopMargin($this->marge_haute);
523 $pdf->setPageOrientation(
'', 1, 0);
526 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
527 $pdf->setPage($pageposafter);
528 $curY = $tab_top_newpage;
532 if ($pageposafter > $pageposbefore) {
533 $pdf->setPage($pageposafter);
534 $curY = $tab_top_newpage;
537 $pdf->SetFont(
'',
'', $default_font_size - 1);
540 if (isModEnabled(
'productbatch')) {
541 $pdf->SetXY($this->posxlot, $curY);
542 $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 3, $object->lines[$i]->batch,
'',
'C');
546 $pdf->SetXY($this->posxweightvol, $curY);
548 if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight) {
549 $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty, 5).
' '.
measuringUnitString(0,
"weight", $object->lines[$i]->weight_units, 1);
552 if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume) {
553 $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty, 5).
' '.
measuringUnitString(0,
"volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1);
558 $pdf->writeHTMLCell($this->posxqty - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
563 $pdf->SetXY($this->posxqty, $curY);
564 $pdf->writeHTMLCell($this->posxwarehousesource - $this->posxqty + 2, 3, $this->posxqty - 1, $curY, $object->lines[$i]->qty, 0, 0,
false,
true,
'C');
569 if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) {
570 $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source];
572 $wh_source->fetch($object->lines[$i]->fk_warehouse_source);
573 $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source] = $wh_source;
575 $pdf->SetXY($this->posxwarehousesource, $curY);
576 $pdf->MultiCell(($this->posxwarehousedestination - $this->posxwarehousesource), 3, $wh_source->ref.(!empty($wh_source->lieu) ?
' - '.$wh_source->lieu :
''),
'',
'C');
579 $wh_destination =
new Entrepot($db);
580 if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) {
581 $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination];
583 $wh_destination->fetch($object->lines[$i]->fk_warehouse_destination);
584 $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination] = $wh_destination;
586 $pdf->SetXY($this->posxwarehousedestination, $curY);
587 $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination), 3, $wh_destination->ref.(!empty($wh_destination->lieu) ?
' - '.$wh_destination->lieu :
''),
'',
'C');
590 $pdf->SetXY($this->posxpuht, $curY);
591 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price($object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
593 $pdf->SetXY($this->posxtotalht, $curY);
594 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price($object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
598 if ($weighttxt && $voltxt) {
604 $pdf->setPage($pageposafter);
605 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
607 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
608 $pdf->SetLineStyle(array(
'dash'=>0));
612 while ($pagenb < $pageposafter) {
613 $pdf->setPage($pagenb);
615 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
617 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
619 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
621 $pdf->setPage($pagenb);
622 $pdf->setPageOrientation(
'', 1, 0);
624 $this->
_pagehead($pdf, $object, 0, $outputlangs);
627 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
629 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
631 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
633 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
636 if (!empty($tplidx)) {
637 $pdf->useTemplate($tplidx);
641 $this->
_pagehead($pdf, $object, 0, $outputlangs);
648 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
649 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
651 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
652 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
656 $posy = $this->
_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
659 $this->
_pagefoot($pdf, $object, $outputlangs);
660 if (method_exists($pdf,
'AliasNbPages')) {
661 $pdf->AliasNbPages();
666 $pdf->Output($file,
'F');
669 $hookmanager->initHooks(array(
'pdfgeneration'));
670 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
672 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
674 $this->error = $hookmanager->error;
675 $this->errors = $hookmanager->errors;
680 $this->result = array(
'fullpath'=>$file);
684 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
688 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
937 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
940 global $conf, $langs, $mysoc;
942 $langs->load(
"orders");
950 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->SHIPPING_DRAFT_WATERMARK);
954 $pdf->SetTextColor(0, 0, 60);
955 $pdf->SetFont(
'',
'B', $default_font_size + 3);
959 $posy = $this->marge_haute;
960 $posx = $this->page_largeur - $this->marge_droite - $w;
962 $pdf->SetXY($this->marge_gauche, $posy);
965 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
966 if ($this->emetteur->logo) {
967 if (is_readable($logo)) {
969 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
971 $pdf->SetTextColor(200, 0, 0);
972 $pdf->SetFont(
'',
'B', $default_font_size - 2);
973 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
974 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
977 $text = $this->emetteur->name;
978 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
982 if (isModEnabled(
'barcode')) {
985 $posx = $this->marge_gauche + 3;
988 if (isModEnabled(
'barcode')) {
994 $pdf->SetDrawColor(128, 128, 128);
996 $posx = $this->page_largeur - $w - $this->marge_droite;
997 $posy = $this->marge_haute;
999 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1000 $pdf->SetXY($posx, $posy);
1001 $pdf->SetTextColor(0, 0, 60);
1002 $title = $outputlangs->transnoentities(
"StockTransferSheet").
' '.$object->ref;
1003 $pdf->MultiCell($w, 4, $title,
'',
'R');
1005 $pdf->SetFont(
'',
'', $default_font_size + 1);
1008 if (!empty($object->date_prevue_depart)) {
1010 $pdf->SetXY($posx, $posy);
1011 $pdf->SetTextColor(0, 0, 60);
1012 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date($object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1016 if (!empty($object->date_prevue_arrivee)) {
1018 $pdf->SetXY($posx, $posy);
1019 $pdf->SetTextColor(0, 0, 60);
1020 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date($object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1024 if (!empty($object->date_reelle_depart)) {
1026 $pdf->SetXY($posx, $posy);
1027 $pdf->SetTextColor(0, 0, 60);
1028 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date($object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1032 if (!empty($object->date_reelle_arrivee)) {
1034 $pdf->SetXY($posx, $posy);
1035 $pdf->SetTextColor(0, 0, 60);
1036 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date($object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1039 if (!empty($object->thirdparty->code_client)) {
1041 $pdf->SetXY($posx, $posy);
1042 $pdf->SetTextColor(0, 0, 60);
1043 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
1047 $pdf->SetFont(
'',
'', $default_font_size + 3);
1051 $origin = $object->origin;
1052 $origin_id = $object->origin_id;
1055 if (!empty($conf->$origin->enabled)) {
1056 $outputlangs->load(
'orders');
1058 $classname = ucfirst($origin);
1059 $linkedobject =
new $classname($this->db);
1060 $result = $linkedobject->fetch($origin_id);
1064 $pdf->SetFont(
'',
'', $default_font_size - 2);
1065 $text = $linkedobject->ref;
1066 if ($linkedobject->ref_client) {
1067 $text .=
' ('.$linkedobject->ref_client.
')';
1070 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1071 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1073 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1074 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1080 $carac_emetteur =
'';
1082 $arrayidcontact = array();
1083 $arrayidcontact = $object->getIdContact(
'external',
'STFROM');
1085 $usecontact =
false;
1086 if (count($arrayidcontact) > 0) {
1090 $result = $object->fetch_contact($arrayidcontact[0]);
1094 $thirdparty = $object->contact;
1096 $thirdparty = $this->emetteur;
1099 if (!empty($thirdparty)) {
1104 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1,
'targetwithdetails', $object);
1106 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1111 $posx = $this->marge_gauche;
1113 $posx = $this->page_largeur - $this->marge_droite - 80;
1120 $pdf->SetTextColor(0, 0, 0);
1121 $pdf->SetFont(
'',
'', $default_font_size - 2);
1122 $pdf->SetXY($posx, $posy - 5);
1123 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1124 $pdf->SetXY($posx, $posy);
1125 $pdf->SetFillColor(230, 230, 230);
1126 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1127 $pdf->SetTextColor(0, 0, 60);
1128 $pdf->SetFillColor(255, 255, 255);
1131 $pdf->SetXY($posx + 2, $posy + 3);
1132 $pdf->SetFont(
'',
'B', $default_font_size);
1133 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1134 $posy = $pdf->getY();
1137 $pdf->SetXY($posx + 2, $posy);
1138 $pdf->SetFont(
'',
'', $default_font_size - 1);
1139 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1143 $usecontact =
false;
1144 $arrayidcontact = $object->getIdContact(
'external',
'STDEST');
1145 if (count($arrayidcontact) > 0) {
1147 $result = $object->fetch_contact($arrayidcontact[0]);
1153 $thirdparty = $object->contact;
1155 $thirdparty = $object->thirdparty;
1158 if (!empty($thirdparty)) {
1162 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact :
null), $usecontact,
'targetwithdetails', $object);
1166 if ($this->page_largeur < 210) {
1170 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1172 $posx = $this->marge_gauche;
1176 $pdf->SetTextColor(0, 0, 0);
1177 $pdf->SetFont(
'',
'', $default_font_size - 2);
1178 $pdf->SetXY($posx + 2, $posy - 5);
1179 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1180 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1183 $pdf->SetXY($posx + 2, $posy + 3);
1184 $pdf->SetFont(
'',
'B', $default_font_size);
1185 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1187 $posy = $pdf->getY();
1190 $pdf->SetFont(
'',
'', $default_font_size - 1);
1191 $pdf->SetXY($posx + 2, $posy);
1192 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1195 $pdf->SetTextColor(0, 0, 0);