34 require_once DOL_DOCUMENT_ROOT.
'/core/modules/commande/modules_commande.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
64 public $update_main_doc_field;
75 public $phpmin = array(5, 5);
81 public $version =
'dolibarr';
101 public $marge_gauche;
106 public $marge_droite;
132 global $conf, $langs, $mysoc;
135 $langs->loadLangs(array(
"main",
"bills",
"products"));
138 $this->
name = $langs->trans(
"StockTransferSheetProforma");
139 $this->
description = $langs->trans(
'StockTransferSheetProforma');
140 $this->update_main_doc_field = 1;
145 $this->page_largeur = $formatarray[
'width'];
146 $this->page_hauteur = $formatarray[
'height'];
147 $this->format = array($this->page_largeur, $this->page_hauteur);
148 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
149 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
150 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
151 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
153 $this->option_logo = 1;
154 $this->option_tva = 1;
155 $this->option_modereg = 1;
156 $this->option_condreg = 1;
157 $this->option_codeproduitservice = 1;
158 $this->option_multilang = 1;
159 $this->option_escompte = 0;
160 $this->option_credit_note = 0;
161 $this->option_freetext = 1;
162 $this->option_draft_watermark = 1;
165 $this->emetteur = $mysoc;
166 if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2);
169 $this->posxdesc = $this->marge_gauche + 1;
172 $this->tabTitleHeight = 5;
174 $this->tva = array();
175 $this->localtax1 = array();
176 $this->localtax2 = array();
177 $this->atleastoneratenotnull = 0;
178 $this->atleastonediscount = 0;
193 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
196 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
198 if (!is_object($outputlangs)) $outputlangs = $langs;
200 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
203 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"deliveries"));
205 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
206 global $outputlangsbis;
207 $outputlangsbis =
new Translate(
'', $conf);
208 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
209 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"orders",
"deliveries"));
212 $nblines = count($object->lines);
215 if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
216 $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
220 $realpatharray = array();
221 $this->atleastonephoto =
false;
222 if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) {
225 for ($i = 0; $i < $nblines; $i++) {
226 if (empty($object->lines[$i]->fk_product))
continue;
228 $objphoto->fetch($object->lines[$i]->fk_product);
230 if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
231 $pdir[0] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
232 $pdir[1] =
get_exdir(0, 0, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
234 $pdir[0] =
get_exdir(0, 0, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
235 $pdir[1] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
239 foreach ($pdir as $midir) {
241 $dir = $conf->product->dir_output.
'/'.$midir;
243 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
244 if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) {
245 if ($obj[
'photo_vignette']) {
246 $filename = $obj[
'photo_vignette'];
248 $filename = $obj[
'photo'];
251 $filename = $obj[
'photo'];
254 $realpath = $dir.$filename;
256 $this->atleastonephoto =
true;
261 if ($realpath && $arephoto) $realpatharray[$i] = $realpath;
267 if ($conf->stocktransfer->dir_output) {
268 $object->fetch_thirdparty();
273 if ($object->specimen) {
274 $dir = $conf->stocktransfer->multidir_output[$conf->entity];
275 $file = $dir.
"/SPECIMEN.pdf";
278 $dir = $conf->stocktransfer->multidir_output[$conf->entity].
"/".$object->element.
"/".$objectref;
279 $file = $dir.
"/".$objectref.
"-proforma.pdf";
282 if (!file_exists($dir)) {
284 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
289 if (file_exists($dir)) {
291 if (!is_object($hookmanager)) {
292 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
295 $hookmanager->initHooks(array(
'pdfgeneration'));
296 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
298 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
303 $pdf->SetAutoPageBreak(1, 0);
305 $heightforinfotot = 40;
306 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
307 $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22);
309 if (class_exists(
'TCPDF')) {
310 $pdf->setPrintHeader(
false);
311 $pdf->setPrintFooter(
false);
315 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
316 $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
317 $tplidx = $pdf->importPage(1);
322 $pdf->SetDrawColor(128, 128, 128);
324 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
325 $pdf->SetSubject($outputlangs->transnoentities(
"PdfOrderTitle"));
326 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
327 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
328 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PdfOrderTitle").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
329 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
331 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
334 foreach ($object->lines as $line) {
335 if ($line->remise_percent) {
336 $this->atleastonediscount =
true;
344 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
346 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
347 $pdf->SetFont(
'',
'', $default_font_size - 1);
348 $pdf->MultiCell(0, 3,
'');
349 $pdf->SetTextColor(0, 0, 0);
352 $tab_top = 90 + $top_shift;
353 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
356 if ($conf->incoterm->enabled) {
357 $desc_incoterms = $object->getIncotermsForPDF();
358 if ($desc_incoterms) {
361 $pdf->SetFont(
'',
'', $default_font_size - 1);
362 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
363 $nexY = $pdf->GetY();
364 $height_incoterms = $nexY - $tab_top;
367 $pdf->SetDrawColor(192, 192, 192);
368 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
370 $tab_top = $nexY + 6;
375 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
376 if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
378 if (is_object($object->thirdparty)) {
379 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
380 $salerepobj =
new User($this->
db);
381 $salerepobj->fetch($salereparray[0][
'id']);
382 if (!empty($salerepobj->signature)) $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
387 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
388 if (!empty($extranote)) {
392 $pagenb = $pdf->getPage();
394 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
395 $pageposbeforenote = $pagenb;
404 $pdf->startTransaction();
406 $pdf->SetFont(
'',
'', $default_font_size - 1);
407 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
409 $pageposafternote = $pdf->getPage();
410 $posyafter = $pdf->GetY();
412 if ($pageposafternote > $pageposbeforenote) {
413 $pdf->rollbackTransaction(
true);
416 while ($pagenb < $pageposafternote) {
419 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
420 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
422 $pdf->setTopMargin($tab_top_newpage);
424 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
428 $pdf->setPage($pageposbeforenote);
429 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
430 $pdf->SetFont(
'',
'', $default_font_size - 1);
431 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
432 $pageposafternote = $pdf->getPage();
434 $posyafter = $pdf->GetY();
436 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
437 $pdf->AddPage(
'',
'',
true);
440 $pdf->setPage($pageposafternote);
441 $pdf->setTopMargin($tab_top_newpage);
443 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
449 $i = $pageposbeforenote;
450 while ($i < $pageposafternote) {
454 $pdf->SetDrawColor(128, 128, 128);
456 if ($i > $pageposbeforenote) {
457 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
458 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
460 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
461 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
465 $pdf->setPageOrientation(
'', 1, 0);
466 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
472 $pdf->setPage($pageposafternote);
473 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
474 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
475 $height_note = $posyafter - $tab_top_newpage;
476 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
479 $pdf->commitTransaction();
480 $posyafter = $pdf->GetY();
481 $height_note = $posyafter - $tab_top;
482 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
485 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
487 $pdf->AddPage(
'',
'',
true);
490 $pdf->setPage($pageposafternote);
491 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
492 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
494 $posyafter = $tab_top_newpage;
498 $tab_height = $tab_height - $height_note;
499 $tab_top = $posyafter + 6;
509 $pdf->startTransaction();
510 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
511 $pdf->rollbackTransaction(
true);
513 $nexY = $tab_top + $this->tabTitleHeight;
516 $pageposbeforeprintlines = $pdf->getPage();
517 $pagenb = $pageposbeforeprintlines;
518 for ($i = 0; $i < $nblines; $i++) {
520 $pdf->SetFont(
'',
'', $default_font_size - 1);
521 $pdf->SetTextColor(0, 0, 0);
524 $imglinesize = array();
527 $pdf->setTopMargin($tab_top_newpage);
528 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
529 $pageposbefore = $pdf->getPage();
532 $showpricebeforepagebreak = 1;
537 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
538 $pdf->AddPage(
'',
'',
true);
539 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
540 $pdf->setPage($pageposbefore + 1);
542 $curY = $tab_top_newpage;
545 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
546 $showpricebeforepagebreak = 1;
547 else $showpricebeforepagebreak = 0;
550 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
551 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
553 $posYAfterImage = $curY + $imglinesize[
'height'];
558 $pdf->startTransaction();
560 if (method_exists($object->lines[$i],
'fetch_product')) {
561 $object->lines[$i]->fetch_product();
562 $object->lines[$i]->label = $object->lines[$i]->product->label;
563 $object->lines[$i]->description = $object->lines[$i]->product->description;
564 $object->lines[$i]->fk_unit = $object->lines[$i]->product->fk_unit;
567 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
569 $pageposafter = $pdf->getPage();
570 if ($pageposafter > $pageposbefore) {
571 $pdf->rollbackTransaction(
true);
572 $pageposafter = $pageposbefore;
574 $pdf->setPageOrientation(
'', 1, $heightforfooter);
576 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
577 $pageposafter = $pdf->getPage();
578 $posyafter = $pdf->GetY();
579 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
580 if ($i == ($nblines - 1)) {
581 $pdf->AddPage(
'',
'',
true);
582 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
584 $pdf->setPage($pageposafter + 1);
589 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
590 $showpricebeforepagebreak = 1;
591 else $showpricebeforepagebreak = 0;
595 $pdf->commitTransaction();
601 $nexY = max($pdf->GetY(), $posYAfterImage);
604 $pageposafter = $pdf->getPage();
606 $pdf->setPage($pageposbefore);
607 $pdf->setTopMargin($this->marge_haute);
608 $pdf->setPageOrientation(
'', 1, 0);
611 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
612 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
615 $pdf->SetFont(
'',
'', $default_font_size - 1);
621 $nexY = max($pdf->GetY(), $nexY);
626 $pmp = $object->lines[$i]->pmp;
628 $nexY = max($pdf->GetY(), $nexY);
636 $nexY = max($pdf->GetY(), $nexY);
642 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
644 $nexY = max($pdf->GetY(), $nexY);
648 if ($this->
getColumnStatus(
'discount') && $object->lines[$i]->remise_percent) {
651 $nexY = max($pdf->GetY(), $nexY);
656 $pmp_qty = $pmp * $object->lines[$i]->qty;
658 $nexY = max($pdf->GetY(), $nexY);
662 if (!empty($object->lines[$i]->array_options)) {
663 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
667 $nexY = max($pdf->GetY(), $nexY);
678 'outputlangs' => $outputlangs,
679 'hidedetails' => $hidedetails
681 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
685 if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
686 else $tvaligne = $object->lines[$i]->total_tva;
688 $localtax1ligne = $object->lines[$i]->total_localtax1;
689 $localtax2ligne = $object->lines[$i]->total_localtax2;
690 $localtax1_rate = $object->lines[$i]->localtax1_tx;
691 $localtax2_rate = $object->lines[$i]->localtax2_tx;
692 $localtax1_type = $object->lines[$i]->localtax1_type;
693 $localtax2_type = $object->lines[$i]->localtax2_type;
695 if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
696 if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
697 if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
699 $vatrate = (string) $object->lines[$i]->tva_tx;
702 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
703 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
705 $localtax1_type = $localtaxtmp_array[0];
706 $localtax2_type = $localtaxtmp_array[2];
710 if ($localtax1_type && $localtax1ligne != 0)
711 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
712 if ($localtax2_type && $localtax2ligne != 0)
713 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
715 if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .=
'*';
716 if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0;
717 $this->tva[$vatrate] += $tvaligne;
720 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
721 $pdf->setPage($pageposafter);
722 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
724 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
725 $pdf->SetLineStyle(array(
'dash'=>0));
730 while ($pagenb < $pageposafter) {
731 $pdf->setPage($pagenb);
732 if ($pagenb == $pageposbeforeprintlines) {
733 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
735 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
737 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
739 $pdf->setPage($pagenb);
740 $pdf->setPageOrientation(
'', 1, 0);
741 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
743 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
744 if ($pagenb == $pageposafter) {
745 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
747 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
749 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
752 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
754 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
759 if ($pagenb == $pageposbeforeprintlines)
760 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
761 else $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
762 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
769 $posy = $this->
drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
780 $this->
_pagefoot($pdf, $object, $outputlangs);
781 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
785 $pdf->Output($file,
'F');
788 $hookmanager->initHooks(array(
'pdfgeneration'));
789 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
791 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
793 $this->error = $hookmanager->error;
794 $this->errors = $hookmanager->errors;
797 if (!empty($conf->global->MAIN_UMASK))
798 @chmod($file, octdec($conf->global->MAIN_UMASK));
800 $this->result = array(
'fullpath'=>$file);
804 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
808 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"STOCKTRANSFER_OUTPUTDIR");
837 global $conf, $mysoc;
840 $pdf->SetFont(
'',
'', $default_font_size - 1);
843 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
844 $pdf->SetFont(
'',
'B', $default_font_size - 2);
845 $pdf->SetXY($this->marge_gauche, $posy);
846 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
848 $posy = $pdf->GetY() + 4;
854 if ($object->cond_reglement_code || $object->cond_reglement) {
855 $pdf->SetFont(
'',
'B', $default_font_size - 2);
856 $pdf->SetXY($this->marge_gauche, $posy);
857 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
858 $pdf->MultiCell(43, 4, $titre, 0,
'L');
860 $pdf->SetFont(
'',
'', $default_font_size - 2);
861 $pdf->SetXY($posxval, $posy);
862 $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);
863 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
864 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
866 $posy = $pdf->GetY() + 3;
897 if (!empty($object->date_livraison)) {
898 $outputlangs->load(
"sendings");
899 $pdf->SetFont(
'',
'B', $default_font_size - 2);
900 $pdf->SetXY($this->marge_gauche, $posy);
901 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
902 $pdf->MultiCell(80, 4, $titre, 0,
'L');
903 $pdf->SetFont(
'',
'', $default_font_size - 2);
904 $pdf->SetXY($posxval, $posy);
905 $dlp =
dol_print_date($object->date_livraison,
"daytext",
false, $outputlangs,
true);
906 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
908 $posy = $pdf->GetY() + 1;
909 } elseif ($object->availability_code || $object->availability) {
910 $pdf->SetFont(
'',
'B', $default_font_size - 2);
911 $pdf->SetXY($this->marge_gauche, $posy);
912 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
913 $pdf->MultiCell(80, 4, $titre, 0,
'L');
914 $pdf->SetTextColor(0, 0, 0);
915 $pdf->SetFont(
'',
'', $default_font_size - 2);
916 $pdf->SetXY($posxval, $posy);
917 $lib_availability = $outputlangs->transnoentities(
"AvailabilityType".$object->availability_code) != (
'AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities(
"AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability :
'');
918 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
919 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
921 $posy = $pdf->GetY() + 1;
925 if ($object->mode_reglement_code
926 && $object->mode_reglement_code !=
'CHQ'
927 && $object->mode_reglement_code !=
'VIR') {
928 $pdf->SetFont(
'',
'B', $default_font_size - 2);
929 $pdf->SetXY($this->marge_gauche, $posy);
930 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
931 $pdf->MultiCell(80, 5, $titre, 0,
'L');
933 $pdf->SetFont(
'',
'', $default_font_size - 2);
934 $pdf->SetXY($posxval, $posy);
935 $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);
936 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
938 $posy = $pdf->GetY() + 2;
942 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'CHQ') {
944 if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
945 if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
947 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
949 $pdf->SetXY($this->marge_gauche, $posy);
950 $pdf->SetFont(
'',
'B', $default_font_size - 3);
951 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->proprio), 0,
'L', 0);
952 $posy = $pdf->GetY() + 1;
954 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
955 $pdf->SetXY($this->marge_gauche, $posy);
956 $pdf->SetFont(
'',
'', $default_font_size - 3);
957 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
958 $posy = $pdf->GetY() + 2;
961 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
962 $pdf->SetXY($this->marge_gauche, $posy);
963 $pdf->SetFont(
'',
'B', $default_font_size - 3);
964 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
965 $posy = $pdf->GetY() + 1;
967 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
968 $pdf->SetXY($this->marge_gauche, $posy);
969 $pdf->SetFont(
'',
'', $default_font_size - 3);
970 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
971 $posy = $pdf->GetY() + 2;
978 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'VIR') {
979 if (!empty($object->fk_account) || !empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) {
980 $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
981 if (!empty($object->fk_bank)) $bankid = $object->fk_bank;
983 $account->fetch($bankid);
985 $curx = $this->marge_gauche;
988 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
1010 global $conf, $mysoc;
1016 $pdf->SetFont(
'',
'', $default_font_size - 1);
1019 $col1x = 120; $col2x = 170;
1020 if ($this->page_largeur < 210) {
1023 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
1027 $outputlangsbis =
null;
1028 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
1029 $outputlangsbis =
new Translate(
'', $conf);
1030 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
1031 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
1043 $pdf->SetFillColor(248, 248, 248);
1045 $total_ttc = $object->getValorisationTotale();
1047 $this->atleastoneratenotnull = 0;
1051 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1052 $pdf->SetTextColor(0, 0, 60);
1053 $pdf->SetFillColor(224, 224, 224);
1054 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"Total", $mysoc->country_code) :
''), $useborder,
'L', 1);
1056 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1057 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1059 $pdf->SetTextColor(0, 0, 0);
1061 $creditnoteamount = 0;
1062 $depositsamount = 0;
1066 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1067 if (!empty($object->paye)) $resteapayer = 0;
1069 if ($deja_regle > 0) {
1073 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1074 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L', 0);
1075 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1076 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R', 0);
1079 $pdf->SetTextColor(0, 0, 60);
1080 $pdf->SetFillColor(224, 224, 224);
1081 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1082 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L', 1);
1084 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1085 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
1087 $pdf->SetFont(
'',
'', $default_font_size - 1);
1088 $pdf->SetTextColor(0, 0, 0);
1092 return ($tab2_top + ($tab2_hl * $index));
1109 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
1115 if ($hidetop) $hidetop = -1;
1117 $currency = !empty($currency) ? $currency : $conf->currency;
1121 $pdf->SetTextColor(0, 0, 0);
1122 $pdf->SetFont(
'',
'', $default_font_size - 2);
1124 if (empty($hidetop)) {
1125 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1126 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1127 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1130 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1131 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight,
'F',
null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1135 $pdf->SetDrawColor(128, 128, 128);
1136 $pdf->SetFont(
'',
'', $default_font_size - 1);
1139 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1142 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
1144 if (empty($hidetop)) {
1145 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
1161 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey =
"StockTransferSheetProforma")
1164 global $conf, $langs, $hookmanager;
1167 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1174 if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) {
1175 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
1178 $pdf->SetTextColor(0, 0, 60);
1179 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1181 $posy = $this->marge_haute;
1182 $posx = $this->page_largeur - $this->marge_droite - 100;
1184 $pdf->SetXY($this->marge_gauche, $posy);
1187 if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
1188 if ($this->emetteur->logo) {
1189 $logodir = $conf->mycompany->dir_output;
1190 if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
1191 if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
1192 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1194 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1196 if (is_readable($logo)) {
1198 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1200 $pdf->SetTextColor(200, 0, 0);
1201 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1202 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1203 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1206 $text = $this->emetteur->name;
1207 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1211 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1212 $pdf->SetXY($posx, $posy);
1213 $pdf->SetTextColor(0, 0, 60);
1214 $title = $outputlangs->transnoentities($titlekey);
1215 $pdf->MultiCell(100, 3, $title,
'',
'R');
1217 $pdf->SetFont(
'',
'B', $default_font_size);
1220 $pdf->SetXY($posx, $posy);
1221 $pdf->SetTextColor(0, 0, 60);
1222 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
1225 $pdf->SetFont(
'',
'', $default_font_size - 1);
1228 if (!empty($object->date_prevue_depart)) {
1230 $pdf->SetXY($posx, $posy);
1231 $pdf->SetTextColor(0, 0, 60);
1232 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date($object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1236 if (!empty($object->date_prevue_arrivee)) {
1238 $pdf->SetXY($posx, $posy);
1239 $pdf->SetTextColor(0, 0, 60);
1240 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date($object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1244 if (!empty($object->date_reelle_depart)) {
1246 $pdf->SetXY($posx, $posy);
1247 $pdf->SetTextColor(0, 0, 60);
1248 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date($object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1252 if (!empty($object->date_reelle_arrivee)) {
1254 $pdf->SetXY($posx, $posy);
1255 $pdf->SetTextColor(0, 0, 60);
1256 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date($object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1259 if ($object->ref_client) {
1261 $pdf->SetXY($posx, $posy);
1262 $pdf->SetTextColor(0, 0, 60);
1263 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset($object->ref_client),
'',
'R');
1266 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
1267 $object->fetch_projet();
1268 if (!empty($object->project->ref)) {
1270 $pdf->SetXY($posx, $posy);
1271 $pdf->SetTextColor(0, 0, 60);
1272 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->projet->title),
'',
'R');
1276 if (!empty($conf->global->PDF_SHOW_PROJECT)) {
1277 $object->fetch_projet();
1278 if (!empty($object->project->ref)) {
1280 $pdf->SetXY($posx, $posy);
1281 $pdf->SetTextColor(0, 0, 60);
1282 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->projet->ref),
'',
'R');
1286 if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
1288 $pdf->SetXY($posx, $posy);
1289 $pdf->SetTextColor(0, 0, 60);
1290 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
1294 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1295 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1296 if (count($arrayidcontact) > 0) {
1297 $usertmp =
new User($this->
db);
1298 $usertmp->fetch($arrayidcontact[0]);
1300 $pdf->SetXY($posx, $posy);
1301 $pdf->SetTextColor(0, 0, 60);
1302 $pdf->MultiCell(100, 3, $langs->trans(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1310 $current_y = $pdf->getY();
1311 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1312 if ($current_y < $pdf->getY()) {
1313 $top_shift = $pdf->getY() - $current_y;
1318 $carac_emetteur =
'';
1320 $arrayidcontact = array();
1321 $arrayidcontact = $object->getIdContact(
'external',
'STFROM');
1323 $usecontact =
false;
1324 if (count($arrayidcontact) > 0) {
1328 $result = $object->fetch_contact($arrayidcontact[0]);
1331 if ($usecontact) $thirdparty = $object->contact;
1332 else $thirdparty = $this->emetteur;
1336 if ($usecontact) $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1,
'targetwithdetails', $object);
1337 else $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1340 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1341 $posx = $this->marge_gauche;
1342 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1344 $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
1345 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
1348 $pdf->SetTextColor(0, 0, 0);
1349 $pdf->SetFont(
'',
'', $default_font_size - 2);
1350 $pdf->SetXY($posx, $posy - 5);
1351 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1352 $pdf->SetXY($posx, $posy);
1353 $pdf->SetFillColor(230, 230, 230);
1354 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1355 $pdf->SetTextColor(0, 0, 60);
1356 $pdf->SetFillColor(255, 255, 255);
1359 $pdf->SetXY($posx + 2, $posy + 3);
1360 $pdf->SetFont(
'',
'B', $default_font_size);
1361 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1362 $posy = $pdf->getY();
1365 $pdf->SetXY($posx + 2, $posy);
1366 $pdf->SetFont(
'',
'', $default_font_size - 1);
1367 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1371 $usecontact =
false;
1372 $arrayidcontact = $object->getIdContact(
'external',
'STDEST');
1373 if (count($arrayidcontact) > 0) {
1375 $result = $object->fetch_contact($arrayidcontact[0]);
1381 $thirdparty = $object->contact;
1383 $thirdparty = $object->thirdparty;
1388 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact :
null), $usecontact,
'targetwithdetails', $object);
1391 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
1392 if ($this->page_largeur < 210) $widthrecbox = 84;
1393 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1394 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1395 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1398 $pdf->SetTextColor(0, 0, 0);
1399 $pdf->SetFont(
'',
'', $default_font_size - 2);
1400 $pdf->SetXY($posx + 2, $posy - 5);
1401 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1402 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1405 $pdf->SetXY($posx + 2, $posy + 3);
1406 $pdf->SetFont(
'',
'B', $default_font_size);
1407 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1409 $posy = $pdf->getY();
1412 $pdf->SetFont(
'',
'', $default_font_size - 1);
1413 $pdf->SetXY($posx + 2, $posy);
1414 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1417 $pdf->SetTextColor(0, 0, 0);
1432 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1436 $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1437 return pdf_pagefoot($pdf, $outputlangs,
'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1452 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1454 global $conf, $hookmanager;
1457 $this->defaultContentsFieldsStyle = array(
1459 'padding' => array(1, 0.5, 1, 0.5),
1463 $this->defaultTitlesFieldsStyle = array(
1465 'padding' => array(0.5, 0, 0.5, 0),
1487 $this->cols[
'desc'] = array(
1492 'textkey' =>
'Designation',
1496 'padding' => array(0.5, 1, 0.5, 1.5),
1500 'padding' => array(1, 0.5, 1, 1.5),
1505 $this->cols[
'photo'] = array(
1507 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
1510 'textkey' =>
'Photo',
1514 'padding' => array(0, 0, 0, 0),
1516 'border-left' =>
false,
1519 if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) {
1520 $this->cols[
'photo'][
'status'] =
true;
1525 $this->cols[
'vat'] = array(
1532 'border-left' =>
true,
1541 $this->cols[
'subprice'] = array(
1546 'textkey' =>
'PMPValueShort'
1548 'border-left' =>
true,
1553 $nblines = count($object->lines);
1554 for ($i = 0; $i < $nblines; $i++) {
1556 $tmpwidth = max($tmpwidth, $tmpwidth2);
1558 if ($tmpwidth > 10) {
1559 $this->cols[
'subprice'][
'width'] += (2 * ($tmpwidth - 10));
1563 $this->cols[
'qty'] = array(
1570 'border-left' =>
true,
1574 $this->cols[
'unit'] = array(
1581 'border-left' =>
true,
1583 if ($conf->global->PRODUCT_USE_UNITS) {
1584 $this->cols[
'unit'][
'status'] =
true;
1588 $this->cols[
'discount'] = array(
1593 'textkey' =>
'ReductionShort'
1595 'border-left' =>
true,
1597 if ($this->atleastonediscount) {
1598 $this->cols[
'discount'][
'status'] =
true;
1601 $rank = $rank + 1000;
1602 $this->cols[
'totalexcltax'] = array(
1607 'textkey' =>
'PMPValue'
1609 'border-left' =>
true,
1613 if (!empty($object->lines)) {
1614 $line = reset($object->lines);
1618 $parameters = array(
1619 'object' => $object,
1620 'outputlangs' => $outputlangs,
1621 'hidedetails' => $hidedetails,
1622 'hidedesc' => $hidedesc,
1623 'hideref' => $hideref
1626 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1629 } elseif (empty($reshook)) {
1630 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1632 $this->cols = $hookmanager->resArray;