146 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
149 global $user,
$conf, $langs, $hookmanager;
153 if (!is_object($outputlangs)) {
154 $outputlangs = $langs;
158 $outputlangs->charset_output =
'ISO-8859-1';
161 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal",
"deliveries",
"receptions",
"productbatch",
"sendings"));
168 $nblines = count(
$object->lines);
171 $realpatharray = array();
173 $objphoto =
new Product($this->db);
175 for ($i = 0; $i < $nblines; $i++) {
176 if (empty(
$object->lines[$i]->fk_product)) {
180 $objphoto =
new Product($this->db);
181 $objphoto->fetch(
$object->lines[$i]->fk_product);
184 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
185 $dir =
$conf->product->dir_output.
'/'.$pdir;
187 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product');
188 $dir =
$conf->product->dir_output.
'/'.$pdir;
193 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
196 if ($obj[
'photo_vignette']) {
197 $filename = $obj[
'photo_vignette'];
199 $filename = $obj[
'photo'];
202 $filename = $obj[
'photo'];
205 $realpath = $dir.$filename;
210 $realpatharray[$i] = $realpath;
215 if (count($realpatharray) == 0) {
216 $this->posxpicture = $this->posxweightvol;
219 if (
$conf->reception->dir_output) {
222 $dir =
$conf->reception->dir_output;
223 $file = $dir.
"/SPECIMEN.pdf";
226 $dir =
$conf->reception->dir_output.
"/".$rcpref;
227 $file = $dir.
"/".$rcpref.
".pdf";
230 if (!file_exists($dir)) {
232 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
237 if (file_exists($dir)) {
239 if (!is_object($hookmanager)) {
240 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
243 $hookmanager->initHooks(array(
'pdfgeneration'));
244 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
246 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
249 $nblines = count(
$object->lines);
253 $heightforinfotot = 8;
255 $heightforfooter = $this->marge_basse + 8;
256 $pdf->SetAutoPageBreak(1, 0);
258 if (class_exists(
'TCPDF')) {
259 $pdf->setPrintHeader(
false);
260 $pdf->setPrintFooter(
false);
265 $pagecount = $pdf->setSourceFile(
$conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
266 $tplidx = $pdf->importPage(1);
271 $pdf->SetDrawColor(128, 128, 128);
273 if (method_exists($pdf,
'AliasNbPages')) {
274 $pdf->AliasNbPages();
277 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
278 $pdf->SetSubject($outputlangs->transnoentities(
"Reception"));
279 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
280 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
281 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Reception"));
283 $pdf->SetCompression(
false);
287 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
291 if (!empty($tplidx)) {
292 $pdf->useTemplate($tplidx);
296 $pdf->SetFont(
'',
'', $default_font_size - 1);
297 $pdf->MultiCell(0, 3,
'');
298 $pdf->SetTextColor(0, 0, 0);
301 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
303 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
306 $height_incoterms = 0;
307 if (isModEnabled(
'incoterm')) {
308 $desc_incoterms =
$object->getIncotermsForPDF();
310 if ($desc_incoterms) {
313 $pdf->SetFont(
'',
'', $default_font_size - 1);
314 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
315 $nexY = $pdf->GetY();
316 $height_incoterms = $nexY - $tab_top;
319 $pdf->SetDrawColor(192, 192, 192);
320 $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');
322 $tab_top = $nexY + 6;
323 $height_incoterms += 4;
328 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
329 $tab_top_alt = $tab_top;
334 if (!empty(
$object->tracking_number)) {
335 $pdf->SetFont(
'',
'B', $default_font_size - 2);
336 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
337 $tab_top_alt = $pdf->GetY();
340 if (!empty(
$object->tracking_url)) {
341 if (
$object->reception_method_id > 0) {
343 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipment_method_id,
'c_shipment_mode',
'rowid',
'code');
346 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
348 $label .= $outputlangs->trans(
"ReceptionMethod").
": ".$outputlangs->trans(
"ReceptionMethod".strtoupper($code));
352 $label .=
$object->tracking_url;
354 $pdf->SetFont(
'',
'B', $default_font_size - 2);
355 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
357 $tab_top_alt = $pdf->GetY();
363 if (!empty(
$object->note_public)) {
364 $pdf->SetFont(
'',
'', $default_font_size - 1);
368 $nexY = $pdf->GetY();
369 $height_note = $nexY - $tab_top;
372 $pdf->SetDrawColor(192, 192, 192);
373 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius,
'1234',
'D');
375 $tab_height -= $height_note;
376 $tab_top = $nexY + 6;
385 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
387 $encoding =
'QRCODE';
391 if ($module->encodingIsSupported($encoding)) {
392 $result = $module->writeBarCode(
$object->ref, $encoding);
396 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
397 $newcode =
dol_hash($newcode,
'md5');
399 $barcode_path =
$conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
405 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
407 $nexY = $pdf->GetY();
408 $height_barcode = 20;
412 $this->error =
'Failed to generate barcode';
416 $iniY = $tab_top + 7;
417 $curY = $tab_top + 7;
418 $nexY = $tab_top + 7;
419 $fk_commandefourndet = 0;
424 for ($i = 0; $i < $nblines; $i++) {
426 $pdf->SetFont(
'',
'', $default_font_size - 1);
427 $pdf->SetTextColor(0, 0, 0);
430 $imglinesize = array();
431 if (!empty($realpatharray[$i])) {
435 $pdf->setTopMargin($tab_top_newpage);
436 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
437 $pageposbefore = $pdf->getPage();
439 $showpricebeforepagebreak = 1;
441 $posYAfterDescription = 0;
444 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
445 $pdf->AddPage(
'',
'',
true);
446 if (!empty($tplidx)) {
447 $pdf->useTemplate($tplidx);
452 $pdf->setPage($pageposbefore + 1);
454 $curY = $tab_top_newpage;
458 $showpricebeforepagebreak = 1;
460 $showpricebeforepagebreak = 0;
464 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
465 $curX = $this->posxpicture - 1;
466 $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
468 $posYAfterImage = $curY + $imglinesize[
'height'];
472 $curX = $this->posxdesc - 1;
486 $pdf->startTransaction();
487 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
489 $pageposafter = $pdf->getPage();
490 if ($pageposafter > $pageposbefore) {
491 $pdf->rollbackTransaction(
true);
492 $pageposafter = $pageposbefore;
494 $pdf->setPageOrientation(
'', 1, $heightforfooter);
496 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
498 $pageposafter = $pdf->getPage();
499 $posyafter = $pdf->GetY();
501 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
502 if ($i == ($nblines - 1)) {
503 $pdf->AddPage(
'',
'',
true);
504 if (!empty($tplidx)) {
505 $pdf->useTemplate($tplidx);
510 $pdf->setPage($pageposafter + 1);
517 $showpricebeforepagebreak = 1;
519 $showpricebeforepagebreak = 0;
523 $pdf->commitTransaction();
525 $posYAfterDescription = $pdf->GetY();
527 $nexY = max($pdf->GetY(), $posYAfterImage);
528 $pageposafter = $pdf->getPage();
530 $pdf->setPage($pageposbefore);
531 $pdf->setTopMargin($this->marge_haute);
532 $pdf->setPageOrientation(
'', 1, 0);
535 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
536 $pdf->setPage($pageposafter);
537 $curY = $tab_top_newpage;
541 if ($pageposafter > $pageposbefore) {
542 $pdf->setPage($pageposafter);
543 $curY = $tab_top_newpage;
546 $pdf->SetFont(
'',
'', $default_font_size - 1);
549 $pdf->SetXY($this->posxweightvol, $curY);
551 if (
$object->lines[$i]->fk_product_type == 0 && is_object(
$object->lines[$i]->product) &&
$object->lines[$i]->product->weight) {
555 if (
$object->lines[$i]->fk_product_type == 0 && is_object(
$object->lines[$i]->product) &&
$object->lines[$i]->product->volume) {
560 $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
566 $pdf->SetXY($this->posxqtyordered, $curY);
567 if (
$object->lines[$i]->fk_commandefourndet != $fk_commandefourndet) {
568 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3,
$object->lines[$i]->qty_asked,
'',
'C');
569 $totalOrdered +=
$object->lines[$i]->qty_asked;
571 $fk_commandefourndet =
$object->lines[$i]->fk_commandefourndet;
575 $pdf->SetXY($this->posxqtytoship, $curY);
576 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3,
$object->lines[$i]->qty,
'',
'C');
580 $pdf->SetXY($this->posxpuht, $curY);
581 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
584 $pdf->SetXY($this->posxtotalht, $curY);
585 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price($amountreceived, 0, $outputlangs),
'',
'R');
587 $totalAmount += $amountreceived;
591 if ($weighttxt && $voltxt) {
597 $pdf->setPage($pageposafter);
598 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
600 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
601 $pdf->SetLineStyle(array(
'dash' => 0));
605 while ($pagenb < $pageposafter) {
606 $pdf->setPage($pagenb);
608 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object);
610 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object);
614 $pdf->setPage($pagenb);
615 $pdf->setPageOrientation(
'', 1, 0);
616 if (!empty($tplidx)) {
617 $pdf->useTemplate($tplidx);
620 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
622 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object);
624 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object);
629 if (!empty($tplidx)) {
630 $pdf->useTemplate($tplidx);
638 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0,
$object);
639 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
641 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object);
642 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
646 $posy = $this->
_tableau_tot($pdf,
$object, 0, $bottomlasttab, $outputlangs, $totalOrdered, $totalAmount);
650 if (method_exists($pdf,
'AliasNbPages')) {
651 $pdf->AliasNbPages();
656 $pdf->Output($file,
'F');
659 $hookmanager->initHooks(array(
'pdfgeneration'));
660 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
662 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
664 $this->error = $hookmanager->error;
665 $this->errors = $hookmanager->errors;
670 $this->result = array(
'fullpath' => $file);
674 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
678 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
697 protected function _tableau_tot(&$pdf,
$object, $deja_regle, $posy, $outputlangs, $totalOrdered, $totalAmount = 0)
700 global
$conf, $mysoc;
708 $pdf->SetFont(
'',
'B', $default_font_size - 1);
711 $col1x = $this->posxweightvol - 50;
712 $col2x = $this->posxweightvol;
718 $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
720 $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
726 $totalWeighttoshow =
'';
727 $totalVolumetoshow =
'';
730 $tmparray =
$object->getTotalWeightVolume();
731 $totalWeight = $tmparray[
'weight'];
732 $totalVolume = $tmparray[
'volume'];
733 $totalToShip = $tmparray[
'toship'];
741 if ($totalWeight !=
'') {
744 if ($totalVolume !=
'') {
754 $pdf->SetFillColor(255, 255, 255);
755 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
756 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L', 1);
761 if ($totalWeighttoshow) {
762 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * ($index + $index2));
763 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C', 1);
766 if ($totalVolumetoshow) {
767 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * ($index + $index2));
768 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C', 1);
774 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
775 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0,
'C', 1);
779 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
780 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0,
'C', 1);
784 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
785 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C', 1);
787 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
788 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price($totalAmount, 0, $outputlangs), 0,
'C', 1);
791 $pdf->SetTextColor(0, 0, 0);
798 return ($tab2_top + ($tab2_hl * $index));
815 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0,
$object =
null)
828 $pdf->SetTextColor(0, 0, 0);
829 $pdf->SetFont(
'',
'', $default_font_size - 2);
832 $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');
834 $pdf->SetDrawColor(128, 128, 128);
835 $pdf->SetFont(
'',
'', $default_font_size - 1);
838 if (empty($hidetop)) {
839 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
841 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
842 $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
846 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
847 if (empty($hidetop)) {
848 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
849 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
854 $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height);
855 if (empty($hidetop)) {
856 $pdf->SetXY($this->posxqtyordered - 1, $tab_top + 1);
857 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities(
"QtyOrdered"),
'',
'C');
862 $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
863 if (empty($hidetop)) {
864 $pdf->SetXY($this->posxqtytoship, $tab_top + 1);
865 $statusreceived = Reception::STATUS_CLOSED;
867 $statusreceived = Reception::STATUS_VALIDATED;
870 $statusreceived = Reception::STATUS_CLOSED;
873 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
'QtyToReceive'),
'',
'C');
875 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
'QtyReceived'),
'',
'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');
907 global
$conf, $langs, $mysoc;
909 $langs->load(
"orders");
916 $pdf->SetTextColor(0, 0, 60);
917 $pdf->SetFont(
'',
'B', $default_font_size + 3);
921 $posy = $this->marge_haute;
922 $posx = $this->page_largeur - $this->marge_droite - $w;
924 $pdf->SetXY($this->marge_gauche, $posy);
927 if ($this->emetteur->logo) {
928 $logodir =
$conf->mycompany->dir_output;
929 if (!empty(
$conf->mycompany->multidir_output[
$object->entity])) {
930 $logodir =
$conf->mycompany->multidir_output[
$object->entity];
933 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
935 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
937 if (is_readable($logo)) {
939 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
941 $pdf->SetTextColor(200, 0, 0);
942 $pdf->SetFont(
'',
'B', $default_font_size - 2);
943 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
944 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
947 $text = $this->emetteur->name;
948 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
951 $pdf->SetDrawColor(128, 128, 128);
953 $posx = $this->page_largeur - $w - $this->marge_droite;
954 $posy = $this->marge_haute;
956 $pdf->SetFont(
'',
'B', $default_font_size + 2);
957 $pdf->SetXY($posx, $posy);
958 $pdf->SetTextColor(0, 0, 60);
959 $title = $outputlangs->transnoentities(
"ReceptionSheet");
960 $pdf->MultiCell($w, 4, $title,
'',
'R');
962 $pdf->SetFont(
'',
'', $default_font_size + 1);
966 $pdf->SetXY($posx, $posy);
967 $pdf->SetTextColor(0, 0, 60);
968 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefReception").
" : ".
$object->ref,
'',
'R');
971 if (!empty(
$object->date_delivery)) {
973 $pdf->SetXY($posx, $posy);
974 $pdf->SetTextColor(0, 0, 60);
975 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
978 if (!empty(
$object->thirdparty->code_fournisseur)) {
980 $pdf->SetXY($posx, $posy);
981 $pdf->SetTextColor(0, 0, 60);
982 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_fournisseur),
'',
'R');
986 $pdf->SetFont(
'',
'', $default_font_size + 3);
991 $origin_id =
$object->origin_id;
996 if (isModEnabled(
"supplier_order")) {
997 $outputlangs->load(
'orders');
999 $classname =
'CommandeFournisseur';
1000 $linkedobject =
new $classname($this->db);
1001 $result = $linkedobject->fetch($origin_id);
1005 $pdf->SetFont(
'',
'', $default_font_size - 2);
1006 $text = $linkedobject->ref;
1007 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1008 $text .=
' ('.$linkedobject->ref_client.
')';
1011 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1012 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1014 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1015 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1023 $carac_emetteur =
'';
1025 $arrayidcontact = array();
1026 if (!empty($origin) && is_object(
$object->origin_object)) {
1027 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1029 if (empty($arrayidcontact)) {
1030 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SHIPPING');
1032 if (count($arrayidcontact) > 0) {
1033 $object->fetch_user(reset($arrayidcontact));
1034 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1035 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1037 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1041 $carac_emetteur .=
"\n";
1048 $posx = $this->marge_gauche;
1050 $posx = $this->page_largeur - $this->marge_droite - 80;
1057 $pdf->SetTextColor(0, 0, 0);
1058 $pdf->SetFont(
'',
'', $default_font_size - 2);
1059 $pdf->SetXY($posx, $posy - 5);
1060 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1061 $pdf->SetXY($posx, $posy);
1062 $pdf->SetFillColor(230, 230, 230);
1063 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'F');
1064 $pdf->SetTextColor(0, 0, 60);
1065 $pdf->SetFillColor(255, 255, 255);
1068 $usecontact =
false;
1069 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1071 if (count($arrayidcontact) > 0) {
1073 $result =
$object->fetch_contact($arrayidcontact[0]);
1077 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset(
$conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1078 $thirdparty =
$object->contact;
1080 $thirdparty =
$object->thirdparty;
1088 $pdf->SetXY($posx + 2, $posy + 3);
1089 $pdf->SetFont(
'',
'B', $default_font_size);
1090 $pdf->MultiCell($widthrecbox - 2, 4, $carac_client_name, 0,
'L');
1092 $posy = $pdf->getY();
1095 $pdf->SetFont(
'',
'', $default_font_size - 1);
1096 $pdf->SetXY($posx + 2, $posy);
1097 $pdf->MultiCell($widthrecbox - 2, 4, $carac_client, 0,
'L');
1101 if ($this->page_largeur < 210) {
1105 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1107 $posx = $this->marge_gauche;
1111 $pdf->SetTextColor(0, 0, 0);
1112 $pdf->SetFont(
'',
'', $default_font_size - 2);
1113 $pdf->SetXY($posx + 2, $posy - 5);
1114 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1115 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius,
'1234',
'D');
1120 $pdf->SetXY($posx + 2, $posy + 3);
1121 $pdf->SetFont(
'',
'B', $default_font_size);
1122 $pdf->MultiCell($widthrecbox, 2, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1123 $posy = $pdf->getY();
1126 $pdf->SetXY($posx + 2, $posy);
1127 $pdf->SetFont(
'',
'', $default_font_size - 1);
1128 $pdf->MultiCell($widthrecbox, 4, $carac_emetteur, 0,
'L');
1131 $pdf->SetTextColor(0, 0, 0);