<?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="Dep";$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;
}
//--------------------------------------------------------------------------
$Dep=V($_POST['Dep']);		
$Pro=V($_POST['Pro']);		
$Dis=V($_POST['Dis']);
//
$Dep_=$Dep."%";
$Pro_=$Pro."%";
$Dis_=$Dis."%";
//
$FF="ID>0 AND DEP LIKE '$Dep_' AND PROV LIKE '$Pro_' AND DIS LIKE '$Dis_' ";
//--------------------------------------------------------------------------
$VP_RegXPag=20;
$LStrTR=gn("count(*)","lista_ubigeo",$FF);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>

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

<script type="text/javascript" src="js/sis_funcionez.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:780px;position:relative;top:0px;background-color:#09C; z-index:500;}
.cF {height:480px;width:780px;position:relative;top:0px}
</style>

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

function Z(Dep,Pro,Dis,Ubi){
	window.opener.fRecep(Dep,Pro,Dis);	
	window.close();	
}
</script>

</head>
<body>

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

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" style=" width:780px;" >
<img src="img/buscar.png" class="iT" />
<div class="tT" style=" width:500px;">DEPARTAMENTOS - SELECCIONAR</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 35px; top: 129px; width: 168px;">
DEPARTAMENTO</div>
<input name="Dep" type="text" id="Dep" 
class="lt" style="left: 34px; top: 146px; width: 174px;" 
value="<?php echo $Dep;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 225px; top: 129px; width: 100px;">
PROVINCIA</div>
<input name="Pro" type="text" id="Pro" 
class="lt" style="left: 222px; top: 146px; width: 167px;" 
value="<?php echo $Pro;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 406px; top: 129px; width: 100px;">
DISTRITO</div>
<input name="Dis" type="text" id="Dis" 
class="lt" style="left: 405px; top: 146px; width: 312px;"
value="<?php echo $Dis;?>"  
tabindex="<?php echo ++$TI;?>" />

 <!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width:500px; height: 26px;">
<input name="CmdB" type="button" id="CmdC"  class="btm" 
value="Filtrar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-------------------------------->

<div style="position: absolute; left: 35px; top: 180px; width: 717px; 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: 715px; height: 263px;">
<table id="Exportar_a_Excel" style="font-size:0.9rem; width:100%" >
<thead>
<tr align="left">
<th width="28%">DEPARTAMENTO</th>
<th width="28%">PROVINCIA</th>
<th width="28%">DISTRITO</th>
<th width="2%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;
	
$s="SELECT * FROM lista_ubigeo WHERE $FF ORDER BY DEP,PROV,DIS ";

$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs = grs($s);				
while ($r = $rs->fetch_assoc()){
	$PX++;
	$CSS="";
	if($PX%2==0)$CSS=' style="background-color:#D4D4D4" ';
		?>
        <tr <?php echo $CSS;?> onDblClick="Z('<?php echo $r['DEP'];?>','<?php echo $r['PROV'];?>','<?php echo $r['DIS'];?>')">
        <!----------------------------------------------->
        <td ><?php echo $r['DEP'];?></td>
        <td ><?php echo $r['PROV'];?></td>
        <td ><?php echo $r['DIS'];?></td>
        <!----------------------------------------------->       
        <td style="cursor:pointer;" onClick="Z('<?php echo $r['DEP'];?>','<?php echo $r['PROV'];?>','<?php echo $r['DIS'];?>')">
        <img src="img/b_edit.png"  border="0"/>
        </td>    
        </tr>
		<?php
    }    
?>
    
                
</tbody>
</table>
</div>


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

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