124    global $user, 
$conf, $langs, $hookmanager;
 
  126    if (!is_object($outputlangs)) {
 
  127      $outputlangs = $langs;
 
  130    $sav_charset_output = $outputlangs->charset_output;
 
  132      $outputlangs->charset_output = 
'ISO-8859-1';
 
  136    $outputlangs->loadLangs(array(
"main", 
"companies", 
"bills", 
"products", 
"compta"));
 
  144        $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
 
  149    $file = $dir.
"/bordereau-".$number.
".pdf";
 
  152    if (!is_object($hookmanager)) {
 
  153      include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
 
  156    $hookmanager->initHooks(array(
'pdfgeneration'));
 
  157    $parameters = array(
'file' => $file, 
'outputlangs' => $outputlangs);
 
  159    $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, 
$object, $action); 
 
  163    $heightforinfotot = 50; 
 
  165    $heightforfooter = $this->marge_basse + 8; 
 
  167      $heightforfooter += 6;
 
  169    $pdf->SetAutoPageBreak(1, 0);
 
  171    if (class_exists(
'TCPDF')) {
 
  172      $pdf->setPrintHeader(
false);
 
  173      $pdf->setPrintFooter(
false);
 
  179    $pdf->SetDrawColor(128, 128, 128);
 
  181    $pdf->SetTitle($outputlangs->transnoentities(
"CheckReceipt").
" ".$number);
 
  182    $pdf->SetSubject($outputlangs->transnoentities(
"CheckReceipt"));
 
  183    $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
 
  184    $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
 
  185    $pdf->SetKeyWords($outputlangs->transnoentities(
"CheckReceipt").
" ".$number);
 
  187      $pdf->SetCompression(
false);
 
  191    $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); 
 
  193    $nboflines = count($this->lines);
 
  196    $pages = intval($nboflines / $this->line_per_page);
 
  197    if (($nboflines % $this->line_per_page) > 0) {
 
  207    $this->
Header($pdf, $pagenb, $pages, $outputlangs);
 
  209    $this->
Body($pdf, $pagenb, $pages, $outputlangs);
 
  212    $this->
_pagefoot($pdf, 
null, $outputlangs);
 
  213    if (method_exists($pdf, 
'AliasNbPages')) {
 
  214      $pdf->AliasNbPages();  
 
  219    $pdf->Output($file, 
'F');
 
  222    if (!is_object($hookmanager)) {
 
  223      include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
 
  226    $hookmanager->initHooks(array(
'pdfgeneration'));
 
  227    $parameters = array(
'file' => $file, 
'object' => 
$object, 
'outputlangs' => $outputlangs);
 
  229    $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action); 
 
  231      $this->error = $hookmanager->error;
 
  232      $this->errors = $hookmanager->errors;
 
  237    $this->result = array(
'fullpath' => $file);
 
  239    $outputlangs->charset_output = $sav_charset_output;
 
 
  254  public function Header(&$pdf, $page, $pages, $outputlangs)
 
  261    $outputlangs->loadLangs(array(
"compta", 
"banks"));
 
  263    $title = $outputlangs->transnoentities(
"CheckReceipt");
 
  264    $pdf->SetFont(
'', 
'B', $default_font_size);
 
  266    $pdf->MultiCell(0, 2, $title, 0, 
'L');
 
  268    $pdf->SetFont(
'', 
'', $default_font_size);
 
  270    $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"Ref"), 0, 
'L');
 
  272    $pdf->SetFont(
'', 
'', $default_font_size);
 
  273    $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext ? 
" - ".$this->ref_ext : 
'')), 0, 
'L');
 
  275    $pdf->SetFont(
'', 
'', $default_font_size);
 
  277    $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"Date"), 0, 
'L');
 
  279    $pdf->SetFont(
'', 
'', $default_font_size);
 
  280    $pdf->MultiCell(60, 2, 
dol_print_date($this->date, 
"day", 
false, $outputlangs));
 
  282    $pdf->SetFont(
'', 
'', $default_font_size);
 
  284    $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"Owner"), 0, 
'L');
 
  285    $pdf->SetFont(
'', 
'', $default_font_size);
 
  287    $pdf->MultiCell(80, 2, $outputlangs->convToOutputCharset($this->account->owner_name), 0, 
'L');
 
  289    $pdf->SetFont(
'', 
'', $default_font_size);
 
  291    $pdf->MultiCell(22, 2, $outputlangs->transnoentities(
"BankAccount"), 0, 
'L');
 
  292    pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1);
 
  294    $pdf->SetFont(
'', 
'', $default_font_size);
 
  295    $pdf->SetXY(114, 15);
 
  296    $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"Signature"), 0, 
'L');
 
  298    $pdf->RoundedRect(9, 14, 192, 35, $this->corner_radius, 
'1234', 
'D');
 
  299    $pdf->line(9, 19, 112, 19);
 
  300    $pdf->line(9, 25, 112, 25);
 
  302    $pdf->line(9, 31, 112, 31);
 
  304    $pdf->line(30, 14, 30, 49);
 
  305    $pdf->line(112, 14, 112, 49);
 
  309    $pdf->RoundedRect(9, $posy, 192, 6, $this->corner_radius, 
'1234', 
'D');
 
  310    $pdf->line(55, $posy, 55, $posy + 6);
 
  311    $pdf->line(140, $posy, 140, $posy + 6);
 
  312    $pdf->line(170, $posy, 170, $posy + 6);
 
  314    $pdf->SetFont(
'', 
'', $default_font_size);
 
  315    $pdf->SetXY(10, $posy + 1);
 
  316    $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"NumberOfCheques"), 0, 
'L');
 
  318    $pdf->SetFont(
'', 
'B', $default_font_size);
 
  319    $pdf->SetXY(57, $posy + 1);
 
  320    $pdf->MultiCell(40, 2, $this->nbcheque, 0, 
'L');
 
  322    $pdf->SetFont(
'', 
'', $default_font_size);
 
  323    $pdf->SetXY(148, $posy + 1);
 
  324    $pdf->MultiCell(40, 2, $langs->trans(
"Total"));
 
  326    $pdf->SetFont(
'', 
'B', $default_font_size);
 
  327    $pdf->SetXY(170, $posy + 1);
 
  328    $pdf->MultiCell(31, 2, 
price($this->amount), 0, 
'C', 0);
 
  331    $pdf->SetFont(
'', 
'', $default_font_size - 2);
 
  332    $pdf->SetXY(11, $this->tab_top + 2);
 
  333    $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"Num"), 0, 
'L');
 
  334    $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
 
  336    $pdf->SetXY(41, $this->tab_top + 2);
 
  337    $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"Bank"), 0, 
'L');
 
  338    $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10);
 
  340    $pdf->SetXY(101, $this->tab_top + 2);
 
  341    $pdf->MultiCell(40, 2, $outputlangs->transnoentities(
"CheckTransmitter"), 0, 
'L');
 
  342    $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10);
 
  344    $pdf->SetXY(180, $this->tab_top + 2);
 
  345    $pdf->MultiCell(20, 2, $outputlangs->transnoentities(
"Amount"), 0, 
'R');
 
  346    $pdf->line(9, $this->tab_top + 8, 201, $this->tab_top + 8);
 
  348    $pdf->RoundedRect(9, $this->tab_top, 192, $this->tab_height + 10, $this->corner_radius, 
'1234', 
'D');
 
 
  362  public function Body(&$pdf, $pagenb, $pages, $outputlangs)
 
  369    $pdf->SetFont(
'', 
'', $default_font_size - 1);
 
  371    $pdf->SetFillColor(220, 220, 220);
 
  374    $num = count($this->lines);
 
  375    for ($j = 0; $j < $num; $j++) {
 
  377      $dynamic_line_height = array();
 
  378      $dynamic_line_height[] = $pdf->getStringHeight(60, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq));
 
  379      $dynamic_line_height[] = $pdf->getStringHeight(80, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq));
 
  380      $max_line_height = max($dynamic_line_height);
 
  382      if ($max_line_height > $this->line_height) {
 
  383        $nb_lines = floor($max_line_height / $this->line_height) + 1;
 
  389      if ($lineinpage >= ($this->line_per_page - 1)) {
 
  396        $this->
Header($pdf, $pagenb, $pages, $outputlangs);
 
  397        $pdf->SetFont(
'', 
'', $default_font_size - 1);
 
  398        $pdf->MultiCell(0, 3, 
''); 
 
  399        $pdf->SetTextColor(0, 0, 0);
 
  402      $lineinpage += $nb_lines;
 
  404      $pdf->SetXY(1, $this->tab_top + 10 + $yp);
 
  405      $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 
'R', 0);
 
  407      $pdf->SetXY(10, $this->tab_top + 10 + $yp);
 
  408      $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : 
'', 0, 
'L', 0);
 
  410      $pdf->SetXY(40, $this->tab_top + 10 + $yp);
 
  411      $pdf->MultiCell(60, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->bank_chq, 44), 0, 
'L', 0);
 
  413      $pdf->SetXY(100, $this->tab_top + 10 + $yp);
 
  414      $pdf->MultiCell(80, $this->line_height, $outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq, 50), 0, 
'L', 0);
 
  416      $pdf->SetXY(180, $this->tab_top + 10 + $yp);
 
  417      $pdf->MultiCell(20, $this->line_height, 
price($this->lines[$j]->amount_chq), 0, 
'R', 0);
 
  419      $yp += ($this->line_height * $nb_lines);