132 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
135 global $user, $langs, $conf, $mysoc, $db, $hookmanager;
137 if (!is_object($outputlangs)) {
138 $outputlangs = $langs;
142 $outputlangs->charset_output =
'ISO-8859-1';
146 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"stocks",
"orders",
"deliveries"));
148 if ($conf->stock->dir_output) {
150 if ($object->specimen) {
151 $dir = $conf->stock->dir_output;
152 $file = $dir.
"/SPECIMEN.pdf";
155 $dir = $conf->stock->dir_output.
"/".$objectref;
156 $file = $dir.
"/".$objectref.
".pdf";
160 $supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
161 $object->supplierprices = $supplierprices;
163 $productstatic =
new Product($this->db);
165 if (!file_exists($dir)) {
167 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
172 if (file_exists($dir)) {
174 if (!is_object($hookmanager)) {
175 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
178 $hookmanager->initHooks(array(
'pdfgeneration'));
179 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
181 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
186 $pdf->SetAutoPageBreak(1, 0);
188 $heightforinfotot = 40;
189 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
190 $heightforfooter = $this->marge_basse + 8;
192 $heightforfooter += 6;
195 if (class_exists(
'TCPDF')) {
196 $pdf->setPrintHeader(
false);
197 $pdf->setPrintFooter(
false);
202 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
203 $tplidx = $pdf->importPage(1);
208 $pdf->SetDrawColor(128, 128, 128);
210 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
211 $pdf->SetSubject($outputlangs->transnoentities(
"Stock"));
212 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
213 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
214 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Stock").
" ".$outputlangs->convToOutputCharset($object->label));
216 $pdf->SetCompression(
false);
219 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
224 if (!empty($tplidx)) {
225 $pdf->useTemplate($tplidx);
228 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
229 $pdf->SetFont(
'',
'', $default_font_size - 1);
230 $pdf->MultiCell(0, 3,
'');
231 $pdf->SetTextColor(0, 0, 0);
233 $tab_top = 65 + $top_shift;
234 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
236 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
242 $totalvalue = $totalvaluesell = 0;
244 $sortfield =
'p.ref';
247 $sql =
"SELECT p.rowid as rowid, p.ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
248 $sql .=
" ps.reel as value";
249 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
250 $sql .=
" WHERE ps.fk_product = p.rowid";
251 $sql .=
" AND ps.reel <> 0";
252 $sql .=
" AND ps.fk_entrepot = ".((int) $object->id);
253 $sql .= $this->db->order($sortfield, $sortorder);
256 $resql = $this->db->query($sql);
258 $num = $this->db->num_rows($resql);
262 $nexY = $tab_top + $this->tabTitleHeight;
264 for ($i = 0; $i < $nblines; $i++) {
267 $objp = $this->db->fetch_object($resql);
271 $sql =
"SELECT label";
272 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
273 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
274 $sql .=
" AND lang = '".$this->db->escape($langs->getDefaultLang()).
"'";
277 $result = $this->db->query($sql);
279 $objtp = $this->db->fetch_object($result);
280 if ($objtp->label !=
'') {
281 $objp->produit = $objtp->label;
286 $pdf->SetFont(
'',
'', $default_font_size - 1);
287 $pdf->SetTextColor(0, 0, 0);
289 $pdf->setTopMargin($tab_top_newpage);
290 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
291 $pageposbefore = $pdf->getPage();
294 $curX = $this->posxdesc - 1;
296 $showpricebeforepagebreak = 1;
298 $pdf->startTransaction();
299 $pdf->writeHTMLCell($this->wref, 3, $curX, $curY, $outputlangs->convToOutputCharset($objp->ref), 0, 1,
false,
true,
'J',
true);
301 $pageposafter = $pdf->getPage();
302 if ($pageposafter > $pageposbefore) {
303 $pdf->rollbackTransaction(
true);
304 $pageposafter = $pageposbefore;
306 $pdf->setPageOrientation(
'', 1, $heightforfooter);
307 $pdf->writeHTMLCell($this->wref, 4, $curX, $curY, $outputlangs->convToOutputCharset($objp->ref), 0, 1,
false,
true,
'J',
true);
309 $pageposafter = $pdf->getPage();
310 $posyafter = $pdf->GetY();
311 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
312 if ($i == ($nblines - 1)) {
313 $pdf->AddPage(
'',
'',
true);
314 if (!empty($tplidx)) {
315 $pdf->useTemplate($tplidx);
318 $this->
_pagehead($pdf, $object, 0, $outputlangs);
320 $pdf->setPage($pageposafter + 1);
327 $showpricebeforepagebreak = 1;
329 $showpricebeforepagebreak = 0;
333 $pdf->commitTransaction();
335 $posYAfterDescription = $pdf->GetY();
337 $nexY = $pdf->GetY();
338 $pageposafter = $pdf->getPage();
340 $pdf->setPage($pageposbefore);
341 $pdf->setTopMargin($this->marge_haute);
342 $pdf->setPageOrientation(
'', 1, 0);
345 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
346 $pdf->setPage($pageposafter);
347 $curY = $tab_top_newpage;
350 $pdf->SetFont(
'',
'', $default_font_size - 1);
352 $productstatic->id = $objp->rowid;
353 $productstatic->ref = $objp->ref;
354 $productstatic->label = $objp->produit;
355 $productstatic->type = $objp->type;
356 $productstatic->entity = $objp->entity;
357 $productstatic->status_batch = $objp->tobatch;
364 $pdf->SetXY($this->posxlabel + 0.8, $curY);
365 $pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3,
dol_trunc($productstatic->label, 24), 0,
'L');
368 $valtoshow =
price2num($objp->value,
'MS');
369 $towrite = (empty($valtoshow) ?
'0' : $valtoshow);
371 $pdf->SetXY($this->posxqty, $curY);
372 $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0,
'R');
375 $totalunit += $objp->value;
377 $pdf->SetXY($this->posxup, $curY);
378 $pdf->MultiCell($this->posxunit - $this->posxup - 0.8, 3,
price(
price2num($objp->ppmp,
'MU'), 0, $outputlangs), 0,
'R');
381 $pdf->SetXY($this->posxunit, $curY);
382 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3,
price(
price2num($objp->ppmp * $objp->value,
'MT'), 0, $outputlangs), 0,
'R');
383 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
387 $pricemin = $objp->price;
388 $pdf->SetXY($this->posxdiscount, $curY);
389 $pdf->MultiCell($this->postotalht - $this->posxdiscount, 3,
price(
price2num($pricemin,
'MU'), 0, $outputlangs), 0,
'R', 0);
392 $pdf->SetXY($this->postotalht, $curY);
393 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3,
price(
price2num($pricemin * $objp->value,
'MT'), 0, $outputlangs), 0,
'R', 0);
395 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
399 $pdf->setPage($pageposafter);
400 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
402 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
403 $pdf->SetLineStyle(array(
'dash'=>0));
409 while ($pagenb < $pageposafter) {
410 $pdf->setPage($pagenb);
412 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
414 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
416 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
418 $pdf->setPage($pagenb);
419 $pdf->setPageOrientation(
'', 1, 0);
421 $this->
_pagehead($pdf, $object, 0, $outputlangs);
423 if (!empty($tplidx)) {
424 $pdf->useTemplate($tplidx);
427 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
429 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
431 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
433 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
436 if (!empty($tplidx)) {
437 $pdf->useTemplate($tplidx);
441 $this->
_pagehead($pdf, $object, 0, $outputlangs);
446 $this->db->free($resql);
456 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
457 $pdf->line($this->marge_gauche, $curY - 1, $this->page_largeur - $this->marge_droite, $curY - 1);
458 $pdf->SetLineStyle(array(
'dash'=>0));
460 $pdf->SetFont(
'',
'B', $default_font_size - 1);
461 $pdf->SetTextColor(0, 0, 0);
464 $pdf->SetXY($this->posxdesc, $curY);
465 $pdf->MultiCell($this->wref, 3, $langs->trans(
"Total"), 0,
'L');
468 $valtoshow =
price2num($totalunit,
'MS');
469 $towrite = empty($valtoshow) ?
'0' : $valtoshow;
471 $pdf->SetXY($this->posxqty, $curY);
472 $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0,
'R');
475 $pdf->SetXY($this->posxunit, $curY);
476 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3,
price(
price2num($totalvalue,
'MT'), 0, $outputlangs), 0,
'R');
481 $pdf->SetXY($this->postotalht, $curY);
482 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3,
price(
price2num($totalvaluesell,
'MT'), 0, $outputlangs), 0,
'R', 0);
490 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
500 $pdf->SetFont(
'',
'', $default_font_size - 1);
501 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
502 $nexY = $pdf->GetY();
503 $height_note = $nexY - $tab_top;
506 $pdf->SetDrawColor(192, 192, 192);
507 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
509 $tab_height = $tab_height - $height_note;
510 $tab_top = $nexY + 6;
523 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
524 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
526 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
527 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
530 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
539 $this->
_pagefoot($pdf, $object, $outputlangs);
540 if (method_exists($pdf,
'AliasNbPages')) {
541 $pdf->AliasNbPages();
546 $pdf->Output($file,
'F');
549 $hookmanager->initHooks(array(
'pdfgeneration'));
550 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
552 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
554 $this->error = $hookmanager->error;
555 $this->errors = $hookmanager->errors;
560 $this->result = array(
'fullpath'=>$file);
564 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
568 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"PRODUCT_OUTPUTDIR");
587 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
597 $currency = !empty($currency) ? $currency : $conf->currency;
601 $pdf->SetTextColor(0, 0, 0);
602 $pdf->SetFont(
'',
'', $default_font_size - 2);
604 if (empty($hidetop)) {
605 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
606 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
607 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
611 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5,
'F',
null, explode(
',',
getDolGlobalString(
'MAIN_PDF_TITLE_BACKGROUND_COLOR')));
615 $pdf->SetDrawColor(128, 128, 128);
617 $pdf->SetFont(
'',
'B', $default_font_size - 3);
620 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);
622 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
623 $pdf->SetDrawColor(200, 200, 200);
624 $pdf->line($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite, $tab_top);
625 $pdf->SetLineStyle(array(
'dash'=>0));
626 $pdf->SetDrawColor(128, 128, 128);
627 $pdf->SetTextColor(0, 0, 0);
630 if (empty($hidetop)) {
631 $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11);
632 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
633 $pdf->MultiCell($this->wref, 3, $outputlangs->transnoentities(
"Ref"),
'',
'L');
636 $pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height);
637 if (empty($hidetop)) {
638 $pdf->SetXY($this->posxlabel - 1, $tab_top + 1);
639 $pdf->MultiCell($this->posxqty - $this->posxlabel - 1, 2, $outputlangs->transnoentities(
"Label"),
'',
'C');
642 $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
643 if (empty($hidetop)) {
644 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
645 $pdf->MultiCell($this->posxup - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Units"),
'',
'C');
648 $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
649 if (empty($hidetop)) {
650 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
651 $pdf->MultiCell($this->posxunit - $this->posxup - 1, 2, $outputlangs->transnoentities(
"AverageUnitPricePMPShort"),
'',
'C');
654 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
655 if (empty($hidetop)) {
656 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
657 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"EstimatedStockValueShort"),
'',
'C');
660 $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
661 if (empty($hidetop)) {
662 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
663 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"SellPriceMin"),
'',
'C');
666 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
667 if (empty($hidetop)) {
668 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
669 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 2, $outputlangs->transnoentities(
"EstimatedStockValueSellShort"),
'',
'C');
672 if (empty($hidetop)) {
673 $pdf->SetDrawColor(200, 200, 200);
674 $pdf->SetLineStyle(array(
'dash' =>
'0',
'color' => array(200, 200, 200)));
675 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
676 $pdf->SetLineStyle(array(
'dash' => 0));
691 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey =
"")
693 global $conf, $langs, $db, $hookmanager;
696 $outputlangs->loadLangs(array(
"main",
"propal",
"companies",
"bills",
"orders",
"stocks"));
700 if ($object->type == 1) {
701 $titlekey =
'ServiceSheet';
703 $titlekey =
'StockSheet';
710 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->STOCK_DRAFT_WATERMARK);
713 $pdf->SetTextColor(0, 0, 60);
714 $pdf->SetFont(
'',
'B', $default_font_size + 3);
716 $posy = $this->marge_haute;
717 $posx = $this->page_largeur - $this->marge_droite - 100;
719 $pdf->SetXY($this->marge_gauche, $posy);
723 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
724 if ($this->emetteur->logo) {
725 if (is_readable($logo)) {
727 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
729 $pdf->SetTextColor(200, 0, 0);
730 $pdf->SetFont(
'',
'B', $default_font_size - 2);
731 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
732 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
735 $text = $this->emetteur->name;
736 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
739 $yafterleft = $pdf->GetY() + $height;
741 $pdf->SetFont(
'',
'B', $default_font_size + 3);
742 $pdf->SetXY($posx, $posy);
743 $pdf->SetTextColor(0, 0, 60);
745 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Warehouse").
' '.$outputlangs->convToOutputCharset($object->label),
'',
'R');
748 $pdf->SetFont(
'',
'', $default_font_size - 1);
749 $pdf->SetXY($posx, $posy);
750 $pdf->SetTextColor(0, 0, 60);
751 if (!empty($object->lieu)) {
752 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Label").
' : '.$object->lieu,
'',
'R');
757 $pdf->SetXY($posx, $posy);
758 $pdf->SetTextColor(0, 0, 60);
762 $hasparent = (!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0);
765 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ParentWarehouse").
' :',
'',
'R');
768 $pdf->SetXY($posx - 50, $posy);
769 $pdf->MultiCell(150, 3, $e->label,
'',
'R');
772 $yafterright = $pdf->GetY();
775 $nbpage = $pdf->getPage();
777 $nexY = max($yafterleft, $yafterright);
779 $pdf->SetXY($posx, $posy);
780 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"Description").
' : </b>'.nl2br($object->description), 0, 1);
781 $nexY = $pdf->GetY();
783 $calcproductsunique = $object->nb_different_products();
784 $calcproducts = $object->nb_products();
787 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"NumberOfDifferentProducts").
' : </b>'.(empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb']), 0, 1);
788 $nexY = $pdf->GetY();
791 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
792 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"NumberOfProducts").
' : </b>'.(empty($valtoshow) ?
'0' : $valtoshow), 0, 1);
793 $nexY = $pdf->GetY();
796 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"EstimatedStockValueShort").
' : </b>'.
price((empty($calcproducts[
'value']) ?
'0' :
price2num($calcproducts[
'value'],
'MT')), 0, $langs, 0, -1, -1, $conf->currency), 0, 1);
797 $nexY = $pdf->GetY();
800 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"Date").
' : </b>'.
dol_print_date(
dol_now(),
'dayhour'), 0, 1);
801 $nexY = $pdf->GetY();
804 $sql =
"SELECT max(m.datem) as datem";
805 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
806 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
807 $resqlbis = $this->db->query($sql);
809 $obj = $this->db->fetch_object($resqlbis);
810 $lastmovementdate = $this->db->jdate($obj->datem);
815 if ($lastmovementdate) {
818 $toWrite = $outputlangs->transnoentities(
"None");
821 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"LastMovement").
' : </b>'.$toWrite, 0, 1);
823 $nexY = $pdf->GetY();
829 $current_y = $pdf->getY();
830 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
831 if ($current_y < $pdf->getY()) {
832 $top_shift = $pdf->getY() - $current_y;
835 $pdf->SetTextColor(0, 0, 0);