Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $page_from = $_SERVER['PHP_SELF'];
- // include ("include/allfunc/checklogin.php");
- // include ("include/allfunc/conexion.php");
- // include ("include/allfunc/funciones.php");
- // include ("include/allfunc/num2letters.php");
- define ("WSSA_WSDL", "/tmp/wssa-file.wsdl"); # The WSDL corresponding to WSAA
- define ("WSFEv1_WSDL", "/tmp/wsfev1-file.wsdl"); # The WSDL corresponding to WSFEV1
- class WSCommons
- {
- public function WSCOMM_ObjToArr($data)
- {
- $this->Dat = $data;
- if (is_array($this->Dat) || is_object($this->Dat))
- {
- $this->result = array();
- foreach ($this->Dat as $this->key => $this->value)
- {
- $this->result[$this->key] = $this->WSCOMM_ObjToArr($this->value);
- }
- return $this->result;
- }
- return $this->Dat;
- }
- }
- class WSSAFE extends WSCommons
- {
- public $wssaNroUnico;
- public $wssaCodEmp;
- public $wssaTipoParametro;
- public $wssaServicio;
- public $wssaWSDL;
- public $wssaCERT;
- public $wssaPrivateKey;
- public $wssaPassPhrase;
- public $wssaProxyHost;
- public $wssaProxyPort;
- public $wssaURL;
- public $wssaSOAPVersion;
- public $wssaSOAPTrace;
- public $wssaSOAPExceptions;
- public $wssaBaja;
- public $wssaFechaBaja;
- public $wssaAuthFE = array();
- public $wssaTRA;
- public $wssaTRAStatus;
- public $wssaTRAFile = "/tmp/TRA.xml";
- public $wssaTRAInFile = "/tmp/TRA.xml";
- public $wssaTRAOutFile = "/tmp/TRA.tmp";
- public $wssaTRAErrors = array();
- public $wssaTRACMS;
- public $wssaTRAResults;
- public $wssaTRARequest;
- public $wssaTRAResponse2 = array('source'=>'','destination'=>'','uniqueid'=>'','generationtime'=>'','expirationtime'=>'','token'=>'','sign'=>'',);
- public $wssaTRAResult;
- public $wssaGetLastRequest = "/tmp/request-loginCms.xml";
- public $wssaGetLastResponse = "/tmp/response-loginCms.xml";
- function __construct()
- {
- $this->wssaTRAResponse = array('source'=>'','destination'=>'','uniqueid'=>'','generationtime'=>'','expirationtime'=>'','token'=>'','sign'=>'',);
- }
- /*
- function WSSAFE()
- {
- $this->wssaNroUnico = 0;
- $this->wssaCodEmp = 0;
- $this->wssaTipoParametro = '';
- $this->wssaServicio = '';
- $this->wssaWSDL = '';
- $this->wssaCERT = '';
- $this->wssaPrivateKey = '';
- $this->wssaPassPhrase = '';
- $this->wssaProxyHost = '';
- $this->wssaProxyPort = '';
- $this->wssaURL = '';
- $this->wssaSOAPVersion = '';
- $this->wssaSOAPTrace = '';
- $this->wssaSOAPExceptions = '';
- $this->wssaBaja = '';
- $this->wssaFechaBaja = '';
- $this->wssaAuthFE = array();
- $this->wssaTRA = '';
- $this->wssaTRAStatus = '';
- $this->wssaTRAFile = "/tmp/TRA.xml";
- $this->wssaTRAInFile = "/tmp/TRA.xml";
- $this->wssaTRAOutFile = "/tmp/TRA.tmp";
- $this->wssaTRAErrors = array();
- $this->wssaTRACMS = '';
- $this->wssaTRAResults = '';
- $this->wssaTRARequest = '';
- $this->wssaTRAResponse = array();
- $this->wssaTRAResult = '';
- $this->wssaGetLastRequest = "/tmp/request-loginCms.xml";
- $this->wssaGetLastResponse = "/tmp/response-loginCms.xml";
- }
- public function __construct()
- {
- $this->wssaNroUnico = 0;
- $this->wssaCodEmp = 0;
- $this->wssaTipoParametro = '';
- $this->wssaServicio = '';
- $this->wssaWSDL = '';
- $this->wssaCERT = '';
- $this->wssaPrivateKey = '';
- $this->wssaPassPhrase = '';
- $this->wssaProxyHost = '';
- $this->wssaProxyPort = '';
- $this->wssaURL = '';
- $this->wssaSOAPVersion = '';
- $this->wssaSOAPTrace = '';
- $this->wssaSOAPExceptions = '';
- $this->wssaBaja = '';
- $this->wssaFechaBaja = '';
- $this->wssaAuthFE = array();
- $this->wssaTRA = '';
- $this->wssaTRAStatus = '';
- $this->wssaTRAFile = "/tmp/TRA.xml";
- $this->wssaTRAInFile = "/tmp/TRA.xml";
- $this->wssaTRAOutFile = "/tmp/TRA.tmp";
- $this->wssaTRAErrors = array();
- $this->wssaTRACMS = '';
- $this->wssaTRAResults = '';
- $this->wssaTRARequest = '';
- $this->wssaTRAResponse;
- $this->wssaTRAResult = '';
- $this->wssaGetLastRequest = "/tmp/request-loginCms.xml";
- $this->wssaGetLastResponse = "/tmp/response-loginCms.xml";
- }
- */
- /*
- public $wssaNroUnico;
- public $wssaCodEmp;
- public $wssaTipoParametro;
- public $wssaServicio;
- public $wssaWSDL;
- public $wssaCERT;
- public $wssaPrivateKey;
- public $wssaPassPhrase;
- public $wssaProxyHost;
- public $wssaProxyPort;
- public $wssaURL;
- public $wssaSOAPVersion;
- public $wssaSOAPTrace;
- public $wssaSOAPExceptions;
- public $wssaBaja;
- public $wssaFechaBaja;
- public $wssaAuthFE = array();
- public $wssaTRA;
- public $wssaTRAStatus;
- public $wssaTRAFile = "/tmp/TRA.xml";
- public $wssaTRAInFile = "/tmp/TRA.xml";
- public $wssaTRAOutFile = "/tmp/TRA.tmp";
- public $wssaTRAErrors = array();
- public $wssaTRACMS;
- public $wssaTRAResults;
- public $wssaTRARequest;
- public $wssaTRAResponse = array();
- public $wssaTRAResult;
- public $wssaGetLastRequest = "/tmp/request-loginCms.xml";
- public $wssaGetLastResponse = "/tmp/response-loginCms.xml";
- */
- public function WSSA_getParamFE()
- {
- $this->query = 'SELECT * FROM tbl_DetParametrosFE WHERE CodEmp="' . $_SESSION['codemp'] . '" AND SERVICIO="wsaa"' ;
- $this->res = query($this->query);
- $this->nor = query_num_rows($this->res);
- if($this->nor > 0)
- {
- while($this->row=query_fetch_object($this->res))
- {
- $this->wssaNroUnico = trim($this->row->NROUNICO);
- $this->wssaCodEmp = trim($this->row->CODEMP);
- $this->wssaTipoParametro = trim($this->row->TIPOPARAMETRO);
- //$this->wssaServicio = trim($this->row->SERVICIO);
- $this->wssaServicio = 'wsfe';
- $this->wssaWSDL = trim($this->row->WSDL);
- //file_put_contents("wssa-file.wsdl",$this->wssaWSDL);
- file_put_contents(WSSA_WSDL,$this->wssaWSDL);
- $this->wssaCERT = trim($this->row->CERT);
- $this->wssaPrivateKey = trim($this->row->PRIVATEKEY);
- $this->wssaPassPhrase = trim($this->row->PASSPHRASE);
- $this->wssaProxyHost = trim($this->row->PROXYHOST);
- $this->wssaProxyPort = trim($this->row->PROXYPORT);
- $this->wssaURL = trim($this->row->URL);
- $this->wssaSOAPVersionStr = trim($this->row->SOAP_VERSION);
- if($this->wssaSOAPVersionStr == 'SOAP_1_2')
- {
- $this->wssaSOAPVersion = 2;
- }else
- {
- $this->wssaSOAPVersion = 1;
- }
- $this->wssaSOAPTrace = trim($this->row->SOAP_TRACE);
- $this->wssaSOAPExceptions = trim($this->row->SOAP_EXCEPTIONS);
- $this->wssaBaja = trim($this->row->BAJA);
- $this->wssaFechaBaja = trim($this->row->FECHABAJA);
- }
- }
- }
- public function WSSA_Connect()
- {
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSSA_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSSA_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- }
- public function WSSA_CreateTRA()
- {
- $this->WSSA_getParamFE();
- $this->TRA = new SimpleXMLElement(
- '<?xml version="1.0" encoding="UTF-8"?>' .
- '<loginTicketRequest version="1.0">'.
- '</loginTicketRequest>');
- $this->TRA->addChild('header');
- // $TRA->header->addChild('source','C=AR, O=BUNAR SRL, serialNumber=CUIT 20265665250, CN=demo-admin.geryon.com.ar');
- // $TRA->header->addChild('destination','CN=wsaahomo,O=AFIP, C=ar,serialNumber=CUIT 33693450239');
- $this->TRA->header->addChild('uniqueId',date('U'));
- $this->TRA->header->addChild('generationTime',date('c',date('U')-600));
- $this->TRA->header->addChild('expirationTime',date('c',date('U')+600));
- $this->TRA->addChild('service',$this->wssaServicio);
- $this->TRA->asXML($this->wssaTRAFile);
- }
- public function WSSA_SignTRA()
- {
- $this->wssaTRAStatus=openssl_pkcs7_sign($this->wssaTRAInFile, $this->wssaTRAOutFile, $this->wssaCERT,
- array($this->wssaPrivateKey, $this->wssaPassPhrase),
- array(),
- !PKCS7_DETACHED
- );
- if(!$this->wssaTRAStatus)
- {
- $this->wssaTRAErrors['WSSA_SignTRA:PKCS7'] = 'Se ha producido un error generando la firma PKCS#7';
- }else
- {
- $this->wssaTRAErrors['WSSA_SignTRA:PKCS7'] = 'OK';
- $inf=fopen($this->wssaTRAOutFile, "r");
- $i=0;
- $this->wssaTRACMS="";
- while (!feof($inf))
- {
- $buffer=fgets($inf);
- if ( $i++ >= 4 ) {$this->wssaTRACMS.=$buffer;}
- }
- fclose($inf);
- unlink($this->wssaTRAInFile);
- unlink($this->wssaTRAOutFile);
- return $this->wssaTRACMS;
- }
- }
- public function WSSA_CallWSAA()
- {
- if($this->wssaProxyHost == '' || $this->wssaProxyHost == NULL)
- {
- $this->wssaTRA=new SoapClient(WSSA_WSDL, array(
- 'soap_version' => $this->wssaSOAPVersion,
- 'location' => $this->wssaURL,
- 'trace' => $this->wssaSOAPTrace,
- 'exceptions' => $this->wssaSOAPExceptions
- ));
- }else
- {
- $this->wssaTRA=new SoapClient(WSSA_WSDL, array(
- 'proxy_host' => $this->wssaProxyHost,
- 'proxy_port' => $this->wssaProxyPort,
- 'soap_version' => $this->wssaSOAPVersion,
- 'location' => $this->wssaURL,
- 'trace' => $this->wssaSOAPTrace,
- 'exceptions' => $this->wssaSOAPExceptions
- ));
- }
- // var_dump($this->wssaTRA->__getFunctions());
- $this->wssaTRAResults=$this->wssaTRA->loginCms(array('in0'=>$this->wssaTRACMS));
- // $this->wssaTRARequest = $this->wssaTRA->__getLastRequest();
- // $this->wssaTRAResponse = $this->wssaTRA->__getLastResponse();
- // echo "asdasdas";
- // print_r($this->wssaTRAResults);
- file_put_contents($this->wssaGetLastRequest,$this->wssaTRA->__getLastRequest());
- file_put_contents($this->wssaGetLastResponse,$this->wssaTRA->__getLastResponse());
- if (is_soap_fault($this->wssaTRAResults))
- {
- $this->wssaTRAErrors['WSSA_CallWSAA:Code'] = $this->wssaTRAResults->faultcode;
- $this->wssaTRAErrors['WSSA_CallWSAA:Dsc'] = $this->wssaTRAResults->faultstring;
- }else
- {
- $this->wssaTRAErrors['WSSA_CallWSAA:Code'] = 'OK';
- $this->wssaTRAErrors['WSSA_CallWSAA:Dsc'] = '';
- }
- return $this->wssaTRAResults->loginCmsReturn;
- }
- public function WSSA_getTicket()
- {
- echo "5<br/>";
- var_dump($this->wssaTRAResponse);
- echo "6<br/>";
- print_r($this->wssaTRAResponse);
- $this->WSSA_CreateTRA();
- $this->wssaTRACMS = $this->WSSA_SignTRA();
- $this->TA=$this->WSSA_CallWSAA();
- //print_r($this->TA);
- $this->p = xml_parser_create();
- xml_parse_into_struct($this->p, $this->TA, $this->vals2, $this->index2);
- xml_parser_free($this->p);
- //echo "<pre><br>";
- //$this->responseARR = array();
- foreach($this->vals2 as $this->k=>$this->l)
- {
- if($this->k==2){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['source'] = $this->n;}}}
- if($this->k==4){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['destination'] = $this->n;}}}
- if($this->k==6){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['uniqueid'] = $this->n;}}}
- if($this->k==8){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['generationtime'] = $this->n;}}}
- if($this->k==10){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['expirationtime'] = $this->n;}}}
- if($this->k==15){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['token'] = $this->n;}}}
- if($this->k==17){foreach ($this->l as $this->m=>$this->n){if($this->m == 'value'){$this->wssaTRAResponse['sign'] = $this->n;}}}
- //echo $k;
- }
- //print_r($this->wssaTRAResponse);
- //echo "</pre><br>";
- }
- public function WSSA_activateTicket()
- {
- //$this->WSSA_showTicket();
- // echo "1<br/>";
- // var_dump($this->wssaTRAFile);
- echo "VARIABLE VACÍA<br/>";
- var_dump($this->wssaTRAResponse);
- echo "VARIABLE VACÍA CON PRINT_R<br/>";
- print_r($this->wssaTRAResponse);
- //$this->cant = count($this->wssaTRAResponse);
- //echo $this->cant."<br/>";
- echo "asdasd<br/>";
- if($this->wssaTRAResponse['generationtime'] == '')
- {
- //echo "COMO LA VARIABLE ESTÁ VACÍA PARA ESE ÍNDICE DEL ARRAY LLAMO A LA FUNCIÓN getTicket(). (en realidad debería de mirar count($array) PERO NO FUNCIONÓ";
- $this->WSSA_getTicket();
- }
- //echo "4-PUEDO ACCEDER A ESTA VARIABLE<br/>SI EJECUTO ESTE CÓDIGO NUEVAMENTE SE SUPONE QUE NO TIENE QUE LLAMAR NUEVAMENTE A LA FUNCIÓN getTicket() PORQUE YA ACUTLIZÓ LOS DATOS, SIN EMBARGO ESTÁ VACÍA";
- print_r($this->wssaTRAResponse);
- //return $this->TicketActive;
- }
- public function WSSA_showTicket()
- {
- //print_r($this->wssaTRAResponse);
- return $this->wssaTRAResponse;
- }
- public function WSSA_activateTicket2()
- {
- //$this->WSSA_showTicket();
- var_dump($this->wssaTRAFile);
- var_dump($this->wssaTRAResponse);
- print_r($this->wssaTRAResponse);
- //$this->cant = count($this->wssaTRAResponse);
- //echo $this->cant."<br/>";
- if($this->cant == 0)
- {
- $this->WSSA_getTicket();
- }
- print_r($this->wssaTRAResponse);
- //return $this->TicketActive;
- }
- }
- class FEv1 extends WSSAFE
- {
- /*
- IMPLEMENTACIÓN DEL WEBSERVICES DE FACTURACIÓN ELECTRÓNICA DE AFIP
- VERSIÓN DE LA CLASE: v1
- VERSIÓN DEL APLICATIVO: v2.6
- */
- //var $wsfev1TRA;
- var $wsfev1NroUnico;
- var $wsfev1CodEmp;
- var $wsfev1TipoParametro;
- var $wsfev1Servicio;
- var $wsfev1WSDL;
- var $wsfev1CERT;
- var $wsfev1PrivateKey;
- var $wsfev1PassPhrase;
- var $wsfev1ProxyHost;
- var $wsfev1ProxyPort;
- var $wsfev1URL;
- var $wsfev1SOAPVersion;
- var $wsfev1SOAPTrace;
- var $wsfev1SOAPExceptions;
- var $wsfev1Baja;
- var $wsfev1FechaBaja;
- var $wsfev1AuthFE = array();
- var $wsfev1TRA;
- var $wsfev1TRAStatus;
- var $wsfev1TRAFile = "/tmp/wsfev1-TRA.xml";
- var $wsfev1TRAInFile = "/tmp/wsfev1-TRA.xml";
- var $wsfev1TRAOutFile = "/tmp/wsfev1-TRA.tmp";
- var $wsfev1TRAErrors = array();
- var $wsfev1TRACMS;
- var $wsfev1TRAResults;
- var $wsfev1TRARequest;
- var $wsfev1TRAResponse = array();
- var $wsfev1TRAResult;
- var $wsfev1TRAConceptoTipo = array();
- var $wsfev1TRACbteTipo = array();
- var $wsfev1TRADocTipo = array();
- var $wsfev1TRAIvaTipo = array();
- var $wsfev1TRAMoneda = array();
- var $wsfev1TRAOpcionalTipo = array();
- var $wsfev1TRATributoTipo = array();
- var $wsfev1TRAPtoVenta = array();
- var $wsfev1TRARegXReq = array();
- var $wsfev1TRAPaisTipo = array();
- var $wsfev1TRAFEDummyResult = array();
- private function WSFEv1_getParamFE()
- {
- //MÉTODO: Obtengo los parámetros necesarios para poder establecer una comunicación SOAP
- $this->query = 'SELECT * FROM tbl_DetParametrosFE WHERE CodEmp="' . $_SESSION['codemp'] . '" AND SERVICIO="wsfev1"' ;
- $this->res = query($this->query);
- $this->nor = query_num_rows($this->res);
- if($this->nor > 0)
- {
- while($this->row=query_fetch_object($this->res))
- {
- $this->wsfev1NroUnico = trim($this->row->NROUNICO);
- $this->wsfev1CodEmp = trim($this->row->CODEMP);
- $this->wsfev1TipoParametro = trim($this->row->TIPOPARAMETRO);
- //$this->wsfev1Servicio = trim($this->row->SERVICIO);
- $this->wsfev1Servicio = 'wsfe';
- $this->wsfev1WSDL = trim($this->row->WSDL);
- //file_put_contents("wsfev1-file.wsdl",utf8_encode($this->wsfev1WSDL));
- file_put_contents(WSFEv1_WSDL,utf8_encode($this->wsfev1WSDL));
- $this->wsfev1CERT = trim($this->row->CERT);
- $this->wsfev1PrivateKey = trim($this->row->PRIVATEKEY);
- $this->wsfev1PassPhrase = trim($this->row->PASSPHRASE);
- $this->wsfev1ProxyHost = trim($this->row->PROXYHOST);
- $this->wsfev1ProxyPort = trim($this->row->PROXYPORT);
- $this->wsfev1URL = trim($this->row->URL);
- $this->wsfev1SOAPVersionStr = trim($this->row->SOAP_VERSION);
- if($this->wsfev1SOAPVersionStr == 'SOAP_1_2')
- {
- $this->wsfev1SOAPVersion = 2;
- }else
- {
- $this->wsfev1SOAPVersion = 1;
- }
- $this->wsfev1SOAPTrace = trim($this->row->SOAP_TRACE);
- $this->wsfev1SOAPExceptions = trim($this->row->SOAP_EXCEPTIONS);
- $this->wsfev1Baja = trim($this->row->BAJA);
- $this->wsfev1FechaBaja = trim($this->row->FECHABAJA);
- }
- }
- }
- public function WSFEv1_ObternerParamCodTposCpbtes()
- {
- //MÉTODO: FEParamGetTiposCbte
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->AuthARR = array('Auth' => array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- );
- //print_r($this->AuthARR);
- $this->CbteTipoARR = $this->wsfev1TRA->FEParamGetTiposCbte($this->AuthARR);
- /*
- $this->CbteTipoARR = $this->wsfev1TRA->FEParamGetTiposCbte(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- */
- $this->b = 0;
- foreach ($this->CbteTipoARR as $this->CbteTipo=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRACbteTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRACbteTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- echo '<pre>';
- print_r($this->wsfev1TRACbteTipo);
- echo '</pre>';
- //print_r($this->wsfev1TRACbteTipo);
- }
- public function WSFEv1_ObternerParamCodTposConceptos()
- {
- //MÉTODO: FEParamGetTiposConcepto
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->ConceptosARR = $this->wsfev1TRA->FEParamGetTiposConcepto(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->ConceptosARR as $this->Concepto=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRAConceptoTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRAConceptoTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- }
- public function WSFEv1_ObternerParamCodTposDocs()
- {
- //MÉTODO: FEParamGetTiposDoc
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->DocTipoARR = $this->wsfev1TRA->FEParamGetTiposDoc(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->DocTipoARR as $this->DocTipo=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRADocTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRADocTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- echo '<pre>';
- print_r($this->DocTipoARR);
- echo '</pre>';
- }
- public function WSFEv1_ObternerParamCodTposAlic()
- {
- //MÉTODO: FEParamGetTiposIVA
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->IvaTipoARR = $this->wsfev1TRA->FEParamGetTiposIVA(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->IvaTipoARR as $this->IvaTipo=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRAIvaTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRAIvaTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- print_r($this->wsfev1TRAIvaTipo);
- }
- public function WSFEv1_ObternerParamCodTposMonedas()
- {
- //MÉTODO: FEParamGetTiposMonedas
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->MonedaARR = $this->wsfev1TRA->FEParamGetTiposMonedas(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->MonedaARR as $this->Moneda=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- $this->wsfev1TRAMoneda[$this->b] = array();
- foreach($this->k as $this->n=>$this->o)
- {
- $this->wsfev1TRAMoneda[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- public function WSFEv1_ObternerParamCodTposDatOpc()
- {
- //MÉTODO: FEParamGetTiposOpcional
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->OpcionalTipoARR = $this->wsfev1TRA->FEParamGetTiposOpcional(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->OpcionalTipoARR as $this->OpcionalTipo=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRAOpcionalTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRAOpcionalTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- }
- public function WSFEv1_ObternerParamCodTposTribut()
- {
- //MÉTODO: FEParamGetTiposTributos
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->TributoTipoARR = $this->wsfev1TRA->FEParamGetTiposTributos(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->TributoTipoARR as $this->TributoTipo=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRATributoTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRATributoTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- print_r($this->wsfev1TRATributoTipo);
- }
- public function WSFEv1_ObternerParamCodPtosVT()
- {
- //MÉTODO: FEParamGetPtosVenta
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->PtoVentaARR = $this->wsfev1TRA->FEParamGetPtosVenta(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->PtoVentaARR as $this->PtoVenta=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRAPtoVenta[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRAPtoVenta[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- }
- //OJO, NO FUNCIONA ESTE MÉTODO
- public function WSFEv1_ObternerParamCotMoneda()
- {
- //MÉTODO: FEParamGetCotizacion
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->PtoVentaARR = $this->wsfev1TRA->FEParamGetCotizacion(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- print_r($this->PtoVentaARR);
- foreach ($this->PtoVentaARR as $this->PtoVenta=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRAPtoVenta[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRAPtoVenta[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- print_r($this->wsfev1TRAPtoVenta);
- }
- public function WSFEv1_DUMMYMethod()
- {
- //MÉTODO: FEDummy
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->FEDummyResultARR = $this->wsfev1TRA->FEDummy();
- $this->b = 0;
- foreach ($this->FEDummyResultARR as $this->FEDummyResult=>$this->c)
- {
- $this->wsfev1TRAFEDummyResult[$this->b] = array();
- foreach($this->c as $this->n=>$this->o)
- {
- $this->wsfev1TRAFEDummyResult[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- public function WSFEv1_ObternerParamUltNroAutorizado($PtoVta, $CpbteTipo)
- {
- //MÉTODO: FECompUltimoAutorizado
- $this->WSFEv1_getParamFE();
- $this->PtoVta = $PtoVta;
- $this->CpbteTipo = $CpbteTipo;
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->PtoVentaARR = $this->wsfev1TRA->FECompUltimoAutorizado
- (
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- ),
- 'PtoVta' => $this->PtoVta,
- 'CbteTipo' => $this->CpbteTipo)
- );
- $this->b = 0;
- foreach ($this->PtoVentaARR as $this->PtoVenta=>$this->c)
- {
- $this->wsfev1TRAPtoVenta[$this->b] = array();
- foreach($this->c as $this->n=>$this->o)
- {
- $this->wsfev1TRAPtoVenta[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- public function WSFEv1_ObternerParamCantMaxRegTotXReq()
- {
- //MÉTODO: FECompTotXRequest
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->RegXReqARR = $this->wsfev1TRA->FECompTotXRequest(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->RegXReqARR as $this->RegXReq=>$this->c)
- {
- $this->wsfev1TRARegXReq[$this->b] = array();
- foreach($this->c as $this->n=>$this->o)
- {
- $this->wsfev1TRARegXReq[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- public function WSFEv1_ObternerParamTiposPaises()
- {
- //MÉTODO: FEParamGetTiposPaises
- $this->WSFEv1_getParamFE();
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->PaisTipoARR = $this->wsfev1TRA->FEParamGetTiposPaises(
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- );
- $this->b = 0;
- foreach ($this->PaisTipoARR as $this->PaisTipo=>$this->c)
- {
- foreach($this->c as $this->h=>$this->i)
- {
- foreach($this->i as $this->j=>$this->k)
- {
- foreach($this->k as $this->l=>$this->m)
- {
- $this->wsfev1TRAPaisTipo[$this->b] = array();
- foreach($this->m as $this->n=>$this->o)
- {
- $this->wsfev1TRAPaisTipo[$this->b][$this->n] = utf8_decode($this->o);
- }
- $this->b++;
- }
- }
- }
- }
- }
- public function WSFEv1_ConsultarCpbteEmitCod()
- {
- }
- public function WSFEv1_SolicitarCAE($ParamNroCpbte)
- {
- $this->WSSA_activateTicket();
- //$this->WSSA_getTicket();
- $this->WSFEv1_getParamFE();
- //echo "1";
- //$this->WSSA_Connect();
- $this->NroCpbte = $ParamNroCpbte;
- if($this->wsfev1ProxyHost == '' || $this->wsfev1ProxyHost == NULL)
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }else
- {
- $this->wsfev1TRA=new SoapClient(WSFEv1_WSDL, array(
- 'proxy_host' => $this->wsfev1ProxyHost,
- 'proxy_port' => $this->wsfev1ProxyPort,
- 'soap_version' => $this->wsfev1SOAPVersion,
- 'location' => $this->wsfev1URL,
- 'trace' => $this->wsfev1SOAPTrace,
- 'exceptions' => $this->wsfev1SOAPExceptions
- ));
- }
- $this->AuthARR = array();
- $this->AuthARR['Auth'] = array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- );
- //DATOS DE FeCabReq
- $this->FeCabReqCantReg = 1;
- $this->FeCabReqPtoVta = 2000;
- $this->FeCabReqCbteTipo = 6;
- //DATOS DE CbtesAsoc
- $this->CpbteAsocTipo = 2;
- $this->CpbteAsocPtoVta = 2;
- $this->CpbteAsocNro = 2;
- //DATOS DE Tributos
- $this->TributosId = 1;
- $this->TributosDesc = 'Impuestos nacionales';
- $this->TributosBaseImp = 10000;
- $this->TributosAlic = 21;
- $this->TributosImporte = 2100;
- //DATOS DE AlicIva
- $this->AlicIvaId = 5;
- $this->AlicIvaBaseImp = 10000;
- $this->AlicIvaImporte = 2100;
- //DATOS DE Opcionales
- $this->OpcionalId = 2;
- $this->OpcionalValor = 2;
- //DATOS DE FECAEDetRequest
- $this->FECAEDetRequestConcepto = 2;
- $this->FECAEDetRequestDocTipo = '96';
- $this->FECAEDetRequestDocNro = '29162959';
- $this->FECAEDetRequestCbteDesde = 4;
- $this->FECAEDetRequestCbteHasta = 4;
- $this->FECAEDetRequestCbteFch = '20150814';
- $this->FECAEDetRequestImpTotal = 12100;
- $this->FECAEDetRequestImpTotConc = 0;
- $this->FECAEDetRequestImpNeto = 1000;
- $this->FECAEDetRequestImpOpEx = 0;
- $this->FECAEDetRequestImpTrib = 0;
- $this->FECAEDetRequestImpIVA = 2100;
- $this->FECAEDetRequestFchServDesde = '20150801';
- $this->FECAEDetRequestFchServHasta = '20150831';
- $this->FECAEDetRequestFchVtoPago = '20150831';
- $this->FECAEDetRequestMonId = 'PES';
- $this->FECAEDetRequestMonCotiz = 1;
- $this->query = 'SELECT * FROM tbl_DetParametrosFE WHERE CodEmp="' . $_SESSION['codemp'] . '" AND SERVICIO="wsaa"' ;
- $this->res = query($this->query);
- $this->nor = query_num_rows($this->res);
- if($this->nor > 0)
- {
- while($this->row=query_fetch_object($this->res))
- {
- //$this->wssaNroUnico = trim($this->row->NROUNICO);
- //$this->wssaCodEmp = trim($this->row->CODEMP);
- //$this->wssaTipoParametro = trim($this->row->TIPOPARAMETRO);
- }
- }
- $this->queryCpbteFE = 'SELECT * FROM tbl_ComprobantesFE WHERE CodEmp="' . $_SESSION['codemp'] . '" AND ID="'.$this->NroCpbte.'"' ;
- $this->resCpbteFE = query($this->queryCpbteFE);
- $this->norCpbteFE = query_num_rows($this->resCpbteFE);
- if($this->norCpbteFE > 0)
- {
- while($this->rowCpbteFE=query_fetch_object($this->resCpbteFE))
- {
- //DATOS DE FeCabReq
- $this->FeCabReqCantReg = 1;
- $this->FeCabReqPtoVta = trim($this->rowCpbteFE->PUNTODEVENTA);
- $this->FeCabReqCbteTipo = trim($this->rowCpbteFE->TIPOCPBTE);
- //DATOS DE CbtesAsoc
- $this->CpbteAsocTipo = 2;
- $this->CpbteAsocPtoVta = 2;
- $this->CpbteAsocNro = 2;
- //DATOS DE Tributos
- $this->TributosId = 1;
- $this->TributosDesc = 'Impuestos nacionales';
- $this->TributosBaseImp = 10000;
- $this->TributosAlic = 21;
- $this->TributosImporte = 2100;
- //DATOS DE AlicIva
- $this->AlicIvaId = 5;
- $this->AlicIvaBaseImp = 10000;
- $this->AlicIvaImporte = 2100;
- //DATOS DE Opcionales
- $this->OpcionalId = 2;
- $this->OpcionalValor = 2;
- //DATOS DE FECAEDetRequest
- $this->FECAEDetRequestConcepto = 2; //ARMAR EL ROUTINE
- $this->FECAEDetRequestDocTipo = trim($this->rowCpbteFE->CODIDCOMPRADOR);
- $this->FECAEDetRequestDocNro = trim($this->rowCpbteFE->NROIDCOMPRADOR);
- $this->FECAEDetRequestCbteDesde = trim($this->rowCpbteFE->NROCPBTE);
- $this->FECAEDetRequestCbteHasta = trim($this->rowCpbteFE->NROCPBTE);
- $this->FECAEDetRequestCbteFch = ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHACPBTE,'ano')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHACPBTE,'mes')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHACPBTE,'dia'));
- $this->FECAEDetRequestImpTotal = trim($this->rowCpbteFE->IMPORTETOTAL*100);
- $this->FECAEDetRequestImpTotConc = trim($this->rowCpbteFE->IMPORTETOTALCONCEPNONETOGRAVADO*100);
- $this->FECAEDetRequestImpNeto = trim($this->rowCpbteFE->IMPORTENETOGRAVADO*100);
- $this->FECAEDetRequestImpOpEx = trim($this->rowCpbteFE->IMPORTEOPEREXENTAS*100);
- $this->FECAEDetRequestImpTrib = 0; //VER BIEN ESTE CONCEPTO
- $this->FECAEDetRequestImpIVA = trim($this->rowCpbteFE->IMPUESTOLIQUIDADO*100);
- $this->FECAEDetRequestFchServDesde = ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHADESDESERVFACTU,'ano')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHADESDESERVFACTU,'mes')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHADESDESERVFACTU,'dia'));
- $this->FECAEDetRequestFchServHasta = ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHAHASTASERVFACTU,'ano')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHAHASTASERVFACTU,'mes')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHAHASTASERVFACTU,'dia'));
- $this->FECAEDetRequestFchVtoPago = ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHAVENCSERVFACTU,'ano')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHAVENCSERVFACTU,'mes')).ALL_ClaToSQLDate(trim($this->rowCpbteFE->FECHAVENCSERVFACTU,'dia'));
- $this->FECAEDetRequestMonId = 'PES'; //VER ESTE TEMA
- $this->FECAEDetRequestMonCotiz = 1; //VER ESTE TEMA
- }
- }
- $this->FeCabReq = array('CantReg' => $this->FeCabReqCantReg,'PtoVta' => $this->FeCabReqPtoVta, 'CbteTipo' => $this->FeCabReqCbteTipo);
- //FUTURA IMPLEMENTACIÓN
- //$this->CpbteAsoc =array('Tipo' => $this->CpbteAsocTipo,'PtoVta' => $this->CpbteAsocPtoVta, 'Nro' => $this->CpbteAsocNro);
- //$this->CbtesAsoc = array($this->CpbteAsoc);
- //$this->Tributo = array('Id' => $this->TributosId,'Desc' => $this->TributosDesc, 'BaseImp' => $this->TributosBaseImp, 'Alic' => $this->TributosAlic, 'Importe' => $this-TributosImporte);
- //$this->Tributos = array($this->Tributo);
- //$this->AlicIva = array('Id' => $this->AlicIvaId,'BaseImp' => $this->AlicIvaBaseImp, 'Importe' => $this->AlicIvaImporte);
- //$this->IVA = array($this->AlicIva);
- //$this->Opcional = array('Id' => $this->OpcionalId,'Valor' => $this->OpcionalValor);
- //$this->Opcionales = array($this->Opcional);
- $this->FECAEDetRequest = array(
- 'Concepto' => $this->FECAEDetRequestConcepto,
- 'DocTipo' => $this->FECAEDetRequestDocTipo,
- 'DocNro' => $this->FECAEDetRequestDocNro,
- 'CbteDesde' => $this->FECAEDetRequestCbteDesde,
- 'CbteHasta' => $this->FECAEDetRequestCbteHasta,
- 'CbteFch' => $this->FECAEDetRequestCbteFch,
- 'ImpTotal' => $this->FECAEDetRequestImpTotal,
- 'ImpTotConc' => $this->FECAEDetRequestImpTotConc,
- 'ImpNeto' => $this->FECAEDetRequestImpNeto,
- 'ImpOpEx' => $this->FECAEDetRequestImpOpEx,
- 'ImpTrib' => $this->FECAEDetRequestImpTrib,
- 'ImpIVA' => $this->FECAEDetRequestImpIVA,
- 'FchServDesde' => $this->FECAEDetRequestFchServDesde,
- 'FchServHasta' => $this->FECAEDetRequestFchServHasta,
- 'FchVtoPago' => $this->FECAEDetRequestFchVtoPago,
- 'MonId' => $this->FECAEDetRequestMonId,
- 'MonCotiz' => $this->FECAEDetRequestMonCotiz,
- );
- //$this->WSFEv1_ObternerParamCodTposCpbtes();
- /*
- array('Auth' =>
- array(
- 'Token' => $this->wssaTRAResponse['token'],
- 'Sign' => $this->wssaTRAResponse['sign'],
- 'Cuit' => $_SESSION['codempCUIT']
- )
- )
- */
- // $this->FeCAEReq = array($this->AuthARR,);
- //$this->WSFEv1_ObternerParamCodTposAlic();
- $this->FeDetReq = array();
- $this->FeDetReq = $this->FECAEDetRequest;
- //$this->FeCAEReq = array($this->FeCabReq,$this->FeDetReq);
- $this->FeCAEReq = array();
- //$this->FECAESolicitar = array('FECAESolicitar' => array($this->AuthARR,$this->FeCAEReq));
- //$this->FECAESolicitar = array($this->AuthARR,$this->FeCAEReq);
- $this->FECAESolicitar = $this->AuthARR;
- $this->FECAESolicitar['FeCAEReq'] = $this->FeCAEReq;
- $this->FECAESolicitar['FeCAEReq']['FeCabReq'] = $this->FeCabReq;
- $this->FECAESolicitar['FeCAEReq']['FeDetReq']['FECAEDetRequest'] = $this->FeDetReq;
- $this->FECAESolicitar['FeCAEReq']['FeDetReq']['FECAEDetRequest']['Iva'][] = $this->AlicIva;
- //$this->FECAESolicitar['FeCAEReq']['FeDetReq']['FECAEDetRequest']['Opcionales'][] = $this->Opcional;
- //$this->FECAESolicitar['FeCAEReq']['FeDetReq']['FECAEDetRequest']['Tributos'][] = $this->Tributo;
- //$this->FECAESolicitar['FeCAEReq']['FeDetReq']['FECAEDetRequest']['CbtesAsoc'][] = $this->CbteAsoc;
- $this->FECAESolicitarResult = $this->wsfev1TRA->FECAESolicitar($this->FECAESolicitar);
- $this->FECAESolicitarResultARR = array();
- //print_r($this->wsfev1TRA->__getFunctions());
- //print_r($this->FECAESolicitarResult);
- $this->FECAESolicitarResultARR = $this->WSCOMM_ObjToArr($this->FECAESolicitarResult);
- // print_r($this->aa['FECAESolicitarResult']);
- //print_r($this->FECAESolicitarResult);
- //print_r($this->FECAESolicitarResultARR);
- //print_r($this->FECAESolicitarResult);
- //print_r($this->FECAESolicitar);
- if( array_key_exists('Errors',$this->FECAESolicitarResultARR['FECAESolicitarResult']) ||
- array_key_exists('Events',$this->FECAESolicitarResultARR['FECAESolicitarResult'])
- )
- {
- //VALIDO PRIMERO SI HAY ERRORES ARRAY Errors
- foreach($this->FECAESolicitarResultARR['FECAESolicitarResult']['Errors'] as $this->keys => $this->keysval)
- {
- //print_r($this->keysval);
- //echo "<br/>".$this->keysval['Code'];
- //echo "<br/>" . utf8_decode($this->keysval['Msg']);
- }
- return "error";
- }else
- {
- return "okay";
- }
- //$this->WSFEv1_ObternerParamCodTposCpbtes();
- //$this->WSFEv1_ObternerParamCodTposConceptos();
- //$this->WSFEv1_ObternerParamCodTposDocs();
- //$this->WSFEv1_ObternerParamCodTposMonedas();
- //$this->WSFEv1_ObternerParamCodTposDatOpc();
- //$this->WSFEv1_ObternerParamCodTposTribut();
- //$this->WSFEv1_ObternerParamCodPtosVT();
- //$this->WSFEv1_ObternerParamCotMoneda();
- //$this->WSFEv1_DUMMYMethod();
- //$this->WSFEv1_ObternerParamUltNroAutorizado(8,1);
- //$this->WSFEv1_ObternerParamCantMaxRegTotXReq();
- //$this->WSFEv1_ObternerParamTiposPaises();
- //var_dump($this->wsfev1TRA->__getFunctions());
- }
- public function WSFEv1_SolicitarCAEA()
- {
- }
- public function WSFEv1_ConsultarCAEA()
- {
- }
- public function WSFEv1_InformarCpbteSinMovimientoCAEA()
- {
- }
- public function WSFEv1_InformarCpbteConMovimientoCAEA()
- {
- }
- public function WSFEv1_ConsultarCpbteSinMovimientoCAEA()
- {
- }
- }
- // $poi = new FEv1();
- // $poi->WSSA_getTicket();
- // //print_r($poi->WSSA_showTicket());
- // //$poi->WSFEv1_ObternerParamCodTposDocs();
- // $poi->WSFEv1_ObternerParamCodTposCpbtes();
- //$poi->WSFEv1_SolicitarCAE(4444);
- //print_r($_SESSION);
- // AHORA INTENTO CREAR UNA FACTURA
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement