55 global $conf, $langs, $mysoc;
58 $langs->loadLangs(array(
"main",
"bank",
"withdrawals",
"companies"));
62 $this->
description = $langs->trans(
"DocumentModelBan").
' (Volunteer wanted to finish)';
67 $this->page_largeur = $formatarray[
'width'];
68 $this->page_hauteur = $formatarray[
'height'];
69 $this->format = array($this->page_largeur, $this->page_hauteur);
75 $this->option_logo = 1;
76 $this->option_tva = 1;
79 $this->emetteur = $mysoc;
80 if (!$this->emetteur->country_code) {
81 $this->emetteur->country_code = substr($langs->defaultlang, -2);
85 $this->posxref = $this->marge_gauche + 1;
86 $this->posxlabel = $this->marge_gauche + 25;
87 $this->posxworkload = $this->marge_gauche + 100;
88 $this->posxdatestart = $this->marge_gauche + 150;
89 $this->posxdateend = $this->marge_gauche + 170;
104 global $conf, $hookmanager, $langs, $user;
106 if (!is_object($outputlangs)) {
107 $outputlangs = $langs;
110 if (!empty($conf->global->MAIN_USE_FPDF)) {
111 $outputlangs->charset_output =
'ISO-8859-1';
115 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
117 if ($conf->bank->dir_output) {
121 if ($object->specimen) {
122 $dir = $conf->bank->dir_output;
123 $file = $dir.
"/SPECIMEN.pdf";
126 $dir = $conf->bank->dir_output.
"/".$objectref;
127 $file = $dir.
"/".$objectref.
".pdf";
130 if (!file_exists($dir)) {
132 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
137 if (file_exists($dir)) {
139 if (!is_object($hookmanager)) {
140 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
143 $hookmanager->initHooks(array(
'pdfgeneration'));
144 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
146 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
150 $heightforinfotot = 50;
151 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
152 $heightforfooter = $this->marge_basse + 8;
153 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
154 $heightforfooter += 6;
156 $pdf->SetAutoPageBreak(1, 0);
158 if (class_exists(
'TCPDF')) {
159 $pdf->setPrintHeader(
false);
160 $pdf->setPrintFooter(
false);
166 $pdf->SetDrawColor(128, 128, 128);
168 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
169 $pdf->SetSubject($outputlangs->transnoentities(
"BAN"));
170 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
171 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
172 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"BAN"));
174 $pdf->SetCompression(
false);
177 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
182 $this->
_pagehead($pdf, $object, 1, $outputlangs);
183 $pdf->SetFont(
'',
'', $default_font_size - 1);
184 $pdf->MultiCell(0, 3,
'');
185 $pdf->SetTextColor(0, 0, 0);
188 $tab_top_newpage = 40;
190 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
193 if (!empty($object->note_public)) {
194 $pdf->SetFont(
'',
'', $default_font_size - 1);
195 $pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2,
dol_htmlentitiesbr($object->note_public), 0, 1);
196 $nexY = $pdf->GetY();
197 $height_note = $nexY - ($tab_top - 2);
200 $pdf->SetDrawColor(192, 192, 192);
201 $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
203 $tab_height = $tab_height - $height_note;
204 $tab_top = $nexY + 6;
209 $iniY = $tab_top + 7;
210 $curY = $tab_top + 7;
211 $nexY = $tab_top + 7;
213 $pdf->SetXY($this->marge_gauche, $curY);
214 $pdf->MultiCell(200, 3, $outputlangs->trans(
"BAN").
' : '.$object->account_number, 0,
'L');
220 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
221 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
223 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
224 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
230 $this->
_pagefoot($pdf, $object, $outputlangs);
231 if (method_exists($pdf,
'AliasNbPages')) {
232 $pdf->AliasNbPages();
237 $pdf->Output($file,
'F');
240 if (!is_object($hookmanager)) {
241 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
244 $hookmanager->initHooks(array(
'pdfgeneration'));
245 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
247 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
249 $this->error = $hookmanager->error;
250 $this->errors = $hookmanager->errors;
255 $this->result = array(
'fullpath'=>$file);
259 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
264 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"DELIVERY_OUTPUTDIR");
300 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
302 global $langs, $conf, $mysoc;
309 $pdf->SetTextColor(0, 0, 60);
310 $pdf->SetFont(
'',
'B', $default_font_size + 3);
312 $posx = $this->page_largeur - $this->marge_droite - 100;
313 $posy = $this->marge_haute;
315 $pdf->SetXY($this->marge_gauche, $posy);
318 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
320 if (is_readable($logo)) {
322 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
324 $pdf->SetTextColor(200, 0, 0);
325 $pdf->SetFont(
'',
'B', $default_font_size - 2);
326 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
327 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
330 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
333 $pdf->SetFont(
'',
'B', $default_font_size + 3);
334 $pdf->SetXY($posx, $posy);
335 $pdf->SetTextColor(0, 0, 60);
336 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"BAN").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
337 $pdf->SetFont(
'',
'', $default_font_size + 2);
340 $pdf->SetXY($posx, $posy);
341 $pdf->SetTextColor(0, 0, 60);
342 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
dol_now(),
'day',
false, $outputlangs,
true),
'',
'R');
348 $pdf->SetTextColor(0, 0, 60);