28require_once DOL_DOCUMENT_ROOT.
'/core/modules/bank/modules_bank.php';
29require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44 public $version =
'development';
49 public $posxdatestart;
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");
295 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
298 global
$conf, $mysoc;
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);
401 $showdetails = !
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 0 :
$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Parent class for bank account models.
Class permettant de generer les projects 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 $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
dolChmod($filepath, $newmask='')
Change mod of a file.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
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.