<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

$action = $_GET['action'];
$go = $_GET['go'];
$id = $_GET['id'];
if ( $action == "pendentes" )
{
    $sql->query( "SELECT Id, Login, Data, Hora, Valor, Qual_Foi, Email, Envelope, Compra, Trans, Agencia, Pagamento FROM SITE_PEDIDOS WHERE Entao=0" );
    if ( $id == false )
    {
        echo "<table width=\"100%\"><tr><td>\r\n        \t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\">\r\n            \t<tr>\r\n                \t<td width=\"1\"><img src=\"images/bdy05.gif\" width=\"1\" height=\"23\"></td>\r\n                \t<td width=\"22\" background=\"images/bdy06.gif\" align=\"center\"><nobr>&nbsp;<img src=\"images/bullet090.gif\">&nbsp;</nobr></td>\r\n                \t<td width=\"95%\" background=\"images/bdy06.gif\" class=\"nrm02\" align=\"left\">&nbsp;<b><font color=\"#2283BF\">Pedidos Pendentes</font></b></td>\r\n                \t<td background=\"images/bdy06.gif\" align=\"right\"><img src=\"images/bullet031.gif\" width=\"6\" height=\"10\">&nbsp;&nbsp;</td>\r\n                \t<td width=\"1\"><img src=\"images/bdy05.gif\" width=\"1\" height=\"23\"></td>\r\n                </tr>\r\n                <tr>\r\n                \t<td width=\"1\" bgcolor=\"#666666\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                \t<td colspan=\"3\"><!--<img src=\"images/spacer.gif\" width=\"100\" height=\"5\">-->\r\n                \t\t<table width=\"100%\" cellpadding=\"5\">\r\n                        <tr>\r\n                          <td colspan=\"8\" class=\"infotitulo\">Pedidos</td>\r\n                        </tr>\r\n\t\t\t\t\t\t<tr class=\"pedidotitulo\">\r\n\t\t\t\t\t\t\t<td>#ID</td>\r\n\t\t\t\t\t\t\t<td>Login</td>\r\n\t\t\t\t\t\t\t<td>Data</td>\r\n\t\t\t\t\t\t\t<td>Hora</td>\r\n\t\t\t\t\t\t\t<td>Valor</td>\r\n\t\t\t\t\t\t\t<td>Compra</td>\r\n                            <td>Outros</td>\r\n                            <td>Op&ccedil;&otilde;es</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t";
        while ( $info = $sql->row( ) )
        {
            ++$x;
            if ( $x % 2 == 0 )
            {
                $estilo = "pedidos2";
            }
            else
            {
                $estilo = "pedidos1";
            }
            echo "                            <form name=\"form";
            echo $x;
            echo "\" action=\"\" method=\"post\">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\">";
            echo $info[0];
            echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\">";
            echo $info[1];
            echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\" align=\"center\">";
            echo $info[2];
            echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\" align=\"center\">";
            echo $info[3];
            echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\" align=\"center\">";
            echo $info[4];
            echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\">";
            echo $info[5];
            echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\"><a href=\"javascript:;\" onmouseover=\"Tip('Envelope: ";
            echo $info[7];
            echo "<br>Transferencia: ";
            echo $info[9];
            echo "<br>Agencia: ";
            echo $info[10];
            echo "<br>Pagamento: ";
            echo $info[11];
            echo "<br>Email ";
            echo $info[6];
            echo "<br>Compra ";
            echo $info[8];
            echo "')\" class=\"pedido\">+ Informacoes</a></td>\r\n\t\t\t\t\t\t\t<td class=\"";
            echo $estilo;
            echo "\"><input type=\"radio\" name=\"acao\" id=\"acao\" value=\"1\" OnChange=\"Pedido('";
            echo $info[0];
            echo "')\"><label>Aceita</label><input type=\"radio\" name=\"acao\" id=\"acao\" value=\"2\" OnChange=\"Pedido('";
            echo $info[0];
            echo "')\"><label>Recusa</label></td>\r\n                        </tr>\r\n                        \t</form>\r\n\t\t\t\t\t\t\t";
        }
        echo "\t\t\t\t\t\t</table>\r\n                    </td>\r\n                    <td width=\"1\" bgcolor=\"#666666\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                </tr>\r\n                <tr>\r\n                    <td width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                    <td bgcolor=\"#666666\" colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                    <td width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                </tr>\r\n\t\t\t</table>\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n        ";
    }
    if ( $id == true )
    {
        $act = $_GET['act'];
        $check->checanumeropositivo( $id, "ID" );
        $check->checanumeropositivo( $act, "Ação" );
        $sql->verificaidpedidos( $id, 1 );
        if ( $act == 1 )
        {
            $sql->executaaceitarpedido( $id );
        }
        if ( $act == 2 )
        {
            $sql->executarecusarpedido( $id );
        }
    }
}
if ( $action == "aceitos" )
{
    $sql->query( "SELECT Id, Login, Data, Hora, Valor, Qual_Foi, Email, Envelope, Compra, Trans, Agencia, Pagamento FROM SITE_PEDIDOS WHERE Entao=1" );
    echo "<table width=\"100%\"><tr><td>\r\n        \t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\">\r\n            \t<tr>\r\n                \t<td width=\"1\"><img src=\"images/bdy05.gif\" width=\"1\" height=\"23\"></td>\r\n                \t<td width=\"22\" background=\"images/bdy06.gif\" align=\"center\"><nobr>&nbsp;<img src=\"images/bullet090.gif\">&nbsp;</nobr></td>\r\n                \t<td width=\"95%\" background=\"images/bdy06.gif\" class=\"nrm02\" align=\"left\">&nbsp;<b><font color=\"#2283BF\">Pedidos Aceitos</font></b></td>\r\n                \t<td background=\"images/bdy06.gif\" align=\"right\"><img src=\"images/bullet031.gif\" width=\"6\" height=\"10\">&nbsp;&nbsp;</td>\r\n                \t<td width=\"1\"><img src=\"images/bdy05.gif\" width=\"1\" height=\"23\"></td>\r\n                </tr>\r\n                <tr>\r\n                \t<td width=\"1\" bgcolor=\"#666666\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                \t<td colspan=\"3\"><!--<img src=\"images/spacer.gif\" width=\"100\" height=\"5\">-->\r\n                \t\t<table width=\"100%\" cellpadding=\"5\">\r\n                        <tr>\r\n                          <td colspan=\"8\" class=\"infotitulo\">Pedidos</td>\r\n                        </tr>\r\n\t\t\t\t\t\t<tr class=\"pedidotitulo\">\r\n\t\t\t\t\t\t\t<td>#ID</td>\r\n\t\t\t\t\t\t\t<td>Login</td>\r\n\t\t\t\t\t\t\t<td>Data</td>\r\n\t\t\t\t\t\t\t<td>Hora</td>\r\n\t\t\t\t\t\t\t<td>Valor</td>\r\n\t\t\t\t\t\t\t<td>Compra</td>\r\n                            <td>Outros</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t";
    while ( $info = $sql->row( ) )
    {
        ++$x;
        if ( $x % 2 == 0 )
        {
            $estilo = "pedidos2";
        }
        else
        {
            $estilo = "pedidos1";
        }
        echo "                            <form name=\"form";
        echo $x;
        echo "\" action=\"\" method=\"post\">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\">";
        echo $info[0];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\">";
        echo $info[1];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\" align=\"center\">";
        echo $info[2];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\" align=\"center\">";
        echo $info[3];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\" align=\"center\">";
        echo $info[4];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\">";
        echo $info[5];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\"><a href=\"javascript:;\" onmouseover=\"Tip('Envelope: ";
        echo $info[7];
        echo "<br>Transferencia: ";
        echo $info[9];
        echo "<br>Agencia: ";
        echo $info[10];
        echo "<br>Pagamento: ";
        echo $info[11];
        echo "<br>Email ";
        echo $info[6];
        echo "<br>Compra ";
        echo $info[8];
        echo "')\" class=\"pedido\">+ Informacoes</a></td>\r\n                        </tr>\r\n                        \t</form>\r\n\t\t\t\t\t\t\t";
    }
    echo "\t\t\t\t\t\t</table>\r\n                    </td>\r\n                    <td width=\"1\" bgcolor=\"#666666\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                </tr>\r\n                <tr>\r\n                    <td width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                    <td bgcolor=\"#666666\" colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                    <td width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                </tr>\r\n\t\t\t</table>\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n";
}
if ( $action == "recusados" )
{
    $sql->query( "SELECT Id, Login, Data, Hora, Valor, Qual_Foi, Email, Envelope, Compra, Trans, Agencia, Pagamento FROM SITE_PEDIDOS WHERE Entao=2" );
    echo "<table width=\"100%\"><tr><td>\r\n        \t<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\">\r\n            \t<tr>\r\n                \t<td width=\"1\"><img src=\"images/bdy05.gif\" width=\"1\" height=\"23\"></td>\r\n                \t<td width=\"22\" background=\"images/bdy06.gif\" align=\"center\"><nobr>&nbsp;<img src=\"images/bullet090.gif\">&nbsp;</nobr></td>\r\n                \t<td width=\"95%\" background=\"images/bdy06.gif\" class=\"nrm02\" align=\"left\">&nbsp;<b><font color=\"#2283BF\">Pedidos Recusados</font></b></td>\r\n                \t<td background=\"images/bdy06.gif\" align=\"right\"><img src=\"images/bullet031.gif\" width=\"6\" height=\"10\">&nbsp;&nbsp;</td>\r\n                \t<td width=\"1\"><img src=\"images/bdy05.gif\" width=\"1\" height=\"23\"></td>\r\n                </tr>\r\n                <tr>\r\n                \t<td width=\"1\" bgcolor=\"#666666\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                \t<td colspan=\"3\"><!--<img src=\"images/spacer.gif\" width=\"100\" height=\"5\">-->\r\n                \t\t<table width=\"100%\" cellpadding=\"5\">\r\n                        <tr>\r\n                          <td colspan=\"8\" class=\"infotitulo\">Pedidos</td>\r\n                        </tr>\r\n\t\t\t\t\t\t<tr class=\"pedidotitulo\">\r\n\t\t\t\t\t\t\t<td>#ID</td>\r\n\t\t\t\t\t\t\t<td>Login</td>\r\n\t\t\t\t\t\t\t<td>Data</td>\r\n\t\t\t\t\t\t\t<td>Hora</td>\r\n\t\t\t\t\t\t\t<td>Valor</td>\r\n\t\t\t\t\t\t\t<td>Compra</td>\r\n                            <td>Outros</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t";
    while ( $info = $sql->row( ) )
    {
        ++$x;
        if ( $x % 2 == 0 )
        {
            $estilo = "pedidos2";
        }
        else
        {
            $estilo = "pedidos1";
        }
        echo "                            <form name=\"form";
        echo $x;
        echo "\" action=\"\" method=\"post\">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\">";
        echo $info[0];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\">";
        echo $info[1];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\" align=\"center\">";
        echo $info[2];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\" align=\"center\">";
        echo $info[3];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\" align=\"center\">";
        echo $info[4];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\">";
        echo $info[5];
        echo "</td>\r\n\t\t\t\t\t\t\t<td class=\"";
        echo $estilo;
        echo "\"><a href=\"javascript:;\" onmouseover=\"Tip('Envelope: ";
        echo $info[7];
        echo "<br>Transferencia: ";
        echo $info[9];
        echo "<br>Agencia: ";
        echo $info[10];
        echo "<br>Pagamento: ";
        echo $info[11];
        echo "<br>Email ";
        echo $info[6];
        echo "<br>Compra ";
        echo $info[8];
        echo "')\" class=\"pedido\">+ Informacoes</a></td>\r\n                        </tr>\r\n                        \t</form>\r\n\t\t\t\t\t\t\t";
    }
    echo "\t\t\t\t\t\t</table>\r\n                    </td>\r\n                    <td width=\"1\" bgcolor=\"#666666\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                </tr>\r\n                <tr>\r\n                    <td width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                    <td bgcolor=\"#666666\" colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                    <td width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>\r\n                </tr>\r\n\t\t\t</table>\r\n\t\t</td>\r\n\t</tr>\r\n</table>\r\n";
}
?>
