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 * 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(1, 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->getFullName($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 // Positionne $this->atleastonediscount si on a au moins une remise
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 = 90 + $top_shift;
338 $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
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($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('', 1, $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('', 1, $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('', 1, 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 // Collecte des totaux par valeur de tva dans $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 // TODO remise_percent is an obsolete field for object parent
537 /*if ($object->remise_percent) {
538 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
539 }
540 if ($object->remise_percent) {
541 $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
542 }
543 if ($object->remise_percent) {
544 $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
545 }*/
546
547 $vatrate = (string) $object->lines[$i]->tva_tx;
548
549 // Retrieve type from database for backward compatibility with old records
550 if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
551 && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
552 $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
553 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
554 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
555 }
556
557 // retrieve global local tax
558 if ($localtax1_type && $localtax1ligne != 0) {
559 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
560 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
561 } else {
562 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
563 }
564 }
565 if ($localtax2_type && $localtax2ligne != 0) {
566 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
567 $this->localtax2[$localtax2_type][$localtax2_rate] = (float) $localtax2ligne;
568 } else {
569 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
570 }
571 }
572
573 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
574 $vatrate .= '*';
575 }
576
577 // Fill $this->tva and $this->tva_array
578 if (!isset($this->tva[$vatrate])) {
579 $this->tva[$vatrate] = 0;
580 }
581 $this->tva[$vatrate] += $tvaligne;
582 $vatcode = $object->lines[$i]->vat_src_code;
583 if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
584 $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
585 }
586 $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
587
588 if ($posYAfterImage > $posYAfterDescription) {
589 $nexY = $posYAfterImage;
590 }
591
592 // Add line
593 if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
594 $pdf->setPage($pageposafter);
595 $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
596 //$pdf->SetDrawColor(190,190,200);
597 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
598 $pdf->SetLineStyle(array('dash' => 0));
599 }
600
601 $nexY += 2; // Add space between lines
602
603 // Detect if some page were added automatically and output _tableau for past pages
604 while ($pagenb < $pageposafter) {
605 $pdf->setPage($pagenb);
606 if ($pagenb == 1) {
607 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
608 } else {
609 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
610 }
611 $this->_pagefoot($pdf, $object, $outputlangs, 1);
612 $pagenb++;
613 $pdf->setPage($pagenb);
614 $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
615 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
616 $this->_pagehead($pdf, $object, 0, $outputlangs);
617 }
618 if (!empty($tplidx)) {
619 $pdf->useTemplate($tplidx);
620 }
621 }
622 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { // @phan-suppress-current-line PhanUndeclaredProperty
623 if ($pagenb == 1) {
624 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
625 } else {
626 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
627 }
628 $this->_pagefoot($pdf, $object, $outputlangs, 1);
629 // New page
630 $pdf->AddPage();
631 if (!empty($tplidx)) {
632 $pdf->useTemplate($tplidx);
633 }
634 $pagenb++;
635 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
636 $this->_pagehead($pdf, $object, 0, $outputlangs);
637 }
638 }
639 }
640
641 // Show square
642 if ($pagenb == 1) {
643 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
644 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
645 } else {
646 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
647 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
648 }
649
650 // Affiche zone infos
651 $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
652
653 // Affiche zone totaux
654 //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
655
656 // Affiche zone versements
657 /*
658 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
659 {
660 $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
661 }
662 */
663
664 // Pied de page
665 $this->_pagefoot($pdf, $object, $outputlangs);
666 if (method_exists($pdf, 'AliasNbPages')) {
667 $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
668 }
669
670 $pdf->Close();
671
672 $pdf->Output($file, 'F');
673
674 //Add pdfgeneration hook
675 $hookmanager->initHooks(array('pdfgeneration'));
676 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
677 global $action;
678 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
679 if ($reshook < 0) {
680 $this->error = $hookmanager->error;
681 $this->errors = $hookmanager->errors;
682 }
683
684 dolChmod($file);
685
686 $this->result = array('fullpath' => $file);
687
688 return 1; // No error
689 } else {
690 $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
691 return 0;
692 }
693 } else {
694 $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR");
695 return 0;
696 }
697 }
698
699 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
700 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
710 protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
711 {
712 // phpcs:enable
713 return 1;
714 }
715
716 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
717 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
727 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
728 {
729 // phpcs:enable
730 global $conf;
731 $default_font_size = pdf_getPDFFontSize($outputlangs);
732
733 $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
734
735 $pdf->SetFont('', '', $default_font_size - 1);
736
737 $posxval = 52;
738
739 // Show shipping date
740 if (!empty($object->delivery_date)) {
741 $outputlangs->load("sendings");
742 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
743 $pdf->SetXY($this->marge_gauche, $posy);
744 $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
745 $pdf->MultiCell(80, 4, $titre, 0, 'L');
746 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
747 $pdf->SetXY($posxval, $posy);
748 $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
749 $pdf->MultiCell(80, 4, $dlp, 0, 'L');
750
751 $posy = $pdf->GetY() + 1;
752 } else {
753 $outputlangs->load("sendings");
754 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
755 $pdf->SetXY($this->marge_gauche, $posy);
756 $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
757 $pdf->MultiCell(80, 4, $titre, 0, 'L');
758 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
759 $pdf->SetXY($posxval, $posy);
760 //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true);
761 $pdf->MultiCell(80, 4, '', 0, 'L');
762
763 $posy = $pdf->GetY() + 1;
764 }
765 /*
766 elseif ($object->availability_code || $object->availability) // Show availability conditions
767 {
768 $pdf->SetFont('','B', $default_font_size - 2);
769 $pdf->SetXY($this->marge_gauche, $posy);
770 $titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
771 $pdf->MultiCell(80, 4, $titre, 0, 'L');
772 $pdf->SetTextColor(0,0,0);
773 $pdf->SetFont('','', $default_font_size - 2);
774 $pdf->SetXY($posxval, $posy);
775 $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset($object->availability);
776 $lib_availability=str_replace('\n',"\n",$lib_availability);
777 $pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
778
779 $posy=$pdf->GetY()+1;
780 }*/
781
782 // Show payments conditions
783 if (!getDolGlobalString('SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND') && ($object->cond_reglement_code || $object->cond_reglement)) {
784 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
785 $pdf->SetXY($this->marge_gauche, $posy);
786 $titre = $outputlangs->transnoentities("PaymentConditions").':';
787 $pdf->MultiCell(80, 4, $titre, 0, 'L');
788
789 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
790 $pdf->SetXY($posxval, $posy);
791 $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);
792 $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
793 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
794
795 $posy = $pdf->GetY() + 3;
796 }
797
798 if (getDolGlobalString('SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE')) {
799 // Show payment mode
800 if ($object->mode_reglement_code
801 && $object->mode_reglement_code != 'CHQ'
802 && $object->mode_reglement_code != 'VIR') {
803 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
804 $pdf->SetXY($this->marge_gauche, $posy - 2);
805 $titre = $outputlangs->transnoentities("PaymentMode").':';
806 $pdf->MultiCell(80, 5, $titre, 0, 'L');
807 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
808 $pdf->SetXY($posxval, $posy - 2);
809 $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);
810 $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
811
812 $posy = $pdf->GetY() + 2;
813 }
814
815 // Show payment mode CHQ
816 if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
817 // Si mode reglement non force ou si force a CHQ
818 if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) {
819 if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) {
820 $account = new Account($this->db);
821 $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER'));
822
823 $pdf->SetXY($this->marge_gauche, $posy);
824 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
825 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->owner_name), 0, 'L', 0);
826 $posy = $pdf->GetY() + 1;
827
828 if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) {
829 $pdf->SetXY($this->marge_gauche, $posy);
830 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
831 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
832 $posy = $pdf->GetY() + 2;
833 }
834 }
835 if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) {
836 $pdf->SetXY($this->marge_gauche, $posy);
837 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
838 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
839 $posy = $pdf->GetY() + 1;
840
841 if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) {
842 $pdf->SetXY($this->marge_gauche, $posy);
843 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
844 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
845 $posy = $pdf->GetY() + 2;
846 }
847 }
848 }
849 }
850
851 // If payment mode not forced or forced to VIR, show payment with BAN
852 if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
853 if (!empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) {
854 $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
855 $account = new Account($this->db);
856 $account->fetch($bankid);
857
858 $curx = $this->marge_gauche;
859 $cury = $posy;
860
861 $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
862
863 $posy += 2;
864 }
865 }
866 }
867
868 return $posy;
869 }
870
871 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
872 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
883 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
884 {
885 // phpcs:enable
886 global $conf, $mysoc;
887 $default_font_size = pdf_getPDFFontSize($outputlangs);
888
889 $tab2_top = $posy;
890 $tab2_hl = 4;
891 $pdf->SetFont('', '', $default_font_size - 1);
892
893 // Tableau total
894 $col1x = 120;
895 $col2x = 170;
896 if ($this->page_largeur < 210) { // To work with US executive format
897 $col2x -= 20;
898 }
899 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
900
901 $useborder = 0;
902 $index = 0;
903
904 // Total HT
905 $pdf->SetFillColor(255, 255, 255);
906 $pdf->SetXY($col1x, $tab2_top);
907 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
908
909 $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
910 $pdf->SetXY($col2x, $tab2_top);
911 $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
912
913 // Show VAT by rates and total
914 $pdf->SetFillColor(248, 248, 248);
915
916 $this->atleastoneratenotnull = 0;
917 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) {
918 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000']));
919 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) {
920 // Nothing to do
921 } else {
922 //Local tax 1 before VAT
923 //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
924 //{
925 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
926 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
927 continue;
928 }
929
930 foreach ($localtax_rate as $tvakey => $tvaval) {
931 if ($tvakey != 0) { // On affiche pas taux 0
932 //$this->atleastoneratenotnull++;
933
934 $index++;
935 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
936
937 $tvacompl = '';
938 if (preg_match('/\*/', $tvakey)) {
939 $tvakey = str_replace('*', '', $tvakey);
940 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
941 }
942 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
943 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
944 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
945
946 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
947 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
948 }
949 }
950 }
951 //}
952 //Local tax 2 before VAT
953 //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
954 //{
955 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
956 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
957 continue;
958 }
959
960 foreach ($localtax_rate as $tvakey => $tvaval) {
961 if ($tvakey != 0) { // On affiche pas taux 0
962 //$this->atleastoneratenotnull++;
963
964
965
966 $index++;
967 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
968
969 $tvacompl = '';
970 if (preg_match('/\*/', $tvakey)) {
971 $tvakey = str_replace('*', '', $tvakey);
972 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
973 }
974 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
975 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
976 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
977
978 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
979 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
980 }
981 }
982 }
983 //}
984 // VAT
985 foreach ($this->tva as $tvakey => $tvaval) {
986 if ($tvakey > 0) { // On affiche pas taux 0
987 $this->atleastoneratenotnull++;
988
989 $index++;
990 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
991
992 $tvacompl = '';
993 if (preg_match('/\*/', $tvakey)) {
994 $tvakey = str_replace('*', '', $tvakey);
995 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
996 }
997 $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
998 $totalvat .= vatrate($tvakey, 1).$tvacompl;
999 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1000
1001 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1002 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1003 }
1004 }
1005
1006 //Local tax 1 after VAT
1007 //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
1008 //{
1009 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1010 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1011 continue;
1012 }
1013
1014 foreach ($localtax_rate as $tvakey => $tvaval) {
1015 if ($tvakey != 0) { // On affiche pas taux 0
1016 //$this->atleastoneratenotnull++;
1017
1018 $index++;
1019 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1020
1021 $tvacompl = '';
1022 if (preg_match('/\*/', $tvakey)) {
1023 $tvakey = str_replace('*', '', $tvakey);
1024 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1025 }
1026 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1027
1028 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
1029 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1030 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1031 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1032 }
1033 }
1034 }
1035 //}
1036 //Local tax 2 after VAT
1037 //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1038 //{
1039 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1040 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1041 continue;
1042 }
1043
1044 foreach ($localtax_rate as $tvakey => $tvaval) {
1045 // retrieve global local tax
1046 if ($tvakey != 0) { // On affiche pas taux 0
1047 //$this->atleastoneratenotnull++;
1048
1049 $index++;
1050 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1051
1052 $tvacompl = '';
1053 if (preg_match('/\*/', $tvakey)) {
1054 $tvakey = str_replace('*', '', $tvakey);
1055 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1056 }
1057 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1058
1059 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
1060 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1061
1062 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1063 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1064 }
1065 }
1066 }
1067 //}
1068
1069 // Total TTC
1070 $index++;
1071 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1072 $pdf->SetTextColor(0, 0, 60);
1073 $pdf->SetFillColor(224, 224, 224);
1074 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1075
1076 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1077 $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1078 }
1079 }
1080
1081 $pdf->SetTextColor(0, 0, 0);
1082
1083 $resteapayer = $object->total_ttc - $deja_regle;
1084 if (!empty($object->paye)) {
1085 $resteapayer = 0;
1086 }
1087
1088 if ($deja_regle > 0) {
1089 $index++;
1090
1091 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1092 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1093
1094 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1095 $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
1096
1097 $index++;
1098 $pdf->SetTextColor(0, 0, 60);
1099 $pdf->SetFillColor(224, 224, 224);
1100 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1101 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1102
1103 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1104 $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
1105
1106 $pdf->SetFont('', '', $default_font_size - 1);
1107 $pdf->SetTextColor(0, 0, 0);
1108 }
1109
1110 $index++;
1111 return ($tab2_top + ($tab2_hl * $index));
1112 }
1113
1114 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1128 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1129 {
1130 global $conf;
1131
1132 // Force to disable hidetop and hidebottom
1133 $hidebottom = 0;
1134 if ($hidetop) {
1135 $hidetop = -1;
1136 }
1137
1138 $currency = !empty($currency) ? $currency : $conf->currency;
1139 $default_font_size = pdf_getPDFFontSize($outputlangs);
1140
1141 // Amount in (at tab_top - 1)
1142 $pdf->SetTextColor(0, 0, 0);
1143 $pdf->SetFont('', '', $default_font_size - 2);
1144
1145 if (empty($hidetop)) {
1146 $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1147 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1148 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1149
1150 //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1151 if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
1152 $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')));
1153 }
1154 }
1155
1156 $pdf->SetDrawColor(128, 128, 128);
1157 $pdf->SetFont('', '', $default_font_size - 1);
1158
1159 // Output Rect
1160 $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
1161
1162 if (empty($hidetop)) {
1163 $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
1164
1165 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1166 $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1167 }
1168
1169 $pdf->line($this->posxup + 1, $tab_top, $this->posxup + 1, $tab_top + $tab_height);
1170 if (empty($hidetop)) {
1171 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1172 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1173 }
1174
1175 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1176 if (empty($hidetop)) {
1177 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1178 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1179 }
1180
1181 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
1182 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1183 if (empty($hidetop)) {
1184 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1185 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
1186 }
1187 }
1188
1189 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1190 if (empty($hidetop)) {
1191 if ($this->atleastonediscount) {
1192 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1193 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1194 }
1195 }
1196 if ($this->atleastonediscount) {
1197 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1198 }
1199 if (empty($hidetop)) {
1200 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1201 $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
1202 }
1203 }
1204
1205 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1215 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1216 {
1217 global $conf, $langs;
1218 '@phan-var-force SupplierProposal $object';
1219
1220 // Load traductions files required by page
1221 $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies"));
1222
1223 $default_font_size = pdf_getPDFFontSize($outputlangs);
1224
1225 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1226
1227 $pdf->SetTextColor(0, 0, 60);
1228 $pdf->SetFont('', 'B', $default_font_size + 3);
1229
1230 $posy = $this->marge_haute;
1231 $posx = $this->page_largeur - $this->marge_droite - 100;
1232
1233 $pdf->SetXY($this->marge_gauche, $posy);
1234
1235 // Logo
1236 if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
1237 if ($this->emetteur->logo) {
1238 $logodir = $conf->mycompany->dir_output;
1239 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1240 $logodir = $conf->mycompany->multidir_output[$object->entity];
1241 }
1242 if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
1243 $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
1244 } else {
1245 $logo = $logodir.'/logos/'.$this->emetteur->logo;
1246 }
1247 if (is_readable($logo)) {
1248 $height = pdf_getHeightForLogo($logo);
1249 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1250 } else {
1251 $pdf->SetTextColor(200, 0, 0);
1252 $pdf->SetFont('', 'B', $default_font_size - 2);
1253 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1254 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1255 }
1256 } else {
1257 $text = $this->emetteur->name;
1258 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0);
1259 }
1260 }
1261
1262 $pdf->SetFont('', 'B', $default_font_size + 3);
1263 $pdf->SetXY($posx, $posy);
1264 $pdf->SetTextColor(0, 0, 60);
1265 $title = $outputlangs->transnoentities("CommercialAsk");
1266 $pdf->MultiCell(100, 4, $title, '', 'R');
1267
1268 $pdf->SetFont('', 'B', $default_font_size);
1269
1270 $posy += 5;
1271 $pdf->SetXY($posx, $posy);
1272 $pdf->SetTextColor(0, 0, 60);
1273 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1274
1275 $posy += 1;
1276 $pdf->SetFont('', '', $default_font_size - 2);
1277
1278 if ($object->ref_fourn) {
1279 $posy += 4;
1280 $pdf->SetXY($posx, $posy);
1281 $pdf->SetTextColor(0, 0, 60);
1282 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_fourn), 65), '', 'R');
1283 }
1284
1285 if ($object->thirdparty->code_fournisseur) {
1286 $posy += 4;
1287 $pdf->SetXY($posx, $posy);
1288 $pdf->SetTextColor(0, 0, 60);
1289 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
1290 }
1291
1292 // Get contact
1293 if (getDolGlobalString('DOC_SHOW_FIRST_SALES_REP')) {
1294 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1295 if (count($arrayidcontact) > 0) {
1296 $usertmp = new User($this->db);
1297 $usertmp->fetch($arrayidcontact[0]);
1298 $posy += 4;
1299 $pdf->SetXY($posx, $posy);
1300 $pdf->SetTextColor(0, 0, 60);
1301 $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
1302 }
1303 }
1304
1305 $posy += 2;
1306
1307 $top_shift = 0;
1308 // Show list of linked objects
1309 $current_y = $pdf->getY();
1310 $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1311 if ($current_y < $pdf->getY()) {
1312 $top_shift = $pdf->getY() - $current_y;
1313 }
1314
1315 if ($showaddress) {
1316 // Sender properties
1317 $carac_emetteur = '';
1318 // Add internal contact of object if defined
1319 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1320 if (count($arrayidcontact) > 0) {
1321 $object->fetch_user($arrayidcontact[0]);
1322 $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
1323 $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
1324 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
1325 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
1326 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
1327 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
1328 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
1329 $carac_emetteur .= "\n";
1330 }
1331
1332 $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1333
1334 // Show sender
1335 $posy = 42 + $top_shift;
1336 $posx = $this->marge_gauche;
1337 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1338 $posx = $this->page_largeur - $this->marge_droite - 80;
1339 }
1340 $hautcadre = 40;
1341
1342 // Show sender frame
1343 $pdf->SetTextColor(0, 0, 0);
1344 $pdf->SetFont('', '', $default_font_size - 2);
1345 $pdf->SetXY($posx, $posy - 5);
1346 $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
1347 $pdf->SetXY($posx, $posy);
1348 $pdf->SetFillColor(230, 230, 230);
1349 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius, '1234', 'F');
1350 $pdf->SetTextColor(0, 0, 60);
1351
1352 // Show sender name
1353 $pdf->SetXY($posx + 2, $posy + 3);
1354 $pdf->SetFont('', 'B', $default_font_size);
1355 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1356 $posy = $pdf->getY();
1357
1358 // Show sender information
1359 $pdf->SetXY($posx + 2, $posy);
1360 $pdf->SetFont('', '', $default_font_size - 1);
1361 $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1362
1363
1364 // 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'
1365 $usecontact = false;
1366 if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) {
1367 $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1368 } else {
1369 $arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
1370 }
1371 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1372 $usecontact = true;
1373 $result = $object->fetch_contact($arrayidcontact[0]);
1374 }
1375
1376 // Recipient name
1377 if (!empty($usecontact)) {
1378 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1379 $socname = $object->contact;
1380 } else {
1381 $socname = $object->thirdparty;
1382 }
1383 } else {
1384 $socname = $object->thirdparty;
1385 }
1386
1387 $carac_client_name = pdfBuildThirdpartyName($socname, $outputlangs);
1388
1389 $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), 'target', $object);
1390
1391 // Show recipient
1392 $widthrecbox = 100;
1393 if ($this->page_largeur < 210) {
1394 $widthrecbox = 84; // To work with US executive format
1395 }
1396 $posy = 42 + $top_shift;
1397 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1398 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1399 $posx = $this->marge_gauche;
1400 }
1401
1402 // Show recipient frame
1403 $pdf->SetTextColor(0, 0, 0);
1404 $pdf->SetFont('', '', $default_font_size - 2);
1405 $pdf->SetXY($posx + 2, $posy - 5);
1406 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
1407 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
1408
1409 // Show recipient name
1410 $pdf->SetXY($posx + 2, $posy + 3);
1411 $pdf->SetFont('', 'B', $default_font_size);
1412 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1413
1414 // Show recipient information
1415 $pdf->SetFont('', '', $default_font_size - 1);
1416 $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4));
1417 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1418 }
1419
1420 $pdf->SetTextColor(0, 0, 0);
1421 return $top_shift;
1422 }
1423
1424 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1434 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1435 {
1436 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1437 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);
1438 }
1439}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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.
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.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
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 a 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_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...
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:2648
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:1442
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:86
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition pdf.lib.php:288
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition pdf.lib.php:313
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:1027
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition pdf.lib.php:729
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition pdf.lib.php:1405
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank information for PDF generation.
Definition pdf.lib.php:850
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:265
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:434
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0)
Return line unit.
Definition pdf.lib.php:2245
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
Definition pdf.lib.php:2085
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:765
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:386
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:137
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140