<?php
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;
}
//+++
$HW=$_SESSION['SYS_HW'];
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
//
include("lq_clientes_ed_fun.php");
//
$VP_RegXPag=20;
$LStrTR=gn("count(*)","vclientes",$FF);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Actualizar Datos Del Cliente</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="fe/funcionex.js"></script>
<script type="text/javascript" src="fe/lq_clientes_ed2.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="estilox.css"  />
<link rel="stylesheet" type="text/css" href="basix.css"  />
<style type="text/css">
.cF {height:800px;width:1300px;position:relative; <?php echo "top:0px";?>}
</style>
<script>
$(document).ready(function(){  
   Inicializar();   
});
</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  <?php echo $LStrMsg;?>  >
<div align="center">

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;" >
<form id="Frm" name="Frm" method="post" action="lq_clientes_ed.php">
<!--INI_TITULO-->
<div id="DivT" class="dT"  style="width:1300px">
<img src="img/unidades.png" class="iT" />
<div class="tT" style="width:1000px">ACTUALIZAR DATOS DEL CLIENTE</div>
</div>
<!--FIN_TITULO-->
<div class="s1" style="left:177px; top: 114px; width: 142px; height: 18px;">
  <?php
	if(strlen($_PDF)>0){
		echo "<a href=\"$_PDF\" target=\"_new\">DESCARGAR</a>";	
	}
?>
  
</div>

<div class="ad" style="left:35px; top:132px; width: 130px; height: 18px;">DEPARTAMENTO</div>
<select name="Dep" id="Dep" 
class="lty" style="left:35px; top:149px; width: 139px;"
tabindex="<?php echo ++$TI;?>"  >
<?php
echo FCBO("dis_nombre","distritos","id_distrito>0",$Dep,"S","N");
?>
</select>

<div class="s1" style="left:184px; top: 132px; width: 54px; height: 18px;">RUC</div>
<input name="Ruc"  type="text" 
class="nei"  id="Ruc" 
style="left:184px; top: 149px; width: 104px;"
maxlength="11" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Ruc;?>"   />

<div class="s1" style="left:300px; top: 132px; width: 54px; height: 18px;">DNI</div>
<input name="Dni"  type="text" 
class="nei"  id="Dni" 
style="left:300px; top: 149px; width: 104px;"
maxlength="8" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Dni;?>"   />

<div class="s1" style="left:418px; top: 132px; width: 210px; height: 18px;">
NOMBRES</div>
<input name="Nom"  type="text" 
class="lt"  id="Nom" 
style="left:417px; top: 149px; width: 233px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Nom;?>"   />

<div class="s1" style="left:662px; top: 132px; width: 86px; height: 18px;"> EMAIL
</div>
<input name="Ema"  type="text" 
class="lt"  id="Ema" 
style="left:661px; top: 149px; width: 328px;"
maxlength="150" 
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Ema;?>"   />

<input name="CmdF" type="button" id="CmdF"  style="position:absolute; top:149px; left:1000px; width: 84px;"
value="Filtrar" onClick="fFiltrar();"  
tabindex="<?php echo ++$TI;?>" />

<!--INI_TABLA----->
<div class="s1"
style="background:#ECF9FF; position:absolute; left: 35px; top: 182px; width: 1244px; height: 550px; overflow:auto;">
<div class="s1" style="left: 0px; top: 0px; width: 1242px;">
  <table id="Exportar_a_Excel" class="f3t" width="1223" border="1" style="border-collapse: collapse">
   <tr>
      <td colspan="9" bgcolor="#CCCCCC" height="18" align="center">
      <?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
      </td>
      </tr>   
    <tr>
      <td width="240" bgcolor="#CCCCCC">NOMBRES</td>
      <td width="120" bgcolor="#CCCCCC">RUC</td>
      <td width="80" bgcolor="#CCCCCC">DNI</td>
      <td width="90" bgcolor="#CCCCCC">TLF.FIJO</td>
      <td width="100" bgcolor="#CCCCCC">CELULAR</td>
      <td width="125" bgcolor="#CCCCCC">DEPARTAMENTO</td>
      <td width="179" bgcolor="#CCCCCC">DIRECCION</td>
      <td width="171" bgcolor="#CCCCCC">EMAIL</td>     
      <td width="60" bgcolor="#CCCCCC">RANDOM</td> 
    </tr>   
    <?php
		$s="SELECT ID,NOMBRE,RUC,DNI,DISTRITO,DIRECCION,TEL,CEL,EMAIL,CLI_RND
			FROM vclientes WHERE $FF 
			ORDER BY NOMBRE ";
		$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
		//echo $s;  
		$rs = grs($s);
		while ($r = $rs->fetch_assoc()){
			$ID=$r['ID'];
	?>
    <tr>
        <td>
        <input  class="lt" type="text" style="position:inherit; width:240px"  
        tabindex="<?php echo ++$TI;?>"
        name="N_<?php echo $ID;?>" value="<?php echo $r['NOMBRE'];?>" id="N_<?php echo $ID;?>">
        </td>
        <td>
        <input class="nei" type="text" style="position:inherit; width:120px"  
        tabindex="<?php echo ++$TI;?>"
        name="R_<?php echo $ID;?>" maxlength="11" value="<?php echo $r['RUC'];?>" id="R_<?php echo $ID;?>" >
        </td>
        <td>
        <input class="neiy" type="text" style="position:inherit; width:80px"  
        tabindex="<?php echo ++$TI;?>"
        name="D_<?php echo $ID;?>"  maxlength="8" value="<?php echo $r['DNI'];?>" id="D_<?php echo $ID;?>">
        </td>
        <td>
        <input class="nei" type="text" style="position:inherit; width:90px"  
        tabindex="<?php echo ++$TI;?>"
        name="T_<?php echo $ID;?>" maxlength="11" value="<?php echo $r['TEL'];?>" id="T_<?php echo $ID;?>" >
        </td>
        <td>
        <input class="neiy" type="text" style="position:inherit; width:100px"  
        tabindex="<?php echo ++$TI;?>"
        name="C_<?php echo $ID;?>"  maxlength="8" value="<?php echo $r['CEL'];?>" id="C_<?php echo $ID;?>">
        </td>
        <td>
        <select name="P_<?php echo $ID;?>" id="P_<?php echo $ID;?>" 
        class="lt" style="position:inherit; width:100%"
        tabindex="<?php echo ++$TI;?>"  >
        <?php
        echo FCBO("dis_nombre","distritos","id_distrito>0",$r['EMAIL'],"N","N");
        ?>
        </select>
        </td>
        <td>
        <input class="lt" type="text" style="position:inherit; width:100%"  
        tabindex="<?php echo ++$TI;?>"
        name="A_<?php echo $ID;?>" value="<?php echo $r['DIRECCION'];?>" id="A_<?php echo $ID;?>">
        </td> 
        <td>
        <input class="lt" type="text" style="position:inherit; width:100%"  
        tabindex="<?php echo ++$TI;?>"
        name="Z_<?php echo $ID;?>" value="<?php echo $r['EMAIL'];?>" id="Z_<?php echo $ID;?>">
        </td>
        
        <td>
        <select name="X_<?php echo $ID;?>" id="X_<?php echo $ID;?>" 
        class="lt" style="position:inherit; width:60px"
        tabindex="<?php echo ++$TI;?>"  >
        <?php
        echo FCBO_("au_item","auxiliar","au_tab='SI_NO'",$r['CLI_RND'],"N","N");
        ?>
        </select>
        </td>
        
    </tr>			
    <?php
		}
	?>
  </table>
</div>
</div>
<?php
	/*
	$TCOMI=0;
	$PAL=0;
	$MIN=vbval($Cmip);	
	$MAX=vbval($Cmap);
	$COM=vbval($Comi);
	if($COM>0){
		$UNI=round(($MAX - $MIN) / $COM,2);
	}
	if($TOT_PTO>$MIN){
		$DIF=$TOT_PTO - $MIN;		
		$PAL=round($DIF / $UNI,2);
		$TCOMI=round($TOT_PTO * $PAL/100,2);
	}
	*/
?>
<!--FIN_TABLA----->
<!--INI_OCULTOS-------------------------------->
<?php include("ocultox.php");?>
<!--FIN_OCULTOS-------------------------------->
<!--INI_BOTONES----->
<div id="DivBtn"  align="left"
style="position:absolute; left: 33px; top: 71px; width: 703px; height: 26px;">
<input name="CmdP" type="button" id="CmdP" class="btm"
value="Guardar" onClick="fGuardar();"  
tabindex="<?php echo ++$TI;?>" />
<input name="CmdB" type="button" id="CmdZ" class="btm"
value="Menu" onClick="fBuscar('menu.php');"  
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-->
</form>
<form action="ficheroExcel.php" 
method="post" target="_blank" 
id="FormularioExportacion" >
</form>

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