<?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;
}
//
$USU_KOD=vbval(V($_SESSION['SYS_USER_ID']));
$StrGT=""; $LStrMsg=""; $LStrFoc=""; $LStrMM="";
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$LStrPag=V($_POST['TxtPag']);
include("cuentas_fun.php");
$w="ID>0";
$VP_RegXPag=15;
$LStrTR=gn("count(*)","vis_cuentas",$w);
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
$TI=1;
?>
<!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>Cuentas</title>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="jquery.maskedinput.min.js" type="text/javascript"></script>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script type="text/javascript" src="fe/cuentas.js"></script>
<script type="text/javascript" src="fe/leo.js"></script>
<script>
$(document).ready(function(){
   //$("#TxtFec").mask("99-99-99"); 
   
        
});
</script>
<link rel="stylesheet" type="text/css" href="basic.css"  />
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm {height:650px;width:1100px;position:relative;top:0px;background-color:#666666;}

#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}
.s5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="cuentas.php" onsubmit="return false;">
<center> 
<div Id="DivFRM"  class="centrarFrm" >


<?php if(strlen($Fec)==0)$Fec=date("d-m-y");?>
<div class="s1" style="left: 35px; top: 137px; width: 59px;">
FECHA</div>
<input name="Fec" type="text" id="Fec" 
style="position:absolute; left: 35px; top: 156px; width: 83px; background-color:#CCC" 
value="<?php echo $Fec;?>"   readonly="readonly"
onkeydown="return SoloFec(this,event,'Ban');" 
tabindex="<?php echo $TI++?>" />

<div class="s1" style="left: 130px; top: 137px; width: 65px;">
BANCO</div>
<select name="Ban" id="Ban" 
style="position:absolute; left:130px; top:156px; width: 118px;" 
onkeydown="return SoloTextoEx(event,'Tip');" tabindex="<?php echo $TI++?>">
<?php 
	echo FCBO("ban_nombre","bancos","id_banco>0",$Ban,"N","S");
?>
</select>


<div class="s1" style="left: 259px; top: 137px; width: 146px;">
TIPO DE CUENTA</div>
<select name="Tip" id="Tip" 
style="position:absolute; left:260px; top:156px; width: 147px;" 
onkeydown="return SoloTextoEx(event,'Mnd');" 
tabindex="<?php echo $TI++?>">
<?php 
	echo FCBO("aux_des","auxiliares","aux_tip='T-CTA'",$Tip,"N","S");
?>
</select>

<div class="s1" style="left: 418px; top: 137px; width: 81px;">
MONEDA</div>
<select name="Mnd" id="Mnd" 
style="position:absolute; left:419px; top:156px; width: 112px;" 
onkeydown="return SoloTextoEx(event,'Nro');" 
tabindex="<?php echo $TI++?>">
<?php 
	echo FCBO("mon_nombre","monedas","",$Mnd,"N","S");
?>
</select>


<div class="s1" style="left:542px; top: 136px; width: 163px;">
NUMERO DE CUENTA</div>
<input name="Nro" type="text" id="Nro" 
style="position:absolute; left: 543px; top: 156px; width:176px;" 
value="<?php echo $Nro;?>" maxlength="25"
onkeydown="return SoloTextoEx(event,'Cci');" 
tabindex="<?php echo $TI++?>" onfocus="selecciona_value(this);"/>


<div class="s1" style="left:732px; top: 136px; width: 220px;">
CCI (Opcional)</div>
<input name="Cci" type="text" id="Cci" 
style="position:absolute; left: 733px; top: 156px; width:244px;" 
value="<?php echo $Cci;?>"  maxlength="25"
onkeydown="return SoloTextoEx(event,'Hab');" 
tabindex="<?php echo $TI++?>" onfocus="selecciona_value(this);"/>

<?php if(strlen($Hab)==0)$Hab="SI";?>
<div class="s1" style="left: 989px; top: 137px; width: 89px;">
HABILITADO</div>
<select name="Hab" id="Hab" 
style="position:absolute; left:990px; top:156px; width: 73px;" 
onkeydown="return SoloTextoEx(event,'Tit');" tabindex="<?php echo $TI++?>">
<?php 
	echo FCBO("au_item","auxiliar","au_tab='SI_NO'",$Hab,"N","N");
?>
</select>


<div class="s1" style="left:35px; top: 184px; width: 220px;"> TITULAR
</div>
<input name="Tit" type="text" id="Tit" 
style="position:absolute; left: 35px; top: 202px; width:372px;" 
value="<?php echo $Tit;?>"  maxlength="50"
onkeydown="return SoloTextoEx(event,'Obs');" 
tabindex="<?php echo $TI++?>" onfocus="selecciona_value(this);"/>

<div class="s1" style="left:419px; top: 184px; width: 128px;">
OBSERVACION</div>
<input name="Obs" type="text" id="Obs" 
style="position:absolute; left: 419px; top: 202px; width:642px;" 
value="<?php echo $Obs;?>"  maxlength="50"
onkeydown="return SoloTextoEx(event,'CmdG');" 
tabindex="<?php echo $TI++?>" onfocus="selecciona_value(this);"/>



<div class="s1" style="left:35px; top: 233px; width: 89px;">
EMPRESAS</div>
<div style="position:absolute; left:35px; top:251px; width:1027px;" align="left">
<table border="0" width="1%" style="font-size:11px; font-family:Tahoma, Geneva, sans-serif; color:#FFF">
  <tr>
  	<?php
	$CUE_KOD=vbval($StrId);
	$s="SELECT id_emp as ID,emp_nomc as NOM 
		FROM empresas WHERE id_emp>0 ORDER BY emp_nomc ";
	$rs=grs($s);
	while($r=$rs->fetch_assoc()){
		$CH="ch_".$r['ID'];
		$SEL="";
		if($CUE_KOD>0){
			if(gn("count(*)","cuentas_emp","id_cta=$CUE_KOD AND id_emp=".$r['ID'])>0){
				$SEL=' checked="checked" ';
			}
		}
	?>
    <td width="1%">
    <input type="checkbox" name="<?php echo $CH;?>" value="1"  <?php echo $SEL;?> 
    id="<?php echo $CH;?>" style="position:inherit" tabindex="<?php echo $TI++?>" />
    </td>
    <td width="1%"><?php echo $r['NOM'];?></td>
    <td width="5%">&nbsp;</td>
    <?php
	}
	?>    
  </tr>
</table>
</div>


<div id="layer4" style="position:absolute; left: 35px; top: 85px; width: 442px; height: 26px;">
<div align="left" class="f2">
<input name="CmdB" type="button" id="CmdG"  
<?php
if(vbval($StrId)==0){
	echo " value=\"Guardar\"  ";
}else{
	if(vbval($StrAku)>0){
		echo " value=\"Guardar\"   disabled=\"disabled\" ";
	}else{
		echo " value=\"Modificar\"  ";
	}
}
?>
onclick="fGuardar();" style="width:80px" 
tabindex="<?php echo $TI++?>"/>

<input name="CmdB" type="button" 
id="CmdC" value="Nuevo" onclick="flCancelar();"  
tabindex="<?php echo $TI++?>"/>

<?php
$E_D=' disabled="disabled" ';
if(vbval($StrId)>0)$E_D="";
?>
<input name="CmdB" type="button" 
id="CmdE" value="Eliminar" onclick="flEliminar();" <?php echo $E_D;?>
tabindex="<?php echo $TI++?>"/>

<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="<?php echo $TI++?>"/>

</div>
</div>

<div id="layer3" style="position:absolute; left: 35px; top: 291px; width: 1048px; height: 317px; overflow:auto">
<div align="left" class="f2">
<table width="1030" height="22" border="1" cellpadding="0" cellspacing="0">

<tr>
<td height="18" colspan="10" bgcolor="#666666" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
<tr>
<td width="81" bgcolor="#999999" style="color:#000">FECHA</td>
<td width="97" bgcolor="#999999" style="color:#000">BANCO*</td>
<td width="107" bgcolor="#999999" style="color:#000">TIPO DE CUENTA</td>
<td width="66" bgcolor="#999999" style="color:#000">MONEDA</td>
<td width="170" bgcolor="#999999" style="color:#000">NUMERO DE CUENTA*</td>
<td width="198" bgcolor="#999999" style="color:#000">CCI</td>
<td width="24" bgcolor="#999999" style="color:#000">HAB</td>
<td width="169" bgcolor="#999999" style="color:#000">TITULAR</td>
<td width="80" bgcolor="#999999" style="color:#000">USUARIO</td>
<td width="16" bgcolor="#999999">&nbsp;</td>
</tr>

<?php
$s="SELECT * FROM vis_cuentas WHERE ID>0 ORDER BY BAN,NRO";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs=grs($s);
while($r=$rs->fetch_assoc()){
?>		
	<tr ondblclick="fActivar('<?php echo $r['ID'];?>');">
	<td bgcolor="#FFFFFF"><span class="s5"><?php echo $r['SYS_FEC_'];?></span></td>
	<td bgcolor="#FFFFFF"><span class="s5"><?php echo $r['BAN'];?></span></td>
	<td bgcolor="#FFFFFF"><span class="s5"><?php echo $r['TIP'];?></span></td>
	<td bgcolor="#FFFFFF" ><span class="s5"><?php echo $r['MND'];?></span></td>
	<td bgcolor="#FFFFFF" ><span class="s5"><?php echo $r['NRO'];?></span></td>
	<td bgcolor="#FFFFFF" ><span class="s5"><?php echo $r['CCI'];?></span></td>
	<td bgcolor="#FFFFFF" ><span class="s5"><?php echo $r['HAB'];?></span></td>
	<td bgcolor="#FFFFFF" ><span class="s5"><?php echo $r['TIT'];?></span></td>
	<td bgcolor="#FFFFFF"><span class="s5"><?php echo $r['USU'];?></span></td>
	<td bgcolor="#FFFFFF" 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    
}
?>	  

</table>
</div>
</div>
<div id="layer" style="position:absolute; left: 116px; top: 21px; width: 412px; height: 45px; z-index: 100;">
<div align="left" class="Estilo1">
<input name="POL_USU_PER_ELI" type="hidden" id="POL_USU_PER_ELI" value="<?php echo $POL_USU_PER_ELI;?>"/>

<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtAku" type="hidden" id="TxtAku" value="<?php echo $StrAku;?>" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<input name="FEC_SERVER" type="hidden" id="FEC_SERVER" value="<?php echo date("d-m-y");?>"/>  
<strong>CUENTAS</strong> </div>
</div>
<div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
<div align="left" class="Estilo1"><img src="img/marcas.gif" width="48" height="48" /></div>
</div>
<div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 1100px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
<div align="left" class="Estilo1">        
</div>
</div>
</div>
</center>	
</form>
</body>
</html>
