<?php
ini_set("session.cookie_lifetime",60*60*10);
ini_set("session.gc_maxlifetime", 60*60*10);
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
$SYS_MSG="";$SYS_FOC="";$OK=1;
$StrId=V($_POST['TxtId']);$StrCmd=V($_POST['TxtAc']);$LStrPag=V($_POST['TxtPag']);
//++++
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;
}
$USU_KOD=vbval(V($_SESSION['SYS_USER_ID']));
//--------------------------------------------------------------------------
include("sis_productos_fun.php");
//--------------------------------------------------------------------------
$VP_RegXPag=20;
$LStrTR=gn("count(*)","vproductos","ID>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Productos</title>
<?php AddJs(); ?>

<script type="text/javascript" src="js/sis_funciones.js"></script>
<script type="text/javascript" src="js/sis_productos.js"></script>

<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />

<style type="text/css">
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}
.cF {height:600px;width:1250px;position:relative;top:0px}
</style>

<script>
$(document).ready(function(){  
   Inicializar();
   SYS_LOAD();
});
</script>

</head>
<body  <?php echo $LStrMsg;?>>

<div align="center">
<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post" action="sis_productos.php" autocomplete="off" >

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="bng/prod.png" class="iT" style="width:48px; height:48px" />
<div class="tT">PRODUCTOS</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 35px; top: 129px; width: 70px;">
CODIGO</div>
<input name="TxtCod" type="text" id="TxtCod" 
class="lt" style="left: 35px; top: 146px; width: 124px;" 
value="<?php echo $StrCod;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 169px; top: 129px; width: 144px;">
LINEA DE PRODUCTO</div>
<select name="CboLin" id="CboLin" 
class="lt" style="left: 168px; top: 146px; width: 187px;"  
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("lin_nombre","lineas","id_linea>0",$StrLin,"N","S");?>    
</select>

<div class="s1"style="left: 366px; top: 129px; width: 202px;">
DESCRIPCION / NOMBRE</div>
<input name="TxtDes" type="text" id="TxtDes" 
class="lt" style="left: 365px; top: 146px; width: 439px;" 
value="<?php echo $StrDes;?>"   
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 814px; top: 115px; width: 77px;">
PRECIO COMPRA $.</div>
<input name="TxtPcS" type="text" id="TxtPcS" 
class="ndd" style="left: 814px; top: 146px; width: 67px; text-align: right" 
value="<?php echo $StrPcS;?>" onKeyUp="CalcularDOL();" 
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 890px; top: 129px; width: 44px;">
T. CAM</div>
<input name="TxtTC" type="text" id="TxtTC" 
class="rod" style="left: 889px; top: 146px; width: 48px;" 
value="<?php echo $StrTC;?>"/>

<div class="s1" style="left: 939px; top: 115px; width: 82px;">
PRECIO COMPRA S/.</div>
<input name="TxtPcD" type="text" id="TxtPcD" 
class="rod" style="left: 947px; top: 146px; width: 74px;" 
value="<?php echo $StrPcD;?>"/>

<div class="s1" style="left: 1026px; top: 115px; width: 95px;">
PRE. VENTA MINIMO S/.</div>
<input name="TxtPvMin" type="text" id="TxtPvMin" 
class="ndd" style="left: 1025px; top: 146px; width: 87px;" 
value="<?php echo $StrPvMin;?>"   
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 1122px; top: 115px; width: 103px;">
PRE. VENTA MAXIMO S/.</div>
<input name="TxtPvMax" type="text" id="TxtPvMax" 
class="ndd" style="left: 1122px; top: 146px; width: 90px;" 
value="<?php echo $StrPvMax;?>"   
tabindex="<?php echo ++$TI;?>"  />

<div class="s1" style="left: 35px; top: 193px; width: 167px;">
PROVEEDOR</div>
<select name="CboPro" id="CboPro" 
class="lt" style="left: 33px; top: 210px; width: 320px;" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("NOMBRE","vproveedores","ID>0",$StrPro,"N","S");?>
</select>

<div class="s1" style="left: 364px; top: 179px; width: 82px;">
PRODUCTO EN USO</div>
<select name="CboPUso" id="CboPUso" 
class="lt" style="left: 363px; top: 210px; width: 85px;" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("au_item","auxiliar","au_tab='SI_NO'",$CboPUso,"N","N");?>
</select>

<div class="s1" style="left: 458px; top: 191px; width: 82px;"> UNIDAD
</div>
<select name="Und" id="Und" 
class="lt" style="left: 458px; top: 210px; width: 123px;" 
tabindex="<?php echo ++$TI;?>">
<?php 
	echo FCBO("uni_nombre","unidades","id_unidad >0",$StrUni,"N","S");
?>
</select>

<div class="s1" style="left: 35px; top: 251px; width: 595px;">
CONTROL DE STOCK MEDIANTE COLORES</div>

<div class="s1" style="left: 35px; top: 276px; width: 134px;">
ROJO desde 0 hasta :</div>
<input name="TxtRojo" type="text" id="TxtRojo" 
class="lt" style="left: 171px; top: 273px; width: 60px; ; text-align: right" 
value="<?php echo $StrRojo;?>"   
tabindex="<?php echo ++$TI;?>"  />

<div class="s1" style="left: 244px; top: 276px; width: 173px;">
AMBAR desde ROJO hasta :</div>
<input name="TxtAmbar" type="text" id="TxtAmbar" 
class="lt" style="position: absolute; left: 420px; top: 273px; width: 56px; ; text-align: right" 
value="<?php echo $StrAmbar;?>"   
tabindex="<?php echo ++$TI;?>"  />

<div class="s1" style="left: 35px; top: 299px; width: 820px;">
ROJO : STOCK CRITICO / AMBAR : STOCK MINIMO</div>


<!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width:1000px; height: 26px;">
<input name="CmdB" type="button" id="CmdG" class="btm" 
<?php GOM($StrId);?>
onclick="fGuardar();"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdC"  class="btm" 
value="Nuevo" onClick="fCancelar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdE" class="btm" 
value="Eliminar" onClick="fEliminar();"
<?php DIS($StrId);?>
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fBuscar('sis_productos_b.php?CmdB=CallBack');"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB" class="btm" style="width:130px;"
value="Ver stock general" onClick="fBuscar('stockgeneral.php?CmdB=CallBack');"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB" class="btm"
value="Menu" onClick="fBuscar('menu.php');"  
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-------------------------------->


<div style="position: absolute; left: 35px; top: 317px; width: 1180px; height: 22px;">
<table  style="font-size:0.9rem; width:100%" >
<thead>
<tr>
<td colspan="5"  align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
</thead>
</table>
</div>

<div class="tableFixHead" style="position: absolute; left: 35px; top: 342px; width: 1180px; height: 238px;">
<table  style="font-size:0.9rem; width:100%" >
<thead>
<tr align="left">
<th width="5%">CODIGO</th>
<th width="18%">LINEA</th>
<th width="69%">DESCRIPCION</th>
<th width="6%">UND</th>
<th width="2%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;

$s="SELECT ID,COD,LINEA,DESCRIPCION,MARCA,UNIDAD FROM vproductos
WHERE ID> 0 ORDER BY DESCRIPCION";

$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);	  				
$result = grs($s);
while ($r = $result->fetch_assoc()){
	$PX++;
	$CSS="";
	$UND=$r['UNIDAD'];//PRO_UND_GET($r['ID']);
	if($PX%2==0)$CSS=' style="background-color:#D4D4D4" ';
?>
        <tr <?php echo $CSS;?> onDblClick="fActivar(<?php echo $r['ID'];?>);">
        <!----------------------------------------------->
        <td ><?php echo $r['COD'];?></td>
        <td ><?php echo $r['LINEA'];?></td>
        <td ><?php echo $r['DESCRIPCION'];?></td>
        <td ><?php echo $UND;?></td>
        <!----------------------------------------------->       
        <td>
        <a href="javascript:void(0)" onClick="fActivar(<?php echo $r['ID'];?>);">
        <img src="img/b_edit.png"  border="0"/></a>
        </td>    
        </tr>
<?php
    }    
?>	  

</tbody>
</table>
</div>
        
<?php include("sis_ocultos.php");?>
	
</form>
</div>
</div>
</body>
</html>
