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",
"sendings",
"productbatch",
"other",
"compta"));
198 global $outputlangsbis;
199 $outputlangsbis =
null;
201 $outputlangsbis =
new Translate(
'', $conf);
203 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"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(
true, 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;
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, (
string)
$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(
'',
true, $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(
'',
true, $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(
'',
true, 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, (string)
$object->lines[$i]->qty_asked,
'',
'C');
601 $pdf->SetXY($this->posxqtytoship, $curY);
602 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, (string)
$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(
'',
true, 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);
692 $this->warnings = $hookmanager->warnings;
694 $this->error = $hookmanager->error;
695 $this->errors = $hookmanager->errors;
702 $this->result = array(
'fullpath' => $file);
706 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
710 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
738 $pdf->SetFont(
'',
'B', $default_font_size - 1);
741 $col1x = $this->posxweightvol - 50;
742 $col2x = $this->posxweightvol;
748 $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
750 $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
756 $totalWeighttoshow =
'';
757 $totalVolumetoshow =
'';
760 $tmparray =
$object->getTotalWeightVolume();
761 $totalWeight = $tmparray[
'weight'];
762 $totalVolume = $tmparray[
'volume'];
763 $totalOrdered = $tmparray[
'ordered'];
764 $totalToShip = $tmparray[
'toship'];
772 if (!empty($totalWeight)) {
778 if (!empty(
$object->trueWeight)) {
785 $pdf->SetFillColor(255, 255, 255);
786 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
787 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L',
true);
790 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
791 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, (
string) $totalOrdered, 0,
'C',
true);
795 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
796 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, (
string) $totalToShip, 0,
'C',
true);
800 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
801 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C',
true);
803 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
804 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price(
$object->total_ht, 0, $outputlangs), 0,
'C',
true);
809 if ($totalWeighttoshow) {
810 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
811 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C',
true);
815 if ($totalVolumetoshow) {
816 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
817 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C',
true);
821 if (!$totalWeighttoshow && !$totalVolumetoshow) {
826 $pdf->SetTextColor(0, 0, 0);
828 return ($tab2_top + ($tab2_hl * $index));
844 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
858 $pdf->SetTextColor(0, 0, 0);
859 $pdf->SetFont(
'',
'', $default_font_size - 2);
862 $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');
864 $pdf->SetDrawColor(128, 128, 128);
865 $pdf->SetFont(
'',
'', $default_font_size - 1);
868 if (empty($hidetop)) {
869 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
871 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
872 $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
876 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
877 if (empty($hidetop)) {
878 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
879 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
884 $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height);
885 if (empty($hidetop)) {
886 $pdf->SetXY($this->posxqtyordered - 1, $tab_top + 1);
887 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities(
"QtyOrdered"),
'',
'C');
892 $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
893 if (empty($hidetop)) {
894 $pdf->SetXY($this->posxqtytoship, $tab_top + 1);
895 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
"QtyToShip"),
'',
'C');
900 $pdf->line($this->posxpuht - 1, $tab_top, $this->posxpuht - 1, $tab_top + $tab_height);
901 if (empty($hidetop)) {
902 $pdf->SetXY($this->posxpuht - 1, $tab_top + 1);
903 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
906 $pdf->line($this->posxtotalht - 1, $tab_top, $this->posxtotalht - 1, $tab_top + $tab_height);
907 if (empty($hidetop)) {
908 $pdf->SetXY($this->posxtotalht - 1, $tab_top + 1);
909 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities(
"TotalHT"),
'',
'C');
927 global $conf, $langs,
$mysoc;
929 $langs->load(
"orders");
936 $pdf->SetTextColor(0, 0, 60);
937 $pdf->SetFont(
'',
'B', $default_font_size + 3);
941 $posy = $this->marge_haute;
942 $posx = $this->page_largeur - $this->marge_droite - $w;
944 $pdf->SetXY($this->marge_gauche, $posy);
947 if ($this->emetteur->logo) {
948 $logodir = $conf->mycompany->dir_output;
949 if (!empty($conf->mycompany->multidir_output[
$object->entity ?? $conf->entity])) {
950 $logodir = $conf->mycompany->multidir_output[
$object->entity ?? $conf->entity];
953 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
955 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
957 if (is_readable($logo)) {
959 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
961 $pdf->SetTextColor(200, 0, 0);
962 $pdf->SetFont(
'',
'B', $default_font_size - 2);
963 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
964 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
967 $text = $this->emetteur->name;
968 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
971 $pdf->SetDrawColor(128, 128, 128);
973 $posx = $this->page_largeur - $w - $this->marge_droite;
974 $posy = $this->marge_haute;
976 $pdf->SetFont(
'',
'B', $default_font_size + 2);
977 $pdf->SetXY($posx, $posy);
978 $pdf->SetTextColor(0, 0, 60);
979 $title = $outputlangs->transnoentities(
"SendingSheet");
980 $pdf->MultiCell($w, 4, $title,
'',
'R');
982 $pdf->SetFont(
'',
'', $default_font_size + 1);
986 $pdf->SetXY($posx, $posy);
987 $pdf->SetTextColor(0, 0, 60);
988 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefSending").
" : ".
$object->ref,
'',
'R');
991 if (!empty(
$object->date_delivery)) {
993 $pdf->SetXY($posx, $posy);
994 $pdf->SetTextColor(0, 0, 60);
995 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
1000 $pdf->SetXY($posx, $posy);
1001 $pdf->SetTextColor(0, 0, 60);
1002 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1007 $pdf->SetXY($posx, $posy);
1008 $pdf->SetTextColor(0, 0, 60);
1009 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_compta_client),
'',
'R');
1012 $pdf->SetFont(
'',
'', $default_font_size + 3);
1017 $origin_id =
$object->origin_id;
1023 $outputlangs->load(
'orders');
1025 $classname = ucfirst($origin);
1026 $linkedobject =
new $classname($this->db);
1027 '@phan-var-force Commande|Facture $linkedobject';
1028 $result = $linkedobject->fetch($origin_id);
1032 $pdf->SetFont(
'',
'', $default_font_size - 2);
1033 $text = $linkedobject->ref;
1034 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1035 $text .=
' ('.$linkedobject->ref_client.
')';
1038 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1039 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities((
string) $text), 0,
'R');
1041 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1042 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1058 $carac_emetteur =
'';
1060 $arrayidcontact = array();
1061 if (!empty($origin) && is_object(
$object->origin_object)) {
1062 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1064 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1065 $object->fetch_user(reset($arrayidcontact));
1066 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1067 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1069 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1073 $carac_emetteur .=
"\n";
1080 $posx = $this->marge_gauche;
1082 $posx = $this->page_largeur - $this->marge_droite - 80;
1090 $pdf->SetTextColor(0, 0, 0);
1091 $pdf->SetFont(
'',
'', $default_font_size - 2);
1092 $pdf->SetXY($posx, $posy - 5);
1093 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1094 $pdf->SetXY($posx, $posy);
1095 $pdf->SetFillColor(230, 230, 230);
1096 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'F');
1097 $pdf->SetTextColor(0, 0, 60);
1098 $pdf->SetFillColor(255, 255, 255);
1103 $pdf->SetXY($posx + 2, $posy + 3);
1104 $pdf->SetFont(
'',
'B', $default_font_size);
1105 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1106 $posy = $pdf->getY();
1110 $pdf->SetXY($posx + 2, $posy);
1111 $pdf->SetFont(
'',
'', $default_font_size - 1);
1112 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1116 $usecontact =
false;
1117 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1118 if (count($arrayidcontact) > 0) {
1120 $result =
$object->fetch_contact($arrayidcontact[0]);
1124 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1125 $thirdparty =
$object->contact;
1127 $thirdparty =
$object->thirdparty;
1136 if ($this->page_largeur < 210) {
1140 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1142 $posx = $this->marge_gauche;
1147 $pdf->SetTextColor(0, 0, 0);
1148 $pdf->SetFont(
'',
'', $default_font_size - 2);
1149 $pdf->SetXY($posx + 2, $posy - 5);
1150 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1151 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1155 $pdf->SetXY($posx + 2, $posy + 3);
1156 $pdf->SetFont(
'',
'B', $default_font_size);
1157 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1159 $posy = $pdf->getY();
1162 $pdf->SetXY($posx + 2, $posy);
1163 $pdf->SetFont(
'',
'', $default_font_size - 1);
1164 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1167 $pdf->SetTextColor(0, 0, 0);