1
I am developing a php application with mysql and at a certain point need to make a query in the database and bring the information in a table. Until then quiet, however I need to have the option to print all the contents of the table, ie print (on paper) a dynamic query.
I studied ireport but I’m having a hard time, and I’d like to know if there’s another way to make that impression or not. In another part of the application I print certificates and it is very quiet, but the ireport gives me the impression that I will have to do some tricks to use with php.
Here is an example of the table I’m using, and remembering that sometimes the search generates several pages.
<table cellspacing="0" cellpadding="0" border="0" class="display" id="listausers">
<thead>
<tr>
<th>N°Registro</th><th>Beneficiário</th><th>Data Emissão</th><th>CPF</th><th>CNH</th><th>Data do Cadastro</th></th><th>Operações</th>
</tr>
</thead>
<tbody>
<?php
$data_atual=explode("/" , date('d/m/Y'));
$ano_atual=$data_atual[2];
$alvara_vaga_idoso = new alvara_vaga_idoso();
$alvara_vaga_idoso->selecionaTudo($alvara_vaga_idoso);
while($res = $alvara_vaga_idoso->retornaDados()):
echo '<tr>';
printf('<td>%s</td>',$res->num_registro ."/".$ano_atual);
printf('<td>%s</td>',$res->nome_beneficiario);
printf('<td>%s</td>',$res->data_emissao);
printf('<td>%s</td>',$res->cpf);
printf('<td>%s</td>',$res->cnh);
printf('<td class="center">%s</td>',date("d/m/Y - H:i:s",strtotime($res->datacad)));
printf('<td class="center"><a href="?m=alvara_vaga_idoso&t=incluir_alvaras_vaga_idoso" title="Novo Cadastro"> <img src="images/add.png" alt="Novo Cadastro"/> </a> <a href="?m=alvara_vaga_idoso&t=editar_alvara_vaga_idoso&num_registro=%s" title="Editar Cadastro"> <img src="images/edit.png" alt="Editar Cadastro"/> </a></a> <a href="?m=alvara_vaga_idoso&t=visualizar_alvara_vaga_idoso&num_registro=%s" title="Visualizar Cadastro"> <img src="images/view.png" alt="Visualizar Cadastro"/><a href="?m=alvara_vaga_idoso&t=imprimir_alvara_vaga_idoso&num_registro=%s" title="Imprimir Credencial"> <img src="images/printer.png" alt="Imprimir Credencial"/> </a> </td>',$res->num_registro,$res->num_registro,$res->num_registro);
echo '</tr>';
endwhile;
?>
</tbody>
</table>
You generate this table on screen, and it will have a print button, would that be?
– Rodrigo Santos
That’s right Rodrigo, my difficulty is like printing when it’s more than one page
– maycon rocha
vc generates a table with paging? would be?
– Rodrigo Santos