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(7, 0);
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);
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);
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) {
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));
330 $pdf->SetCompression(
false);
333 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
336 foreach ($object->lines as $line) {
337 if ($line->remise_percent) {
338 $this->atleastonediscount =
true;
346 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
348 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
349 $pdf->SetFont(
'',
'', $default_font_size - 1);
350 $pdf->MultiCell(0, 3,
'');
351 $pdf->SetTextColor(0, 0, 0);
354 $tab_top = 90 + $top_shift;
355 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
358 if ($conf->incoterm->enabled) {
359 $desc_incoterms = $object->getIncotermsForPDF();
360 if ($desc_incoterms) {
363 $pdf->SetFont(
'',
'', $default_font_size - 1);
364 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
365 $nexY = $pdf->GetY();
366 $height_incoterms = $nexY - $tab_top;
369 $pdf->SetDrawColor(192, 192, 192);
370 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
372 $tab_top = $nexY + 6;
377 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
378 if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
380 if (is_object($object->thirdparty)) {
381 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
382 $salerepobj =
new User($this->
db);
383 $salerepobj->fetch($salereparray[0][
'id']);
384 if (!empty($salerepobj->signature)) $notetoshow =
dol_concatdesc($notetoshow, $salerepobj->signature);
389 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
390 if (!empty($extranote)) {
394 $pagenb = $pdf->getPage();
396 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
397 $pageposbeforenote = $pagenb;
406 $pdf->startTransaction();
408 $pdf->SetFont(
'',
'', $default_font_size - 1);
409 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
411 $pageposafternote = $pdf->getPage();
412 $posyafter = $pdf->GetY();
414 if ($pageposafternote > $pageposbeforenote) {
415 $pdf->rollbackTransaction(
true);
418 while ($pagenb < $pageposafternote) {
421 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
424 $pdf->setTopMargin($tab_top_newpage);
426 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
430 $pdf->setPage($pageposbeforenote);
431 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
432 $pdf->SetFont(
'',
'', $default_font_size - 1);
433 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
434 $pageposafternote = $pdf->getPage();
436 $posyafter = $pdf->GetY();
438 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
439 $pdf->AddPage(
'',
'',
true);
442 $pdf->setPage($pageposafternote);
443 $pdf->setTopMargin($tab_top_newpage);
445 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
451 $i = $pageposbeforenote;
452 while ($i < $pageposafternote) {
456 $pdf->SetDrawColor(128, 128, 128);
458 if ($i > $pageposbeforenote) {
459 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
460 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
462 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
463 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
467 $pdf->setPageOrientation(
'', 1, 0);
468 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
474 $pdf->setPage($pageposafternote);
475 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
477 $height_note = $posyafter - $tab_top_newpage;
478 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
481 $pdf->commitTransaction();
482 $posyafter = $pdf->GetY();
483 $height_note = $posyafter - $tab_top;
484 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
487 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
489 $pdf->AddPage(
'',
'',
true);
492 $pdf->setPage($pageposafternote);
493 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
496 $posyafter = $tab_top_newpage;
500 $tab_height = $tab_height - $height_note;
501 $tab_top = $posyafter + 6;
511 $pdf->startTransaction();
512 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
513 $pdf->rollbackTransaction(
true);
515 $nexY = $tab_top + $this->tabTitleHeight;
518 $pageposbeforeprintlines = $pdf->getPage();
519 $pagenb = $pageposbeforeprintlines;
520 for ($i = 0; $i < $nblines; $i++) {
522 $pdf->SetFont(
'',
'', $default_font_size - 1);
523 $pdf->SetTextColor(0, 0, 0);
526 $imglinesize = array();
529 $pdf->setTopMargin($tab_top_newpage);
530 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
531 $pageposbefore = $pdf->getPage();
534 $showpricebeforepagebreak = 1;
539 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
540 $pdf->AddPage(
'',
'',
true);
541 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
542 $pdf->setPage($pageposbefore + 1);
544 $curY = $tab_top_newpage;
547 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
548 $showpricebeforepagebreak = 1;
549 else $showpricebeforepagebreak = 0;
552 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
553 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
555 $posYAfterImage = $curY + $imglinesize[
'height'];
560 $pdf->startTransaction();
562 if (method_exists($object->lines[$i],
'fetch_product')) {
563 $object->lines[$i]->fetch_product();
564 $object->lines[$i]->label = $object->lines[$i]->product->label;
565 $object->lines[$i]->description = $object->lines[$i]->product->description;
566 $object->lines[$i]->fk_unit = $object->lines[$i]->product->fk_unit;
569 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
571 $pageposafter = $pdf->getPage();
572 if ($pageposafter > $pageposbefore) {
573 $pdf->rollbackTransaction(
true);
574 $pageposafter = $pageposbefore;
576 $pdf->setPageOrientation(
'', 1, $heightforfooter);
578 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
579 $pageposafter = $pdf->getPage();
580 $posyafter = $pdf->GetY();
581 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
582 if ($i == ($nblines - 1)) {
583 $pdf->AddPage(
'',
'',
true);
584 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
586 $pdf->setPage($pageposafter + 1);
591 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
592 $showpricebeforepagebreak = 1;
593 else $showpricebeforepagebreak = 0;
597 $pdf->commitTransaction();
603 $nexY = max($pdf->GetY(), $posYAfterImage);
606 $pageposafter = $pdf->getPage();
608 $pdf->setPage($pageposbefore);
609 $pdf->setTopMargin($this->marge_haute);
610 $pdf->setPageOrientation(
'', 1, 0);
613 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
614 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
617 $pdf->SetFont(
'',
'', $default_font_size - 1);
623 $nexY = max($pdf->GetY(), $nexY);
628 $pmp = $object->lines[$i]->pmp;
630 $nexY = max($pdf->GetY(), $nexY);
638 $nexY = max($pdf->GetY(), $nexY);
644 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
646 $nexY = max($pdf->GetY(), $nexY);
650 if ($this->
getColumnStatus(
'discount') && $object->lines[$i]->remise_percent) {
653 $nexY = max($pdf->GetY(), $nexY);
658 $pmp_qty = $pmp * $object->lines[$i]->qty;
660 $nexY = max($pdf->GetY(), $nexY);
664 if (!empty($object->lines[$i]->array_options)) {
665 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
669 $nexY = max($pdf->GetY(), $nexY);
680 'outputlangs' => $outputlangs,
681 'hidedetails' => $hidedetails
683 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
687 if (
isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
688 else $tvaligne = $object->lines[$i]->total_tva;
690 $localtax1ligne = $object->lines[$i]->total_localtax1;
691 $localtax2ligne = $object->lines[$i]->total_localtax2;
692 $localtax1_rate = $object->lines[$i]->localtax1_tx;
693 $localtax2_rate = $object->lines[$i]->localtax2_tx;
694 $localtax1_type = $object->lines[$i]->localtax1_type;
695 $localtax2_type = $object->lines[$i]->localtax2_type;
697 if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
698 if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
699 if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
701 $vatrate = (string) $object->lines[$i]->tva_tx;
704 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
705 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
707 $localtax1_type = $localtaxtmp_array[0];
708 $localtax2_type = $localtaxtmp_array[2];
712 if ($localtax1_type && $localtax1ligne != 0)
713 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
714 if ($localtax2_type && $localtax2ligne != 0)
715 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
717 if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .=
'*';
718 if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0;
719 $this->tva[$vatrate] += $tvaligne;
722 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
723 $pdf->setPage($pageposafter);
724 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
726 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
727 $pdf->SetLineStyle(array(
'dash'=>0));
732 while ($pagenb < $pageposafter) {
733 $pdf->setPage($pagenb);
734 if ($pagenb == $pageposbeforeprintlines) {
735 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
737 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
739 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
741 $pdf->setPage($pagenb);
742 $pdf->setPageOrientation(
'', 1, 0);
745 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
746 if ($pagenb == $pageposafter) {
747 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code);
749 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
751 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
754 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
761 if ($pagenb == $pageposbeforeprintlines)
762 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
763 else $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
764 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
771 $posy = $this->
drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
782 $this->
_pagefoot($pdf, $object, $outputlangs);
783 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
787 $pdf->Output($file,
'F');
790 $hookmanager->initHooks(array(
'pdfgeneration'));
791 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
793 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
795 $this->error = $hookmanager->error;
796 $this->errors = $hookmanager->errors;
799 if (!empty($conf->global->MAIN_UMASK))
800 @chmod($file, octdec($conf->global->MAIN_UMASK));
802 $this->result = array(
'fullpath'=>$file);
806 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
810 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"STOCKTRANSFER_OUTPUTDIR");
839 global $conf, $mysoc;
842 $pdf->SetFont(
'',
'', $default_font_size - 1);
845 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
846 $pdf->SetFont(
'',
'B', $default_font_size - 2);
847 $pdf->SetXY($this->marge_gauche, $posy);
848 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
850 $posy = $pdf->GetY() + 4;
856 if ($object->cond_reglement_code || $object->cond_reglement) {
857 $pdf->SetFont(
'',
'B', $default_font_size - 2);
858 $pdf->SetXY($this->marge_gauche, $posy);
859 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
860 $pdf->MultiCell(43, 4, $titre, 0,
'L');
862 $pdf->SetFont(
'',
'', $default_font_size - 2);
863 $pdf->SetXY($posxval, $posy);
864 $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);
865 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
866 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0,
'L');
868 $posy = $pdf->GetY() + 3;
899 if (!empty($object->date_livraison)) {
900 $outputlangs->load(
"sendings");
901 $pdf->SetFont(
'',
'B', $default_font_size - 2);
902 $pdf->SetXY($this->marge_gauche, $posy);
903 $titre = $outputlangs->transnoentities(
"DateDeliveryPlanned").
':';
904 $pdf->MultiCell(80, 4, $titre, 0,
'L');
905 $pdf->SetFont(
'',
'', $default_font_size - 2);
906 $pdf->SetXY($posxval, $posy);
907 $dlp =
dol_print_date($object->date_livraison,
"daytext",
false, $outputlangs,
true);
908 $pdf->MultiCell(80, 4, $dlp, 0,
'L');
910 $posy = $pdf->GetY() + 1;
911 } elseif ($object->availability_code || $object->availability) {
912 $pdf->SetFont(
'',
'B', $default_font_size - 2);
913 $pdf->SetXY($this->marge_gauche, $posy);
914 $titre = $outputlangs->transnoentities(
"AvailabilityPeriod").
':';
915 $pdf->MultiCell(80, 4, $titre, 0,
'L');
916 $pdf->SetTextColor(0, 0, 0);
917 $pdf->SetFont(
'',
'', $default_font_size - 2);
918 $pdf->SetXY($posxval, $posy);
919 $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 :
'');
920 $lib_availability = str_replace(
'\n',
"\n", $lib_availability);
921 $pdf->MultiCell(80, 4, $lib_availability, 0,
'L');
923 $posy = $pdf->GetY() + 1;
927 if ($object->mode_reglement_code
928 && $object->mode_reglement_code !=
'CHQ'
929 && $object->mode_reglement_code !=
'VIR') {
930 $pdf->SetFont(
'',
'B', $default_font_size - 2);
931 $pdf->SetXY($this->marge_gauche, $posy);
932 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
933 $pdf->MultiCell(80, 5, $titre, 0,
'L');
935 $pdf->SetFont(
'',
'', $default_font_size - 2);
936 $pdf->SetXY($posxval, $posy);
937 $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);
938 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
940 $posy = $pdf->GetY() + 2;
944 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'CHQ') {
946 if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
947 if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
949 $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
951 $pdf->SetXY($this->marge_gauche, $posy);
952 $pdf->SetFont(
'',
'B', $default_font_size - 3);
953 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $account->proprio), 0,
'L', 0);
954 $posy = $pdf->GetY() + 1;
956 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
957 $pdf->SetXY($this->marge_gauche, $posy);
958 $pdf->SetFont(
'',
'', $default_font_size - 3);
959 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0,
'L', 0);
960 $posy = $pdf->GetY() + 2;
963 if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
964 $pdf->SetXY($this->marge_gauche, $posy);
965 $pdf->SetFont(
'',
'B', $default_font_size - 3);
966 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByChequeOrderedTo', $this->emetteur->name), 0,
'L', 0);
967 $posy = $pdf->GetY() + 1;
969 if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
970 $pdf->SetXY($this->marge_gauche, $posy);
971 $pdf->SetFont(
'',
'', $default_font_size - 3);
972 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0,
'L', 0);
973 $posy = $pdf->GetY() + 2;
980 if (empty($object->mode_reglement_code) || $object->mode_reglement_code ==
'VIR') {
981 if (!empty($object->fk_account) || !empty($object->fk_bank) ||
getDolGlobalInt(
'FACTURE_RIB_NUMBER')) {
982 $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account);
983 if (!empty($object->fk_bank)) $bankid = $object->fk_bank;
985 $account->fetch($bankid);
987 $curx = $this->marge_gauche;
990 $posy =
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
1012 global $conf, $mysoc;
1018 $pdf->SetFont(
'',
'', $default_font_size - 1);
1021 $col1x = 120; $col2x = 170;
1022 if ($this->page_largeur < 210) {
1025 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
1029 $outputlangsbis =
null;
1030 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
1031 $outputlangsbis =
new Translate(
'', $conf);
1032 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
1033 $outputlangsbis->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"propal"));
1045 $pdf->SetFillColor(248, 248, 248);
1047 $total_ttc = $object->getValorisationTotale();
1049 $this->atleastoneratenotnull = 0;
1053 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1054 $pdf->SetTextColor(0, 0, 60);
1055 $pdf->SetFillColor(224, 224, 224);
1056 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transcountrynoentities(
"Total", $mysoc->country_code) :
''), $useborder,
'L', 1);
1058 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1059 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc, 0, $outputlangs), $useborder,
'R', 1);
1061 $pdf->SetTextColor(0, 0, 0);
1063 $creditnoteamount = 0;
1064 $depositsamount = 0;
1068 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1069 if (!empty($object->paye)) $resteapayer = 0;
1071 if ($deja_regle > 0) {
1075 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1076 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), 0,
'L', 0);
1077 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1078 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle, 0, $outputlangs), 0,
'R', 0);
1081 $pdf->SetTextColor(0, 0, 60);
1082 $pdf->SetFillColor(224, 224, 224);
1083 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1084 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay").(is_object($outputlangsbis) ?
' / '.$outputlangsbis->transnoentities(
"AlreadyPaid") :
''), $useborder,
'L', 1);
1086 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1087 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer, 0, $outputlangs), $useborder,
'R', 1);
1089 $pdf->SetFont(
'',
'', $default_font_size - 1);
1090 $pdf->SetTextColor(0, 0, 0);
1094 return ($tab2_top + ($tab2_hl * $index));
1111 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
1117 if ($hidetop) $hidetop = -1;
1119 $currency = !empty($currency) ? $currency : $conf->currency;
1123 $pdf->SetTextColor(0, 0, 0);
1124 $pdf->SetFont(
'',
'', $default_font_size - 2);
1126 if (empty($hidetop)) {
1127 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1128 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1129 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1132 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1133 $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));
1137 $pdf->SetDrawColor(128, 128, 128);
1138 $pdf->SetFont(
'',
'', $default_font_size - 1);
1141 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1144 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
1146 if (empty($hidetop)) {
1147 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
1163 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey =
"StockTransferSheetProforma")
1166 global $conf, $langs, $hookmanager;
1169 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"orders",
"companies"));
1180 $pdf->SetTextColor(0, 0, 60);
1181 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1183 $posy = $this->marge_haute;
1184 $posx = $this->page_largeur - $this->marge_droite - 100;
1186 $pdf->SetXY($this->marge_gauche, $posy);
1190 if ($this->emetteur->logo) {
1191 $logodir = $conf->mycompany->dir_output;
1192 if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
1194 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1196 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1198 if (is_readable($logo)) {
1200 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1202 $pdf->SetTextColor(200, 0, 0);
1203 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1204 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1205 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1208 $text = $this->emetteur->name;
1209 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1213 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1214 $pdf->SetXY($posx, $posy);
1215 $pdf->SetTextColor(0, 0, 60);
1216 $title = $outputlangs->transnoentities($titlekey);
1217 $pdf->MultiCell(100, 3, $title,
'',
'R');
1219 $pdf->SetFont(
'',
'B', $default_font_size);
1222 $pdf->SetXY($posx, $posy);
1223 $pdf->SetTextColor(0, 0, 60);
1224 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
1227 $pdf->SetFont(
'',
'', $default_font_size - 1);
1230 if (!empty($object->date_prevue_depart)) {
1232 $pdf->SetXY($posx, $posy);
1233 $pdf->SetTextColor(0, 0, 60);
1234 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueDepart").
" : ".
dol_print_date($object->date_prevue_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1238 if (!empty($object->date_prevue_arrivee)) {
1240 $pdf->SetXY($posx, $posy);
1241 $pdf->SetTextColor(0, 0, 60);
1242 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DatePrevueArrivee").
" : ".
dol_print_date($object->date_prevue_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1246 if (!empty($object->date_reelle_depart)) {
1248 $pdf->SetXY($posx, $posy);
1249 $pdf->SetTextColor(0, 0, 60);
1250 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleDepart").
" : ".
dol_print_date($object->date_reelle_depart,
"day",
false, $outputlangs,
true),
'',
'R');
1254 if (!empty($object->date_reelle_arrivee)) {
1256 $pdf->SetXY($posx, $posy);
1257 $pdf->SetTextColor(0, 0, 60);
1258 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateReelleArrivee").
" : ".
dol_print_date($object->date_reelle_arrivee,
"day",
false, $outputlangs,
true),
'',
'R');
1261 if ($object->ref_client) {
1263 $pdf->SetXY($posx, $posy);
1264 $pdf->SetTextColor(0, 0, 60);
1265 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset($object->ref_client),
'',
'R');
1268 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
1269 $object->fetch_projet();
1270 if (!empty($object->project->ref)) {
1272 $pdf->SetXY($posx, $posy);
1273 $pdf->SetTextColor(0, 0, 60);
1274 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->projet->title),
'',
'R');
1278 if (!empty($conf->global->PDF_SHOW_PROJECT)) {
1279 $object->fetch_projet();
1280 if (!empty($object->project->ref)) {
1282 $pdf->SetXY($posx, $posy);
1283 $pdf->SetTextColor(0, 0, 60);
1284 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->projet->ref),
'',
'R');
1288 if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
1290 $pdf->SetXY($posx, $posy);
1291 $pdf->SetTextColor(0, 0, 60);
1292 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
1296 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1297 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1298 if (count($arrayidcontact) > 0) {
1299 $usertmp =
new User($this->
db);
1300 $usertmp->fetch($arrayidcontact[0]);
1302 $pdf->SetXY($posx, $posy);
1303 $pdf->SetTextColor(0, 0, 60);
1304 $pdf->MultiCell(100, 3, $langs->trans(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1312 $current_y = $pdf->getY();
1313 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1314 if ($current_y < $pdf->getY()) {
1315 $top_shift = $pdf->getY() - $current_y;
1320 $carac_emetteur =
'';
1322 $arrayidcontact = array();
1323 $arrayidcontact = $object->getIdContact(
'external',
'STFROM');
1325 $usecontact =
false;
1326 if (count($arrayidcontact) > 0) {
1330 $result = $object->fetch_contact($arrayidcontact[0]);
1333 if ($usecontact) $thirdparty = $object->contact;
1334 else $thirdparty = $this->emetteur;
1338 if ($usecontact) $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1,
'targetwithdetails', $object);
1339 else $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1342 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1343 $posx = $this->marge_gauche;
1344 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1346 $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
1347 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
1350 $pdf->SetTextColor(0, 0, 0);
1351 $pdf->SetFont(
'',
'', $default_font_size - 2);
1352 $pdf->SetXY($posx, $posy - 5);
1353 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"Sender").
":", 0,
'L');
1354 $pdf->SetXY($posx, $posy);
1355 $pdf->SetFillColor(230, 230, 230);
1356 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1357 $pdf->SetTextColor(0, 0, 60);
1358 $pdf->SetFillColor(255, 255, 255);
1361 $pdf->SetXY($posx + 2, $posy + 3);
1362 $pdf->SetFont(
'',
'B', $default_font_size);
1363 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($carac_emetteur_name), 0,
'L');
1364 $posy = $pdf->getY();
1367 $pdf->SetXY($posx + 2, $posy);
1368 $pdf->SetFont(
'',
'', $default_font_size - 1);
1369 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1373 $usecontact =
false;
1374 $arrayidcontact = $object->getIdContact(
'external',
'STDEST');
1375 if (count($arrayidcontact) > 0) {
1377 $result = $object->fetch_contact($arrayidcontact[0]);
1383 $thirdparty = $object->contact;
1385 $thirdparty = $object->thirdparty;
1390 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact :
null), $usecontact,
'targetwithdetails', $object);
1393 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
1394 if ($this->page_largeur < 210) $widthrecbox = 84;
1395 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1396 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1397 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1400 $pdf->SetTextColor(0, 0, 0);
1401 $pdf->SetFont(
'',
'', $default_font_size - 2);
1402 $pdf->SetXY($posx + 2, $posy - 5);
1403 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient").
":", 0,
'L');
1404 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1407 $pdf->SetXY($posx + 2, $posy + 3);
1408 $pdf->SetFont(
'',
'B', $default_font_size);
1409 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1411 $posy = $pdf->getY();
1414 $pdf->SetFont(
'',
'', $default_font_size - 1);
1415 $pdf->SetXY($posx + 2, $posy);
1416 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1419 $pdf->SetTextColor(0, 0, 0);
1434 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1437 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1438 return pdf_pagefoot($pdf, $outputlangs,
'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1453 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1455 global $conf, $hookmanager;
1458 $this->defaultContentsFieldsStyle = array(
1460 'padding' => array(1, 0.5, 1, 0.5),
1464 $this->defaultTitlesFieldsStyle = array(
1466 'padding' => array(0.5, 0, 0.5, 0),
1488 $this->cols[
'desc'] = array(
1493 'textkey' =>
'Designation',
1497 'padding' => array(0.5, 1, 0.5, 1.5),
1501 'padding' => array(1, 0.5, 1, 1.5),
1506 $this->cols[
'photo'] = array(
1508 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
1511 'textkey' =>
'Photo',
1515 'padding' => array(0, 0, 0, 0),
1517 'border-left' =>
false,
1520 if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) {
1521 $this->cols[
'photo'][
'status'] =
true;
1526 $this->cols[
'vat'] = array(
1533 'border-left' =>
true,
1542 $this->cols[
'subprice'] = array(
1547 'textkey' =>
'PMPValueShort'
1549 'border-left' =>
true,
1554 $nblines = count($object->lines);
1555 for ($i = 0; $i < $nblines; $i++) {
1557 $tmpwidth = max($tmpwidth, $tmpwidth2);
1559 if ($tmpwidth > 10) {
1560 $this->cols[
'subprice'][
'width'] += (2 * ($tmpwidth - 10));
1564 $this->cols[
'qty'] = array(
1571 'border-left' =>
true,
1575 $this->cols[
'unit'] = array(
1582 'border-left' =>
true,
1584 if ($conf->global->PRODUCT_USE_UNITS) {
1585 $this->cols[
'unit'][
'status'] =
true;
1589 $this->cols[
'discount'] = array(
1594 'textkey' =>
'ReductionShort'
1596 'border-left' =>
true,
1598 if ($this->atleastonediscount) {
1599 $this->cols[
'discount'][
'status'] =
true;
1602 $rank = $rank + 1000;
1603 $this->cols[
'totalexcltax'] = array(
1608 'textkey' =>
'PMPValue'
1610 'border-left' =>
true,
1614 if (!empty($object->lines)) {
1615 $line = reset($object->lines);
1619 $parameters = array(
1620 'object' => $object,
1621 'outputlangs' => $outputlangs,
1622 'hidedetails' => $hidedetails,
1623 'hidedesc' => $hidedesc,
1624 'hideref' => $hideref
1627 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1630 } elseif (empty($reshook)) {
1631 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1633 $this->cols = $hookmanager->resArray;
Class to manage bank accounts.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
getColumnStatus($colKey)
get column status from column key
printStdColumnContent($pdf, &$curY, $colKey, $columnText='')
print standard column content
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
getExtrafieldContent($object, $extrafieldKey, $outputlangs=null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
Parent class for orders models.
Class to manage products or services.
Class to manage translations.
Class to manage Dolibarr users.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
if(!function_exists('dolEscapeXML')) convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank informations for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.