<?php session_start();
require('../cfg/cfg.php');
require('../cfg/res.php');
include('php_gene1.php');
?>
<!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_id'];?> - Generar Contabilidad</title>
<link rel="stylesheet" href="http://vcrxol.com/_css/comun.css" type="text/css" />
<link rel="stylesheet" href="../css/comun2.css" type="text/css" />

<script type="text/javascript" src="../js/jquery-1.11.1.js"></script>
<script type="text/javascript">

<?php include('../../_js/busca_ficha.js');?>

<?php include('../../_js/busca_maes3.js');?>
<?php include('../../_js/lista_maes3.js');?>
<?php include('../../_js/fecha_format.js');?>
<?php include('../../_js/js_gene1.js');?>
<?php //include('js_gene1.js');?>

	
function _fecha(e,idfec)
{
//if(e.keyCode==9 || e.keyCode==13)
	if(e.keyCode==13)
	{
		var fn=document.getElementById(idfec).value;
		fn=fecha_format(fn);
		document.getElementById(idfec).value=fn;
	}
}
	
	
function docu_key(e)
{
		var docux=document.getElementById('docu').value;
		
		if(docux=='' || docux==' ')
		{
			return false;
		}
	
		if(e.keyCode==13)
		{
			docu_();	
		}
		
}
function docu_()
{
	busca_maes2('docu',document.getElementById('docu').value,'docu','docu_descri','');
}

function gene_inve()
{
	if(document.getElementById('modu').value=='' && document.getElementById('docu').value=='')
	{
		return false;
	}

// 	var data = new FormData();
	
	var data=new_FormData();
	var error='ext_error';
	var modu=document.getElementById('modu').value;
	var docu=document.getElementById('docu').value;
	var fini=document.getElementById('fini').value;
	var ffin=document.getElementById('ffin').value;
	var nini=document.getElementById('nini').value;
	var nfin=document.getElementById('nfin').value;
	var contab=document.getElementById('contab').value;
// document.body.style.cursor='wait';
document.getElementById('ext_error').innerHTML='Procesando...';
document.getElementById('ext_list').innerHTML='';
// document.getElementById('btn_gene').disabled=true;
// 		data:{modu:modu,docu:docu,fini:fini,ffin:ffin,nini:nini,nfin:nfin,contab:contab}, 

	var _urlinker='vrgenecontab2.php';	
	
	
		$.ajax({
		cache:false,
		url:_urlinker,
		datatype: "text",
	  async:true,
		type:'POST',
		data:data, 
		contentType:false,
		processData:false,
    	beforeSend: function(jqXHR, textStatus)
		{
		}, 
		success:function(dato, textStatus, jqXHR)
		{
     	document.body.style.cursor='auto';
      document.getElementById('ext_error').innerHTML='';
      document.getElementById('ext_list').innerHTML=dato;
//                        document.getElementById('btn_gene').disabled=false;

			console.log(dato);
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if(document.getElementById(error))
		   {
				
				document.getElementById(error).innerHTML='';
				if (jqXHR.status === 0) {
				document.getElementById(error).innerHTML='Not connect: Verify Network.';
				} else if (jqXHR.status == 404) {
				document.getElementById(error).innerHTML='Requested page not found [404]';
				} else if (jqXHR.status == 500) {
				document.getElementById(error).innerHTML='Internal Server Error [500].';
				} else if (exception === 'parsererror') {
				document.getElementById(error).innerHTML='Requested JSON parse failed.';
				} else if (exception === 'timeout') {
				document.getElementById(error).innerHTML='Servidor no Responde';
				} else if (exception === 'abort') {
				document.getElementById(error).innerHTML='Ajax request aborted.';
				} else {
				document.getElementById(error).innerHTML='Uncaught Error: ' + jqXHR.responseText;
				}
		   }
		   else
		   {
			
				if (jqXHR.status === 0) {
	              console.log('Not connect: Verify Network.');
		           } 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');
		           } else if (exception === 'abort') {
	               console.log('Ajax request aborted.');
		           } else {
	               console.log('Uncaught Error: ' + jqXHR.responseText);
           			}
			
			}
		   

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

}



</script>

</head>

<body>
<div align="center" >
	<div align="left" style="">
<table width="100%">
	<tr>
    	<td>
			<a href="http://<?php echo $empr_codigo;?>.vcrxol.com/main/" title="INICIO" ><img src="http://vcrxol.com/_logo/logo<?php echo $empr_codigo;?>1.png" width="190"/></a>		</td>
        <td>
	        <div style="font-size:18px; font-weight:bolder;  margin:0px 0px 0px 5px; padding:0px 0px 0px 5px; width:300px;border-bottom:#09c solid 2px;" align="left">GENERAR CONTABILIDAD</div>
        </td>
        <td  align="right"><span style="font-weight:bolder;"><?php echo $_SESSION['user_vcrx_descri'];?></span>&nbsp;</td>
    	<td width="70"  align="right"><input type="image" src="http://vcrxol.com/_img/salir.png"  title="Salir" onclick="if(confirm('Esta Seguro que Desea Salir?')){window.location.href ='../salir.php';}" style="border:none;"/>&nbsp;</td>
    </tr>
</table>
		
		
		
		
		
<table>
<th width="20%">
	<table><caption>FILTROS</caption>	
	<tr>
		<?php $pcaption='MODU';  $ptabla='modu'; include('vrgetcod.php'); ?>
		</tr>	
	<tr>
		<?php $pcaption='DOCU';  $ptabla='docu'; $pnotob=1;include('vrgetcod.php'); ?>
	</tr>	
	</table>
</th>

	
	
<th width="20%">
<table><caption>FECHAS</caption>	
	<tr>
		<?php $pcaption='inicial';  $pidtxt='fini'; $pdefa=$xfecha1; $pobj=3; include('vrgetfec.php'); ?>
	</tr>
	<tr>
		<?php $pcaption='final';  $pidtxt='ffin'; $pdefa=$xfecha2; $pobj=3; include('vrgetfec.php'); ?>
	</tr>
</table>
</th>

<th width="20%">
	<table><caption>NUMEROS</caption>	
	<tr>
		<?php $pcaption='Desde';  $pidtxt='nini'; $pdefa='000000001'; $pobj=3; include('vrgetnum.php'); ?>
	</tr>
	<tr>
		<?php $pcaption='Hasta';  $pidtxt='nfin'; $pdefa='999999999'; $pobj=3; include('vrgetnum.php'); ?>
	</tr>
	</table>
</th>

<th width="20%">
	<table>
	<tr>
		<?php $pcaption='ENTIDAD';  $ptabla='enti'; $pnotob=1; include('vrgetcod.php'); ?>
	</tr>	
	<tr>
	<?php $pcaption='Contabilizar'; $pidtxt='contab'; $poptions="1,SOLO NUEVOS;2,TODOS"; $ponclick='gene_inve();'; include('vrselopt.php'); ?>
	</tr>
<!-- 	<input type="button" id="btn_gene" onclick="gene_inve();" value="Generar" class="btn" style="cursor:pointer;" /> -->
	<tr>
	<td>
	<?php //$pcaption='Contabilizar'; $ponclick='gene_inve();';  include('vrbutton.php'); ?>
	</td>
	</tr>
	</table>
</th>
</table>

	<?php	require('lista_car.php'); ?>	

<div id="ext_error"></div>
<div id="ext_list"></div>
</div>
</div>

<div id="mensaje3">
	
	</div>	
</body>
</html>


