140 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
143 global $user, $conf, $langs, $hookmanager;
147 if (!is_object($outputlangs)) {
148 $outputlangs = $langs;
152 $outputlangs->charset_output =
'ISO-8859-1';
155 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal",
"deliveries",
"receptions",
"productbatch",
"sendings"));
162 $nblines = count(
$object->lines);
165 $realpatharray = array();
167 $objphoto =
new Product($this->db);
169 for ($i = 0; $i < $nblines; $i++) {
170 if (empty(
$object->lines[$i]->fk_product)) {
174 $objphoto =
new Product($this->db);
175 $objphoto->fetch(
$object->lines[$i]->fk_product);
178 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
179 $dir = $conf->product->dir_output.
'/'.$pdir;
181 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product');
182 $dir = $conf->product->dir_output.
'/'.$pdir;
187 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
190 if ($obj[
'photo_vignette']) {
191 $filename = $obj[
'photo_vignette'];
193 $filename = $obj[
'photo'];
196 $filename = $obj[
'photo'];
199 $realpath = $dir.$filename;
204 $realpatharray[$i] = $realpath;
209 if (count($realpatharray) == 0) {
210 $this->posxpicture = $this->posxweightvol;
213 if ($conf->reception->dir_output) {
216 $dir = $conf->reception->dir_output;
217 $file = $dir.
"/SPECIMEN.pdf";
220 $dir = $conf->reception->dir_output.
"/".$rcpref;
221 $file = $dir.
"/".$rcpref.
".pdf";
224 if (!file_exists($dir)) {
226 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
231 if (file_exists($dir)) {
233 if (!is_object($hookmanager)) {
234 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
237 $hookmanager->initHooks(array(
'pdfgeneration'));
238 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
240 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
243 $nblines = count(
$object->lines);
247 $heightforinfotot = 8;
248 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
249 $heightforfooter = $this->marge_basse + 8;
250 $pdf->SetAutoPageBreak(1, 0);
252 if (class_exists(
'TCPDF')) {
253 $pdf->setPrintHeader(
false);
254 $pdf->setPrintFooter(
false);
259 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
260 $tplidx = $pdf->importPage(1);
265 $pdf->SetDrawColor(128, 128, 128);
267 if (method_exists($pdf,
'AliasNbPages')) {
268 $pdf->AliasNbPages();
271 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
272 $pdf->SetSubject($outputlangs->transnoentities(
"Reception"));
273 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
274 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
275 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Reception"));
277 $pdf->SetCompression(
false);
281 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
285 if (!empty($tplidx)) {
286 $pdf->useTemplate($tplidx);
290 $pdf->SetFont(
'',
'', $default_font_size - 1);
291 $pdf->MultiCell(0, 3,
'');
292 $pdf->SetTextColor(0, 0, 0);
295 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
297 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
300 $height_incoterms = 0;
301 if (isModEnabled(
'incoterm')) {
302 $desc_incoterms =
$object->getIncotermsForPDF();
304 if ($desc_incoterms) {
307 $pdf->SetFont(
'',
'', $default_font_size - 1);
308 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
309 $nexY = $pdf->GetY();
310 $height_incoterms = $nexY - $tab_top;
313 $pdf->SetDrawColor(192, 192, 192);
314 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
316 $tab_top = $nexY + 6;
317 $height_incoterms += 4;
322 if (!empty(
$object->note_public) || !empty(
$object->tracking_number)) {
323 $tab_top_alt = $tab_top;
328 if (!empty(
$object->tracking_number)) {
329 $pdf->SetFont(
'',
'B', $default_font_size - 2);
330 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".
$object->tracking_number, 0, 1,
false,
true,
'L');
331 $tab_top_alt = $pdf->GetY();
334 if (!empty(
$object->tracking_url)) {
335 if (
$object->reception_method_id > 0) {
337 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipment_method_id,
'c_shipment_mode',
'rowid',
'code');
340 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
342 $label .= $outputlangs->trans(
"ReceptionMethod").
": ".$outputlangs->trans(
"ReceptionMethod".strtoupper($code));
346 $label .=
$object->tracking_url;
348 $pdf->SetFont(
'',
'B', $default_font_size - 2);
349 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
351 $tab_top_alt = $pdf->GetY();
357 if (!empty(
$object->note_public)) {
358 $pdf->SetFont(
'',
'', $default_font_size - 1);
362 $nexY = $pdf->GetY();
363 $height_note = $nexY - $tab_top;
366 $pdf->SetDrawColor(192, 192, 192);
367 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
369 $tab_height = $tab_height - $height_note;
370 $tab_top = $nexY + 6;
379 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
381 $encoding =
'QRCODE';
385 if ($module->encodingIsSupported($encoding)) {
386 $result = $module->writeBarCode(
$object->ref, $encoding);
390 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
391 $newcode =
dol_hash($newcode,
'md5');
393 $barcode_path = $conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
399 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
401 $nexY = $pdf->GetY();
402 $height_barcode = 20;
406 $this->error =
'Failed to generate barcode';
410 $iniY = $tab_top + 7;
411 $curY = $tab_top + 7;
412 $nexY = $tab_top + 7;
413 $fk_commandefourndet = 0;
418 for ($i = 0; $i < $nblines; $i++) {
420 $pdf->SetFont(
'',
'', $default_font_size - 1);
421 $pdf->SetTextColor(0, 0, 0);
424 $imglinesize = array();
425 if (!empty($realpatharray[$i])) {
429 $pdf->setTopMargin($tab_top_newpage);
430 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
431 $pageposbefore = $pdf->getPage();
433 $showpricebeforepagebreak = 1;
435 $posYAfterDescription = 0;
438 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
439 $pdf->AddPage(
'',
'',
true);
440 if (!empty($tplidx)) {
441 $pdf->useTemplate($tplidx);
446 $pdf->setPage($pageposbefore + 1);
448 $curY = $tab_top_newpage;
452 $showpricebeforepagebreak = 1;
454 $showpricebeforepagebreak = 0;
458 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
459 $curX = $this->posxpicture - 1;
460 $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
462 $posYAfterImage = $curY + $imglinesize[
'height'];
466 $curX = $this->posxdesc - 1;
480 $pdf->startTransaction();
481 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
483 $pageposafter = $pdf->getPage();
484 if ($pageposafter > $pageposbefore) {
485 $pdf->rollbackTransaction(
true);
486 $pageposafter = $pageposbefore;
488 $pdf->setPageOrientation(
'', 1, $heightforfooter);
490 pdf_writelinedesc($pdf,
$object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
492 $pageposafter = $pdf->getPage();
493 $posyafter = $pdf->GetY();
495 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
496 if ($i == ($nblines - 1)) {
497 $pdf->AddPage(
'',
'',
true);
498 if (!empty($tplidx)) {
499 $pdf->useTemplate($tplidx);
504 $pdf->setPage($pageposafter + 1);
511 $showpricebeforepagebreak = 1;
513 $showpricebeforepagebreak = 0;
517 $pdf->commitTransaction();
519 $posYAfterDescription = $pdf->GetY();
521 $nexY = max($pdf->GetY(), $posYAfterImage);
522 $pageposafter = $pdf->getPage();
524 $pdf->setPage($pageposbefore);
525 $pdf->setTopMargin($this->marge_haute);
526 $pdf->setPageOrientation(
'', 1, 0);
529 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
530 $pdf->setPage($pageposafter);
531 $curY = $tab_top_newpage;
535 if ($pageposafter > $pageposbefore) {
536 $pdf->setPage($pageposafter);
537 $curY = $tab_top_newpage;
540 $pdf->SetFont(
'',
'', $default_font_size - 1);
543 $pdf->SetXY($this->posxweightvol, $curY);
545 if (
$object->lines[$i]->fk_product_type == 0 && is_object(
$object->lines[$i]->product) &&
$object->lines[$i]->product->weight) {
549 if (
$object->lines[$i]->fk_product_type == 0 && is_object(
$object->lines[$i]->product) &&
$object->lines[$i]->product->volume) {
554 $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
560 $pdf->SetXY($this->posxqtyordered, $curY);
561 if (
$object->lines[$i]->fk_commandefourndet != $fk_commandefourndet) {
562 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3,
$object->lines[$i]->qty_asked,
'',
'C');
563 $totalOrdered +=
$object->lines[$i]->qty_asked;
565 $fk_commandefourndet =
$object->lines[$i]->fk_commandefourndet;
569 $pdf->SetXY($this->posxqtytoship, $curY);
570 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3,
$object->lines[$i]->qty,
'',
'C');
574 $pdf->SetXY($this->posxpuht, $curY);
575 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price(
$object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
578 $pdf->SetXY($this->posxtotalht, $curY);
579 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price($amountreceived, 0, $outputlangs),
'',
'R');
581 $totalAmount += $amountreceived;
585 if ($weighttxt && $voltxt) {
591 $pdf->setPage($pageposafter);
592 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
594 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
595 $pdf->SetLineStyle(array(
'dash' => 0));
599 while ($pagenb < $pageposafter) {
600 $pdf->setPage($pagenb);
602 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object);
604 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object);
608 $pdf->setPage($pagenb);
609 $pdf->setPageOrientation(
'', 1, 0);
610 if (!empty($tplidx)) {
611 $pdf->useTemplate($tplidx);
614 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
616 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1,
$object);
618 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object);
623 if (!empty($tplidx)) {
624 $pdf->useTemplate($tplidx);
632 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0,
$object);
633 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
635 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object);
636 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
640 $posy = $this->
_tableau_tot($pdf,
$object, 0, $bottomlasttab, $outputlangs, $totalOrdered, $totalAmount);
644 if (method_exists($pdf,
'AliasNbPages')) {
645 $pdf->AliasNbPages();
650 $pdf->Output($file,
'F');
653 $hookmanager->initHooks(array(
'pdfgeneration'));
654 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
656 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
658 $this->error = $hookmanager->error;
659 $this->errors = $hookmanager->errors;
664 $this->result = array(
'fullpath' => $file);
668 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
672 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
691 protected function _tableau_tot(&$pdf,
$object, $deja_regle, $posy, $outputlangs, $totalOrdered, $totalAmount = 0)
694 global $conf, $mysoc;
702 $pdf->SetFont(
'',
'B', $default_font_size - 1);
705 $col1x = $this->posxweightvol - 50;
706 $col2x = $this->posxweightvol;
712 $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
714 $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
720 $totalWeighttoshow =
'';
721 $totalVolumetoshow =
'';
724 $tmparray =
$object->getTotalWeightVolume();
725 $totalWeight = $tmparray[
'weight'];
726 $totalVolume = $tmparray[
'volume'];
727 $totalToShip = $tmparray[
'toship'];
735 if ($totalWeight !=
'') {
738 if ($totalVolume !=
'') {
748 $pdf->SetFillColor(255, 255, 255);
749 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
750 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L', 1);
755 if ($totalWeighttoshow) {
756 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * ($index + $index2));
757 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C', 1);
760 if ($totalVolumetoshow) {
761 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * ($index + $index2));
762 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C', 1);
768 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
769 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0,
'C', 1);
773 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
774 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0,
'C', 1);
778 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
779 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C', 1);
781 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
782 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price($totalAmount, 0, $outputlangs), 0,
'C', 1);
785 $pdf->SetTextColor(0, 0, 0);
792 return ($tab2_top + ($tab2_hl * $index));
809 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0,
$object =
null)
822 $pdf->SetTextColor(0, 0, 0);
823 $pdf->SetFont(
'',
'', $default_font_size - 2);
826 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
828 $pdf->SetDrawColor(128, 128, 128);
829 $pdf->SetFont(
'',
'', $default_font_size - 1);
832 if (empty($hidetop)) {
833 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
835 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
836 $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
840 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
841 if (empty($hidetop)) {
842 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
843 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
848 $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height);
849 if (empty($hidetop)) {
850 $pdf->SetXY($this->posxqtyordered - 1, $tab_top + 1);
851 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities(
"QtyOrdered"),
'',
'C');
856 $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
857 if (empty($hidetop)) {
858 $pdf->SetXY($this->posxqtytoship, $tab_top + 1);
859 $statusreceived = Reception::STATUS_CLOSED;
861 $statusreceived = Reception::STATUS_VALIDATED;
864 $statusreceived = Reception::STATUS_CLOSED;
867 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
'QtyToReceive'),
'',
'C');
869 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
'QtyReceived'),
'',
'C');
875 $pdf->line($this->posxpuht - 1, $tab_top, $this->posxpuht - 1, $tab_top + $tab_height);
876 if (empty($hidetop)) {
877 $pdf->SetXY($this->posxpuht - 1, $tab_top + 1);
878 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
881 $pdf->line($this->posxtotalht - 1, $tab_top, $this->posxtotalht - 1, $tab_top + $tab_height);
882 if (empty($hidetop)) {
883 $pdf->SetXY($this->posxtotalht - 1, $tab_top + 1);
884 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities(
"TotalHT"),
'',
'C');
901 global $conf, $langs, $mysoc;
903 $langs->load(
"orders");
910 $pdf->SetTextColor(0, 0, 60);
911 $pdf->SetFont(
'',
'B', $default_font_size + 3);
915 $posy = $this->marge_haute;
916 $posx = $this->page_largeur - $this->marge_droite - $w;
918 $pdf->SetXY($this->marge_gauche, $posy);
921 if ($this->emetteur->logo) {
922 $logodir = $conf->mycompany->dir_output;
923 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
924 $logodir = $conf->mycompany->multidir_output[
$object->entity];
927 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
929 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
931 if (is_readable($logo)) {
933 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
935 $pdf->SetTextColor(200, 0, 0);
936 $pdf->SetFont(
'',
'B', $default_font_size - 2);
937 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
938 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
941 $text = $this->emetteur->name;
942 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
945 $pdf->SetDrawColor(128, 128, 128);
947 $posx = $this->page_largeur - $w - $this->marge_droite;
948 $posy = $this->marge_haute;
950 $pdf->SetFont(
'',
'B', $default_font_size + 2);
951 $pdf->SetXY($posx, $posy);
952 $pdf->SetTextColor(0, 0, 60);
953 $title = $outputlangs->transnoentities(
"ReceptionSheet");
954 $pdf->MultiCell($w, 4, $title,
'',
'R');
956 $pdf->SetFont(
'',
'', $default_font_size + 1);
960 $pdf->SetXY($posx, $posy);
961 $pdf->SetTextColor(0, 0, 60);
962 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefReception").
" : ".
$object->ref,
'',
'R');
965 if (!empty(
$object->date_delivery)) {
967 $pdf->SetXY($posx, $posy);
968 $pdf->SetTextColor(0, 0, 60);
969 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
972 if (!empty(
$object->thirdparty->code_fournisseur)) {
974 $pdf->SetXY($posx, $posy);
975 $pdf->SetTextColor(0, 0, 60);
976 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_fournisseur),
'',
'R');
980 $pdf->SetFont(
'',
'', $default_font_size + 3);
985 $origin_id =
$object->origin_id;
990 if (isModEnabled(
"supplier_order")) {
991 $outputlangs->load(
'orders');
993 $classname =
'CommandeFournisseur';
994 $linkedobject =
new $classname($this->db);
995 $result = $linkedobject->fetch($origin_id);
999 $pdf->SetFont(
'',
'', $default_font_size - 2);
1000 $text = $linkedobject->ref;
1001 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1002 $text .=
' ('.$linkedobject->ref_client.
')';
1005 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1006 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1008 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1009 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1017 $carac_emetteur =
'';
1019 $arrayidcontact = array();
1020 if (!empty($origin) && is_object(
$object->origin_object)) {
1021 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1023 if (empty($arrayidcontact)) {
1024 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SHIPPING');
1026 if (count($arrayidcontact) > 0) {
1027 $object->fetch_user(reset($arrayidcontact));
1028 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1029 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1031 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1035 $carac_emetteur .=
"\n";
1042 $posx = $this->marge_gauche;
1044 $posx = $this->page_largeur - $this->marge_droite - 80;
1051 $pdf->SetTextColor(0, 0, 0);
1052 $pdf->SetFont(
'',
'', $default_font_size - 2);
1053 $pdf->SetXY($posx, $posy - 5);
1054 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1055 $pdf->SetXY($posx, $posy);
1056 $pdf->SetFillColor(230, 230, 230);
1057 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1058 $pdf->SetTextColor(0, 0, 60);
1059 $pdf->SetFillColor(255, 255, 255);
1062 $usecontact =
false;
1063 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1065 if (count($arrayidcontact) > 0) {
1067 $result =
$object->fetch_contact($arrayidcontact[0]);
1071 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1072 $thirdparty =
$object->contact;
1074 $thirdparty =
$object->thirdparty;
1082 $pdf->SetXY($posx + 2, $posy + 3);
1083 $pdf->SetFont(
'',
'B', $default_font_size);
1084 $pdf->MultiCell($widthrecbox - 2, 4, $carac_client_name, 0,
'L');
1086 $posy = $pdf->getY();
1089 $pdf->SetFont(
'',
'', $default_font_size - 1);
1090 $pdf->SetXY($posx + 2, $posy);
1091 $pdf->MultiCell($widthrecbox - 2, 4, $carac_client, 0,
'L');
1095 if ($this->page_largeur < 210) {
1099 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1101 $posx = $this->marge_gauche;
1105 $pdf->SetTextColor(0, 0, 0);
1106 $pdf->SetFont(
'',
'', $default_font_size - 2);
1107 $pdf->SetXY($posx + 2, $posy - 5);
1108 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1109 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1114 $pdf->SetXY($posx + 2, $posy + 3);
1115 $pdf->SetFont(
'',
'B', $default_font_size);
1116 $pdf->MultiCell($widthrecbox, 2, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1117 $posy = $pdf->getY();
1120 $pdf->SetXY($posx + 2, $posy);
1121 $pdf->SetFont(
'',
'', $default_font_size - 1);
1122 $pdf->MultiCell($widthrecbox, 4, $carac_emetteur, 0,
'L');
1125 $pdf->SetTextColor(0, 0, 0);