31 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
32 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
62 public $update_main_doc_field;
73 public $phpmin = array(7, 0);
79 public $version =
'dolibarr';
104 public $marge_droite;
130 global $conf, $langs, $mysoc;
133 $langs->loadLangs(array(
"main",
"bills"));
136 $this->
name =
"cornas";
137 $this->
description = $langs->trans(
'SuppliersCommandModel');
138 $this->update_main_doc_field = 1;
143 $this->page_largeur = $formatarray[
'width'];
144 $this->page_hauteur = $formatarray[
'height'];
145 $this->format = array($this->page_largeur, $this->page_hauteur);
151 $this->option_logo = 1;
152 $this->option_tva = 1;
153 $this->option_modereg = 1;
154 $this->option_condreg = 1;
155 $this->option_multilang = 1;
156 $this->option_escompte = 0;
157 $this->option_credit_note = 0;
158 $this->option_freetext = 1;
159 $this->option_draft_watermark = 1;
162 $this->emetteur = $mysoc;
163 if (empty($this->emetteur->country_code)) {
164 $this->emetteur->country_code = substr($langs->defaultlang, -2);
168 $this->posxdesc = $this->marge_gauche + 1;
170 $this->tva = array();
171 $this->tva_array = array();
172 $this->localtax1 = array();
173 $this->localtax2 = array();
174 $this->atleastoneratenotnull = 0;
175 $this->atleastonediscount = 0;
191 public function write_file($object, $outputlangs =
'', $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
194 global $user, $langs, $conf, $hookmanager, $mysoc, $nblines;
196 if (!is_object($outputlangs)) {
197 $outputlangs = $langs;
200 if (!empty($conf->global->MAIN_USE_FPDF)) {
201 $outputlangs->charset_output =
'ISO-8859-1';
205 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"dict",
"products"));
207 global $outputlangsbis;
208 $outputlangsbis =
null;
209 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
210 $outputlangsbis =
new Translate(
'', $conf);
211 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
212 $outputlangsbis->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"dict",
"products"));
215 $nblines = count($object->lines);
218 if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
219 $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
223 $realpatharray = array();
224 if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) {
225 for ($i = 0; $i < $nblines; $i++) {
226 if (empty($object->lines[$i]->fk_product)) {
231 $objphoto->fetch($object->lines[$i]->fk_product);
234 $pdir =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
235 $dir = $conf->product->dir_output.
'/'.$pdir;
237 $pdir =
get_exdir($objphoto->id, 0, 0, 0, $objphoto,
'product');
238 $dir = $conf->product->dir_output.
'/'.$pdir;
242 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
244 if ($obj[
'photo_vignette']) {
245 $filename = $obj[
'photo_vignette'];
247 $filename = $obj[
'photo'];
250 $filename = $obj[
'photo'];
252 $realpath = $dir.$filename;
257 $realpatharray[$i] = $realpath;
261 if (count($realpatharray) == 0) {
262 $this->posxpicture = $this->posxtva;
265 if ($conf->fournisseur->commande->dir_output) {
266 $object->fetch_thirdparty();
269 $amount_credit_notes_included = 0;
270 $amount_deposits_included = 0;
275 if ($object->specimen) {
276 $dir = $conf->fournisseur->commande->dir_output;
277 $file = $dir.
"/SPECIMEN.pdf";
281 $dir = $conf->fournisseur->commande->dir_output.
'/'.$objectref;
282 $file = $dir.
"/".$objectref.
".pdf";
283 if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) {
284 $file = $dir.
"/".$objectref.($objectrefsupplier ?
"_".$objectrefsupplier :
"").
".pdf";
288 if (!file_exists($dir)) {
290 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
295 if (file_exists($dir)) {
297 if (!is_object($hookmanager)) {
298 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
301 $hookmanager->initHooks(array(
'pdfgeneration'));
302 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
304 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
306 $nblines = count($object->lines);
310 $heightforinfotot = 50;
311 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
312 $heightforfooter = $this->marge_basse + 8;
313 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
314 $heightforfooter += 6;
316 $pdf->SetAutoPageBreak(1, 0);
318 if (class_exists(
'TCPDF')) {
319 $pdf->setPrintHeader(
false);
320 $pdf->setPrintFooter(
false);
324 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
325 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
326 $tplidx = $pdf->importPage(1);
331 $pdf->SetDrawColor(128, 128, 128);
333 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
334 $pdf->SetSubject($outputlangs->transnoentities(
"Order"));
335 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
336 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
337 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Order").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
339 $pdf->SetCompression(
false);
342 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
345 foreach ($object->lines as $line) {
346 if ($line->remise_percent) {
347 $this->atleastonediscount =
true;
354 if (!empty($tplidx)) {
355 $pdf->useTemplate($tplidx);
358 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
359 $pdf->SetFont(
'',
'', $default_font_size - 1);
360 $pdf->MultiCell(0, 3,
'');
361 $pdf->SetTextColor(0, 0, 0);
363 $tab_top = 90 + $top_shift;
364 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
366 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
370 $desc_incoterms = $object->getIncotermsForPDF();
371 if ($desc_incoterms) {
374 $pdf->SetFont(
'',
'', $default_font_size - 1);
375 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
376 $nexY = $pdf->GetY();
377 $height_incoterms = $nexY - $tab_top;
380 $pdf->SetDrawColor(192, 192, 192);
381 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
383 $tab_top = $nexY + 6;
388 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
391 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
392 if (!empty($extranote)) {
396 $pagenb = $pdf->getPage();
398 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
399 $pageposbeforenote = $pagenb;
408 $pdf->startTransaction();
410 $pdf->SetFont(
'',
'', $default_font_size - 1);
411 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
413 $pageposafternote = $pdf->getPage();
414 $posyafter = $pdf->GetY();
416 if ($pageposafternote > $pageposbeforenote) {
417 $pdf->rollbackTransaction(
true);
420 while ($pagenb < $pageposafternote) {
423 if (!empty($tplidx)) {
424 $pdf->useTemplate($tplidx);
427 $this->
_pagehead($pdf, $object, 0, $outputlangs);
430 $pdf->setTopMargin($tab_top_newpage);
432 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
436 $pdf->setPage($pageposbeforenote);
437 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
438 $pdf->SetFont(
'',
'', $default_font_size - 1);
439 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
440 $pageposafternote = $pdf->getPage();
442 $posyafter = $pdf->GetY();
444 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
445 $pdf->AddPage(
'',
'',
true);
448 $pdf->setPage($pageposafternote);
449 $pdf->setTopMargin($tab_top_newpage);
451 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
457 $i = $pageposbeforenote;
458 while ($i < $pageposafternote) {
462 $pdf->SetDrawColor(128, 128, 128);
464 if ($i > $pageposbeforenote) {
465 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
466 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
468 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
469 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
473 $pdf->setPageOrientation(
'', 1, 0);
474 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
480 $pdf->setPage($pageposafternote);
481 if (!empty($tplidx)) {
482 $pdf->useTemplate($tplidx);
485 $this->
_pagehead($pdf, $object, 0, $outputlangs);
487 $height_note = $posyafter - $tab_top_newpage;
488 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
491 $pdf->commitTransaction();
492 $posyafter = $pdf->GetY();
493 $height_note = $posyafter - $tab_top;
494 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
497 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
499 $pdf->AddPage(
'',
'',
true);
502 $pdf->setPage($pageposafternote);
503 if (!empty($tplidx)) {
504 $pdf->useTemplate($tplidx);
507 $this->
_pagehead($pdf, $object, 0, $outputlangs);
510 $posyafter = $tab_top_newpage;
514 $tab_height = $tab_height - $height_note;
515 $tab_top = $posyafter + 6;
520 $nexY = $tab_top + 5;
526 $pageposbeforeprintlines = $pdf->getPage();
527 $pagenb = $pageposbeforeprintlines;
528 for ($i = 0; $i < $nblines; $i++) {
530 $pdf->SetFont(
'',
'', $default_font_size - 1);
531 $pdf->SetTextColor(0, 0, 0);
534 $imglinesize = array();
535 if (!empty($realpatharray[$i])) {
539 $pdf->setTopMargin($tab_top_newpage);
540 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
541 $pageposbefore = $pdf->getPage();
543 $showpricebeforepagebreak = 1;
545 $posYAfterDescription = 0;
550 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
551 $pdf->AddPage(
'',
'',
true);
552 if (!empty($tplidx)) {
553 $pdf->useTemplate($tplidx);
555 $pdf->setPage($pageposbefore + 1);
557 $curY = $tab_top_newpage;
560 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
561 $showpricebeforepagebreak = 1;
563 $showpricebeforepagebreak = 0;
567 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
568 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
570 $posYAfterImage = $curY + $imglinesize[
'height'];
574 $curX = $this->posxdesc - 1;
575 $showpricebeforepagebreak = 1;
578 $pdf->startTransaction();
579 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
581 $pageposafter = $pdf->getPage();
582 if ($pageposafter > $pageposbefore) {
583 $pdf->rollbackTransaction(
true);
585 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
587 $pageposafter = $pdf->getPage();
588 $posyafter = $pdf->GetY();
589 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
590 if ($i == ($nblines - 1)) {
591 $pdf->AddPage(
'',
'',
true);
592 if (!empty($tplidx)) {
593 $pdf->useTemplate($tplidx);
596 $pdf->setPage($pageposafter + 1);
601 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
602 $showpricebeforepagebreak = 1;
604 $showpricebeforepagebreak = 0;
609 $pdf->commitTransaction();
611 $posYAfterDescription = $pdf->GetY();
614 $nexY = $pdf->GetY();
615 $pageposafter = $pdf->getPage();
616 $pdf->setPage($pageposbefore);
617 $pdf->setTopMargin($this->marge_haute);
618 $pdf->setPageOrientation(
'', 1, 0);
621 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
622 $pdf->setPage($pageposafter);
623 $curY = $tab_top_newpage;
626 $pdf->SetFont(
'',
'', $default_font_size - 1);
632 $nexY = max($pdf->GetY(), $nexY);
639 $nexY = max($pdf->GetY(), $nexY);
647 $nexY = max($pdf->GetY(), $nexY);
653 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
655 $nexY = max($pdf->GetY(), $nexY);
659 if ($this->
getColumnStatus(
'discount') && $object->lines[$i]->remise_percent) {
662 $nexY = max($pdf->GetY(), $nexY);
669 $nexY = max($pdf->GetY(), $nexY);
673 if (!empty($object->lines[$i]->array_options)) {
674 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
676 $extrafieldValue = $this->
getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
678 $nexY = max($pdf->GetY(), $nexY);
689 'outputlangs' => $outputlangs,
690 'hidedetails' => $hidedetails
692 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
696 if (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) {
697 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
699 $tvaligne = $object->lines[$i]->total_tva;
702 $localtax1ligne = $object->lines[$i]->total_localtax1;
703 $localtax2ligne = $object->lines[$i]->total_localtax2;
704 $localtax1_rate = $object->lines[$i]->localtax1_tx;
705 $localtax2_rate = $object->lines[$i]->localtax2_tx;
706 $localtax1_type = $object->lines[$i]->localtax1_type;
707 $localtax2_type = $object->lines[$i]->localtax2_type;
709 if (!empty($object->remise_percent)) {
710 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
712 if (!empty($object->remise_percent)) {
713 $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
715 if (!empty($object->remise_percent)) {
716 $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
719 $vatrate = (string) $object->lines[$i]->tva_tx;
722 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
723 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
725 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
726 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
730 if ($localtax1_type && $localtax1ligne != 0) {
731 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
733 if ($localtax2_type && $localtax2ligne != 0) {
734 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
737 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
742 if (!isset($this->tva[$vatrate])) {
743 $this->tva[$vatrate] = 0;
745 $this->tva[$vatrate] += $tvaligne;
746 $vatcode = $object->lines[$i]->vat_src_code;
747 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
748 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
750 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate'=>$vatrate,
'vatcode'=>$vatcode,
'amount'=> $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
752 if ($posYAfterImage > $posYAfterDescription) {
753 $nexY = $posYAfterImage;
757 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
758 $pdf->setPage($pageposafter);
759 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
761 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
762 $pdf->SetLineStyle(array(
'dash'=>0));
766 while ($pagenb < $pageposafter) {
767 $pdf->setPage($pagenb);
768 if ($pagenb == $pageposbeforeprintlines) {
769 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
771 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
773 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
775 $pdf->setPage($pagenb);
776 $pdf->setPageOrientation(
'', 1, 0);
778 $this->
_pagehead($pdf, $object, 0, $outputlangs);
780 if (!empty($tplidx)) {
781 $pdf->useTemplate($tplidx);
784 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
785 if ($pagenb == $pageposafter) {
786 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
788 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
790 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
793 if (!empty($tplidx)) {
794 $pdf->useTemplate($tplidx);
798 $this->
_pagehead($pdf, $object, 0, $outputlangs);
804 if ($pagenb == $pageposbeforeprintlines) {
805 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
806 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
808 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
809 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
813 $posy = $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
816 $posy = $this->
_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
819 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) {
824 $this->
_pagefoot($pdf, $object, $outputlangs);
825 if (method_exists($pdf,
'AliasNbPages')) {
826 $pdf->AliasNbPages();
831 $pdf->Output($file,
'F');
834 $hookmanager->initHooks(array(
'pdfgeneration'));
835 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
837 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
839 $this->error = $hookmanager->error;
840 $this->errors = $hookmanager->errors;
845 $this->result = array(
'fullpath'=>$file);
849 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
853 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
888 global $conf, $mysoc;
892 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
893 $pdf->SetFont(
'',
'B', $default_font_size - 2);
894 $pdf->SetXY($this->marge_gauche, $posy);
895 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
897 $posy = $pdf->GetY() + 4;
903 if (!empty($object->cond_reglement_code) || $object->cond_reglement) {
904 $pdf->SetFont(
'',
'B', $default_font_size - 2);
905 $pdf->SetXY($this->marge_gauche, $posy);
906 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
907 $pdf->MultiCell(80, 4, $titre, 0,
'L');
909 $pdf->SetFont(
'',
'', $default_font_size - 2);
910 $pdf->SetXY($posxval, $posy);
911 $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);
912 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
913 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0,
'L');
915 $posy = $pdf->GetY() + 3;
919 if (!empty($object->mode_reglement_code)) {
920 $pdf->SetFont(
'',
'B', $default_font_size - 2);
921 $pdf->SetXY($this->marge_gauche, $posy);
922 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
923 $pdf->MultiCell(80, 5, $titre, 0,
'L');
925 $pdf->SetFont(
'',
'', $default_font_size - 2);
926 $pdf->SetXY($posxval, $posy);
927 $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);
928 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
930 $posy = $pdf->GetY() + 2;
949 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
952 global $conf, $mysoc;
958 $pdf->SetFont(
'',
'', $default_font_size - 1);
963 if ($this->page_largeur < 210) {
966 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
972 $pdf->SetFillColor(255, 255, 255);
973 $pdf->SetXY($col1x, $tab2_top);
974 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
976 $total_ht = ((
isModEnabled(
"multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
977 $pdf->SetXY($col2x, $tab2_top);
978 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0,
'R', 1);
981 $pdf->SetFillColor(248, 248, 248);
983 $this->atleastoneratenotnull = 0;
984 foreach ($this->tva as $tvakey => $tvaval) {
986 $this->atleastoneratenotnull++;
989 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
993 if (preg_match(
'/\*/', $tvakey)) {
994 $tvakey = str_replace(
'*',
'', $tvakey);
995 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
998 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
999 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
1000 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1002 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1003 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R', 1);
1006 if (!$this->atleastoneratenotnull) {
1008 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1009 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code), 0,
'L', 1);
1011 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1012 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_tva), 0,
'R', 1);
1015 if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION ==
'localtax1on' && $object->total_localtax1 > 0) {
1017 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1018 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code), 0,
'L', 1);
1019 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1020 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax1), $useborder,
'R', 1);
1024 if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION ==
'localtax2on' && $object->total_localtax2 > 0) {
1026 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1027 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code), 0,
'L', 1);
1028 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1029 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax2), $useborder,
'R', 1);
1035 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1036 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1040 foreach ($localtax_rate as $tvakey => $tvaval) {
1045 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1048 if (preg_match(
'/\*/', $tvakey)) {
1049 $tvakey = str_replace(
'*',
'', $tvakey);
1050 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1052 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
1053 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1054 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1056 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1057 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1065 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1066 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1070 foreach ($localtax_rate as $tvakey => $tvaval) {
1075 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1078 if (preg_match(
'/\*/', $tvakey)) {
1079 $tvakey = str_replace(
'*',
'', $tvakey);
1080 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1082 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
1083 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1084 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1086 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1087 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R', 1);
1095 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1096 $pdf->SetTextColor(0, 0, 60);
1097 $pdf->SetFillColor(224, 224, 224);
1098 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
1100 $total_ttc = (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
1101 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1102 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc), $useborder,
'R', 1);
1103 $pdf->SetFont(
'',
'', $default_font_size - 1);
1104 $pdf->SetTextColor(0, 0, 0);
1106 $creditnoteamount = 0;
1107 $depositsamount = 0;
1111 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1112 if (!empty($object->paye)) {
1116 if ($deja_regle > 0) {
1120 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1121 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L', 0);
1122 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1123 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle), 0,
'R', 0);
1126 $pdf->SetTextColor(0, 0, 60);
1127 $pdf->SetFillColor(224, 224, 224);
1128 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1129 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L', 1);
1131 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1132 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer), $useborder,
'R', 1);
1134 $pdf->SetFont(
'',
'', $default_font_size - 1);
1135 $pdf->SetTextColor(0, 0, 0);
1139 return ($tab2_top + ($tab2_hl * $index));
1156 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
1166 $currency = !empty($currency) ? $currency : $conf->currency;
1170 $pdf->SetTextColor(0, 0, 0);
1171 $pdf->SetFont(
'',
'', $default_font_size - 2);
1173 if (empty($hidetop)) {
1174 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1175 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1176 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1179 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1180 $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));
1184 $pdf->SetDrawColor(128, 128, 128);
1185 $pdf->SetFont(
'',
'', $default_font_size - 1);
1188 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1190 foreach ($this->cols as $colKey => $colDef) {
1196 $colDef[
'title'][
'label'] = !empty($colDef[
'title'][
'label']) ? $colDef[
'title'][
'label'] : $outputlangs->transnoentities($colDef[
'title'][
'textkey']);
1199 if (!empty($colDef[
'border-left'])) {
1200 $pdf->line($colDef[
'xStartPos'], $tab_top, $colDef[
'xStartPos'], $tab_top + $tab_height);
1203 if (empty($hidetop)) {
1204 $pdf->SetXY($colDef[
'xStartPos'] + $colDef[
'title'][
'padding'][3], $tab_top + $colDef[
'title'][
'padding'][0]);
1206 $textWidth = $colDef[
'width'] - $colDef[
'title'][
'padding'][3] - $colDef[
'title'][
'padding'][1];
1207 $pdf->MultiCell($textWidth, 2, $colDef[
'title'][
'label'],
'', $colDef[
'title'][
'align']);
1211 if (empty($hidetop)) {
1212 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1226 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1228 global $langs, $conf, $mysoc;
1230 $ltrdirection =
'L';
1231 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') $ltrdirection =
'R';
1234 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"sendings"));
1248 $pdf->SetTextColor(0, 0, 60);
1249 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1251 $posx = $this->page_largeur - $this->marge_droite - 100;
1252 $posy = $this->marge_haute;
1254 $pdf->SetXY($this->marge_gauche, $posy);
1258 if ($this->emetteur->logo) {
1259 $logodir = $conf->mycompany->dir_output;
1260 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1261 $logodir = $conf->mycompany->multidir_output[$object->entity];
1264 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1266 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1268 if (is_readable($logo)) {
1270 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1272 $pdf->SetTextColor(200, 0, 0);
1273 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1274 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1275 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1278 $text = $this->emetteur->name;
1279 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1283 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1284 $pdf->SetXY($posx, $posy);
1285 $pdf->SetTextColor(0, 0, 60);
1286 $title = $outputlangs->transnoentities(
"SupplierOrder").
" ".$outputlangs->convToOutputCharset($object->ref);
1287 $pdf->MultiCell(100, 3, $title,
'',
'R');
1290 if ($object->ref_supplier) {
1292 $pdf->SetFont(
'',
'B', $default_font_size);
1293 $pdf->SetXY($posx, $posy);
1294 $pdf->SetTextColor(0, 0, 60);
1295 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefSupplier").
" : ".$outputlangs->convToOutputCharset($object->ref_supplier),
'',
'R');
1299 $pdf->SetFont(
'',
'', $default_font_size - 1);
1301 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
1302 $object->fetch_projet();
1303 if (!empty($object->project->ref)) {
1305 $pdf->SetXY($posx, $posy);
1306 $pdf->SetTextColor(0, 0, 60);
1307 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->project->title),
'',
'R');
1311 if (!empty($conf->global->PDF_SHOW_PROJECT)) {
1312 $object->fetch_projet();
1313 if (!empty($object->project->ref)) {
1314 $outputlangs->load(
"projects");
1316 $pdf->SetXY($posx, $posy);
1317 $langs->load(
"projects");
1318 $pdf->SetTextColor(0, 0, 60);
1319 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
1323 if (!empty($object->date_commande)) {
1325 $pdf->SetXY($posx, $posy);
1326 $pdf->SetTextColor(0, 0, 60);
1327 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($object->date_commande,
"day",
false, $outputlangs,
true),
'',
'R');
1330 $pdf->SetXY($posx, $posy);
1331 $pdf->SetTextColor(255, 0, 0);
1332 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"OrderToProcess"),
'',
'R');
1335 $pdf->SetTextColor(0, 0, 60);
1336 $usehourmin =
'day';
1337 if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) {
1338 $usehourmin =
'dayhour';
1340 if (!empty($object->delivery_date)) {
1342 $pdf->SetXY($posx - 90, $posy);
1343 $pdf->MultiCell(190, 3, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date($object->delivery_date, $usehourmin,
false, $outputlangs,
true),
'',
'R');
1346 if ($object->thirdparty->code_fournisseur) {
1348 $pdf->SetXY($posx, $posy);
1349 $pdf->SetTextColor(0, 0, 60);
1350 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
1354 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1355 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1356 if (count($arrayidcontact) > 0) {
1357 $usertmp =
new User($this->
db);
1358 $usertmp->fetch($arrayidcontact[0]);
1360 $pdf->SetXY($posx, $posy);
1361 $pdf->SetTextColor(0, 0, 60);
1362 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1367 $pdf->SetTextColor(0, 0, 60);
1371 $current_y = $pdf->getY();
1372 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1373 if ($current_y < $pdf->getY()) {
1374 $top_shift = $pdf->getY() - $current_y;
1379 $carac_emetteur =
'';
1381 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1382 if (count($arrayidcontact) > 0) {
1383 $object->fetch_user($arrayidcontact[0]);
1384 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1387 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1390 $posy = 42 + $top_shift;
1391 $posx = $this->marge_gauche;
1392 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1393 $posx = $this->page_largeur - $this->marge_droite - 80;
1398 $pdf->SetTextColor(0, 0, 0);
1399 $pdf->SetFont(
'',
'', $default_font_size - 2);
1400 $pdf->SetXY($posx, $posy - 5);
1401 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1402 $pdf->SetXY($posx, $posy);
1403 $pdf->SetFillColor(230, 230, 230);
1404 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1405 $pdf->SetTextColor(0, 0, 60);
1408 $pdf->SetXY($posx + 2, $posy + 3);
1409 $pdf->SetFont(
'',
'B', $default_font_size);
1410 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1411 $posy = $pdf->getY();
1414 $pdf->SetXY($posx + 2, $posy);
1415 $pdf->SetFont(
'',
'', $default_font_size - 1);
1416 $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
1421 $usecontact =
false;
1422 $arrayidcontact = $object->getIdContact(
'external',
'CUSTOMER');
1423 if (count($arrayidcontact) > 0) {
1425 $result = $object->fetch_contact($arrayidcontact[0]);
1429 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1430 $thirdparty = $object->contact;
1432 $thirdparty = $object->thirdparty;
1437 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
1441 if ($this->page_largeur < 210) {
1444 $posy = 42 + $top_shift;
1445 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1446 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1447 $posx = $this->marge_gauche;
1451 $pdf->SetTextColor(0, 0, 0);
1452 $pdf->SetFont(
'',
'', $default_font_size - 2);
1453 $pdf->SetXY($posx + 2, $posy - 5);
1454 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1455 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1458 $pdf->SetXY($posx + 2, $posy + 3);
1459 $pdf->SetFont(
'',
'B', $default_font_size);
1460 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
1462 $posy = $pdf->getY();
1465 $pdf->SetFont(
'',
'', $default_font_size - 1);
1466 $pdf->SetXY($posx + 2, $posy);
1467 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1483 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1485 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1486 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1501 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1503 global $conf, $hookmanager;
1506 $this->defaultContentsFieldsStyle = array(
1508 'padding' => array(1, 0.5, 1, 0.5),
1512 $this->defaultTitlesFieldsStyle = array(
1514 'padding' => array(0.5, 0, 0.5, 0),
1536 $this->cols[
'desc'] = array(
1541 'textkey' =>
'Designation',
1545 'padding' => array(0.5, 1, 0.5, 1.5),
1549 'padding' => array(1, 0.5, 1, 1.5),
1554 $this->cols[
'photo'] = array(
1556 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
1559 'textkey' =>
'Photo',
1563 'padding' => array(0, 0, 0, 0),
1565 'border-left' =>
false,
1568 if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) {
1569 $this->cols[
'photo'][
'status'] =
true;
1574 $this->cols[
'vat'] = array(
1581 'border-left' =>
true,
1584 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
1585 $this->cols[
'vat'][
'status'] =
true;
1589 $this->cols[
'subprice'] = array(
1594 'textkey' =>
'PriceUHT'
1596 'border-left' =>
true,
1599 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) {
1600 $this->cols[
'subprice'][
'status'] =
true;
1604 $this->cols[
'qty'] = array(
1611 'border-left' =>
true,
1615 $this->cols[
'unit'] = array(
1622 'border-left' =>
true,
1625 $this->cols[
'unit'][
'status'] =
true;
1629 $this->cols[
'discount'] = array(
1634 'textkey' =>
'ReductionShort'
1636 'border-left' =>
true,
1638 if ($this->atleastonediscount) {
1639 $this->cols[
'discount'][
'status'] =
true;
1642 $rank = $rank + 1000;
1643 $this->cols[
'totalexcltax'] = array(
1648 'textkey' =>
'TotalHT'
1650 'border-left' =>
true,
1653 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) {
1654 $this->cols[
'totalexcltax'][
'status'] =
true;
1658 if (!empty($object->lines)) {
1659 $line = reset($object->lines);
1663 $parameters = array(
1664 'object' => $object,
1665 'outputlangs' => $outputlangs,
1666 'hidedetails' => $hidedetails,
1667 'hidedesc' => $hidedesc,
1668 'hideref' => $hideref
1671 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1674 } elseif (empty($reshook)) {
1675 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1677 $this->cols = $hookmanager->resArray;