<?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");
	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;
}
//
$StrCL=V($_GET['C']);
if(strlen($StrCL)==0){
	$StrCL=V($_POST['TxtCL']);
}
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$StrNom=V($_POST['TxtNom']);		
$StrDir=V($_POST['TxtDir']);		
//-------------------------
$StrNomT=$StrNom."%";
$StrDirT=$StrDir."%";
$FF="ID>0 AND CLI LIKE '$StrCL' AND NOM LIKE '$StrNomT' AND DIR LIKE '$StrDirT'";
//-------------------------
$LStrTR=gn("count(*)","vclientes_suc",$FF);
$LStrPag=V($_POST['TxtPag']);	
if($StrCmd=="F"){$LStrPag="1";}
$VP_RegXPag=15;	
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);

?>
<!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>Ventas - Clientes - Seleccionar</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<style type="text/css">
<!--
body {
	background-color: #666;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:700px;
	height:600px;
	position:absolute;
	left:50%;
	top:0px;
	background-color:#999999;
	margin:0 0 0 -350px;
}
#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}

-->
</style>

</head>
<body  onload="document.getElementById('TxtNom').focus();">
<form id="Frm" name="Frm" method="post" action="clientes_suc_sel.php">
<center> 
  <div Id="DivFRM"  class="centrarFrm" >
    <div id="layer6" style="position:absolute; left: 60px; top: 86px; width: 118px;">
      <div align="left" class="f2">NOMBRE</div>
    </div>
    <div id="layer3" style="position:absolute; left: 15px; top: 138px; width: 667px; height: 200px;">
      <div align="left" class="f2">
        <table width="668" border="1" cellpadding="0" cellspacing="0">
          <tr>
            <td colspan="6" bgcolor="#999999" height="18px" align="center">
            <?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
            </td>
            </tr>
<tr>
<td width="134" bgcolor="#999999"><span class="s4">NOMBRE</span></td>
<td width="501" bgcolor="#999999"><span class="s4">DIRECCION</span></td>
<td width="25" bgcolor="#999999">&nbsp;</td>
</tr>
		  <?php		  		
				$s="SELECT NOM,DIR FROM vclientes_suc ".
				   "WHERE $FF ORDER BY NOM,DIR ";		  				
				$X1="<td bgcolor=\"#FFFFFF\"><span class=\"Estilo5\">";
				$X2="</span></td>";
				$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
				$result = grs($s);				
				while ($row = $result->fetch_row()){
					echo "<tr 
						  ondblclick=\"
						  window.opener.document.Frm.TxtDesDir.value='$row[1]';
						  window.close();
						  \">";
					echo $X1.$row[0].$X2;
					echo $X1.$row[1].$X2;
					echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
						 <a href=\"javascript:void(null)\"
						 onclick=\"
						 window.opener.document.Frm.TxtDesDir.value='$row[0]';
						 window.close();
						 \"
						 >
						 <img src=\"img/b_edit.png\"  border=\"0\"/>
						 </a>
						 </td>";
					echo "</tr>";
				}

		  ?>		  
         
        </table>
      </div>
  </div>
<div id="layer" style="position:absolute; left: 116px; top: 30px; width: 412px; height: 24px;">
<div align="left" class="Estilo1"> SELECCIONAR SUCURSAL</div>
</div>
<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtCL" type="hidden" id="TxtCL" value="<?php echo $StrCL;?>" />

<input name="TxtNom" type="text" id="TxtNom" 
style="position:absolute; left: 60px; top: 109px; width: 135px;" 
value="<?php echo $StrNom;?>"  
onkeydown="return SoloTextoEx(event,'TxtDir');"  
tabindex="1" />

    <div id="LblTit" style="position:absolute; left: 57px; top: 25px; width: 64px;">
    <div align="left" class="Estilo1"><img src="img/buscar.png" width="57" height="60" /></div>
  </div>	
        <input name="CmdB" type="button" id="CmdB" 
style="position:absolute; left: 436px; top: 109px; width: 69px;"
        value="Filtrar" onclick="fFiltrar();"  tabindex="4"/>

    <div id="layer7" style="position:absolute; left: 209px; top: 86px; width: 143px;">
      <div align="left" class="f2">DIRECCION</div>
    </div>
<input name="TxtDir" type="text" id="TxtDir" 
style="position:absolute; left: 207px; top: 109px; width: 215px;" 
value="<?php echo $StrCon;?>"  
onkeydown="return SoloTextoEx(event,'CmdB');"  tabindex="2" />
  </div>
</center>	
</form>
</body>
</html>
