Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/10/2012, 11:12
Avatar de jlct
jlct
 
Fecha de Ingreso: abril-2012
Ubicación: Venezuela
Mensajes: 148
Antigüedad: 12 años, 1 mes
Puntos: 19
Respuesta: Registro de transacciones

medicina_nuevo.php
Código PHP:
Ver original
  1. <?php
  2.     include("../../modelos/config.php");
  3.     $lcnombre=$_GET["lcnombre"];
  4.     $lnalmacen=$_GET["lnalmacen"]; 
  5.     $lctipo=$_GET["lctipo"];
  6.     $lcexistencia=$_GET["lcexistencia"];   
  7.     $lcindicaciones=$_GET["lcindicaciones"];
  8.     $lnhay=$_GET["lnhay"];
  9.     $lchacer=$_GET["lchacer"];
  10.     $lcoperacion=$_GET["lcoperacion"];
  11. ?>
  12.  
  13. <!doctype html>
  14. <html lang="es">
  15.     <head>
  16.         <meta charset="utf-8" />
  17.         <title>Unidad de Producción Mijagüito</title>
  18.         <link rel="shortcut icon" href="../imagenes/icono.png">
  19.         <link rel="stylesheet" href="../../css/estilo.css" />
  20.         <!--[if IE]>
  21.         <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  22.         <![endif]-->
  23.         <style type="text/css">
  24. <!--
  25. .Estilo1 {
  26.     color: #FF0000;
  27.     font-weight: bold;
  28. }
  29. .Estilo2 {color: #FF0000}
  30. .Estilo3 {font-size: 14px}
  31. -->
  32.         </style>
  33. <noscript>  
  34.         <!--[if IE]>  
  35.             <link rel="stylesheet" href="css/ie.css">  
  36.         <![endif]-->  
  37.         </noscript>
  38.     </head>
  39. <body class="no-js">
  40.  
  41.         <? include("../../nav/nav_menuprincipal.html"); ?>
  42.     <script src="../js/jquery.js"></script>  
  43.     <script src="../js/modernizr.js"></script>
  44.     <article>
  45.         <header><br />
  46.             <!-- <a href="javascript:history.go(-1)" class="Estilo3">Atrás </a><br /> -->
  47.             <br />
  48.             <h1 align="center">Registro de las medicinas o Líneas</h1>
  49.         </header><br />
  50.         <section>
  51.             <p><form name="form1" id="form1" method="post" action="../../controladores/cormedicina.php">
  52.             <input name="txthacer" type="hidden" id="txthacer" value="<? print($lchacer);?>" />
  53.             <input name="txtoperacion" type="hidden" id="txtoperacion" value="<? print($lcoperacion);?>" />
  54.             <input name="txthay" type="hidden" id="txthay" value="<? print($lnhay);?>"/>
  55.             <input name="txtubicacion" type="hidden" id="txtubicacion" value="general"/>
  56.                         <fieldset>
  57.                         <ol>
  58.                             <li>
  59.                               <table width="380" height="46" border="0">
  60.                                 <tr>
  61.                                 <td width="50"><span class="Estilo2">
  62.                                 <label for="nombre">*</label></span>
  63.                                 <label for="nombre">Almacen: </label>
  64.                                 </td>
  65.                                 <td width="125">
  66.                                 <select name="cmbalmacen" id="cmbalmacen">
  67.                                 <option value="-">Seleccione</option>
  68.                                 <?
  69.                                 $c = new Conexion;
  70.                                 $c->Conectar();
  71.                                 $c = mysql_query("Select * from talmacen");
  72.                                 while($row=mysql_fetch_array($c))
  73.                                 {
  74.                                 ?> <option value="<?=$row['id_almacen']?>" <? if($row['id_almacen']==$lnalmacen){print "selected";}?>><? print $row['nombre'];?></option>
  75.                                
  76.                                 <? } @mysql_close($c) ?>
  77.                                 </select>
  78.                                 </td>
  79.                                 </tr>
  80.                                 <tr>
  81.                                 <td width="50"><span class="Estilo2">
  82.                                 <label for="nombre">*</label></span>
  83.                                 <label for="nombre">Nombre: </label>
  84.                                 </td>
  85.                                 <td width="125"><input title="Nombre de la medicina. Ejemplo: Brahman" size="20" id="txtnombre" name="txtnombre" onBlur="focusmedicina()" placeholder="Ingrese el nombre de la medicina" value="<? print($lcnombre);?>">
  86.                                 </td>
  87.                                 </tr>
  88.                                 <tr>
  89.                                 <td><span class="Estilo2">
  90.                                 <label for="nombre">*</label></span>
  91.                                 <label for="nombre">Tipo de Medicina: </label>
  92.                                 </td>
  93.                                 <td width="125">
  94.                                 <select id="cmbtipo" name="cmbtipo" >
  95.                                 <option value="-" >Seleccione</option>
  96.                                 <option value="D" <? if($lctipo=="D"){print "selected";}?>>Desparasitantes</option>
  97.                                 <option value="G" <? if($lctipo=="G"){print "selected";}?>>Medicina General</option>
  98.                                 <option value="V" <? if($lctipo=="V"){print "selected";}?>>Vacunas</option>
  99.                                 </select>
  100.                                 </td>
  101.                                 </tr>
  102.                                 <tr>
  103.                                 <td width="50"><span class="Estilo2">
  104.                                 <label for="nombre">*</label></span>
  105.                                 <label for="nombre">Indicaciones: </label>
  106.                                 </td>
  107.                                 <td width="125">
  108.                                 <textarea name="txtindicaciones" id="txtindicaciones" cols="25" rows="2"><? print $lcindicaciones;?></textarea>
  109.                                 </td>
  110.                                 </tr>
  111.                                 <tr>
  112.                                 <td width="50"><span class="Estilo2">
  113.                                 <label for="nombre">*</label></span>
  114.                                 <label for="nombre">Existencia: </label>
  115.                                 </td>
  116.                                 <td width="125"><input title="Cantidad en existencia de la medicina" size="20" id="txtexistencia" name="txtexistencia" placeholder="Ingrese la cantidad del medicamento" value="<? print $lcexistencia;?>">
  117.                                 </td>
  118.                                 </tr>
  119.                               </table>
  120.                             </li>
  121.                         </ol>
  122.                         </fieldset>
  123.                     <fieldset>
  124.                         <p>
  125.                         <table align="center" width="200" border="0">
  126.                           <tr>
  127.                             <td><div align="center">
  128.                               <input name="btnguardar" type="button" id="button" value="Guardar" onClick="guardar()"/>
  129.                             </div></td>
  130.                             <td><div align="center">
  131.                               <input name="btncancelar" type="button" id="btncancelar" value="Limpiar" onClick="cancelar()"/>
  132.                             </div></td>
  133.                             <td><div align="center">
  134.                               <input name="btnsalir" type="button" id="btnsalir" value="Salir" onClick="location.href = 'medicina.php' "/>
  135.                             </div></td>
  136.                           </tr>
  137.                         </table>
  138.                           <br />
  139.                           <br />
  140.                         </p>
  141.                         <div align="center" class="Estilo1">"Los campos marcados con <span class="Estilo2">(*)</span> son campos obligatorios"</div>
  142.                     </fieldset>
  143.                     </form></p>
  144.         </section><br />
  145.     </article>
  146.     <footer>
  147.         <p>&copy; 2012 Universidad Politécnica Territorial de Portuguesa. Todos los derechos reservados.</p>
  148.     </footer>
  149. </body>
  150.  
  151. <script>
  152.     function validarletras(e)
  153.     { // 1
  154.        
  155.         tecla = (document.all) ? e.keyCode : e.which; // 2
  156.         if (tecla==8) return true; // 3
  157.         patron =/\D/;   // 4
  158.         te = String.fromCharCode(tecla); // 5
  159.         return patron.test(te); // 6
  160.     }
  161. </script>
  162. <script language="javascript">
  163.    inicio();
  164.    function inicio()
  165.    {
  166.       f=document.form1;
  167.       if(f.txtoperacion.value!="buscar")
  168.       {
  169.          if(f.txthacer.value=="listo")
  170.          {
  171.             if(f.txtoperacion.value=="incluir")
  172.             {
  173.                alert("Registro Almacenado");
  174.             }
  175.           }
  176.          cancelar();
  177.       }
  178.       else if(f.txtoperacion.value=="buscar")
  179.       {
  180.          if(f.txthay.value==1)
  181.          {
  182.             alert("Registro ya existe");
  183.                 existe();
  184.          }
  185.        }   
  186.  }//fin inicio             
  187.    
  188.    function existe()
  189.    {
  190.       f=document.form1;
  191.       f.txtnombre.disabled=true;
  192.       f.cmbalmacen.disabled=true;
  193.       f.txtexistencia.disabled=true;
  194.       f.cmbtipo.disabled=true;
  195.       f.txtindicaciones.disabled=true;
  196.            
  197.       f.btnguardar.disabled=true;
  198.       f.btncancelar.disabled=false;
  199.    }
  200.    function cancelar()
  201.    {
  202.       f=document.form1;
  203.       f.txthacer.value="";
  204.       f.txtnombre.value="";
  205.       f.cmbalmacen.value="-";
  206.       f.txtexistencia.value="";
  207.       f.cmbtipo.value="-";
  208.       f.txtindicaciones.value="";
  209.       f.txtnombre.disabled=false;
  210.       f.cmbalmacen.disabled=false;
  211.       f.txtexistencia.disabled=false;
  212.       f.cmbtipo.disabled=false;
  213.       f.txtindicaciones.disabled=false;
  214.    
  215.       f.btnguardar.disabled=false;
  216.       f.btncancelar.disabled=false;
  217.      
  218.       f.txtnombre.focus();//envia el curso a la caja de texto
  219.    }
  220.    
  221.    function focusmedicina()
  222.    {
  223.       f=document.form1;
  224.       if (f.txtnombre.value!="")
  225.       {
  226.          f.txtoperacion.value="buscar";
  227.          f.cmbalmacen.disabled=false;
  228.          f.submit();
  229.       }
  230.       else
  231.       {
  232.          f.txtnombre.focus();
  233.       }
  234.    }
  235.    function guardar()
  236.     {
  237.         f=document.form1;
  238.         f.txtoperacion.value="incluir";
  239.         f.txtnombre.disabled=false;
  240.         if (validar())
  241.         {
  242.             f.submit();
  243.         }
  244.     }
  245.    function validar()
  246.     {
  247.         f=document.form1;
  248.         bueno=false;
  249.         if(f.txtnombre.value=="")
  250.         {
  251.             alert("Debe ingresar el nombre de la medicina");
  252.             f.txtnombre.focus();
  253.         }
  254.         else if(f.cmbalmacen.value=="-")
  255.         {
  256.             alert("Debe seleccionar un almacen");
  257.             f.cmbalmacen.focus();
  258.         }
  259.         else if(f.txtindicaciones.value=="")
  260.         {
  261.             alert("Debe ingresar las indicaciones de la medicina");
  262.             f.txtindicaciones.focus();
  263.         }
  264.         else if(f.cmbtipo.value=="-")
  265.         {
  266.             alert("Debe seleccionar el tipo de medicamento");
  267.             f.cmbtipo.focus();
  268.         }
  269.         else if(f.txtexistencia.value=="")
  270.         {
  271.             alert("Debe ingresar una cantidad");
  272.             f.txtexistencia.focus();
  273.         }
  274.         else
  275.         {
  276.             bueno=true;
  277.         }
  278.         return bueno;
  279.     }//fin valida
  280. </script>
  281. </html>