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';
68 public $phpmin = array(5, 6);
74 public $version =
'dolibarr';
125 global $conf, $langs, $mysoc;
128 $langs->loadLangs(array(
"main",
"bills"));
131 $this->
name =
"muscadet";
132 $this->
description = $langs->trans(
'SuppliersCommandModelMuscadet');
137 $this->page_largeur = $formatarray[
'width'];
138 $this->page_hauteur = $formatarray[
'height'];
139 $this->format = array($this->page_largeur, $this->page_hauteur);
140 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
141 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
142 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
143 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
145 $this->option_logo = 1;
146 $this->option_tva = 1;
147 $this->option_modereg = 1;
148 $this->option_condreg = 1;
149 $this->option_codeproduitservice = 1;
150 $this->option_multilang = 1;
151 $this->option_escompte = 0;
152 $this->option_credit_note = 0;
153 $this->option_freetext = 1;
154 $this->option_draft_watermark = 1;
157 $this->emetteur = $mysoc;
158 if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2);
161 $this->posxdesc = $this->marge_gauche + 1;
162 $this->posxdiscount = 162;
163 $this->postotalht = 174;
165 if (!empty($conf->global->PRODUCT_USE_UNITS))
169 $this->posxqty = 132;
170 $this->posxunit = 147;
172 $this->posxtva = 110;
174 $this->posxqty = 145;
175 $this->posxunit = 162;
178 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxup = $this->posxtva;
179 $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
180 if ($this->page_largeur < 210)
182 $this->posxpicture -= 20;
183 $this->posxtva -= 20;
185 $this->posxqty -= 20;
186 $this->posxunit -= 20;
187 $this->posxdiscount -= 20;
188 $this->postotalht -= 20;
191 $this->tva = array();
192 $this->localtax1 = array();
193 $this->localtax2 = array();
194 $this->atleastoneratenotnull = 0;
195 $this->atleastonediscount = 0;
211 public function write_file($object, $outputlangs =
'', $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
214 global $user, $langs, $conf, $hookmanager, $mysoc, $nblines;
216 if (!is_object($outputlangs)) $outputlangs = $langs;
218 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
221 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"dict",
"products"));
223 $nblines = count($object->lines);
226 $realpatharray = array();
227 if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE))
229 for ($i = 0; $i < $nblines; $i++)
231 if (empty($object->lines[$i]->fk_product))
continue;
234 $objphoto->fetch($object->lines[$i]->fk_product);
236 if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
238 $pdir =
get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
239 $dir = $conf->product->dir_output.
'/'.$pdir;
241 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
242 $dir = $conf->product->dir_output.
'/'.$pdir;
246 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
248 $filename = $obj[
'photo'];
250 $realpath = $dir.$filename;
254 if ($realpath) $realpatharray[$i] = $realpath;
257 if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva;
259 if ($conf->fournisseur->commande->dir_output)
261 $object->fetch_thirdparty();
264 $amount_credit_notes_included = 0;
265 $amount_deposits_included = 0;
270 if ($object->specimen)
272 $dir = $conf->fournisseur->commande->dir_output;
273 $file = $dir.
"/SPECIMEN.pdf";
277 $dir = $conf->fournisseur->commande->dir_output.
'/'.$objectref;
278 $file = $dir.
"/".$objectref.
".pdf";
279 if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir.
"/".$objectref.($objectrefsupplier ?
"_".$objectrefsupplier :
"").
".pdf";
282 if (!file_exists($dir))
286 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
291 if (file_exists($dir))
294 if (!is_object($hookmanager))
296 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
299 $hookmanager->initHooks(array(
'pdfgeneration'));
300 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
302 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
304 $nblines = count($object->lines);
308 $heightforinfotot = 50;
309 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
310 $heightforfooter = $this->marge_basse + 8;
311 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
312 $pdf->SetAutoPageBreak(1, 0);
314 if (class_exists(
'TCPDF'))
316 $pdf->setPrintHeader(
false);
317 $pdf->setPrintFooter(
false);
321 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
323 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
324 $tplidx = $pdf->importPage(1);
329 $pdf->SetDrawColor(128, 128, 128);
331 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
332 $pdf->SetSubject($outputlangs->transnoentities(
"PurchaseOrder"));
333 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
334 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
335 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"PurchaseOrder").
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
336 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
338 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
341 for ($i = 0; $i < $nblines; $i++)
343 if ($object->lines[$i]->remise_percent)
345 $this->atleastonediscount++;
348 if (empty($this->atleastonediscount))
350 $delta = ($this->postotalht - $this->posxdiscount);
351 $this->posxpicture += $delta;
352 $this->posxtva += $delta;
353 $this->posxup += $delta;
354 $this->posxqty += $delta;
355 $this->posxunit += $delta;
356 $this->posxdiscount += $delta;
362 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
364 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs);
365 $pdf->SetFont(
'',
'', $default_font_size - 1);
366 $pdf->MultiCell(0, 3,
'');
367 $pdf->SetTextColor(0, 0, 0);
369 $tab_top = 90 + $top_shift;
370 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
373 if (!empty($conf->incoterm->enabled))
375 $desc_incoterms = $object->getIncotermsForPDF();
380 $pdf->SetFont(
'',
'', $default_font_size - 1);
381 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
382 $nexY = $pdf->GetY();
383 $height_incoterms = $nexY - $tab_top;
386 $pdf->SetDrawColor(192, 192, 192);
387 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
389 $tab_top = $nexY + 6;
394 if (!empty($object->note_public))
398 $pdf->SetFont(
'',
'', $default_font_size - 1);
399 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($object->note_public), 0, 1);
400 $nexY = $pdf->GetY();
401 $height_note = $nexY - $tab_top;
404 $pdf->SetDrawColor(192, 192, 192);
405 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
407 $tab_top = $nexY + 6;
410 $iniY = $tab_top + 7;
411 $curY = $tab_top + 7;
412 $nexY = $tab_top + 7;
415 for ($i = 0; $i < $nblines; $i++)
418 $pdf->SetFont(
'',
'', $default_font_size - 1);
419 $pdf->SetTextColor(0, 0, 0);
422 $imglinesize = array();
425 $pdf->setTopMargin($tab_top_newpage);
426 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
427 $pageposbefore = $pdf->getPage();
429 $showpricebeforepagebreak = 1;
431 $posYAfterDescription = 0;
434 if (!empty($imglinesize[
'width']) && !empty($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
436 $pdf->AddPage(
'',
'',
true);
437 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
438 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
439 $pdf->setPage($pageposbefore + 1);
441 $curY = $tab_top_newpage;
444 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
445 $showpricebeforepagebreak = 1;
446 else $showpricebeforepagebreak = 0;
449 if (!empty($imglinesize[
'width']) && !empty($imglinesize[
'height']))
451 $curX = $this->posxpicture - 1;
452 $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
454 $posYAfterImage = $curY + $imglinesize[
'height'];
457 $curX = $this->posxdesc - 1;
458 $showpricebeforepagebreak = 1;
460 $pdf->startTransaction();
461 if ($posYAfterImage > 0)
463 $descWidth = $this->posxpicture - $curX;
465 $descWidth = $this->posxtva - $curX;
467 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
469 $pageposafter = $pdf->getPage();
470 if ($pageposafter > $pageposbefore)
472 $pdf->rollbackTransaction(
true);
473 $pageposafter = $pageposbefore;
475 $pdf->setPageOrientation(
'', 1, $heightforfooter);
476 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
477 $posyafter = $pdf->GetY();
478 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
480 if ($i == ($nblines - 1))
482 $pdf->AddPage(
'',
'',
true);
483 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
484 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
485 $pdf->setPage($pageposafter + 1);
490 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
491 $showpricebeforepagebreak = 1;
492 else $showpricebeforepagebreak = 0;
496 $pdf->commitTransaction();
499 $nexY = $pdf->GetY();
500 $pageposafter = $pdf->getPage();
501 $pdf->setPage($pageposbefore);
502 $pdf->setTopMargin($this->marge_haute);
503 $pdf->setPageOrientation(
'', 1, 0);
506 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
507 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
510 $pdf->SetFont(
'',
'', $default_font_size - 1);
513 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
516 $pdf->SetXY($this->posxtva, $curY);
517 $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0,
'R');
521 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) {
523 $pdf->SetXY($this->posxup, $curY);
524 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0,
'R', 0);
529 $pdf->SetXY($this->posxqty, $curY);
530 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0,
'R');
533 if (!empty($conf->global->PRODUCT_USE_UNITS))
535 $unit =
pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
536 $pdf->SetXY($this->posxunit, $curY);
537 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0,
'L');
541 $pdf->SetXY($this->posxdiscount, $curY);
542 if ($object->lines[$i]->remise_percent)
545 $pdf->MultiCell($this->postotalht - $this->posxdiscount - 1, 3, $remise_percent, 0,
'R');
549 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) {
551 $pdf->SetXY($this->postotalht, $curY);
552 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0,
'R', 0);
556 if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
557 else $tvaligne = $object->lines[$i]->total_tva;
559 $localtax1ligne = $object->lines[$i]->total_localtax1;
560 $localtax2ligne = $object->lines[$i]->total_localtax2;
561 $localtax1_rate = $object->lines[$i]->localtax1_tx;
562 $localtax2_rate = $object->lines[$i]->localtax2_tx;
563 $localtax1_type = $object->lines[$i]->localtax1_type;
564 $localtax2_type = $object->lines[$i]->localtax2_type;
566 if (!empty($object->remise_percent)) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
567 if (!empty($object->remise_percent)) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
568 if (!empty($object->remise_percent)) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
570 $vatrate = (string) $object->lines[$i]->tva_tx;
573 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
574 && (!empty($localtax1_rate) || !empty($localtax2_rate)))
577 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
578 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
582 if ($localtax1_type && $localtax1ligne != 0)
583 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
584 if ($localtax2_type && $localtax2ligne != 0)
585 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
587 if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .=
'*';
588 if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0;
589 $this->tva[$vatrate] += $tvaligne;
591 if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage;
594 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
596 $pdf->setPage($pageposafter);
597 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
599 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
600 $pdf->SetLineStyle(array(
'dash'=>0));
606 while ($pagenb < $pageposafter)
608 $pdf->setPage($pagenb);
611 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
613 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
615 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
617 $pdf->setPage($pagenb);
618 $pdf->setPageOrientation(
'', 1, 0);
619 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
621 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
625 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
627 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
629 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
632 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
634 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
641 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
642 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
644 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
645 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
649 $posy = $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
652 $posy = $this->
_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
655 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
661 $this->
_pagefoot($pdf, $object, $outputlangs);
662 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
666 $pdf->Output($file,
'F');
669 $hookmanager->initHooks(array(
'pdfgeneration'));
670 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
672 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
675 $this->error = $hookmanager->error;
676 $this->errors = $hookmanager->errors;
679 if (!empty($conf->global->MAIN_UMASK))
680 @chmod($file, octdec($conf->global->MAIN_UMASK));
682 $this->result = array(
'fullpath'=>$file);
686 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
690 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
725 global $conf, $mysoc;
729 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
730 $pdf->SetFont(
'',
'B', $default_font_size - 2);
731 $pdf->SetXY($this->marge_gauche, $posy);
732 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
734 $posy = $pdf->GetY() + 4;
740 if (!empty($object->cond_reglement_code) || $object->cond_reglement_id) {
741 $pdf->SetFont(
'',
'B', $default_font_size - 2);
742 $pdf->SetXY($this->marge_gauche, $posy);
743 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
744 $pdf->MultiCell(80, 4, $titre, 0,
'L');
746 $pdf->SetFont(
'',
'', $default_font_size - 2);
747 $pdf->SetXY($posxval, $posy);
748 $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);
749 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
750 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0,
'L');
752 $posy = $pdf->GetY() + 3;
756 if (!empty($object->mode_reglement_code)) {
757 $pdf->SetFont(
'',
'B', $default_font_size - 2);
758 $pdf->SetXY($this->marge_gauche, $posy);
759 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
760 $pdf->MultiCell(80, 5, $titre, 0,
'L');
762 $pdf->SetFont(
'',
'', $default_font_size - 2);
763 $pdf->SetXY($posxval, $posy);
764 $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);
765 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
767 $posy = $pdf->GetY() + 2;
785 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
788 global $conf, $mysoc;
794 $pdf->SetFont(
'',
'', $default_font_size - 1);
797 $col1x = 120; $col2x = 170;
798 if ($this->page_largeur < 210)
802 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
808 $pdf->SetFillColor(255, 255, 255);
809 $pdf->SetXY($col1x, $tab2_top + 0);
810 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
812 $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
813 $pdf->SetXY($col2x, $tab2_top + 0);
814 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0,
'R', 1);
817 $pdf->SetFillColor(248, 248, 248);
819 $this->atleastoneratenotnull = 0;
820 foreach ($this->tva as $tvakey => $tvaval)
824 $this->atleastoneratenotnull++;
827 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
831 if (preg_match(
'/\*/', $tvakey))
833 $tvakey = str_replace(
'*',
'', $tvakey);
834 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
837 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
838 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
839 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
841 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
842 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R', 1);
845 if (!$this->atleastoneratenotnull)
848 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
849 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code), 0,
'L', 1);
851 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
852 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_tva), 0,
'R', 1);
855 if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION ==
'localtax1on' && $object->total_localtax1 > 0)
858 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
859 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code), 0,
'L', 1);
860 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
861 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax1), $useborder,
'R', 1);
865 if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION ==
'localtax2on' && $object->total_localtax2 > 0)
868 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
869 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code), 0,
'L', 1);
870 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
871 $pdf->MultiCell($largcol2, $tab2_hl,
price($object->total_localtax2), $useborder,
'R', 1);
877 foreach ($this->localtax1 as $localtax_type => $localtax_rate)
879 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6')))
continue;
881 foreach ($localtax_rate as $tvakey => $tvaval)
888 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
891 if (preg_match(
'/\*/', $tvakey))
893 $tvakey = str_replace(
'*',
'', $tvakey);
894 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
896 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
897 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
898 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
900 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
901 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
909 foreach ($this->localtax2 as $localtax_type => $localtax_rate)
911 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6')))
continue;
913 foreach ($localtax_rate as $tvakey => $tvaval)
920 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
923 if (preg_match(
'/\*/', $tvakey))
925 $tvakey = str_replace(
'*',
'', $tvakey);
926 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
928 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
929 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
930 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
932 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
933 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R', 1);
941 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
942 $pdf->SetTextColor(0, 0, 60);
943 $pdf->SetFillColor(224, 224, 224);
944 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
946 $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
947 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
948 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc), $useborder,
'R', 1);
949 $pdf->SetFont(
'',
'', $default_font_size - 1);
950 $pdf->SetTextColor(0, 0, 0);
952 $creditnoteamount = 0;
957 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
958 if (!empty($object->paye)) $resteapayer = 0;
965 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
966 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L', 0);
967 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
968 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle), 0,
'R', 0);
971 $pdf->SetTextColor(0, 0, 60);
972 $pdf->SetFillColor(224, 224, 224);
973 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
974 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L', 1);
976 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
977 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer), $useborder,
'R', 1);
979 $pdf->SetFont(
'',
'', $default_font_size - 1);
980 $pdf->SetTextColor(0, 0, 0);
984 return ($tab2_top + ($tab2_hl * $index));
1001 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
1007 if ($hidetop) $hidetop = -1;
1009 $currency = !empty($currency) ? $currency : $conf->currency;
1013 $pdf->SetTextColor(0, 0, 0);
1014 $pdf->SetFont(
'',
'', $default_font_size - 2);
1016 if (empty($hidetop))
1018 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1019 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1020 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1023 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5,
'F', null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1026 $pdf->SetDrawColor(128, 128, 128);
1027 $pdf->SetFont(
'',
'', $default_font_size - 1);
1030 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1032 if (empty($hidetop))
1034 $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
1036 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1037 $pdf->MultiCell(108, 2, $outputlangs->transnoentities(
"Designation"),
'',
'L');
1040 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
1042 $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height);
1043 if (empty($hidetop))
1045 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1046 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities(
"VAT"),
'',
'C');
1050 $pdf->line($this->posxup, $tab_top, $this->posxup, $tab_top + $tab_height);
1051 if (empty($hidetop))
1053 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1054 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities(
"PriceUHT"),
'',
'C');
1057 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1058 if (empty($hidetop))
1060 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1061 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities(
"Qty"),
'',
'C');
1064 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1065 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1066 if (empty($hidetop)) {
1067 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1068 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities(
"Unit"),
'',
'C');
1072 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1073 if (empty($hidetop))
1075 if ($this->atleastonediscount)
1077 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1078 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities(
"ReductionShort"),
'',
'C');
1082 if ($this->atleastonediscount)
1084 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1086 if (empty($hidetop))
1088 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1089 $pdf->MultiCell(30, 2, $outputlangs->transnoentities(
"TotalHTShort"),
'',
'C');
1103 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1105 global $langs, $conf, $mysoc;
1108 $outputlangs->loadLangs(array(
"main",
"orders",
"companies",
"bills",
"sendings"));
1122 $pdf->SetTextColor(0, 0, 60);
1123 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1125 $posx = $this->page_largeur - $this->marge_droite - 100;
1126 $posy = $this->marge_haute;
1128 $pdf->SetXY($this->marge_gauche, $posy);
1131 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
1132 if ($this->emetteur->logo)
1134 if (is_readable($logo))
1137 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1139 $pdf->SetTextColor(200, 0, 0);
1140 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1141 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1142 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
1145 $text = $this->emetteur->name;
1146 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1149 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1150 $pdf->SetXY($posx, $posy);
1151 $pdf->SetTextColor(0, 0, 60);
1152 $title = $outputlangs->transnoentities(
"SupplierOrder").
" ".$outputlangs->convToOutputCharset($object->ref);
1153 $pdf->MultiCell(100, 3, $title,
'',
'R');
1156 if ($object->ref_supplier)
1159 $pdf->SetFont(
'',
'B', $default_font_size);
1160 $pdf->SetXY($posx, $posy);
1161 $pdf->SetTextColor(0, 0, 60);
1162 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefSupplier").
" : ".$outputlangs->convToOutputCharset($object->ref_supplier),
'',
'R');
1166 $pdf->SetFont(
'',
'', $default_font_size - 1);
1168 if (!empty($conf->global->PDF_SHOW_PROJECT))
1170 $object->fetch_projet();
1171 if (!empty($object->project->ref))
1174 $pdf->SetXY($posx, $posy);
1175 $langs->load(
"projects");
1176 $pdf->SetTextColor(0, 0, 60);
1177 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
1181 if (!empty($object->date_commande))
1184 $pdf->SetXY($posx, $posy);
1185 $pdf->SetTextColor(0, 0, 60);
1186 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($object->date_commande,
"day",
false, $outputlangs,
true),
'',
'R');
1189 $pdf->SetXY($posx, $posy);
1190 $pdf->SetTextColor(255, 0, 0);
1191 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"OrderToProcess"),
'',
'R');
1194 $pdf->SetTextColor(0, 0, 60);
1195 $usehourmin =
'day';
1196 if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin =
'dayhour';
1197 if (!empty($object->delivery_date))
1200 $pdf->SetXY($posx - 90, $posy);
1201 $pdf->MultiCell(190, 3, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date($object->delivery_date, $usehourmin,
false, $outputlangs,
true),
'',
'R');
1204 if ($object->thirdparty->code_fournisseur)
1207 $pdf->SetXY($posx, $posy);
1208 $pdf->SetTextColor(0, 0, 60);
1209 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur),
'',
'R');
1213 if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
1215 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1216 if (count($arrayidcontact) > 0)
1218 $usertmp =
new User($this->
db);
1219 $usertmp->fetch($arrayidcontact[0]);
1221 $pdf->SetXY($posx, $posy);
1222 $pdf->SetTextColor(0, 0, 60);
1223 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1228 $pdf->SetTextColor(0, 0, 60);
1232 $current_y = $pdf->getY();
1233 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
1234 if ($current_y < $pdf->getY())
1236 $top_shift = $pdf->getY() - $current_y;
1242 $carac_emetteur =
'';
1244 $arrayidcontact = $object->getIdContact(
'internal',
'SALESREPFOLL');
1245 if (count($arrayidcontact) > 0)
1247 $object->fetch_user($arrayidcontact[0]);
1248 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)).
"\n";
1251 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1254 $posy = 42 + $top_shift;
1255 $posx = $this->marge_gauche;
1256 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
1260 $pdf->SetTextColor(0, 0, 0);
1261 $pdf->SetFont(
'',
'', $default_font_size - 2);
1262 $pdf->SetXY($posx, $posy - 5);
1263 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
1264 $pdf->SetXY($posx, $posy);
1265 $pdf->SetFillColor(230, 230, 230);
1266 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1267 $pdf->SetTextColor(0, 0, 60);
1270 $pdf->SetXY($posx + 2, $posy + 3);
1271 $pdf->SetFont(
'',
'B', $default_font_size);
1272 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1273 $posy = $pdf->getY();
1276 $pdf->SetXY($posx + 2, $posy);
1277 $pdf->SetFont(
'',
'', $default_font_size - 1);
1278 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
1282 $usecontact =
false;
1283 $arrayidcontact = $object->getIdContact(
'external',
'CUSTOMER');
1284 if (count($arrayidcontact) > 0)
1287 $result = $object->fetch_contact($arrayidcontact[0]);
1291 if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1292 $thirdparty = $object->contact;
1294 $thirdparty = $object->thirdparty;
1299 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
1303 if ($this->page_largeur < 210) $widthrecbox = 84;
1304 $posy = 42 + $top_shift;
1305 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1306 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
1309 $pdf->SetTextColor(0, 0, 0);
1310 $pdf->SetFont(
'',
'', $default_font_size - 2);
1311 $pdf->SetXY($posx + 2, $posy - 5);
1312 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo").
":", 0,
'L');
1313 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1316 $pdf->SetXY($posx + 2, $posy + 3);
1317 $pdf->SetFont(
'',
'B', $default_font_size);
1318 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
1320 $posy = $pdf->getY();
1323 $pdf->SetFont(
'',
'', $default_font_size - 1);
1324 $pdf->SetXY($posx + 2, $posy);
1325 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1341 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1344 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1345 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
Parent class for supplier orders models.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
write_file($object, $outputlangs= '', $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Class to manage products or services.
Class to manage Dolibarr users.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
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...
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
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...
Class to generate the supplier orders with the muscadet model.
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency= '')
Show table for lines.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany= '', $targetcontact= '', $usecontact=0, $mode= 'source', $object=null)
Return a string with full address formated for output on documents.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)