<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
include("phpmnu_fun.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
$HW=$_SESSION['SYS_HW'];
$StrGT="";$LStrMsg="";$LStrFoc="";$LStrMM="";
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$LStrPag=V($_POST['TxtPag']);
//
include("clientes_fun.php");
//
$VP_RegXPag=11;
$LStrTR=gn("count(*)","vclientes","ID>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;

$IdUsu=vbval(V($_SESSION['SYS_USER_ID']));
$AT=gs("at","usuarios","id_usuario=$IdUsu");
?>

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Clientes</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/clientes.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />
<link rel="stylesheet" type="text/css" href="css/mnu.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();
});


$(document).keydown(function(e){
	var AT=gv("TxtAT");
	
	if(e.which==71 && e.altKey){		
		if(AT=="1"){	
		document.getElementById("CmdG").click();
		return;
		}
	}
	
	if(e.which==78 && e.altKey){
		if(AT=="1"){
		document.getElementById("CmdC").click();
		return;
		}
	}
	
	if(e.which==75 && e.altKey){
		if(AT=="1"){	
		document.getElementById("CmdE").click();
		return;
		}
	}

	if(e.which==66 && e.altKey){
		if(AT=="1"){	
		document.getElementById("CmdB").click();
		return;
		}
	}

	if(e.which==77 && e.altKey){
		if(AT=="1"){
		document.getElementById("CmdZ").click();
		return;
		}
	}
  
});
</script>
</head>

<body  <?php echo $LStrMsg;?>>
<div align="center">


<div class="mM" align="left" style="font-size:12px">
<?php
//$HTM=file_get_contents("http://inversionessounduniversal.com/ventas/phpmnu.php?USER_ID=$IdUsu");
echo GEN_MENU($IdUsu);
?>
</div>


<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post"  autocomplete="off"
action="clientes.php" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/clientes2.png" class="iT" />
<div class="tT">CLIENTES</div>
</div>
<!--FIN_TITULO--------------------------------->


<center> 
<div id="DivLAST">
</div>
  <div Id="DivFRM"  class="centrarFrm" >

<div class="s1" style="left: 35px; top: 117px; width: 194px;" >
NOMBRE / RAZON SOCIAL *</div>
<input name="TxtNom" type="text" id="TxtNom" 
class="lt" style="left: 35px; top: 134px; width: 447px" 
value="<?php echo $StrNom;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 497px; top: 117px; width: 126px;">
DIRECCION</div>
<input name="TxtDir" type="text" id="TxtDir" 
class="lt" style="left: 494px; top: 134px; width: 445px" 
value="<?php echo $StrDir;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 950px; top: 117px; width: 66px;">
DISTRITO</div>
<select name="CboDis" id="CboDis" 
class="lt" style="left: 950px; top: 134px; width: 261px" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO_("dis_nombre","distritos","id_distrito>=0",$StrDis,"N","N");?>
</select>

<div class="s1" style="left: 35px; top: 161px; width: 51px;">
RUC *</div>
<input name="TxtRuc" type="text" id="TxtRuc" 
class="nei" style="left: 35px; top: 180px; width: 156px" 
value="<?php echo $StrRuc;?>"
tabindex="<?php echo ++$TI;?>" maxlength="11" />

<div class="s1" style="left: 204px; top: 161px; width: 115px;">
DNI</div>
<input name="TxtDni" type="text" id="TxtDni" 
class="nei" style="left: 204px; top: 180px; width: 117px" 
value="<?php echo $StrDni;?>"  
tabindex="<?php echo ++$TI;?>" maxlength="8" />

<div class="s1" style="left: 336px; top: 161px; width: 127px;">
TELEFONO FIJO</div>
<input name="TxtTel" type="text" id="TxtTel" 
class="lt" style="left: 334px; top: 180px; width: 149px" 
value="<?php echo $StrTel;?>" maxlength="30"
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 497px; top: 161px; width: 106px;">
CELULAR</div>
<input name="TxtCel" type="text" id="TxtCel" 
class="lt" style="left: 495px; top: 180px; width: 120px" 
value="<?php echo $StrCel;?>"  maxlength="30" 
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 625px; top: 161px; width: 56px;">
EMAIL</div>
<input name="TxtEma" type="text" id="TxtEma" 
class="lt" style="left: 626px; top: 180px; width: 587px" 
value="<?php echo $StrEma;?>"  
tabindex="<?php echo ++$TI;?>"/>
  

<!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 35px; top: 71px; width:1000px; 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="CmdB" class="btm"
value="Buscar" onClick="fBuscar('clientes_buscar.php');"  
tabindex="<?php echo ++$TI;?>" />

</div>
<!--FIN_BOTONES-------------------------------->

<div class="datagrid" style="position: absolute; left: 35px; top: 215px; width: 1180px; height: 345px;">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
<tr>
<th width="63%">NOMBRE</th>
<th width="11%">RUC</th>
<th width="12%">TELEFONO</th>
<th width="11%">CELULAR</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>

<?php
	$s="SELECT ID,NOMBRE,CONTACTO,RUC,TEL,CEL 
	FROM vclientes
	WHERE ID> 0 ORDER BY NOMBRE";
	$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
	$result = grs($s);
	while ($r = $result->fetch_assoc()){
		?>
        <tr onDblClick="fActivar(<?php echo $r['ID'];?>);">
        <!----------------------------------------------->
        <td ><?php echo $r['NOMBRE'];?></td>
        <td ><?php echo $r['RUC'];?></td>
        <td ><?php echo $r['TEL'];?></td>
        <td ><?php echo $r['CEL'];?></td>
        <!----------------------------------------------->
        <td align="center">
        <a href="javascript:void(0)" onClick="fActivar(<?php echo $r['ID'];?>);">
        <img src="img/b_edit.png"  border="0"/></a></td>
        </tr>
		<?php
	}

?>		  
          
</tbody>
</table>
</div>
   
<!--INI_OCULTOS-------------------------------->
<?php include("ocultos.php");?>

<div id="DivSunat" style="left: 116px; top: 21px; width: 412px;">
<input name="T_RS" type="hidden" id="T_RS" value=""/>
<input name="T_DI" type="hidden" id="T_DI" value=""/>
<input name="T_TE" type="hidden" id="T_TE" value=""/>
</div>
<!--FIN_OCULTOS-------------------------------->

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