62 global $langs, $mysoc;
65 $langs->loadLangs(array(
"main",
"bank",
"withdrawals",
"companies"));
69 $this->
description = $langs->trans(
"DocumentModelBan").
' (Volunteer wanted to finish)';
74 $this->page_largeur = $formatarray[
'width'];
75 $this->page_hauteur = $formatarray[
'height'];
76 $this->format = array($this->page_largeur, $this->page_hauteur);
82 $this->option_logo = 1;
83 $this->option_tva = 1;
86 $this->emetteur = $mysoc;
87 if (!$this->emetteur->country_code) {
88 $this->emetteur->country_code = substr($langs->defaultlang, -2);
92 $this->posxref = $this->marge_gauche + 1;
93 $this->posxlabel = $this->marge_gauche + 25;
94 $this->posxworkload = $this->marge_gauche + 100;
95 $this->posxdatestart = $this->marge_gauche + 150;
96 $this->posxdateend = $this->marge_gauche + 170;
111 global $conf, $hookmanager, $langs, $user;
113 if (!is_object($outputlangs)) {
114 $outputlangs = $langs;
118 $outputlangs->charset_output =
'ISO-8859-1';
122 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
124 if ($conf->bank->dir_output) {
129 $dir = $conf->bank->dir_output;
130 $file = $dir.
"/SPECIMEN.pdf";
133 $dir = $conf->bank->dir_output.
"/".$objectref;
134 $file = $dir.
"/".$objectref.
".pdf";
137 if (!file_exists($dir)) {
139 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
144 if (file_exists($dir)) {
146 if (!is_object($hookmanager)) {
147 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
150 $hookmanager->initHooks(array(
'pdfgeneration'));
151 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
153 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
157 $heightforinfotot = 50;
159 $heightforfooter = $this->marge_basse + 8;
161 $heightforfooter += 6;
163 $pdf->SetAutoPageBreak(1, 0);
165 if (class_exists(
'TCPDF')) {
166 $pdf->setPrintHeader(
false);
167 $pdf->setPrintFooter(
false);
173 $pdf->SetDrawColor(128, 128, 128);
175 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
176 $pdf->SetSubject($outputlangs->transnoentities(
"BAN"));
177 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
178 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
179 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"BAN"));
181 $pdf->SetCompression(
false);
185 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
191 $pdf->SetFont(
'',
'', $default_font_size - 1);
192 $pdf->MultiCell(0, 3,
'');
193 $pdf->SetTextColor(0, 0, 0);
196 $tab_top_newpage = 40;
198 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
201 if (!empty(
$object->note_public)) {
202 $pdf->SetFont(
'',
'', $default_font_size - 1);
204 $nexY = $pdf->GetY();
205 $height_note = $nexY - ($tab_top - 2);
208 $pdf->SetDrawColor(192, 192, 192);
209 $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
211 $tab_height -= $height_note;
212 $tab_top = $nexY + 6;
217 $iniY = $tab_top + 7;
218 $curY = $tab_top + 7;
219 $nexY = $tab_top + 7;
221 $pdf->SetXY($this->marge_gauche, $curY);
222 $pdf->MultiCell(200, 3, $outputlangs->trans(
"BAN").
' : '.
$object->account_number, 0,
'L');
228 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
229 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
231 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
232 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
239 if (method_exists($pdf,
'AliasNbPages')) {
240 $pdf->AliasNbPages();
245 $pdf->Output($file,
'F');
248 if (!is_object($hookmanager)) {
249 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
252 $hookmanager->initHooks(array(
'pdfgeneration'));
253 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
255 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
257 $this->error = $hookmanager->error;
258 $this->errors = $hookmanager->errors;
263 $this->result = array(
'fullpath' => $file);
267 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
272 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"DELIVERY_OUTPUTDIR");
310 global $langs, $conf, $mysoc;
317 $pdf->SetTextColor(0, 0, 60);
318 $pdf->SetFont(
'',
'B', $default_font_size + 3);
320 $posx = $this->page_largeur - $this->marge_droite - 100;
321 $posy = $this->marge_haute;
323 $pdf->SetXY($this->marge_gauche, $posy);
326 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
328 if (is_readable($logo)) {
330 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
332 $pdf->SetTextColor(200, 0, 0);
333 $pdf->SetFont(
'',
'B', $default_font_size - 2);
334 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
335 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
338 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
341 $pdf->SetFont(
'',
'B', $default_font_size + 3);
342 $pdf->SetXY($posx, $posy);
343 $pdf->SetTextColor(0, 0, 60);
344 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"BAN").
" ".$outputlangs->convToOutputCharset(
$object->ref),
'',
'R');
345 $pdf->SetFont(
'',
'', $default_font_size + 2);
348 $pdf->SetXY($posx, $posy);
349 $pdf->SetTextColor(0, 0, 60);
350 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
dol_now(),
'day',
false, $outputlangs,
true),
'',
'R');
356 $pdf->SetTextColor(0, 0, 60);