165 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
168 global $user, $langs, $conf, $mysoc, $db, $hookmanager;
170 if (!is_object($outputlangs)) {
171 $outputlangs = $langs;
174 if (!empty($conf->global->MAIN_USE_FPDF)) {
175 $outputlangs->charset_output =
'ISO-8859-1';
179 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"stocks",
"orders",
"deliveries"));
181 if ($conf->stock->dir_output) {
183 if ($object->specimen) {
184 $dir = $conf->stock->dir_output;
185 $file = $dir.
"/SPECIMEN.pdf";
188 $dir = $conf->stock->dir_output.
"/".$objectref;
189 $file = $dir.
"/".$objectref.
".pdf";
193 $supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
194 $object->supplierprices = $supplierprices;
196 $productstatic =
new Product($this->db);
198 if (!file_exists($dir)) {
200 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
205 if (file_exists($dir)) {
207 if (!is_object($hookmanager)) {
208 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
211 $hookmanager->initHooks(array(
'pdfgeneration'));
212 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
214 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
219 $pdf->SetAutoPageBreak(1, 0);
221 $heightforinfotot = 40;
222 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
223 $heightforfooter = $this->marge_basse + 8;
224 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
225 $heightforfooter += 6;
228 if (class_exists(
'TCPDF')) {
229 $pdf->setPrintHeader(
false);
230 $pdf->setPrintFooter(
false);
234 if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
235 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
236 $tplidx = $pdf->importPage(1);
241 $pdf->SetDrawColor(128, 128, 128);
243 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
244 $pdf->SetSubject($outputlangs->transnoentities(
"Stock"));
245 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
246 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
247 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Stock").
" ".$outputlangs->convToOutputCharset($object->label));
249 $pdf->SetCompression(
false);
252 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
257 if (!empty($tplidx)) {
258 $pdf->useTemplate($tplidx);
261 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
262 $pdf->SetFont(
'',
'', $default_font_size - 1);
263 $pdf->MultiCell(0, 3,
'');
264 $pdf->SetTextColor(0, 0, 0);
266 $tab_top = 65 + $top_shift;
267 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
269 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
275 $totalvalue = $totalvaluesell = 0;
277 $sortfield =
'p.ref';
280 $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,";
281 $sql .=
" ps.reel as value";
282 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
283 $sql .=
" WHERE ps.fk_product = p.rowid";
284 $sql .=
" AND ps.reel <> 0";
285 $sql .=
" AND ps.fk_entrepot = ".((int) $object->id);
286 $sql .= $this->db->order($sortfield, $sortorder);
289 $resql = $this->db->query($sql);
291 $num = $this->db->num_rows($resql);
295 $nexY = $tab_top + $this->tabTitleHeight;
297 for ($i = 0; $i < $nblines; $i++) {
300 $objp = $this->db->fetch_object($resql);
304 $sql =
"SELECT label";
305 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
306 $sql .=
" WHERE fk_product = ".((int) $objp->rowid);
307 $sql .=
" AND lang = '".$this->db->escape($langs->getDefaultLang()).
"'";
310 $result = $this->db->query($sql);
312 $objtp = $this->db->fetch_object($result);
313 if ($objtp->label !=
'') {
314 $objp->produit = $objtp->label;
319 $pdf->SetFont(
'',
'', $default_font_size - 1);
320 $pdf->SetTextColor(0, 0, 0);
322 $pdf->setTopMargin($tab_top_newpage);
323 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
324 $pageposbefore = $pdf->getPage();
327 $curX = $this->posxdesc - 1;
329 $showpricebeforepagebreak = 1;
331 $pdf->startTransaction();
332 $pdf->writeHTMLCell($this->wref, 3, $curX, $curY, $outputlangs->convToOutputCharset($objp->ref), 0, 1,
false,
true,
'J',
true);
334 $pageposafter = $pdf->getPage();
335 if ($pageposafter > $pageposbefore) {
336 $pdf->rollbackTransaction(
true);
337 $pageposafter = $pageposbefore;
339 $pdf->setPageOrientation(
'', 1, $heightforfooter);
340 $pdf->writeHTMLCell($this->wref, 4, $curX, $curY, $outputlangs->convToOutputCharset($objp->ref), 0, 1,
false,
true,
'J',
true);
342 $pageposafter = $pdf->getPage();
343 $posyafter = $pdf->GetY();
344 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
345 if ($i == ($nblines - 1)) {
346 $pdf->AddPage(
'',
'',
true);
347 if (!empty($tplidx)) {
348 $pdf->useTemplate($tplidx);
351 $this->
_pagehead($pdf, $object, 0, $outputlangs);
353 $pdf->setPage($pageposafter + 1);
359 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
360 $showpricebeforepagebreak = 1;
362 $showpricebeforepagebreak = 0;
367 $pdf->commitTransaction();
369 $posYAfterDescription = $pdf->GetY();
371 $nexY = $pdf->GetY();
372 $pageposafter = $pdf->getPage();
374 $pdf->setPage($pageposbefore);
375 $pdf->setTopMargin($this->marge_haute);
376 $pdf->setPageOrientation(
'', 1, 0);
379 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
380 $pdf->setPage($pageposafter);
381 $curY = $tab_top_newpage;
384 $pdf->SetFont(
'',
'', $default_font_size - 1);
386 $productstatic->id = $objp->rowid;
387 $productstatic->ref = $objp->ref;
388 $productstatic->label = $objp->produit;
389 $productstatic->type = $objp->type;
390 $productstatic->entity = $objp->entity;
391 $productstatic->status_batch = $objp->tobatch;
398 $pdf->SetXY($this->posxlabel + 0.8, $curY);
399 $pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3,
dol_trunc($productstatic->label, 24), 0,
'L');
402 $valtoshow =
price2num($objp->value,
'MS');
403 $towrite = (empty($valtoshow) ?
'0' : $valtoshow);
405 $pdf->SetXY($this->posxqty, $curY);
406 $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0,
'R');
409 $totalunit += $objp->value;
411 $pdf->SetXY($this->posxup, $curY);
412 $pdf->MultiCell($this->posxunit - $this->posxup - 0.8, 3,
price(
price2num($objp->ppmp,
'MU'), 0, $outputlangs), 0,
'R');
415 $pdf->SetXY($this->posxunit, $curY);
416 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3,
price(
price2num($objp->ppmp * $objp->value,
'MT'), 0, $outputlangs), 0,
'R');
417 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
420 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
421 $pricemin = $objp->price;
422 $pdf->SetXY($this->posxdiscount, $curY);
423 $pdf->MultiCell($this->postotalht - $this->posxdiscount, 3,
price(
price2num($pricemin,
'MU'), 0, $outputlangs), 0,
'R', 0);
426 $pdf->SetXY($this->postotalht, $curY);
427 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3,
price(
price2num($pricemin * $objp->value,
'MT'), 0, $outputlangs), 0,
'R', 0);
429 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
432 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
433 $pdf->setPage($pageposafter);
434 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
436 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
437 $pdf->SetLineStyle(array(
'dash'=>0));
443 while ($pagenb < $pageposafter) {
444 $pdf->setPage($pagenb);
446 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
448 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
450 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
452 $pdf->setPage($pagenb);
453 $pdf->setPageOrientation(
'', 1, 0);
455 $this->
_pagehead($pdf, $object, 0, $outputlangs);
457 if (!empty($tplidx)) {
458 $pdf->useTemplate($tplidx);
461 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
463 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
465 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
467 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
470 if (!empty($tplidx)) {
471 $pdf->useTemplate($tplidx);
475 $this->
_pagehead($pdf, $object, 0, $outputlangs);
480 $this->db->free($resql);
490 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
491 $pdf->line($this->marge_gauche, $curY - 1, $this->page_largeur - $this->marge_droite, $curY - 1);
492 $pdf->SetLineStyle(array(
'dash'=>0));
494 $pdf->SetFont(
'',
'B', $default_font_size - 1);
495 $pdf->SetTextColor(0, 0, 0);
498 $pdf->SetXY($this->posxdesc, $curY);
499 $pdf->MultiCell($this->wref, 3, $langs->trans(
"Total"), 0,
'L');
502 $valtoshow =
price2num($totalunit,
'MS');
503 $towrite = empty($valtoshow) ?
'0' : $valtoshow;
505 $pdf->SetXY($this->posxqty, $curY);
506 $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0,
'R');
509 $pdf->SetXY($this->posxunit, $curY);
510 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3,
price(
price2num($totalvalue,
'MT'), 0, $outputlangs), 0,
'R');
513 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
515 $pdf->SetXY($this->postotalht, $curY);
516 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3,
price(
price2num($totalvaluesell,
'MT'), 0, $outputlangs), 0,
'R', 0);
524 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
534 $pdf->SetFont(
'',
'', $default_font_size - 1);
535 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
536 $nexY = $pdf->GetY();
537 $height_note = $nexY - $tab_top;
540 $pdf->SetDrawColor(192, 192, 192);
541 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
543 $tab_height = $tab_height - $height_note;
544 $tab_top = $nexY + 6;
557 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
558 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
560 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
561 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
564 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
573 $this->
_pagefoot($pdf, $object, $outputlangs);
574 if (method_exists($pdf,
'AliasNbPages')) {
575 $pdf->AliasNbPages();
580 $pdf->Output($file,
'F');
583 $hookmanager->initHooks(array(
'pdfgeneration'));
584 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
586 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
588 $this->error = $hookmanager->error;
589 $this->errors = $hookmanager->errors;
594 $this->result = array(
'fullpath'=>$file);
598 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
602 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"PRODUCT_OUTPUTDIR");
621 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
631 $currency = !empty($currency) ? $currency : $conf->currency;
635 $pdf->SetTextColor(0, 0, 0);
636 $pdf->SetFont(
'',
'', $default_font_size - 2);
638 if (empty($hidetop)) {
639 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
640 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
641 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
644 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
645 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5,
'F',
null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
649 $pdf->SetDrawColor(128, 128, 128);
651 $pdf->SetFont(
'',
'B', $default_font_size - 3);
654 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);
656 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
657 $pdf->SetDrawColor(200, 200, 200);
658 $pdf->line($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite, $tab_top);
659 $pdf->SetLineStyle(array(
'dash'=>0));
660 $pdf->SetDrawColor(128, 128, 128);
661 $pdf->SetTextColor(0, 0, 0);
664 if (empty($hidetop)) {
665 $pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11);
666 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
667 $pdf->MultiCell($this->wref, 3, $outputlangs->transnoentities(
"Ref"),
'',
'L');
670 $pdf->line($this->posxlabel-1, $tab_top, $this->posxlabel-1, $tab_top + $tab_height);
671 if (empty($hidetop)) {
672 $pdf->SetXY($this->posxlabel - 1, $tab_top + 1);
673 $pdf->MultiCell($this->posxqty - $this->posxlabel - 1, 2, $outputlangs->transnoentities(
"Label"),
'',
'C');
676 $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
677 if (empty($hidetop)) {
678 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
679 $pdf->MultiCell($this->posxup - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Units"),
'',
'C');
682 $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
683 if (empty($hidetop)) {
684 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
685 $pdf->MultiCell($this->posxunit - $this->posxup - 1, 2, $outputlangs->transnoentities(
"AverageUnitPricePMPShort"),
'',
'C');
688 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
689 if (empty($hidetop)) {
690 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
691 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"EstimatedStockValueShort"),
'',
'C');
694 $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
695 if (empty($hidetop)) {
696 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
697 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"SellPriceMin"),
'',
'C');
700 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
701 if (empty($hidetop)) {
702 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
703 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 2, $outputlangs->transnoentities(
"EstimatedStockValueSellShort"),
'',
'C');
706 if (empty($hidetop)) {
707 $pdf->SetDrawColor(200, 200, 200);
708 $pdf->SetLineStyle(array(
'dash' =>
'0',
'color' => array(200, 200, 200)));
709 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
710 $pdf->SetLineStyle(array(
'dash' => 0));
725 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey =
"")
727 global $conf, $langs, $db, $hookmanager;
730 $outputlangs->loadLangs(array(
"main",
"propal",
"companies",
"bills",
"orders",
"stocks"));
734 if ($object->type == 1) {
735 $titlekey =
'ServiceSheet';
737 $titlekey =
'StockSheet';
743 if ($object->statut == 0 && (!empty($conf->global->STOCK_DRAFT_WATERMARK))) {
744 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->STOCK_DRAFT_WATERMARK);
747 $pdf->SetTextColor(0, 0, 60);
748 $pdf->SetFont(
'',
'B', $default_font_size + 3);
750 $posy = $this->marge_haute;
751 $posx = $this->page_largeur - $this->marge_droite - 100;
753 $pdf->SetXY($this->marge_gauche, $posy);
757 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
758 if ($this->emetteur->logo) {
759 if (is_readable($logo)) {
761 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
763 $pdf->SetTextColor(200, 0, 0);
764 $pdf->SetFont(
'',
'B', $default_font_size - 2);
765 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
766 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
769 $text = $this->emetteur->name;
770 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
773 $yafterleft = $pdf->GetY() + $height;
775 $pdf->SetFont(
'',
'B', $default_font_size + 3);
776 $pdf->SetXY($posx, $posy);
777 $pdf->SetTextColor(0, 0, 60);
779 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Warehouse").
' '.$outputlangs->convToOutputCharset($object->label),
'',
'R');
782 $pdf->SetFont(
'',
'', $default_font_size - 1);
783 $pdf->SetXY($posx, $posy);
784 $pdf->SetTextColor(0, 0, 60);
785 if (!empty($object->lieu)) {
786 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Label").
' : '.$object->lieu,
'',
'R');
791 $pdf->SetXY($posx, $posy);
792 $pdf->SetTextColor(0, 0, 60);
796 $hasparent = (!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0);
799 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ParentWarehouse").
' :',
'',
'R');
802 $pdf->SetXY($posx - 50, $posy);
803 $pdf->MultiCell(150, 3, $e->label,
'',
'R');
806 $yafterright = $pdf->GetY();
809 $nbpage = $pdf->getPage();
811 $nexY = max($yafterleft, $yafterright);
813 $pdf->SetXY($posx, $posy);
814 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"Description").
' : </b>'.nl2br($object->description), 0, 1);
815 $nexY = $pdf->GetY();
817 $calcproductsunique = $object->nb_different_products();
818 $calcproducts = $object->nb_products();
821 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"NumberOfDifferentProducts").
' : </b>'.(empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb']), 0, 1);
822 $nexY = $pdf->GetY();
825 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
826 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"NumberOfProducts").
' : </b>'.(empty($valtoshow) ?
'0' : $valtoshow), 0, 1);
827 $nexY = $pdf->GetY();
830 $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);
831 $nexY = $pdf->GetY();
834 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"Date").
' : </b>'.
dol_print_date(
dol_now(),
'dayhour'), 0, 1);
835 $nexY = $pdf->GetY();
838 $sql =
"SELECT max(m.datem) as datem";
839 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
840 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
841 $resqlbis = $this->db->query($sql);
843 $obj = $this->db->fetch_object($resqlbis);
844 $lastmovementdate = $this->db->jdate($obj->datem);
849 if ($lastmovementdate) {
852 $toWrite = $outputlangs->transnoentities(
"None");
855 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"LastMovement").
' : </b>'.$toWrite, 0, 1);
857 $nexY = $pdf->GetY();
863 $current_y = $pdf->getY();
864 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
865 if ($current_y < $pdf->getY()) {
866 $top_shift = $pdf->getY() - $current_y;
869 $pdf->SetTextColor(0, 0, 0);