<?php 
session_start();
foreach($_GET as $key => $value){${$key}=trim(str_replace("'","\'",str_replace('"','\"',$value))); $_PARAMS[$key]=${$key};} 
foreach($_POST as $key => $value){${$key}=trim(str_replace("'","\'",str_replace('"','\"',$value))); $_PARAMS[$key]=${$key};} 

foreach($_POST as $campo => $valor)
{
}

include_once('lib_main.php');
if(!empty($empr)){$link_data=msql_connect('','','',$empr); $cfg_empr=$empr;}
$user_codigo=$_SESSION['user_codigo'];
$user0=data_maes('user',$user_codigo);

$dom = new DOMDocument();
     $dom->encoding = 'utf-8';
     $dom->xmlVersion = '1.0';
     $dom->formatOutput = true;

$error_save='';
$error_save2='';

$response=$dom->appendChild($dom->createElement("response"));
$msgswal=$response->appendChild($dom->createElement("msgswal")); 
$msgswal->setAttribute("id","msgswal");


$docu0=data_maes('docu',$docu);
$tabla=$docu0['docu_tabla'];
$tabla1=$tabla.'1';
$tabla2=$tabla.'2';

if(empty($tabla))
{$error_save='Docu tabla 1 - '.$docu;}

if($tabla=='vtas' or $tabla=='clie')
{
}    

if($tabla=='comp' or $tabla=='prov')
{
}    


if($tabla=='inve')
{
}


if($tabla=='guia')
{
}    



if(!empty($error_save2)){$error_save.=$error_save2;}

if(empty($error_save) and !empty($alert_save))
{
     $msgswal->appendChild($dom->createElement("icon","warning")); 
     $msgswal->appendChild($dom->createElement("title","Advertencia")); 
     $msgswal->appendChild($dom->createElement("text",$alert_save)); 
     $msgswal->appendChild($dom->createElement("timeout","10000")); 
}


if(!empty($error_save))
{
     $msgswal->appendChild($dom->createElement("icon","error")); 
     $msgswal->appendChild($dom->createElement("title","Error")); 
     $msgswal->appendChild($dom->createElement("text",$error_save)); 
}


echo $dom->saveXML();


if(!empty($docu) and !empty($idnum1))
{$claveacc=gen_clac($docu,$idnum1);}
     
     
?>
