25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_stock.php';
26 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
63 public $phpmin = array(5, 6);
69 public $version =
'dolibarr';
120 global $conf, $langs, $mysoc;
123 $langs->loadLangs(array(
"main",
"companies"));
126 $this->
name =
"standard";
127 $this->
description = $langs->trans(
"DocumentModelStandardPDF");
132 $this->page_largeur = $formatarray[
'width'];
133 $this->page_hauteur = $formatarray[
'height'];
134 $this->format = array($this->page_largeur, $this->page_hauteur);
135 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
136 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
137 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
138 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
140 $this->option_logo = 1;
141 $this->option_codestockservice = 0;
142 $this->option_multilang = 1;
143 $this->option_freetext = 0;
146 $this->emetteur = $mysoc;
147 if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2);
151 $this->posxdesc = $this->marge_gauche + 1;
152 $this->posxlabel = $this->posxdesc + $this->wref;
156 $this->posxunit = 135;
157 $this->posxdiscount = 155;
158 $this->postotalht = 175;
160 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva = $this->posxup;
161 $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
162 if ($this->page_largeur < 210)
164 $this->posxpicture -= 20;
165 $this->posxtva -= 20;
167 $this->posxqty -= 20;
168 $this->posxunit -= 20;
169 $this->posxdiscount -= 20;
170 $this->postotalht -= 20;
172 $this->tva = array();
173 $this->localtax1 = array();
174 $this->localtax2 = array();
175 $this->atleastoneratenotnull = 0;
176 $this->atleastonediscount = 0;
192 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
195 global $user, $langs, $conf, $mysoc, $db, $hookmanager;
197 if (!is_object($outputlangs)) $outputlangs = $langs;
199 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
202 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"stocks",
"orders",
"deliveries"));
204 $nblines = count($object->lines);
206 if ($conf->stock->dir_output)
209 if ($object->specimen)
211 $dir = $conf->stock->dir_output;
212 $file = $dir.
"/SPECIMEN.pdf";
215 $dir = $conf->stock->dir_output.
"/".$objectref;
216 $file = $dir.
"/".$objectref.
".pdf";
220 $supplierprices = $stockFournisseur->list_product_fournisseur_price($object->id);
221 $object->supplierprices = $supplierprices;
225 if (!file_exists($dir))
229 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
234 if (file_exists($dir))
237 if (!is_object($hookmanager))
239 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
242 $hookmanager->initHooks(array(
'pdfgeneration'));
243 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
245 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
250 $pdf->SetAutoPageBreak(1, 0);
252 $heightforinfotot = 40;
253 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
254 $heightforfooter = $this->marge_basse + 8;
256 if (class_exists(
'TCPDF'))
258 $pdf->setPrintHeader(
false);
259 $pdf->setPrintFooter(
false);
263 if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
265 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
266 $tplidx = $pdf->importPage(1);
271 $pdf->SetDrawColor(128, 128, 128);
273 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
274 $pdf->SetSubject($outputlangs->transnoentities(
"Stock"));
275 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
276 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
277 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Stock").
" ".$outputlangs->convToOutputCharset($object->label));
278 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
280 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
285 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
287 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
288 $pdf->SetFont(
'',
'', $default_font_size - 1);
289 $pdf->MultiCell(0, 3,
'');
290 $pdf->SetTextColor(0, 0, 0);
292 $tab_top = 80 + $top_shift;
293 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
305 $totalvalue = $totalvaluesell = 0;
307 $sortfield =
'p.ref';
310 $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,";
311 $sql .=
" ps.reel as value";
312 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product as p";
313 $sql .=
" WHERE ps.fk_product = p.rowid";
314 $sql .=
" AND ps.reel <> 0";
315 $sql .=
" AND ps.fk_entrepot = ".$object->id;
316 $sql .= $this->
db->order($sortfield, $sortorder);
326 $this->tabTitleHeight = 0;
327 $nexY = $tab_top + $this->tabTitleHeight;
329 for ($i = 0; $i < $nblines; $i++)
333 $objp = $this->
db->fetch_object(
$resql);
336 if (!empty($conf->global->MAIN_MULTILANGS))
338 $sql =
"SELECT label";
339 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product_lang";
340 $sql .=
" WHERE fk_product=".$objp->rowid;
341 $sql .=
" AND lang='".$this->db->escape($langs->getDefaultLang()).
"'";
344 $result = $this->
db->query($sql);
347 $objtp = $this->
db->fetch_object($result);
348 if ($objtp->label !=
'') $objp->produit = $objtp->label;
352 $pdf->SetFont(
'',
'', $default_font_size - 1);
353 $pdf->SetTextColor(0, 0, 0);
355 $pdf->setTopMargin($tab_top_newpage);
356 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
357 $pageposbefore = $pdf->getPage();
360 $curX = $this->posxdesc - 1;
362 $showpricebeforepagebreak = 1;
364 $pdf->startTransaction();
365 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc);
366 $pageposafter = $pdf->getPage();
367 if ($pageposafter > $pageposbefore)
369 $pdf->rollbackTransaction(
true);
370 $pageposafter = $pageposbefore;
372 $pdf->setPageOrientation(
'', 1, $heightforfooter);
373 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc);
374 $pageposafter = $pdf->getPage();
375 $posyafter = $pdf->GetY();
376 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
378 if ($i == ($nblines - 1))
380 $pdf->AddPage(
'',
'',
true);
381 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
382 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
383 $pdf->setPage($pageposafter + 1);
389 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
390 $showpricebeforepagebreak = 1;
391 else $showpricebeforepagebreak = 0;
395 $pdf->commitTransaction();
397 $posYAfterDescription = $pdf->GetY();
399 $nexY = $pdf->GetY();
400 $pageposafter = $pdf->getPage();
402 $pdf->setPage($pageposbefore);
403 $pdf->setTopMargin($this->marge_haute);
404 $pdf->setPageOrientation(
'', 1, 0);
407 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
408 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
411 $pdf->SetFont(
'',
'', $default_font_size - 1);
413 $productstatic->id = $objp->rowid;
414 $productstatic->ref = $objp->ref;
415 $productstatic->label = $objp->produit;
416 $productstatic->type = $objp->type;
417 $productstatic->entity = $objp->entity;
418 $productstatic->status_batch = $objp->tobatch;
421 $pdf->SetXY($this->posxdesc, $curY);
422 $pdf->MultiCell($this->wref, 3, $productstatic->ref, 0,
'L');
425 $pdf->SetXY($this->posxlabel + 0.8, $curY);
426 $pdf->MultiCell($this->posxqty - $this->posxlabel - 0.8, 3,
dol_trunc($objp->produit, 24), 0,
'L');
429 $valtoshow =
price2num($objp->value,
'MS');
430 $towrite = (empty($valtoshow) ?
'0' : $valtoshow);
432 $pdf->SetXY($this->posxqty, $curY);
433 $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0,
'R');
436 $totalunit += $objp->value;
438 $pdf->SetXY($this->posxup, $curY);
439 $pdf->MultiCell($this->posxunit - $this->posxup - 0.8, 3,
price(
price2num($objp->ppmp,
'MU'), 0, $outputlangs), 0,
'R');
442 $pdf->SetXY($this->posxunit, $curY);
443 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3,
price(
price2num($objp->ppmp * $objp->value,
'MT'), 0, $outputlangs), 0,
'R');
444 $totalvalue +=
price2num($objp->ppmp * $objp->value,
'MT');
447 if (empty($conf->global->PRODUIT_MULTIPRICES))
449 $pricemin = $objp->price;
450 $pdf->SetXY($this->posxdiscount, $curY);
451 $pdf->MultiCell($this->postotalht - $this->posxdiscount, 3,
price(
price2num($pricemin,
'MU'), 0, $outputlangs), 0,
'R', 0);
454 $pdf->SetXY($this->postotalht, $curY);
455 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3,
price(
price2num($pricemin * $objp->value,
'MT'), 0, $outputlangs), 0,
'R', 0);
457 $totalvaluesell +=
price2num($pricemin * $objp->value,
'MT');
460 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
462 $pdf->setPage($pageposafter);
463 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
465 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
466 $pdf->SetLineStyle(array(
'dash'=>0));
472 while ($pagenb < $pageposafter)
474 $pdf->setPage($pagenb);
477 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
479 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
481 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
483 $pdf->setPage($pagenb);
484 $pdf->setPageOrientation(
'', 1, 0);
485 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
487 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
491 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
493 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
495 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
498 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
500 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
509 $nexY = $pdf->GetY();
514 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
515 $pdf->line($this->marge_gauche, $curY - 1, $this->page_largeur - $this->marge_droite, $curY - 1);
516 $pdf->SetLineStyle(array(
'dash'=>0));
518 $pdf->SetFont(
'',
'B', $default_font_size - 1);
519 $pdf->SetTextColor(0, 0, 120);
522 $pdf->SetXY($this->posxdesc, $curY);
523 $pdf->MultiCell($this->wref, 3, $langs->trans(
"Total"), 0,
'L');
526 $valtoshow =
price2num($totalunit,
'MS');
527 $towrite = empty($valtoshow) ?
'0' : $valtoshow;
529 $pdf->SetXY($this->posxqty, $curY);
530 $pdf->MultiCell($this->posxup - $this->posxqty - 0.8, 3, $towrite, 0,
'R');
533 $pdf->SetXY($this->posxunit, $curY);
534 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3,
price(
price2num($totalvalue,
'MT'), 0, $outputlangs), 0,
'R');
537 if (empty($conf->global->PRODUIT_MULTIPRICES))
540 $pdf->SetXY($this->postotalht, $curY);
541 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3,
price(
price2num($totalvaluesell,
'MT'), 0, $outputlangs), 0,
'R', 0);
549 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
560 $pdf->SetFont(
'',
'', $default_font_size - 1);
561 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
562 $nexY = $pdf->GetY();
563 $height_note = $nexY - $tab_top;
566 $pdf->SetDrawColor(192, 192, 192);
567 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
569 $tab_height = $tab_height - $height_note;
570 $tab_top = $nexY + 6;
575 $iniY = $tab_top + 7;
576 $curY = $tab_top + 7;
577 $nexY = $tab_top + 7;
579 $tab_top = $tab_top_newpage + 25 + $top_shift;
584 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
585 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
587 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
588 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
591 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
600 $this->
_pagefoot($pdf, $object, $outputlangs);
601 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
605 $pdf->Output($file,
'F');
608 $hookmanager->initHooks(array(
'pdfgeneration'));
609 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
611 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
614 $this->error = $hookmanager->error;
615 $this->errors = $hookmanager->errors;
618 if (!empty($conf->global->MAIN_UMASK))
619 @chmod($file, octdec($conf->global->MAIN_UMASK));
621 $this->result = array(
'fullpath'=>$file);
625 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
629 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"PRODUCT_OUTPUTDIR");
648 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
654 if ($hidetop) $hidetop = -1;
656 $currency = !empty($currency) ? $currency : $conf->currency;
660 $pdf->SetTextColor(0, 0, 0);
661 $pdf->SetFont(
'',
'', $default_font_size - 2);
665 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
666 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
667 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
670 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $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));
673 $pdf->SetDrawColor(128, 128, 128);
674 $pdf->SetFont(
'',
'B', $default_font_size - 3);
679 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
680 $pdf->SetDrawColor(200, 200, 200);
681 $pdf->line($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite, $tab_top);
682 $pdf->SetLineStyle(array(
'dash'=>0));
683 $pdf->SetDrawColor(128, 128, 128);
684 $pdf->SetTextColor(0, 0, 120);
689 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
690 $pdf->MultiCell($this->wref, 3, $outputlangs->transnoentities(
"Ref"),
'',
'L');
696 $pdf->SetXY($this->posxlabel - 1, $tab_top + 1);
697 $pdf->MultiCell($this->posxqty - $this->posxlabel - 1, 2, $outputlangs->transnoentities(
"Label"),
'',
'L');
703 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
704 $pdf->MultiCell($this->posxup - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Units"),
'',
'R');
710 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
711 $pdf->MultiCell($this->posxunit - $this->posxup - 1, 2, $outputlangs->transnoentities(
"AverageUnitPricePMPShort"),
'',
'R');
717 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
718 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"EstimatedStockValueShort"),
'',
'R');
724 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
725 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"SellPriceMin"),
'',
'R');
731 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
732 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 2, $outputlangs->transnoentities(
"EstimatedStockValueSellShort"),
'',
'R');
735 $pdf->SetDrawColor(200, 200, 200);
736 $pdf->SetLineStyle(array(
'dash'=>
'0',
'color'=>array(200, 200, 200)));
737 $pdf->line($this->marge_gauche, $tab_top + 11, $this->page_largeur - $this->marge_droite, $tab_top + 11);
738 $pdf->SetLineStyle(array(
'dash'=>0));
752 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey =
"")
754 global $conf, $langs, $db, $hookmanager;
757 $outputlangs->loadLangs(array(
"main",
"propal",
"companies",
"bills",
"orders",
"stocks"));
761 if ($object->type == 1) $titlekey =
'ServiceSheet';
762 else $titlekey =
'StockSheet';
767 if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK)))
769 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
772 $pdf->SetTextColor(0, 0, 60);
773 $pdf->SetFont(
'',
'B', $default_font_size + 3);
775 $posy = $this->marge_haute;
776 $posx = $this->page_largeur - $this->marge_droite - 100;
778 $pdf->SetXY($this->marge_gauche, $posy);
781 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
782 if ($this->emetteur->logo)
784 if (is_readable($logo))
787 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
789 $pdf->SetTextColor(200, 0, 0);
790 $pdf->SetFont(
'',
'B', $default_font_size - 2);
791 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
792 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
795 $text = $this->emetteur->name;
796 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
799 $pdf->SetFont(
'',
'B', $default_font_size + 3);
800 $pdf->SetXY($posx, $posy);
801 $pdf->SetTextColor(0, 0, 60);
802 $title = $outputlangs->transnoentities(
"Warehouse");
803 $pdf->MultiCell(100, 3, $title,
'',
'R');
805 $pdf->SetFont(
'',
'B', $default_font_size);
808 $pdf->SetXY($posx, $posy);
809 $pdf->SetTextColor(0, 0, 60);
811 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->label),
'',
'R');
814 $pdf->SetFont(
'',
'', $default_font_size - 1);
815 $pdf->SetXY($posx, $posy);
816 $pdf->SetTextColor(0, 0, 60);
817 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"LocationSummary").
' :',
'',
'R');
820 $pdf->SetXY($posx - 50, $posy);
821 $pdf->MultiCell(150, 3, $object->lieu,
'',
'R');
824 $pdf->SetXY($posx, $posy);
825 $pdf->SetTextColor(0, 0, 60);
829 $hasparent = (!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0);
832 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ParentWarehouse").
' :',
'',
'R');
835 $pdf->SetXY($posx - 50, $posy);
836 $pdf->MultiCell(150, 3, $e->label,
'',
'R');
840 $nexY = $pdf->GetY();
842 $pdf->SetXY($posx, $posy);
843 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"Description").
' : </b>'.nl2br($object->description), 0, 1);
844 $nexY = $pdf->GetY();
846 $calcproductsunique = $object->nb_different_products();
847 $calcproducts = $object->nb_products();
850 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"NumberOfDifferentProducts").
' : </b>'.(empty($calcproductsunique[
'nb']) ?
'0' : $calcproductsunique[
'nb']), 0, 1);
851 $nexY = $pdf->GetY();
854 $valtoshow =
price2num($calcproducts[
'nb'],
'MS');
855 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"NumberOfProducts").
' : </b>'.(empty($valtoshow) ?
'0' : $valtoshow), 0, 1);
856 $nexY = $pdf->GetY();
859 $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);
860 $nexY = $pdf->GetY();
864 $sql =
"SELECT max(m.datem) as datem";
865 $sql .=
" FROM ".MAIN_DB_PREFIX.
"stock_mouvement as m";
866 $sql .=
" WHERE m.fk_entrepot = ".((int) $object->id);
867 $resqlbis = $this->
db->query($sql);
870 $obj = $this->
db->fetch_object($resqlbis);
871 $lastmovementdate = $this->
db->jdate($obj->datem);
876 if ($lastmovementdate)
880 $toWrite = $outputlangs->transnoentities(
"None");
883 $pdf->writeHTMLCell(190, 2, $this->marge_gauche, $nexY,
'<b>'.$outputlangs->transnoentities(
"LastMovement").
' : </b>'.$toWrite, 0, 1);
884 $nexY = $pdf->GetY();
890 $current_y = $pdf->getY();
891 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
892 if ($current_y < $pdf->getY())
894 $top_shift = $pdf->getY() - $current_y;
897 $pdf->SetTextColor(0, 0, 0);
912 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
915 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
916 return pdf_pagefoot($pdf, $outputlangs,
'PRODUCT_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.
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.
</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.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency= '')
Show table for lines.
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...
Class to generate expense report based on standard model.
write_file($object, $outputlangs, $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
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.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
__construct($db)
Constructor.
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
_pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="")
Show top header of page.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Parent class for stock models of doc generators.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Class to manage predefined suppliers products.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
Class to manage warehouses.