GerarXMLporJSON(aJSONFile)
Método para retornar um XML para Envio ao servidor SEFAZ.
Método
GerarXMLporJSON(aJSONFile: string): string;
Parâmetros
Argumento | Tipo | Detalhes |
aJSONFile | String | Caminho completo do arquivo no formato JSON do qual será gerado o XML ou o conteúdo direto do JSON. |
Exemplos json
{
"formato": "tx2",
"incluirCTe": [
{
"versao_2": "4.00",
"cUF_5": "43",
"cCT_6": "00000000",
"CFOP_7": "5357",
"natOp_8": "TRANSPORTE RODOVIARIO DE CARGAS",
"mod_10": "57",
"serie_11": "846",
"nCT_12": "12",
"dhEmi_13": "2017-04-24T10:50:00-03:00",
"tpImp_14": "1",
"tpEmis_15": "1",
"tpAmb_17": "2",
"tpCTe_18": "0",
"procEmi_19": "0",
"verProc_20": "1",
"cMunEnv_672": "4302105",
"xMunEnv_673": "BENTO GONCALVES",
"UFEnv_674": "RS",
"modal_25": "01",
"tpServ_26": "0",
"cMunIni_27": "4302105",
"xMunIni_28": "BENTO GONCALVES",
"UFIni_29": "RS",
"cMunFim_30": "4302105",
"xMunFim_31": "BENTO GONCALVES",
"UFFim_32": "RS",
"retira_33": "0",
"toma_36": "0",
"xDetRetira_34": "detalhes teste",
"indIEToma_1406": "1",
"CNPJ_95": "04086596000145",
"IE_96": "0500077436",
"xNome_97": "Nome teste",
"xFant_98": "Nome teste",
"xLgr_100": "Rua teste",
"nro_101": "300",
"xCpl_102": "10 andar",
"xBairro_103": "BAIRRO TESTE",
"cMun_104": "4302105",
"xMun_105": "BENTO GONCALVES",
"CEP_106": "89233198",
"UF_107": "RS",
"fone_110": "1132433400",
"CNPJ_112": "08187168000160",
"IE_114": "9044016688",
"xNome_115": "CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL",
"xFant_116": "CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL",
"fone_117": "4430283749",
"xLgr_119": "RUA DUQUE DE CAXIAS S/N",
"nro_120": "0",
"xBairro_122": "PARANA",
"cMun_123": "4115200",
"xMun_124": "PARANA",
"CEP_125": "01000000",
"UF_126": "PR",
"cPais_127": "1058",
"xPais_128": "BRASIL",
"email_604": "x@tecnospeed.com.br",
"CPF_200": "22233344405",
"IE_201": "0500048665",
"xNome_202": "CT-E EMITIDO EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL",
"xLgr_206": "Praca Matriz",
"nro_207": "0",
"xBairro_209": "Centro",
"cMun_210": "4302105",
"xMun_211": "BENTO GONCALVES",
"CEP_212": "01000000",
"UF_213": "RS",
"cPais_214": "1058",
"xPais_215": "BRASIL",
"email_608": "guilherme.ganassin@tecnospeed.com.br",
"vTPrest_228": "200.00",
"vRec_229": "200.00",
"CST_609": "00",
"vBC_610": "0.01",
"pICMS_611": "7.00",
"vICMS_612": "0.01",
"versaoModal_636": "3.00",
"vCarga_671": "1000.00",
"proPred_271": "LATA",
"vBCUFFim_676": "1.10",
"pFCPUFFim_682": "1.10",
"pICMSUFFim_677": "40",
"pICMSInter_678": "12.00",
"vICMSUFFim_680": "1.10",
"vICMSUFIni_681": "1.10",
"vFCPUFFim_683": "1.10"
}
],
"incluirdup": [
{}
],
"incluirpass": [
{}
],
"incluiremiDocAnt": [
{}
],
"incluiridDocAntPap": [
{}
],
"incluiridDocAntEle": [
{}
],
"incluirObsCont": [
{}
],
"incluirObsFisco": [
{}
],
"incluirinfOutros": [
{
"tpDoc_159": "00",
"nDoc_161": "123456",
"dEmi_162": "2011-03-22",
"vDocFisc_163": "1.00"
}
],
"incluirComp": [
{}
],
"incluirinfQ": [
{
"cUnid_274": "00",
"tpMed_275": "m3",
"qCarga_276": "1"
}
],
"incluirveicNovos": [
{}
],
"incluirinfNF": [
{}
],
"incluirinfNFe": [
{}
],
"IncluirRodo": [
{
"RNTRC_305": "00000012"
}
],
"incluirOcc": [
{
"serie_312": "1",
"nOcc_313": "1",
"dEmi_314": "2017-04-20",
"CNPJ_316": "08187168000160",
"cInt_317": "10",
"IE_318": "0500077436",
"UF_319": "PR",
"fone_320": "99999999"
}
]
}
Retorno
XML do CTe
Exemplos
Delphi
retorno := spdCTe.GerarXMLporJSON('C:\cte.JSON');
C#
retorno = spdCTe.GerarXMLporJSON("C:\cte.JSON");
Visual Basic 6
retorno = spdCTe.GerarXMLporJSON("C:\cte.JSON")
PHP
$retorno = spdCTe->GerarXMLporJSON("C:\cte.JSON");
Comentários
0 comentário
Por favor, entre para comentar.