<?php $emisor=$_POST['emisor']; ?>
<?php $docu=$_POST['docu']; ?>
<?php $serie=$_POST['serie']; ?>
<?php $numero=$_POST['numero']; ?>
<?php $comp=$_POST['comprobante']; ?>

<?php

$cfg_empr='demo';
if($emisor=='0992968516001'){$cfg_empr='edsk';}
if($emisor=='0991209867001'){$cfg_empr='nsm1';}
if($emisor=='0790060288001'){$cfg_empr='inbo';}
if($emisor=='0991327258001'){$cfg_empr='gaec';}
if($emisor=='0992420502001'){$cfg_empr='japi';}
if($emisor=='0992178612001'){$cfg_empr='logu';}


chdir('../'.$cfg_empr.'/_lib');
include('../_cfg/config.php');
include('php_gene1.php');


$serie=fillzero($serie,6);
$numero=fillzero($numero,9);
$docu=strtoupper(substr($docu,0,1));



if($docu=='F'){$tabla='vtas1'; $docum='FC10';}
if($docu=='R'){$tabla='retp1'; $docum='RPRO';}
	

$sql_clave='select * from '.$tabla.' where docu like "'.$docu.'%" and ptoe="'.$serie.'" and numero="'.$numero.'" order by idnum1 desc';
$res_clave=mysql_query($sql_clave,$link_vcrx);
// echo explain_sql($sql_clave);
$clave=mysql_result($res_clave,0,'claveacc');

// $sql_xml2='select * from clac0 where clac_codigo="'.$clave.'"';
// $res_xml2=mysql_query($sql_xml2,$link_vcrx);
// $xml2=mysql_result($res_xml2,0,'')

$xml2=file_get_contents('../../_cel/'.$clave.'.xml');
echo $xml2;


?>