Lançado Adianti Framework 8.1!
Clique aqui para saber mais
Relatório Tabular com SQL Filtro Período ( não acha registros) Pessoal Gerei um relatorio tabular SQL com filtro de duas datas pelo Studio Pro, e a query não retorna nenhum registro. Executando ela na mão aparecem os registros. Comentei o filtro no código, mas daí não grava nenhum PDF e também não dá erro ...
CD
Relatório Tabular com SQL Filtro Período ( não acha registros)  
Pessoal

Gerei um relatorio tabular SQL com filtro de duas datas pelo Studio Pro, e a query não retorna nenhum registro.

Executando ela na mão aparecem os registros.

Comentei o filtro no código, mas daí não grava nenhum PDF e também não dá erro


  1. <?php
  2. /**
  3.  * Tabular Query Report
  4.  *
  5.  * @version    1.0
  6.  * @package    samples
  7.  * @subpackage tutor
  8.  * @author     Pablo Dall'Oglio
  9.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  10.  * @license    http://www.adianti.com.br/framework-license
  11.  */
  12. class ocor_navio_per extends TPage
  13. {
  14.     private $form// form
  15.     
  16.     /**
  17.      * Class constructor
  18.      * Creates the page and the registration form
  19.      */
  20.     function __construct()
  21.     {
  22.         parent::__construct();
  23.         
  24.         // creates the form
  25.         $this->form = new BootstrapFormBuilder('form_ocor_navio_per.php_report');
  26.         $this->form->setFormTitle'Relatório Navio x Ocorrência' );
  27.         
  28.         // create the form fields
  29.         
  30.         $DATA_INI      = new TDate('DATA_INI');
  31.         $DATA_FIM      = new TDate('DATA_FIM');
  32.         
  33.         $DATA_INI->setmask('dd/mm/yyyy');
  34.         $DATA_FIM->setmask('dd/mm/yyyy');
  35.         
  36.         $this->form->addFields( [new TLabel('Data Inicial: ''red')],     [$DATA_INI] );
  37.         $this->form->addFields( [new TLabel('Data Final..: ''red')],     [$DATA_FIM] );
  38.  
  39.         $DATA_INI->addValidation('Data Ini ', new TRequiredValidator);
  40.         $DATA_FIM->addValidation('Data Fim ', new TRequiredValidator);
  41.         
  42.         $output_type  = new TRadioGroup('output_type');
  43.         $this->form->addFields( [new TLabel('Output')],   [$output_type] );
  44.         
  45.         // define field properties
  46.         $output_type->setUseButton();
  47.         $options = ['html' =>'HTML''pdf' =>'PDF''rtf' =>'RTF''xls' =>'XLS'];
  48.         $output_type->addItems($options);
  49.         $output_type->setValue('pdf');
  50.         $output_type->setLayout('horizontal');
  51.         
  52.         $this->form->addAction'Gerar', new TAction(array($this'onGenerate')), 'fa:download blue');
  53.         
  54.         // wrap the page content using vertical box
  55.         $vbox = new TVBox;
  56.         $vbox->style 'width: 100%';
  57.         // $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  58.         $vbox->add($this->form);
  59.         
  60.         parent::add($vbox);
  61.     }
  62.     /**
  63.      * method onGenerate()
  64.      * Executed whenever the user clicks at the generate button
  65.      */
  66.     function onGenerate()
  67.     {
  68.         try
  69.         {
  70.             // get the form data into an active record Customer
  71.             $data $this->form->getData();
  72.             $this->form->setData($data);
  73.             
  74.             $format $data->output_type;
  75.             
  76.             // open a transaction with database 'datasiop'
  77.             $source TTransaction::open('datasiop');
  78.             
  79.             // define the query
  80.             $query 'SELECT B.NOME AS NAVIO, B.IMO AS IMO,  C.DESCRICAO AS OCORRENCIA,COUNT(0) AS TOTAL
  81.                     FROM OCORRENCIA A, BZM_NAVIO B, bzm_tipo_ocorrencia C
  82.                     WHERE
  83.                     B.ID_NAVIO=A.id_navio_pk
  84.                     AND C.ID_TIPO_OCORRENCIA = A.id_tp_ocorrencia
  85.                     AND A.DATA_OCORRENCIA BETWEEN :DATA_INI AND :DATA_FIM
  86.                     GROUP BY B.NOME, B.IMO,C.DESCRICAO
  87.                     ORDER BY 1,3';
  88.             
  89.             $filters = [];
  90.             $filters['DATA_INI'] = TDate::date2us($data->DATA_INI);
  91.             $filters['DATA_FIM'] = TDate::date2us($data->DATA_FIM);
  92.             
  93.             $data TDatabase::getData($source$querynull$filters );
  94.         
  95.            
  96.             if ($data)
  97.             {
  98.                 $widths = [200,200,200,200];
  99.                 
  100.                 switch ($format)
  101.                 {
  102.                     case 'html':
  103.                         $table = new TTableWriterHTML($widths);
  104.                         break;
  105.                     case 'pdf':
  106.                         $table = new TTableWriterPDF($widths);
  107.                         break;
  108.                     case 'rtf':
  109.                         $table = new TTableWriterRTF($widths);
  110.                         break;
  111.                     case 'xls':
  112.                         $table = new TTableWriterXLS($widths);
  113.                         break;
  114.                 }
  115.                 
  116.                 if (!empty($table))
  117.                 {
  118.                     // create the document styles
  119.                     $table->addStyle('header''Helvetica''16''B''#ffffff''#4B8E57');
  120.                     $table->addStyle('title',  'Helvetica''10''B''#ffffff''#6CC361');
  121.                     $table->addStyle('datap',  'Helvetica''10''',  '#000000''#E3E3E3''LR');
  122.                     $table->addStyle('datai',  'Helvetica''10''',  '#000000''#ffffff''LR');
  123.                     $table->addStyle('footer''Helvetica''10''',  '#2B2B2B''#B5FFB4');
  124.                     
  125.                     $table->setHeaderCallback( function($table) {
  126.                         $table->addRow();
  127.                         $table->addCell('Customers''center''header'4);
  128.                         
  129.                         $table->addRow();
  130.                         $table->addCell('Navio''center''title');
  131.                         $table->addCell('Imo''center''title');
  132.                         $table->addCell('Ocorrencia''center''title');
  133.                         $table->addCell('Total''center''title');
  134.                     });
  135.                     
  136.                     $table->setFooterCallback( function($table) {
  137.                         $table->addRow();
  138.                         $table->addCell(date('d-m-Y h:i:s'), 'left''footer'4);
  139.                     });
  140.                     
  141.                     // controls the background filling
  142.                     $colourFALSE;
  143.                     
  144.                     // data rows
  145.                     foreach ($data as $row)
  146.                     {
  147.                         $style $colour 'datap' 'datai';
  148.                         
  149.                         $table->addRow();
  150.                         $table->addCell($row['NAVIO'], 'left'$style);
  151.                         $table->addCell($row['IMO'], 'left'$style);
  152.                         $table->addCell($row['OCORRENCIA'], 'left'$style);
  153.                         $table->addCell($row['TOTAL'], 'right'$style);
  154.                         
  155.                         $colour = !$colour;
  156.                     }
  157.                     
  158.                     $output "app/output/tabular.{$format}";
  159.                     
  160.                     // stores the file
  161.                     if (!file_exists($output) OR is_writable($output))
  162.                     {
  163.                         $table->save($output);
  164.                         parent::openFile($output);
  165.                     }
  166.                     else
  167.                     {
  168.                         throw new Exception(_t('Permission denied') . ': ' $output);
  169.                     }
  170.                     
  171.                     // shows the success message
  172.                     new TMessage('info''Report generated. Please, enable popups in the browser.');
  173.                 }
  174.             }
  175.             else
  176.             {
  177.                 new TMessage('error''Não há registros!');
  178.             }
  179.     
  180.             // close the transaction
  181.             TTransaction::close();
  182.         }
  183.         catch (Exception $e// in case of exception
  184.         {
  185.             new TMessage('error'$e->getMessage());
  186.             TTransaction::rollback();
  187.         }
  188.     }
  189. }

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework Quero me inscrever agora!

Comentários (4)


MG

Carlos
Você executou esta query diretamente no BD?
Teve retorno, ou seja, esta query quando executada manualmente, retorna os registros esperados?
ER

Carlos Usa estes filtros que é por padrão do adianti para que você tenha um melhor desempenho no resultado de suas aplicações!

abaixo o código completo de um relatório criado por builder, para melhor entende-lo!



  1. <?php
  2. class Cond02NossasEmpresasFiliaisReport extends TPage
  3. {
  4.     private $form// form
  5.     private $loaded;
  6.     private static $database 'websystem';
  7.     private static $activeRecord 'Cond0201';
  8.     private static $primaryKey 'CODIGO';
  9.     private static $formName 'formReport_Cond0201';
  10.     //-----------------------------------------------------
  11.     private static $paginas 1;
  12.     //-----------------------------------------------------
  13.     /**
  14.      * Class constructor
  15.      * Creates the page, the form and the listing
  16.      */
  17.     public function __construct()
  18.     {
  19.         parent::__construct();
  20.         // creates the form
  21.         $this->form = new BootstrapFormBuilder(self::$formName);
  22.         // define the form title
  23.         $this->form->setFormTitle("Relatório Lista Nossas Empresas Filiais");
  24.         $CODIGO = new TEntry('CODIGO');
  25.         $FANTASIA = new TEntry('FANTASIA');
  26.         $CNPJ = new TEntry('CNPJ');
  27.         $INS_EST = new TEntry('INS_EST');
  28.         $CNPJ->setMask('99.999.999/9999-99');
  29.         $CODIGO->setSize(100);
  30.         $CNPJ->setSize('100%');
  31.         $INS_EST->setSize('100%');
  32.         $FANTASIA->setSize('100%');
  33.         $row1 $this->form->addFields([new TLabel("idCódigo:"null'14px'null'100%'),$CODIGO],[new TLabel("Fantasia:"null'14px'null'100%'),$FANTASIA]);
  34.         $row1->layout = [' col-sm-3','col-sm-6'];
  35.         $row2 $this->form->addFields([new TLabel("CNPJ:"null'14px'null'100%'),$CNPJ],[new TLabel("Inscrição Estadual:"null'14px'null'100%'),$INS_EST]);
  36.         $row2->layout = [' col-sm-4',' col-sm-5'];
  37.         // keep the form filled during navigation with session data
  38.         $this->form->setDataTSession::getValue(__CLASS__.'_filter_data') );
  39.         $btn_ongeneratepdf $this->form->addAction("Gerar PDF", new TAction([$this'onGeneratePdf']), 'far:file-pdf #d44734');
  40.         $btn_ongeneratepdf->addStyleClass('btn-primary'); 
  41.         $btn_ongeneratehtml $this->form->addAction("Gerar HTML", new TAction([$this'onGenerateHtml']), 'fas:code #f01d1d');
  42.         $btn_ongeneratexls $this->form->addAction("Gerar XLS", new TAction([$this'onGenerateXls']), 'far:file-excel #00a65a');
  43.         $btn_ongeneratertf $this->form->addAction("Gerar RTF", new TAction([$this'onGenerateRtf']), 'far:file-alt #324bcc');
  44.         // vertical box container
  45.         $container = new TVBox;
  46.         $container->style 'width: 100%';
  47.         $container->class 'form-container';
  48.         $container->add(TBreadCrumb::create(["Controles","Relatório Lista Nossas Empresas Filiais"]));
  49.         $container->add($this->form);
  50.         parent::add($container);
  51.     }
  52.     public function onGeneratePdf($param null
  53.     {
  54.         $this->onGenerate('pdf');
  55.     }
  56.     public function onGenerateHtml($param null
  57.     {
  58.         $this->onGenerate('html');
  59.     }
  60.     public function onGenerateXls($param null
  61.     {
  62.         $this->onGenerate('xls');
  63.     }
  64.     public function onGenerateRtf($param null
  65.     {
  66.         $this->onGenerate('rtf');
  67.     }
  68.     /**
  69.      * Register the filter in the session
  70.      */
  71.     public function getFilters()
  72.     {
  73.         // get the search form data
  74.         $data $this->form->getData();
  75.         $filters = [];
  76.         TSession::setValue(__CLASS__.'_filter_data'NULL);
  77.         TSession::setValue(__CLASS__.'_filters'NULL);
  78.         if (isset($data->CODIGO) AND ( (is_scalar($data->CODIGO) AND $data->CODIGO !== '') OR (is_array($data->CODIGO) AND (!empty($data->CODIGO)) )) )
  79.         {
  80.             $filters[] = new TFilter('CODIGO''='$data->CODIGO);// create the filter 
  81.         }
  82.         if (isset($data->FANTASIA) AND ( (is_scalar($data->FANTASIA) AND $data->FANTASIA !== '') OR (is_array($data->FANTASIA) AND (!empty($data->FANTASIA)) )) )
  83.         {
  84.             $filters[] = new TFilter('FANTASIA''like'"%{$data->FANTASIA}%");// create the filter 
  85.         }
  86.         if (isset($data->CNPJ) AND ( (is_scalar($data->CNPJ) AND $data->CNPJ !== '') OR (is_array($data->CNPJ) AND (!empty($data->CNPJ)) )) )
  87.         {
  88.             $filters[] = new TFilter('CNPJ''='$data->CNPJ);// create the filter 
  89.         }
  90.         if (isset($data->INS_EST) AND ( (is_scalar($data->INS_EST) AND $data->INS_EST !== '') OR (is_array($data->INS_EST) AND (!empty($data->INS_EST)) )) )
  91.         {
  92.             $filters[] = new TFilter('INS_EST''='$data->INS_EST);// create the filter 
  93.         }
  94.         // fill the form with data again
  95.         $this->form->setData($data);
  96.         // keep the search data in the session
  97.         TSession::setValue(__CLASS__.'_filter_data'$data);
  98.         return $filters;
  99.     }
  100.     public function onGenerate($format)
  101.     {
  102.         try
  103.         {
  104.             $filters $this->getFilters();
  105.             // open a transaction with database 'websystem'
  106.             TTransaction::open(self::$database);
  107.             $param = [];
  108.             // creates a repository for Cond0201
  109.             $repository = new TRepository(self::$activeRecord);
  110.             // creates a criteria
  111.             $criteria = new TCriteria;
  112.             $criteria->setProperties($param);
  113.             if ($filters)
  114.             {
  115.                 foreach ($filters as $filter
  116.                 {
  117.                     $criteria->add($filter);       
  118.                 }
  119.             }
  120.             // load the objects according to criteria
  121.             $objects $repository->load($criteriaFALSE);
  122.             if ($objects)
  123.             {
  124.                 $widths = array(200,200,200,200,200,200,200);
  125.                 switch ($format)
  126.                 {
  127.                     case 'html':
  128.                         $tr = new TTableWriterHTML($widths);
  129.                         break;
  130.                     case 'xls':
  131.                         $tr = new TTableWriterXLS($widths);
  132.                         break;
  133.                     case 'pdf':
  134.                         $tr = new TTableWriterPDF($widths'L');
  135.                         break;
  136.                     case 'rtf':
  137.                         if (!class_exists('PHPRtfLite_Autoloader'))
  138.                         {
  139.                             PHPRtfLite::registerAutoloader();
  140.                         }
  141.                         $tr = new TTableWriterRTF($widths'L');
  142.                         break;
  143.                 }
  144.                 if (!empty($tr))
  145.                 {
  146.                     // create the document styles
  147.                     $tr->addStyle('title''Helvetica''10''B',   '#000000''#dbdbdb');
  148.                     $tr->addStyle('datap''Arial''10''',    '#333333''#f0f0f0');
  149.                     $tr->addStyle('datai''Arial''10''',    '#333333''#ffffff');
  150.                     $tr->addStyle('header''Helvetica''16''B',   '#5a5a5a''#6B6B6B');
  151.                     $tr->addStyle('footer''Helvetica''10''B',  '#5a5a5a''#A3A3A3');
  152.                     $tr->addStyle('break''Helvetica''10''B',  '#ffffff''#9a9a9a');
  153.                     $tr->addStyle('total''Helvetica''10''I',  '#000000''#c7c7c7');
  154.                     $tr->addStyle('breakTotal''Helvetica''10''I',  '#000000''#c6c8d0');
  155.                     //-----------------------------------------------------
  156.                     //--- Parte da Função para colocar descrição no cabeçalho e contador de paginas
  157.                     //-----------------------------------------------------
  158.                     //-----------------------------------------------------
  159.                     //=========
  160.                     // pdf formato.
  161.                     //------------------------
  162.                     if ($format == 'pdf')
  163.                     {
  164.                         // Adiciona o cabeçalho
  165.                         $tr->setHeaderCallback(
  166.                             function($tr)
  167.                             {
  168.                                 $pdf $tr->getNativeWriter();
  169.                                 $this->header($pdf);
  170.                             }
  171.                         );
  172.                         // Adiciona o footer do relatório
  173.                         $tr->setFooterCallback(
  174.                             function($tr)
  175.                             {
  176.                                 $pdf $tr->getNativeWriter();
  177.                                 $this->footer($pdf);
  178.                             }
  179.                         );
  180.                     //-----------------------------------------------------
  181.                     //=========
  182.                     // demais formatos.
  183.                     //------------------------
  184.                     } else  {
  185.                             // Adiciona o cabeçalho
  186.                             $tr->setHeaderCallback(
  187.                                 function($tr)
  188.                                 {
  189.                                    $tr->addRow();
  190.                                    $tr->addCell('>>Relatório Lista Nossas Empresas Filiais''center''header'7);
  191.                                 }
  192.                             );
  193.                             // Adiciona o footer do relatório
  194.                             $tr->setFooterCallback(
  195.                                 function($tr)
  196.                                 {
  197.                                     $tr->addRow();
  198.                                     $tr->addCell(date('Y-m-d h:i:s'), 'center''footer'7);
  199.                                 }
  200.                             );                    
  201.                     }
  202.                     //-----------------------------------------------------
  203.                     //-----------------------------------------------------
  204.                     //Fim- Parte da Função para colocar descrição no cabeçalho e contador de paginas
  205.                     //-----------------------------------------------------
  206.                     // add titles row
  207.                     $tr->addRow();
  208.                     $tr->addCell("idCódigo"'left''title');
  209.                     $tr->addCell("Nome Fantasia"'left''title');
  210.                     $tr->addCell("Tel.(DD)"'left''title');
  211.                     $tr->addCell("Telefone"'left''title');
  212.                     $tr->addCell("Cel.(DD)"'left''title');
  213.                     $tr->addCell("Celular"'left''title');
  214.                     $tr->addCell("CNPJ"'left''title');
  215.                     $grandTotal = [];
  216.                     $breakTotal = [];
  217.                     $breakValue null;
  218.                     $firstRow true;
  219.                     // controls the background filling
  220.                     $colour false;                
  221.                     foreach ($objects as $object)
  222.                     {
  223.                         $style $colour 'datap' 'datai';
  224.                         $firstRow false;
  225.                         $tr->addRow();
  226.                         $tr->addCell($object->CODIGO'left'$style);
  227.                         $tr->addCell($object->FANTASIA'left'$style);
  228.                         $tr->addCell($object->TEL_DDD'left'$style);
  229.                         $tr->addCell($object->TELEFONE'left'$style);
  230.                         $tr->addCell($object->CEL_DDD'left'$style);
  231.                         $tr->addCell($object->CELULAR'left'$style);
  232.                         $tr->addCell($object->CNPJ'left'$style);
  233.                         $colour = !$colour;
  234.                     }
  235.                     //-----------------------------------------------------
  236.                     $tr->addRow();
  237.                     $tr->addCell(date('d/m/Y H:i:s'), 'center''footer'7);
  238.                     //-----------------------------------------------------
  239.                     $file 'report_'.uniqid().".{$format}";
  240.                     // stores the file
  241.                     if (!file_exists("app/output/{$file}") || is_writable("app/output/{$file}"))
  242.                     {
  243.                         $tr->save("app/output/{$file}");
  244.                     }
  245.                     else
  246.                     {
  247.                         throw new Exception(_t('Permission denied') . ': ' "app/output/{$file}");
  248.                     }
  249.                     parent::openFile("app/output/{$file}");
  250.                     // shows the success message
  251.                     new TMessage('info'_t('Report generated. Please, enable popups'));
  252.                 }
  253.             }
  254.             else
  255.             {
  256.                 new TMessage('error'_t('No records found'));
  257.             }
  258.             // close the transaction
  259.             TTransaction::close();
  260.         }
  261.         catch (Exception $e// in case of exception
  262.         {
  263.             // shows the exception error message
  264.             new TMessage('error'$e->getMessage());
  265.             // undo all pending operations
  266.             TTransaction::rollback();
  267.         }
  268.     }
  269.     public function onShow($param null)
  270.     {
  271.     }
  272.     //-----------------------------------------------------
  273.     //--- Parte da Função para colocar descrição no cabeçalho e contador de paginas
  274.     //-----------------------------------------------------
  275.     //-----------------------------------------------------
  276.     //Header.
  277.     //-----------------------------------------------------
  278.     public function header($pdf
  279.     { 
  280.         ///////////////////////////////////////////////////////////////////////////
  281.         //--- Buscar dados de sessão referente a filtragem do respectivo relatório.
  282.         ///////////////////////////////////////////////////////////////////////////
  283.         $periodoInicial = (TSession::getValue('HORARIO_INICIAL'));
  284.         $periodoFinal   = (TSession::getValue('HORARIO_FINAL'));
  285.         ////////////////////////////////////////////////////////////
  286.         //
  287.         // open a transaction with database 'cfcwebsystem'
  288.         TTransaction::open(self::$database);
  289.         /////////////////////////////////////////////////////////////////////////////////////////////
  290.         //--- Buscar dados da filial se filtrada e guardado em sessão ou filial referente ao usuário. 
  291.         /////////////////////////////////////////////////////////////////////////////////////////////
  292.         //$codFilial = (TSession::getValue('COD_EMPRESA')); // Filial do filtro. 
  293.         $codFilial = (TSession::getValue('COD_FILIAL')); // Filial do filtro. 
  294.         if (!$codFilial$codFilial = (TSession::getValue('userunitid')); // Filial do Usuário.
  295.         $Cond0201 = new Cond0201($codFilial);
  296.         //if ($Cond0201) {
  297.         //    $logoTipo   = $Cond0201->LOGOTIPO;
  298.         //    $nomeFilial = $Cond0201->FANTASIA;
  299.         //}
  300.         /////////////////////////////////////////////////////////////////////////////////////////////
  301.         //
  302.         $pdf->AliasNbPages();
  303.         //$pdf->Image('app/images/logotipos/logotipo.jpg',30,25,75);
  304.         $pdf->Image($Cond0201->LOGOTIPO302575);
  305.         // Move to the right 
  306.         $pdf->Cell(110); 
  307.         // Title 
  308.         $pdf->SetFont('Arial','B',10); // Bold.
  309.         $pdf->Cell(50,10,utf8_decode($Cond0201->FANTASIA),0,0,'L'); 
  310.         $pdf->Ln(); 
  311.         $pdf->SetFont(''); // Normal.
  312.         $pdf->Cell(110); 
  313.         $pdf->Cell(50,10,utf8_decode('ENDEREÇO: ' $Cond0201->ENDERECO) . ' - ' utf8_decode('BAIRRO: ' $Cond0201->SETOR),0,0,'L'); 
  314.         $pdf->Ln(); 
  315.         $pdf->Cell(110); 
  316.         $pdf->Cell(50,10,'CEP: ' $Cond0201->CEP ' - ' utf8_decode('CIDADE: ' $Cond0201->CIDADE) . ' / ' $Cond0201->UF,0,0,'L'); 
  317.         $pdf->Ln(); 
  318.         $pdf->Cell(110); 
  319.         $pdf->Cell(50,10,utf8_decode('CNPJ: ' $Cond0201->CNPJ) . ' - ' utf8_decode(' TELEFONE/CELULAR: ' $Cond0201->TEL_DDD) . ' ' utf8_decode($Cond0201->TELEFONE ' / ' $Cond0201->CELULAR),0,0,'L'); 
  320.         $pdf->Cell(630,10,utf8_decode('Página: ').$pdf->PageNo().' de {nb}',0,0,'R');
  321.         $pdf->Ln(); 
  322.         $pdf->Cell(110); 
  323.         $pdf->Cell(50,15,utf8_decode('EMAIL: ' $Cond0201->EMAIL_EMAIL) . ' - ' utf8_decode('SITE: ' $Cond0201->RAZAO),0,0,'L'); 
  324.         $pdf->Cell(630,10,utf8_decode('Data Emissão: ').date('d/m/Y'),0,0,'R');
  325.         $pdf->Ln(); 
  326.         $pdf->Cell(110); 
  327.         $pdf->SetFont('Arial','B',12); // Bold.
  328.         $pdf->Cell(50,15,utf8_decode('>>Relatório Lista Nossas Empresas Filiais'),0,0,'L'); 
  329.         //$pdf->Cell(50,15,utf8_decode('>Relatório Lista Nossas Empresas Filiais') . utf8_decode(' - Periódo: ' . $periodoInicial . ' a ' . $periodoFinal),0,0,'L'); 
  330.         $pdf->SetFont(''); // Normal.
  331.         //$pdf->Cell(400,15,date('d/m/Y'),0,0,'R');
  332.         // Line break 
  333.         $pdf->Ln(); 
  334.         //$pdf->Cell(560,5,'','T',0,'L'); 
  335.         $pdf->Cell(790,5,'','T',0,'L'); 
  336.         $pdf->Ln(); 
  337.         // close the transaction
  338.         TTransaction::close();
  339.     } 
  340.     //-----------------------------------------------------
  341.     //-----------------------------------------------------
  342.     public function footer($pdf
  343.     { 
  344.         $numeroPagina self::$paginas;
  345.         $pdf->SetY(-40);
  346.         $pdf->SetFont('Arial','B',12); 
  347.         // Move to the right 
  348.         $pdf->Cell(110); 
  349.         // Title 
  350.         $pdf->PageNo();
  351.         $pdf->Cell(0,10utf8_decode("Página: {$numeroPagina} /{nb}") ,0,0,'R');
  352.         // Line break 
  353.         $pdf->Ln(20); 
  354.         self::$paginas++;
  355.     }
  356.     //-----------------------------------------------------
  357.     //-----------------------------------------------------
  358.     //Fim- Parte da Função para colocar descrição no cabeçalho e contador de paginas
  359.     //-----------------------------------------------------
  360. }
CD

Marcelo,

executando a query direto no banco funciona normalmente.
CD

Carlos Roberto,

Obrigado pelo código.