<?php
include '../ConsumoApiMuniguadalupe/Conexion.php';
header("Content-Type: application/json; charset=UTF-8");

class Operaciones
{
	public function PA_ApiConsultaXml_PorTipo($obj){
	    $conn = new Conexion();
        $conn->Conectar();
        $conn->reiniciarArray();
        $conn->Parametro("@TipoRegistro", $obj['TipoRegistro']);
        $conn->Parametro("@Tipo", $obj['Tipo']);
        $conn->Parametro("@Doc", $obj['Doc']);
        $data = $conn->Procedimiento("dbo.PA_ApiConsultaXml_PorTipo");  
        
        $conn->Desconectar();
        return json_encode($data);
	}
}

$request = json_decode(file_get_contents('php://input'), true);

switch ($request['accion']) {
	case 'PA_ApiConsultaXml_PorTipo':
	    try{
		    $datos = $request['datos'];
        	$app = new Operaciones();
        	echo $app->PA_ApiConsultaXml_PorTipo($datos);
	    }catch (Exception $ex){
	        $data = ['rpta'=>'Error: '.$ex];
	        echo json_encode($data);
	    }
	    break;
}



