61 global $langs, $mysoc;
64 $langs->loadLangs(array(
"main",
"bank",
"withdrawals",
"companies"));
68 $this->
description = $langs->trans(
"DocumentModelBan").
' (Volunteer wanted to finish)';
73 $this->page_largeur = $formatarray[
'width'];
74 $this->page_hauteur = $formatarray[
'height'];
75 $this->format = array($this->page_largeur, $this->page_hauteur);
81 $this->option_logo = 1;
82 $this->option_tva = 1;
85 $this->emetteur = $mysoc;
86 if (!$this->emetteur->country_code) {
87 $this->emetteur->country_code = substr($langs->defaultlang, -2);
91 $this->posxref = $this->marge_gauche + 1;
92 $this->posxlabel = $this->marge_gauche + 25;
93 $this->posxworkload = $this->marge_gauche + 100;
94 $this->posxdatestart = $this->marge_gauche + 150;
95 $this->posxdateend = $this->marge_gauche + 170;
110 global $conf, $hookmanager, $langs, $user;
112 if (!is_object($outputlangs)) {
113 $outputlangs = $langs;
117 $outputlangs->charset_output =
'ISO-8859-1';
121 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
123 if ($conf->bank->dir_output) {
128 $dir = $conf->bank->dir_output;
129 $file = $dir.
"/SPECIMEN.pdf";
132 $dir = $conf->bank->dir_output.
"/".$objectref;
133 $file = $dir.
"/".$objectref.
".pdf";
136 if (!file_exists($dir)) {
138 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
143 if (file_exists($dir)) {
145 if (!is_object($hookmanager)) {
146 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
149 $hookmanager->initHooks(array(
'pdfgeneration'));
150 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
152 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
156 $heightforinfotot = 50;
157 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
158 $heightforfooter = $this->marge_basse + 8;
160 $heightforfooter += 6;
162 $pdf->SetAutoPageBreak(1, 0);
164 if (class_exists(
'TCPDF')) {
165 $pdf->setPrintHeader(
false);
166 $pdf->setPrintFooter(
false);
172 $pdf->SetDrawColor(128, 128, 128);
174 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
175 $pdf->SetSubject($outputlangs->transnoentities(
"BAN"));
176 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
177 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
178 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"BAN"));
180 $pdf->SetCompression(
false);
184 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
190 $pdf->SetFont(
'',
'', $default_font_size - 1);
191 $pdf->MultiCell(0, 3,
'');
192 $pdf->SetTextColor(0, 0, 0);
195 $tab_top_newpage = 40;
197 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
200 if (!empty(
$object->note_public)) {
201 $pdf->SetFont(
'',
'', $default_font_size - 1);
203 $nexY = $pdf->GetY();
204 $height_note = $nexY - ($tab_top - 2);
207 $pdf->SetDrawColor(192, 192, 192);
208 $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
210 $tab_height = $tab_height - $height_note;
211 $tab_top = $nexY + 6;
216 $iniY = $tab_top + 7;
217 $curY = $tab_top + 7;
218 $nexY = $tab_top + 7;
220 $pdf->SetXY($this->marge_gauche, $curY);
221 $pdf->MultiCell(200, 3, $outputlangs->trans(
"BAN").
' : '.
$object->account_number, 0,
'L');
227 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
228 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
230 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
231 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
238 if (method_exists($pdf,
'AliasNbPages')) {
239 $pdf->AliasNbPages();
244 $pdf->Output($file,
'F');
247 if (!is_object($hookmanager)) {
248 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
251 $hookmanager->initHooks(array(
'pdfgeneration'));
252 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
254 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
256 $this->error = $hookmanager->error;
257 $this->errors = $hookmanager->errors;
262 $this->result = array(
'fullpath' => $file);
266 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
271 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"DELIVERY_OUTPUTDIR");
309 global $langs, $conf, $mysoc;
316 $pdf->SetTextColor(0, 0, 60);
317 $pdf->SetFont(
'',
'B', $default_font_size + 3);
319 $posx = $this->page_largeur - $this->marge_droite - 100;
320 $posy = $this->marge_haute;
322 $pdf->SetXY($this->marge_gauche, $posy);
325 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
327 if (is_readable($logo)) {
329 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
331 $pdf->SetTextColor(200, 0, 0);
332 $pdf->SetFont(
'',
'B', $default_font_size - 2);
333 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
334 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
337 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
340 $pdf->SetFont(
'',
'B', $default_font_size + 3);
341 $pdf->SetXY($posx, $posy);
342 $pdf->SetTextColor(0, 0, 60);
343 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"BAN").
" ".$outputlangs->convToOutputCharset(
$object->ref),
'',
'R');
344 $pdf->SetFont(
'',
'', $default_font_size + 2);
347 $pdf->SetXY($posx, $posy);
348 $pdf->SetTextColor(0, 0, 60);
349 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
dol_now(),
'day',
false, $outputlangs,
true),
'',
'R');
355 $pdf->SetTextColor(0, 0, 60);