<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
require_once("DFJQUERY.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<?php

if ($_REQUEST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=cat_platillos_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	if(!isset($_REQUEST['tap2'])){
		include('cat_platillos_CL.php');
		$varible_clase = new clase();
		$res=$varible_clase->lista_busqueda($_REQUEST["bot"]);
		$reg=mysqli_fetch_array($res);
		$_REQUEST['id_pro']=$reg['id_pro'];
		$_REQUEST['tap2']=$reg['np_desc1'];
		$_REQUEST['precio']=$reg['lim_vta1'];
		$_REQUEST['afec_inv']=$reg['afe_inv'];
		$_REQUEST['cve_iva_ven']=$reg['cve_iva_ven'];
		$_REQUEST['afe_coman']=$reg['afe_coman'];
		$_REQUEST['select']=$reg['linea'];
		$_REQUEST['select2']=$reg['gpo_basico'];
		$_REQUEST['tap4']=$reg['exi_min'];
		$_REQUEST['tap5']=$reg['exi_max'];
		$_REQUEST['tap18']=$reg['tip_mon'];
		$_REQUEST['tap14']=$reg['cve_uni_com'];
		$_REQUEST['capacidad']=$reg['capacidad'];
		$_REQUEST['tap15']=$reg['cve_uni_vta'];
		$_REQUEST['tap8']=$reg['cve_marca'];
		$_REQUEST['tap9']=$reg['cve_iva'];
		$_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['potacio']=$reg['potacio'];
		//$_REQUEST['proteinas']=$reg['proteinas'];
		//$_REQUEST['lipidos']=$reg['lipidos'];
		//$_REQUEST['kcalorias']=$reg['kcalorias'];
		//$_REQUEST['calcio']=$reg['calcio'];
		//$_REQUEST['carboidratos']=$reg['carboidratos'];
		//$_REQUEST['sodio']=$reg['sodio'];
		//$_REQUEST['fac_rend']=$reg['fac_rend'];
		//$_REQUEST['temperatura']=$reg['temperatura'];
		//$_REQUEST['dias_alm']=$reg['dias_alm'];
		$_REQUEST['casillero']=$reg['casillero'];
	}
?>
<style type="text/css">
<!--
.Estilo4 {
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
	font-weight: bold;
}
.Estilo5 {font-size: 12px}
.Estilo18 {color: #FFFFFF}
.Estilo19 {font-size: 16px}
.Estilo20 {color: #FFFFFF; font-weight: bold; }
-->
</style>
<script language="javascript">
$(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
	$("#tap2").autocomplete('DYAUTPROD.php',{
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		//max:3                        //maximo de resultados mostrados, se manda como limit en autosugestion
		delay: 200,                  //Retardo de autocompletar 
		width: 500,                  //ancho del cuadro de despliegue
		highlight: false,            //Resalta letras coincidentes
		autoFill: false,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 300,           //alto del cuadro para el scroll
		formatItem:formatItem,	     //formato de presentacion de las posibles busquedas
		extraParams:{tipBus:'d'}     //Parametros Extra a Mandar en autosugestion
	});
});
</script>

<script language="javascript">
function ocultaMuestra(divVent){
	if(divVent.style.display=='none'){
		divVent.style.display='';

	}else{
		divVent.style.display='none';

	}
}	
	</script>
	
	
<body>

<form name="frm1" method="post" action="" enctype="multipart/form-data">
<input name="bot" type="hidden" value="<?php
 echo $_POST['bot'];?>"> 
  <table width="735"  align="center">
    <tr>
      <th colspan="4">ARTICULOS</th>
    </tr>
    <tr>
      <td width="150">Descripcion.</td>
      <td width="867" colspan="3"><input name="tap2" id="tap2" type="text" tabindex="2"
		  onBlur="may(this)" size="60"
		 <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['np_desc1'].'"';
		}
		?>></td>
    </tr>
  </table>
  <div id="divVent" style="display:">
    <table width="735"  align="center"  >
      <tr>
        <th colspan="7">VENTA</th>
      </tr>
      <tr>
        <td width="80">Precio:</td>
        <td width="245"><span class="Estilo19">$ </span><span class="Estilo19">
          <input name="precio" type="text" id="precio" size="15"
		  <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['lim_vta1'].'"';
		}
		?>
		
		>
        </span></td>
        <td colspan="3">Precio Compra: </td>
        <td width="311"><label><input name="cos_pro" type="text" id="cos_pro"
		  <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['cos_prom'].'"';
		}
		?>
		>
        </label></td>
      </tr>
      <tr>
        <td>Linea:</td>
        <td colspan="3"><select name="tap6" tabindex="6">
	  <option></option>
         <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dglineasp ORDER BY des_linea");
		while($dato = mysqli_fetch_array ($result) ){ 
			if($_POST['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 colspan="2">Grupo: 
          <select name="tap7"  tabindex="7"  onChange="javascript: document.getElementById('frm1').submit()">
		<option></option>
        <?php
 
		 $result = mysqli_query($con ,"SELECT * FROM dgbasicop 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>
      </tr>
      <tr>
        <td>IVA Venta:</td>
        <td colspan="3"><select name="cve_iva_ven" id="cve_iva_ven">
            <option>SI</option>
            <option>NO</option>
        </select></td>
        <td colspan="2">Afecta Comandera:
          <select name="afe_coman" id="afe_coman" tabindex="16">
              <?php
 
		if($_POST['afe_coman']==1){
			echo '<option value="S" selected>SI</option>';
		}else{
			echo '<option value="S">SI</option>';
		}
		if($_POST['afe_coman']==0){
			echo '<option value="N">NO</option>';
		}else{
			echo '<option value="N">NO</option>';
		}
		?>
          </select></td>
      </tr>
      <tr>
        <td>Codigo de Barras: </td>
        <td colspan="3"><span class="Estilo4 Estilo5">
          <input name="cod_var" type="text" id="cod_var"size="40"
		   <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['cod_var'].'"';
		}
		?>
		  >
        </span></td>
        <td colspan="2">Afecta Inventario:
		  <select name="afec_inv" id="afec_inv">
            <option value="S" <?php
 if (!(strcmp('S', "$_REQUEST['afe_inv']"))) {echo "selected=\"selected\"";} ?>>ALMACEN</option>
            <option value="R" <?php
 if (!(strcmp('R', "$_REQUEST['afe_inv']"))) {echo "selected=\"selected\"";} ?>>RECETAS</option>
            <option value="N" <?php
 if (!(strcmp('N', "$_REQUEST['afe_inv']"))) {echo "selected=\"selected\"";} ?>>NINGUNO</option>
          </select></td>
      </tr>
      <tr>
        <th height="19" colspan="4" style="#5F84B1"><div align="center" class="Estilo20">FICHA TECNICA </div></th>
        <td colspan="2" rowspan="2" 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 height="45" colspan="4" style="#5F84B1"><textarea name="fic_tec" cols="40" rows="6" id="fic_tec"><? echo $_REQUEST['fic_tec'];?></textarea>        </td>
      </tr>
      <tr>
        <td height="29" colspan="6">
          <div align="center">
            <input type="button" name="bot1" value="Eliminar" onClick="openpage('cat_platillos_EC.php','_self')"/>
            <input type="button" name="bot4" value="Regresar" onClick="openpage('cat_platillos_PR.php','_self')"/>
        </div></td>
      </tr>
    </table>
  </div>
  <div id="divArt" style="display:none">
</form>
    <?php
 
if(isset($_POST['bot3'])){
	echo '<div align="center"
<?php
 mysqli_close($con);?>>
	<form id="form1" name="form1" action="cat_platillos_PR.php" target="_self">
		<input type="submit" name="submit" value="Regresar">
	</form>
	</div>';
	
}
?>
 <?php
 
}
?>
</body>
</html>
<?php
 mysqli_close($con);?>

</body>
</html>
<?php
 mysqli_close($con);?>
