diff --git a/src/Complements.php b/src/Complements.php index ac2375e2..72b9279b 100644 --- a/src/Complements.php +++ b/src/Complements.php @@ -77,8 +77,7 @@ protected static function addInutCTeProtocol($request, $response) $retserie = $retInfInut->getElementsByTagName('serie')->item(0)->nodeValue; $retnCTIni = $retInfInut->getElementsByTagName('nCTIni')->item(0)->nodeValue; $retnCTFin = $retInfInut->getElementsByTagName('nCTFin')->item(0)->nodeValue; - if ( - $versao != $retversao || + if ($versao != $retversao || $tpAmb != $rettpAmb || $cUF != $retcUF || $ano != $retano || @@ -303,8 +302,7 @@ public static function cancelRegister($cte, $cancelamento) $tpEvento = $infEvento->getElementsByTagName('tpEvento') ->item(0) ->nodeValue; - if ( - in_array($cStat, ['135', '136', '155']) + if (in_array($cStat, ['135', '136', '155']) && $tpEvento == '110111' && $chaveEvento == $chaveCTe ) { diff --git a/src/Make.php b/src/Make.php index 073c28b0..17f2f922 100755 --- a/src/Make.php +++ b/src/Make.php @@ -3691,7 +3691,8 @@ public function taginfNF($std) $infNF, 'mod', $std->mod, - true, $identificador . 'Modelo da Nota Fiscal' + true, + $identificador . 'Modelo da Nota Fiscal' ); $this->dom->addChild( $infNF, @@ -3733,7 +3734,8 @@ public function taginfNF($std) 'vBCST', $std->vBCST, true, - $identificador . 'Valor da Base de Cálculo do ICMS ST'); + $identificador . 'Valor da Base de Cálculo do ICMS ST' + ); $this->dom->addChild( $infNF, 'vST', diff --git a/src/Tools.php b/src/Tools.php index 54fd1d25..05507d0b 100755 --- a/src/Tools.php +++ b/src/Tools.php @@ -79,7 +79,7 @@ public function sefazEnviaLote( $body = "urlNamespace\">$request"; $method = $this->urlMethod; if ($compactar) { - $gzdata = base64_encode(gzencode($cons, 9, FORCE_GZIP)); + $gzdata = base64_encode(gzencode($request, 9, FORCE_GZIP)); $body = "urlNamespace\">$gzdata"; $method = $this->urlMethod."Zip"; $parameters = ['cteDadosMsgZip' => $gzdata]; @@ -88,7 +88,7 @@ public function sefazEnviaLote( $this->lastResponse = $this->sendRequest($body, $parameters); return $this->lastResponse; } - + /** * Request authorization to issue CTe OS with one document only * @param type $xml @@ -376,8 +376,8 @@ public function sefazDistDFe( $consulta = "urlPortal\" versao=\"$this->urlVersion\">" . "".$this->tpAmb."" . "$cUF" - . ((strlen($this->config->cnpj)==14) ? - "".$this->config->cnpj."" : + . ((strlen($this->config->cnpj)==14) ? + "".$this->config->cnpj."" : "".$this->config->cnpj."" ) . $tagNSU.""; @@ -720,14 +720,13 @@ public function sefazDownload($chave) $this->tpAmb, true ); - $cUF = UFList::getCodeByUF($this->config->siglaUF); - $tagChave = "$chave"; //monta a consulta - . ((strlen($this->config->cnpj)==14) ? - "".$this->config->cnpj."" : + $consulta = "$chave" + . ((strlen($this->config->cnpj)==14) ? + "".$this->config->cnpj."" : "".$this->config->cnpj."" ) - . $tagChave.""; + .""; //valida o xml da requisição $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); $this->lastRequest = $consulta; @@ -872,7 +871,7 @@ public function sefazCE( ) { $uf = $this->validKeyByUF($chave); $tpEvento = 110180; - + /* relaciona as chaves das NFes */ $infEntrega = ''; foreach ($aNFes as $NFe) {