Páginas

terça-feira, 10 de setembro de 2013

Criando um relatorio simples oracle com php

<table  width="845"  cellpadding=0 cellspacing=0>
<!--<tr bgcolor=#696969>
    <td  width="400" span class="relatorio"><b>Colaborador</B></td>
    <td  width="350" span class="relatorio"><b>Unidade/Gerência</B></td>
    </tr>
    -->
<?php
$sql_hoje = "select a.area, INITCAP(a.nome) NOME,a.data_nascimento
    from funcionarios a
          where to_char(a.data_nascimento,'dd') = to_char(sysdate,'dd') and to_char(a.data_nascimento,'mm') = to_char(sysdate,'mm')
          order by AREA, NOME ";

/*ANALISA*/
$sql_hoje = ociparse($c,$sql_hoje) or die("ERRO NA ANÁLISE DA CLÁUSULA SQL");
/*EXECUTA*/
ociexecute($sql_hoje,OCI_DEFAULT);

/*EXIBE OS RESULTADOS NA TELA*/
echo "<b>".dia_atual()." ".date("d/m/Y")."</B><BR>";
$bgcolor = "#ffffff";
        while($resultado = @oci_fetch_array($sql_hoje))
    {
        if ($bgcolor=="#E8E8E8")
            $bgcolor="#ffffff";
            Else{
            $bgcolor="#E8E8E8";
            }
    print "
    <tr>
    <td  width='400' BGCOLOR=\"$bgcolor\" span class='relatorio' >$resultado[NOME]</td>
    <td  width='350' BGCOLOR=\"$bgcolor\" span class='relatorio' >$resultado[AREA]</td>
    </tr>";
}
        ocifreestatement($sql_hoje); //LIBERA DA MEMÓRIA
?>
</table>

Nenhum comentário:

Postar um comentário