function geraXML() { $this->Id = 'ID' . $this->chNFe; $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = false; $CP01 = $dom->appendChild($dom->createElement('cancNFe')); $CP01_att1 = $CP01->appendChild($dom->createAttribute('versao')); $CP01_att1->appendChild($dom->createTextNode($this->versao)); $CP01_att2 = $CP01->appendChild($dom->createAttribute('xmlns')); $CP01_att2->appendChild($dom->createTextNode('http://www.portalfiscal.inf.br/nfe')); $CP03 = $CP01->appendChild($dom->createElement('infCanc')); $CP04 = $CP03->setAttribute('Id', $this->Id); $CP05 = $CP03->appendChild($dom->createElement('tpAmb', $this->tpAmb)); $CP06 = $CP03->appendChild($dom->createElement('xServ', $this->xServ)); $CP07 = $CP03->appendChild($dom->createElement('chNFe', $this->chNFe)); $CP08 = $CP03->appendChild($dom->createElement('nProt', $this->nProt)); $CP09 = $CP03->appendChild($dom->createElement('xJust', $this->xJust)); $xml = $dom->saveXML(); $assinatura = new assinatura(); $this->XML = $assinatura->assinaXML($xml, 'infCanc'); return $this->XML; }
function assinaNFe($sXML) { $assinatura = new assinatura(); $xml_assinado = $assinatura->assinaXML($sXML, 'infNFe'); return $xml_assinado; }
function geraXML() { $this->id = 'DPEC' . $this->CNPJ; $this->cUF = substr($this->chNFe, 0, 2); $this->CNPJ = substr($this->chNFe, 6, 14); $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = false; $BP01 = $dom->appendChild($dom->createElement('envDPEC')); $BP01_att1 = $BP01->appendChild($dom->createAttribute('versao')); $BP01_att1->appendChild($dom->createTextNode($this->versao)); $BP01_att2 = $BP01->appendChild($dom->createAttribute('xmlns')); $BP01_att2->appendChild($dom->createTextNode('http://www.portalfiscal.inf.br/nfe')); $BP01_att3 = $BP01->appendChild($dom->createAttribute('xmlns:xsd')); $BP01_att3->appendChild($dom->createTextNode('http://www.w3.org/2001/XMLSchema')); $BP01_att4 = $BP01->appendChild($dom->createAttribute('xmlns:xsi')); $BP01_att4->appendChild($dom->createTextNode('http://www.w3.org/2001/XMLSchema-instance')); $BP02 = $BP01->appendChild($dom->createElement('infDPEC')); $BP02_att1 = $BP02->appendChild($dom->createAttribute('Id')); $BP02_att1->appendChild($dom->createTextNode($this->id)); $BP03 = $BP02->appendChild($dom->createElement('ideDec')); $BP04 = $BP03->appendChild($dom->createElement('cUF', $this->cUF)); $BP04 = $BP03->appendChild($dom->createElement('tpAmb', $this->tpAmb)); $BP04 = $BP03->appendChild($dom->createElement('verProc', $this->verProc)); $BP04 = $BP03->appendChild($dom->createElement('CNPJ', $this->CNPJ)); $BP04 = $BP03->appendChild($dom->createElement('IE', $this->IE)); $BP04 = $BP03->appendChild($dom->createElement('resNFe')); $BP05 = $BP04->appendChild($dom->createElement('chNFe', $this->chNFe)); if ($this->destCNPJ != '') { $BP06 = $BP05->appendChild($dom->createElement('CNPJ', $this->destCNPJ)); } else { $BP06 = $BP05->appendChild($dom->createElement('CPF', $this->destCPF)); } $BP06 = $BP05->appendChild($dom->createElement('CPF', $this->destUF)); $BP06 = $BP05->appendChild($dom->createElement('vNF', $this->vNF)); $BP06 = $BP05->appendChild($dom->createElement('vICMS', $this->vICMS)); $BP06 = $BP05->appendChild($dom->createElement('vST', $this->vST)); $xml = $dom->saveXML(); $assinatura = new assinatura(); $this->XML = $assinatura->assinaXML($xml, 'infDPEC'); return $this->XML; }
function geraXML() { $this->Id = 'ID' . $this->cUF . $this->CNPJ . $this->mod . $this->serie . $this->nNFIni . $this->nNFFin; $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = false; $DP01 = $dom->appendChild($dom->createElement('inutNFe')); $DP01_att1 = $DP01->appendChild($dom->createAttribute('versao')); $DP01_att1->appendChild($dom->createTextNode($this->versao)); $DP01_att2 = $DP01->appendChild($dom->createAttribute('xmlns')); $DP01_att2->appendChild($dom->createTextNode('http://www.portalfiscal.inf.br/nfe')); $DP03 = $DP01->appendChild($dom->createElement('infInut')); $DP04 = $DP03->setAttribute('Id', $this->Id); $DP05 = $DP03->appendChild($dom->createElement('tpAmb', $this->tpAmb)); $DP06 = $DP03->appendChild($dom->createElement('xServ', $this->xServ)); $DP07 = $DP03->appendChild($dom->createElement('cUF', $this->cUF)); $DP08 = $DP03->appendChild($dom->createElement('ano', $this->ano)); $DP09 = $DP03->appendChild($dom->createElement('CNPJ', $this->CNPJ)); $DP10 = $DP03->appendChild($dom->createElement('mod', $this->mod)); $DP11 = $DP03->appendChild($dom->createElement('serie', $this->serie)); $DP12 = $DP03->appendChild($dom->createElement('nNFIni', $this->nNFIni)); $DP13 = $DP03->appendChild($dom->createElement('nNFFin', $this->nNFFin)); $DP14 = $DP03->appendChild($dom->createElement('xJust', $this->xJust)); $xml = $dom->saveXML(); $assinatura = new assinatura(); $this->XML = $assinatura->assinaXML($xml, 'infInut'); return $this->XML; }