25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
45 global $conf, $langs, $mysoc;
48 $this->
name =
"squille";
49 $this->
description = $langs->trans(
"DocumentModelStandardPDF");
53 $this->page_largeur = $formatarray[
'width'];
54 $this->page_hauteur = $formatarray[
'height'];
55 $this->format = array($this->page_largeur, $this->page_hauteur);
56 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
57 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
58 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
59 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
61 $this->option_logo = 1;
64 $this->emetteur = $mysoc;
65 if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2);
68 $this->posxdesc = $this->marge_gauche + 1;
69 $this->posxweightvol = $this->page_largeur - $this->marge_droite - 78;
70 $this->posxqtyordered = $this->page_largeur - $this->marge_droite - 56;
71 $this->posxqtytoship = $this->page_largeur - $this->marge_droite - 28;
72 $this->posxpuht = $this->page_largeur - $this->marge_droite;
74 if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
75 $this->posxweightvol = $this->page_largeur - $this->marge_droite - 118;
76 $this->posxqtyordered = $this->page_largeur - $this->marge_droite - 96;
77 $this->posxqtytoship = $this->page_largeur - $this->marge_droite - 68;
78 $this->posxpuht = $this->page_largeur - $this->marge_droite - 40;
79 $this->posxtotalht = $this->page_largeur - $this->marge_droite - 20;
82 $this->posxpicture = $this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
84 if ($this->page_largeur < 210)
86 $this->posxweightvol -= 20;
87 $this->posxpicture -= 20;
88 $this->posxqtyordered -= 20;
89 $this->posxqtytoship -= 20;
92 if (!empty($conf->global->RECEPTION_PDF_HIDE_ORDERED))
94 $this->posxweightvol += ($this->posxqtytoship - $this->posxqtyordered);
95 $this->posxpicture += ($this->posxqtytoship - $this->posxqtyordered);
96 $this->posxqtyordered = $this->posxqtytoship;
112 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
115 global $user, $conf, $langs, $hookmanager;
117 $object->fetch_thirdparty();
119 if (!is_object($outputlangs)) $outputlangs = $langs;
121 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
123 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal",
"deliveries",
"receptions",
"productbatch",
"sendings"));
125 $nblines = count($object->lines);
128 $realpatharray = array();
129 if (!empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE))
133 for ($i = 0; $i < $nblines; $i++)
135 if (empty($object->lines[$i]->fk_product))
continue;
138 $objphoto->fetch($object->lines[$i]->fk_product);
140 $pdir =
get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
141 $dir = $conf->product->dir_output.
'/'.$pdir;
145 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
146 if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) {
148 if ($obj[
'photo_vignette'])
150 $filename = $obj[
'photo_vignette'];
152 $filename = $obj[
'photo'];
155 $filename = $obj[
'photo'];
158 $realpath = $dir.$filename;
162 if ($realpath) $realpatharray[$i] = $realpath;
166 if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol;
168 if ($conf->reception->dir_output)
171 if ($object->specimen)
173 $dir = $conf->reception->dir_output;
174 $file = $dir.
"/SPECIMEN.pdf";
177 $dir = $conf->reception->dir_output.
"/".$rcpref;
178 $file = $dir.
"/".$rcpref.
".pdf";
181 if (!file_exists($dir))
185 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
190 if (file_exists($dir))
193 if (!is_object($hookmanager))
195 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
198 $hookmanager->initHooks(array(
'pdfgeneration'));
199 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
201 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
204 $nblines = count($object->lines);
208 $heightforinfotot = 8;
209 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
210 $heightforfooter = $this->marge_basse + 8;
211 $pdf->SetAutoPageBreak(1, 0);
213 if (class_exists(
'TCPDF'))
215 $pdf->setPrintHeader(
false);
216 $pdf->setPrintFooter(
false);
220 if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
222 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
223 $tplidx = $pdf->importPage(1);
228 $pdf->SetDrawColor(128, 128, 128);
230 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
232 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
233 $pdf->SetSubject($outputlangs->transnoentities(
"Reception"));
234 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
235 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
236 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Reception"));
237 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
239 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
243 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
245 $this->
_pagehead($pdf, $object, 1, $outputlangs);
246 $pdf->SetFont(
'',
'', $default_font_size - 1);
247 $pdf->MultiCell(0, 3,
'');
248 $pdf->SetTextColor(0, 0, 0);
251 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
253 $tab_height_newpage = 150;
256 $height_incoterms = 0;
257 if (!empty($conf->incoterm->enabled))
259 $desc_incoterms = $object->getIncotermsForPDF();
264 $pdf->SetFont(
'',
'', $default_font_size - 1);
265 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
266 $nexY = $pdf->GetY();
267 $height_incoterms = $nexY - $tab_top;
270 $pdf->SetDrawColor(192, 192, 192);
271 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
273 $tab_top = $nexY + 6;
274 $height_incoterms += 4;
278 if (!empty($object->note_public) || !empty($object->tracking_number))
280 $tab_top = 88 + $height_incoterms;
281 $tab_top_alt = $tab_top;
283 $pdf->SetFont(
'',
'B', $default_font_size - 2);
284 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".$object->tracking_number, 0, 1,
false,
true,
'L');
286 $tab_top_alt = $pdf->GetY();
290 if (!empty($object->tracking_number))
292 $object->getUrlTrackingStatus($object->tracking_number);
293 if (!empty($object->tracking_url))
295 if ($object->reception_method_id > 0)
298 $code = $outputlangs->getLabelFromKey($this->
db, $object->shipment_method_id,
'c_shipment_mode',
'rowid',
'code');
300 if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
301 $label .= $outputlangs->trans(
"ReceptionMethod").
": ".$outputlangs->trans(
"ReceptionMethod".strtoupper($code));
303 if ($object->tracking_url != $object->tracking_number)
306 $label .= $object->tracking_url;
308 $pdf->SetFont(
'',
'B', $default_font_size - 2);
309 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
311 $tab_top_alt = $pdf->GetY();
317 if (!empty($object->note_public))
319 $pdf->SetFont(
'',
'', $default_font_size - 1);
320 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top_alt,
dol_htmlentitiesbr($object->note_public), 0, 1);
323 $nexY = $pdf->GetY();
324 $height_note = $nexY - $tab_top;
327 $pdf->SetDrawColor(192, 192, 192);
328 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
330 $tab_height = $tab_height - $height_note;
331 $tab_top = $nexY + 6;
336 $iniY = $tab_top + 7;
337 $curY = $tab_top + 7;
338 $nexY = $tab_top + 7;
339 $fk_commandefourndet = 0;
342 for ($i = 0; $i < $nblines; $i++)
345 $pdf->SetFont(
'',
'', $default_font_size - 1);
346 $pdf->SetTextColor(0, 0, 0);
349 $imglinesize = array();
352 $pdf->setTopMargin($tab_top_newpage);
353 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
354 $pageposbefore = $pdf->getPage();
356 $showpricebeforepagebreak = 1;
358 $posYAfterDescription = 0;
361 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
363 $pdf->AddPage(
'',
'',
true);
364 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
365 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
366 $pdf->setPage($pageposbefore + 1);
368 $curY = $tab_top_newpage;
371 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
372 $showpricebeforepagebreak = 1;
373 else $showpricebeforepagebreak = 0;
376 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']))
378 $curX = $this->posxpicture - 1;
379 $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
381 $posYAfterImage = $curY + $imglinesize[
'height'];
385 $curX = $this->posxdesc - 1;
387 $pdf->startTransaction();
388 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
390 $pageposafter = $pdf->getPage();
391 if ($pageposafter > $pageposbefore)
393 $pdf->rollbackTransaction(
true);
394 $pageposafter = $pageposbefore;
396 $pdf->setPageOrientation(
'', 1, $heightforfooter);
398 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
400 $pageposafter = $pdf->getPage();
401 $posyafter = $pdf->GetY();
403 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
405 if ($i == ($nblines - 1))
407 $pdf->AddPage(
'',
'',
true);
408 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
409 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
410 $pdf->setPage($pageposafter + 1);
416 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
417 $showpricebeforepagebreak = 1;
418 else $showpricebeforepagebreak = 0;
422 $pdf->commitTransaction();
424 $posYAfterDescription = $pdf->GetY();
426 $nexY = $pdf->GetY();
427 $pageposafter = $pdf->getPage();
429 $pdf->setPage($pageposbefore);
430 $pdf->setTopMargin($this->marge_haute);
431 $pdf->setPageOrientation(
'', 1, 0);
434 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
435 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
439 if ($pageposafter > $pageposbefore) {
440 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
443 $pdf->SetFont(
'',
'', $default_font_size - 1);
445 $pdf->SetXY($this->posxweightvol, $curY);
447 if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
449 $weighttxt = round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).
' '.
measuringUnitString(0,
"weight", $object->lines[$i]->product->weight_units);
452 if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
454 $voltxt = round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).
' '.
measuringUnitString(0,
"volume", $object->lines[$i]->product->volume_units ? $object->lines[$i]->product->volume_units : 0);
457 $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
460 if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) {
461 $pdf->SetXY($this->posxqtyordered, $curY);
462 if ($object->lines[$i]->fk_commandefourndet != $fk_commandefourndet) {
463 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,
'',
'C');
464 $totalOrdered += $object->lines[$i]->qty_asked;
466 $fk_commandefourndet = $object->lines[$i]->fk_commandefourndet;
469 $pdf->SetXY($this->posxqtytoship, $curY);
470 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty,
'',
'C');
472 if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT))
474 $pdf->SetXY($this->posxpuht, $curY);
475 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price($object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
477 $pdf->SetXY($this->posxtotalht, $curY);
478 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price($object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
482 if ($weighttxt && $voltxt) $nexY += 2;
485 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
487 $pdf->setPage($pageposafter);
488 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
490 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
491 $pdf->SetLineStyle(array(
'dash'=>0));
495 while ($pagenb < $pageposafter)
497 $pdf->setPage($pagenb);
500 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
502 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
504 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
506 $pdf->setPage($pagenb);
507 $pdf->setPageOrientation(
'', 1, 0);
509 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
513 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
515 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
517 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
520 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
528 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
529 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
531 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
532 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
536 $posy = $this->
_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs, $totalOrdered);
539 $this->
_pagefoot($pdf, $object, $outputlangs);
540 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
544 $pdf->Output($file,
'F');
547 $hookmanager->initHooks(array(
'pdfgeneration'));
548 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
550 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
553 $this->error = $hookmanager->error;
554 $this->errors = $hookmanager->errors;
557 if (!empty($conf->global->MAIN_UMASK))
558 @chmod($file, octdec($conf->global->MAIN_UMASK));
562 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
566 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
584 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered)
587 global $conf, $mysoc;
595 $pdf->SetFont(
'',
'B', $default_font_size - 1);
598 $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol;
603 if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
604 else $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
609 $totalWeighttoshow =
'';
610 $totalVolumetoshow =
'';
613 $tmparray = $object->getTotalWeightVolume();
614 $totalWeight = $tmparray[
'weight'];
615 $totalVolume = $tmparray[
'volume'];
616 $totalToShip = $tmparray[
'toship'];
620 if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
622 $object->trueVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth);
623 $object->volume_units = $object->size_units * 3;
628 if ($object->trueWeight) $totalWeighttoshow =
showDimensionInBestUnit($object->trueWeight, $object->weight_units,
"weight", $outputlangs);
629 if ($object->trueVolume) $totalVolumetoshow =
showDimensionInBestUnit($object->trueVolume, $object->volume_units,
"volume", $outputlangs);
631 $pdf->SetFillColor(255, 255, 255);
632 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
633 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L', 1);
635 if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED))
637 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
638 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0,
'C', 1);
641 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
642 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0,
'C', 1);
644 if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
645 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
646 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C', 1);
648 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
649 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price($object->total_ht, 0, $outputlangs), 0,
'C', 1);
653 if ($totalWeighttoshow)
655 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
656 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C', 1);
660 if ($totalVolumetoshow)
662 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
663 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C', 1);
667 if (!$totalWeighttoshow && !$totalVolumetoshow) $index++;
669 $pdf->SetTextColor(0, 0, 0);
671 return ($tab2_top + ($tab2_hl * $index));
687 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
693 if ($hidetop) $hidetop = -1;
698 $pdf->SetTextColor(0, 0, 0);
699 $pdf->SetFont(
'',
'', $default_font_size - 2);
702 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
704 $pdf->SetDrawColor(128, 128, 128);
705 $pdf->SetFont(
'',
'', $default_font_size - 1);
709 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
711 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
712 $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities(
"Description"),
'',
'L');
715 $pdf->line($this->posxweightvol - 1, $tab_top, $this->posxweightvol - 1, $tab_top + $tab_height);
718 $pdf->SetXY($this->posxweightvol - 1, $tab_top + 1);
719 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities(
"WeightVolShort"),
'',
'C');
722 if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED))
724 $pdf->line($this->posxqtyordered - 1, $tab_top, $this->posxqtyordered - 1, $tab_top + $tab_height);
727 $pdf->SetXY($this->posxqtyordered - 1, $tab_top + 1);
728 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities(
"QtyOrdered"),
'',
'C');
732 $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
735 $pdf->SetXY($this->posxqtytoship, $tab_top + 1);
736 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities(
"QtyToReceive"),
'',
'C');
739 if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
740 $pdf->line($this->posxpuht - 1, $tab_top, $this->posxpuht - 1, $tab_top + $tab_height);
743 $pdf->SetXY($this->posxpuht - 1, $tab_top + 1);
744 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
747 $pdf->line($this->posxtotalht - 1, $tab_top, $this->posxtotalht - 1, $tab_top + $tab_height);
750 $pdf->SetXY($this->posxtotalht - 1, $tab_top + 1);
751 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities(
"TotalHT"),
'',
'C');
766 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
768 global $conf, $langs, $mysoc;
770 $langs->load(
"orders");
777 if ($object->statut == 0 && (!empty($conf->global->RECEPTION_DRAFT_WATERMARK)))
779 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->RECEPTION_DRAFT_WATERMARK);
783 $pdf->SetTextColor(0, 0, 60);
784 $pdf->SetFont(
'',
'B', $default_font_size + 3);
788 $posy = $this->marge_haute;
789 $posx = $this->page_largeur - $this->marge_droite - $w;
791 $pdf->SetXY($this->marge_gauche, $posy);
794 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
795 if ($this->emetteur->logo)
797 if (is_readable($logo))
800 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
802 $pdf->SetTextColor(200, 0, 0);
803 $pdf->SetFont(
'',
'B', $default_font_size - 2);
804 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
805 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
808 $text = $this->emetteur->name;
809 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
813 if (!empty($conf->barcode->enabled))
817 $posx = $this->marge_gauche + 3;
820 if (!empty($conf->barcode->enabled))
827 $pdf->SetDrawColor(128, 128, 128);
828 if (!empty($conf->barcode->enabled))
836 $posx = $this->page_largeur - $w - $this->marge_droite;
837 $posy = $this->marge_haute;
839 $pdf->SetFont(
'',
'B', $default_font_size + 2);
840 $pdf->SetXY($posx, $posy);
841 $pdf->SetTextColor(0, 0, 60);
842 $title = $outputlangs->transnoentities(
"ReceptionSheet");
843 $pdf->MultiCell($w, 4, $title,
'',
'R');
845 $pdf->SetFont(
'',
'', $default_font_size + 1);
849 $pdf->SetXY($posx, $posy);
850 $pdf->SetTextColor(0, 0, 60);
851 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefReception").
" : ".$object->ref,
'',
'R');
854 if (!empty($object->date_delivery))
857 $pdf->SetXY($posx, $posy);
858 $pdf->SetTextColor(0, 0, 60);
859 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date($object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
862 if (!empty($object->thirdparty->code_fournisseur))
865 $pdf->SetXY($posx, $posy);
866 $pdf->SetTextColor(0, 0, 60);
867 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
871 $pdf->SetFont(
'',
'', $default_font_size + 3);
875 $origin = $object->origin;
876 $origin_id = $object->origin_id;
879 if (!empty($conf->fournisseur->enabled))
881 $outputlangs->load(
'orders');
883 $classname =
'CommandeFournisseur';
884 $linkedobject =
new $classname($this->
db);
885 $result = $linkedobject->fetch($origin_id);
890 $pdf->SetFont(
'',
'', $default_font_size - 2);
891 $text = $linkedobject->ref;
892 if ($linkedobject->ref_client) $text .=
' ('.$linkedobject->ref_client.
')';
894 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
895 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
897 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
898 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
905 $carac_emetteur =
'';
907 $arrayidcontact = array();
908 if (!empty($origin) && is_object($object->$origin)) $arrayidcontact = $object->$origin->getIdContact(
'internal',
'SALESREPFOLL');
909 if (empty($arrayidcontact)) $arrayidcontact = $object->$origin->getIdContact(
'internal',
'SHIPPING');
910 if (count($arrayidcontact) > 0)
912 $object->fetch_user(reset($arrayidcontact));
913 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$outputlangs->transnoentities(
"Name").
": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
916 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
919 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
920 $posx = $this->marge_gauche;
921 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
923 $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
924 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
927 $pdf->SetTextColor(0, 0, 0);
928 $pdf->SetFont(
'',
'', $default_font_size - 2);
929 $pdf->SetXY($posx, $posy - 5);
930 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
931 $pdf->SetXY($posx, $posy);
932 $pdf->SetFillColor(230, 230, 230);
933 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
934 $pdf->SetTextColor(0, 0, 60);
935 $pdf->SetFillColor(255, 255, 255);
939 $arrayidcontact = $object->$origin->getIdContact(
'external',
'SHIPPING');
941 if (count($arrayidcontact) > 0)
944 $result = $object->fetch_contact($arrayidcontact[0]);
948 if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
949 $thirdparty = $object->contact;
951 $thirdparty = $object->thirdparty;
956 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact,
'targetwithdetails', $object);
959 $pdf->SetXY($posx + 2, $posy + 3);
960 $pdf->SetFont(
'',
'B', $default_font_size);
961 $pdf->MultiCell($widthrecbox - 2, 4, $carac_client_name, 0,
'L');
963 $posy = $pdf->getY();
966 $pdf->SetFont(
'',
'', $default_font_size - 1);
967 $pdf->SetXY($posx + 2, $posy);
968 $pdf->MultiCell($widthrecbox - 2, 4, $carac_client, 0,
'L');
971 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
972 if ($this->page_largeur < 210) $widthrecbox = 84;
973 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
974 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
975 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
978 $pdf->SetTextColor(0, 0, 0);
979 $pdf->SetFont(
'',
'', $default_font_size - 2);
980 $pdf->SetXY($posx + 2, $posy - 5);
981 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
982 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
987 $pdf->SetXY($posx + 2, $posy + 3);
988 $pdf->SetFont(
'',
'B', $default_font_size);
989 $pdf->MultiCell($widthrecbox, 2, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
990 $posy = $pdf->getY();
993 $pdf->SetXY($posx + 2, $posy);
994 $pdf->SetFont(
'',
'', $default_font_size - 1);
995 $pdf->MultiCell($widthrecbox, 4, $carac_emetteur, 0,
'L');
998 $pdf->SetTextColor(0, 0, 0);
1011 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1014 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1015 return pdf_pagefoot($pdf, $outputlangs,
'RECEPTION_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
__construct($db=0)
Constructor.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Class to manage products or services.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom= 'UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
Classe permettant de generer les borderaux envoi au modele Squille.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered)
Show total to pay.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput= 'no')
Output a dimension with best unit.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany= '', $targetcontact= '', $usecontact=0, $mode= 'source', $object=null)
Return a string with full address formated for output on documents.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
Parent class of sending receipts models.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
measuringUnitString($unit, $measuring_style= '', $scale= '', $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
write_file($object, $outputlangs, $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.