dolibarr  16.0.5
pdf_aurore.modules.php
1 <?php
2 /* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
5  * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
7  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  * or see https://www.gnu.org/
22  */
23 
29 require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_proposal/modules_supplier_proposal.php';
30 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
34 
35 
40 {
44  public $db;
45 
49  public $name;
50 
54  public $description;
55 
59  public $update_main_doc_field;
60 
64  public $type;
65 
70  public $phpmin = array(5, 6);
71 
76  public $version = 'dolibarr';
77 
81  public $page_largeur;
82 
86  public $page_hauteur;
87 
91  public $format;
92 
96  public $marge_gauche;
97 
101  public $marge_droite;
102 
106  public $marge_haute;
107 
111  public $marge_basse;
112 
117  public $emetteur;
118 
119 
125  public function __construct($db)
126  {
127  global $conf, $langs, $mysoc;
128 
129  // Translations
130  $langs->loadLangs(array("main", "bills"));
131 
132  $this->db = $db;
133  $this->name = "aurore";
134  $this->description = $langs->trans('DocModelAuroreDescription');
135  $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
136 
137  // Page size for A4 format
138  $this->type = 'pdf';
139  $formatarray = pdf_getFormat();
140  $this->page_largeur = $formatarray['width'];
141  $this->page_hauteur = $formatarray['height'];
142  $this->format = array($this->page_largeur, $this->page_hauteur);
143  $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
144  $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
145  $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
146  $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
147 
148  $this->option_logo = 1; // Display logo
149  $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
150  $this->option_modereg = 1; // Display payment mode
151  $this->option_condreg = 1; // Display payment terms
152  $this->option_multilang = 1; // Available in several languages
153  $this->option_escompte = 1; // Displays if there has been a discount
154  $this->option_credit_note = 1; // Support credit notes
155  $this->option_freetext = 1; // Support add of a personalised text
156  $this->option_draft_watermark = 1; //Support add of a watermark on drafts
157  $this->watermark = '';
158 
159  // Get source company
160  $this->emetteur = $mysoc;
161  if (empty($this->emetteur->country_code)) {
162  $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
163  }
164 
165  // Define position of columns
166  $this->posxdesc = $this->marge_gauche + 1;
167  $this->posxdiscount = 162;
168  $this->postotalht = 174;
169 
170  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
171  $this->posxtva = 101;
172  $this->posxup = 118;
173  $this->posxqty = 135;
174  $this->posxunit = 151;
175  } else {
176  $this->posxtva = 102;
177  $this->posxup = 126;
178  $this->posxqty = 145;
179  $this->posxunit = 162;
180  }
181 
182  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
183  $this->posxup = $this->posxtva;
184  }
185  $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
186  if ($this->page_largeur < 210) { // To work with US executive format
187  $this->posxpicture -= 20;
188  $this->posxtva -= 20;
189  $this->posxup -= 20;
190  $this->posxqty -= 20;
191  $this->posxunit -= 20;
192  $this->posxdiscount -= 20;
193  $this->postotalht -= 20;
194  }
195 
196  $this->tva = array();
197  $this->tva_array = array();
198  $this->localtax1 = array();
199  $this->localtax2 = array();
200  $this->atleastoneratenotnull = 0;
201  $this->atleastonediscount = 0;
202  }
203 
204  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
216  public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
217  {
218  // phpcs:enable
219  global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
220 
221  if (!is_object($outputlangs)) {
222  $outputlangs = $langs;
223  }
224  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
225  if (!empty($conf->global->MAIN_USE_FPDF)) {
226  $outputlangs->charset_output = 'ISO-8859-1';
227  }
228 
229  // Load traductions files required by page
230  $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal"));
231 
232  // Show Draft Watermark
233  if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
234  $this->watermark = $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK;
235  }
236 
237  $nblines = count($object->lines);
238 
239  // Loop on each lines to detect if there is at least one image to show
240  $realpatharray = array();
241  if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
242  for ($i = 0; $i < $nblines; $i++) {
243  if (empty($object->lines[$i]->fk_product)) {
244  continue;
245  }
246 
247  $objphoto = new Product($this->db);
248  $objphoto->fetch($object->lines[$i]->fk_product);
249 
250  if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
251  $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
252  $dir = $conf->product->dir_output.'/'.$pdir;
253  } else {
254  $pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product');
255  $dir = $conf->product->dir_output.'/'.$pdir;
256  }
257 
258  $realpath = '';
259  foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
260  if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
261  if ($obj['photo_vignette']) {
262  $filename = $obj['photo_vignette'];
263  } else {
264  $filename = $obj['photo'];
265  }
266  } else {
267  $filename = $obj['photo'];
268  }
269  $realpath = $dir.$filename;
270  break;
271  }
272 
273  if ($realpath) {
274  $realpatharray[$i] = $realpath;
275  }
276  }
277  }
278  if (count($realpatharray) == 0) {
279  $this->posxpicture = $this->posxtva;
280  }
281 
282  if ($conf->supplier_proposal->dir_output) {
283  $object->fetch_thirdparty();
284 
285  // $deja_regle = 0;
286 
287  // Definition of $dir and $file
288  if ($object->specimen) {
289  $dir = $conf->supplier_proposal->dir_output;
290  $file = $dir."/SPECIMEN.pdf";
291  } else {
292  $objectref = dol_sanitizeFileName($object->ref);
293  $dir = $conf->supplier_proposal->dir_output."/".$objectref;
294  $file = $dir."/".$objectref.".pdf";
295  }
296 
297  if (!file_exists($dir)) {
298  if (dol_mkdir($dir) < 0) {
299  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
300  return 0;
301  }
302  }
303 
304  if (file_exists($dir)) {
305  // Add pdfgeneration hook
306  if (!is_object($hookmanager)) {
307  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
308  $hookmanager = new HookManager($this->db);
309  }
310  $hookmanager->initHooks(array('pdfgeneration'));
311  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
312  global $action;
313  $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
314 
315  // Create pdf instance
316  $pdf = pdf_getInstance($this->format);
317  $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
318  $heightforinfotot = 50; // Height reserved to output the info and total part
319  $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
320  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
321  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
322  $heightforfooter += 6;
323  }
324  $pdf->SetAutoPageBreak(1, 0);
325 
326  if (class_exists('TCPDF')) {
327  $pdf->setPrintHeader(false);
328  $pdf->setPrintFooter(false);
329  }
330  $pdf->SetFont(pdf_getPDFFont($outputlangs));
331  // Set path to the background PDF File
332  if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
333  $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
334  $tplidx = $pdf->importPage(1);
335  }
336 
337  $pdf->Open();
338  $pagenb = 0;
339  $pdf->SetDrawColor(128, 128, 128);
340 
341  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
342  $pdf->SetSubject($outputlangs->transnoentities("CommercialAsk"));
343  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
344  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
345  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
346  if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
347  $pdf->SetCompression(false);
348  }
349 
350  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
351 
352  // Positionne $this->atleastonediscount si on a au moins une remise
353  for ($i = 0; $i < $nblines; $i++) {
354  if ($object->lines[$i]->remise_percent) {
355  $this->atleastonediscount++;
356  }
357  }
358  if (empty($this->atleastonediscount)) {
359  $delta = ($this->postotalht - $this->posxdiscount);
360  $this->posxpicture += $delta;
361  $this->posxtva += $delta;
362  $this->posxup += $delta;
363  $this->posxqty += $delta;
364  $this->posxunit += $delta;
365  $this->posxdiscount += $delta;
366  // post of fields after are not modified, stay at same position
367  }
368 
369  // New page
370  $pdf->AddPage();
371  if (!empty($tplidx)) {
372  $pdf->useTemplate($tplidx);
373  }
374  $pagenb++;
375  $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
376  $pdf->SetFont('', '', $default_font_size - 1);
377  $pdf->MultiCell(0, 3, ''); // Set interline to 3
378  $pdf->SetTextColor(0, 0, 0);
379 
380  $tab_top = 90 + $top_shift;
381  $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
382 
383  // Affiche notes
384  $notetoshow = empty($object->note_public) ? '' : $object->note_public;
385  if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
386  // Get first sale rep
387  if (is_object($object->thirdparty)) {
388  $salereparray = $object->thirdparty->getSalesRepresentatives($user);
389  $salerepobj = new User($this->db);
390  $salerepobj->fetch($salereparray[0]['id']);
391  if (!empty($salerepobj->signature)) {
392  $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
393  }
394  }
395  }
396 
397  // Extrafields in note
398  $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
399  if (!empty($extranote)) {
400  $notetoshow = dol_concatdesc($notetoshow, $extranote);
401  }
402 
403  if ($notetoshow) {
404  $tab_top -= 2;
405 
406  $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
407  complete_substitutions_array($substitutionarray, $outputlangs, $object);
408  $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
409  $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
410 
411  $pdf->SetFont('', '', $default_font_size - 1);
412  $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1);
413  $nexY = $pdf->GetY();
414  $height_note = $nexY - $tab_top;
415 
416  // Rect takes a length in 3rd parameter
417  $pdf->SetDrawColor(192, 192, 192);
418  $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
419 
420  $tab_top = $nexY + 6;
421  }
422 
423  $iniY = $tab_top + 7;
424  $curY = $tab_top + 7;
425  $nexY = $tab_top + 7;
426 
427  // Loop on each lines
428  for ($i = 0; $i < $nblines; $i++) {
429  $curY = $nexY;
430  $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
431  $pdf->SetTextColor(0, 0, 0);
432 
433  // Define size of image if we need it
434  $imglinesize = array();
435  if (!empty($realpatharray[$i])) {
436  $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
437  }
438 
439  $pdf->setTopMargin($tab_top_newpage);
440  $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
441  $pageposbefore = $pdf->getPage();
442 
443  $showpricebeforepagebreak = 1;
444  $posYAfterImage = 0;
445  $posYAfterDescription = 0;
446 
447  // We start with Photo of product line
448  if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
449  $pdf->AddPage('', '', true);
450  if (!empty($tplidx)) {
451  $pdf->useTemplate($tplidx);
452  }
453  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
454  $this->_pagehead($pdf, $object, 0, $outputlangs);
455  }
456  $pdf->setPage($pageposbefore + 1);
457 
458  $curY = $tab_top_newpage;
459 
460  // Allows data in the first page if description is long enough to break in multiples pages
461  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
462  $showpricebeforepagebreak = 1;
463  } else {
464  $showpricebeforepagebreak = 0;
465  }
466  }
467 
468  if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
469  $curX = $this->posxpicture - 1;
470  $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
471  // $pdf->Image does not increase value return by getY, so we save it manually
472  $posYAfterImage = $curY + $imglinesize['height'];
473  }
474 
475  // Description of product line
476  $curX = $this->posxdesc - 1;
477 
478  $pdf->startTransaction();
479  if ($posYAfterImage > 0) {
480  $descWidth = $this->posxpicture - $curX;
481  } else {
482  $descWidth = $this->posxtva - $curX;
483  }
484  pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
485 
486  $pageposafter = $pdf->getPage();
487  if ($pageposafter > $pageposbefore) { // There is a pagebreak
488  $pdf->rollbackTransaction(true);
489  $pageposafter = $pageposbefore;
490  //print $pageposafter.'-'.$pageposbefore;exit;
491  $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
492  pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
493 
494  $pageposafter = $pdf->getPage();
495  $posyafter = $pdf->GetY();
496  //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
497  if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
498  if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
499  $pdf->AddPage('', '', true);
500  if (!empty($tplidx)) {
501  $pdf->useTemplate($tplidx);
502  }
503  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
504  $this->_pagehead($pdf, $object, 0, $outputlangs);
505  }
506  $pdf->setPage($pageposafter + 1);
507  }
508  } else {
509  // We found a page break
510  // Allows data in the first page if description is long enough to break in multiples pages
511  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
512  $showpricebeforepagebreak = 1;
513  } else {
514  $showpricebeforepagebreak = 0;
515  }
516  }
517  } else // No pagebreak
518  {
519  $pdf->commitTransaction();
520  }
521  $posYAfterDescription = $pdf->GetY();
522 
523  $nexY = $pdf->GetY();
524  $pageposafter = $pdf->getPage();
525 
526  $pdf->setPage($pageposbefore);
527  $pdf->setTopMargin($this->marge_haute);
528  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
529 
530  // We suppose that a too long description or photo were moved completely on next page
531  if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
532  $pdf->setPage($pageposafter);
533  $curY = $tab_top_newpage;
534  }
535 
536  $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
537 
538  // VAT Rate
539  /*
540  if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
541  {
542  $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
543  $pdf->SetXY($this->posxtva, $curY);
544  $pdf->MultiCell($this->posxup-$this->posxtva-3, 3, $vat_rate, 0, 'R');
545  }
546 
547  // Unit price before discount
548  $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
549  $pdf->SetXY($this->posxup, $curY);
550  if ($up_excl_tax > 0)
551  $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
552  */
553 
554  // Quantity
555  $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
556  $pdf->SetXY($this->posxqty, $curY);
557  $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
558 
559  // Unit
560  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
561  $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
562  $pdf->SetXY($this->posxunit, $curY);
563  $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L');
564  }
565 
566  // Discount on line
567  /*
568  if ($object->lines[$i]->remise_percent)
569  {
570  $pdf->SetXY($this->posxdiscount-2, $curY);
571  $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
572  $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
573  }
574 
575  // Total HT line
576  $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
577  $pdf->SetXY($this->postotalht, $curY);
578  if ($total_excl_tax > 0)
579  $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
580  */
581 
582  // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
583  if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) {
584  $tvaligne = $object->lines[$i]->multicurrency_total_tva;
585  } else {
586  $tvaligne = $object->lines[$i]->total_tva;
587  }
588 
589  $localtax1ligne = $object->lines[$i]->total_localtax1;
590  $localtax2ligne = $object->lines[$i]->total_localtax2;
591  $localtax1_rate = $object->lines[$i]->localtax1_tx;
592  $localtax2_rate = $object->lines[$i]->localtax2_tx;
593  $localtax1_type = $object->lines[$i]->localtax1_type;
594  $localtax2_type = $object->lines[$i]->localtax2_type;
595 
596  if ($object->remise_percent) {
597  $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
598  }
599  if ($object->remise_percent) {
600  $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
601  }
602  if ($object->remise_percent) {
603  $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
604  }
605 
606  $vatrate = (string) $object->lines[$i]->tva_tx;
607 
608  // Retrieve type from database for backward compatibility with old records
609  if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
610  && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
611  $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
612  $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
613  $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
614  }
615 
616  // retrieve global local tax
617  if ($localtax1_type && $localtax1ligne != 0) {
618  $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
619  }
620  if ($localtax2_type && $localtax2ligne != 0) {
621  $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
622  }
623 
624  if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
625  $vatrate .= '*';
626  }
627 
628  // Fill $this->tva and $this->tva_array
629  if (!isset($this->tva[$vatrate])) {
630  $this->tva[$vatrate] = 0;
631  }
632  $this->tva[$vatrate] += $tvaligne;
633  $vatcode = $object->lines[$i]->vat_src_code;
634  if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
635  $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
636  }
637  $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
638 
639  if ($posYAfterImage > $posYAfterDescription) {
640  $nexY = $posYAfterImage;
641  }
642 
643  // Add line
644  if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
645  $pdf->setPage($pageposafter);
646  $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
647  //$pdf->SetDrawColor(190,190,200);
648  $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
649  $pdf->SetLineStyle(array('dash'=>0));
650  }
651 
652  $nexY += 2; // Add space between lines
653 
654  // Detect if some page were added automatically and output _tableau for past pages
655  while ($pagenb < $pageposafter) {
656  $pdf->setPage($pagenb);
657  if ($pagenb == 1) {
658  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
659  } else {
660  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
661  }
662  $this->_pagefoot($pdf, $object, $outputlangs, 1);
663  $pagenb++;
664  $pdf->setPage($pagenb);
665  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
666  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
667  $this->_pagehead($pdf, $object, 0, $outputlangs);
668  }
669  if (!empty($tplidx)) {
670  $pdf->useTemplate($tplidx);
671  }
672  }
673  if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
674  if ($pagenb == 1) {
675  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
676  } else {
677  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
678  }
679  $this->_pagefoot($pdf, $object, $outputlangs, 1);
680  // New page
681  $pdf->AddPage();
682  if (!empty($tplidx)) {
683  $pdf->useTemplate($tplidx);
684  }
685  $pagenb++;
686  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
687  $this->_pagehead($pdf, $object, 0, $outputlangs);
688  }
689  }
690  }
691 
692  // Show square
693  if ($pagenb == 1) {
694  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
695  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
696  } else {
697  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
698  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
699  }
700 
701  // Affiche zone infos
702  $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
703 
704  // Affiche zone totaux
705  //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
706 
707  // Affiche zone versements
708  /*
709  if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
710  {
711  $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
712  }
713  */
714 
715  // Pied de page
716  $this->_pagefoot($pdf, $object, $outputlangs);
717  if (method_exists($pdf, 'AliasNbPages')) {
718  $pdf->AliasNbPages();
719  }
720 
721  $pdf->Close();
722 
723  $pdf->Output($file, 'F');
724 
725  //Add pdfgeneration hook
726  $hookmanager->initHooks(array('pdfgeneration'));
727  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
728  global $action;
729  $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
730  if ($reshook < 0) {
731  $this->error = $hookmanager->error;
732  $this->errors = $hookmanager->errors;
733  }
734 
735  if (!empty($conf->global->MAIN_UMASK)) {
736  @chmod($file, octdec($conf->global->MAIN_UMASK));
737  }
738 
739  $this->result = array('fullpath'=>$file);
740 
741  return 1; // No error
742  } else {
743  $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
744  return 0;
745  }
746  } else {
747  $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR");
748  return 0;
749  }
750  }
751 
752  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
753  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
763  protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
764  {
765  // phpcs:enable
766  }
767 
768  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
769  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
779  protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
780  {
781  // phpcs:enable
782  global $conf;
783  $default_font_size = pdf_getPDFFontSize($outputlangs);
784 
785  $pdf->SetFont('', '', $default_font_size - 1);
786 
787  $posxval = 52;
788 
789  // Show shipping date
790  if (!empty($object->delivery_date)) {
791  $outputlangs->load("sendings");
792  $pdf->SetFont('', 'B', $default_font_size - 2);
793  $pdf->SetXY($this->marge_gauche, $posy);
794  $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
795  $pdf->MultiCell(80, 4, $titre, 0, 'L');
796  $pdf->SetFont('', '', $default_font_size - 2);
797  $pdf->SetXY($posxval, $posy);
798  $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
799  $pdf->MultiCell(80, 4, $dlp, 0, 'L');
800 
801  $posy = $pdf->GetY() + 1;
802  } else {
803  $outputlangs->load("sendings");
804  $pdf->SetFont('', 'B', $default_font_size - 2);
805  $pdf->SetXY($this->marge_gauche, $posy);
806  $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
807  $pdf->MultiCell(80, 4, $titre, 0, 'L');
808  $pdf->SetFont('', '', $default_font_size - 2);
809  $pdf->SetXY($posxval, $posy);
810  //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true);
811  $pdf->MultiCell(80, 4, '', 0, 'L');
812 
813  $posy = $pdf->GetY() + 1;
814  }
815  /* PHFAVRE
816  elseif ($object->availability_code || $object->availability) // Show availability conditions
817  {
818  $pdf->SetFont('','B', $default_font_size - 2);
819  $pdf->SetXY($this->marge_gauche, $posy);
820  $titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
821  $pdf->MultiCell(80, 4, $titre, 0, 'L');
822  $pdf->SetTextColor(0,0,0);
823  $pdf->SetFont('','', $default_font_size - 2);
824  $pdf->SetXY($posxval, $posy);
825  $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset($object->availability);
826  $lib_availability=str_replace('\n',"\n",$lib_availability);
827  $pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
828 
829  $posy=$pdf->GetY()+1;
830  }*/
831 
832  // Show payments conditions
833  if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) {
834  $pdf->SetFont('', 'B', $default_font_size - 2);
835  $pdf->SetXY($this->marge_gauche, $posy);
836  $titre = $outputlangs->transnoentities("PaymentConditions").':';
837  $pdf->MultiCell(80, 4, $titre, 0, 'L');
838 
839  $pdf->SetFont('', '', $default_font_size - 2);
840  $pdf->SetXY($posxval, $posy);
841  $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);
842  $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
843  $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
844 
845  $posy = $pdf->GetY() + 3;
846  }
847 
848  if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) {
849  // Show payment mode
850  if ($object->mode_reglement_code
851  && $object->mode_reglement_code != 'CHQ'
852  && $object->mode_reglement_code != 'VIR') {
853  $pdf->SetFont('', 'B', $default_font_size - 2);
854  $pdf->SetXY($this->marge_gauche, $posy - 2);
855  $titre = $outputlangs->transnoentities("PaymentMode").':';
856  $pdf->MultiCell(80, 5, $titre, 0, 'L');
857  $pdf->SetFont('', '', $default_font_size - 2);
858  $pdf->SetXY($posxval, $posy - 2);
859  $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);
860  $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
861 
862  $posy = $pdf->GetY() + 2;
863  }
864 
865  // Show payment mode CHQ
866  if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
867  // Si mode reglement non force ou si force a CHQ
868  if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
869  $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
870 
871  if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
872  $account = new Account($this->db);
873  $account->fetch($conf->global->FACTURE_CHQ_NUMBER);
874 
875  $pdf->SetXY($this->marge_gauche, $posy);
876  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
877  $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
878  $posy = $pdf->GetY() + 1;
879 
880  if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
881  $pdf->SetXY($this->marge_gauche, $posy);
882  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
883  $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
884  $posy = $pdf->GetY() + 2;
885  }
886  }
887  if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
888  $pdf->SetXY($this->marge_gauche, $posy);
889  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
890  $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
891  $posy = $pdf->GetY() + 1;
892 
893  if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
894  $pdf->SetXY($this->marge_gauche, $posy);
895  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
896  $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
897  $posy = $pdf->GetY() + 2;
898  }
899  }
900  }
901  }
902 
903  // If payment mode not forced or forced to VIR, show payment with BAN
904  if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
905  if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) {
906  $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
907  $account = new Account($this->db);
908  $account->fetch($bankid);
909 
910  $curx = $this->marge_gauche;
911  $cury = $posy;
912 
913  $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
914 
915  $posy += 2;
916  }
917  }
918  }
919 
920  return $posy;
921  }
922 
923  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
924  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
935  protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
936  {
937  // phpcs:enable
938  global $conf, $mysoc;
939  $default_font_size = pdf_getPDFFontSize($outputlangs);
940 
941  $tab2_top = $posy;
942  $tab2_hl = 4;
943  $pdf->SetFont('', '', $default_font_size - 1);
944 
945  // Tableau total
946  $col1x = 120;
947  $col2x = 170;
948  if ($this->page_largeur < 210) { // To work with US executive format
949  $col2x -= 20;
950  }
951  $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
952 
953  $useborder = 0;
954  $index = 0;
955 
956  // Total HT
957  $pdf->SetFillColor(255, 255, 255);
958  $pdf->SetXY($col1x, $tab2_top + 0);
959  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
960 
961  $pdf->SetXY($col2x, $tab2_top + 0);
962  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
963 
964  // Show VAT by rates and total
965  $pdf->SetFillColor(248, 248, 248);
966 
967  $this->atleastoneratenotnull = 0;
968  if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
969  $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
970  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) {
971  // Nothing to do
972  } else {
973  //Local tax 1 before VAT
974  //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
975  //{
976  foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
977  if (in_array((string) $localtax_type, array('1', '3', '5'))) {
978  continue;
979  }
980 
981  foreach ($localtax_rate as $tvakey => $tvaval) {
982  if ($tvakey != 0) { // On affiche pas taux 0
983  //$this->atleastoneratenotnull++;
984 
985  $index++;
986  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
987 
988  $tvacompl = '';
989  if (preg_match('/\*/', $tvakey)) {
990  $tvakey = str_replace('*', '', $tvakey);
991  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
992  }
993  $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
994  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
995  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
996 
997  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
998  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
999  }
1000  }
1001  }
1002  //}
1003  //Local tax 2 before VAT
1004  //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1005  //{
1006  foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1007  if (in_array((string) $localtax_type, array('1', '3', '5'))) {
1008  continue;
1009  }
1010 
1011  foreach ($localtax_rate as $tvakey => $tvaval) {
1012  if ($tvakey != 0) { // On affiche pas taux 0
1013  //$this->atleastoneratenotnull++;
1014 
1015 
1016 
1017  $index++;
1018  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1019 
1020  $tvacompl = '';
1021  if (preg_match('/\*/', $tvakey)) {
1022  $tvakey = str_replace('*', '', $tvakey);
1023  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1024  }
1025  $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1026  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1027  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1028 
1029  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1030  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1031  }
1032  }
1033  }
1034  //}
1035  // VAT
1036  foreach ($this->tva as $tvakey => $tvaval) {
1037  if ($tvakey > 0) { // On affiche pas taux 0
1038  $this->atleastoneratenotnull++;
1039 
1040  $index++;
1041  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1042 
1043  $tvacompl = '';
1044  if (preg_match('/\*/', $tvakey)) {
1045  $tvakey = str_replace('*', '', $tvakey);
1046  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1047  }
1048  $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
1049  $totalvat .= vatrate($tvakey, 1).$tvacompl;
1050  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1051 
1052  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1053  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1054  }
1055  }
1056 
1057  //Local tax 1 after VAT
1058  //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
1059  //{
1060  foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1061  if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1062  continue;
1063  }
1064 
1065  foreach ($localtax_rate as $tvakey => $tvaval) {
1066  if ($tvakey != 0) { // On affiche pas taux 0
1067  //$this->atleastoneratenotnull++;
1068 
1069  $index++;
1070  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1071 
1072  $tvacompl = '';
1073  if (preg_match('/\*/', $tvakey)) {
1074  $tvakey = str_replace('*', '', $tvakey);
1075  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1076  }
1077  $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1078 
1079  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1080  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1081  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1082  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1083  }
1084  }
1085  }
1086  //}
1087  //Local tax 2 after VAT
1088  //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1089  //{
1090  foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1091  if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1092  continue;
1093  }
1094 
1095  foreach ($localtax_rate as $tvakey => $tvaval) {
1096  // retrieve global local tax
1097  if ($tvakey != 0) { // On affiche pas taux 0
1098  //$this->atleastoneratenotnull++;
1099 
1100  $index++;
1101  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1102 
1103  $tvacompl = '';
1104  if (preg_match('/\*/', $tvakey)) {
1105  $tvakey = str_replace('*', '', $tvakey);
1106  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1107  }
1108  $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1109 
1110  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1111  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1112 
1113  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1114  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1115  }
1116  }
1117  }
1118  //}
1119 
1120  // Total TTC
1121  $index++;
1122  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1123  $pdf->SetTextColor(0, 0, 60);
1124  $pdf->SetFillColor(224, 224, 224);
1125  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1126 
1127  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1128  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1129  }
1130  }
1131 
1132  $pdf->SetTextColor(0, 0, 0);
1133 
1134  $resteapayer = $object->total_ttc - $deja_regle;
1135  if (!empty($object->paye)) {
1136  $resteapayer = 0;
1137  }
1138 
1139  if ($deja_regle > 0) {
1140  $index++;
1141 
1142  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1143  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1144 
1145  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1146  $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
1147 
1148  /*
1149  if ($object->close_code == 'discount_vat')
1150  {
1151  $index++;
1152  $pdf->SetFillColor(255,255,255);
1153 
1154  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1155  $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
1156 
1157  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1158  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1);
1159 
1160  $resteapayer=0;
1161  }
1162  */
1163 
1164  $index++;
1165  $pdf->SetTextColor(0, 0, 60);
1166  $pdf->SetFillColor(224, 224, 224);
1167  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1168  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1169 
1170  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1171  $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
1172 
1173  $pdf->SetFont('', '', $default_font_size - 1);
1174  $pdf->SetTextColor(0, 0, 0);
1175  }
1176 
1177  $index++;
1178  return ($tab2_top + ($tab2_hl * $index));
1179  }
1180 
1181  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1195  protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1196  {
1197  global $conf;
1198 
1199  // Force to disable hidetop and hidebottom
1200  $hidebottom = 0;
1201  if ($hidetop) {
1202  $hidetop = -1;
1203  }
1204 
1205  $currency = !empty($currency) ? $currency : $conf->currency;
1206  $default_font_size = pdf_getPDFFontSize($outputlangs);
1207 
1208  // Amount in (at tab_top - 1)
1209  $pdf->SetTextColor(0, 0, 0);
1210  $pdf->SetFont('', '', $default_font_size - 2);
1211 
1212  if (empty($hidetop)) {
1213  $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1214  $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1215  $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1216 
1217  //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1218  if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1219  $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));
1220  }
1221  }
1222 
1223  $pdf->SetDrawColor(128, 128, 128);
1224  $pdf->SetFont('', '', $default_font_size - 1);
1225 
1226  // Output Rect
1227  $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
1228 
1229  if (empty($hidetop)) {
1230  $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter
1231 
1232  $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1233  $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1234  }
1235 
1236  if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
1237  $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height);
1238  //$pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height);
1239  if (empty($hidetop)) {
1240  $pdf->SetXY($this->posxtva - 5, $tab_top + 1);
1241  $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
1242  }
1243  }
1244 
1245  $pdf->line($this->posxup - 3, $tab_top, $this->posxup - 3, $tab_top + $tab_height);
1246  if (empty($hidetop)) {
1247  $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1248  $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1249  }
1250 
1251  $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1252  if (empty($hidetop)) {
1253  $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1254  $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1255  }
1256 
1257  if (!empty($conf->global->PRODUCT_USE_UNITS)) {
1258  $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1259  if (empty($hidetop)) {
1260  $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1261  $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
1262  }
1263  }
1264 
1265  $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1266  if (empty($hidetop)) {
1267  if ($this->atleastonediscount) {
1268  $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1269  $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1270  }
1271  }
1272  if ($this->atleastonediscount) {
1273  $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1274  }
1275  if (empty($hidetop)) {
1276  $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1277  $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
1278  }
1279  }
1280 
1281  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1291  protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1292  {
1293  global $conf, $langs;
1294 
1295  // Load traductions files required by page
1296  $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies"));
1297 
1298  $default_font_size = pdf_getPDFFontSize($outputlangs);
1299 
1300  pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1301 
1302  $pdf->SetTextColor(0, 0, 60);
1303  $pdf->SetFont('', 'B', $default_font_size + 3);
1304 
1305  $posy = $this->marge_haute;
1306  $posx = $this->page_largeur - $this->marge_droite - 100;
1307 
1308  $pdf->SetXY($this->marge_gauche, $posy);
1309 
1310  // Logo
1311  if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
1312  if ($this->emetteur->logo) {
1313  $logodir = $conf->mycompany->dir_output;
1314  if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1315  $logodir = $conf->mycompany->multidir_output[$object->entity];
1316  }
1317  if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
1318  $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
1319  } else {
1320  $logo = $logodir.'/logos/'.$this->emetteur->logo;
1321  }
1322  if (is_readable($logo)) {
1323  $height = pdf_getHeightForLogo($logo);
1324  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1325  } else {
1326  $pdf->SetTextColor(200, 0, 0);
1327  $pdf->SetFont('', 'B', $default_font_size - 2);
1328  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1329  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1330  }
1331  } else {
1332  $text = $this->emetteur->name;
1333  $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1334  }
1335  }
1336 
1337  $pdf->SetFont('', 'B', $default_font_size + 3);
1338  $pdf->SetXY($posx, $posy);
1339  $pdf->SetTextColor(0, 0, 60);
1340  $title = $outputlangs->transnoentities("CommercialAsk");
1341  $pdf->MultiCell(100, 4, $title, '', 'R');
1342 
1343  $pdf->SetFont('', 'B', $default_font_size);
1344 
1345  $posy += 5;
1346  $pdf->SetXY($posx, $posy);
1347  $pdf->SetTextColor(0, 0, 60);
1348  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1349 
1350  $posy += 1;
1351  $pdf->SetFont('', '', $default_font_size - 2);
1352 
1353  if ($object->ref_client) {
1354  $posy += 4;
1355  $pdf->SetXY($posx, $posy);
1356  $pdf->SetTextColor(0, 0, 60);
1357  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
1358  }
1359  /* PHFAVRE
1360  $posy+=4;
1361  $pdf->SetXY($posx,$posy);
1362  $pdf->SetTextColor(0,0,60);
1363  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R');
1364  */
1365 
1366  if ($object->thirdparty->code_fournisseur) {
1367  $posy += 4;
1368  $pdf->SetXY($posx, $posy);
1369  $pdf->SetTextColor(0, 0, 60);
1370  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
1371  }
1372 
1373  // Get contact
1374  if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1375  $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1376  if (count($arrayidcontact) > 0) {
1377  $usertmp = new User($this->db);
1378  $usertmp->fetch($arrayidcontact[0]);
1379  $posy += 4;
1380  $pdf->SetXY($posx, $posy);
1381  $pdf->SetTextColor(0, 0, 60);
1382  $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
1383  }
1384  }
1385 
1386  $posy += 2;
1387 
1388  $top_shift = 0;
1389  // Show list of linked objects
1390  $current_y = $pdf->getY();
1391  $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1392  if ($current_y < $pdf->getY()) {
1393  $top_shift = $pdf->getY() - $current_y;
1394  }
1395 
1396  if ($showaddress) {
1397  // Sender properties
1398  $carac_emetteur = '';
1399  // Add internal contact of proposal if defined
1400  $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1401  if (count($arrayidcontact) > 0) {
1402  $object->fetch_user($arrayidcontact[0]);
1403  $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
1404  $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
1405  }
1406 
1407  $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1408 
1409  // Show sender
1410  $posy = 42 + $top_shift;
1411  $posx = $this->marge_gauche;
1412  if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1413  $posx = $this->page_largeur - $this->marge_droite - 80;
1414  }
1415  $hautcadre = 40;
1416 
1417  // Show sender frame
1418  $pdf->SetTextColor(0, 0, 0);
1419  $pdf->SetFont('', '', $default_font_size - 2);
1420  $pdf->SetXY($posx, $posy - 5);
1421  $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
1422  $pdf->SetXY($posx, $posy);
1423  $pdf->SetFillColor(230, 230, 230);
1424  $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
1425  $pdf->SetTextColor(0, 0, 60);
1426 
1427  // Show sender name
1428  $pdf->SetXY($posx + 2, $posy + 3);
1429  $pdf->SetFont('', 'B', $default_font_size);
1430  $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1431  $posy = $pdf->getY();
1432 
1433  // Show sender information
1434  $pdf->SetXY($posx + 2, $posy);
1435  $pdf->SetFont('', '', $default_font_size - 1);
1436  $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1437 
1438 
1439  // If CUSTOMER contact defined, we use it
1440  $usecontact = false;
1441  $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1442  if (count($arrayidcontact) > 0) {
1443  $usecontact = true;
1444  $result = $object->fetch_contact($arrayidcontact[0]);
1445  }
1446 
1447  // Recipient name
1448  if (!empty($usecontact)) {
1449  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)))) {
1450  $socname = $object->contact;
1451  } else {
1452  $socname = $object->thirdparty;
1453  }
1454  } else {
1455  $socname = $object->thirdparty;
1456  }
1457 
1458  $carac_client_name = pdfBuildThirdpartyName($socname, $outputlangs);
1459 
1460  $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
1461 
1462  // Show recipient
1463  $widthrecbox = 100;
1464  if ($this->page_largeur < 210) {
1465  $widthrecbox = 84; // To work with US executive format
1466  }
1467  $posy = 42 + $top_shift;
1468  $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1469  if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1470  $posx = $this->marge_gauche;
1471  }
1472 
1473  // Show recipient frame
1474  $pdf->SetTextColor(0, 0, 0);
1475  $pdf->SetFont('', '', $default_font_size - 2);
1476  $pdf->SetXY($posx + 2, $posy - 5);
1477  $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
1478  $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1479 
1480  // Show recipient name
1481  $pdf->SetXY($posx + 2, $posy + 3);
1482  $pdf->SetFont('', 'B', $default_font_size);
1483  $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1484 
1485  // Show recipient information
1486  $pdf->SetFont('', '', $default_font_size - 1);
1487  $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4));
1488  $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1489  }
1490 
1491  $pdf->SetTextColor(0, 0, 0);
1492  return $top_shift;
1493  }
1494 
1495  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1505  protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1506  {
1507  global $conf;
1508  $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1509  return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
1510  }
1511 }
dol_nboflines_bis
dol_nboflines_bis($text, $maxlinesize=0, $charset='UTF-8')
Return nb of lines of a formated text with and (WARNING: string must not have mixed and br sepa...
Definition: functions.lib.php:7142
make_substitutions
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Definition: functions.lib.php:7839
getLocalTaxesFromRate
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
Definition: functions.lib.php:6097
db
$conf db
API class for accounts.
Definition: inc.php:41
pdf_getSizeForImage
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
Definition: pdf.lib.php:2474
pdf_getlineqty
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
Definition: pdf.lib.php:1931
pdf_aurore\__construct
__construct($db)
Constructor.
Definition: pdf_aurore.modules.php:125
dol_trunc
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
Definition: functions.lib.php:3805
pdf_writelinedesc
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
Definition: pdf.lib.php:1345
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1226
description
print *****$script_file(".$version.") pid cd cd cd description as description
Definition: email_expire_services_to_customers.php:83
pdf_getFormat
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition: pdf.lib.php:84
pdf_getInstance
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:126
pdf_aurore\_pagehead
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
Definition: pdf_aurore.modules.php:1291
pdf_getPDFFont
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition: pdf.lib.php:265
pdf_getlineunit
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
Definition: pdf.lib.php:2092
pdf_aurore\_tableau_tot
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
Definition: pdf_aurore.modules.php:935
name
$conf db name
Definition: repair.php:122
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
dol_concatdesc
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...
Definition: functions.lib.php:7248
pdfBuildThirdpartyName
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
Definition: pdf.lib.php:386
pdf_pagehead
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition: pdf.lib.php:711
get_exdir
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
Definition: functions.lib.php:6549
pdf_aurore\_tableau_info
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
Definition: pdf_aurore.modules.php:779
pdf_bank
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank informations for PDF generation.
Definition: pdf.lib.php:812
pdf_aurore\_tableau
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
Definition: pdf_aurore.modules.php:1195
pdf_getHeightForLogo
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition: pdf.lib.php:313
CommonDocGenerator\printRect
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Definition: commondocgenerator.class.php:977
pdf_writeLinkedObjects
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition: pdf.lib.php:1309
pdf_build_address
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
Definition: pdf.lib.php:427
convertBackOfficeMediasLinksToPublicLinks
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...
Definition: functions2.lib.php:2711
pdf_aurore\_tableau_versements
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
Definition: pdf_aurore.modules.php:763
pdf_aurore\_pagefoot
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Definition: pdf_aurore.modules.php:1505
User
Class to manage Dolibarr users.
Definition: user.class.php:44
pdf_aurore\write_file
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
Definition: pdf_aurore.modules.php:216
Product
Class to manage products or services.
Definition: product.class.php:46
dol_htmlentitiesbr
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...
Definition: functions.lib.php:6991
pdf_getPDFFontSize
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition: pdf.lib.php:288
pdf_getSubstitutionArray
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
Definition: pdf.lib.php:737
price
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.
Definition: functions.lib.php:5541
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6603
ModelePDFSupplierProposal
Classe mere des modeles de propale.
Definition: modules_supplier_proposal.php:37
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119
pdf_aurore
Class to generate PDF supplier proposal Aurore.
Definition: pdf_aurore.modules.php:39
Account
Class to manage bank accounts.
Definition: account.class.php:38
HookManager
Class to manage hooks.
Definition: hookmanager.class.php:30
complete_substitutions_array
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...
Definition: functions.lib.php:7961
vatrate
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
Definition: functions.lib.php:5492
pdf_pagefoot
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.
Definition: pdf.lib.php:989
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25