121 global $user, $conf, $langs, $hookmanager;
123 if (!is_object($outputlangs)) {
124 $outputlangs = $langs;
127 $sav_charset_output = $outputlangs->charset_output;
129 $outputlangs->charset_output =
'ISO-8859-1';
133 $outputlangs->loadLangs(array(
"main",
"companies",
"bills",
"products",
"compta"));
141 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
146 $file = $dir.
"/bordereau-".$number.
".pdf";
149 if (!is_object($hookmanager)) {
150 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
153 $hookmanager->initHooks(array(
'pdfgeneration'));
154 $parameters = array(
'file' => $file,
'outputlangs' => $outputlangs);
156 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
160 $heightforinfotot = 50;
162 $heightforfooter = $this->marge_basse + 8;
164 $heightforfooter += 6;
166 $pdf->SetAutoPageBreak(1, 0);
168 if (class_exists(
'TCPDF')) {
169 $pdf->setPrintHeader(
false);
170 $pdf->setPrintFooter(
false);
176 $pdf->SetDrawColor(128, 128, 128);
178 $pdf->SetTitle($outputlangs->transnoentities(
"CheckReceipt").
" ".$number);
179 $pdf->SetSubject($outputlangs->transnoentities(
"CheckReceipt"));
180 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
181 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
182 $pdf->SetKeyWords($outputlangs->transnoentities(
"CheckReceipt").
" ".$number);
184 $pdf->SetCompression(
false);
188 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
190 $nboflines = count($this->lines);
193 $pages = intval($nboflines / $this->line_per_page);
194 if (($nboflines % $this->line_per_page) > 0) {
204 $this->
Header($pdf, $pagenb, $pages, $outputlangs);
206 $this->
Body($pdf, $pagenb, $pages, $outputlangs);
209 $this->
_pagefoot($pdf,
'', $outputlangs);
210 if (method_exists($pdf,
'AliasNbPages')) {
211 $pdf->AliasNbPages();
216 $pdf->Output($file,
'F');
219 if (!is_object($hookmanager)) {
220 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
223 $hookmanager->initHooks(array(
'pdfgeneration'));
224 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
226 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
228 $this->error = $hookmanager->error;
229 $this->errors = $hookmanager->errors;
234 $this->result = array(
'fullpath' => $file);
236 $outputlangs->charset_output = $sav_charset_output;
251 public function Header(&$pdf, $page, $pages, $outputlangs)
258 $outputlangs->loadLangs(array(
"compta",
"banks"));
260 $title = $outputlangs->transnoentities(
"CheckReceipt");
261 $pdf->SetFont(
'',
'B', $default_font_size);
263 $pdf->MultiCell(0, 2, $title, 0,
'L');
265 $pdf->SetFont(
'',
'', $default_font_size);
267 $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"Ref"), 0,
'L');
269 $pdf->SetFont(
'',
'', $default_font_size);
270 $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext ?
" - ".$this->ref_ext :
'')), 0,
'L');
272 $pdf->SetFont(
'',
'', $default_font_size);
274 $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"Date"), 0,
'L');
276 $pdf->SetFont(
'',
'', $default_font_size);
277 $pdf->MultiCell(60, 2,
dol_print_date($this->date,
"day",
false, $outputlangs));
279 $pdf->SetFont(
'',
'', $default_font_size);
281 $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"Owner"), 0,
'L');
282 $pdf->SetFont(
'',
'', $default_font_size);
284 $pdf->MultiCell(80, 2, $outputlangs->convToOutputCharset($this->account->owner_name), 0,
'L');
286 $pdf->SetFont(
'',
'', $default_font_size);
288 $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"BankAccount"), 0,
'L');
289 pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1);
291 $pdf->SetFont(
'',
'', $default_font_size);
292 $pdf->SetXY(114, 15);
293 $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"Signature"), 0,
'L');
295 $pdf->RoundedRect(9, 14, 192, 35, $this->corner_radius,
'1234',
'D');
296 $pdf->line(9, 19, 112, 19);
297 $pdf->line(9, 25, 112, 25);
299 $pdf->line(9, 31, 112, 31);
301 $pdf->line(30, 14, 30, 49);
302 $pdf->line(112, 14, 112, 49);
306 $pdf->RoundedRect(9, $posy, 192, 6, $this->corner_radius,
'1234',
'D');
307 $pdf->line(55, $posy, 55, $posy + 6);
308 $pdf->line(140, $posy, 140, $posy + 6);
309 $pdf->line(170, $posy, 170, $posy + 6);
311 $pdf->SetFont(
'',
'', $default_font_size);
312 $pdf->SetXY(10, $posy + 1);
313 $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"NumberOfCheques"), 0,
'L');
315 $pdf->SetFont(
'',
'B', $default_font_size);
316 $pdf->SetXY(57, $posy + 1);
317 $pdf->MultiCell(40, 2, $this->nbcheque, 0,
'L');
319 $pdf->SetFont(
'',
'', $default_font_size);
320 $pdf->SetXY(148, $posy + 1);
321 $pdf->MultiCell(40, 2, $langs->trans(
"Total"));
323 $pdf->SetFont(
'',
'B', $default_font_size);
324 $pdf->SetXY(170, $posy + 1);
325 $pdf->MultiCell(31, 2,
price($this->amount), 0,
'C', 0);
328 $pdf->SetFont(
'',
'', $default_font_size - 2);
329 $pdf->SetXY(11, $this->tab_top + 2);
330 $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"Num"), 0,
'L');
331 $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
333 $pdf->SetXY(41, $this->tab_top + 2);
334 $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"Bank"), 0,
'L');
335 $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10);
337 $pdf->SetXY(101, $this->tab_top + 2);
338 $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"CheckTransmitter"), 0,
'L');
339 $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10);
341 $pdf->SetXY(180, $this->tab_top + 2);
342 $pdf->MultiCell(20, 2, $outputlangs->transnoentities(
"Amount"), 0,
'R');
343 $pdf->line(9, $this->tab_top + 8, 201, $this->tab_top + 8);
345 $pdf->RoundedRect(9, $this->tab_top, 192, $this->tab_height + 10, $this->corner_radius,
'1234',
'D');
359 public function Body(&$pdf, $pagenb, $pages, $outputlangs)
366 $pdf->SetFont(
'',
'', $default_font_size - 1);
368 $pdf->SetFillColor(220, 220, 220);
371 $num = count($this->lines);
372 for ($j = 0; $j < $num; $j++) {
374 $dynamic_line_height = array();
375 $dynamic_line_height[] = $pdf->getStringHeight(60, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq));
376 $dynamic_line_height[] = $pdf->getStringHeight(80, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq));
377 $max_line_height = max($dynamic_line_height);
379 if ($max_line_height > $this->line_height) {
380 $nb_lines = floor($max_line_height / $this->line_height) + 1;
386 if ($lineinpage >= ($this->line_per_page - 1)) {
393 $this->
Header($pdf, $pagenb, $pages, $outputlangs);
394 $pdf->SetFont(
'',
'', $default_font_size - 1);
395 $pdf->MultiCell(0, 3,
'');
396 $pdf->SetTextColor(0, 0, 0);
399 $lineinpage += $nb_lines;
401 $pdf->SetXY(1, $this->tab_top + 10 + $yp);
402 $pdf->MultiCell(8, $this->line_height, $j + 1, 0,
'R', 0);
404 $pdf->SetXY(10, $this->tab_top + 10 + $yp);
405 $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq :
'', 0,
'L', 0);
407 $pdf->SetXY(40, $this->tab_top + 10 + $yp);
408 $pdf->MultiCell(60, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq, 44), 0,
'L', 0);
410 $pdf->SetXY(100, $this->tab_top + 10 + $yp);
411 $pdf->MultiCell(80, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq, 50), 0,
'L', 0);
413 $pdf->SetXY(180, $this->tab_top + 10 + $yp);
414 $pdf->MultiCell(20, $this->line_height,
price($this->lines[$j]->amount_chq), 0,
'R', 0);
416 $yp += ($this->line_height * $nb_lines);