<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
if(vbval($_SESSION['SYS_USER_GI'])!=USU_GET_GI($_SESSION['SYS_USER_ID'])){
	JsDir("cerrar.php");	
	return;
}
//
$StrGT="";	
$LStrMsg="";
$LStrFoc="";
$LStrMM="";
$VP_RegXPag=15;
$LStrPag=V($_POST['TxtPag']);
$LStrTR=gn("count(*)","vproductos","");
include("productos_proc.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Productos</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<script type="text/javascript" src="fe/productos.js"></script>
<style type="text/css">
<!--
body {
background-color: #999;
}
#Layer1 {position:absolute;left:345px;top:115px;width:123px;height:35px;z-index:1;
}
.centrarFrm{
width:900px;
height:700px;
position:absolute;
left:<?php echo "50%";?>;
top:<?php echo "50%";?>;
background-color:#006699;
margin:<?php echo "-350px";?> 0 0 <?php echo "-450px";?>;
}
#Layer2 {
position:absolute;
left:409px;
top:205px;
width:82px;
height:24px;
z-index:1;
}
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFFFFF;
}
.f2 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
.Estilo3 {color: #FFFFFF; font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.s4 {color: #000099}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
color: #900;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="productos.php">
<center> 
<div Id="DivFRM"  class="centrarFrm" >
<div id="layer5" style="position:absolute; left: 31px; top: 157px; width: 70px;">
<div align="left" class="f2">CODIGO</div>
</div>
<div id="layer4" style="position:absolute; left: 31px; top: 85px; width: 630px; height: 26px;">
<div align="left" class="f2">
<input name="CmdB" type="button" id="CmdG"
<?php
if(strlen($StrId)==0){
echo "value=\"Guardar\"";
}else{
echo "value=\"Modificar\"";
}
?>
onclick="fGuardar();" style="width:80px" tabindex="2"/>
<input name="CmdB" type="button" id="CmdC" value="Nuevo" 
onclick="fCancelar();"  tabindex="3"/>
<input name="CmdB" type="button" id="CmdE" value="Eliminar" 
onclick="fEliminar();"
<?php
if(strlen($StrId)==0){
echo "disabled=\"disabled\"";
}
?>
tabindex="4"/>
<input name="CmdB" type="button" id="CmdB" 
value="Buscar" onclick="fBuscar('productoz_buscar.php?CmdB=CallBack');"  tabindex="3"/>
<input name="CmdB" type="button" id="CmdB" 
value="Ver stock general" onclick="fBuscar('stockgeneral.php?CmdB=CallBack');"  tabindex="3"/>
<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="3"/>
</div>
</div>
<div id="layer3" style="position:absolute; left: 30px; top: 340px; width: 838px; height: 346px; overflow:auto">
<div align="left" class="f2">
<table width="822" height="40" border="1" cellpadding="0" cellspacing="0">

<tr>
<td height="18" colspan="5" bgcolor="#666666" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>

<tr>
<td width="173" height="17" bgcolor="#999999"><span class="s4">CODIGO</span></td>
<td width="176" bgcolor="#999999"><span class="s4">LINEA</span></td>
<td width="462" bgcolor="#999999"><span class="s4">DESCRIPCION</span></td>
<td width="27" bgcolor="#999999">&nbsp;</td>
</tr>

<?php	
$s="SELECT ID,COD,LINEA,DESCRIPCION,MARCA FROM vproductos
WHERE ID> 0 ORDER BY DESCRIPCION";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);	  				
$result = grs($s);
$YY="<td bgcolor=\"#FFFFFF\"><span class=\"s4\">";
$ZZ="</span></td>";
while ($row = $result->fetch_row()){
echo "<tr ondblclick=\"fActivar($row[0]);\">";
echo $YY.VV($row[1]).$ZZ;
echo $YY.VV($row[2]).$ZZ;
echo $YY.VV(vbmid($row[3],1,35)).$ZZ;	  
echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
<a href=\"javascript:void(0)\" onclick=\"fActivar($row[0]);\">
<img src=\"img/b_edit.png\"  border=\"0\"/>
</a>
</td>";
echo "</tr>";
}

?>		  


</table>
</div>
</div>
<div id="layer" style="position:absolute; left: 121px; top: 21px; width: 412px; height: 45px; z-index: 100;">
<div align="left" class="Estilo1">
<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<strong>PRODUCTOS</strong></div>
</div>
<input name="TxtCod" type="text" id="TxtCod" style="position:absolute; left: 31px; top: 177px; width: 174px;" 
value="<?php echo $StrCod;?>"  
onKeyDown="return SoloTextoEx(event,'CboLin');" 
tabindex="1" />

<div id="LblTit" style="position:absolute; left: 54px; top: 15px; width: 64px; z-index: 100;">
<div align="left" class="Estilo1"><img src="img/productos.png" width="60" height="57" /></div>
</div>
<input name="TxtDes" type="text" id="TxtDes" style="position:absolute; left: 408px; top: 177px; width: 460px;" 
value="<?php echo $StrDes;?>"   
onkeydown="return SoloTextoEx(event,'TxtPcS');" tabindex="3" />

<div id="layer7" style="position:absolute; left: 409px; top: 157px; width: 202px;">
<div align="left" class="f2">DESCRIPCION / NOMBRE</div>
</div>
<div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 900px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
<div align="left" class="Estilo1">
<input name="TxtId2" type="hidden" id="TxtId2" value="<?php echo $StrId;?>"/>
<input name="TxtAc2" type="hidden" id="TxtAc2" value="" />
<input name="TxtPag2" type="hidden" id="TxtPag2" value="<?php echo $LStrPag; ?>" />
</div>
</div>
<div id="layer9" style="position:absolute; left: 222px; top: 157px; width: 144px;">
<div align="left" class="f2">LINEA DE PRODUCTO</div>
</div>
<select name="CboLin" id="CboLin" 
style="position:absolute; left: 222px; top: 177px; width: 171px;"  tabindex="2"
onKeyDown="return SoloTextoEx(event,'TxtDes');">
<?php
$s="SELECT lin_nombre FROM lineas WHERE id_linea>= 0 ORDER BY lin_nombre";
$result = grs($s);
while ($row = $result->fetch_row()){
if($StrLin==$row[0]){
echo "<option value=\"$row[0]\" selected=\"selected\">$row[0]</option>";
}else{
echo "<option value=\"$row[0]\" >$row[0]</option>";
}
}
?>         
</select>
<input name="TxtPcS" type="text" id="TxtPcS" style="position:absolute; left: 31px; top: 241px; width: 67px; text-align:right" 
value="<?php echo $StrPcS;?>"   
onkeydown="return SoloNum(this,event,'TxtPvMin');"
onkeyup="CalcularDOL();" tabindex="4" />

<div id="layer16" style="position:absolute; left: 31px; top: 208px; width: 77px;">
<div align="left" class="f2">PRECIO COMPRA $.</div>
</div>
<div id="layer17" style="position:absolute; left: 169px; top: 208px; width: 82px;">
<div align="left" class="f2">PRECIO COMPRA S/.</div>
</div>
<input name="TxtPcD" type="text" id="TxtPcD" style="position:absolute; left: 171px; top: 241px; width: 67px; background-color:#CCC; text-align:right" 
value="<?php echo $StrPcD;?>"   
onkeydown="return SoloTextoEx(event,'CmdG');" tabindex="1" readonly="readonly" />

<div id="layer19" style="position:absolute; left: 256px; top: 208px; width: 95px;">
<div align="left" class="f2">PRECIO VENTA MINIMO S/.</div>
</div>
<input name="TxtPvMin" type="text" id="TxtPvMin" style="position:absolute; left: 255px; top: 241px; width: 67px; ; text-align:right" 
value="<?php echo $StrPvMin;?>"   
onkeydown="return SoloNum(this,event,'TxtPvMax');" tabindex="5"  />

<div id="layer21" style="position:absolute; left: 352px; top: 209px; width: 103px;">
<div align="left" class="f2">PRECIO VENTA MAXIMO S/.</div>
</div>
<input name="TxtPvMax" type="text" id="TxtPvMax" style="position:absolute; left: 352px; top: 241px; width: text-align:right; width: 87px;" 
value="<?php echo $StrPvMax;?>"   
onkeydown="return SoloNum(this,event,'CboPro');" tabindex="6"  />

<input name="TxtTC" type="text" id="TxtTC" style="position:absolute; left: 119px; top: 241px; width: 41px; background-color:#CCC; text-align:right" 
value="<?php echo $StrTC;?>"   
onkeydown="return SoloNum(this,event,'TxtPvMin');" tabindex="1" readonly="readonly" />

<div id="layer24" style="position:absolute; left: 120px; top: 220px; width: 44px;">
<div align="left" class="f2">T. CAM</div>
</div>
<select name="CboPro" id="CboPro" 
style="position:absolute; left: 454px; top: 241px; width: 320px;" tabindex="7"
onkeydown="return SoloTextoEx(event,'CboPUso');"
>
<?php echo FCBO_("NOMBRE","vproveedores","ID>0",$StrPro,"N","S");?>
</select>

<div id="layer26" style="position:absolute; left: 456px; top: 220px; width: 167px;">
<div align="left" class="f2">PROVEEDOR</div>
</div>

<div id="layer26" style="position:absolute; left: 785px; top: 212px; width: 82px;">
<div align="left" class="f2">PRODUCTO EN USO</div>
</div>
<select name="CboPUso" id="CboPUso" 
style="position:absolute; left: 784px; top: 241px; width: 85px;" tabindex="8"
onkeydown="return SoloTextoEx(event,'TxtRojo');">
<?php echo FCBO_("au_item","auxiliar","au_tab='SI_NO'",$CboPUso,"N","N");?>
</select>

<div id="layer26" style="position:absolute; left:31px; top: 272px; width: 595px;">
<div align="left" class="f2">CONTROL DE STOCK MEDIANTE COLORES</div>
</div>

<div id="layer26" style="position:absolute; left:31px; top: 297px; width: 134px;">
<div align="left" class="f2">ROJO desde 0 hasta :</div>
</div>

<input name="TxtRojo" type="text" id="TxtRojo" 
style="position:absolute; left: 167px; top: 294px; width: 60px; ; text-align:right" 
value="<?php echo $StrRojo;?>"   
onkeydown="return SoloEnterosEx(this,event,'TxtAmbar');" tabindex="9"  />

<div id="layer26" style="position:absolute; left:240px; top: 297px; width: 173px;">
<div align="left" class="f2">AMBAR desde ROJO hasta :</div>
</div>

<input name="TxtAmbar" type="text" id="TxtAmbar" 
style="position:absolute; left: 414px; top: 294px; width: 56px; ; text-align:right" 
value="<?php echo $StrAmbar;?>"   
onkeydown="return SoloEnterosEx(this,event,'CmdG');" tabindex="10"  />

<div id="layer26" style="position:absolute; left:31px; top: 320px; width: 820px;">
<div align="left" class="f2">ROJO : STOCK CRITICO / AMBAR : STOCK MINIMO</div>
</div>

</div>
</center>	
</form>
</body>
</html>
