<?php
 
session_start();
$com = "C";
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>
<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('PUNTOVTA.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>


<?php

if ($_POST['bot']==""){
	echo '<h2>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=PV10000_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	
	include('PV10000_CL.php');
	$varible_clase = new clase();
	$res=$varible_clase->lista_busqueda($_POST["bot"]);
	$reg=mysqli_fetch_array($res);
	    $_REQUEST['afe_inv']=$reg['afe_inv'];
		$_REQUEST['cos_prom']=$reg['cos_prom'];
		$_REQUEST['cod_var']=$reg['cod_var'];
		$_REQUEST['fic_tec']=$reg['fic_tec'];
		$_REQUEST['num_pun']=$reg['num_pun'];		
		$_REQUEST['tip_pre']=$reg['tip_pre'];		
		$_REQUEST['per_mod']=$reg['per_mod'];
		$_REQUEST['por_des']=$reg['por_des'];
		$_REQUEST['afe_coman']=$reg['afe_coman'];
		$_REQUEST['cve_iva_ven']=$reg['cve_iva_ven'];
		}								
		?>

<form name="frm1" method="post" action="" enctype="multipart/form-data">
  <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="279"><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 dglineas 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 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>
      </tr>
      <tr>
        <td>IVA Venta:</td>
        <td colspan="3"><select name="cve_iva_ven" id="cve_iva_ven">
          <option value="1" <?php
 if (!(strcmp('1', $_REQUEST['cve_iva_ven']))) {echo "selected=\"selected\"";} ?>>SI</option>
          <option value="0" <?php
 if (!(strcmp('0', $_REQUEST['cve_iva_ven']))) {echo "selected=\"selected\"";} ?>>NO</option>
        </select></td>
        <td colspan="2">Afecta Comandera:        
          <select name="afe_coman" id="afe_coman">
            <option value="1" <?php
 if (!(strcmp('1', $_REQUEST['afe_coman']))) {echo "selected=\"selected\"";} ?>>SI</option>
            <option value="0" <?php
 if (!(strcmp('0', $_REQUEST['afe_coman']))) {echo "selected=\"selected\"";} ?>>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>
        <td>Desc Venta </td>
        <td colspan="3"><input name="des_cor" type="text" id="des_cor"></td>
        <td width="67">Num Receta: </td>
        <td><input name="id_receta" type="text" id="id_receta"
		   <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['id_receta'].'"';
		}
		?>
		  ></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/ptventa/NO_'. $reg["nparte1"] .'.JPG';
			if (file_exists($fotografia)) {
				echo '<img src="foto/ptventa/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>
    </table>
  </div>
  <div id="divArt" style="display:none">
  <table width="735"  align="center">
    <tr>
      <th colspan="8">ALMACEN</th>
    </tr>
    <tr>
      <td width="79">Cantidad Minima:</td>
      <td width="179"><input name="tap4" type="text"  tabindex="4"
	 <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['id_catprom'].'"';
		}
		?>
		  onBlur="may(this)"/></td>
      <td width="86">Cantidad Maxima:</td>
      <td width="196"><input name="tap5" type="text" tabindex="5"
		<?php

			if(isset($_POST['tap5'])){ 
				echo 'value="' . $_POST['tap5'] .  '"';
			}
		?>
		  onBlur="may(this)"/></td>
      <td width="45">Moneda:</td>
      <td colspan="3"><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>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><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>
      <input name="capacidad" type="text" id="capacidad" size="15"></td>
      <td>Marca:</td>
      <td colspan="3"><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>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['conc_iva'] .' </option>'; 
			}else{
				echo '<option value= "' . $dato['cve_iva'] . '">' .$dato['conc_iva'] .' </option>'; 
			}
		}
		?>
      </select></td>
      <td>Costo Promedio:</td>
      <td><input name="cos_prom" type="text" id="cos_prom" value="<? echo $_REQUEST['cos_prom'];?>"></td>
      <td colspan="4">&nbsp;</td>
    </tr>
  </table>
  </div>
  <div id="divNut" style="display:none">
   <table width="737"   align="center">
    <!--DWLayoutTable-->
    
    <tr>
      <th colspan="6"><label>VALORES NUTRICIONALES </label></th>
    </tr>
   
    <tr>
      <td width="130" height="29">Potasio:</td>
      <td width="164"><input name="potacio" type="text" class="agrega" id="potacio"  value="<? echo $_REQUEST['potacio'];?>" size="15"></td>
      <td width="113">Proteinas:</td>
      <td width="164"><input name="proteinas" type="text" class="agrega" id="proteinas"  value="<? echo $_REQUEST['proteinas'];?>" size="15"></td>
      <td width="107">Lipidos:</td>
      <td width="174"><input name="lipidos" type="text" class="agrega" id="lipidos" 
	   <?php
 
		if(isset($_POST['bot'])){
		echo 'value="'.$reg['lip'].'"';
		}
		?>
	   ></td>
    </tr>
    <tr>
      <td height="28">K Calorias: </td>
      <td><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>Carbohidratos:</td>
      <td><input name="carboidratos" type="text" class="agrega" id="carboidratos"  value="<? echo $_REQUEST['carboidratos'];?>" size="15"></td>
    </tr>
    <tr>
      <td>Sodio:</td>
      <td><input name="sodio" type="text" class="agrega" id="sodio"  value="<? echo $_REQUEST['sodio'];?>" size="15"></td>
      <td>Factor rendimiento:</td>
      <td><label>
        <input name="fac_rend" type="text" class="agrega" id="fac_rend" value="<? echo $_REQUEST['fac_rend'];?>" size="20">
      </label></td>
      <td>Temperatura:</td>
      <td><input name="temperatura" type="text" class="agrega" id="temperatura" value="<? echo $_REQUEST['temperatura'];?>" size="15"></td>
    </tr>
    <tr>
      <td>Dias almacen:</td>
      <td><span class="Estilo18">
        <input name="dias_alm" type="text" class="agrega" id="dias_alm" value="<? echo $_REQUEST['dias_alm'];?>" size="15">
      </span></td>
      <td>Casillero:</td>
      <td><input name="casillero" type="text" class="agrega" id="casillero" value="<? echo $_REQUEST['casillero'];?>" size="15"></td>
      <td><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    
    
	
	<tr>
	  <td colspan="6" nowrap bordercolor="#FFFFFF"><div align="center">
	   
      </div></td>
    </tr>
  </table>
  </div>
</form>
    <?php
 
if(isset($_POST['bot3'])){
	echo '<div align="center">
	<form id="form1" name="form1" action="PV10000_PR.php" target="_self">
		<input type="submit" name="submit" value="Regresar">
	</form>
	</div>';
	
}
mysqli_close($con);

?>
</body>
</html>





