175 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
178 global $user,
$conf, $langs, $hookmanager;
182 if (!is_object($outputlangs)) {
183 $outputlangs = $langs;
187 $outputlangs->charset_output =
'ISO-8859-1';
191 $outputlangs->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"other",
"compta"));
198 global $outputlangsbis;
199 $outputlangsbis =
null;
203 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"other",
"compta"));
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;
258 if (
$conf->expedition->dir_output) {
261 $dir =
$conf->expedition->dir_output.
"/sending";
262 $file = $dir.
"/SPECIMEN.pdf";
265 $dir =
$conf->expedition->dir_output.
"/sending/".$expref;
266 $file = $dir.
"/".$expref.
".pdf";
269 if (!file_exists($dir)) {
271 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
276 if (file_exists($dir)) {
278 if (!is_object($hookmanager)) {
279 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
282 $hookmanager->initHooks(array(
'pdfgeneration'));
283 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
285 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
292 $heightforinfotot = 8;
294 $heightforfooter = $this->marge_basse + 8;
296 $heightforfooter += 6;
298 $pdf->SetAutoPageBreak(1, 0);
300 if (class_exists(
'TCPDF')) {
301 $pdf->setPrintHeader(
false);
302 $pdf->setPrintFooter(
false);
307 $pagecount = $pdf->setSourceFile(
$conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
308 $tplidx = $pdf->importPage(1);
313 $pdf->SetDrawColor(128, 128, 128);
315 if (method_exists($pdf,
'AliasNbPages')) {
316 $pdf->AliasNbPages();
319 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
320 $pdf->SetSubject($outputlangs->transnoentities(
"Shipment"));
321 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
322 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
323 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Shipment"));
325 $pdf->SetCompression(
false);
329 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
333 if (!empty($tplidx)) {
334 $pdf->useTemplate($tplidx);
338 $pdf->SetFont(
'',
'', $default_font_size - 1);
339 $pdf->MultiCell(0, 3,
'');
340 $pdf->SetTextColor(0, 0, 0);
343 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
345 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
348 $height_incoterms = 0;
349 if (isModEnabled(
'incoterm')) {
350 $desc_incoterms =
$object->getIncotermsForPDF();
351 if ($desc_incoterms) {
354 $pdf->SetFont(
'',
'', $default_font_size - 1);
355 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
356 $nexY = $pdf->GetY();
357 $height_incoterms = $nexY - $tab_top;
360 $pdf->SetDrawColor(192, 192, 192);
361 $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');
363 $tab_top = $nexY + 6;
364 $height_incoterms += 4;
369 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
370 $tab_top_alt = $tab_top;
375 if (!empty(
$object->tracking_number)) {
376 $height_trackingnumber = 4;
378 $pdf->SetFont(
'',
'B', $default_font_size - 2);
379 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
380 $tab_top_alt = $pdf->GetY();
383 if (!empty(
$object->tracking_url)) {
384 if (
$object->shipping_method_id > 0) {
386 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
389 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
391 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
395 $label .=
$object->tracking_url;
398 $height_trackingnumber += 4;
399 $pdf->SetFont(
'',
'B', $default_font_size - 2);
400 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
403 $tab_top = $pdf->GetY();
407 if (!empty(
$object->note_public)) {
408 $pdf->SetFont(
'',
'', $default_font_size - 1);
412 $nexY = $pdf->GetY();
413 $height_note = $nexY - $tab_top;
416 $pdf->SetDrawColor(192, 192, 192);
417 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 3, $this->corner_radius,
'1234',
'D');
419 $tab_height -= $height_note;
420 $tab_top = $nexY + 6;
429 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
431 $encoding =
'QRCODE';
435 if ($module->encodingIsSupported($encoding)) {
436 $result = $module->writeBarCode(
$object->ref, $encoding);
440 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
441 $newcode =
dol_hash($newcode,
'md5');
443 $barcode_path =
$conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
449 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
451 $nexY = $pdf->GetY();
452 $height_barcode = 20;
456 $this->error =
'Failed to generate barcode';
461 $iniY = $tab_top + 7;
462 $curY = $tab_top + 7;
463 $nexY = $tab_top + 7;
466 for ($i = 0; $i < $nblines; $i++) {
468 $pdf->SetFont(
'',
'', $default_font_size - 1);
469 $pdf->SetTextColor(0, 0, 0);
472 $imglinesize = array();
473 if (!empty($realpatharray[$i])) {
477 $pdf->setTopMargin($tab_top_newpage);
478 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
479 $pageposbefore = $pdf->getPage();
481 $showpricebeforepagebreak = 1;
483 $posYAfterDescription = 0;
484 $heightforsignature = 0;
487 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
488 $pdf->AddPage(
'',
'',
true);
489 if (!empty($tplidx)) {
490 $pdf->useTemplate($tplidx);
495 $pdf->setPage($pageposbefore + 1);
497 $curY = $tab_top_newpage;
501 $showpricebeforepagebreak = 1;
503 $showpricebeforepagebreak = 0;
507 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
508 $curX = $this->posxpicture - 1;
509 $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
511 $posYAfterImage = $curY + $imglinesize[
'height'];
515 $curX = $this->posxdesc - 1;
517 $pdf->startTransaction();
518 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
520 $pageposafter = $pdf->getPage();
521 if ($pageposafter > $pageposbefore) {
522 $pdf->rollbackTransaction(
true);
523 $pageposafter = $pageposbefore;
525 $pdf->setPageOrientation(
'', 1, $heightforfooter);
526 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
528 $pageposafter = $pdf->getPage();
529 $posyafter = $pdf->GetY();
531 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
532 if ($i == ($nblines - 1)) {
533 $pdf->AddPage(
'',
'',
true);
534 if (!empty($tplidx)) {
535 $pdf->useTemplate($tplidx);
540 $pdf->setPage($pageposafter + 1);
547 $showpricebeforepagebreak = 1;
549 $showpricebeforepagebreak = 0;
553 $pdf->commitTransaction();
555 $posYAfterDescription = $pdf->GetY();
557 $nexY = max($pdf->GetY(), $posYAfterImage);
558 $pageposafter = $pdf->getPage();
560 $pdf->setPage($pageposbefore);
561 $pdf->setTopMargin($this->marge_haute);
562 $pdf->setPageOrientation(
'', 1, 0);
565 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
566 $pdf->setPage($pageposafter);
567 $curY = $tab_top_newpage;
571 if ($pageposafter > $pageposbefore) {
572 $pdf->setPage($pageposafter);
573 $curY = $tab_top_newpage;
576 $pdf->SetFont(
'',
'', $default_font_size - 1);
580 $pdf->SetXY($this->posxweightvol, $curY);
582 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
591 $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
596 $pdf->SetXY($this->posxqtyordered, $curY);
597 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3,
$object->lines[$i]->qty_asked,
'',
'C');
601 $pdf->SetXY($this->posxqtytoship, $curY);
602 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3,
$object->lines[$i]->qty_shipped,
'',
'C');
606 $pdf->SetXY($this->posxpuht, $curY);
607 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
609 $pdf->SetXY($this->posxtotalht, $curY);
610 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price(
$object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
614 if ($weighttxt && $voltxt) {
620 $pdf->setPage($pageposafter);
621 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
623 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
624 $pdf->SetLineStyle(array(
'dash' => 0));
628 while ($pagenb < $pageposafter) {
629 $pdf->setPage($pagenb);
631 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
633 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
637 $pdf->setPage($pagenb);
638 $pdf->setPageOrientation(
'', 1, 0);
642 if (!empty($tplidx)) {
643 $pdf->useTemplate($tplidx);
646 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
648 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
650 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
655 if (!empty($tplidx)) {
656 $pdf->useTemplate($tplidx);
667 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
668 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
670 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
671 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
679 if (method_exists($pdf,
'AliasNbPages')) {
680 $pdf->AliasNbPages();
685 $pdf->Output($file,
'F');
688 $hookmanager->initHooks(array(
'pdfgeneration'));
689 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
691 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
693 $this->error = $hookmanager->error;
694 $this->errors = $hookmanager->errors;
699 $this->result = array(
'fullpath' => $file);
703 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
707 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
727 global
$conf, $mysoc;
735 $pdf->SetFont(
'',
'B', $default_font_size - 1);
738 $col1x = $this->posxweightvol - 50;
739 $col2x = $this->posxweightvol;
745 $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
747 $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
753 $totalWeighttoshow =
'';
754 $totalVolumetoshow =
'';
757 $tmparray =
$object->getTotalWeightVolume();
758 $totalWeight = $tmparray[
'weight'];
759 $totalVolume = $tmparray[
'volume'];
760 $totalOrdered = $tmparray[
'ordered'];
761 $totalToShip = $tmparray[
'toship'];
769 if (!empty($totalWeight)) {
775 if (!empty(
$object->trueWeight)) {
782 $pdf->SetFillColor(255, 255, 255);
783 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
784 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L', 1);
787 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
788 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0,
'C', 1);
792 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
793 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0,
'C', 1);
797 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
798 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C', 1);
800 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
801 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price(
$object->total_ht, 0, $outputlangs), 0,
'C', 1);
806 if ($totalWeighttoshow) {
807 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
808 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C', 1);
812 if ($totalVolumetoshow) {
813 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
814 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C', 1);
818 if (!$totalWeighttoshow && !$totalVolumetoshow) {
823 $pdf->SetTextColor(0, 0, 0);
825 return ($tab2_top + ($tab2_hl * $index));
841 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
855 $pdf->SetTextColor(0, 0, 0);
856 $pdf->SetFont(
'',
'', $default_font_size - 2);
859 $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');
861 $pdf->SetDrawColor(128, 128, 128);
862 $pdf->SetFont(
'',
'', $default_font_size - 1);
865 if (empty($hidetop)) {
866 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
868 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
869 $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
873 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
874 if (empty($hidetop)) {
875 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
876 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
881 $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height);
882 if (empty($hidetop)) {
883 $pdf->SetXY($this->posxqtyordered - 1, $tab_top + 1);
884 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities(
"QtyOrdered"),
'',
'C');
889 $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
890 if (empty($hidetop)) {
891 $pdf->SetXY($this->posxqtytoship, $tab_top + 1);
892 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
"QtyToShip"),
'',
'C');
897 $pdf->line($this->posxpuht - 1, $tab_top, $this->posxpuht - 1, $tab_top + $tab_height);
898 if (empty($hidetop)) {
899 $pdf->SetXY($this->posxpuht - 1, $tab_top + 1);
900 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
903 $pdf->line($this->posxtotalht - 1, $tab_top, $this->posxtotalht - 1, $tab_top + $tab_height);
904 if (empty($hidetop)) {
905 $pdf->SetXY($this->posxtotalht - 1, $tab_top + 1);
906 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities(
"TotalHT"),
'',
'C');
924 global
$conf, $langs, $mysoc;
926 $langs->load(
"orders");
933 $pdf->SetTextColor(0, 0, 60);
934 $pdf->SetFont(
'',
'B', $default_font_size + 3);
938 $posy = $this->marge_haute;
939 $posx = $this->page_largeur - $this->marge_droite - $w;
941 $pdf->SetXY($this->marge_gauche, $posy);
944 if ($this->emetteur->logo) {
945 $logodir =
$conf->mycompany->dir_output;
946 if (!empty(
$conf->mycompany->multidir_output[
$object->entity])) {
947 $logodir =
$conf->mycompany->multidir_output[
$object->entity];
950 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
952 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
954 if (is_readable($logo)) {
956 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
958 $pdf->SetTextColor(200, 0, 0);
959 $pdf->SetFont(
'',
'B', $default_font_size - 2);
960 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
961 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
964 $text = $this->emetteur->name;
965 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
968 $pdf->SetDrawColor(128, 128, 128);
970 $posx = $this->page_largeur - $w - $this->marge_droite;
971 $posy = $this->marge_haute;
973 $pdf->SetFont(
'',
'B', $default_font_size + 2);
974 $pdf->SetXY($posx, $posy);
975 $pdf->SetTextColor(0, 0, 60);
976 $title = $outputlangs->transnoentities(
"SendingSheet");
977 $pdf->MultiCell($w, 4, $title,
'',
'R');
979 $pdf->SetFont(
'',
'', $default_font_size + 1);
983 $pdf->SetXY($posx, $posy);
984 $pdf->SetTextColor(0, 0, 60);
985 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefSending").
" : ".
$object->ref,
'',
'R');
988 if (!empty(
$object->date_delivery)) {
990 $pdf->SetXY($posx, $posy);
991 $pdf->SetTextColor(0, 0, 60);
992 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
997 $pdf->SetXY($posx, $posy);
998 $pdf->SetTextColor(0, 0, 60);
999 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1004 $pdf->SetXY($posx, $posy);
1005 $pdf->SetTextColor(0, 0, 60);
1006 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_compta_client),
'',
'R');
1009 $pdf->SetFont(
'',
'', $default_font_size + 3);
1014 $origin_id =
$object->origin_id;
1019 if (isModEnabled($origin)) {
1020 $outputlangs->load(
'orders');
1022 $classname = ucfirst($origin);
1023 $linkedobject =
new $classname($this->db);
1024 '@phan-var-force Commande|Facture $linkedobject';
1025 $result = $linkedobject->fetch($origin_id);
1029 $pdf->SetFont(
'',
'', $default_font_size - 2);
1030 $text = $linkedobject->ref;
1031 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1032 $text .=
' ('.$linkedobject->ref_client.
')';
1035 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1036 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1038 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1039 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1055 $carac_emetteur =
'';
1057 $arrayidcontact = array();
1058 if (!empty($origin) && is_object(
$object->origin_object)) {
1059 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1061 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1062 $object->fetch_user(reset($arrayidcontact));
1063 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1064 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1066 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1070 $carac_emetteur .=
"\n";
1077 $posx = $this->marge_gauche;
1079 $posx = $this->page_largeur - $this->marge_droite - 80;
1087 $pdf->SetTextColor(0, 0, 0);
1088 $pdf->SetFont(
'',
'', $default_font_size - 2);
1089 $pdf->SetXY($posx, $posy - 5);
1090 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1091 $pdf->SetXY($posx, $posy);
1092 $pdf->SetFillColor(230, 230, 230);
1093 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'F');
1094 $pdf->SetTextColor(0, 0, 60);
1095 $pdf->SetFillColor(255, 255, 255);
1100 $pdf->SetXY($posx + 2, $posy + 3);
1101 $pdf->SetFont(
'',
'B', $default_font_size);
1102 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1103 $posy = $pdf->getY();
1107 $pdf->SetXY($posx + 2, $posy);
1108 $pdf->SetFont(
'',
'', $default_font_size - 1);
1109 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1113 $usecontact =
false;
1114 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1115 if (count($arrayidcontact) > 0) {
1117 $result =
$object->fetch_contact($arrayidcontact[0]);
1121 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset(
$conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1122 $thirdparty =
$object->contact;
1124 $thirdparty =
$object->thirdparty;
1133 if ($this->page_largeur < 210) {
1137 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1139 $posx = $this->marge_gauche;
1144 $pdf->SetTextColor(0, 0, 0);
1145 $pdf->SetFont(
'',
'', $default_font_size - 2);
1146 $pdf->SetXY($posx + 2, $posy - 5);
1147 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1148 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1152 $pdf->SetXY($posx + 2, $posy + 3);
1153 $pdf->SetFont(
'',
'B', $default_font_size);
1154 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1156 $posy = $pdf->getY();
1159 $pdf->SetXY($posx + 2, $posy);
1160 $pdf->SetFont(
'',
'', $default_font_size - 1);
1161 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1164 $pdf->SetTextColor(0, 0, 0);