Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <title>Produtos da OS <?php echo $id; ?></title>
- <script language='JavaScript'>
- function SomenteNumero(e){
- var tecla=(window.event)?event.keyCode:e.which;
- if((tecla>47 && tecla<58)) return true;
- else{
- if (tecla==8 || tecla==0) return true;
- else return false;
- }
- }
- </script>
- </html>
- <?php
- include('config.php');
- $ip = $_SERVER['REMOTE_ADDR'];
- $usuario = $_POST['usuario'];
- $senha = $_POST['senha'];
- $id = $_POST['id'];
- $resolucao = $_POST['historico'];
- $ip1 = $_POST['ip1'];
- $ip2 = $_POST['ip2'];
- $veiculo = $_POST['automovel'];
- mysql_query("INSERT INTO `os_ip` (`cod_ip`,`ip1`,`ip2`,`os_id`) VALUES (NULL,'".$ip1."','".$ip2."','".$id."');");
- echo "<BR><BR><BR>";
- if(empty($usuario)){
- echo ("<center><h2><font color=red>Campo usuário esta em branco, favor preencher!");
- } else {
- if(empty($senha)){
- echo ("<center><h2><font color=red>Campo senha esta em branco, favor preencher!");
- } else {
- if(empty($id)){
- echo ("<center><h2><font color=red>Campo nº OS esta em branco, favor preencher!");
- } else {
- $tes = mysql_query("select count(*) from os where id ='$id'");
- $tes1 = mysql_result($tes,0);
- if ($tes1==1){
- $os = mysql_query("select status from os where id='$id'");
- $os1 = mysql_result($os,0);
- $us = mysql_query("select count(*) from user where user='$usuario' and user_password='$senha'");
- $use1 = mysql_result($us,0);
- if (($os1==1)or ($os1==3)) {
- mysql_query("UPDATE os SET status=3, resolucao='$resolucao' where id = $id");
- if ($use1 == 1) {
- if (empty($veiculo)) {
- echo ("<center><h2><font color=red>Veículo não foi selecionado!");
- } else {
- $query2 = mysql_query('SELECT nome FROM automoveis where id='.$veiculo.'');
- $auto = mysql_result($query2,0);
- $clien = mysql_query('SELECT nome_cliente FROM os where id='.$id.'');
- $cliente = mysql_result($clien,0);
- $usern = mysql_query('SELECT clientes_id FROM os where id='.$id.'');
- $username = mysql_result($usern,0);
- echo "<form action='fechaos.php' method=post>
- <table border='0' align=center width=700>
- <tr>
- <td>Usuário: <b>". $usuario ."</b></td>
- <td>IP: ". $ip ."</td>
- </tr>
- <tr>
- <td>OS nº: <b>". $id ."</b></td>
- <td>Veículo: <b>". $auto."</b></td>
- </tr>
- <tr>
- <td>Cliente: <b>".$cliente."</b></td>
- <td><input type='hidden' name='id2' value=".$id ." /></td>
- </tr>
- </table>";
- $res = mysql_query("select * from produtos ORDER BY nome ASC"); /*Executa o comando SQL, no caso para pegar todos os usuarios do sistema e retorna o valor da consulta em uma variavel ($res) */
- echo "<table border='1' align=center width=700>
- <tr>
- <td align=center width=540><b>Nome</b></td>
- <td align=center width=100><b>Valor</b></td>
- <td align=center width=30><b>Quantidade<BR>Utilizada</b></td>
- <td align=center width=30><b>Recebeu?</b></td>
- </tr>";
- /*Enquanto houver dados na tabela para serem mostrados será executado tudo que esta dentro do while */
- while($escrever=mysql_fetch_array($res)){
- /*Escreve cada linha da tabela*/
- $num = $escrever['valor'];
- $num1 = number_format($num, 2, ',', '.');
- $prod6 = $escrever['id'];
- echo "<tr>
- <td align=center>" . $escrever['nome'] . "</td>
- <td align=center>R$ " . $num1 . "</td>
- <td align=center><input type='text' size='10' name='quant' maxlength='3' onkeypress='return SomenteNumero(event)'></td>
- <td align=center><select size='1'>
- <option selected></option>
- <option value='p_sim'>Sim</option>
- <option value='p_nao'>Não</option>
- <option value='p_loja'>Loja</option>
- <option value='p_repo'>Reposição</option>
- </select>
- <input name='id_prod' type='hidden' value=". $escrever['id'] .">
- </td>
- </tr>
- <input type='hidden' name='produ1' value=".$prod6 ." />";
- }/*Fim do while*/
- echo "</table>
- <table border=0 align=center>
- <tr>
- <td><BR><input type='submit' value='Finalizar OS'></td>
- </tr>
- </table>
- </form>"; /*fecha a tabela apos termino de impressão das linhas*/
- }
- } else {
- echo "<font color=red><center>Usuário ou senha errados ou não esta autorizado!</font>";
- }
- } else {
- echo "<center><h1><font color=red>OS já foi finalizada, favor informar ao Leo, para verificação!";
- }
- }else{
- echo ("<center><h1><font color=red>OS não encontrada!");
- }
- }
- }
- }
- ?>
- <?php
- include('config.php');
- $quant = $_POST['quant'];
- $id = $_POST['id2'];
- $produto = $_POST['id_prod'];
- echo $quant, $id, $produto;
- mysql_query("UPDATE os SET status=0 where id = $id");
- mysql_query("INSERT INTO `estoque` (`produtos_id`,`cc`,`quant`) VALUES ('".$produto."','0','".$quant."');");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement