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

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

<body>
<?php
 
$ayuda = 'DI2110A_AG.php';
include("DYAYUDA.php");
?>
<form name="frm1" method="post" action="" enctype="multipart/form-data">
  <table width="915"   align="center">
    <!--DWLayoutTable-->
    <tr>
      <th colspan="6" class=\"titulo\"><div align="center">AGREGAR ARTICULO  </div></th>
    </tr>
    <tr>
      <td width="116">Clave de producto: </td>
      <td width="146">
        <input name="tap1" type="text" class="busquetd" tabindex="1"
		  onBlur="may(this)" size="15"
		<?php

			if(isset($_POST['tap1'])){ 
				echo 'value="' . $_POST['tap1'] .  '"';
			}
		?>/>     </td>
      <td width="84">Descripcion:</td>
      <td width="146"><input name="tap2" type="text" class="busquetd" tabindex="2"
		  onBlur="may(this)"
		<?php

			if(isset($_POST['tap2'])){ 
				echo 'value="' . $_POST['tap2'] .  '"';
			}
		?>></td>
      <td width="95">Precio:</td>
      <td width="146"><label><span class="Estilo19">$
        <input name="precio" type="text" id="precio" size="15"
		<?php

			if(isset($_POST['precio'])){ 
				echo 'value="' . $_POST['precio'] .  '"';
			}
		?>
		
		>
      </span></label></td>
    </tr>
   
    <tr>
      <td height="29">Cantidad Minima:</td>
      <td><input name="tap4" type="text"  tabindex="4"
	  <?php

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

			if(isset($_POST['tap5'])){ 
				echo 'value="' . $_POST['tap5'] .  '"';
			}
		?>
		  onBlur="may(this)"/></td>
      <td>Inventariado:</td>
      <td><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>Grupo:</td>
      <td><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']){
				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>Almacen:</td>
      <td><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($_POST['tap6']==$dato['linea']){
				echo '<option value= "' . $dato['linea'] . '" selected>' .$dato['des_linea'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['linea'] . '">' .$dato['des_linea'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td>Marca:</td>
      <td><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']){
				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>Unidad medida:</td>
      <td><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']){
				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>Capacidad:</td>
      <td><label>
      <input name="capacidad" type="text" id="capacidad" size="15">
      </label>
      <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']){
				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>Afectar Inventario:</td>
      <td><select name="tap16" tabindex="16">
        <?php
 
		if($_POST['tap16']==1){
			echo '<option value="S" selected>SI</option>';
		}else{
			echo '<option value="S">SI</option>';
		}
		if($_POST['tap16']==0){
			echo '<option value="N">NO</option>';
		}else{
			echo '<option value="N">NO</option>';
		}
		?>
      </select></td>
    </tr>
    <tr>
      <td>Controlar N&ordm; de serie: </td>
      <td><select name="tap17" tabindex="17">
        <?php

		if($_REQUEST['tap16']=='0' || !isset($_REQUEST['tap16'])){
			echo '<option value="0" selected>NO</option>';
		}else{
			echo '<option value="0">NO</option>';
		}
		if($_REQUEST['tap16']=='1'){
			echo '<option value="1" selected>SI</option>';
		}else{
			echo '<option value="1">SI</option>';
		}
		?>
      </select></td>
      <td>Iva:</td>
      <td><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']){
				echo '<option value= "' . $dato['cve_iva'] . '" selected>' . $dato['cve_iva'] . '  ' .$dato['conc_iva'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['cve_iva'] . '">' . $dato['cve_iva'] . '  ' .$dato['conc_iva'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td>Moneda:</td>
      <td><select name="tap18" tabindex="18">
        <?php
 
		if($_POST['tap18']==1){
			echo '<option value="1">NACIONAL</option>';
		}else{
			echo '<option value="1">NACIONAL</option>';
		}
		if($_POST['tap18']==2){
			echo '<option value="2" selected>EXTRANJERA</option>';
		}else{
			echo '<option value="2">EXTRANJERA</option>';
		}
		?>
      </select></td>
    </tr>
    <tr>
      <td style="#5F84B1"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td 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 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 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 style="#5F84B1"><span class="Estilo18">Costo Promedio:</span></td>
      <td style="#5F84B1"><input name="cos_prom" type="text" id="cos_prom" value="<? echo $_REQUEST['cos_prom'];?>"></td>
    </tr>
    <tr>
      <td style="#5F84B1"><span class="Estilo18">Casillero</span></td>
      <td style="#5F84B1"><input name="casillero" type="text" id="casillero" value="<? echo $_REQUEST['casillero'];?>" size="10"></td>
      <td style="#5F84B1"><span class="Estilo18">Temperatura:</span></td>
      <td style="#5F84B1"><input name="temperatura" type="text" id="temperatura" value="<? echo $_REQUEST['temperatura'];?>" size="7"></td>
      <td style="#5F84B1"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td style="#5F84B1"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr>
      <th colspan="4"><label></label>        <label>
        <div align="center">VALORES NUTICIONALES </div>
      </label></th>
      <td>Potacio:</td>
      <td><label>
        <input name="potacio" type="text" class="agrega" id="potacio"  value="<? echo $_REQUEST['potacio'];?>" size="15">
      </label></td>
    </tr>
	<tr>
	  <td>Proteinas:</td>
	  <td><label>
	    <input name="proteinas" type="text" class="agrega" id="proteinas"  value="<? echo $_REQUEST['proteinas'];?>" size="15">
	  </label></td>
	  <td>Lipidos:</td>
	  <td><label>
	    <input name="lipidos" type="text" class="agrega" id="lipidos"  value="<? echo $_REQUEST['lipidos'];?>" size="15">
	  </label></td>
	  <td>Carboidratos:</td>
	  <td><label>
	    <input name="carboidratos" type="text" class="agrega" id="carboidratos"  value="<? echo $_REQUEST['carboidratos'];?>" size="15">
	  </label></td>
    </tr>
	<tr>
	  <td>K Calorias: </td>
	  <td valign="top"><input name="kcalorias" type="text" class="agrega" id="kcalorias"  value="<? echo $_REQUEST['kcalorias'];?>" size="15"></td>
	  <td>Calcio:</td>
      <td><input name="calcio" type="text" class="agrega" id="calcio"  value="<? echo $_REQUEST['calcio'];?>" size="15"></td>
      <td>Sodio:</td>
      <td><input name="sodio" type="text" class="agrega" id="sodio"  value="<? echo $_REQUEST['sodio'];?>" size="15"></td>
	</tr>
	
	<tr>
	  <td height="29" colspan="4" style="#5F84B1"><span class="Estilo4 Estilo5">Codigo Barras: 
	    <input name="cod_var" type="text" id="cod_var" value="<? echo $_REQUEST['cod_var'];?>" size="40">
	  </span></td>
	  <td style="#5F84B1"><span class="Estilo18">Factor rendimiento:</span></td>
	  <td style="#5F84B1"><label>
	    <input name="fac_rend" type="text" class="agrega" id="fac_rend" value="<? echo $_REQUEST['fac_rend'];?>" size="20">
	  </label></td>
    </tr>
	<tr>
	  <td colspan="6" nowrap bordercolor="#FFFFFF" style="#CCCCCC"><div align="center" class="Estilo3">Ficha Tecnica</div></td>
    </tr>
	<tr>
	  <td colspan="3" nowrap bordercolor="#FFFFFF" style="#5F84B1" class="Estilo4 Estilo5">
        <textarea name="fic_tec" cols="50" rows="9" id="fic_tec"><? echo $_REQUEST['fic_tec'];?></textarea>	  </td>
	  <td colspan="3" 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="20" >
        <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="150">';
			}else{
				echo '<img src="foto/sin_producto.jpg" width="150" height="150">';
			}
		  ?>
        </div></td>
    </tr>
	
	<tr>
	  <td colspan="6" nowrap bordercolor="#FFFFFF"><div align="center">
	    <input name="Submit22" type="Button" onClick="openpage('RC10000_AC.php','_self')" value="Guardar">
	    <input type="Button" name="Submit2" value="Regresar" onClick="envia1('RC10000_PR.php','_self')">
      </div></td>
    </tr>
  </table>
</form>
</body>
</html>
<?php
 mysqli_close($con);?>
