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