<?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='ASIGNA XML ';
$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%;}
.item1_{ width:100px;}
.item2_{ width:100px;}
.cant_{ width:50px; text-align:right;}
.dcto_{ width:50px; text-align:right;}
.ice_{ width:50px; text-align:right;}
.iva_{ width:50px; text-align:right;}
.puni_{ width:50px; text-align:right;}
</style>
<script type="text/javascript">
<?php include('../../_js/busca_maes3.js');?>
<?php include('../../_js/lista_maes3.js');?>
<?php include('../../_js/fecha_format.js');?>
function get_auto()
{
	var idx=document.getElementById('atrznume').value;
	document.getElementById('_asigna').innerHTML='';
	document.getElementById('_detalle').innerHTML='';
	document.getElementById('claveacc').value='';
	document.getElementById('docu').value='';
	document.getElementById('ptoe').value='';
	document.getElementById('numero').value='';
	document.getElementById('enti').value='';
	document.getElementById('fecha').value='';

	$.ajax({
		url:'asigna_xml3.php',
		async:true,
		cache:false, 
		type:'POST',
		data:{idx:idx},
		success: function(dato)
		{
			document.getElementById('_detalle').innerHTML=dato;
			document.getElementById('claveacc').value=document.getElementById('hdd_claveacc').value;
			document.getElementById('docu').value=document.getElementById('hdd_docu').value;
			document.getElementById('ptoe').value=document.getElementById('hdd_ptoe').value;
			document.getElementById('numero').value=document.getElementById('hdd_numero').value;
			document.getElementById('enti').value=document.getElementById('hdd_enti').value;
			document.getElementById('fecha').value=document.getElementById('hdd_fecha').value;
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if (jqXHR.status === 0) {document.getElementById('_detalle').innerHTML='Not connect: Verify Network.';}
           if (jqXHR.status == 404) {document.getElementById('_detalle').innerHTML='Requested page not found [404]';}
           if (jqXHR.status == 500) {document.getElementById('_detalle').innerHTML='Internal Server Error [500].';}
           if (exception === 'parsererror') {document.getElementById('_detalle').innerHTML='Requested JSON parse failed.';}
           if (exception === 'timeout') {document.getElementById('_detalle').innerHTML='Servidor no Responde';}
           if (exception === 'abort') {document.getElementById('_detalle').innerHTML='Ajax request aborted.';}
           //else {console.log('Uncaught Error: ' + jqXHR.responseText);}
		},
	    complete:function(jqXHR, textStatus){if(textStatus==='success'){}           },
	});



}
function get(e)
{
	if(e.keyCode==13){get_auto();}
}

function asig_cod(idx,e)
{
	if(e.keyCode==13)
	{
		busca_maes2('item',document.getElementById(idx).value,idx,idx+'_descri','');	
		document.getElementById(idx).title=document.getElementById(idx+'_descri').innerHTML;
	}

}
function asig_cue(idx,e)
{
	if(e.keyCode==13)
	{
		busca_maes2('ctas',document.getElementById(idx).value,idx,idx+'_descri','');	
		document.getElementById(idx).title=document.getElementById(idx+'_descri').innerHTML;
	}

}

function _guarda(idx,idx2)
{
	var item1=document.getElementById('item1_'+idx2).value;
	var ctas=document.getElementById('ctas_'+idx2).value;
	document.getElementById('_asigna').innerHTML='';
	$.ajax({
		url:'asigna_xml2.php',
		async:true,
		cache:false, 
		type:'POST',
		data:{idx:idx,idx2:idx2,item1:item1,ctas:ctas},
		success: function(dato)
		{
			document.getElementById('_asigna').innerHTML=dato;
	
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if (jqXHR.status === 0) {document.getElementById('_asigna').innerHTML='Not connect: Verify Network.';}
           if (jqXHR.status == 404) {document.getElementById('_asigna').innerHTML='Requested page not found [404]';}
           if (jqXHR.status == 500) {document.getElementById('_asigna').innerHTML='Internal Server Error [500].';}
           if (errorThrown === 'parsererror') {document.getElementById('_asigna').innerHTML='Requested JSON parse failed.';}
           if (errorThrown === 'timeout') {document.getElementById('_asigna').innerHTML='Servidor no Responde';}
           if (errorThrown === 'abort') {document.getElementById('_asigna').innerHTML='Ajax request aborted.';}
           
		},
	    complete:function(jqXHR, textStatus){if(textStatus==='success'){}           },
	});
	

}

</script>

</head>

<body>
<div align="center">
<div>
<div align="center"><?php include('../../_lib/cabecera2.php');?></div>

<table border="0" width="100%" cellpadding="4" cellspacing="0" style="font-size:12px;" >
<tr valign="top">
<td><input type="button" value="AUTORIZACION" /></td>
<td><input type="text" id="atrznume" onkeypress="get(event);"  /><span id="atrznume_descri"></span></td>
</tr>

<tr valign="top">
<td><input type="button" value="CLAVE" /></td>
<td><input type="text" id="claveacc" /><span id="claveacc_descri"></span></td>
</tr>


<tr valign="top">
<td><input type="button" value="DOCUMENTO" /></td>
<td><input type="text" id="docu" /><span id="docu_descri"></span></td>
</tr>

<tr valign="top">
<td><input type="button" value="PTOE" /></td>
<td><input type="text" id="ptoe" /><span id="ptoe_descri"></span></td>
</tr>

<tr valign="top">
<td><input type="button" value="NUMERO" /></td>
<td><input type="text" id="numero" /><span id="numero_descri"></span></td>
</tr>

<tr valign="top">
<td><input type="button" value="PROVEEDOR" /></td>
<td><input type="text" id="enti" /><span id="enti_descri"></span></td>
</tr>

<tr valign="top">
<td><input type="button" value="FECHA" /></td>
<td><input type="text" id="fecha" /><span id="fecha_descri"></span></td>
</tr>




</table>

<div id="_asigna"></div>
<div id="_detalle"></div>
</div>
</div>


</body>
</html>