<?php 
session_start();
include('../cfg/cfg.php');
include('../cfg/res.php');
if(empty($_SESSION['user_vcrx_tipo']) || !isset($_SESSION['user_vcrx_tipo']))
{
	die('<a href="../salir.php">SU SESSION EXPIRO.</a>');
}

$pagina_descri='CUENTAS ';
$pagina_nivel;
$pagina_tipo;


?>

<!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><?php echo $empr_nombre .' - ' . $_SESSION['user_vcrx_descri'];?></title>
<link rel="stylesheet" href="http://vcrxol.com/css/ambiente.css"  type="text/css" />
<script type="text/javascript" src="../js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="../js/busca_maes.js"></script>
<style type="text/css">
body{background:#ffffff;}
.dper_txt{border:solid 1px #000000; border-radius:2px; padding:2px; margin:2px;}
.txt_adr{ width:100%;}
</style>
<script type="text/javascript">
<?php include('../../_js/busca_maes3.js');?>
<?php include('../../_js/lista_maes3.js');?>
<?php include('../../_js/fecha_format.js');?>

<?php if(isset($_GET['idx']) && !empty($_GET['idx'])){?>
<?php }?>

<?php if ( !mb_stristr('admi.sist.supe',strtolower($_SESSION['user_vcrx_tipo'])) ) {?>
<?php }?>
function _guarda(){
	document.getElementById('direc_error').innerHTML='';
	var codigo='<?php echo $_GET['idx'];?>';
	var descri=document.getElementById('cta_descri').value;
	var tipo=document.getElementById('cta_tipo').value;
	var status=document.getElementById('cta_status').value;
	var cair=document.getElementById('cta_cair').value;
	if(codigo==''){	alert('Error en carga de parametros'); return false;}

	$.ajax({
		cache:false,
		url:'../_lib/_linker.php',
		datatype: "text",
	    async:true,
		type:'POST',
		data:{script:'vrctas2.php',codigo:codigo,descri:descri,tipo:tipo,status:status,cair:cair,upd:'1'},
		beforeSend: function(jqXHR, textStatus){}, 
		success:function(data, textStatus, jqXHR){		
			document.getElementById('direc_error').innerHTML=data;
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if (jqXHR.status === 0) {
              alert('Sin Conexion: Verifique Red.');
			  location.href='../salir.php';
           } else if (jqXHR.status == 404) {
               console.log('Requested page not found [404]');
           } else if (jqXHR.status == 500) {
               console.log('Internal Server Error [500].');
           } else if (exception === 'parsererror') {
               console.log('Requested JSON parse failed.');
           } else if (exception === 'timeout') {
               alert('Servidor no Responde');
			   location.href='../salir.php';
           } else if (exception === 'abort') {
               console.log('Ajax request aborted.');
           } else {
               console.log('Uncaught Error: ' + jqXHR.responseText);
           }

		}, 
		 complete:function(jqXHR, textStatus){if(textStatus==='success'){}},
			timeout:90000
		});

}

</script>

</head>

<body>
<div align="center">
<div>
<div align="center"><?php include('../../_lib/cabecera2.php');?></div>
<?php 
$cta_sql='select *from ctas0 where ctas_codigo="'.$_GET['idx'].'"';

$cta_res=mysql_query($cta_sql,$link_vcrx);
if(mysql_num_rows($cta_res)==0 && !isset($_GET['idx']) || empty($_GET['idx'])){die('Parametro incorrecto');}
$cta_descri=mysql_result($cta_res,0,'ctas_descri');
$cta_tipo=mysql_result($cta_res,0,'ctas_tipo');
$cta_status=mysql_result($cta_res,0,'ctas_status');
$cta_cair=mysql_result($cta_res,0,'ctas_cair');

?>
<table border="0" cellpadding="2" cellspacing="0" style=" font-size:12px; font-weight:bolder;">
<tr>
	<td><input type="button" value="CODIGO" /></td>
    <td><input type="text" value="<?php echo $_GET['idx'];?>" disabled="disabled" /></td>
</tr>
<tr>
	<?php  $pcaption='DESCRIPCION'; $pidtxt='cta_descri'; $plong=30; $pdefa=$cta_descri;  include('vrgettxt.php'); ?>
</tr>
<tr>
	<?php  $pcaption='TIPO'; $pidtxt='cta_tipo'; $plong=6; $pdefa=$cta_tipo;  include('vrgettxt.php'); ?>
</tr>

<tr>
	<?php  $pcaption='STATUS'; $pidtxt='cta_status'; $plong=2; $pdefa=$cta_status; include('vrgettxt.php'); ?>
</tr>

<tr>
	<?php  $pcaption='CAIR'; $pidtxt='cta_cair'; $plong=6; $pdefa=$cta_cair; include('vrgettxt.php'); ?>
</tr>


</table>

<?php if(mb_stristr('admi.sist.supe',strtolower($_SESSION['user_vcrx_tipo']))){ ?> <?php }?>
<input type="button" value="Guardar"    onclick="_guarda();"    id="btn_g"/>
<input type="button" value="Limpiar"    onclick="_limpia('<?php if (mb_stristr('admi.sist.supe',strtolower($_SESSION['user_vcrx_tipo'])) ){echo '1';}?>');"    id="dper_btn_l"/>
<input type="image" width="20" src="http://vcrxol.com/_img/add_address.png" onclick="add_adr('<?php echo $_POST['ci'];?>');" style="display:none;" />

<div id="direc_error" style="height:20px; color:#F00;"></div>


	

<div id="direc_d"></div>


<?php		
// $xwidth=40;	
require('lista_car.php');
?>	

</div>
</div>

<input type="hidden" id="dper_hdd_ci" />
</body>
</html>