159 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
162 global $user, $conf, $langs, $hookmanager;
166 if (!is_object($outputlangs)) {
167 $outputlangs = $langs;
171 $outputlangs->charset_output =
'ISO-8859-1';
175 $outputlangs->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"other"));
182 global $outputlangsbis;
183 $outputlangsbis =
null;
185 $outputlangsbis =
new Translate(
'', $conf);
187 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
193 $realpatharray = array();
194 $this->atleastonephoto =
false;
196 $objphoto =
new Product($this->db);
198 for ($i = 0; $i < $nblines; $i++) {
199 if (empty(
$object->lines[$i]->fk_product)) {
203 $objphoto =
new Product($this->db);
204 $objphoto->fetch(
$object->lines[$i]->fk_product);
206 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
207 $dir = $conf->product->dir_output.
'/'.$pdir;
209 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
210 $dir = $conf->product->dir_output.
'/'.$pdir;
215 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
218 if ($obj[
'photo_vignette']) {
219 $filename = $obj[
'photo_vignette'];
221 $filename = $obj[
'photo'];
224 $filename = $obj[
'photo'];
227 $realpath = $dir.$filename;
228 $this->atleastonephoto =
true;
233 $realpatharray[$i] = $realpath;
238 if (count($realpatharray) == 0) {
239 $this->posxpicture = $this->posxweightvol;
242 if ($conf->expedition->dir_output) {
245 $dir = $conf->expedition->dir_output.
"/sending";
246 $file = $dir.
"/SPECIMEN.pdf";
249 $dir = $conf->expedition->dir_output.
"/sending/".$expref;
250 $file = $dir.
"/".$expref.
".pdf";
253 if (!file_exists($dir)) {
255 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
260 if (file_exists($dir)) {
262 if (!is_object($hookmanager)) {
263 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
266 $hookmanager->initHooks(array(
'pdfgeneration'));
267 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
269 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
276 $heightforinfotot = 8;
277 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
278 $heightforfooter = $this->marge_basse + 8;
280 $heightforfooter += 6;
282 $pdf->SetAutoPageBreak(1, 0);
284 if (class_exists(
'TCPDF')) {
285 $pdf->setPrintHeader(
false);
286 $pdf->setPrintFooter(
false);
291 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
292 $tplidx = $pdf->importPage(1);
297 $pdf->SetDrawColor(128, 128, 128);
299 if (method_exists($pdf,
'AliasNbPages')) {
300 $pdf->AliasNbPages();
303 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
304 $pdf->SetSubject($outputlangs->transnoentities(
"Shipment"));
305 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
306 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
307 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Shipment"));
309 $pdf->SetCompression(
false);
313 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
317 if (!empty($tplidx)) {
318 $pdf->useTemplate($tplidx);
322 $pdf->SetFont(
'',
'', $default_font_size - 1);
323 $pdf->MultiCell(0, 3,
'');
324 $pdf->SetTextColor(0, 0, 0);
327 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift: 10);
329 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
332 $height_incoterms = 0;
333 if (isModEnabled(
'incoterm')) {
334 $desc_incoterms =
$object->getIncotermsForPDF();
335 if ($desc_incoterms) {
338 $pdf->SetFont(
'',
'', $default_font_size - 1);
339 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
340 $nexY = $pdf->GetY();
341 $height_incoterms = $nexY - $tab_top;
344 $pdf->SetDrawColor(192, 192, 192);
345 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
347 $tab_top = $nexY + 6;
348 $height_incoterms += 4;
353 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
354 $tab_top_alt = $tab_top;
359 if (!empty(
$object->tracking_number)) {
360 $height_trackingnumber = 4;
362 $pdf->SetFont(
'',
'B', $default_font_size - 2);
363 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
364 $tab_top_alt = $pdf->GetY();
367 if (!empty(
$object->tracking_url)) {
368 if (
$object->shipping_method_id > 0) {
370 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
373 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
375 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
379 $label .=
$object->tracking_url;
382 $height_trackingnumber += 4;
383 $pdf->SetFont(
'',
'B', $default_font_size - 2);
384 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
387 $tab_top = $pdf->GetY();
391 if (!empty(
$object->note_public)) {
392 $pdf->SetFont(
'',
'', $default_font_size - 1);
396 $nexY = $pdf->GetY();
397 $height_note = $nexY - $tab_top;
400 $pdf->SetDrawColor(192, 192, 192);
401 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
403 $tab_height = $tab_height - $height_note;
404 $tab_top = $nexY + 6;
413 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
415 $encoding =
'QRCODE';
419 if ($module->encodingIsSupported($encoding)) {
420 $result = $module->writeBarCode(
$object->ref, $encoding);
424 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
425 $newcode =
dol_hash($newcode,
'md5');
427 $barcode_path = $conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
433 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
435 $nexY = $pdf->GetY();
436 $height_barcode = 20;
440 $this->error =
'Failed to generate barcode';
445 $iniY = $tab_top + 7;
446 $curY = $tab_top + 7;
447 $nexY = $tab_top + 7;
450 for ($i = 0; $i < $nblines; $i++) {
452 $pdf->SetFont(
'',
'', $default_font_size - 1);
453 $pdf->SetTextColor(0, 0, 0);
456 $imglinesize = array();
457 if (!empty($realpatharray[$i])) {
461 $pdf->setTopMargin($tab_top_newpage);
462 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
463 $pageposbefore = $pdf->getPage();
465 $showpricebeforepagebreak = 1;
467 $posYAfterDescription = 0;
468 $heightforsignature = 0;
471 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
472 $pdf->AddPage(
'',
'',
true);
473 if (!empty($tplidx)) {
474 $pdf->useTemplate($tplidx);
479 $pdf->setPage($pageposbefore + 1);
481 $curY = $tab_top_newpage;
485 $showpricebeforepagebreak = 1;
487 $showpricebeforepagebreak = 0;
491 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
492 $curX = $this->posxpicture - 1;
493 $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
495 $posYAfterImage = $curY + $imglinesize[
'height'];
499 $curX = $this->posxdesc - 1;
501 $pdf->startTransaction();
502 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
504 $pageposafter = $pdf->getPage();
505 if ($pageposafter > $pageposbefore) {
506 $pdf->rollbackTransaction(
true);
507 $pageposafter = $pageposbefore;
509 $pdf->setPageOrientation(
'', 1, $heightforfooter);
510 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
512 $pageposafter = $pdf->getPage();
513 $posyafter = $pdf->GetY();
515 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
516 if ($i == ($nblines - 1)) {
517 $pdf->AddPage(
'',
'',
true);
518 if (!empty($tplidx)) {
519 $pdf->useTemplate($tplidx);
524 $pdf->setPage($pageposafter + 1);
531 $showpricebeforepagebreak = 1;
533 $showpricebeforepagebreak = 0;
537 $pdf->commitTransaction();
539 $posYAfterDescription = $pdf->GetY();
541 $nexY = max($pdf->GetY(), $posYAfterImage);
542 $pageposafter = $pdf->getPage();
544 $pdf->setPage($pageposbefore);
545 $pdf->setTopMargin($this->marge_haute);
546 $pdf->setPageOrientation(
'', 1, 0);
549 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
550 $pdf->setPage($pageposafter);
551 $curY = $tab_top_newpage;
555 if ($pageposafter > $pageposbefore) {
556 $pdf->setPage($pageposafter);
557 $curY = $tab_top_newpage;
560 $pdf->SetFont(
'',
'', $default_font_size - 1);
564 $pdf->SetXY($this->posxweightvol, $curY);
566 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
570 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
575 $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
580 $pdf->SetXY($this->posxqtyordered, $curY);
581 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3,
$object->lines[$i]->qty_asked,
'',
'C');
585 $pdf->SetXY($this->posxqtytoship, $curY);
586 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3,
$object->lines[$i]->qty_shipped,
'',
'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);
621 $pdf->setPage($pagenb);
622 $pdf->setPageOrientation(
'', 1, 0);
626 if (!empty($tplidx)) {
627 $pdf->useTemplate($tplidx);
630 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
632 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
634 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
639 if (!empty($tplidx)) {
640 $pdf->useTemplate($tplidx);
651 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
652 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
654 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
655 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
663 if (method_exists($pdf,
'AliasNbPages')) {
664 $pdf->AliasNbPages();
669 $pdf->Output($file,
'F');
672 $hookmanager->initHooks(array(
'pdfgeneration'));
673 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
675 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
677 $this->error = $hookmanager->error;
678 $this->errors = $hookmanager->errors;
683 $this->result = array(
'fullpath' => $file);
687 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
691 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
711 global $conf, $mysoc;
719 $pdf->SetFont(
'',
'B', $default_font_size - 1);
722 $col1x = $this->posxweightvol - 50;
723 $col2x = $this->posxweightvol;
729 $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
731 $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
737 $totalWeighttoshow =
'';
738 $totalVolumetoshow =
'';
741 $tmparray =
$object->getTotalWeightVolume();
742 $totalWeight = $tmparray[
'weight'];
743 $totalVolume = $tmparray[
'volume'];
744 $totalOrdered = $tmparray[
'ordered'];
745 $totalToShip = $tmparray[
'toship'];
753 if (!empty($totalWeight)) {
756 if (!empty($totalVolume)) {
759 if (!empty(
$object->trueWeight)) {
762 if (!empty(
$object->trueVolume)) {
766 $pdf->SetFillColor(255, 255, 255);
767 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
768 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L', 1);
771 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
772 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0,
'C', 1);
776 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
777 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0,
'C', 1);
781 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
782 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C', 1);
784 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
785 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price(
$object->total_ht, 0, $outputlangs), 0,
'C', 1);
790 if ($totalWeighttoshow) {
791 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
792 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C', 1);
796 if ($totalVolumetoshow) {
797 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
798 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C', 1);
802 if (!$totalWeighttoshow && !$totalVolumetoshow) {
807 $pdf->SetTextColor(0, 0, 0);
809 return ($tab2_top + ($tab2_hl * $index));
825 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
839 $pdf->SetTextColor(0, 0, 0);
840 $pdf->SetFont(
'',
'', $default_font_size - 2);
843 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
845 $pdf->SetDrawColor(128, 128, 128);
846 $pdf->SetFont(
'',
'', $default_font_size - 1);
849 if (empty($hidetop)) {
850 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
852 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
853 $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
857 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
858 if (empty($hidetop)) {
859 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
860 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
865 $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height);
866 if (empty($hidetop)) {
867 $pdf->SetXY($this->posxqtyordered - 1, $tab_top + 1);
868 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities(
"QtyOrdered"),
'',
'C');
873 $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
874 if (empty($hidetop)) {
875 $pdf->SetXY($this->posxqtytoship, $tab_top + 1);
876 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
"QtyToShip"),
'',
'C');
881 $pdf->line($this->posxpuht - 1, $tab_top, $this->posxpuht - 1, $tab_top + $tab_height);
882 if (empty($hidetop)) {
883 $pdf->SetXY($this->posxpuht - 1, $tab_top + 1);
884 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
887 $pdf->line($this->posxtotalht - 1, $tab_top, $this->posxtotalht - 1, $tab_top + $tab_height);
888 if (empty($hidetop)) {
889 $pdf->SetXY($this->posxtotalht - 1, $tab_top + 1);
890 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities(
"TotalHT"),
'',
'C');
908 global $conf, $langs, $mysoc;
910 $langs->load(
"orders");
917 $pdf->SetTextColor(0, 0, 60);
918 $pdf->SetFont(
'',
'B', $default_font_size + 3);
922 $posy = $this->marge_haute;
923 $posx = $this->page_largeur - $this->marge_droite - $w;
925 $pdf->SetXY($this->marge_gauche, $posy);
928 if ($this->emetteur->logo) {
929 $logodir = $conf->mycompany->dir_output;
930 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
931 $logodir = $conf->mycompany->multidir_output[
$object->entity];
934 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
936 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
938 if (is_readable($logo)) {
940 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
942 $pdf->SetTextColor(200, 0, 0);
943 $pdf->SetFont(
'',
'B', $default_font_size - 2);
944 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
945 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
948 $text = $this->emetteur->name;
949 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
952 $pdf->SetDrawColor(128, 128, 128);
954 $posx = $this->page_largeur - $w - $this->marge_droite;
955 $posy = $this->marge_haute;
957 $pdf->SetFont(
'',
'B', $default_font_size + 2);
958 $pdf->SetXY($posx, $posy);
959 $pdf->SetTextColor(0, 0, 60);
960 $title = $outputlangs->transnoentities(
"SendingSheet");
961 $pdf->MultiCell($w, 4, $title,
'',
'R');
963 $pdf->SetFont(
'',
'', $default_font_size + 1);
967 $pdf->SetXY($posx, $posy);
968 $pdf->SetTextColor(0, 0, 60);
969 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefSending").
" : ".
$object->ref,
'',
'R');
972 if (!empty(
$object->date_delivery)) {
974 $pdf->SetXY($posx, $posy);
975 $pdf->SetTextColor(0, 0, 60);
976 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
981 $pdf->SetXY($posx, $posy);
982 $pdf->SetTextColor(0, 0, 60);
983 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
987 $pdf->SetFont(
'',
'', $default_font_size + 3);
992 $origin_id =
$object->origin_id;
997 if (isModEnabled($origin)) {
998 $outputlangs->load(
'orders');
1000 $classname = ucfirst($origin);
1001 $linkedobject =
new $classname($this->db);
1002 $result = $linkedobject->fetch($origin_id);
1006 $pdf->SetFont(
'',
'', $default_font_size - 2);
1007 $text = $linkedobject->ref;
1008 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1009 $text .=
' ('.$linkedobject->ref_client.
')';
1012 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1013 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1015 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1016 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1032 $carac_emetteur =
'';
1034 $arrayidcontact = array();
1035 if (!empty($origin) && is_object(
$object->origin_object)) {
1036 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1038 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1039 $object->fetch_user(reset($arrayidcontact));
1040 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1041 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1043 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1047 $carac_emetteur .=
"\n";
1054 $posx = $this->marge_gauche;
1056 $posx = $this->page_largeur - $this->marge_droite - 80;
1064 $pdf->SetTextColor(0, 0, 0);
1065 $pdf->SetFont(
'',
'', $default_font_size - 2);
1066 $pdf->SetXY($posx, $posy - 5);
1067 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1068 $pdf->SetXY($posx, $posy);
1069 $pdf->SetFillColor(230, 230, 230);
1070 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1071 $pdf->SetTextColor(0, 0, 60);
1072 $pdf->SetFillColor(255, 255, 255);
1077 $pdf->SetXY($posx + 2, $posy + 3);
1078 $pdf->SetFont(
'',
'B', $default_font_size);
1079 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1080 $posy = $pdf->getY();
1084 $pdf->SetXY($posx + 2, $posy);
1085 $pdf->SetFont(
'',
'', $default_font_size - 1);
1086 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1090 $usecontact =
false;
1091 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1092 if (count($arrayidcontact) > 0) {
1094 $result =
$object->fetch_contact($arrayidcontact[0]);
1098 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1099 $thirdparty =
$object->contact;
1101 $thirdparty =
$object->thirdparty;
1110 if ($this->page_largeur < 210) {
1114 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1116 $posx = $this->marge_gauche;
1121 $pdf->SetTextColor(0, 0, 0);
1122 $pdf->SetFont(
'',
'', $default_font_size - 2);
1123 $pdf->SetXY($posx + 2, $posy - 5);
1124 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1125 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1129 $pdf->SetXY($posx + 2, $posy + 3);
1130 $pdf->SetFont(
'',
'B', $default_font_size);
1131 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1133 $posy = $pdf->getY();
1136 $pdf->SetXY($posx + 2, $posy);
1137 $pdf->SetFont(
'',
'', $default_font_size - 1);
1138 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1141 $pdf->SetTextColor(0, 0, 0);