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);
70 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
71 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
72 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
73 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
75 $this->option_logo = 1;
76 $this->option_tva = 1;
77 $this->option_codeproduitservice = 1;
80 $this->emetteur = $mysoc;
81 if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2);
84 $this->posxref = $this->marge_gauche + 1;
85 $this->posxlabel = $this->marge_gauche + 25;
86 $this->posxworkload = $this->marge_gauche + 100;
87 $this->posxdatestart = $this->marge_gauche + 150;
88 $this->posxdateend = $this->marge_gauche + 170;
103 global $conf, $hookmanager, $langs, $user;
105 if (!is_object($outputlangs)) $outputlangs = $langs;
107 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
110 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
112 if ($conf->bank->dir_output)
117 if ($object->specimen) {
118 $dir = $conf->bank->dir_output;
119 $file = $dir.
"/SPECIMEN.pdf";
122 $dir = $conf->bank->dir_output.
"/".$objectref;
123 $file = $dir.
"/".$objectref.
".pdf";
126 if (!file_exists($dir))
130 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
135 if (file_exists($dir))
138 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)) $heightforfooter += 6;
154 $pdf->SetAutoPageBreak(1, 0);
156 if (class_exists(
'TCPDF'))
158 $pdf->setPrintHeader(
false);
159 $pdf->setPrintFooter(
false);
165 $pdf->SetDrawColor(128, 128, 128);
167 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
168 $pdf->SetSubject($outputlangs->transnoentities(
"BAN"));
169 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
170 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
171 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"BAN"));
172 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
174 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
179 $this->
_pagehead($pdf, $object, 1, $outputlangs);
180 $pdf->SetFont(
'',
'', $default_font_size - 1);
181 $pdf->MultiCell(0, 3,
'');
182 $pdf->SetTextColor(0, 0, 0);
186 $tab_top_newpage = 40;
187 $tab_height_newpage = 210;
190 if (!empty($object->note_public))
192 $pdf->SetFont(
'',
'', $default_font_size - 1);
193 $pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2,
dol_htmlentitiesbr($object->note_public), 0, 1);
194 $nexY = $pdf->GetY();
195 $height_note = $nexY - ($tab_top - 2);
198 $pdf->SetDrawColor(192, 192, 192);
199 $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
201 $tab_height = $tab_height - $height_note;
202 $tab_top = $nexY + 6;
207 $iniY = $tab_top + 7;
208 $curY = $tab_top + 7;
209 $nexY = $tab_top + 7;
211 $pdf->SetXY($this->marge_gauche, $curY);
212 $pdf->MultiCell(200, 3, $outputlangs->trans(
"BAN").
' : '.$object->account_number, 0,
'L');
219 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
220 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
222 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
223 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
229 $this->
_pagefoot($pdf, $object, $outputlangs);
230 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
234 $pdf->Output($file,
'F');
237 if (!is_object($hookmanager))
239 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
242 $hookmanager->initHooks(array(
'pdfgeneration'));
243 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
245 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
248 $this->error = $hookmanager->error;
249 $this->errors = $hookmanager->errors;
252 if (!empty($conf->global->MAIN_UMASK))
253 @chmod($file, octdec($conf->global->MAIN_UMASK));
255 $this->result = array(
'fullpath'=>$file);
259 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
264 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"DELIVERY_OUTPUTDIR");
282 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
285 global $conf, $mysoc;
300 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
302 global $langs, $conf, $mysoc;
309 $pdf->SetTextColor(0, 0, 60);
310 $pdf->SetFont(
'',
'B', $default_font_size + 3);
312 $posx = $this->page_largeur - $this->marge_droite - 100;
313 $posy = $this->marge_haute;
315 $pdf->SetXY($this->marge_gauche, $posy);
318 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
321 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');
331 }
else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
333 $pdf->SetFont(
'',
'B', $default_font_size + 3);
334 $pdf->SetXY($posx, $posy);
335 $pdf->SetTextColor(0, 0, 60);
336 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"BAN").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
337 $pdf->SetFont(
'',
'', $default_font_size + 2);
340 $pdf->SetXY($posx, $posy);
341 $pdf->SetTextColor(0, 0, 60);
342 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
dol_now(),
'day',
false, $outputlangs,
true),
'',
'R');
348 $pdf->SetTextColor(0, 0, 60);
385 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
390 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
Parent class for bank account models.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
dol_now($mode= 'auto')
Return date for now.
write_file($object, $outputlangs)
Fonction generant le projet sur le disque.
__construct($db)
Constructor.
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...
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Classe permettant de generer les projets au modele Ban.
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)