<?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;
}
//--------------------------------------------------------------------------
$StrNom=V($_POST['TxtNom']);		
$StrCon=V($_POST['TxtCon']);		
$StrRuc=V($_POST['TxtRuc']);
//
$StrNomT=$StrNom."%";
$StrConT=$StrCon."%";
$StrRucT=$StrRuc."%";
//
$FF="ID>0 
AND NOMBRE Like '$StrNomT' 
AND CONTACTO Like '$StrConT' 
AND RUC Like '$StrRucT'";
//--------------------------------------------------------------------------
$VP_RegXPag=500;
$LStrTR=gn("count(*)","vproveedores",$FF);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>

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

<script type="text/javascript" src="js/sis_funciones.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();
   jF("TxtNom");
});
</script>

<script language="javascript">
$(document).ready(function() {
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});
</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_b.php" autocomplete="off">

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

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

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

<div class="s1" style="left: 583px; top: 129px; width: 100px;">
RUC</div>
<input name="TxtRuc" type="text" id="TxtRuc" 
class="lt" style="left: 578px; top: 146px; width: 154px;" 
value="<?php echo $StrRuc;?>"  
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="CmdC"  class="btm" 
value="Filtrar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

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

<div style="position: absolute; left: 35px; top: 180px; 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: 205px; width: 1180px; height: 361px;">
<table id="Exportar_a_Excel" style="font-size:0.9rem; width:100%" >
<thead>
<tr align="left">
<th width="28%">NOMBRE</th>
<th width="28%">CONTACTO</th>
<th width="28%">RUC</th>
<th width="28%">TELEFONO</th>
<th width="28%">CELULAR</th>
<th width="2%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;
		  			
$s="SELECT ID,NOMBRE,CONTACTO,RUC,TEL,CEL FROM vproveedores 
	WHERE $FF 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="location.href='sis_proveedores.php?Id=<?php echo $r[0];?>&Pag=0'">
        <!----------------------------------------------->
        <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="sis_proveedores.php?Id=<?php echo $r[0];?>&Pag=0">
        <img src="img/b_edit.png"  border="0"/></a>
        </td>    
        </tr>
		<?php
    }    
?>
</tbody>
</table>
</div>

<?php include("sis_ocultos.php");?>

</form>

<form action="ficheroExcel.php" method="post" target="_blank" id="FormularioExportacion" >
<div style="position: absolute; left: 221px; top: 71px; width: 45px; height: 15px;">  
<input name="" type="button" class="botonExcel btm" value="Exportar" />
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</div>
</form>


</div>
</div>
</body>
</html>
