25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/bank/modules_bank.php';
26 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
46 public $version =
'development';
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;
253 if (!empty($conf->global->MAIN_UMASK)) {
254 @chmod($file, octdec($conf->global->MAIN_UMASK));
257 $this->result = array(
'fullpath'=>$file);
261 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
266 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"DELIVERY_OUTPUTDIR");
284 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
287 global $conf, $mysoc;
302 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
304 global $langs, $conf, $mysoc;
311 $pdf->SetTextColor(0, 0, 60);
312 $pdf->SetFont(
'',
'B', $default_font_size + 3);
314 $posx = $this->page_largeur - $this->marge_droite - 100;
315 $posy = $this->marge_haute;
317 $pdf->SetXY($this->marge_gauche, $posy);
320 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
322 if (is_readable($logo)) {
324 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
326 $pdf->SetTextColor(200, 0, 0);
327 $pdf->SetFont(
'',
'B', $default_font_size - 2);
328 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
329 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
332 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
335 $pdf->SetFont(
'',
'B', $default_font_size + 3);
336 $pdf->SetXY($posx, $posy);
337 $pdf->SetTextColor(0, 0, 60);
338 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"BAN").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
339 $pdf->SetFont(
'',
'', $default_font_size + 2);
342 $pdf->SetXY($posx, $posy);
343 $pdf->SetTextColor(0, 0, 60);
344 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
dol_now(),
'day',
false, $outputlangs,
true),
'',
'R');
350 $pdf->SetTextColor(0, 0, 60);
387 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
392 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
Parent class for bank account models.
Classe permettant de generer les projets au modele Ban.
__construct($db)
Constructor.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
write_file($object, $outputlangs)
Fonction generant le projet sur le disque.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.