143 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
146 global $user, $langs,
$conf, $hookmanager, $mysoc;
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->getFullName($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 = 90 + $top_shift;
272 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
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);
608 $this->error = $hookmanager->error;
609 $this->errors = $hookmanager->errors;
614 $this->result = array(
'fullpath' => $file);
618 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
622 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
658 global
$conf, $mysoc;
662 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
663 $pdf->SetFont(
'',
'B', $default_font_size - 2);
664 $pdf->SetXY($this->marge_gauche, $posy);
665 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L',
false);
667 $posy = $pdf->GetY() + 4;
673 if (!empty(
$object->cond_reglement_code) ||
$object->cond_reglement) {
674 $pdf->SetFont(
'',
'B', $default_font_size - 2);
675 $pdf->SetXY($this->marge_gauche, $posy);
676 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
677 $pdf->MultiCell(80, 4, $titre, 0,
'L');
679 $pdf->SetFont(
'',
'', $default_font_size - 2);
680 $pdf->SetXY($posxval, $posy);
681 $lib_condition_paiement = ($outputlangs->transnoentities(
"PaymentCondition".
$object->cond_reglement_code) !=
'PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities(
"PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset(
$object->cond_reglement_doc ?
$object->cond_reglement_doc :
$object->cond_reglement_label);
682 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
683 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0,
'L');
685 $posy = $pdf->GetY() + 3;
689 if (!empty(
$object->mode_reglement_code)) {
690 $pdf->SetFont(
'',
'B', $default_font_size - 2);
691 $pdf->SetXY($this->marge_gauche, $posy);
692 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
693 $pdf->MultiCell(80, 5, $titre, 0,
'L');
695 $pdf->SetFont(
'',
'', $default_font_size - 2);
696 $pdf->SetXY($posxval, $posy);
697 $lib_mode_reg = $outputlangs->transnoentities(
"PaymentType".
$object->mode_reglement_code) !=
'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentities(
"PaymentType".
$object->mode_reglement_code) : $outputlangs->convToOutputCharset(
$object->mode_reglement);
698 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
700 $posy = $pdf->GetY() + 2;
722 global
$conf, $mysoc;
728 $pdf->SetFont(
'',
'', $default_font_size - 1);
733 if ($this->page_largeur < 210) {
736 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
742 $pdf->SetFillColor(255, 255, 255);
743 $pdf->SetXY($col1x, $tab2_top);
744 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L',
true);
746 $total_ht = ((isModEnabled(
"multicurrency") && isset(
$object->multicurrency_tx) &&
$object->multicurrency_tx != 1) ?
$object->multicurrency_total_ht :
$object->total_ht);
747 $pdf->SetXY($col2x, $tab2_top);
748 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty(
$object->remise) ?
$object->remise : 0)), 0,
'R',
true);
751 $pdf->SetFillColor(248, 248, 248);
753 $this->atleastoneratenotnull = 0;
754 foreach ($this->tva as $tvakey => $tvaval) {
756 $this->atleastoneratenotnull++;
759 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
763 if (preg_match(
'/\*/', $tvakey)) {
764 $tvakey = str_replace(
'*',
'', $tvakey);
765 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
768 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
769 $totalvat .=
vatrate($tvakey,
true).$tvacompl;
770 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
772 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
773 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R',
true);
776 if (!$this->atleastoneratenotnull) {
778 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
779 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code), 0,
'L',
true);
781 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
782 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_tva), 0,
'R',
true);
787 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
788 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code), 0,
'L',
true);
789 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
790 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_localtax1), $useborder,
'R',
true);
796 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
797 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code), 0,
'L',
true);
798 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
799 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_localtax2), $useborder,
'R',
true);
805 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
806 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
810 foreach ($localtax_rate as $tvakey => $tvaval) {
815 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
818 if (preg_match(
'/\*/', $tvakey)) {
819 $tvakey = str_replace(
'*',
'', $tvakey);
820 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
822 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
823 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
824 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
826 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
827 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R',
true);
835 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
836 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
840 foreach ($localtax_rate as $tvakey => $tvaval) {
845 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
848 if (preg_match(
'/\*/', $tvakey)) {
849 $tvakey = str_replace(
'*',
'', $tvakey);
850 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
852 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
853 $totalvat .=
vatrate((
string) abs((
float) $tvakey),
true).$tvacompl;
854 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L',
true);
856 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
857 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R',
true);
865 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
866 $pdf->SetTextColor(0, 0, 60);
867 $pdf->SetFillColor(224, 224, 224);
868 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L',
true);
870 $total_ttc = (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) ?
$object->multicurrency_total_ttc :
$object->total_ttc;
871 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
872 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc), $useborder,
'R',
true);
873 $pdf->SetFont(
'',
'', $default_font_size - 1);
874 $pdf->SetTextColor(0, 0, 0);
876 $creditnoteamount = 0;
881 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
886 if ($deja_regle > 0) {
890 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
891 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L',
false);
892 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
893 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle), 0,
'R',
false);
896 $pdf->SetTextColor(0, 0, 60);
897 $pdf->SetFillColor(224, 224, 224);
898 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
899 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L',
true);
901 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
902 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer), $useborder,
'R',
true);
904 $pdf->SetFont(
'',
'', $default_font_size - 1);
905 $pdf->SetTextColor(0, 0, 0);
909 return ($tab2_top + ($tab2_hl * $index));
999 global $langs,
$conf, $mysoc;
1001 $ltrdirection =
'L';
1002 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1003 $ltrdirection =
'R';
1007 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"sendings",
"mrp"));
1021 $pdf->SetTextColor(0, 0, 60);
1022 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1024 $posx = $this->page_largeur - $this->marge_droite - 100;
1025 $posy = $this->marge_haute;
1028 $pdf->SetXY($this->marge_gauche, $posy);
1031 $logo =
$conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1032 if ($this->emetteur->logo) {
1033 if (is_readable($logo)) {
1035 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1037 $pdf->SetTextColor(200, 0, 0);
1038 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1039 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1040 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
1043 $text = $this->emetteur->name;
1044 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1047 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1048 $pdf->SetXY($posx, $posy);
1049 $pdf->SetTextColor(0, 0, 60);
1050 $title = $outputlangs->transnoentities(
"ManufacturingOrder").
" ".$outputlangs->convToOutputCharset(
$object->ref);
1051 $pdf->MultiCell(100, 3, $title,
'',
'R');
1056 $pdf->SetFont(
'',
'B', $default_font_size);
1057 $pdf->SetXY($posx, $posy);
1058 $pdf->SetTextColor(0, 0, 60);
1059 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefSupplier").
" : ".$outputlangs->convToOutputCharset(
$object->ref_supplier),
'',
'R');
1063 $pdf->SetFont(
'',
'', $default_font_size - 1);
1066 if (!empty(
$object->project->ref)) {
1068 $pdf->SetXY($posx, $posy);
1069 $pdf->SetTextColor(0, 0, 60);
1070 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1076 if (!empty(
$object->project->ref)) {
1077 $outputlangs->load(
"projects");
1079 $pdf->SetXY($posx, $posy);
1080 $langs->load(
"projects");
1081 $pdf->SetTextColor(0, 0, 60);
1082 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1086 if (!empty(
$object->date_start_planned)) {
1088 $pdf->SetXY($posx, $posy);
1089 $pdf->SetTextColor(0, 0, 60);
1090 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"MoDate").
" : ".
dol_print_date(
$object->date_start_planned,
"day",
false, $outputlangs,
true),
'',
'R');
1093 $pdf->SetXY($posx, $posy);
1094 $pdf->SetTextColor(255, 0, 0);
1095 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ToApprove"),
'',
'R');
1099 $prodToMake =
new Product($this->db);
1100 $resProdToMake = $prodToMake->fetch(
$object->fk_product);
1102 if ($resProdToMake > 0) {
1105 $pdf->SetFont(
'',
'B', $default_font_size + 1);
1106 $pdf->SetXY($posx, $posy);
1107 $pdf->SetTextColor(0, 0, 60);
1108 $pdf->MultiCell($w, 3, $prodToMake->ref,
'',
'R');
1112 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1113 $pdf->SetXY($posx, $posy);
1114 $pdf->SetTextColor(0, 0, 60);
1115 $pdf->MultiCell($w, 3, html_entity_decode($prodToMake->description),
'',
'R',
false, 1,
null,
null,
true, 0,
false,
true, 51,
'T',
true);
1116 $posy = $pdf->GetY() - 5;
1119 $array = array_filter(array($prodToMake->length, $prodToMake->width, $prodToMake->height));
1120 $dim = implode(
"x", $array);
1123 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1124 $pdf->SetXY($posx, $posy);
1125 $pdf->SetTextColor(0, 0, 60);
1126 $pdf->MultiCell($w, 3, $dim,
'',
'R');
1131 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1132 $pdf->SetXY($posx, $posy);
1133 $pdf->SetTextColor(0, 0, 60);
1134 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"QtyToProduce").
": " .$object->qty,
'',
'R');
1137 $pdf->SetTextColor(0, 0, 60);
1138 $usehourmin =
'day';
1140 $usehourmin =
'dayhour';
1142 if (!empty(
$object->delivery_date)) {
1144 $pdf->SetXY($posx - 90, $posy);
1145 $pdf->MultiCell(190, 3, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->delivery_date, $usehourmin,
false, $outputlangs,
true),
'',
'R');
1148 if (isset(
$object->thirdparty->code_fournisseur)) {
1150 $pdf->SetXY($posx, $posy);
1151 $pdf->SetTextColor(0, 0, 60);
1152 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_fournisseur),
'',
'R');
1157 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1158 if (count($arrayidcontact) > 0) {
1159 $usertmp =
new User($this->db);
1160 $usertmp->fetch($arrayidcontact[0]);
1162 $pdf->SetXY($posx, $posy);
1163 $pdf->SetTextColor(0, 0, 60);
1164 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1169 $pdf->SetTextColor(0, 0, 60);
1173 $current_y = $pdf->getY();
1175 if ($current_y < $pdf->getY()) {
1176 $top_shift = $pdf->getY() - $current_y;
1181 $carac_emetteur =
'';
1183 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1184 if (count($arrayidcontact) > 0) {
1185 $object->fetch_user($arrayidcontact[0]);
1186 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1187 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1189 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1193 $carac_emetteur .=
"\n";
1199 $posy = 42 + $top_shift;
1200 $posx = $this->marge_gauche;
1202 $posx = $this->page_largeur - $this->marge_droite - 80;
1207 $pdf->SetTextColor(0, 0, 0);
1208 $pdf->SetFont(
'',
'', $default_font_size - 2);
1209 $pdf->SetXY($posx, $posy - 5);
1210 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1211 $pdf->SetXY($posx, $posy);
1212 $pdf->SetFillColor(230, 230, 230);
1213 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius,
'1234',
'F');
1214 $pdf->SetTextColor(0, 0, 60);
1217 $pdf->SetXY($posx + 2, $posy + 3);
1218 $pdf->SetFont(
'',
'B', $default_font_size);
1219 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1220 $posy = $pdf->getY();
1223 $pdf->SetXY($posx + 2, $posy);
1224 $pdf->SetFont(
'',
'', $default_font_size - 1);
1225 $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
1230 $usecontact =
false;
1231 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1232 if (count($arrayidcontact) > 0) {
1234 $result =
$object->fetch_contact($arrayidcontact[0]);
1238 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')))) {
1239 $thirdparty =
$object->contact;
1241 $thirdparty =
$object->thirdparty;