Advertisement
Guest User

Untitled

a guest
May 20th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. <html>
  2. <title>Produtos da OS <?php echo $id; ?></title>
  3. <script language='JavaScript'>
  4. function SomenteNumero(e){
  5. var tecla=(window.event)?event.keyCode:e.which;
  6. if((tecla>47 && tecla<58)) return true;
  7. else{
  8. if (tecla==8 || tecla==0) return true;
  9. else return false;
  10. }
  11. }
  12. </script>
  13. </html>
  14. <?php
  15. include('config.php');
  16. $ip = $_SERVER['REMOTE_ADDR'];
  17. $usuario = $_POST['usuario'];
  18. $senha = $_POST['senha'];
  19. $id = $_POST['id'];
  20. $resolucao = $_POST['historico'];
  21. $ip1 = $_POST['ip1'];
  22. $ip2 = $_POST['ip2'];
  23. $veiculo = $_POST['automovel'];
  24. mysql_query("INSERT INTO `os_ip` (`cod_ip`,`ip1`,`ip2`,`os_id`) VALUES (NULL,'".$ip1."','".$ip2."','".$id."');");
  25. echo "<BR><BR><BR>";
  26. if(empty($usuario)){
  27. echo ("<center><h2><font color=red>Campo usu&aacute;rio esta em branco, favor preencher!");
  28. } else {
  29. if(empty($senha)){
  30. echo ("<center><h2><font color=red>Campo senha esta em branco, favor preencher!");
  31. } else {
  32. if(empty($id)){
  33. echo ("<center><h2><font color=red>Campo n&#186; OS esta em branco, favor preencher!");
  34. } else {
  35. $tes = mysql_query("select count(*) from os where id ='$id'");
  36. $tes1 = mysql_result($tes,0);
  37. if ($tes1==1){
  38. $os = mysql_query("select status from os where id='$id'");
  39. $os1 = mysql_result($os,0);
  40. $us = mysql_query("select count(*) from user where user='$usuario' and user_password='$senha'");
  41. $use1 = mysql_result($us,0);
  42. if (($os1==1)or ($os1==3)) {
  43. mysql_query("UPDATE os SET status=3, resolucao='$resolucao' where id = $id");
  44. if ($use1 == 1) {
  45. if (empty($veiculo)) {
  46. echo ("<center><h2><font color=red>Ve&iacute;culo n&atilde;o foi selecionado!");
  47. } else {
  48. $query2 = mysql_query('SELECT nome FROM automoveis where id='.$veiculo.'');
  49. $auto = mysql_result($query2,0);
  50. $clien = mysql_query('SELECT nome_cliente FROM os where id='.$id.'');
  51. $cliente = mysql_result($clien,0);
  52. $usern = mysql_query('SELECT clientes_id FROM os where id='.$id.'');
  53. $username = mysql_result($usern,0);
  54. echo "<form action='fechaos.php' method=post>
  55. <table border='0' align=center width=700>
  56. <tr>
  57. <td>Usu&aacute;rio: <b>". $usuario ."</b></td>
  58. <td>IP: ". $ip ."</td>
  59. </tr>
  60. <tr>
  61. <td>OS n&#186;: <b>". $id ."</b></td>
  62. <td>Ve&iacute;culo: <b>". $auto."</b></td>
  63. </tr>
  64. <tr>
  65. <td>Cliente: <b>".$cliente."</b></td>
  66. <td><input type='hidden' name='id2' value=".$id ." /></td>
  67. </tr>
  68. </table>";
  69. $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) */
  70. echo "<table border='1' align=center width=700>
  71. <tr>
  72. <td align=center width=540><b>Nome</b></td>
  73. <td align=center width=100><b>Valor</b></td>
  74. <td align=center width=30><b>Quantidade<BR>Utilizada</b></td>
  75. <td align=center width=30><b>Recebeu?</b></td>
  76.  
  77. </tr>";
  78. /*Enquanto houver dados na tabela para serem mostrados será executado tudo que esta dentro do while */
  79. while($escrever=mysql_fetch_array($res)){
  80.  
  81. /*Escreve cada linha da tabela*/
  82. $num = $escrever['valor'];
  83. $num1 = number_format($num, 2, ',', '.');
  84. $prod6 = $escrever['id'];
  85.  
  86. echo "<tr>
  87. <td align=center>" . $escrever['nome'] . "</td>
  88. <td align=center>R$ " . $num1 . "</td>
  89. <td align=center><input type='text' size='10' name='quant' maxlength='3' onkeypress='return SomenteNumero(event)'></td>
  90. <td align=center><select size='1'>
  91. <option selected></option>
  92. <option value='p_sim'>Sim</option>
  93. <option value='p_nao'>Não</option>
  94. <option value='p_loja'>Loja</option>
  95. <option value='p_repo'>Reposição</option>
  96. </select>
  97. <input name='id_prod' type='hidden' value=". $escrever['id'] .">
  98. </td>
  99. </tr>
  100. <input type='hidden' name='produ1' value=".$prod6 ." />";
  101. }/*Fim do while*/
  102. echo "</table>
  103. <table border=0 align=center>
  104. <tr>
  105. <td><BR><input type='submit' value='Finalizar OS'></td>
  106. </tr>
  107. </table>
  108.  
  109. </form>"; /*fecha a tabela apos termino de impressão das linhas*/
  110. }
  111. } else {
  112. echo "<font color=red><center>Usu&aacute;rio ou senha errados ou n&atilde;o esta autorizado!</font>";
  113. }
  114. } else {
  115. echo "<center><h1><font color=red>OS j&aacute; foi finalizada, favor informar ao Leo, para verificação!";
  116. }
  117. }else{
  118. echo ("<center><h1><font color=red>OS n&atilde;o encontrada!");
  119. }
  120. }
  121. }
  122. }
  123. ?>
  124.  
  125. <?php
  126. include('config.php');
  127. $quant = $_POST['quant'];
  128. $id = $_POST['id2'];
  129. $produto = $_POST['id_prod'];
  130.  
  131.  
  132. echo $quant, $id, $produto;
  133. mysql_query("UPDATE os SET status=0 where id = $id");
  134. mysql_query("INSERT INTO `estoque` (`produtos_id`,`cc`,`quant`) VALUES ('".$produto."','0','".$quant."');");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement