dolibarr 25.0.0-alpha
pdf_aurore.modules.php
Go to the documentation of this file.
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 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Nick Fragoulis
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 * or see https://www.gnu.org/
25 */
26
32require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_proposal/modules_supplier_proposal.php';
33require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
37
38
43{
47 public $db;
48
52 public $name;
53
57 public $description;
58
62 public $update_main_doc_field;
63
67 public $type;
68
73 public $version = 'dolibarr';
74
75
81 public function __construct($db)
82 {
83 global $conf, $langs, $mysoc;
84
85 // Translations
86 $langs->loadLangs(array("main", "bills"));
87
88 $this->db = $db;
89 $this->name = "aurore";
90 $this->description = $langs->trans('DocModelAuroreDescription');
91 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
92
93 // Page size for A4 format
94 $this->type = 'pdf';
95 $formatarray = pdf_getFormat();
96 $this->page_largeur = $formatarray['width'];
97 $this->page_hauteur = $formatarray['height'];
98 $this->format = array($this->page_largeur, $this->page_hauteur);
99 $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
100 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
101 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
102 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
103 $this->corner_radius = getDolGlobalInt('MAIN_PDF_FRAME_CORNER_RADIUS', 0);
104 $this->option_logo = 1; // Display logo
105 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
106 $this->option_modereg = 1; // Display payment mode
107 $this->option_condreg = 1; // Display payment terms
108 $this->option_multilang = 1; // Available in several languages
109 $this->option_escompte = 1; // Displays if there has been a discount
110 $this->option_credit_note = 1; // Support credit notes
111 $this->option_freetext = 1; // Support add of a personalised text
112 $this->option_draft_watermark = 1; //Support add of a watermark on drafts
113 $this->watermark = '';
114
115 // Define position of columns
116 $this->posxdesc = $this->marge_gauche + 1;
117
118 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
119 //$this->posxtva = 101;
120 $this->posxup = 112;
121 $this->posxqty = 135;
122 $this->posxunit = 151;
123 } else {
124 //$this->posxtva = 106;
125 $this->posxup = 122;
126 $this->posxqty = 145;
127 $this->posxunit = 162;
128 }
129 $this->posxdiscount = 162;
130 $this->postotalht = 174;
131
132 $this->posxpicture = $this->posxup - getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20); // width of images
133 if ($this->page_largeur < 210) { // To work with US executive format
134 $this->posxpicture -= 20;
135 $this->posxup -= 20;
136 $this->posxqty -= 20;
137 $this->posxunit -= 20;
138 $this->posxdiscount -= 20;
139 $this->postotalht -= 20;
140 }
141
142 $this->tva = array();
143 $this->tva_array = array();
144 $this->localtax1 = array();
145 $this->localtax2 = array();
146 $this->atleastoneratenotnull = 0;
147 $this->atleastonediscount = 0;
148
149 if ($mysoc === null) {
150 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
151 return;
152 }
153
154 // Get source company
155 $this->emetteur = $mysoc;
156 if (empty($this->emetteur->country_code)) {
157 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
158 }
159 }
160
161 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
173 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
174 {
175 // phpcs:enable
176 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
177
178 if (!is_object($outputlangs)) {
179 $outputlangs = $langs;
180 }
181 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
182 if (getDolGlobalString('MAIN_USE_FPDF')) {
183 $outputlangs->charset_output = 'ISO-8859-1';
184 }
185
186 // Load traductions files required by page
187 $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal"));
188
189 // Show Draft Watermark
190 if ($object->status == $object::STATUS_DRAFT && (getDolGlobalString('SUPPLIER_PROPOSAL_DRAFT_WATERMARK'))) {
191 $this->watermark = getDolGlobalString('SUPPLIER_PROPOSAL_DRAFT_WATERMARK');
192 }
193
194 $nblines = count($object->lines);
195
196 // Loop on each lines to detect if there is at least one image to show
197 $realpatharray = array();
198 if (getDolGlobalString('MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE')) {
199 for ($i = 0; $i < $nblines; $i++) {
200 if (empty($object->lines[$i]->fk_product)) {
201 continue;
202 }
203
204 $objphoto = new Product($this->db);
205 $objphoto->fetch($object->lines[$i]->fk_product);
206
207 if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
208 $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
209 $dir = $conf->product->dir_output.'/'.$pdir;
210 } else {
211 $pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product');
212 $dir = $conf->product->dir_output.'/'.$pdir;
213 }
214
215 $realpath = '';
216 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
217 if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
218 if ($obj['photo_vignette']) {
219 $filename = $obj['photo_vignette'];
220 } else {
221 $filename = $obj['photo'];
222 }
223 } else {
224 $filename = $obj['photo'];
225 }
226 $realpath = $dir.$filename;
227 break;
228 }
229
230 if ($realpath) {
231 $realpatharray[$i] = $realpath;
232 }
233 }
234 }
235 if (count($realpatharray) == 0) {
236 $this->posxpicture = $this->posxup;
237 }
238
239 if ($conf->supplier_proposal->dir_output) {
240 $object->fetch_thirdparty();
241
242 // $deja_regle = 0;
243
244 // Definition of $dir and $file
245 if ($object->specimen) {
246 $dir = $conf->supplier_proposal->dir_output;
247 $file = $dir."/SPECIMEN.pdf";
248 } else {
249 $objectref = dol_sanitizeFileName($object->ref);
250 $dir = $conf->supplier_proposal->dir_output."/".$objectref;
251 $file = $dir."/".$objectref.".pdf";
252 }
253
254 if (!file_exists($dir)) {
255 if (dol_mkdir($dir) < 0) {
256 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
257 return 0;
258 }
259 }
260
261 if (file_exists($dir)) {
262 // Add pdfgeneration hook
263 if (!is_object($hookmanager)) {
264 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
265 $hookmanager = new HookManager($this->db);
266 }
267 $hookmanager->initHooks(array('pdfgeneration'));
268 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
269 global $action;
270 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
271
272 // Create pdf instance
273 $pdf = pdf_getInstance($this->format);
274 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
275 $heightforinfotot = 50; // Height reserved to output the info and total part
276 $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
277 $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
278 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
279 $heightforfooter += 6;
280 }
281 $pdf->setAutoPageBreak(true, 0);
282
283 if (class_exists('TCPDF')) {
284 $pdf->setPrintHeader(false);
285 $pdf->setPrintFooter(false);
286 }
287 $pdf->SetFont(pdf_getPDFFont($outputlangs));
288 // Set path to the background PDF File
289 if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
290 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
291 $tplidx = $pdf->importPage(1);
292 }
293
294 $pdf->Open();
295 $pagenb = 0;
296 $pdf->SetDrawColor(128, 128, 128);
297
298 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
299 $pdf->SetSubject($outputlangs->transnoentities("CommercialAsk"));
300 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
301 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
302 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
303 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
304 $pdf->SetCompression(false);
305 }
306
307 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
308 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
309
310 // Set $this->atleastonediscount if there is at least one discount
311 for ($i = 0; $i < $nblines; $i++) {
312 if ($object->lines[$i]->remise_percent) {
313 $this->atleastonediscount++;
314 }
315 }
316 if (empty($this->atleastonediscount)) {
317 $delta = ($this->postotalht - $this->posxdiscount);
318 $this->posxpicture += $delta;
319 $this->posxup += $delta;
320 $this->posxqty += $delta;
321 $this->posxunit += $delta;
322 $this->posxdiscount += $delta;
323 // post of fields after are not modified, stay at same position
324 }
325
326 // New page
327 $pdf->AddPage();
328 if (!empty($tplidx)) {
329 $pdf->useTemplate($tplidx);
330 }
331 $pagenb++;
332 $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
333 $pdf->SetFont('', '', $default_font_size - 1);
334 $pdf->MultiCell(0, 3, ''); // Set interline to 3
335 $pdf->SetTextColor(0, 0, 0);
336
337 $tab_top = 80 + $this->marge_haute + $top_shift;
338 $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 32 + $this->marge_haute + $top_shift : $this->marge_haute);
339
340 // Affiche notes
341 $notetoshow = empty($object->note_public) ? '' : $object->note_public;
342 if (getDolGlobalString('MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE')) {
343 // Get first sale rep
344 if (is_object($object->thirdparty)) {
345 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
346 $salerepobj = new User($this->db);
347 $salerepobj->fetch($salereparray[0]['id']);
348 if (!empty($salerepobj->signature)) {
349 $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
350 }
351 }
352 }
353
354 // Extrafields in note
355 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
356 if (!empty($extranote)) {
357 $notetoshow = dol_concatdesc((string) $notetoshow, $extranote);
358 }
359
360 if ($notetoshow) {
361 $tab_top -= 2;
362
363 $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
364 complete_substitutions_array($substitutionarray, $outputlangs, $object);
365 $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
366 $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
367
368 $pdf->SetFont('', '', $default_font_size - 1);
369 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1);
370 $nexY = $pdf->GetY();
371 $height_note = $nexY - $tab_top;
372
373 // Rect takes a length in 3rd parameter
374 $pdf->SetDrawColor(192, 192, 192);
375 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius, '1234', 'D');
376
377 $tab_top = $nexY + 6;
378 }
379
380 $iniY = $tab_top + 7;
381 $curY = $tab_top + 7;
382 $nexY = $tab_top + 7;
383
384 // Loop on each lines
385 for ($i = 0; $i < $nblines; $i++) {
386 $curY = $nexY;
387 $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
388 $pdf->SetTextColor(0, 0, 0);
389
390 // Define size of image if we need it
391 $imglinesize = array();
392 if (!empty($realpatharray[$i])) {
393 $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
394 }
395
396 $pdf->setTopMargin($tab_top_newpage);
397 $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
398 $pageposbefore = $pdf->getPage();
399
400 $showpricebeforepagebreak = 1;
401 $posYAfterImage = 0;
402 $posYAfterDescription = 0;
403
404 // We start with Photo of product line
405 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
406 $pdf->AddPage('', '', true);
407 if (!empty($tplidx)) {
408 $pdf->useTemplate($tplidx);
409 }
410 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
411 $this->_pagehead($pdf, $object, 0, $outputlangs);
412 }
413 $pdf->setPage($pageposbefore + 1);
414
415 $curY = $tab_top_newpage;
416
417 // Allows data in the first page if description is long enough to break in multiples pages
418 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
419 $showpricebeforepagebreak = 1;
420 } else {
421 $showpricebeforepagebreak = 0;
422 }
423 }
424
425 if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
426 $curX = $this->posxpicture - 1;
427 $pdf->Image($realpatharray[$i], $curX + (($this->posxup - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
428 // $pdf->Image does not increase value return by getY, so we save it manually
429 $posYAfterImage = $curY + $imglinesize['height'];
430 }
431
432 // Description of product line
433 $curX = $this->posxdesc - 1;
434
435 $pdf->startTransaction();
436 if ($posYAfterImage > 0) {
437 $descWidth = $this->posxpicture - $curX;
438 } else {
439 $descWidth = $this->posxup - $curX;
440 }
441 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
442
443 $pageposafter = $pdf->getPage();
444 if ($pageposafter > $pageposbefore) { // There is a pagebreak
445 $pdf->rollbackTransaction(true);
446 $pageposafter = $pageposbefore;
447 //print $pageposafter.'-'.$pageposbefore;exit;
448 $pdf->setPageOrientation('', true, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
449 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
450
451 $pageposafter = $pdf->getPage();
452 $posyafter = $pdf->GetY();
453 //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
454 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
455 if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
456 $pdf->AddPage('', '', true);
457 if (!empty($tplidx)) {
458 $pdf->useTemplate($tplidx);
459 }
460 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
461 $this->_pagehead($pdf, $object, 0, $outputlangs);
462 }
463 $pdf->setPage($pageposafter + 1);
464 }
465 } else {
466 // We found a page break
467 // Allows data in the first page if description is long enough to break in multiples pages
468 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
469 $showpricebeforepagebreak = 1;
470 } else {
471 $showpricebeforepagebreak = 0;
472 }
473 }
474 } else { // No pagebreak
475 $pdf->commitTransaction();
476 }
477 $posYAfterDescription = $pdf->GetY();
478
479 $nexY = $pdf->GetY();
480 $pageposafter = $pdf->getPage();
481
482 $pdf->setPage($pageposbefore);
483 $pdf->setTopMargin($this->marge_haute);
484 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
485
486 // We suppose that a too long description or photo were moved completely on next page
487 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
488 $pdf->setPage($pageposafter);
489 $curY = $tab_top_newpage;
490 }
491
492 $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default
493
494 // Quantity
495 $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
496 $pdf->SetXY($this->posxqty, $curY);
497 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
498
499 // Unit
500 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
501 $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails);
502 $pdf->SetXY($this->posxunit, $curY);
503 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L');
504 }
505
506 // Discount on line
507 /*
508 if ($object->lines[$i]->remise_percent)
509 {
510 $pdf->SetXY($this->posxdiscount-2, $curY);
511 $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
512 $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
513 }
514
515 // Total HT line
516 $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
517 $pdf->SetXY($this->postotalht, $curY);
518 if ($total_excl_tax > 0)
519 $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
520 */
521
522 // // Collect total by value of vat rate into $this->tva["taux"]=total_tva
523 if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
524 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
525 } else {
526 $tvaligne = $object->lines[$i]->total_tva;
527 }
528
529 $localtax1ligne = $object->lines[$i]->total_localtax1;
530 $localtax2ligne = $object->lines[$i]->total_localtax2;
531 $localtax1_rate = $object->lines[$i]->localtax1_tx;
532 $localtax2_rate = $object->lines[$i]->localtax2_tx;
533 $localtax1_type = $object->lines[$i]->localtax1_type;
534 $localtax2_type = $object->lines[$i]->localtax2_type;
535
536 $vatrate = (string) $object->lines[$i]->tva_tx;
537
538 // Retrieve type from database for backward compatibility with old records
539 if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
540 && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
541 $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
542 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
543 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
544 }
545
546 // retrieve global local tax
547 if ($localtax1_type && $localtax1ligne != 0) {
548 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
549 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
550 } else {
551 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
552 }
553 }
554 if ($localtax2_type && $localtax2ligne != 0) {
555 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
556 $this->localtax2[$localtax2_type][$localtax2_rate] = (float) $localtax2ligne;
557 } else {
558 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
559 }
560 }
561
562 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
563 $vatrate .= '*';
564 }
565
566 // Fill $this->tva and $this->tva_array
567 if (!isset($this->tva[$vatrate])) {
568 $this->tva[$vatrate] = 0;
569 }
570 $this->tva[$vatrate] += $tvaligne;
571 $vatcode = $object->lines[$i]->vat_src_code;
572 if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
573 $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
574 }
575 $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
576
577 if ($posYAfterImage > $posYAfterDescription) {
578 $nexY = $posYAfterImage;
579 }
580
581 // Add line
582 if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
583 $pdf->setPage($pageposafter);
584 $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
585 //$pdf->SetDrawColor(190,190,200);
586 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
587 $pdf->SetLineStyle(array('dash' => 0));
588 }
589
590 $nexY += 2; // Add space between lines
591
592 // Detect if some page were added automatically and output _tableau for past pages
593 while ($pagenb < $pageposafter) {
594 $pdf->setPage($pagenb);
595 if ($pagenb == 1) {
596 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
597 } else {
598 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
599 }
600 $this->_pagefoot($pdf, $object, $outputlangs, 1);
601 $pagenb++;
602 $pdf->setPage($pagenb);
603 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
604 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
605 $this->_pagehead($pdf, $object, 0, $outputlangs);
606 }
607 if (!empty($tplidx)) {
608 $pdf->useTemplate($tplidx);
609 }
610 }
611 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { // @phan-suppress-current-line PhanUndeclaredProperty
612 if ($pagenb == 1) {
613 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
614 } else {
615 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
616 }
617 $this->_pagefoot($pdf, $object, $outputlangs, 1);
618 // New page
619 $pdf->AddPage();
620 if (!empty($tplidx)) {
621 $pdf->useTemplate($tplidx);
622 }
623 $pagenb++;
624 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
625 $this->_pagehead($pdf, $object, 0, $outputlangs);
626 }
627 }
628 }
629
630 // Show square
631 if ($pagenb == 1) {
632 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
633 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
634 } else {
635 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
636 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
637 }
638
639 // Affiche zone infos
640 $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
641
642 // Affiche zone totaux
643 //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
644
645 // Affiche zone versements
646 /*
647 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
648 {
649 $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
650 }
651 */
652
653 // Pied de page
654 $this->_pagefoot($pdf, $object, $outputlangs);
655 if (method_exists($pdf, 'AliasNbPages')) {
656 $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
657 }
658
659 $pdf->Close();
660
661 $pdf->Output($file, 'F');
662
663 //Add pdfgeneration hook
664 $hookmanager->initHooks(array('pdfgeneration'));
665 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
666 global $action;
667 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
668 $this->warnings = $hookmanager->warnings;
669 if ($reshook < 0) {
670 $this->error = $hookmanager->error;
671 $this->errors = $hookmanager->errors;
672 dolChmod($file);
673 return -1;
674 }
675
676 dolChmod($file);
677
678 $this->result = array('fullpath' => $file);
679
680 return 1; // No error
681 } else {
682 $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
683 return 0;
684 }
685 } else {
686 $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR");
687 return 0;
688 }
689 }
690
691 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
692 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
702 protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
703 {
704 // phpcs:enable
705 return 1;
706 }
707
708 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
709 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
719 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
720 {
721 // phpcs:enable
722 global $conf;
723 $default_font_size = pdf_getPDFFontSize($outputlangs);
724
725 $diffsizetitle = getDolGlobalInt('PDF_DIFFSIZE_TITLE', 3);
726
727 $pdf->SetFont('', '', $default_font_size - 1);
728
729 $posxval = 52;
730
731 // Show shipping date
732 if (!empty($object->delivery_date)) {
733 $outputlangs->load("sendings");
734 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
735 $pdf->SetXY($this->marge_gauche, $posy);
736 $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
737 $pdf->MultiCell(80, 4, $titre, 0, 'L');
738 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
739 $pdf->SetXY($posxval, $posy);
740 $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
741 $pdf->MultiCell(80, 4, $dlp, 0, 'L');
742
743 $posy = $pdf->GetY() + 1;
744 } else {
745 $outputlangs->load("sendings");
746 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
747 $pdf->SetXY($this->marge_gauche, $posy);
748 $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
749 $pdf->MultiCell(80, 4, $titre, 0, 'L');
750 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
751 $pdf->SetXY($posxval, $posy);
752 //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true);
753 $pdf->MultiCell(80, 4, '', 0, 'L');
754
755 $posy = $pdf->GetY() + 1;
756 }
757 /*
758 elseif ($object->availability_code || $object->availability) // Show availability conditions
759 {
760 $pdf->SetFont('','B', $default_font_size - 2);
761 $pdf->SetXY($this->marge_gauche, $posy);
762 $titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
763 $pdf->MultiCell(80, 4, $titre, 0, 'L');
764 $pdf->SetTextColor(0,0,0);
765 $pdf->SetFont('','', $default_font_size - 2);
766 $pdf->SetXY($posxval, $posy);
767 $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset($object->availability);
768 $lib_availability=str_replace('\n',"\n",$lib_availability);
769 $pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
770
771 $posy=$pdf->GetY()+1;
772 }*/
773
774 // Show payments conditions
775 if (!getDolGlobalString('SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND') && ($object->cond_reglement_code || $object->cond_reglement)) {
776 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
777 $pdf->SetXY($this->marge_gauche, $posy);
778 $titre = $outputlangs->transnoentities("PaymentConditions").':';
779 $pdf->MultiCell(80, 4, $titre, 0, 'L');
780
781 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
782 $pdf->SetXY($posxval, $posy);
783 $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);
784 $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
785 if ($object->deposit_percent > 0) {
786 $lib_condition_paiement = str_replace('__DEPOSIT_PERCENT__', $object->deposit_percent, $lib_condition_paiement);
787 }
788 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
789
790 $posy = $pdf->GetY() + 3;
791 }
792
793 if (getDolGlobalString('SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE')) {
794 // Show payment mode
795 if ($object->mode_reglement_code
796 && $object->mode_reglement_code != 'CHQ'
797 && $object->mode_reglement_code != 'VIR') {
798 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
799 $pdf->SetXY($this->marge_gauche, $posy - 2);
800 $titre = $outputlangs->transnoentities("PaymentMode").':';
801 $pdf->MultiCell(80, 5, $titre, 0, 'L');
802 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
803 $pdf->SetXY($posxval, $posy - 2);
804 $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);
805 $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
806
807 $posy = $pdf->GetY() + 2;
808 }
809
810 // Show payment mode CHQ
811 if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
812 // Si mode reglement non force ou si force a CHQ
813 if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) {
814 if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) {
815 $account = new Account($this->db);
816 $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER'));
817
818 $pdf->SetXY($this->marge_gauche, $posy);
819 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
820 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->owner_name), 0, 'L', false);
821 $posy = $pdf->GetY() + 1;
822
823 if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) {
824 $pdf->SetXY($this->marge_gauche, $posy);
825 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
826 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', false);
827 $posy = $pdf->GetY() + 2;
828 }
829 }
830 if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) {
831 $pdf->SetXY($this->marge_gauche, $posy);
832 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
833 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', false);
834 $posy = $pdf->GetY() + 1;
835
836 if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) {
837 $pdf->SetXY($this->marge_gauche, $posy);
838 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
839 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', false);
840 $posy = $pdf->GetY() + 2;
841 }
842 }
843 }
844 }
845
846 // If payment mode not forced or forced to VIR, show payment with BAN
847 if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
848 if (!empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) {
849 $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
850 $account = new Account($this->db);
851 $account->fetch($bankid);
852
853 $curx = $this->marge_gauche;
854 $cury = $posy;
855
856 $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
857
858 $posy += 2;
859 }
860 }
861 }
862
863 return $posy;
864 }
865
866 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
867 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
878 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
879 {
880 // phpcs:enable
881 global $conf, $mysoc;
882 $default_font_size = pdf_getPDFFontSize($outputlangs);
883
884 $tab2_top = $posy;
885 $tab2_hl = 4;
886 $pdf->SetFont('', '', $default_font_size - 1);
887
888 // Tableau total
889 $col1x = 120;
890 $col2x = 170;
891 if ($this->page_largeur < 210) { // To work with US executive format
892 $col2x -= 20;
893 }
894 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
895
896 $useborder = 0;
897 $index = 0;
898
899 // Total HT
900 $pdf->SetFillColor(255, 255, 255);
901 $pdf->SetXY($col1x, $tab2_top);
902 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', true);
903
904 $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
905 $pdf->SetXY($col2x, $tab2_top);
906 $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', true);
907
908 // Show VAT by rates and total
909 $pdf->SetFillColor(248, 248, 248);
910
911 $this->atleastoneratenotnull = 0;
912 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) {
913 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000']));
914 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) {
915 // Nothing to do
916 } else {
917 //Local tax 1 before VAT
918 //if (getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') && getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == 'localtax1on')
919 //{
920 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
921 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
922 continue;
923 }
924
925 foreach ($localtax_rate as $tvakey => $tvaval) {
926 if ($tvakey != 0) { // On affiche pas taux 0
927 //$this->atleastoneratenotnull++;
928
929 $index++;
930 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
931
932 $tvacompl = '';
933 if (preg_match('/\*/', $tvakey)) {
934 $tvakey = str_replace('*', '', $tvakey);
935 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
936 }
937 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
938 $totalvat .= vatrate((string) abs((float) $tvakey), true).$tvacompl;
939 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
940
941 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
942 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', true);
943 }
944 }
945 }
946 //}
947 //Local tax 2 before VAT
948 //if (getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') && getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == 'localtax2on')
949 //{
950 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
951 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
952 continue;
953 }
954
955 foreach ($localtax_rate as $tvakey => $tvaval) {
956 if ($tvakey != 0) { // On affiche pas taux 0
957 //$this->atleastoneratenotnull++;
958
959
960
961 $index++;
962 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
963
964 $tvacompl = '';
965 if (preg_match('/\*/', $tvakey)) {
966 $tvakey = str_replace('*', '', $tvakey);
967 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
968 }
969 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
970 $totalvat .= vatrate((string) abs((float) $tvakey), true).$tvacompl;
971 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
972
973 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
974 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', true);
975 }
976 }
977 }
978 //}
979 // VAT
980 foreach ($this->tva as $tvakey => $tvaval) {
981 if ($tvakey > 0) { // On affiche pas taux 0
982 $this->atleastoneratenotnull++;
983
984 $index++;
985 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
986
987 $tvacompl = '';
988 if (preg_match('/\*/', $tvakey)) {
989 $tvakey = str_replace('*', '', $tvakey);
990 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
991 }
992 $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
993 $totalvat .= vatrate($tvakey, true).$tvacompl;
994 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
995
996 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
997 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', true);
998 }
999 }
1000
1001 //Local tax 1 after VAT
1002 //if (getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') && getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == 'localtax1on')
1003 //{
1004 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1005 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1006 continue;
1007 }
1008
1009 foreach ($localtax_rate as $tvakey => $tvaval) {
1010 if ($tvakey != 0) { // On affiche pas taux 0
1011 //$this->atleastoneratenotnull++;
1012
1013 $index++;
1014 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1015
1016 $tvacompl = '';
1017 if (preg_match('/\*/', $tvakey)) {
1018 $tvakey = str_replace('*', '', $tvakey);
1019 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1020 }
1021 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1022
1023 $totalvat .= vatrate((string) abs((float) $tvakey), true).$tvacompl;
1024 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
1025 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1026 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', true);
1027 }
1028 }
1029 }
1030 //}
1031 //Local tax 2 after VAT
1032 //if (getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') && getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == 'localtax2on')
1033 //{
1034 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1035 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1036 continue;
1037 }
1038
1039 foreach ($localtax_rate as $tvakey => $tvaval) {
1040 // retrieve global local tax
1041 if ($tvakey != 0) { // On affiche pas taux 0
1042 //$this->atleastoneratenotnull++;
1043
1044 $index++;
1045 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1046
1047 $tvacompl = '';
1048 if (preg_match('/\*/', $tvakey)) {
1049 $tvakey = str_replace('*', '', $tvakey);
1050 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1051 }
1052 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1053
1054 $totalvat .= vatrate((string) abs((float) $tvakey), true).$tvacompl;
1055 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
1056
1057 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1058 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', true);
1059 }
1060 }
1061 }
1062 //}
1063
1064 // Total TTC
1065 $index++;
1066 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1067 $pdf->SetTextColor(0, 0, 60);
1068 $pdf->SetFillColor(224, 224, 224);
1069 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', true);
1070
1071 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1072 $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', true);
1073 }
1074 }
1075
1076 $pdf->SetTextColor(0, 0, 0);
1077
1078 $resteapayer = $object->total_ttc - $deja_regle;
1079 if (!empty($object->paye)) {
1080 $resteapayer = 0;
1081 }
1082
1083 if ($deja_regle > 0) {
1084 $index++;
1085
1086 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1087 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', false);
1088
1089 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1090 $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', false);
1091
1092 $index++;
1093 $pdf->SetTextColor(0, 0, 60);
1094 $pdf->SetFillColor(224, 224, 224);
1095 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1096 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', true);
1097
1098 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1099 $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', true);
1100
1101 $pdf->SetFont('', '', $default_font_size - 1);
1102 $pdf->SetTextColor(0, 0, 0);
1103 }
1104
1105 $index++;
1106 return ($tab2_top + ($tab2_hl * $index));
1107 }
1108
1109 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1123 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1124 {
1125 global $conf;
1126
1127 // Force to disable hidetop and hidebottom
1128 $hidebottom = 0;
1129 if ($hidetop) {
1130 $hidetop = -1;
1131 }
1132
1133 $currency = !empty($currency) ? $currency : $conf->currency;
1134 $default_font_size = pdf_getPDFFontSize($outputlangs);
1135
1136 // Amount in (at tab_top - 1)
1137 $pdf->SetTextColor(0, 0, 0);
1138 $pdf->SetFont('', '', $default_font_size - 2);
1139
1140 if (empty($hidetop)) {
1141 $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1142 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1143 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1144
1145 //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1146 if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
1147 $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1148 }
1149 }
1150
1151 $pdf->SetDrawColor(128, 128, 128);
1152 $pdf->SetFont('', '', $default_font_size - 1);
1153
1154 // Output Rect
1155 $this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect takes a length in 3rd parameter and 4th parameter
1156
1157 if (empty($hidetop)) {
1158 $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
1159
1160 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1161 $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1162 }
1163
1164 $pdf->line($this->posxup + 1, $tab_top, $this->posxup + 1, $tab_top + $tab_height);
1165 if (empty($hidetop)) {
1166 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1167 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1168 }
1169
1170 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1171 if (empty($hidetop)) {
1172 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1173 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1174 }
1175
1176 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
1177 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1178 if (empty($hidetop)) {
1179 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1180 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
1181 }
1182 }
1183
1184 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1185 if (empty($hidetop)) {
1186 if ($this->atleastonediscount) {
1187 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1188 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1189 }
1190 }
1191 if ($this->atleastonediscount) {
1192 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1193 }
1194 if (empty($hidetop)) {
1195 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1196 $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
1197 }
1198 }
1199
1200 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1210 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1211 {
1212 global $conf, $langs;
1213 '@phan-var-force SupplierProposal $object';
1214
1215 // Load traductions files required by page
1216 $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies"));
1217
1218 $default_font_size = pdf_getPDFFontSize($outputlangs);
1219
1220 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1221
1222 $pdf->SetTextColor(0, 0, 60);
1223 $pdf->SetFont('', 'B', $default_font_size + 3);
1224
1225 $posy = $this->marge_haute;
1226 $posx = $this->page_largeur - $this->marge_droite - 100;
1227
1228 $pdf->SetXY($this->marge_gauche, $posy);
1229
1230 // Logo
1231 $logodir = $conf->mycompany->dir_output;
1232 if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
1233 $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity];
1234 }
1235 pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, 100, $default_font_size, 'J');
1236
1237 $pdf->SetFont('', 'B', $default_font_size + 3);
1238 $pdf->SetXY($posx, $posy);
1239 $pdf->SetTextColor(0, 0, 60);
1240 $title = $outputlangs->transnoentities("CommercialAsk");
1241 $pdf->MultiCell(100, 4, $title, '', 'R');
1242
1243 $pdf->SetFont('', 'B', $default_font_size);
1244
1245 $posy += 5;
1246 $pdf->SetXY($posx, $posy);
1247 $pdf->SetTextColor(0, 0, 60);
1248 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1249
1250 $posy += 1;
1251 $pdf->SetFont('', '', $default_font_size - 2);
1252
1253 if ($object->ref_fourn) {
1254 $posy += 4;
1255 $pdf->SetXY($posx, $posy);
1256 $pdf->SetTextColor(0, 0, 60);
1257 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_fourn), 65), '', 'R');
1258 }
1259
1260 if ($object->thirdparty->code_fournisseur) {
1261 $posy += 4;
1262 $pdf->SetXY($posx, $posy);
1263 $pdf->SetTextColor(0, 0, 60);
1264 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities((string) $object->thirdparty->code_fournisseur), '', 'R');
1265 }
1266
1267 // Get contact
1268 if (getDolGlobalString('DOC_SHOW_FIRST_SALES_REP')) {
1269 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1270 if (count($arrayidcontact) > 0) {
1271 $usertmp = new User($this->db);
1272 $usertmp->fetch($arrayidcontact[0]);
1273 $posy += 4;
1274 $pdf->SetXY($posx, $posy);
1275 $pdf->SetTextColor(0, 0, 60);
1276 $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
1277 }
1278 }
1279
1280 $posy += 2;
1281
1282 $top_shift = 0;
1283 // Show list of linked objects
1284 $current_y = $pdf->getY();
1285 $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1286 if ($current_y < $pdf->getY()) {
1287 $top_shift = $pdf->getY() - $current_y;
1288 }
1289
1290 if ($showaddress) {
1291 // Sender properties
1292 $carac_emetteur = '';
1293 // Add internal contact of object if defined
1294 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1295 if (count($arrayidcontact) > 0) {
1296 $object->fetch_user($arrayidcontact[0]);
1297 $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
1298 $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
1299 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
1300 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
1301 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
1302 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
1303 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
1304 $carac_emetteur .= "\n";
1305 }
1306
1307 $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1308
1309 // Show sender
1310 $posy = 32 + $this->marge_haute + $top_shift;
1311 $posx = $this->marge_gauche;
1312 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1313 $posx = $this->page_largeur - $this->marge_droite - 80;
1314 }
1315 $hautcadre = 40;
1316
1317 // Show sender frame
1318 $pdf->SetTextColor(0, 0, 0);
1319 $pdf->SetFont('', '', $default_font_size - 2);
1320 $pdf->SetXY($posx, $posy - 5);
1321 $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
1322 $pdf->SetXY($posx, $posy);
1323 $pdf->SetFillColor(230, 230, 230);
1324 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius, '1234', 'F');
1325 $pdf->SetTextColor(0, 0, 60);
1326
1327 // Show sender name
1328 $pdf->SetXY($posx + 2, $posy + 3);
1329 $pdf->SetFont('', 'B', $default_font_size);
1330 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1331 $posy = $pdf->getY();
1332
1333 // Show sender information
1334 $pdf->SetXY($posx + 2, $posy);
1335 $pdf->SetFont('', '', $default_font_size - 1);
1336 $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1337
1338
1339 // If CUSTOMER contact defined on proposal, we use it. Note: Even if this is a supplier object, the code for external contact that follow order is 'CUSTOMER'
1340 $usecontact = false;
1341 if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
1342 $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1343 } else {
1344 $arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
1345 }
1346 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1347 $usecontact = true;
1348 $result = $object->fetch_contact($arrayidcontact[0]);
1349 }
1350
1351 // Recipient name
1352 if (!empty($usecontact)) {
1353 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1354 $socname = $object->contact;
1355 } else {
1356 $socname = $object->thirdparty;
1357 }
1358 } else {
1359 $socname = $object->thirdparty;
1360 }
1361
1362 $carac_client_name = pdfBuildThirdpartyName($socname, $outputlangs);
1363
1364 $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), 'target', $object);
1365
1366 // Show recipient
1367 $widthrecbox = 100;
1368 if ($this->page_largeur < 210) {
1369 $widthrecbox = 84; // To work with US executive format
1370 }
1371 $posy = 32 + $this->marge_haute + $top_shift;
1372 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1373 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1374 $posx = $this->marge_gauche;
1375 }
1376
1377 // Show recipient frame
1378 $pdf->SetTextColor(0, 0, 0);
1379 $pdf->SetFont('', '', $default_font_size - 2);
1380 $pdf->SetXY($posx + 2, $posy - 5);
1381 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
1382 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
1383
1384 // Show recipient name
1385 $pdf->SetXY($posx + 2, $posy + 3);
1386 $pdf->SetFont('', 'B', $default_font_size);
1387 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1388
1389 // Show recipient information
1390 $pdf->SetFont('', '', $default_font_size - 1);
1391 $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4));
1392 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1393 }
1394
1395 $pdf->SetTextColor(0, 0, 0);
1396 return $top_shift;
1397 }
1398
1399 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1409 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1410 {
1411 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1412 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);
1413 }
1414}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage bank accounts.
printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop=0, $hidebottom=0, $style='D')
Print a rounded rectangle on the PDF.
Class to manage hooks.
Perent class of the Proposal models.
Class to manage products or services.
Class to manage Dolibarr users.
Class to generate PDF supplier proposal Aurore.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
global $mysoc
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formatted for view output Used into pdf and HTML pages.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_nboflines_bis($text, $maxlinesize=0, $charset='UTF-8')
Return nb of lines of a formatted text with and (WARNING: string must not have mixed and br sep...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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:3217
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:87
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition pdf.lib.php:1851
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition pdf.lib.php:294
pdf_bank($pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank information for PDF generation.
Definition pdf.lib.php:1282
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0, $align='J')
Output line description into PDF.
Definition pdf.lib.php:1889
pdf_pagehead($pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition pdf.lib.php:790
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:1464
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:273
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formatted for output on PDF documents.
Definition pdf.lib.php:479
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $emetteur, $logodir, $posx, $posy, $w, $default_font_size, $align)
Output company logo on top-left of a PDF page header, or the company name as fallback text if no logo...
Definition pdf.lib.php:349
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0)
Return line unit.
Definition pdf.lib.php:2752
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
Definition pdf.lib.php:2592
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
Definition pdf.lib.php:1178
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:129
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
Definition pdf.lib.php:434
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition repair.php:130
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:133