<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");

?>
<html>
 <meta http-equiv="expires" content="1" >

<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<?php

if ($_POST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=DI21100_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	if(!isset($_POST['tap1'])){
		include('RC10000_CL.php');
		$varible_clase = new clase();
		$res=$varible_clase->lista_busqueda($_POST["bot"]);
		$reg=mysqli_fetch_array($res);
		$_REQUEST['es_inv']=$reg['es_inv'];
		$_REQUEST['cos_prom']=$reg['cos_prom'];
		$_REQUEST['cod_var']=$reg['cod_var'];
		$_REQUEST['fic_tec']=$reg['fic_tec'];
		$_REQUEST['casillero']=$reg['casillero'];
		$_REQUEST['cos_prom']=$reg['cos_prom'];
		$_REQUEST['dias_alm']=$reg['dias_alm'];
		$_REQUEST['fac_rend']=$reg['fac_rend'];
		$_REQUEST['fact_min']=$reg['fact_min'];
		$_REQUEST['fact_max']=$reg['fact_max'];
		$_REQUEST['linea']=$dato['linea']; 
		$_REQUEST['des_linea']=$dato['des_linea'];
	}
?>

<body>
<form name="frm1" id="frm1" method="post" action="" 
enctype="multipart/form-data">
<input type="hidden" name="bot" id="bot" value="<? echo $_POST['bot'];?>">
  <table width="767"  align="center">
    <tr>
      <th colspan="6" class=\"titulo\"><div align="center">MODIFICAR   PRODUCTO </div></th>
    </tr>
    <tr>
      <td width="87" nowrap>Clave de producto: </td>
      <td width="146" nowrap>
        <input name="tap1" type="text" class="agrega" tabindex="1"
		  onBlur="may(this)" size="15"
		<?php

			if(isset($_POST['bot'])){
				echo 'value="' . htmlentities($reg['nparte1']) .  '"';
			}elseif(isset($_POST['tap1'])){ 
				echo 'value="' . $_POST['tap1'] .  '"';
			}
		?>/>     </td>
      <td width="102" nowrap>Descripcion:</td>
      <td width="146" nowrap><input name="tap2" type="text" class="agrega" tabindex="2"
		  onBlur="may(this)" size="20"
		<?php

		if(isset($_POST['bot'])){
			echo 'value="' . htmlentities($reg['np_desc1']) .  '"';
		}elseif(isset($_POST['tap2'])){ 
			echo 'value="' . $_POST['tap2'] .  '"';
		}
		?>></td>
      <td width="80" nowrap>Precio:</td>
      <td width="146" nowrap><span class="Estilo19">$
        <input name="precio" type="text" id="precio" tabindex="10" size="15"
		 <?php

		if(isset($_POST['bot'])){
				echo 'value="' . $reg['precio'] .  '"';
		}elseif(isset($_POST['precio'])){ 
				echo 'value="' . $_POST['precio'] .  '"';
			}
		?>
		>
      </span></td>
    </tr>
    
    <tr>
      <td nowrap>Cantidad Minima:</td>
      <td nowrap><input name="tap4" type="text"  tabindex="4"
		  onBlur="may(this)" size="20"
	  <?php

		if(isset($_POST['bot'])){
				echo 'value="' . $reg['exi_min'] .  '"';
		}elseif(isset($_POST['tap4'])){ 
				echo 'value="' . $_POST['tap4'] .  '"';
			}
		?>/></td>
      <td nowrap>Cantidad Maxima:</td>
      <td nowrap><input name="tap5" type="text" tabindex="5"
		  onBlur="may(this)" size="20"
		<?php

			if(isset($_POST['bot'])){
				echo 'value="' . $reg['exi_max'] .  '"';
		}elseif(isset($_POST['tap5'])){ 
				echo 'value="' . $_POST['tap5'] .  '"';
			}
		?>/></td>
      <td nowrap>Inventariado:
      <label></label></td>
      <td nowrap><select name="es_inv" id="es_inv">
        <option value="1" <?php
 if (!(strcmp(1, "$_REQUEST['es_inv']"))) {echo "selected=\"selected\"";} ?>>SI</option>
        <option value="0" <?php
 if (!(strcmp(0, "$_REQUEST['es_inv']"))) {echo "selected=\"selected\"";} ?>>NO</option>
      </select></td>
    </tr>
    <tr>
      <td nowrap>Grupo:</td>
      <td nowrap><select name="tap7"  tabindex="7"  onChange="javascript: document.getElementById('frm1').submit()">
        <option></option>
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dgbasico ORDER BY des_basico");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($_POST['tap7']==$dato['gpo_basico'] or $dato['gpo_basico'] == $reg['gpo_basico']){
				echo '<option value= "' . $dato['gpo_basico'] . '" selected>' .$dato['des_basico'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['gpo_basico'] . '">' .$dato['des_basico'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td nowrap>Almacen:</td>
      <td nowrap><select name="tap6" tabindex="6">
        <option></option>
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dglineas ORDER BY des_linea");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($_REQUEST['tap6']==$dato['linea'] or $dato['linea'] == $reg['linea']){
				echo '<option value= "' . $dato['linea'] . '" selected>' .$dato['des_linea'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['linea'] . '">' .$dato['des_linea'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td nowrap>Marca:</td>
      <td nowrap><select name="tap8" tabindex="8">
        <option></option>
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dxmarcas ORDER BY des_marca");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($_POST['tap8']==$dato['cve_marca'] or $dato['cve_marca'] == $reg['cve_marca']){
				echo '<option value= "' . $dato['cve_marca'] . '" selected>' .$dato['des_marca'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['cve_marca'] . '">' .$dato['des_marca'] .' </option>'; 
			}
		}
		?>
      </select></td>
    </tr>
    <tr>
      <td nowrap>Unidad de Compra:</td>
      <td nowrap><select name="tap14" tabindex="14">
        <option></option>
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dggrupos ORDER BY des_uni");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($dato['cve_uni']==$_POST['tap14'] or $dato['cve_uni'] == $reg['cve_uni_com']){
				echo '<option value= "' . $dato['cve_uni'] . '" selected>' . $dato['des_uni'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['cve_uni'] . '">' . $dato['des_uni'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td nowrap>Capacidad:</td>
      <td nowrap><input name="capacidad" type="text" id="capacidad" size="15"
	  <?php

		if(isset($_POST['bot'])){
				echo 'value="' . $reg['capacidad'] .  '"';
		}elseif(isset($_POST['tap4'])){ 
				echo 'value="' . $_POST['capacidad'] .  '"';
			}
		?>
	  >
      <select name="tap15" tabindex="15">
        <option></option>
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dggrupos ORDER BY des_uni");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($_POST['tap15']==$dato['cve_uni'] or $dato['cve_uni'] == $reg['cve_uni_vta']){
				echo '<option value= "' . $dato['cve_uni'] . '" selected>' .$dato['des_uni'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['cve_uni'] . '">' . $dato['des_uni'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td nowrap>Afectar Invenatario:</td>
      <td nowrap><select name="tap16" tabindex="16">
        <?php
 
		if($_POST['tap16']=='S' or $reg['afe_inv'] == 'S'){
			echo '<option value="S" selected>SI</option>';
		}else{
			echo '<option value="S">SI</option>';
		}
		if($_POST['tap16']=='N' or $reg['afe_inv'] == 'N'){
			echo '<option value="N" selected>NO</option>';
		}else{
			echo '<option value="N">NO</option>';
		}
		?>
      </select></td>
    </tr>
    <tr>
      <td nowrap>Controlar N&ordm; de serie:</td>
      <td nowrap><select name="tap17" tabindex="17">
        <?php
 
		if($_POST['tap16']==0 or $reg['cont_nser'] == 0){
			echo '<option value="0" selected>NO</option>';
		}else{
			echo '<option value="0">NO</option>';
		}
		if($_POST['tap16']==1 or $reg['cont_nser'] == 1){
			echo '<option value="1" selected>SI</option>';
		}else{
			echo '<option value="1">SI</option>';
		}
		?>
      </select></td>
      <td nowrap>Iva:</td>
      <td nowrap><select name="tap9" tabindex="9" >
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dxtasiva ORDER BY cve_iva");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($_POST['tap9']==$dato['cve_iva'] or $dato['cve_iva'] == $reg['cve_iva']){
				echo '<option value= "' . $dato['cve_iva'] . '" selected>' .$dato['conc_iva'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['cve_iva'] . '">' . $dato['conc_iva'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td nowrap>Moneda:</td>
      <td nowrap><select name="tap18" tabindex="18">
        <?php
 
		if(($_POST['tap18']==1 or $reg['tip_mon'] == 1) || ($_POST['tap18']=='N' or $reg['tip_mon'] == 'N')){
			echo '<option value="1" selected>NACIONAL</option>';
		}else{
			echo '<option value="1">NACIONAL</option>';
		}
		if(($_POST['tap18']==2 or $reg['tip_mon'] == 2)|| ($_POST['tap18']=='E' or $reg['tip_mon'] == 'E')){
			echo '<option value="2" selected>EXTRANJERA</option>';
		}else{
			echo '<option value="2">EXTRANJERA</option>';
		}
		?>
      </select></td>
    </tr>
    <tr>
      <td nowrap style="#5F84B1">&nbsp;</td>
      <td nowrap style="#5F84B1"><span class="Estilo18">Maximo
          <input name="fact_max" type="text" id="fact_max" value="<? echo $_REQUEST['fact_max'];?>" size="10">
      </span></td>
      <td nowrap style="#5F84B1"><span class="Estilo18">Minimo </span> <span class="Estilo18">
      <input name="fact_min" type="text" id="fact_min" value="<? echo $_REQUEST['fact_min'];?>" size="10">
      </span>
      <td nowrap style="#5F84B1"><span class="Estilo18">Dias almacen:
          <input name="dias_alm" type="text" id="dias_alm" value="<? echo $_REQUEST['dias_alm'];?>" size="7">
      </span></td>
      <td nowrap style="#5F84B1"><span class="Estilo18">Costo Promedio:</span></td>
      <td nowrap style="#5F84B1"><input name="cos_prom" type="text" id="cos_prom" value="<? echo $_REQUEST['cos_prom'];?>" size="15"></td>
    </tr>
    <tr>
      <td nowrap style="#5F84B1"><span class="Estilo18">Casillero</span></td>
      <td nowrap style="#5F84B1"><input name="casillero" type="text" id="casillero" value="<? echo $_REQUEST['casillero'];?>" size="10"></td>
      <td nowrap style="#5F84B1"><span class="Estilo18">Temperatura:</span></td>
      <td nowrap style="#5F84B1"><input name="temperatura" type="text" id="temperatura" size="7"
	   <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['temperatura'] .  '"';
		}
		?>
	  ></td>
      <td nowrap style="#5F84B1"><span class="Estilo18">Factor rendimiento:</span></td>
      <td nowrap style="#5F84B1"><input name="fac_rend" type="text" class="agrega" id="fac_rend" value="<? echo $_REQUEST['fac_rend'];?>" size="20"></td>
    </tr>
    <tr>
      <th colspan="4" nowrap>VALORES NUTICIONALES </th>
      <td nowrap>Potacio:</td>
      <td nowrap><input name="potacio" type="text" class="agrega" id="potacio" size="15"
	    <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['potacio'] .  '"';
		}
		?>
	  ></td>
    </tr>
    <tr>
      <td nowrap>Proteinas:</td>
      <td nowrap><input name="proteinas" type="text" class="agrega" id="proteinas" size="15"
	  <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['proteinas'] .  '"';
		}
		?>
	  ></td>
      <td nowrap>Lipidos:</td>
      <td nowrap><input name="lipidos" type="text" class="agrega" id="lipidos" size="15"
	  <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['lipidos'] .  '"';
		}
		?>
	  ></td>
      <td nowrap>Carboidratos:</td>
      <td nowrap><input name="carboidratos" type="text" class="agrega" id="carboidratos" size="15"
	  <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['carboidratos'] .  '"';
		}
		?>
	  ></td>
    </tr>
    <tr>
      <td nowrap>K Calorias: </td>
      <td nowrap><label>
        <input name="kcalorias" type="text" class="agrega" id="kcalorias" size="15"
		<?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['kcalorias'] .  '"';
		}
		?>
		>
      </label></td>
      <td nowrap><label>Calcio:</label></td>
      <td nowrap><input name="calcio" type="text" class="agrega" id="calcio" size="15"
	  <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['calcio'] .  '"';
		}
		?>
	  ></td>
      <td nowrap>Sodio:</td>
      <td nowrap><input name="sodio" type="text" class="agrega" id="sodio" size="15"
	  <?php
 
		if(isset($_POST['bot'])){
				echo 'value="' . $reg['sodio'] .  '"';
		}
		?>
	  ></td>
    </tr>
	<tr>
	  <td colspan="6" nowrap bordercolor="#FFFFFF" style="#CCCCCC"><div align="center" class="Estilo2">Ficha Tecnica </div></td>
    </tr>
	<tr>
	  <td nowrap bordercolor="#FFFFFF" style="#5F84B1" class="Estilo4 Estilo5">Codigo Barras: </td>
	  <td colspan="2" nowrap bordercolor="#FFFFFF" style="#FDFDFD"><input name="cod_var" type="text" id="cod_var" value="<? echo $_REQUEST['cod_var'];?>" size="40"></td>
	  <td colspan="3" rowspan="2" nowrap bordercolor="#FFFFFF" style="#5F84B1"><input type="checkbox" name="ac" value="1" onClick="act_fichero(ac.checked)">
      <input name="fichero" type="file" disabled="disabled" size="10" >
        <div align="center" id="capa">
          <?php

			$fotografia = 'foto/dginvent/NO_'. $reg["nparte1"] .'.JPG';
			if (file_exists($fotografia)) {
				echo '<img src="foto/dginvent/NO_'.$reg["nparte1"].'.JPG" width="150" height="175">';
			}else{
				echo '<img src="foto/sin_producto.jpg" width="150" height="175">';
			}
		  ?>
        </div></td>
    </tr>
	<tr>
	  <td colspan="3" nowrap bordercolor="#FFFFFF" style="#5F84B1">
      <textarea name="fic_tec" cols="50" rows="9" id="fic_tec"><? echo $_REQUEST['fic_tec'];?></textarea>	  </td>
    </tr>
	<tr>
	  <td colspan="6" nowrap bordercolor="#FFFFFF"><div align="center">
	    <input name="Submit22" type="Button" onClick="openpage('RC10000_MC.php','_self')" value="Guardar">
	    <input type="Button" name="Submit2" value="Regresar" onClick="envia1('RC10000_PR.php','_self')">
      </div></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
<?php
 
}
?>
</body>
</html>
<?php
 mysqli_close($con);?>
