<?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;
}
//--------------------------------------------------------------------------
include("sis_proveedores_fun.php");
//--------------------------------------------------------------------------
$VP_RegXPag=20;
$LStrTR=gn("count(*)","vproveedores","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>Proveedores</title>
<?php AddJs(); ?>

<script type="text/javascript" src="js/sis_funciones.js"></script>
<script type="text/javascript" src="js/sis_proveedores.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>

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

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

<div class="s1" style="left: 35px; top: 129px; width: 157px;">
NOMBRE / RAZON SOCIAL</div>
<input name="TxtNom" type="text" id="TxtNom" 
class="lt" style="left: 35px; top: 146px; width: 290px;" 
value="<?php echo $StrNom;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 336px; top: 129px; width: 88px;">
CONTACTO</div>
<input name="TxtCon" type="text" id="TxtCon" 
class="lt" style="left: 333px; top: 146px; width: 147px;" 
value="<?php echo $StrCon;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 489px; top: 129px; width: 64px;">
DIRECCION</div>
<input name="TxtDir" type="text" id="TxtDir" 
class="lt" style="left: 488px; top: 146px; width: 512px;" 
value="<?php echo $StrDir;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 1010px; top: 129px; width: 144px;">
DEPARTAMENTO</div>
<select name="CboDis" id="CboDis" 
class="lt" style="left: 1010px; top: 146px; width: 201px;" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("dis_nombre","distritos","id_distrito>0",$StrDis,"N","S");?>
</select>

<div class="s1" style="left: 37px; top: 186px; width: 51px;">
RUC</div>
<input name="TxtRuc" type="text" id="TxtRuc" 
class="lt" style="left: 35px; top: 203px; width: 103px;" 
value="<?php echo $StrRuc;?>"  
tabindex="<?php echo ++$TI;?>" maxlength="11" />

<div class="s1" style="left: 147px; top: 186px; width: 103px;">
DNI</div>
<input name="TxtDni" type="text" id="TxtDni" 
class="lt" style="left: 148px; top: 203px; width: 105px;" 
value="<?php echo $StrDni;?>"  
tabindex="<?php echo ++$TI;?>" maxlength="8" />

<div class="s1" style="left: 265px; top: 186px; width: 130px;">
TELEFONO FIJO</div>
<input name="TxtTel" type="text" id="TxtTel" 
class="lt" style="left: 262px; top: 203px; width: 138px;" 
value="<?php echo $StrTel;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 410px; top: 186px; width: 152px;">
CELULAR</div>
<input name="TxtCel" type="text" id="TxtCel" 
class="lt" style="left: 410px; top: 203px; width: 248px;"
value="<?php echo $StrCel;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 667px; top: 186px; width: 58px;">
FAX</div>
<input name="TxtFax" type="text" id="TxtFax" 
class="lt" style="left: 667px; top: 203px; width: 170px;" 
value="<?php echo $StrFax;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 851px; top: 186px; width: 142px;">
EMAIL</div>
<input name="TxtEma" type="text" id="TxtEma" 
class="lt" style="left: 848px; top: 203px; width: 363px;" 
value="<?php echo $StrEma;?>"  
tabindex="<?php echo ++$TI;?>" />

<!--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_proveedores_b.php');"  
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: 236px; 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: 262px; width: 1180px; height: 301px;">
<table  style="font-size:0.9rem; width:100%" >
<thead>
<tr align="left">
<th width="47%">NOMBRE</th>
<th width="11%">CONTACTO</th>
<th width="15%">RUC</th>
<th width="14%">TELEFONO</th>
<th width="11%">CELULAR</th>
<th width="2%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;
	
$s="SELECT ID,NOMBRE,CONTACTO,RUC,TEL,CEL FROM vproveedores
		WHERE ID> 0 ORDER BY NOMBRE";	
		
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);	 				
$result = grs($s);
while ($r = $result->fetch_assoc()){
	$PX++;
	$CSS="";
	if($PX%2==0)$CSS=' style="background-color:#D4D4D4" ';
		?>
        <tr <?php echo $CSS;?> onDblClick="fActivar(<?php echo $r['ID'];?>);">
        <!----------------------------------------------->
        <td ><?php echo $r['NOMBRE'];?></td>
        <td ><?php echo $r['CONTACTO'];?></td>
        <td ><?php echo $r['RUC'];?></td>
        <td ><?php echo $r['TEL'];?></td>
        <td ><?php echo $r['CEL'];?></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>
