Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/10/2012, 11:13
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_editar.php
Código PHP:
Ver original
  1. <?php
  2.     include("../../modelos/config.php");
  3.     $C = new Conexion;
  4.     $C->Conectar();
  5.     $ID = $_REQUEST['ID'];
  6.     $C = mysql_query("Select * from tmedicina where id_medicina=$ID");
  7.     if ($sql = @mysql_fetch_array($C))
  8.     {
  9.         $lnID = $sql['id_medicina'];
  10.         $lcnombre = $sql['nombre'];
  11.         $lnalmacen = $sql['almacen'];
  12.         $lctipo = $sql['tipo'];
  13.         $lcindicaciones = $sql['indicaciones'];
  14.         $lcexistencia = $sql['existencia'];
  15.     }
  16. ?>
  17.  
  18. <!doctype html>
  19. <html lang="es">
  20.     <head>
  21.         <meta charset="utf-8" />
  22.         <title>Unidad de Producción Mijagüito</title>
  23.         <link rel="shortcut icon" href="../imagenes/icono.png">
  24.         <link rel="stylesheet" href="../../css/estilo.css" />
  25.         <!--[if IE]>
  26.         <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  27.         <![endif]-->
  28.         <style type="text/css">
  29. <!--
  30. .Estilo1 {
  31.     color: #FF0000;
  32.     font-weight: bold;
  33. }
  34. .Estilo2 {color: #FF0000}
  35. .Estilo3 {font-size: 14px}
  36. -->
  37.         </style>
  38. <noscript>  
  39.         <!--[if IE]>  
  40.             <link rel="stylesheet" href="css/ie.css">  
  41.         <![endif]-->  
  42.         </noscript>
  43.     </head>
  44. <body class="no-js">
  45.  
  46.         <? include("../../nav/nav_menuprincipal.html"); ?>
  47.     <script src="../js/jquery.js"></script>  
  48.     <script src="../js/modernizr.js"></script>
  49.     <article>
  50.         <header><br />
  51.             <!-- <a href="javascript:history.go(-1)" class="Estilo3">Atrás </a><br /> -->
  52.             <br />
  53.             <h1 align="center">Registro de las medicinas o Líneas</h1>
  54.         </header><br />
  55.         <section>
  56.             <p><form name="form1" id="form1" method="post" action="../../controladores/cormedicina.php">
  57.                 <input name="txthacer" type="hidden" id="txthacer" value="<? print($lchacer);?>" />
  58.             <input name="txtoperacion" type="hidden" id="txtoperacion" value="<? print($lcoperacion);?>" />
  59.             <input name="txthay" type="hidden" id="txthay" value="<? print($lnhay);?>"/>
  60.             <input name="txtcodigo" type="hidden" id="txtcodigo" value="<? print($lnID);?>"/>
  61.             <input name="txtubicacion" type="hidden" id="txtubicacion" value="general"/>
  62.                         <fieldset>
  63.                         <ol>
  64.                             <li>
  65.                               <table width="380" height="46" border="0">
  66.                                 <tr>
  67.                                 <td width="50"><span class="Estilo2">
  68.                                 <label for="nombre">*</label></span>
  69.                                 <label for="nombre">Almacen: </label>
  70.                                 </td>
  71.                                 <td width="125">
  72.                                 <select name="cmbalmacen" id="cmbalmacen">
  73.                                 <option value="-">Seleccione</option>
  74.                                 <?
  75.                                 $c = new Conexion;
  76.                                 $c->Conectar();
  77.                                 $c = mysql_query("Select * from talmacen");
  78.                                 while($row=mysql_fetch_array($c))
  79.                                 {
  80.                                 ?> <option value="<?=$row['id_almacen']?>" <? if($row['id_almacen']==$lnalmacen){print "selected";}?>><? print $row['nombre'];?></option>
  81.                                
  82.                                 <? } @mysql_close($c) ?>
  83.                                 </select>
  84.                                 </td>
  85.                                 </tr>
  86.                                 <tr>
  87.                                 <td width="50"><span class="Estilo2">
  88.                                 <label for="nombre">*</label></span>
  89.                                 <label for="nombre">Nombre: </label>
  90.                                 </td>
  91.                                 <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);?>">
  92.                                 </td>
  93.                                 </tr>
  94.                                 <tr>
  95.                                 <td><span class="Estilo2">
  96.                                 <label for="nombre">*</label></span>
  97.                                 <label for="nombre">Tipo de Medicina: </label>
  98.                                 </td>
  99.                                 <td width="125">
  100.                                 <select id="cmbtipo" name="cmbtipo" >
  101.                                 <option value="-" >Seleccione</option>
  102.                                 <option value="D" <? if($lctipo=="D"){print "selected";}?>>Desparasitantes</option>
  103.                                 <option value="G" <? if($lctipo=="G"){print "selected";}?>>Medicina General</option>
  104.                                 <option value="V" <? if($lctipo=="V"){print "selected";}?>>Vacunas</option>
  105.                                 </select>
  106.                                 </td>
  107.                                 </tr>
  108.                                 <tr>
  109.                                 <td width="50"><span class="Estilo2">
  110.                                 <label for="nombre">*</label></span>
  111.                                 <label for="nombre">Indicaciones: </label>
  112.                                 </td>
  113.                                 <td width="125">
  114.                                 <textarea name="txtindicaciones" id="txtindicaciones" cols="25" rows="2"><? print $lcindicaciones;?></textarea>
  115.                                 </td>
  116.                                 </tr>
  117.                                 <tr>
  118.                                 <td width="50"><span class="Estilo2">
  119.                                 <label for="nombre">*</label></span>
  120.                                 <label for="nombre">Existencia: </label>
  121.                                 </td>
  122.                                 <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;?>">
  123.                                 </td>
  124.                                 </tr>
  125.                               </table>
  126.                             </li>
  127.                         </ol>
  128.                         </fieldset>
  129.                     <fieldset>
  130.                         <p>
  131.                         <table align="center" width="200" border="0">
  132.                           <tr>
  133.                             <td><div align="center">
  134.                               <input name="btnguardar" type="button" id="button" value="Guardar" onClick="guardar()"/>
  135.                             </div></td>
  136.                 <td><div align="center">
  137.                               <input name="btnsalir" type="button" id="btnsalir" value="Salir" onClick="location.href = 'medicina.php' "/>
  138.                             </div></td>
  139.                           </tr>
  140.                         </table>
  141.                           <br />
  142.                           <br />
  143.                         </p>
  144.                         <div align="center" class="Estilo1">"Los campos marcados con <span class="Estilo2">(*)</span> son campos obligatorios"</div>
  145.                     </fieldset>
  146.                     </form></p>
  147.         </section><br />
  148.     </article>
  149.     <footer>
  150.         <p>&copy; 2012 Universidad Politécnica Territorial de Portuguesa. Todos los derechos reservados.</p>
  151.     </footer>
  152. </body>
  153. <script language="javascript">
  154.  
  155.    function guardar()
  156.     {
  157.         f=document.form1;
  158.         f.txtoperacion.value="modificar";
  159.         f.txtnombre.disabled=false;
  160.         if (validar())
  161.         {
  162.             f.submit();
  163.         }
  164.     }
  165.    function validar()
  166.     {
  167.         f=document.form1;
  168.         bueno=false;
  169.         if(f.txtnombre.value=="")
  170.         {
  171.             alert("Debe ingresar el nombre de la medicina");
  172.             f.txtnombre.focus();
  173.         }
  174.         else if(f.cmbalmacen.value=="-")
  175.         {
  176.             alert("Debe seleccionar un almacen");
  177.             f.cmbalmacen.focus();
  178.         }
  179.         else if(f.txtindicaciones.value=="")
  180.         {
  181.             alert("Debe ingresar las indicaciones de la medicina");
  182.             f.txtindicaciones.focus();
  183.         }
  184.         else if(f.cmbtipo.value=="-")
  185.         {
  186.             alert("Debe seleccionar el tipo de medicamento");
  187.             f.cmbtipo.focus();
  188.         }
  189.         else if(f.txtexistencia.value=="")
  190.         {
  191.             alert("Debe ingresar una cantidad");
  192.             f.txtexistencia.focus();
  193.         }
  194.         else
  195.         {
  196.             bueno=true;
  197.         }
  198.         return bueno;
  199.     }//fin valida
  200. </script>
  201. </html>
  202. <? @mysql_close($C);?>