dolibarr  7.0.0-beta
pdf_beluga.modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
3  * Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
4 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  * or see http://www.gnu.org/
18  */
19 
27 require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
35 
36 if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
37 if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
38 if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
39 if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
40 if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
41 if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
42 if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
43 if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
44 if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
45 if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
46 if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
47 
48 
49 
55 {
56  var $emetteur; // Objet societe qui emet
57 
63  function __construct($db)
64  {
65  global $conf,$langs,$mysoc;
66 
67  $langs->load("main");
68  $langs->load("projects");
69  $langs->load("companies");
70 
71  $this->db = $db;
72  $this->name = "beluga";
73  $this->description = $langs->trans("DocumentModelBeluga");
74 
75  // Dimension page pour format A4
76  $this->type = 'pdf';
77  $formatarray=pdf_getFormat();
78  $this->page_largeur = $formatarray['width'];
79  $this->page_hauteur = $formatarray['height'];
80  $this->format = array($this->page_largeur,$this->page_hauteur);
81  $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
82  $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
83  $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
84  $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
85 
86  $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
87  $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
88  $this->option_codeproduitservice = 1; // Affiche code produit-service
89 
90  // Recupere emmetteur
91  $this->emetteur=$mysoc;
92  if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
93 
94  // Defini position des colonnes
95  $this->posxref=$this->marge_gauche+1;
96  $this->posxdate=$this->marge_gauche+25;
97  $this->posxsociety=$this->marge_gauche+45;
98  $this->posxamountht=$this->marge_gauche+110;
99  $this->posxamountttc=$this->marge_gauche+135;
100  $this->posxstatut=$this->marge_gauche+165;
101  }
102 
103 
111  function write_file($object,$outputlangs)
112  {
113  global $user,$langs,$conf;
114 
115  $formproject=new FormProjets($this->db);
116 
117  if (! is_object($outputlangs)) $outputlangs=$langs;
118  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
119  if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
120 
121  $outputlangs->load("main");
122  $outputlangs->load("dict");
123  $outputlangs->load("companies");
124  $outputlangs->load("projects");
125 
126  if ($conf->projet->dir_output)
127  {
128  //$nblignes = count($object->lines); // This is set later with array of tasks
129 
130  $objectref = dol_sanitizeFileName($object->ref);
131  $dir = $conf->projet->dir_output;
132  if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
133  $file = $dir . "/" . $objectref . ".pdf";
134 
135  if (! file_exists($dir))
136  {
137  if (dol_mkdir($dir) < 0)
138  {
139  $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
140  return 0;
141  }
142  }
143 
144  if (file_exists($dir))
145  {
146  // Add pdfgeneration hook
147  if (! is_object($hookmanager))
148  {
149  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
150  $hookmanager=new HookManager($this->db);
151  }
152  $hookmanager->initHooks(array('pdfgeneration'));
153  $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
154  global $action;
155  $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
156 
157  $pdf=pdf_getInstance($this->format);
158  $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
159  $heightforinfotot = 50; // Height reserved to output the info and total part
160  $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
161  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
162  $pdf->SetAutoPageBreak(1,0);
163 
164  if (class_exists('TCPDF'))
165  {
166  $pdf->setPrintHeader(false);
167  $pdf->setPrintFooter(false);
168  }
169  $pdf->SetFont(pdf_getPDFFont($outputlangs));
170 
171  // Complete object by loading several other informations
172  $task = new Task($this->db);
173  $tasksarray = $task->getTasksArray(0,0,$object->id);
174 
175  $object->lines=$tasksarray;
176  $nblignes=count($object->lines);
177 
178  $pdf->Open();
179  $pagenb=0;
180  $pdf->SetDrawColor(128,128,128);
181 
182  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
183  $pdf->SetSubject($outputlangs->transnoentities("Project"));
184  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
185  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
186  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
187  if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
188 
189  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
190 
191  // New page
192  $pdf->AddPage();
193  $pagenb++;
194  $this->_pagehead($pdf, $object, 1, $outputlangs);
195  $pdf->SetFont('','', $default_font_size - 1);
196  $pdf->MultiCell(0, 3, ''); // Set interline to 3
197  $pdf->SetTextColor(0,0,0);
198 
199  $tab_top = 50;
200  $tab_height = 200;
201  $tab_top_newpage = 40;
202  $tab_height_newpage = 210;
203 
204  // Affiche notes
205  if (! empty($object->note_public))
206  {
207  $pdf->SetFont('','', $default_font_size - 1);
208  $pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
209  $nexY = $pdf->GetY();
210  $height_note=$nexY-($tab_top-2);
211 
212  // Rect prend une longueur en 3eme param
213  $pdf->SetDrawColor(192,192,192);
214  $pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
215 
216  $tab_height = $tab_height - $height_note;
217  $tab_top = $nexY+6;
218  }
219  else
220  {
221  $height_note=0;
222  }
223 
224  $iniY = $tab_top + 7;
225  $curY = $tab_top + 7;
226  $nexY = $tab_top + 7;
227 
228  $listofreferent=array(
229  'propal'=>array(
230  'name'=>"Proposals",
231  'title'=>"ListProposalsAssociatedProject",
232  'class'=>'Propal',
233  'table'=>'propal',
234  'datefieldname'=>'datep',
235  'test'=>$conf->propal->enabled && $user->rights->propale->lire,
236  'lang'=>'propal'),
237  'order'=>array(
238  'name'=>"CustomersOrders",
239  'title'=>"ListOrdersAssociatedProject",
240  'class'=>'Commande',
241  'table'=>'commande',
242  'datefieldname'=>'date_commande',
243  'test'=>$conf->commande->enabled && $user->rights->commande->lire,
244  'lang'=>'order'),
245  'invoice'=>array(
246  'name'=>"CustomersInvoices",
247  'title'=>"ListInvoicesAssociatedProject",
248  'class'=>'Facture',
249  'margin'=>'add',
250  'table'=>'facture',
251  'datefieldname'=>'datef',
252  'test'=>$conf->facture->enabled && $user->rights->facture->lire,
253  'lang'=>'bills'),
254  'invoice_predefined'=>array(
255  'name'=>"PredefinedInvoices",
256  'title'=>"ListPredefinedInvoicesAssociatedProject",
257  'class'=>'FactureRec',
258  'table'=>'facture_rec',
259  'datefieldname'=>'datec',
260  'test'=>$conf->facture->enabled && $user->rights->facture->lire,
261  'lang'=>'bills'),
262  'order_supplier'=>array(
263  'name'=>"SuppliersOrders",
264  'title'=>"ListSupplierOrdersAssociatedProject",
265  'class'=>'CommandeFournisseur',
266  'table'=>'commande_fournisseur',
267  'datefieldname'=>'date_commande',
268  'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire,
269  'lang'=>'orders'),
270  'invoice_supplier'=>array(
271  'name'=>"BillsSuppliers",
272  'title'=>"ListSupplierInvoicesAssociatedProject",
273  'class'=>'FactureFournisseur',
274  'margin'=>'minus',
275  'table'=>'facture_fourn',
276  'datefieldname'=>'datef',
277  'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire,
278  'lang'=>'bills'),
279  'contract'=>array(
280  'name'=>"Contracts",
281  'title'=>"ListContractAssociatedProject",
282  'class'=>'Contrat',
283  'table'=>'contrat',
284  'datefieldname'=>'date_contrat',
285  'test'=>$conf->contrat->enabled && $user->rights->contrat->lire,
286  'lang'=>'contract'),
287  'intervention'=>array(
288  'name'=>"Interventions",
289  'title'=>"ListFichinterAssociatedProject",
290  'class'=>'Fichinter',
291  'table'=>'fichinter',
292  'datefieldname'=>'date_valid',
293  'disableamount'=>1,
294  'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire,
295  'lang'=>'interventions'),
296  'trip'=>array(
297  'name'=>"TripsAndExpenses",
298  'title'=>"ListExpenseReportsAssociatedProject",
299  'class'=>'Deplacement',
300  'table'=>'deplacement',
301  'datefieldname'=>'dated',
302  'margin'=>'minus',
303  'disableamount'=>1,
304  'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire,
305  'lang'=>'trip'),
306  'expensereport'=>array(
307  'name'=>"ExpensesReports",
308  'title'=>"ListExpenseReportsAssociatedProject",
309  'class'=>'ExpenseReport',
310  'table'=>'expensereport',
311  'datefieldname'=>'dated',
312  'margin'=>'minus',
313  'disableamount'=>1,
314  'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire,
315  'lang'=>'trip'),
316  'agenda'=>array(
317  'name'=>"Agenda",
318  'title'=>"ListActionsAssociatedProject",
319  'class'=>'ActionComm',
320  'table'=>'actioncomm',
321  'datefieldname'=>'datep',
322  'disableamount'=>1,
323  'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->read,
324  'lang'=>'agenda')
325  );
326 
327 
328  foreach ($listofreferent as $key => $value)
329  {
330  $title=$value['title'];
331  $classname=$value['class'];
332  $tablename=$value['table'];
333  $datefieldname=$value['datefieldname'];
334  $qualified=$value['test'];
335  $langstoload=$value['lang'];
336  $langs->load($langstoload);
337 
338  if ($qualified)
339  {
340  //var_dump("$key, $tablename, $datefieldname, $dates, $datee");
341  $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
342  //var_dump($elementarray);
343 
344  $num = count($elementarray);
345  if ($num >= 0)
346  {
347  $nexY = $pdf->GetY() + 5;
348  $curY = $nexY;
349  $pdf->SetXY($this->posxref, $curY);
350  $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
351 
352  $selectList = $formproject->select_element($tablename, $project->thirdparty->id);
353  $nexY = $pdf->GetY() + 1;
354  $curY = $nexY;
355  $pdf->SetXY($this->posxref, $curY);
356  $pdf->MultiCell($this->posxdate - $this->posxref, 3, $outputlangs->transnoentities("Ref"), 1, 'L');
357  $pdf->SetXY($this->posxdate, $curY);
358  $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities("Date"), 1, 'C');
359  $pdf->SetXY($this->posxsociety, $curY);
360  $titlethirdparty=$outputlangs->transnoentities("ThirdParty");
361  if ($classname == 'ExpenseReport') $titlethirdparty=$langs->trans("User");
362  $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $titlethirdparty, 1, 'L');
363  if (empty($value['disableamount'])) {
364  $pdf->SetXY($this->posxamountht, $curY);
365  $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHTShort"), 1, 'R');
366  $pdf->SetXY($this->posxamountttc, $curY);
367  $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTCShort"), 1, 'R');
368  } else {
369  $pdf->SetXY($this->posxamountht, $curY);
370  $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
371  }
372  $pdf->SetXY($this->posxstatut, $curY);
373  $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R');
374 
375  if (is_array($elementarray) && count($elementarray) > 0)
376  {
377  $nexY = $pdf->GetY();
378  $curY = $nexY;
379 
380  $total_ht = 0;
381  $total_ttc = 0;
382  $num = count($elementarray);
383  for ($i = 0; $i < $num; $i ++) {
384  $idofelement=$elementarray[$i];
385  if ($classname == 'ExpenseReport')
386  {
387  // We get id of expense report
388  $expensereportline=new ExpenseReportLine($this->db);
389  $expensereportline->fetch($idofelement);
390  $idofelement = $expensereportline->fk_expensereport;
391  }
392 
393  $element = new $classname($this->db);
394  $element->fetch($idofelement);
395  $element->fetch_thirdparty();
396  // print $classname;
397 
398  $qualifiedfortotal = true;
399  if ($key == 'invoice') {
400  if ($element->close_code == 'replaced')
401  $qualifiedfortotal = false; // Replacement invoice
402  }
403 
404  $pdf->SetXY($this->posxref, $curY);
405  $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
406 
407  // Date
408  if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
409  $date = $element->date_commande;
410  else {
411  $date = $element->date;
412  if (empty($date))
413  $date = $element->datep;
414  if (empty($date))
415  $date = $element->date_contrat;
416  if (empty($date))
417  $date = $element->datev; // Fiche inter
418  }
419 
420  $pdf->SetXY($this->posxdate, $curY);
421  $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C');
422 
423  $pdf->SetXY($this->posxsociety, $curY);
424  if (is_object($element->thirdparty))
425  {
426  $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $element->thirdparty->name, 1, 'L');
427  }
428  elseif ($classname == 'ExpenseReport')
429  {
430  $fuser=new User($this->db);
431  $fuser->fetch($element->fk_user_author);
432  $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L');
433  }
434 
435  // Amount without tax
436  if (empty($value['disableamount'])) {
437  $pdf->SetXY($this->posxamountht, $curY);
438  $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : '&nbsp;'), 1, 'R');
439  $pdf->SetXY($this->posxamountttc, $curY);
440  $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : '&nbsp;'), 1, 'R');
441  } else {
442  $pdf->SetXY($this->posxamountht, $curY);
443  $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
444  }
445 
446  // Status
447  if ($element instanceof CommonInvoice) {
448  // This applies for Facture and FactureFournisseur
449  $outputstatut = $element->getLibStatut(1, $element->getSommePaiement());
450  } else {
451  $outputstatut = $element->getLibStatut(1);
452  }
453  $pdf->SetXY($this->posxstatut, $curY);
454  $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1, 'R', false, 1, '', '', true, 0, true);
455 
456  if ($qualifiedfortotal) {
457  $total_ht = $total_ht + $element->total_ht;
458  $total_ttc = $total_ttc + $element->total_ttc;
459  }
460  $nexY = $pdf->GetY();
461  $curY = $nexY;
462  }
463 
464  if (empty($value['disableamount'])) {
465  $curY = $nexY;
466  $pdf->SetXY($this->posxref, $curY);
467  $pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L');
468  $pdf->SetXY($this->posxamountht, $curY);
469  $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : '&nbsp;'), 1, 'R');
470  $pdf->SetXY($this->posxamountttc, $curY);
471  $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : '&nbsp;'), 1, 'R');
472  $pdf->SetXY($this->posxstatut, $curY);
473  $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L');
474  }
475  $nexY = $pdf->GetY() + 5;
476  $curY = $nexY;
477  }
478  }
479  }
480  }
481 
482  /*
483  * Pied de page
484  */
485  $this->_pagefoot($pdf,$object,$outputlangs);
486  if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
487 
488  $pdf->Close();
489 
490  $pdf->Output($file,'F');
491 
492  // Add pdfgeneration hook
493  if (! is_object($hookmanager))
494  {
495  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
496  $hookmanager=new HookManager($this->db);
497  }
498  $hookmanager->initHooks(array('pdfgeneration'));
499  $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
500  global $action;
501  $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
502 
503  if (! empty($conf->global->MAIN_UMASK))
504  @chmod($file, octdec($conf->global->MAIN_UMASK));
505 
506  $this->result = array('fullpath'=>$file);
507 
508  return 1; // Pas d'erreur
509  }
510  else
511  {
512  $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
513  return 0;
514  }
515  }
516 
517  $this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
518  return 0;
519  }
520 
521 
534  function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
535  {
536  global $conf,$mysoc;
537 
538  $default_font_size = pdf_getPDFFontSize($outputlangs);
539 
540  $pdf->SetDrawColor(128,128,128);
541 
542  // Rect prend une longueur en 3eme param
543  $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
544  // line prend une position y en 3eme param
545  $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
546 
547  $pdf->SetTextColor(0,0,0);
548  $pdf->SetFont('','', $default_font_size);
549 
550  $pdf->SetXY($this->posxref, $tab_top+1);
551  $pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L');
552 
553  $pdf->SetXY($this->posxlabel, $tab_top+1);
554  $pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
555 
556  $pdf->SetXY($this->posxworkload, $tab_top+1);
557  $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R');
558 
559  $pdf->SetXY($this->posxprogress, $tab_top+1);
560  $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R');
561 
562  $pdf->SetXY($this->posxdatestart, $tab_top+1);
563  $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, '', 0, 'C');
564 
565  $pdf->SetXY($this->posxdateend, $tab_top+1);
566  $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
567 
568  }
569 
579  function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
580  {
581  global $langs,$conf,$mysoc;
582 
583  $default_font_size = pdf_getPDFFontSize($outputlangs);
584 
585  pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
586 
587  $pdf->SetTextColor(0,0,60);
588  $pdf->SetFont('','B', $default_font_size + 3);
589 
590  $posx=$this->page_largeur-$this->marge_droite-100;
591  $posy=$this->marge_haute;
592 
593  $pdf->SetXY($this->marge_gauche,$posy);
594 
595  // Logo
596  $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
597  if ($mysoc->logo)
598  {
599  if (is_readable($logo))
600  {
601  $height=pdf_getHeightForLogo($logo);
602  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
603  }
604  else
605  {
606  $pdf->SetTextColor(200,0,0);
607  $pdf->SetFont('','B', $default_font_size - 2);
608  $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
609  $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
610  }
611  }
612  else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
613 
614  $pdf->SetFont('','B', $default_font_size + 3);
615  $pdf->SetXY($posx,$posy);
616  $pdf->SetTextColor(0,0,60);
617  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
618  $pdf->SetFont('','', $default_font_size + 2);
619 
620  $posy+=6;
621  $pdf->SetXY($posx,$posy);
622  $pdf->SetTextColor(0,0,60);
623  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
624  $posy+=6;
625  $pdf->SetXY($posx,$posy);
626  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
627 
628  $pdf->SetTextColor(0,0,60);
629 
630  }
631 
641  function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
642  {
643  global $conf;
644  $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
645  return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
646  }
647 }
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:82
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition: pdf.lib.php:580
Class of expense report details lines.
Classe permettant de generer les projets au modele Baleine.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
pdf_getFormat(Translate $outputlangs=null)
Return array with format properties of default PDF format.
Definition: pdf.lib.php:42
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition: pdf.lib.php:256
Class to manage Dolibarr users.
Definition: user.class.php:39
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition: pdf.lib.php:233
Class to manage hooks.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Parent class for projects models.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
Definition: pdf.lib.php:852
Class to manage building of HTML components.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition: pdf.lib.php:277
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
Superclass for invoices classes.
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...
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
__construct($db)
Constructor.
Class to manage tasks.
Definition: task.class.php:32
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
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...
write_file($object, $outputlangs)
Fonction generant le projet sur le disque.
type
Definition: viewcat.php:283
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.