<?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_clientes_suc_fun.php");
//--------------------------------------------------------------------------
$VP_RegXPag=20;
$LStrTR=gn("count(*)","clientes_suc","suc_id_cliente=$IC");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>

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


<script type="text/javascript" src="js/sis_funciones.js"></script>
<script type="text/javascript" src="js/sis_clientez_suc.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:700px;position:relative;top:0px;background-color:#09C; z-index:500;}
.cF {height:460px;width:700px;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_clientes_suc.php" autocomplete="off">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" style="width:700px;" >
<img src="img/almacen.jpg" class="iT" />
<div class="tT" style="width:300px;">CLIENTES - SUCURSALES</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 35px; top: 120px; width: 126px;">
NOMBRE
</div>
<input name="TxtNom" type="text" id="TxtNom"
class="lt" style="left: 35px; top: 137px; width: 137px;" 
value="<?php echo $StrNom;?>"  
tabindex="<?php echo ++$TI;?>" />

<div class="s1" style="left: 183px; top: 120px; width: 159px;">
DIRECCION
</div>
<input name="TxtDir" type="text" id="TxtDir" 
class="lt" style="left: 180px; top: 137px; width: 490px;" 
value="<?php echo $StrDir;?>"   
tabindex="<?php echo ++$TI;?>" />
    
<!--INI_BOTONES-------------------------------->
<div align="left" style="position:absolute; left: 33px; top: 71px; width:500px; 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="CmdZ" class="btm" 
value="Cerrar" onClick="window.close();"  
tabindex="<?php echo ++$TI;?>"/>
</div>
<!--FIN_BOTONES-------------------------------->
    
    
<div style="position: absolute; left: 35px; top: 166px; width: 635px; 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: 192px; width: 635px; height: 245px;">
<table  style="font-size:0.9rem; width:100%" >
<thead>
<tr align="left">
<th width="25%">NOMBRE</th>
<th width="25%">DIRECCION</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;

$s="SELECT id_suc,suc_nom,suc_dir FROM clientes_suc
	WHERE suc_id_cliente=$IC ORDER BY suc_nom";
	
$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[0];?>);">
        <!----------------------------------------------->
        <td ><?php echo $r['suc_nom'];?></td>
        <td ><?php echo $r['suc_dir'];?></td>
        <!----------------------------------------------->       
        <td>
        <a href="javascript:void(0)" onClick="fActivar(<?php echo $r[0];?>);">
        <img src="img/b_edit.png"  border="0"/></a>
        </td>    
        </tr>
		<?php
    }
    
?>  

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

<input name="TxtIC" type="hidden" id="TxtIC" value="<?php echo $IC;?>"/>

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