..:: MX Studio Fóruns ::..: Preciso entender para alterar - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




ATENÇÃO

Para evitar posts desnecessários e que não influam para o andamento e desenvolvimento do fórum, clique aqui e leia todas as regras.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Preciso entender para alterar Carregar valores nas caixas

#1 User is offline   ricardoelias 

  • Group: Membros
  • Posts: 153
  • Joined: 14-July 04

  Posted 21 May 2007 - 12:44 PM

Bom peguei pra alterar um sistema que eu não criei, particularmente não gosto, mas itive de faze-lo e o programador quando o fez utilizou cookies ou sessão não entendi direito...
A Dúvida é o seguinte...
eu escolho o produto que quero pedir (ou produtos) nessa página

CODE
<?
session_start();

if(empty($_SESSION['nome.usuario'])){
    require_once("../conexao.php"); //referencia estatica
    $sql = "SELECT CODUSR,NOMUSR from USUARIO where LGNUSR='" . $PHP_AUTH_USER . "'";
    //echo $sql;
    $rs = mysql_fetch_array(mysql_query($sql));




    $_SESSION['cod.usuario'] = $rs['CODUSR'];
    $_SESSION['nome.usuario'] = $rs['NOMUSR'];
    $_SESSION['admin.usuario'] = true;
}

require_once("includes/config.inc.php");
global $config;

require_once($config['path']['conexao']);

/* LIMPA A TABELA DE PEDIDOS */
$del = "DELETE from PEDIDO where STAPED='P' and DTAPED < NOW() - INTERVAL 1 DAY";
$query = mysql_query($del);


$sql = "SELECT CODPRO,NOMPRO from PRODUTO";
$query = mysql_query($sql);

while($rs = mysql_fetch_array($query)){
    
    $out .= "  <tr>
    <td width=\"13\" height=\"25\">&nbsp;</td>
    <td height=\"25\"><table width=\"752\" height=\"25\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
        <tr>
          <td width=\"25\"><input name=\"produto[]\" type=\"checkbox\" class=\"campotxt9\" value=\"" . $rs['CODPRO'] . "\">
          </td>
          <td class=\"txt1preto\">" . $rs['NOMPRO'] . "</td>
        </tr>
      </table></td>
    <td width=\"13\" height=\"25\">&nbsp;</td>
  </tr>";    
}

$sql = 'SELECT CODCLI,CGCCLI,NOMCLI from CLIENTE where CODUSU=' . $_SESSION["cod.usuario"].' order by NOMCLI';
$query = mysql_query($sql);

while($rs = mysql_fetch_array($query)){
    $drop .= "<option value=\"" . $rs['CGCCLI'] . "\" " . ($_GET['cnpj'] == $rs['CGCCLI'] ? "SELECTED" : null) . ">" . $rs['NOMCLI'] . " [" . $rs['CGCCLI'] . "]</option>\n";
}


switch(date('w')){
    case 0: $dia = "Domingo"; break;
    case 1: $dia = "Segunda-feira"; break;
    case 2: $dia = "Terça-feira"; break;
    case 3: $dia = "Quarta-feira"; break;
    case 4: $dia = "Quinta-feira"; break;
    case 5: $dia = "Sexta-feita"; break;
    case 6: $dia = "Sábado"; break;
}

switch(date('n')){
    case 1: $mes = "Janeiro"; break;
    case 2: $mes = "Fevereiro"; break;
    case 3: $mes = "Março"; break;
    case 4: $mes = "Abril"; break;
    case 5: $mes = "Maio"; break;
    case 6: $mes = "Junho"; break;
    case 7: $mes = "Julho"; break;
    case 8: $mes = "Agosto"; break;
    case 9: $mes = "Setembro"; break;
    case 10: $mes = "Outubro"; break;
    case 11: $mes = "Novembro"; break;
    case 12: $mes = "Dezembro"; break;
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>FGA UTILIDADES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="_elementos/fga_css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function valida(){
//    alert(document.forml["produto[]"].length);
    for(var i=0; i < document.forml["produto[]"].length; i++){
//        alert(document.forml["produto[]"][i].checked);
        if(document.forml["produto[]"][i].checked){
            return true;
        }
    }
    
    alert("Por favor selecione um produto");
    return false;
}
</script>
</head>

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table width="778" height="94" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10" bgcolor="5D1101"><img src="_elementos/10x10.gif" width="10" height="10"></td>
  </tr>
  <tr>
    <td><table width="778" height="80" border="0" cellpadding="0" cellspacing="0">
      <tr>
          <td width="120"><table width="120" height="80" border="0" cellpadding="0" cellspacing="0">
<tr>
                <td align="center" valign="middle"><img src="_elementos/logo_fga.gif" width="98" height="72"></td>
              </tr>
            </table></td>
        <td><table width="658" height="80" border="0" cellpadding="0" cellspacing="0">
          <tr>
                <td height="22" align="right"><img src="_elementos/alfa_1_envio.gif" width="645" height="25"></td>
          </tr>
          <tr>
                <td height="22" align="right" background="_elementos/alfa_2.jpg"><span class="tit1preto">
                <strong><?=$dia. date(", d \de ") . $mes . date(" \de Y")?></strong>&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
          </tr>
          <tr>
                <td><table width="537" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="103" align="right"><img src="_elementos/icon_repr.gif" width="20" height="19"></td>
                      <td width="434" align="right"><span class="txt1preto"><font size="1">Ol&aacute;,
                        </font></span><span class="txt1veemelhobold"><strong><?=$_SESSION['nome.usuario']?>.</strong>
                        </span><strong> <br>
                        </strong><span class="txt1preto"></span><font size="1"><span class="txt1preto">Bem-vindo
                        &agrave; &aacute;rea de representantes da FGA Utilidades.</span></font></td>
                    </tr>
                  </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="10" bgcolor="5D1101"><img src="_elementos/10x10.gif" width="10" height="10"></td>
  </tr>
</table>
<table width="778" height="94" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20"><img src="_elementos/pedidos.gif" width="778" height="20"></td>
  </tr>
  <form name="forml" method="post" action="tabela.action.php" onsubmit="return valida()">
  <tr>
    <td background="_elementos/pedidos_2.jpg"><table width="778" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="15"><img src="_elementos/traco2.gif" width="1" height="15"></td>
        </tr>
        <tr>
          <td><table width="778" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="389"> <table width="389" height="74" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><table width="389" height="15" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="13" height="15"><img src="_elementos/traco2.gif" width="1" height="15"></td>
                            <td height="15" class="txt1veemelhobold">1 - Clientes</td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td><table width="389" height="20" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="13" height="20">&nbsp;</td>
                            <td height="20"><select name="cnpj" class="campotxt8">
                                <?=$drop?>
                              </select></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td><table width="389" height="24" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="13" height="15"><img src="_elementos/traco2.gif" width="1" height="15"></td>
                            <td width="181" height="15" valign="top" class="txt1preto"><a href="cadastrar_cliente.php">&gt;
                              Adicionar cliente</a></td>
                            <td width="195" valign="top" class="txt1preto"><a href="relatorio_clientes.php">&gt; Hist&oacute;rico dos seus Cliente </a></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
                <td valign="top" class="txt1preto"><span class="txt1vermelho"><strong>Como
                  enviar relat&oacute;rios? </strong></span><br>
                  1 - Selecione o cliente para qual a venda foi efetuada. Caso
                  o <br> &nbsp;&nbsp;&nbsp;&nbsp; cliente n&atilde;o apare&ccedil;a
                  na lista, clicar em adicionar novo cliente.<br>
                  2 - Selecione os produtos que foram vendidos.<br>
                  3 - Clique em avan&ccedil;ar.</td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="778" border="0" cellpadding="0" cellspacing="0" bgcolor="FBEEBB">
  <tr>
    <td width="13" height="15">&nbsp;</td>
    <td height="15" class="txt1veemelhobold">2 - Produtos vendidos</td>
    <td width="13" height="15">&nbsp;</td>
  </tr>
  <input type="hidden" name="action" value="<?=_ADICIONAR_PEDIDO_?>"/>
<?=$out?>
  
</table>
<table width="778" border="0" cellpadding="0" cellspacing="0" bgcolor="FBEEBB">
  <tr>
    <td width="13" height="25">&nbsp;</td>
    <td height="25">&nbsp;</td>
    <td width="13" height="25">&nbsp;</td>
  </tr>
  <tr>
    <td width="13" height="25">&nbsp;</td>
    <td height="25"><input name="next" type="submit" class="botao3" value="Avan&ccedil;ar &gt;&gt;"></td>
    <td width="13" height="25">&nbsp;</td>
  </tr>
  </form>
  <tr>
    <td width="13" height="70">&nbsp;</td>
    <td height="70" class="txt1preto"><a href="logout.php">Logout</a></td>
    <td width="13" height="70">&nbsp;</td>
  </tr>
</table>
<p class="txt1preto">&nbsp;</p>
</body>
</html>


Então sou redirecionado para a próxima página onde defino algumas caracteristicas do produto essa pagina chama -se MOSTRA TABELA
o código dela é o seguinte

CODE
<?

/*
* mostra_tabela.php
* Mostra a tabela de sub-produtos de acordo com o produto passado
* rafael@trestini.com.br
*
* Parametros
* codpro - codigo do produto
*/

require_once("includes/config.inc.php");
global $config;

require_once($config['path']['conexao']);

session_start();

//echo "codpro: " . $codpro . "<br/>";

$sql = "SELECT COR.* from COR
        inner join PRODUTO_COR on COR.CODCOR=PRODUTO_COR.CODCOR
        where CODPRO=" . $codpro;
        
$query = mysql_query($sql) or die ($sql . "<br/><br/>" . mysql_error());
$qtdcores = mysql_num_rows($query);

while($rs = mysql_fetch_array($query)){
    $coresheader .= "<td width='50' valign='middle' align='center' class='tit1preto'>" . $rs['NOMCOR'] . "</td>\n";
    $cores .= "<td width='50' align='center'><input type='text' name='cor_" . $rs['CODCOR'] . "[]' class='campotxt' style='width:70%'/></td>\n";
}
        
$sql = "SELECT SUBPRODUTO.*,PRODUTO.* from PRODUTO
        inner join SUBPRODUTO on PRODUTO.CODPRO=SUBPRODUTO.CODPRO
        where PRODUTO.CODPRO=" . $codpro;
$query = mysql_query($sql) or die ($sql . "<br/><br/>" . mysql_error());

while($rs = mysql_fetch_array($query)){
    $nomeproduto = $rs['NOMPRO'];
    $tabela .= "
                <tr>
                    <td class='tit1preto'><input type='hidden' name='codsubpro[]' value='" . $rs['CODSBP'] . "'/>" . $rs['CODSUBPRO'] . "</td>
                    <td class='tit1preto'>" . $rs['NOMSBP'] . "</td>
                    " . $cores . "
                    <Td><input type='text' name='valor[]' onkeydown='return charValid(event.keyCode, this)' class='campotxt'/></td>
                </tr>";
}

switch(date('w')){
    case 0: $dia = "Domingo"; break;
    case 1: $dia = "Segunda-feira"; break;
    case 2: $dia = "Terça-feira"; break;
    case 3: $dia = "Quarta-feira"; break;
    case 4: $dia = "Quinta-feira"; break;
    case 5: $dia = "Sexta-feita"; break;
    case 6: $dia = "Sábado"; break;
}

switch(date('n')){
    case 1: $mes = "Janeiro"; break;
    case 2: $mes = "Fevereiro"; break;
    case 3: $mes = "Março"; break;
    case 4: $mes = "Abril"; break;
    case 5: $mes = "Maio"; break;
    case 6: $mes = "Junho"; break;
    case 7: $mes = "Julho"; break;
    case 8: $mes = "Agosto"; break;
    case 9: $mes = "Setembro"; break;
    case 10: $mes = "Outubro"; break;
    case 11: $mes = "Novembro"; break;
    case 12: $mes = "Dezembro"; break;
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>FGA UTILIDADES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="_elementos/fga_css.css" rel="stylesheet" type="text/css">

<script language="javascript">
    function valida(){
        var hasValor = false;
        for(var i=0; i<document.forml.length; i++){
            if(document.forml[i].name.substring(0,3) == "val"){
                if(document.forml[i].value != ""){
                    hasValor = true;
                    break;
                }
            }
        }
        
        if(!hasValor){
            alert("Pelo menos um produto (quantidade e valor) tem que ser preenchido");
            return false;
        }
        
        for(var i=0; i<document.forml.length; i++){
            if(document.forml[i].name.substring(0,3) == "cor" || document.forml[i].name.substring(0,3) == "val"){
                if(document.forml[i].value != "" && !isNaN(document.forml[i].value)){
                    //alert(document.forml[i].name + " :: " + document.forml[i].value);
                    return validaCorValor();
                }
            }
        }
        alert("É necessário o preenchimento de ao menos um produto");
        return false;
    }
    
    function validaCorValor(){
        for(var i=0; i<document.forml.length; i++){
            if(document.forml[i].name.substring(0,3) == "cor" || document.forml[i].name.substring(0,3) == "val"){
                if(isNaN(document.forml[i].value)){
                    alert("Alguns dados foram preenchidos de maneira incorreta");
                    document.forml[i].focus();
                    return false;
                }
            }
        }
        return true;
    }
    
    function charValid(caracter, element){
//        alert(caracter);
        if((caracter >= 48 && caracter <= 57) || (caracter >= 96 && caracter <= 105) || caracter == 190 || caracter == 8 || caracter == 194){
            return true
        }else if(caracter == 188 || caracter == 110){
//            alert("virgula!");
            element.value += ".";
            return false;
        }else{
//            alert("invalido " + caracter);
//            alert(caracter);
            return false;
        }
    }
</script>

</head>

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<form name="forml" method="post" action="tabela.action.php" onsubmit="return valida()">
<input type="hidden" name="action" value="<?=_ADICIONAR_PRODUTOS_?>"/>
<input type="hidden" name="codpro" value="<?=$codpro?>"/>

<table width="778" height="94" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10" bgcolor="5D1101"><img src="_elementos/10x10.gif" width="10" height="10"></td>
  </tr>
  <tr>
    <td><table width="778" height="80" border="0" cellpadding="0" cellspacing="0">
      <tr>
          <td width="120"><table width="120" height="80" border="0" cellpadding="0" cellspacing="0">
<tr>
                <td align="center" valign="middle"><img src="_elementos/logo_fga.gif" width="98" height="72"></td>
              </tr>
            </table></td>
        <td><table width="658" height="80" border="0" cellpadding="0" cellspacing="0">
          <tr>
                <td height="22" align="right"><img src="_elementos/alfa_1_envio.gif" width="645" height="25"></td>
          </tr>
          <tr>
                <td height="22" align="right" background="_elementos/alfa_2.jpg"><span class="tit1preto">
                <strong><?=$dia. date(", d \de ") . $mes . date(" \de Y")?></strong>
                <font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;&nbsp;</font></span><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;&nbsp;
                  </font></td>
          </tr>
          <tr>
                <td><table width="537" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="103" align="right"><img src="_elementos/icon_repr.gif" width="20" height="19"></td>
                      <td width="434" align="right"><span class="txt1preto"><font size="1">Ol&aacute;,</font>
                        </span><span class="txt1veemelhobold"><strong><?=$_SESSION['nome.usuario']?>.</strong></span><font size="1"><strong></strong></font><font size="1"><strong>
                        </strong><span class="txt1preto">Bem-vindo &agrave; &aacute;rea
                        de representantes da FGA Utilidades.</span></font></td>
                    </tr>
                  </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="10" bgcolor="5D1101"><img src="_elementos/10x10.gif" width="10" height="10"></td>
  </tr>
</table>
<table width="778" height="94" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20"><img src="_elementos/pedidos.gif" width="778" height="20"></td>
  </tr>
  <tr>
    <td background="_elementos/pedidos_2.jpg"><table width="778" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="389">
<table width="389" height="74" border="0" cellpadding="0" cellspacing="0">
<tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><table width="389" height="24" border="0" cellpadding="0" cellspacing="0">
<tr>
                      <td width="13">&nbsp;</td>
                      <td class="txt2vermelho">PRODUTO <?=$_SESSION['prod.atual']?> de <?=$_SESSION['qtd.prods']?></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
          </td>
          <td><span class="txt1veemelhobold">DICAS DE PREENCHIMENTO</span><br>
            <span class="txt1preto">1 - Preencha as quantidades de cada produto
            e o valor em que <br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foram vendidos.<br>
            2 - Clique avan&ccedil;ar para preencher o pr&oacute;ximo produto.</span></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="778" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1">&nbsp;</td>
    <td>
    
  <table width="758" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td height="25" valign="middle" colspan="<?=($qtdcores + 3)?>" class="txt1veemelhobold"><?=$nomeproduto?></td>
    </tr>
    <tr>
        <td height="25" valign="middle" class='tit1preto' width="30">Cod</td>
        <td valign="middle" class='tit1preto' width="<?=(758 - ($qtdcores * 50) - 160)?>">Produto</td>
        <?=$coresheader?>
        <td valign="middle" width="130" class='tit1preto'>Valor Unit</td>
    </tr>
    
    <?=$tabela?>
    
  </table>
            
      </td>
    <td width="1">&nbsp;</td>
  </tr>
</table>

<table width="778" height="40" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td><input name="previous" type="button" class="botao3" value="&lt; &lt; Voltar" onclick="java script:history.back()">
      </td>
    <td width="170" align="center">
      <input name="next" type="submit" class="botao3" value="Avan&ccedil;ar &gt;&gt;">    </td>
  </tr>
</table>
</form>
</body>
</html>


quado termin ode definir todas as caracteristicas ele me joga nessa página, que é a FINALIZAR PEDIDO
CODE
<?

session_start();

switch(date('w')){
    case 0: $dia = "Domingo"; break;
    case 1: $dia = "Segunda-feira"; break;
    case 2: $dia = "Terça-feira"; break;
    case 3: $dia = "Quarta-feira"; break;
    case 4: $dia = "Quinta-feira"; break;
    case 5: $dia = "Sexta-feita"; break;
    case 6: $dia = "Sábado"; break;
}

switch(date('n')){
    case 1: $mes = "Janeiro"; break;
    case 2: $mes = "Fevereiro"; break;
    case 3: $mes = "Março"; break;
    case 4: $mes = "Abril"; break;
    case 5: $mes = "Maio"; break;
    case 6: $mes = "Junho"; break;
    case 7: $mes = "Julho"; break;
    case 8: $mes = "Agosto"; break;
    case 9: $mes = "Setembro"; break;
    case 10: $mes = "Outubro"; break;
    case 11: $mes = "Novembro"; break;
    case 12: $mes = "Dezembro"; break;
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>FGA UTILIDADES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="_elementos/fga_css.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table width="778" height="94" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="10" bgcolor="5D1101"><img src="_elementos/10x10.gif" width="10" height="10"></td>
  </tr>
  <tr>
    <td><table width="778" height="80" border="0" cellpadding="0" cellspacing="0">
      <tr>
          <td width="120"><table width="120" height="80" border="0" cellpadding="0" cellspacing="0">
<tr>
                <td align="center" valign="middle"><img src="_elementos/logo_fga.gif" width="98" height="72"></td>
              </tr>
            </table></td>
        <td><table width="658" height="80" border="0" cellpadding="0" cellspacing="0">
          <tr>
                <td height="22" align="right"><img src="_elementos/alfa_1_envio.gif" width="645" height="25"></td>
          </tr>
          <tr>
                <td height="22" align="right" background="_elementos/alfa_2.jpg">
                <span class="tit1preto">
                <strong><?=$dia. date(", d \de ") . $mes . date(" \de Y")?></strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;&nbsp;</font></span><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;&nbsp;
                  </font></td>
          </tr>
          <tr>
                <td><table width="537" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="103" align="right"><img src="_elementos/icon_repr.gif" width="20" height="19"></td>
                      <td width="434" align="right"><span class="txt1preto"><font size="1">Ol&aacute;,
                        </font></span><span class="txt1veemelhobold">
                        <strong><?=$_SESSION['nome.usuario']?>.</strong>
                        </span><strong></strong><font size="1"><strong>
                        </strong><span class="txt1preto">Bem-vindo &agrave; &aacute;rea
                        de representantes da FGA Utilidades.</span></font></td>
                    </tr>
                  </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="10" bgcolor="5D1101"><img src="_elementos/10x10.gif" width="10" height="10"></td>
  </tr>
</table>
<table width="778" height="94" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20"><img src="_elementos/pedidos.gif" width="778" height="20"></td>
  </tr>
  <tr>
    <td background="_elementos/pedidos_2.jpg"><table width="778" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="389">
<form name="forml" method="post" action="tabela.action.php">
<input type="hidden" name="action" value="<?=_FINALIZAR_PEDIDO_?>"/>
<table width="389" height="74" border="0" cellpadding="0" cellspacing="0">
<tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><table width="389" height="24" border="0" cellpadding="0" cellspacing="0">
<tr>
                      <td width="13">&nbsp;</td>
                      <td class="txt2vermelho">Finaliza&ccedil;&atilde;o do relat&oacute;rio.</td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
          </td>
          <td class="txt1preto">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="778" height="182" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="5">
    </td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="5"></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="5"></td>
  </tr>
  <tr>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
    <td height="15" bgcolor="FDF6DD" class="txt1preto">Nome do comprador</td>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"></td>
    <td height="20" bgcolor="FDF6DD" class="campotxt">
      <input name="comprador" type="text" class="campotxt2">
    </td>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"></td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="15" bgcolor="FDF6DD" class="campotxt">Pra&ccedil;a de pagamento</td>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="8" height="18"></td>
    <td height="20" bgcolor="FDF6DD" class="campotxt">
      <input name="praca" type="text" class="campotxt2">
    </td>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"><img src="_elementos/traco2.gif" width="1" height="18"></td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="15" bgcolor="FDF6DD" class="campotxt">Frete</td>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
    <td height="20" bgcolor="FDF6DD" class="campotxt">
      <input name="frete" type="radio" class="campobola" value="FOB">
      &nbsp;FOB &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="frete" type="radio" class="campobola" value="CIF">
      &nbsp;CIF</td>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="15"></td>
    <td height="15" bgcolor="FDF6DD" class="campotxt">Redespacho pela transportadora</td>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="15"></td>
  </tr>
  <tr>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"></td>
    <td height="20" bgcolor="FDF6DD" class="campotxt"> <input name="transportadora" type="text" class="campotxt2"></td>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"></td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  
  <tr>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="15"></td>
    <td height="15" bgcolor="FDF6DD" class="campotxt">Forma de Pagamento</td>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="15"></td>
  </tr>
  <tr>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"></td>
    <td height="20" bgcolor="FDF6DD" class="campotxt"> <input name="formapagto" type="text" class="campotxt2"></td>
    <td width="13" height="20" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="18"></td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="1" height="10"></td>
  </tr>
  
  <tr>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="8" height="10"></td>
    <td height="15" bgcolor="FDF6DD" class="campotxt">Observa&ccedil;&otilde;es</td>
    <td width="13" height="15" bgcolor="FDF6DD" class="campotxt"><img src="_elementos/traco2.gif" width="8" height="10"></td>
  </tr>
  <tr>
    <td width="13" height="80" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
    <td height="80" bgcolor="FDF6DD" class="campotxt">
      <textarea name="obs" class="campotxt3" rows="6" cols="40"></textarea>
    </td>
    <td width="13" height="80" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
    <td height="10" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
  </tr>
  <tr>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
    <td height="10" bgcolor="FDF6DD" class="campotxt"><table width="752" border="0" cellspacing="0" cellpadding="0">
<tr>
          <td width="20">&nbsp;</td>
          <td width="251">
          
            <input name="next" type="submit" class="botao" value="Visualizar relat&oacute;rio"></td>
            
          <td class="botao">&nbsp;</td>
        </tr>
      </table></td>
    <td width="13" height="10" bgcolor="FDF6DD" class="campotxt">&nbsp;</td>
  </tr>
</table>
</form>
<p class="campotxt2">&nbsp;</p>
<p class="txt2vermelho">&nbsp; </p>
<p class="txt1preto">&nbsp; </p>
</body>
</html>


O QUE EU PRECISO É UM BOTÃO VOLTAR... que não seja só o JS com history -1
as caixa deve recuperar os valores...
e esse é o problema nem sei colo ele tá transmitindo os valores de uma página pra outra pra pdoe jogar elas nas caixas...
Se algu[em puder me dar um breve explicada no código e me dizer como ecuperar os valores na variaves ajudaria muito
porque além disso preciso de um botão
Fazer o mesmo pedido novamente
onde carregaria o pedido nas caixas pra pessoa só alterar algumas coisa... e já mandar o pedido denovo
também não sei como vou fazer isso
PRECISO DISSO MEIO RÁPIDO
Valeu Galera
Conto com vocês
0

#2 User is offline   ricardoelias 

  • Group: Membros
  • Posts: 153
  • Joined: 14-July 04

  Posted 21 May 2007 - 05:56 PM

Pessoal achei um arquivo importante eu acho se chaam tabela.action.php

CODE
<?

/*
* tabela.action.php
* concentra todas as acoes para o preenchimento do pedido
*/

require_once("includes/config.inc.php");
global $config;

require_once($config['path']['conexao']);

session_start();

if(empty($_SESSION['nome.usuario'])){
    echo "<script>alert('Sua sessao expirou'); location.href='adicionar_pedido.php';</script>";
}

if(empty($_SESSION['cod.pedido'])){
    header("Location: home.php");
}

switch($action){
    case _ADICIONAR_PEDIDO_:
        $_SESSION['qtd.prods'] = count($produto);
        $_SESSION['prod.atual'] = 1;    
    
        $sql = "SELECT count(*) as COUNT,CODCLI from CLIENTE where CGCCLI='" . $cnpj . "' group by CODCLI";
        $query = mysql_query($sql) or die(mysql_error());
        $rs = mysql_fetch_array($query);
        if($rs['COUNT'] == 0){
            exit("CNPJ invalido. Nenhum cliente cadastrado com esse numero<br/><a href='cadastrar_cliente.php'>Inserir cadastro</a>");
        }else{
            $_SESSION['cod.cliente'] = $rs['CODCLI'];
        }
    
        $ins = "INSERT into PEDIDO (CODCLI,CODUSR,DTAPED) values (" . $_SESSION['cod.cliente'] . "," . $_SESSION['cod.usuario'] . ",now())";
        if(mysql_query($ins)){
            $_SESSION['cod.pedido'] = mysql_insert_id();
        }else{
            exit("Falha ao tentar criar o pedido");
        }
        
        $_SESSION['serial.prods'] = serialize($produto);
        header("Location: mostra_tabela.php?codpro=" . $produto[0]);
        exit();
        break;
        
    case _ADICIONAR_PRODUTOS_:
        $_SESSION['prod.atual']++;
        /* Montando o array de cores */
        $sql = "SELECT CODCOR from PRODUTO_COR where CODPRO=" . $codpro;
        $query = mysql_query($sql) or die("SQL: " . $sql . "<br/>" . mysql_error());
        $cores = Array();
        while($rs = mysql_fetch_array($query)){
            array_push($cores, $rs['CODCOR']);
        }
        
        // montando array serializado de produtos caso a validacao tenha passado
        $produtos = unserialize($_SESSION['serial.prods']);
        $aux_produtos = Array();
        foreach($produtos as $cod){
            if($cod != $codpro){
                array_push($aux_produtos, $cod);
            }
        }
        $_SESSION['serial.prods'] = serialize($aux_produtos);

        // gravacao dos produtos e das quantidades
        foreach($codsubpro as $idx=>$codsbp){
            // verificacao do preenchimento das quantidades nas cores
            
            if($valor[$idx] > 0){
                $qtdcor = 0;
                foreach($cores as $codcor){
                    //echo "cor_$codcor [$idx]=" . ${"cor_" . $codcor}[$idx] . "<br/>";
                    $qtdcor += ${"cor_" . $codcor}[$idx];
                }
                if($qtdcor == 0) { exit("Nenhuma quantidade informada. <a href='java script:history.back()'>Voltar</a>"); }
            }

            $ins = "INSERT into PEDIDO_SUBPRODUTO values ('',
                    " . $_SESSION['cod.pedido'] . ",
                    " . $codsubpro[$idx] . ",
                    " . $valor[$idx] . ")";
            mysql_query($ins);
            $insert_id = mysql_insert_id();
            
            foreach($cores as $codcor){
                
            
                $ins_cor = "INSERT into PEDIDO_SUBPRODUTO_COR values (
                            " . $insert_id . ",
                            " . $codcor . ",
                            " . ${"cor_" . $codcor}[$idx] . ")";
//                echo $ins_cor . "<br/>";
                mysql_query($ins_cor);
            }
        }
        
        if(count($aux_produtos) > 0){
            header("Location: mostra_tabela.php?codpro=" . $aux_produtos[0]);
        }else{
            header("Location: finalizar_pedido.php");
        }
        break;
    case _FINALIZAR_PEDIDO_:
        $upd = "UPDATE PEDIDO set
                    CMPPED='" . $comprador . "',
                    PRCPGTPED='" . $praca . "',
                    FRTPED='" . $frete . "',
                    RDPTNSPED='" . $transportadora . "',
                    PGTPED='" . $formapagto . "',
                    OBSPED='" . $obs . "',
                    STAPED='F'
                where CODPED=" . $_SESSION['cod.pedido'];
        mysql_query($upd) or exit("Falha ao tentar finalizar o pedido. Clique no botao voltar do navegador e tente novamente");;
        header("Location: relatorio_pedido.php?codped=" . $_SESSION['cod.pedido']);
}
?>

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)