140  public function write_file(
$object, $outputlangs, $srctemplatepath = 
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
 
  143    global $user, $langs, 
$conf, $mysoc, $db, $hookmanager;
 
  145    if (!is_object($outputlangs)) {
 
  146      $outputlangs = $langs;
 
  150      $outputlangs->charset_output = 
'ISO-8859-1';
 
  154    $outputlangs->loadLangs(array(
"main", 
"dict", 
"companies", 
"bills", 
"stocks", 
"orders", 
"deliveries"));
 
  156    if (
$conf->stock->dir_output) {
 
  159        $dir = 
$conf->stock->dir_output;
 
  160        $file = $dir.
"/SPECIMEN.pdf";
 
  163        $dir = 
$conf->stock->dir_output.
"/".$objectref;
 
  164        $file = $dir.
"/".$objectref.
".pdf";
 
  168      $supplierprices = $stockFournisseur->list_product_fournisseur_price(
$object->id);
 
  169      $object->supplierprices = $supplierprices;
 
  171      $productstatic = 
new Product($this->db);
 
  173      if (!file_exists($dir)) {
 
  175          $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
 
  180      if (file_exists($dir)) {
 
  182        if (!is_object($hookmanager)) {
 
  183          include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
 
  186        $hookmanager->initHooks(array(
'pdfgeneration'));
 
  187        $parameters = array(
'file' => $file, 
'object' => 
$object, 
'outputlangs' => $outputlangs);
 
  189        $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, 
$object, $action); 
 
  194        $pdf->SetAutoPageBreak(1, 0);
 
  196        $heightforinfotot = 40; 
 
  198        $heightforfooter = $this->marge_basse + 8; 
 
  200          $heightforfooter += 6;
 
  203        if (class_exists(
'TCPDF')) {
 
  204          $pdf->setPrintHeader(
false);
 
  205          $pdf->setPrintFooter(
false);
 
  210          $pagecount = $pdf->setSourceFile(
$conf->mycompany->dir_output.
'/' . 
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
 
  211          $tplidx = $pdf->importPage(1);
 
  216        $pdf->SetDrawColor(128, 128, 128);
 
  218        $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
 
  219        $pdf->SetSubject($outputlangs->transnoentities(
"Stock"));
 
  220        $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
 
  221        $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
 
  222        $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Stock").
" ".$outputlangs->convToOutputCharset(
$object->label));
 
  224          $pdf->SetCompression(
false);
 
  228        $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); 
 
  233        if (!empty($tplidx)) {
 
  234          $pdf->useTemplate($tplidx);
 
  238        $pdf->SetFont(
'', 
'', $default_font_size - 1);
 
  239        $pdf->MultiCell(0, 3, 
''); 
 
  240        $pdf->SetTextColor(0, 0, 0);
 
  242        $tab_top = 65 + $top_shift;
 
  243        $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
 
  245        $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
 
  251        $totalvalue = $totalvaluesell = 0;
 
  253        $sortfield = 
'p.ref';
 
  256        $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,";
 
  257        $sql .= 
" ps.reel as value";
 
  258        $sql .= 
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
 
  259        $sql .= 
" WHERE ps.fk_product = p.rowid";
 
  260        $sql .= 
" AND ps.reel <> 0"; 
 
  261        $sql .= 
" AND ps.fk_entrepot = ".((int) 
$object->id);
 
  262        $sql .= $this->db->order($sortfield, $sortorder);
 
  265        $resql = $this->db->query($sql);
 
  267          $num = $this->db->num_rows($resql);
 
  270          $nexY = $tab_top + $this->tabTitleHeight;
 
  272          for ($i = 0; $i < $nblines; $i++) {
 
  275            $objp = $this->db->fetch_object($resql);
 
  279              $sql = 
"SELECT label";
 
  280              $sql .= 
" FROM ".MAIN_DB_PREFIX.
"product_lang";
 
  281              $sql .= 
" WHERE fk_product = ".((int) $objp->rowid);
 
  282              $sql .= 
" AND lang = '".$this->db->escape($langs->getDefaultLang()).
"'";
 
  285              $result = $this->db->query($sql);
 
  287                $objtp = $this->db->fetch_object($result);
 
  288                if ($objtp->label != 
'') {
 
  289                  $objp->produit = $objtp->label;
 
  294            $pdf->SetFont(
'', 
'', $default_font_size - 1); 
 
  295            $pdf->SetTextColor(0, 0, 0);
 
  297            $pdf->setTopMargin($tab_top_newpage);
 
  298            $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); 
 
  299            $pageposbefore = $pdf->getPage();
 
  302            $curX = $this->posxdesc - 1;
 
  304            $showpricebeforepagebreak = 1;
 
  306            $pdf->startTransaction();
 
  307            $pdf->writeHTMLCell($this->wref, 3, $curX, $curY, $outputlangs->convToOutputCharset($objp->ref), 0, 1, 
false, 
true, 
'J', 
true);
 
  309            $pageposafter = $pdf->getPage();
 
  310            if ($pageposafter > $pageposbefore) { 
 
  311              $pdf->rollbackTransaction(
true);
 
  312              $pageposafter = $pageposbefore;
 
  314              $pdf->setPageOrientation(
'', 1, $heightforfooter); 
 
  315              $pdf->writeHTMLCell($this->wref, 4, $curX, $curY, $outputlangs->convToOutputCharset($objp->ref), 0, 1, 
false, 
true, 
'J', 
true);
 
  317              $pageposafter = $pdf->getPage();
 
  318              $posyafter = $pdf->GetY();
 
  319              if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { 
 
  320                if ($i == ($nblines - 1)) { 
 
  321                  $pdf->AddPage(
'', 
'', 
true);
 
  322                  if (!empty($tplidx)) {
 
  323                    $pdf->useTemplate($tplidx);
 
  328                  $pdf->setPage($pageposafter + 1);
 
  335                  $showpricebeforepagebreak = 1;
 
  337                  $showpricebeforepagebreak = 0;
 
  341              $pdf->commitTransaction();
 
  343            $posYAfterDescription = $pdf->GetY();
 
  345            $nexY = $pdf->GetY();
 
  346            $pageposafter = $pdf->getPage();
 
  348            $pdf->setPage($pageposbefore);
 
  349            $pdf->setTopMargin($this->marge_haute);
 
  350            $pdf->setPageOrientation(
'', 1, 0); 
 
  353            if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
 
  354              $pdf->setPage($pageposafter);
 
  355              $curY = $tab_top_newpage;
 
  358            $pdf->SetFont(
'', 
'', $default_font_size - 1); 
 
  360            $productstatic->id = $objp->rowid;
 
  361            $productstatic->ref = $objp->ref;
 
  362            $productstatic->label = $objp->produit;
 
  363            $productstatic->type = $objp->type;
 
  364            $productstatic->entity = $objp->entity;
 
  365            $productstatic->status_batch = $objp->tobatch;
 
  372            $pdf->SetXY($this->posxlabel + 0.8, $curY);
 
  373            $pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3, 
dol_trunc($productstatic->label, 24), 0, 
'L');
 
  376            $valtoshow = 
price2num($objp->value, 
'MS');
 
  377            $towrite = (empty($valtoshow) ? 
'0' : $valtoshow);
 
  379            $pdf->SetXY($this->posxqty, $curY);
 
  380            $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0, 
'R');
 
  383            $totalunit += $objp->value;
 
  385            $pdf->SetXY($this->posxup, $curY);
 
  386            $pdf->MultiCell($this->posxunit - $this->posxup - 0.8, 3, 
price(
price2num($objp->ppmp, 
'MU'), 0, $outputlangs), 0, 
'R');
 
  389            $pdf->SetXY($this->posxunit, $curY);
 
  390            $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3, 
price(
price2num($objp->ppmp * $objp->value, 
'MT'), 0, $outputlangs), 0, 
'R');
 
  391            $totalvalue += 
price2num($objp->ppmp * $objp->value, 
'MT');
 
  395              $pricemin = $objp->price;
 
  396              $pdf->SetXY($this->posxdiscount, $curY);
 
  397              $pdf->MultiCell($this->postotalht - $this->posxdiscount, 3, 
price(
price2num($pricemin, 
'MU'), 0, $outputlangs), 0, 
'R', 0);
 
  400              $pdf->SetXY($this->postotalht, $curY);
 
  401              $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, 
price(
price2num($pricemin * $objp->value, 
'MT'), 0, $outputlangs), 0, 
'R', 0);
 
  403            $totalvaluesell += 
price2num($pricemin * $objp->value, 
'MT');
 
  407              $pdf->setPage($pageposafter);
 
  408              $pdf->SetLineStyle(array(
'dash' => 
'1,1', 
'color' => array(80, 80, 80)));
 
  410              $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
 
  411              $pdf->SetLineStyle(array(
'dash' => 0));
 
  417            while ($pagenb < $pageposafter) {
 
  418              $pdf->setPage($pagenb);
 
  420                $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, 
$object->multicurrency_code);
 
  422                $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, 
$object->multicurrency_code);
 
  426              $pdf->setPage($pagenb);
 
  427              $pdf->setPageOrientation(
'', 1, 0); 
 
  431              if (!empty($tplidx)) {
 
  432                $pdf->useTemplate($tplidx);
 
  435            if (isset(
$object->lines[$i + 1]->pagebreak) && 
$object->lines[$i + 1]->pagebreak) {
 
  437                $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, 
$object->multicurrency_code);
 
  439                $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, 
$object->multicurrency_code);
 
  444              if (!empty($tplidx)) {
 
  445                $pdf->useTemplate($tplidx);
 
  454          $this->db->free($resql);
 
  464            $pdf->SetLineStyle(array(
'dash' => 
'0', 
'color' => array(200, 200, 200)));
 
  465            $pdf->line($this->marge_gauche, $curY - 1, $this->page_largeur - $this->marge_droite, $curY - 1);
 
  466            $pdf->SetLineStyle(array(
'dash' => 0));
 
  468            $pdf->SetFont(
'', 
'B', $default_font_size - 1);
 
  469            $pdf->SetTextColor(0, 0, 0);
 
  472            $pdf->SetXY($this->posxdesc, $curY);
 
  473            $pdf->MultiCell($this->wref, 3, $langs->trans(
"Total"), 0, 
'L');
 
  476            $valtoshow = 
price2num($totalunit, 
'MS');
 
  477            $towrite = empty($valtoshow) ? 
'0' : $valtoshow;
 
  479            $pdf->SetXY($this->posxqty, $curY);
 
  480            $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0, 
'R');
 
  483            $pdf->SetXY($this->posxunit, $curY);
 
  484            $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3, 
price(
price2num($totalvalue, 
'MT'), 0, $outputlangs), 0, 
'R');
 
  489              $pdf->SetXY($this->postotalht, $curY);
 
  490              $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, 
price(
price2num($totalvaluesell, 
'MT'), 0, $outputlangs), 0, 
'R', 0);
 
  498        $notetoshow = empty(
$object->note_public) ? 
'' : 
$object->note_public;
 
  508          $pdf->SetFont(
'', 
'', $default_font_size - 1);
 
  509          $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, 
dol_htmlentitiesbr($notetoshow), 0, 1);
 
  510          $nexY = $pdf->GetY();
 
  511          $height_note = $nexY - $tab_top;
 
  514          $pdf->SetDrawColor(192, 192, 192);
 
  515          $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius, 
'1234', 
'D');
 
  517          $tab_height -= $height_note;
 
  518          $tab_top = $nexY + 6;
 
  531          $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, 
$object->multicurrency_code);
 
  532          $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
 
  534          $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, 
$object->multicurrency_code);
 
  535          $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
 
  538        $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
 
  548        if (method_exists($pdf, 
'AliasNbPages')) {
 
  549          $pdf->AliasNbPages();  
 
  554        $pdf->Output($file, 
'F');
 
  557        $hookmanager->initHooks(array(
'pdfgeneration'));
 
  558        $parameters = array(
'file' => $file, 
'object' => 
$object, 
'outputlangs' => $outputlangs);
 
  560        $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action); 
 
  562          $this->error = $hookmanager->error;
 
  563          $this->errors = $hookmanager->errors;
 
  568        $this->result = array(
'fullpath' => $file);
 
  572        $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
 
  576      $this->error = $langs->trans(
"ErrorConstantNotDefined", 
"PRODUCT_OUTPUTDIR");
 
 
  595  protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = 
'')
 
  605    $currency = !empty($currency) ? $currency : 
$conf->currency;
 
  609    $pdf->SetTextColor(0, 0, 0);
 
  610    $pdf->SetFont(
'', 
'', $default_font_size - 2);
 
  612    if (empty($hidetop)) {
 
  613      $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
 
  614      $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
 
  615      $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
 
  619        $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, 
'1001', 
'F', array(), explode(
',', 
getDolGlobalString(
'MAIN_PDF_TITLE_BACKGROUND_COLOR')));
 
  623    $pdf->SetDrawColor(128, 128, 128);
 
  625    $pdf->SetFont(
'', 
'B', $default_font_size - 3);
 
  628    $this->
printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 
'D'); 
 
  630    $pdf->SetLineStyle(array(
'dash' => 
'0', 
'color' => array(200, 200, 200)));
 
  631    $pdf->SetDrawColor(200, 200, 200);
 
  632    $pdf->line($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite, $tab_top);
 
  633    $pdf->SetLineStyle(array(
'dash' => 0));
 
  634    $pdf->SetDrawColor(128, 128, 128);
 
  635    $pdf->SetTextColor(0, 0, 0);
 
  638    if (empty($hidetop)) {
 
  639      $pdf->line($this->marge_gauche, $tab_top + 11, $this->page_largeur - $this->marge_droite, $tab_top + 11); 
 
  640      $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
 
  641      $pdf->MultiCell($this->wref, 3, $outputlangs->transnoentities(
"Ref"), 
'', 
'L');
 
  644    $pdf->line($this->posxlabel - 1, $tab_top, $this->posxlabel - 1, $tab_top + $tab_height);
 
  645    if (empty($hidetop)) {
 
  646      $pdf->SetXY($this->posxlabel - 1, $tab_top + 1);
 
  647      $pdf->MultiCell($this->posxqty - $this->posxlabel - 1, 2, $outputlangs->transnoentities(
"Label"), 
'', 
'C');
 
  650    $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
 
  651    if (empty($hidetop)) {
 
  652      $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
 
  653      $pdf->MultiCell($this->posxup - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Units"), 
'', 
'C');
 
  656    $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
 
  657    if (empty($hidetop)) {
 
  658      $pdf->SetXY($this->posxup - 1, $tab_top + 1);
 
  659      $pdf->MultiCell($this->posxunit - $this->posxup - 1, 2, $outputlangs->transnoentities(
"AverageUnitPricePMPShort"), 
'', 
'C');
 
  662    $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
 
  663    if (empty($hidetop)) {
 
  664      $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
 
  665      $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"EstimatedStockValueShort"), 
'', 
'C');
 
  668    $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
 
  669    if (empty($hidetop)) {
 
  670      $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
 
  671      $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"SellPriceMin"), 
'', 
'C');
 
  674    $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
 
  675    if (empty($hidetop)) {
 
  676      $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
 
  677      $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 2, $outputlangs->transnoentities(
"EstimatedStockValueSellShort"), 
'', 
'C');
 
  680    if (empty($hidetop)) {
 
  681      $pdf->SetDrawColor(200, 200, 200);
 
  682      $pdf->SetLineStyle(array(
'dash' => 
'0', 
'color' => array(200, 200, 200)));
 
  683      $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
 
  684      $pdf->SetLineStyle(array(
'dash' => 0));
 
 
  701    global 
$conf, $langs;
 
  704    $outputlangs->loadLangs(array(
"main", 
"propal", 
"companies", 
"bills", 
"orders", 
"stocks"));
 
  712      pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 
'mm', 
$conf->global->STOCK_DRAFT_WATERMARK);
 
  715    $pdf->SetTextColor(0, 0, 60);
 
  716    $pdf->SetFont(
'', 
'B', $default_font_size + 3);
 
  718    $posy = $this->marge_haute;
 
  719    $posx = $this->page_largeur - $this->marge_droite - 100;
 
  721    $pdf->SetXY($this->marge_gauche, $posy);
 
  725    $logo = 
$conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
 
  726    if ($this->emetteur->logo) {
 
  727      if (is_readable($logo)) {
 
  729        $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); 
 
  731        $pdf->SetTextColor(200, 0, 0);
 
  732        $pdf->SetFont(
'', 
'B', $default_font_size - 2);
 
  733        $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0, 
'L');
 
  734        $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0, 
'L');
 
  737      $text = $this->emetteur->name;
 
  738      $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 
'L');
 
  741    $yafterleft = $pdf->GetY() + $height;
 
  743    $pdf->SetFont(
'', 
'B', $default_font_size + 3);
 
  744    $pdf->SetXY($posx, $posy);
 
  745    $pdf->SetTextColor(0, 0, 60);
 
  747    $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Warehouse").
' '.$outputlangs->convToOutputCharset(
$object->label), 
'', 
'R');
 
  750    $pdf->SetFont(
'', 
'', $default_font_size - 1);
 
  751    $pdf->SetXY($posx, $posy);
 
  752    $pdf->SetTextColor(0, 0, 60);
 
  754      $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Label").
' : '.
$object->lieu, 
'', 
'R');
 
  759    $pdf->SetXY($posx, $posy);
 
  760    $pdf->SetTextColor(0, 0, 60);
 
  764    $hasparent = (!empty(
$object->fk_parent) && $e->fetch(
$object->fk_parent) > 0);
 
  767      $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ParentWarehouse").
' :', 
'', 
'R');
 
  770      $pdf->SetXY($posx - 50, $posy);
 
  771      $pdf->MultiCell(150, 3, $e->label, 
'', 
'R');
 
  774    $yafterright = $pdf->GetY();
 
  777    $nbpage = $pdf->getPage();
 
  779      $nexY = max($yafterleft, $yafterright);
 
  781      $pdf->SetXY($posx, $posy);
 
  782      $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, 
'<b>'.$outputlangs->transnoentities(
"Description").
' : </b>'.nl2br(
$object->description), 0, 1);
 
  783      $nexY = $pdf->GetY();
 
  785      $calcproductsunique = 
$object->nb_different_products();
 
  786      $calcproducts = 
$object->nb_products();
 
  789      $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, 
'<b>'.$outputlangs->transnoentities(
"NumberOfDifferentProducts").
' : </b>'.(empty($calcproductsunique[
'nb']) ? 
'0' : $calcproductsunique[
'nb']), 0, 1);
 
  790      $nexY = $pdf->GetY();
 
  793      $valtoshow = 
price2num($calcproducts[
'nb'], 
'MS');
 
  794      $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, 
'<b>'.$outputlangs->transnoentities(
"NumberOfProducts").
' : </b>'.(empty($valtoshow) ? 
'0' : $valtoshow), 0, 1);
 
  795      $nexY = $pdf->GetY();
 
  798      $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);
 
  799      $nexY = $pdf->GetY();
 
  802      $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, 
'<b>'.$outputlangs->transnoentities(
"Date").
' : </b>'.
dol_print_date(
dol_now(), 
'dayhour'), 0, 1);
 
  803      $nexY = $pdf->GetY();
 
  806      $sql = 
"SELECT max(m.datem) as datem";
 
  807      $sql .= 
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
 
  808      $sql .= 
" WHERE m.fk_entrepot = ".((int) 
$object->id);
 
  809      $resqlbis = $this->db->query($sql);
 
  811        $obj = $this->db->fetch_object($resqlbis);
 
  812        $lastmovementdate = $this->db->jdate($obj->datem);
 
  817      if ($lastmovementdate) {
 
  820        $toWrite = $outputlangs->transnoentities(
"None");
 
  823      $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY, 
'<b>'.$outputlangs->transnoentities(
"LastMovement").
' : </b>'.$toWrite, 0, 1);
 
  825    $nexY = $pdf->GetY();
 
  831    $current_y = $pdf->getY();
 
  833    if ($current_y < $pdf->getY()) {
 
  834      $top_shift = $pdf->getY() - $current_y;
 
  837    $pdf->SetTextColor(0, 0, 0);