63 global $langs, $mysoc;
66 $langs->loadLangs(array(
"main",
"bank",
"withdrawals",
"companies"));
70 $this->
description = $langs->trans(
"DocumentModelBan").
' (Volunteer wanted to finish)';
75 $this->page_largeur = $formatarray[
'width'];
76 $this->page_hauteur = $formatarray[
'height'];
77 $this->format = array($this->page_largeur, $this->page_hauteur);
82 $this->corner_radius =
getDolGlobalInt(
'MAIN_PDF_FRAME_CORNER_RADIUS', 0);
83 $this->option_logo = 1;
84 $this->option_tva = 1;
87 $this->posxref = $this->marge_gauche + 1;
88 $this->posxlabel = $this->marge_gauche + 25;
89 $this->posxworkload = $this->marge_gauche + 100;
90 $this->posxdatestart = $this->marge_gauche + 150;
91 $this->posxdateend = $this->marge_gauche + 170;
93 if ($mysoc ===
null) {
98 $this->emetteur = $mysoc;
99 if (!$this->emetteur->country_code) {
100 $this->emetteur->country_code = substr($langs->defaultlang, -2);
116 global $conf, $hookmanager, $langs, $user;
118 if (!is_object($outputlangs)) {
119 $outputlangs = $langs;
123 $outputlangs->charset_output =
'ISO-8859-1';
127 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
129 if ($conf->bank->dir_output) {
134 $dir = $conf->bank->dir_output;
135 $file = $dir.
"/SPECIMEN.pdf";
138 $dir = $conf->bank->dir_output.
"/".$objectref;
139 $file = $dir.
"/".$objectref.
".pdf";
142 if (!file_exists($dir)) {
144 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
149 if (file_exists($dir)) {
151 if (!is_object($hookmanager)) {
152 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
155 $hookmanager->initHooks(array(
'pdfgeneration'));
156 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
158 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
162 $heightforinfotot = 50;
164 $heightforfooter = $this->marge_basse + 8;
166 $heightforfooter += 6;
168 $pdf->SetAutoPageBreak(1, 0);
170 if (class_exists(
'TCPDF')) {
171 $pdf->setPrintHeader(
false);
172 $pdf->setPrintFooter(
false);
178 $pdf->SetDrawColor(128, 128, 128);
180 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
181 $pdf->SetSubject($outputlangs->transnoentities(
"BAN"));
182 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
183 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
184 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"BAN"));
186 $pdf->SetCompression(
false);
190 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
196 $pdf->SetFont(
'',
'', $default_font_size - 1);
197 $pdf->MultiCell(0, 3,
'');
198 $pdf->SetTextColor(0, 0, 0);
201 $tab_top_newpage = 40;
203 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
206 if (!empty(
$object->note_public)) {
207 $pdf->SetFont(
'',
'', $default_font_size - 1);
209 $nexY = $pdf->GetY();
210 $height_note = $nexY - ($tab_top - 2);
213 $pdf->SetDrawColor(192, 192, 192);
214 $pdf->RoundedRect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius,
'1234',
'D');
216 $tab_height -= $height_note;
217 $tab_top = $nexY + 6;
222 $iniY = $tab_top + 7;
223 $curY = $tab_top + 7;
224 $nexY = $tab_top + 7;
226 $pdf->SetXY($this->marge_gauche, $curY);
227 $pdf->MultiCell(200, 3, $outputlangs->trans(
"BAN").
' : '.
$object->account_number, 0,
'L');
233 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
234 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
236 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
237 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
244 if (method_exists($pdf,
'AliasNbPages')) {
245 $pdf->AliasNbPages();
250 $pdf->Output($file,
'F');
253 if (!is_object($hookmanager)) {
254 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
257 $hookmanager->initHooks(array(
'pdfgeneration'));
258 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
260 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
262 $this->error = $hookmanager->error;
263 $this->errors = $hookmanager->errors;
268 $this->result = array(
'fullpath' => $file);
272 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
277 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"DELIVERY_OUTPUTDIR");
315 global $langs, $conf, $mysoc;
322 $pdf->SetTextColor(0, 0, 60);
323 $pdf->SetFont(
'',
'B', $default_font_size + 3);
325 $posx = $this->page_largeur - $this->marge_droite - 100;
326 $posy = $this->marge_haute;
328 $pdf->SetXY($this->marge_gauche, $posy);
331 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
333 if (is_readable($logo)) {
335 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
337 $pdf->SetTextColor(200, 0, 0);
338 $pdf->SetFont(
'',
'B', $default_font_size - 2);
339 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
340 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
343 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
346 $pdf->SetFont(
'',
'B', $default_font_size + 3);
347 $pdf->SetXY($posx, $posy);
348 $pdf->SetTextColor(0, 0, 60);
349 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"BAN").
" ".$outputlangs->convToOutputCharset(
$object->ref),
'',
'R');
350 $pdf->SetFont(
'',
'', $default_font_size + 2);
353 $pdf->SetXY($posx, $posy);
354 $pdf->SetTextColor(0, 0, 60);
355 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
dol_now(),
'day',
false, $outputlangs,
true),
'',
'R');
361 $pdf->SetTextColor(0, 0, 60);