public function render()
 {
     if (!$this->conteudo) {
         include_once 'app.ado/DataBase.php';
         $pdo = new DataBase();
         $db = $pdo->getConn();
         $sql = 'select * from ctrl_chaves';
         if ($this->dt_inicial or $this->dt_final) {
             $this->dt_inicial = $this->dt_inicial ? $this->dt_inicial : '2012/01/01';
             $this->dt_final = $this->dt_final ? $this->dt_final : date('Y/m/d');
             $sql .= ' where ((dt_inicial_controle between ? and ?) or (dt_final_controle between ? and ?))';
             $exec[] = $this->dt_inicial;
             $exec[] = $this->dt_final;
             if ($this->id) {
                 $sql .= ' and id_controle = ?';
                 $exec[] = $this->id;
             }
         } elseif ($this->id) {
             $sql .= ' where id_controle = ?';
             $exec[] = $this->id;
         }
         if ($this->order) {
             $sql .= ' order by ?';
             $exec[] = $this->order;
         }
         $sth = $db->prepare($sql);
         $conteudo = $sth->execute($exec);
         $this->conteudo = $conteudo->fetchAll(PDO::FETCH_CLASS, 'CrlChave');
     }
     $tabela = new TTableChave($this->conteudo);
     $pdf = new TRelatorio();
     $pdf->writeHTML($tabela->render());
     $pdf->render();
     $pdf->exit();
 }
 public function render()
 {
     if (is_array($this->conteudo)) {
         $html = '';
         foreach ($this->conteudo as $item) {
             $tabela = new TTableEmprestimo($item);
             $html .= $tabela->render();
         }
     } else {
         $tabela = new TTableEmprestimo($this->conteudo);
         $html .= $tabela->render();
     }
     //var_dump($html);
     $pdf = new TRelatorio();
     $pdf->pdf->WriteHTML(utf8_encode($html));
     $pdf->pdf->Output('jomaro.pdf', 'D');
     $pdf->exit();
 }