143 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
148 if (!is_object($outputlangs)) {
149 $outputlangs = $langs;
153 $outputlangs->charset_output =
'ISO-8859-1';
157 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"dict",
"products"));
159 global $outputlangsbis;
160 $outputlangsbis =
null;
164 $outputlangsbis->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"dict",
"products"));
171 $nblines = count(
$object->lines);
178 if (
$conf->mrp->dir_output) {
182 $amount_credit_notes_included = 0;
183 $amount_deposits_included = 0;
189 $dir =
$conf->mrp->dir_output;
190 $file = $dir.
"/SPECIMEN.pdf";
193 $dir =
$conf->mrp->dir_output.
'/'.$objectref;
194 $file = $dir.
"/".$objectref.
".pdf";
197 if (!file_exists($dir)) {
199 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
204 if (file_exists($dir)) {
206 if (!is_object($hookmanager)) {
207 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
210 $hookmanager->initHooks(array(
'pdfgeneration'));
211 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
213 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
215 $nblines = count(
$object->lines);
219 $heightforinfotot = 50;
221 $heightforfooter = $this->marge_basse + 8;
223 $heightforfooter += 6;
225 $pdf->setAutoPageBreak(
true, 0);
227 if (class_exists(
'TCPDF')) {
228 $pdf->setPrintHeader(
false);
229 $pdf->setPrintFooter(
false);
234 $pagecount = $pdf->setSourceFile(
$conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
235 $tplidx = $pdf->importPage(1);
240 $pdf->SetDrawColor(128, 128, 128);
242 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
243 $pdf->SetSubject($outputlangs->transnoentities(
"ManufacturingOrder"));
244 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
245 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
246 $key_word=$outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"ManufacturingOrder");
247 if (isset(
$object->thirdparty->name) &&
$object->thirdparty->name !==
"") {
248 $key_word.=
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name);
250 $pdf->SetKeyWords($key_word);
252 $pdf->SetCompression(
false);
256 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
262 if (!empty($tplidx)) {
263 $pdf->useTemplate($tplidx);
267 $pdf->SetFont(
'',
'', $default_font_size - 1);
268 $pdf->MultiCell(0, 3,
'');
269 $pdf->SetTextColor(0, 0, 0);
271 $tab_top = 80 + $this->marge_haute + $top_shift;
272 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 32 + $this->marge_haute + $top_shift : $this->marge_haute);
274 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
278 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
281 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
282 if (!empty($extranote)) {
286 $pagenb = $pdf->getPage();
288 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
289 $pageposbeforenote = $pagenb;
298 $pdf->startTransaction();
300 $pdf->SetFont(
'',
'', $default_font_size - 1);
301 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
303 $pageposafternote = $pdf->getPage();
304 $posyafter = $pdf->GetY();
306 if ($pageposafternote > $pageposbeforenote) {
307 $pdf->rollbackTransaction(
true);
310 while ($pagenb < $pageposafternote) {
313 if (!empty($tplidx)) {
314 $pdf->useTemplate($tplidx);
320 $pdf->setTopMargin($tab_top_newpage);
322 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
326 $pdf->setPage($pageposbeforenote);
327 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
328 $pdf->SetFont(
'',
'', $default_font_size - 1);
329 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
330 $pageposafternote = $pdf->getPage();
332 $posyafter = $pdf->GetY();
334 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
335 $pdf->AddPage(
'',
'',
true);
338 $pdf->setPage($pageposafternote);
339 $pdf->setTopMargin($tab_top_newpage);
341 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
347 $i = $pageposbeforenote;
348 while ($i < $pageposafternote) {
351 $pdf->SetDrawColor(128, 128, 128);
353 if ($i > $pageposbeforenote) {
354 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
355 $pdf->RoundedRect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 2, $this->corner_radius,
'1234',
'D');
357 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
358 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2, $this->corner_radius,
'1234',
'D');
362 $pdf->setPageOrientation(
'',
true, 0);
369 $pdf->setPage($pageposafternote);
370 if (!empty($tplidx)) {
371 $pdf->useTemplate($tplidx);
376 $height_note = $posyafter - $tab_top_newpage;
377 $pdf->RoundedRect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 2, $this->corner_radius,
'1234',
'D');
380 $pdf->commitTransaction();
381 $posyafter = $pdf->GetY();
382 $height_note = $posyafter - $tab_top;
383 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2, $this->corner_radius,
'1234',
'D');
386 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
388 $pdf->AddPage(
'',
'',
true);
391 $pdf->setPage($pageposafternote);
392 if (!empty($tplidx)) {
393 $pdf->useTemplate($tplidx);
399 $posyafter = $tab_top_newpage;
403 $tab_height -= $height_note;
404 $tab_top = $posyafter + 6;
409 $nexY = $tab_top + 5;
415 $pageposbeforeprintlines = $pdf->getPage();
416 $pagenb = $pageposbeforeprintlines;
418 $bom =
new BOM($this->db);
419 $bom -> fetch(
$object->fk_bom);
421 $nblines = count($bom->lines);
423 for ($i = 0; $i < $nblines; $i++) {
425 $pdf->SetFont(
'',
'', $default_font_size - 1);
426 $pdf->SetTextColor(0, 0, 0);
428 $prod =
new Product($this->db);
429 $prod->fetch($bom->lines[$i]->fk_product);
431 $pdf->setTopMargin($tab_top_newpage);
432 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
433 $pageposbefore = $pdf->getPage();
435 $showpricebeforepagebreak = 1;
437 $posYAfterDescription = 0;
440 $curX = $this->posxdesc - 1;
441 $showpricebeforepagebreak = 1;
444 $pdf->startTransaction();
448 $pageposafter = $pdf->getPage();
449 $posyafter = $pdf->GetY();
450 if ($pageposafter > $pageposbefore) {
451 $pdf->rollbackTransaction(
true);
456 $pageposafter = $pdf->getPage();
457 $posyafter = $pdf->GetY();
458 } elseif ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
459 if ($i == ($nblines - 1)) {
460 $pdf->AddPage(
'',
'',
true);
461 if (!empty($tplidx)) {
462 $pdf->useTemplate($tplidx);
465 $pdf->setPage($pageposafter + 1);
470 $showpricebeforepagebreak = 1;
472 $showpricebeforepagebreak = 0;
476 $pdf->commitTransaction();
478 $posYAfterDescription = $pdf->GetY();
481 $nexY = $pdf->GetY();
482 $pageposafter = $pdf->getPage();
483 $pdf->setPage($pageposbefore);
484 $pdf->setTopMargin($this->marge_haute);
485 $pdf->setPageOrientation(
'',
true, 0);
488 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
489 $pdf->setPage($pageposafter);
490 $curY = $tab_top_newpage;
494 $pdf->startTransaction();
500 $pageposafter = $pdf->getPage();
501 $posyafter = $pdf->GetY();
502 if ($pageposafter > $pageposbefore) {
503 $pdf->rollbackTransaction(
true);
507 $pageposafter = $pdf->getPage();
508 $posyafter = $pdf->GetY();
509 } elseif ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
510 if ($i == ($nblines - 1)) {
511 $pdf->AddPage(
'',
'',
true);
512 if (!empty($tplidx)) {
513 $pdf->useTemplate($tplidx);
516 $pdf->setPage($pageposafter + 1);
521 $showpricebeforepagebreak = 1;
523 $showpricebeforepagebreak = 0;
527 $pdf->commitTransaction();
529 $posYAfterDescription = max($posYAfterDescription, $pdf->GetY());
532 $nexY = max($nexY, $pdf->GetY());
533 $pageposafter = $pdf->getPage();
534 $pdf->setPage($pageposbefore);
535 $pdf->setTopMargin($this->marge_haute);
536 $pdf->setPageOrientation(
'',
true, 0);
539 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
540 $pdf->setPage($pageposafter);
541 $curY = $tab_top_newpage;
544 $pdf->SetFont(
'',
'', $default_font_size - 1);
549 $qty = $bom->lines[$i]->qty;
551 $nexY = max($pdf->GetY(), $nexY);
557 $qtytot =
$object->qty * $bom->lines[$i]->qty;
559 $nexY = max($pdf->GetY(), $nexY);
564 $array = array_filter(array($prod->length, $prod->width, $prod->height));
565 $dim = implode(
"x", $array);
567 $nexY = max($pdf->GetY(), $nexY);
573 if ($pagenb == $pageposbeforeprintlines) {
574 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code);
575 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
577 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code);
578 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
588 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) {
594 if (method_exists($pdf,
'AliasNbPages')) {
595 $pdf->AliasNbPages();
600 $pdf->Output($file,
'F');
603 $hookmanager->initHooks(array(
'pdfgeneration'));
604 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
606 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
607 $this->warnings = $hookmanager->warnings;
609 $this->error = $hookmanager->error;
610 $this->errors = $hookmanager->errors;
617 $this->result = array(
'fullpath' => $file);
621 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
625 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
697 $pdf->SetFont(
'',
'', $default_font_size - 1);
702 if ($this->page_largeur < 210) {
705 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
711 $pdf->SetFillColor(255, 255, 255);
712 $pdf->SetXY($col1x, $tab2_top);
713 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L',
true);
716 $pdf->SetXY($col2x, $tab2_top);
717 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht), 0,
'R',
true);
720 $pdf->SetFillColor(248, 248, 248);
722 $this->atleastoneratenotnull = 0;
723 foreach ($this->tva as $tvakey => $tvaval) {
725 $this->atleastoneratenotnull++;
728 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
732 if (preg_match(
'/\*/', $tvakey)) {
733 $tvakey = str_replace(
'*',
'', $tvakey);
734 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
737 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT",
$mysoc->country_code).
' ';
738 $totalvat .=
vatrate($tvakey,
true).$tvacompl;
739 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
741 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
742 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R',
true);
745 if (!$this->atleastoneratenotnull) {
747 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
748 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT",
$mysoc->country_code), 0,
'L',
true);
750 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
751 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_tva), 0,
'R',
true);
756 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
757 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code), 0,
'L',
true);
758 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
759 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_localtax1), $useborder,
'R',
true);
765 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
766 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code), 0,
'L',
true);
767 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
768 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_localtax2), $useborder,
'R',
true);
774 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
775 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
779 foreach ($localtax_rate as $tvakey => $tvaval) {
784 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
787 if (preg_match(
'/\*/', $tvakey)) {
788 $tvakey = str_replace(
'*',
'', $tvakey);
789 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
791 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1",
$mysoc->country_code).
' ';
792 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
793 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
795 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
796 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R',
true);
804 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
805 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
809 foreach ($localtax_rate as $tvakey => $tvaval) {
814 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
817 if (preg_match(
'/\*/', $tvakey)) {
818 $tvakey = str_replace(
'*',
'', $tvakey);
819 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
821 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2",
$mysoc->country_code).
' ';
822 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
823 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
825 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
826 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R',
true);
834 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
835 $pdf->SetTextColor(0, 0, 60);
836 $pdf->SetFillColor(224, 224, 224);
837 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L',
true);
840 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
841 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc), $useborder,
'R',
true);
842 $pdf->SetFont(
'',
'', $default_font_size - 1);
843 $pdf->SetTextColor(0, 0, 0);
845 $creditnoteamount = 0;
850 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
855 if ($deja_regle > 0) {
859 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
860 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L',
false);
861 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
862 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle), 0,
'R',
false);
865 $pdf->SetTextColor(0, 0, 60);
866 $pdf->SetFillColor(224, 224, 224);
867 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
868 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L',
true);
870 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
871 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer), $useborder,
'R',
true);
873 $pdf->SetFont(
'',
'', $default_font_size - 1);
874 $pdf->SetTextColor(0, 0, 0);
878 return ($tab2_top + ($tab2_hl * $index));
971 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
976 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"sendings",
"mrp"));
990 $pdf->SetTextColor(0, 0, 60);
991 $pdf->SetFont(
'',
'B', $default_font_size + 3);
993 $posx = $this->page_largeur - $this->marge_droite - 100;
994 $posy = $this->marge_haute;
997 $pdf->SetXY($this->marge_gauche, $posy);
1000 $logo =
$conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1001 if ($this->emetteur->logo) {
1002 if (is_readable($logo)) {
1004 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1006 $pdf->SetTextColor(200, 0, 0);
1007 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1008 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1009 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
1012 $text = $this->emetteur->name;
1013 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1016 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1017 $pdf->SetXY($posx, $posy);
1018 $pdf->SetTextColor(0, 0, 60);
1019 $title = $outputlangs->transnoentities(
"ManufacturingOrder").
" ".$outputlangs->convToOutputCharset(
$object->ref);
1020 $pdf->MultiCell(100, 3, $title,
'',
'R');
1023 $pdf->SetFont(
'',
'', $default_font_size - 1);
1026 if (!empty(
$object->project->ref)) {
1028 $pdf->SetXY($posx, $posy);
1029 $pdf->SetTextColor(0, 0, 60);
1030 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
pdf_truncate_text($pdf,
$object->project->title, 50)),
'',
'R');
1036 if (!empty(
$object->project->ref)) {
1037 $outputlangs->load(
"projects");
1039 $pdf->SetXY($posx, $posy);
1040 $langs->load(
"projects");
1041 $pdf->SetTextColor(0, 0, 60);
1042 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1046 if (!empty(
$object->date_start_planned)) {
1048 $pdf->SetXY($posx, $posy);
1049 $pdf->SetTextColor(0, 0, 60);
1050 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"MoDate").
" : ".
dol_print_date(
$object->date_start_planned,
"day",
false, $outputlangs,
true),
'',
'R');
1053 $pdf->SetXY($posx, $posy);
1054 $pdf->SetTextColor(255, 0, 0);
1055 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ToApprove"),
'',
'R');
1059 $prodToMake =
new Product($this->db);
1060 $resProdToMake = $prodToMake->fetch((
int)
$object->fk_product);
1062 if ($resProdToMake > 0) {
1065 $pdf->SetFont(
'',
'B', $default_font_size + 1);
1066 $pdf->SetXY($posx, $posy);
1067 $pdf->SetTextColor(0, 0, 60);
1068 $pdf->MultiCell($w, 3, $prodToMake->ref,
'',
'R');
1072 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1073 $pdf->SetXY($posx, $posy);
1074 $pdf->SetTextColor(0, 0, 60);
1075 $pdf->MultiCell($w, 3, html_entity_decode($prodToMake->description),
'',
'R',
false, 1,
null,
null,
true, 0,
false,
true, 51,
'T',
true);
1076 $posy = $pdf->GetY() - 5;
1079 $array = array_filter(array($prodToMake->length, $prodToMake->width, $prodToMake->height));
1080 $dim = implode(
"x", $array);
1083 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1084 $pdf->SetXY($posx, $posy);
1085 $pdf->SetTextColor(0, 0, 60);
1086 $pdf->MultiCell($w, 3, $dim,
'',
'R');
1091 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1092 $pdf->SetXY($posx, $posy);
1093 $pdf->SetTextColor(0, 0, 60);
1094 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"QtyToProduce").
": " .$object->qty,
'',
'R');
1097 $pdf->SetTextColor(0, 0, 60);
1098 if (isset(
$object->thirdparty->code_fournisseur)) {
1100 $pdf->SetXY($posx, $posy);
1101 $pdf->SetTextColor(0, 0, 60);
1102 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_fournisseur),
'',
'R');
1107 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1108 if (count($arrayidcontact) > 0) {
1109 $usertmp =
new User($this->db);
1110 $usertmp->fetch($arrayidcontact[0]);
1112 $pdf->SetXY($posx, $posy);
1113 $pdf->SetTextColor(0, 0, 60);
1114 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1119 $pdf->SetTextColor(0, 0, 60);
1123 $current_y = $pdf->getY();
1125 if ($current_y < $pdf->getY()) {
1126 $top_shift = $pdf->getY() - $current_y;
1131 $carac_emetteur =
'';
1133 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1134 if (count($arrayidcontact) > 0) {
1135 $object->fetch_user($arrayidcontact[0]);
1136 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1137 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1139 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1143 $carac_emetteur .=
"\n";
1149 $posy = 32 + $this->marge_haute + $top_shift;
1150 $posx = $this->marge_gauche;
1152 $posx = $this->page_largeur - $this->marge_droite - 80;
1157 $pdf->SetTextColor(0, 0, 0);
1158 $pdf->SetFont(
'',
'', $default_font_size - 2);
1159 $pdf->SetXY($posx, $posy - 5);
1160 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1161 $pdf->SetXY($posx, $posy);
1162 $pdf->SetFillColor(230, 230, 230);
1163 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius,
'1234',
'F');
1164 $pdf->SetTextColor(0, 0, 60);
1167 $pdf->SetXY($posx + 2, $posy + 3);
1168 $pdf->SetFont(
'',
'B', $default_font_size);
1169 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1170 $posy = $pdf->getY();
1173 $pdf->SetXY($posx + 2, $posy);
1174 $pdf->SetFont(
'',
'', $default_font_size - 1);
1175 $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
1180 $usecontact =
false;
1181 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1182 if (count($arrayidcontact) > 0) {
1184 $result =
$object->fetch_contact($arrayidcontact[0]);
1188 if ($usecontact && (
$object->contact->fk_soc !=
$object->thirdparty->id && (!isset(
$conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1189 $thirdparty =
$object->contact;
1191 $thirdparty =
$object->thirdparty;