Ir para conteúdo

XIM

Members
  • Total de itens

    77
  • Registro em

  • Última visita

  • Dias vencidos

    1

XIM venceu o dia em Dezembro 24 2013

Teve o conteúdo mais curtido

Reputação

3 Comum

Sobre XIM

Informações Pessoais

  • Sexo
    Masculino

Últimos Visitantes

1963 visualizações
  1. XIM

    Busca Por Nome

    Boa Noite!!!!tenho este codigo...funciona bem puxando pelo código do produto,mas se eu digitar o nome n funciona...poderia me ajudar?desde já agradeço,obrigado e um ótimo fim de semana a todos. <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $colname_chama_saldo = "-1"; if (isset($_POST['cod_ean'])) { $colname_chama_saldo = $_POST['cod_ean']; } mysql_select_db($database_conexao, $conexao); $query_chama_saldo = sprintf("SELECT * FROM produtos WHERE cod_ean = %s and id_loja = '$id_loja'", GetSQLValueString($colname_chama_saldo, "text")); $chama_saldo = mysql_query($query_chama_saldo, $conexao) or die(mysql_error()); $row_chama_saldo = mysql_fetch_assoc($chama_saldo); $totalRows_chama_saldo = mysql_num_rows($chama_saldo); $colname_chama_vendas = "-1"; if (isset($_POST['cod_ean'])) { $colname_chama_vendas = $_POST['cod_ean']; } mysql_select_db($database_conexao, $conexao); $query_chama_vendas = sprintf("SELECT * FROM produtos_vendidos WHERE ean_vendido = %s and id_loja = '$id_loja'", GetSQLValueString($colname_chama_vendas, "text")); $chama_vendas = mysql_query($query_chama_vendas, $conexao) or die(mysql_error()); $row_chama_vendas = mysql_fetch_assoc($chama_vendas); $totalRows_chama_vendas = mysql_num_rows($chama_vendas); $maxRows_chama_entradas = 4; $pageNum_chama_entradas = 0; if (isset($_GET['pageNum_chama_entradas'])) { $pageNum_chama_entradas = $_GET['pageNum_chama_entradas']; } $startRow_chama_entradas = $pageNum_chama_entradas * $maxRows_chama_entradas; $colname_chama_entradas = "-1"; if (isset($_POST['cod_ean'])) { $colname_chama_entradas = $_POST['cod_ean']; } mysql_select_db($database_conexao, $conexao); $query_chama_entradas = sprintf("SELECT * FROM produtos WHERE cod_ean = %s and id_loja = '$id_loja' ORDER BY id_prod DESC", GetSQLValueString($colname_chama_entradas, "text")); $query_limit_chama_entradas = sprintf("%s LIMIT %d, %d", $query_chama_entradas, $startRow_chama_entradas, $maxRows_chama_entradas); $chama_entradas = mysql_query($query_limit_chama_entradas, $conexao) or die(mysql_error()); $row_chama_entradas = mysql_fetch_assoc($chama_entradas); if (isset($_GET['totalRows_chama_entradas'])) { $totalRows_chama_entradas = $_GET['totalRows_chama_entradas']; } else { $all_chama_entradas = mysql_query($query_chama_entradas); $totalRows_chama_entradas = mysql_num_rows($all_chama_entradas); } $totalPages_chama_entradas = ceil($totalRows_chama_entradas/$maxRows_chama_entradas)-1; mysql_select_db($database_conexao, $conexao); $query_chama_prods = "SELECT * FROM produtos WHERE id_loja = '$id_loja' ORDER BY id_prod DESC"; $chama_prods = mysql_query($query_chama_prods, $conexao) or die(mysql_error()); $row_chama_prods = mysql_fetch_assoc($chama_prods); $totalRows_chama_prods = mysql_num_rows($chama_prods); $colname_chama_entradas2 = "-1"; if (isset($_POST['cod_ean'])) { $colname_chama_entradas2 = $_POST['cod_ean']; } mysql_select_db($database_conexao, $conexao); $query_chama_entradas2 = sprintf("SELECT * FROM produtos WHERE cod_ean = %s ORDER BY id_prod DESC", GetSQLValueString($colname_chama_entradas2, "text")); $chama_entradas2 = mysql_query($query_chama_entradas2, $conexao) or die(mysql_error()); $row_chama_entradas2 = mysql_fetch_assoc($chama_entradas2); $totalRows_chama_entradas2 = mysql_num_rows($chama_entradas2); $queryString_chama_entradas = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_chama_entradas") == false && stristr($param, "totalRows_chama_entradas") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_chama_entradas = "&" . htmlentities(implode("&", $newParams)); } } $queryString_chama_entradas = sprintf("&totalRows_chama_entradas=%d%s", $totalRows_chama_entradas, $queryString_chama_entradas); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <!-- FIM DO CÓDIGO DE BLOQUEIO DO BOTÃO DIREITO--> <script language="JavaScript1.2"> function disabletext(e){ return false } function reEnable(){ return true } //if the browser is IE4+ document.onselectstart=new Function ("return false") //if the browser is NS6 if (window.sidebar){ document.onmousedown=disabletext document.onclick=reEnable } </script> <script language="JavaScript"> function moveRelogio(){ momentoAtual = new Date() hora = momentoAtual.getHours() minuto = momentoAtual.getMinutes() segundo = momentoAtual.getSeconds() str_segundo = new String (segundo) if (str_segundo.length == 1) segundo = "0" + segundo str_minuto = new String (minuto) if (str_minuto.length == 1) minuto = "0" + minuto str_hora = new String (hora) if (str_hora.length == 1) hora = "0" + hora horaImprimivel = hora + ":" + minuto + ":" + segundo +"hrs" document.form_relogio.relogio.value = horaImprimivel } function foco_ean() { document.form1.cod_ean.focus(); } </script> <style> #apDiv1 { display:none; background-color:#FFF; font-family:Arial, Helvetica, sans-serif; border:2px solid #CCC; position:absolute; width:574px; height:259px; z-index:1; left: 342px; top: 159px; } .apDiv1 a:link { color: #06F; text-decoration:none;} .apDiv1 a:visited { color:#06F; text-decoration:none;} .apDiv1 a:hover { color:#06F; text-decoration:underline;} </style> <?php $meses = array (1 => "01", 2 => "02", 3 => "03", 4 => "04", 5 => "05", 6 => "06", 7 => "07", 8 => "08", 9 => "09", 10 => "10", 11 => "11", 12 => "12"); $diasdasemana = array (1 => "Segunda-Feira",2 => "Terça-Feira",3 => "Quarta-Feira",4 => "Quinta-Feira",5 => "Sexta-Feira",6 => "Sábado",0 => "Domingo"); $hoje = getdate(); $dia = $hoje["mday"]; $mes = $hoje["mon"]; $nomemes = $meses[$mes]; $ano = $hoje["year"]; $diadasemana = $hoje["wday"]; $nomediadasemana = $diasdasemana[$diadasemana]; ?> <body onload="foco_ean(),moveRelogio(); "> <div id="apDiv1" class="apDiv1"> <table width="518" align="center" style="border:1px solid #CCC;"> <tr> <td height="54" colspan="2"><strong>Busca por produtos:</strong><br /> Clique no produto para obter informações. </td> <td width="81"><a href="#" onclick="document.getElementById('apDiv1').style.display='none';" ><img src="telas e graficos/bt_menu_principal.png" width="81" height="30" border="0" /></a></td> </tr> <tr> <td width="219">Cód:</td> <td colspan="2">Descrição: </td> </tr> </table> <div id="produts" style="height:130px; overflow:auto;"> <table width="506" border="1" bordercolor="#CCCCCC" align="center"> <?php do { ?> <tr> <td width="59" style=" font-size:12px;"><strong><a href="javascript:;" onclick="cod_ean.value = &quot;<?php echo $row_chama_prods['cod_ean']; ?>&quot;; document.ean.submit()"><?php echo $row_chama_prods['cod_ean']; ?></a></strong></td> <td style=" font-size:12px;"><strong><a href="javascript:;" onclick="cod_ean.value ='<?php echo $row_chama_prods['cod_ean']; ?>'; document.form1.submit()"><?php echo $row_chama_prods['descricao_prod']; ?></a></strong></td> </tr> <?php } while ($row_chama_prods = mysql_fetch_assoc($chama_prods)); ?> </table> </div> <table width="484" border="0" align="center"> <tr> <td width="436" style=" font-size:12px;">** Para busca avançada do item precione as teclas <strong>CTRL + F</strong>, e digite os dados, os itens semelhantes serão destacados**</td> </tr> </table> </div> <br /> <table width="771" border="0" align="center" cellspacing="0" style="border:#CCC 1px solid;"> <tr> <td width="100%"align="center" style="font-family: Arial, Helvetica, sans-serif; font-size: 30px; color: black; background-color: lightblue;"><strong>Estoque</strong></td> <td width="100%" align="center" style="font-family: Arial, Helvetica, sans-serif; color: black; background-color: lightblue;"><strong><a href="index.php" style="color: black; border:1px solid #819FF7; border-radius: 5px; background-color: #CCC;">Voltar</a></strong></td> </tr> <tr> <td colspan="2" style="background-color: lightblue; font-family:Arial, Helvetica, sans-serif;"> <form id="form1" name="form1" method="post" action=""> Código:<input name="cod_ean" type="text" id="cod_ean" value="" /> <input type="submit" name="buscar" id="buscar" value="Consultar" /> <a href="#" onclick="document.getElementById('apDiv1').style.display='block';">listar produtos <img src="telas e graficos/search-b-icon.png" width="28" height="28" border="0" /> </a> </form> </td> </tr> <tr> <td colspan="3" style=" font-family:Arial, Helvetica, sans-serif; color:#666; font-size:12px;"><a href="relatorio_abaixo_estoque.php">relatório abaixo de estoque</a> | <a href="relatorio_estoque.php">relatório de estoque</a></td> </tr> <tr> <td height="83" colspan="3" align="center" style="font-family:Arial, Helvetica, sans-serif;"><?php if ($totalRows_chama_saldo == 0) { // Show if recordset empty ?> <br /> <strong>Digite o código do produto, e precione a tecla 'enter'.<br /> Se estiver usando o scanner, basta passar no código de barras<br /> <br /> As informações serão mostradas de acordo com calcúlos até o momento da consulta.</strong> <?php } // Show if recordset empty ?> <br /> <?php if ((isset($_POST['cod_ean'])) && ($_POST['cod_ean'] != "")) { ?> <br /> <form name="form_relogio" method="get"> <font style=" font-size:13px;">Consulta realizada no dia <?php echo "$dia/$nomemes/$ano"; ?> ás <input name="relogio" type="text" size="8" readonly="readonly" style=" border:2PX; border:none;"> <br /> Estoque sujeito a alterações a qualquer momento.</font> </form> <table width="608" border="1"> <tr> <td width="59">Produto:</td> <td width="533" align="left"><strong><?php if($row_chama_saldo['descricao_prod']=="") {echo"<font color=\"#FF0000\">Sem Cadastro</font>";} else { echo $row_chama_saldo['descricao_prod']; }?></strong></td> </tr> <tr> <td>Cód:</td> <td align="left" style="color:#06F;"><strong><?php $ean=$_POST['cod_ean']; if ($row_chama_saldo['cod_ean']=="") {echo "<font color=\"#FF0000\">$ean</font>"; } else { echo $row_chama_saldo['cod_ean'];} ?></strong></td> </tr> <tr> <td colspan="2"><br /> Preço de venda:<strong> R$<?php if($row_chama_saldo['valor']==""){echo"0,00";}else{ echo $row_chama_saldo['valor'];} ?></strong> </td> </tr> </table> <br /> <em><br /> Custos da última entrada <br /> </em> <table width="468" border="0"> <tr> <td width="153" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;"><strong>Valor de Venda:</strong></td> <td width="186" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;"><strong>Custo de entrada:</strong></td> <td width="115" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;" align="center"><strong>Margem de Lucro</strong></td> </tr> <tr style="cursor:default;" onmouseover="javascript:this.style.backgroundColor='#BBF'" onmouseout="javascript:this.style.backgroundColor=''"> <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><strong> <?php if($row_chama_saldo['valor']==""){echo"0,00";}else{ echo $row_chama_saldo['valor'];} ?> </strong> </td> <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><?php $custo_entrada = $row_chama_entradas['custo_entrada'] ; echo number_format($custo_entrada, 2, ',', '.'); ?></td> <td align="right" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><?php // valor de venda $valor1 = $row_chama_saldo['valor']; // valor de entrada $valor2 = $row_chama_entradas['custo_entrada'] ; // margem de lucro $lucro1 = $valor1 - $valor2; ?><strong> <?php if ($lucro1 >'0'){?> <img src="2683_32x32.png" width="15" height="15" /> <font color="#009900"><?php echo number_format($lucro1, 2, ',', '.');?></font> <?php } else { ?> <img src="telas e graficos/alert.png" alt="" width="15" height="15" title="custo negativo" /> <font color="#FF0000"><?php echo number_format($lucro1, 2, ',', '.');?></font> <?php }?> </strong> </td> </tr> </table> <em><br /> 4 - ultimas entradas </em><br /> <table width="522" border="0"> <tr> <td width="168" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;"><strong>Protocolo:</strong></td> <td width="158" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;"><strong>Data:</strong></td> <td width="82" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;" align="center"><strong>Qt.Entr.Estoque.</strong></td> <td width="66" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; background-color:#D2D2FF;">&nbsp;</td> </tr> <?php do { ?> <tr style="cursor:default;" onmouseover="javascript:this.style.backgroundColor='#BBF'" onmouseout="javascript:this.style.backgroundColor=''"> <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><?php echo $row_chama_entradas['protocolo']; ?></td> <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><?php echo $row_chama_entradas['data_rec']; ?></td> <td align="right" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><strong> <?php $qtd_prod = $row_chama_entradas['quantidade']; echo "$qtd_prod";?> </strong></td> <td align="right" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; border-bottom:#CCC 1px solid;"><a href="ver_nf.php?cod=<?php echo $row_chama_entradas['protocolo']; ?>">ver nota fiscal</a></td> </tr> <?php } while ($row_chama_entradas = mysql_fetch_assoc($chama_entradas)); ?> </table> <br /> <br /> <br /> <table width="577" border="0"> <tr> <td width="571" style="background-color: #CCC;" align="center"><strong>Estatisticas do Produto</strong></td> </tr> <tr> <td style="background-color:#C6FFE2;">Entrada até o momento:<strong> <?php if($row_chama_saldo['quantidade']=="") { echo"0";} else { echo $row_chama_saldo['quantidade']; } ?></strong></td> </tr> <tr> <td>Saída até o momento:<strong> <strong>**</strong> <?php $valor = 0; do { ?> <?php $valor+=$row_chama_vendas['quantidade'] ; ?> <?php } while ($row_chama_vendas = mysql_fetch_assoc($chama_vendas));echo " $valor"; ?> </strong></td> </tr> <tr> <td style="background-color:#C6FFE2; color: #999;" >Limite de estoque do cadastro:<strong> <?php echo $row_chama_saldo['limite']; ?></strong></td> </tr> </table> <strong><br /> </strong><br /></td> </tr> <tr> <td height="82" colspan="3" style="font-family:Arial, Helvetica, sans-serif; font-size:17px; border:#CCC 1px solid;" ><strong>Disponível em estoque no momento: <?php $limite = $row_chama_saldo['limite']; $disponivel = $row_chama_saldo['quantidade'] - $valor; if($disponivel<=$limite) { echo "<font style=\"color:#F00;\">*".$disponivel."</font>"; } else { echo "<font style=\"color:#090\">*".$disponivel."</font>"; } ?> </strong> </td> </tr> <tr> <td colspan="3" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">Informações importantes:<br /> <strong> <strong></strong> <?php $limite = $row_chama_saldo['limite']; $disponivel = $row_chama_saldo['qtd'] - $valor; if($disponivel<=$limite) { echo "<font style=\"color:#F00;\" >*ATENÇÃO!<br /> a quantidade '".$disponivel."' está abaixo do limite de estoque do cadastro! </font>"; } else { echo "<font style=\"color:#090\"> * Quantidade '".$disponivel."' está no limite normal do estoque.</font>"; } ?> <br /> <em>**O total de &quot;Saídas&quot; soma também compras em aberto, se você possuí vendas em aberto, recomendamos<br /> que feche ou exclua do sistema se nescessário o mais rápido possível para que seu estoque não seja alterado. <strong> <?php } ?> </strong></em></strong> </td> </tr> </table> </body> </html>
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.