public function showItens($param)
 {
     $table = new PTableWriteHTML();
     // usa a tabela do PWD para mostrar os itens do pedido
     $table->addRowTitle();
     // cria linha de titulo
     //adciona as colunas
     $table->addCellTitle("Id", 'center');
     $table->addCellTitle("Nome", 'center');
     $table->addCellTitle("Preco", 'center');
     $janela = new PWindows();
     try {
         TTransaction::open('sample');
         // cria as regras para consultar os itens do pediso
         $criteria = new TCriteria();
         $filtro = new TFilter('pedidos_id', '=', $param['key']);
         $criteria->add($filtro);
         // carega os itens do pedido
         $obj = PedidosProdutos::getObjects($criteria);
         $total = 0;
         // adiona os itens
         foreach ($obj as $itens) {
             $table->addRow();
             $table->addCell($itens->id, 'center', 'danger');
             $table->addCell($itens->produto->nome, 'center');
             // pega o nome do produto usango o metodo get_produto
             $table->addCell($itens->qtd, 'center');
             $table->addCell($itens->produto->preco, 'center');
             $total += $itens->produto->preco;
             // adiciona os preços ao total
         }
         $table->addRow();
         $table->addCell("Total : " . $total, 'center');
         TTransaction::close();
         $janela = new PWindows();
         $janela->setSize(800, 300);
         $janela->addContent($table);
         $janela->show();
     } catch (Exeption $e) {
         echo $e->getMessage();
     }
 }
 public function gerar()
 {
     try {
         TTransaction::open('sample');
         $table = new PTableWriteHTML();
         $table->addRowTitle();
         $table->addCellTitle("Id", 'center');
         $table->addCellTitle("Nome", 'center');
         $table->addCellTitle("Telefone", 'center');
         $table->addCellTitle("E-Mail", 'center');
         $criterio = new TCriteria();
         $dados = Contatos::getObjects();
         foreach ($dados as $contatos) {
             $table->addRow();
             $table->addCell($contatos->id, 'center', 'danger');
             $table->addCell($contatos->nome, 'center');
             $table->addCell($contatos->telefone, 'center');
             $table->addCell($contatos->email, 'center');
         }
         TTransaction::close();
         //abre o timer
         if (ob_get_level() == 0) {
             ob_start();
         }
         for ($i = 0; $i == $i; $i++) {
             $table->renderize();
             ob_flush();
             flush();
             sleep(2);
         }
         //fecha o timer
         echo "Done.";
         ob_end_flush();
     } catch (Exeption $e) {
         echo $e->getMessage();
     }
 }