 |
ActiveDelphi .: O site do programador Delphi! :.
|
Exibir mensagem anterior :: Exibir próxima mensagem |
Autor |
Mensagem |
pssmaia Novato

Registrado: Terça-Feira, 17 de Mai de 2011 Mensagens: 73
|
Enviada: Ter Mai 22, 2012 12:23 pm Assunto: Txt para Xml |
|
|
Gostaria Transformar um arquivo Txt com o Layout Acbr para um arquivo Xml como posso fazer isso seque abaixo a rotina para criar o arquivo Txt
AssignFile( F ,'D:\SISOBRA\Importacao\NFE_' + NotaE + '.TXT');
Rewrite(F);
try
WriteLn(F,'NOTA FISCAL|1|');
WriteLn(F,'A|2.00|NFe|');
WriteLn(F,'B|55|' + '|' + '|' + Operacao + '|' + '|' + Entrada + '|55|1|' + NotaE + '|' + '|1|' + Data1 + '|' + Data2 + '|' + Hora + '|'+ Entrada + '|' + Pagamento + '|' + Ibge1 + '|1|1|2|1|3|1.4.1|');
WriteLn(F,'C|' + Razao1 + '|' + Fantasia1 + '|' + Inscricao1 + '|' + IMunicipal + '|' + Cnae +'||||');
WriteLn(F,'C02|' + Cnpj1 + '|');
WriteLn(F,'C05|' + Endereco1 + '|' + Numero1 + '|' + Complemento1 + '|' + Bairro1 + '|' + Ibge1 + '|' + Cidade1 + '|' + UF1 + '|' + Cep1 + '|1058|BRASIL|' + Fone1 + '|');
WriteLn(F,'E|' + Razao2 + '|' + Inscricao2 + '||');
WriteLn(F,'E02|' + Cnpj2 + '|');
WriteLn(F,'E05|' + Endereco2 + '|' + Numero2 + '||' + Bairro2 + '|' + Ibge2 + '|' + Cidade2 + '|' + UF2 + '|' + Cep2 + '|1058|BRASIL|' + fone2 + '|');
Dm.Tb_ItensNota.First;
Contador:=Dm.TB_ItensNota.RecordCount;
Registros:=0;
while Registros <> Contador do
begin
Registros:= Registros + 1;
Dm.Tb_Nota2.Open;
Dm.Tb_Nota2.Append;
Dm.TB_Nota2.Edit;
Dm.TB_Nota2Data.Value:= Date;
Dm.TB_Nota2N_Nota.Value:= Dm.Tb_NotaN_NOTA.Value;
Dm.TB_Nota2CodProduto.Value:=Dm.TB_ItensNotaCodProduto.Value;
Dm.TB_Nota2Produto.Value:=Dm.TB_ItensNotaProduto.Value;
Dm.TB_Nota2Ncm.Value:= Dm.TB_ItensNotaNcm.Value;
Dm.TB_Nota2Cfop.Value:= Dm.Tb_NotaCFOP.Value;
Dm.TB_Nota2Unidade.Value:=Dm.TB_ItensNotaUnidade.Value;
Dm.TB_Nota2Quantidade.Value:=Dm.TB_ItensNotaQuantidade.Value;
Dm.TB_Nota2Unitario.Value:= Dm.TB_ItensNotaUnitario.Value;
Dm.TB_Nota2Total.Value:= Dm.TB_ItensNotaTotal.Value;
Dm.TB_Nota2Adicional.Value:= Dm.Tb_NotaREFERE2.Value;//Dm.Tb_NotaServicos.Value;
Dm.TB_Nota2Usuario.Value:= Dm.Tb_UsuarioUSUARIO.Value;
Dm.TB_Nota2.Post;
Dm.Tb_Nota2.First;
If Dm.Tb_ItensNotaPRODUTO.Value<>'' Then
Begin
WriteLn(F,'I|' + Dm.TB_ItensNotaCodProduto.AsString + '|' + Dm.TB_ItensNotaProduto.Value + '|' + Dm.TB_ItensNotaNCM.Value + '|' + '|' + Dm.TB_ItensNotaCLASFISCAL.Value + '|||'
+ Dm.Tb_ItensNotaCFOP.Value + '|' + Dm.TB_ItensNotaUnidade.Value + '|' + Dm.TB_ItensNotaQuantidade.Value + '|' + Dm.Tb_ItensNotaUNITARIO.AsString + '|' + Dm.Tb_ItensNotaTOTAL.AsString + '||'
+ Dm.TB_ItensNotaUnidade.Value + '|' + Dm.Tb_ItensNotaQUANTIDADE.Value + '|' + Dm.Tb_ItensNotaUNITARIO.AsString + '||||');
WriteLn(F,'M|');
WriteLn(F,'N|');
WriteLn(F,'N06|0|40|');
WriteLn(F,'Q|');
WriteLn(F,'Q04|07|');
WriteLn(F,'S|');
WriteLn(F,'S04|07|');
End;
Dm.Tb_ItensNota.Next;
If Registros= Contador Then
Begin
Break;
End;
End;
WriteLn(F,'W|');
WriteLn(F,'W02|0|0|0|0|' + '|' + ValorProdutos + '|' + ValorFrete + '|' + '|' + ValorSeguro + '|' + '|' + ValorDespesas + '|0|0|0|0|0|0|0|0|' + ValorNota + '|');
WriteLn(F,'X|1|');
WriteLn(F,'X03|' + Razao3 + '|' + Inscricao3 + '|' + Endereco3 + '|' + UF3 + '|' + Cidade3 + '|');
WriteLn(F,'X04|' + Cnpj3 + '|');
WriteLn(F,'X18|' + Placa + '|' + Rntc + '|' + UF4 + '||');
WriteLn(F,'X26|' + Frete + '|' + Volume + '|' + QuantidadeT + '|' + Especie + '|' + Marca + '|' + Numeracao + '|' + PesoLiquido + '|' + PesoBruto + '|');
If Dm.Tb_NotaVENCIMENTO1.Value<>0 Then
Begin
WriteLn(F,'[Duplicata001]');
WriteLn(F,'Numero=' + NotaE + '-A');
WriteLn(F,'DataVencimento=' + Vencimento1);
WriteLn(F,'Valor=' + ValorDup1);
End;
If Dm.Tb_NotaVENCIMENTO2.Value<>0 Then
Begin
WriteLn(F,'[Duplicata002]');
WriteLn(F,'Numero=' + NotaE + '-B');
WriteLn(F,'DataVencimento=' + Vencimento2);
WriteLn(F,'Valor=' + ValorDup2);
End;
If Dm.Tb_NotaVENCIMENTO3.Value<>0 Then
Begin
WriteLn(F,'[Duplicata003]');
WriteLn(F,'Numero=' + NotaE + '-C');
WriteLn(F,'DataVencimento=' + Vencimento3);
WriteLn(F,'Valor=' + ValorDup3);
End;
If Dm.Tb_NotaVENCIMENTO4.Value<>0 Then
Begin
WriteLn(F,'[Duplicata004]');
WriteLn(F,'Numero=' + NotaE + '-D');
WriteLn(F,'DataVencimento=' + Vencimento4);
WriteLn(F,'Valor=' + ValorDup4);
End;
If Dm.Tb_NotaVENCIMENTO5.Value<>0 Then
Begin
WriteLn(F,'[Duplicata005]');
WriteLn(F,'Numero=' + NotaE + '-E');
WriteLn(F,'DataVencimento=' + Vencimento5);
WriteLn(F,'Valor=' + ValorDup5);
End;
If Dm.Tb_NotaVENCIMENTO6.Value<>0 Then
Begin
WriteLn(F,'[Duplicata006]');
WriteLn(F,'Numero=' + NotaE + '-F');
WriteLn(F,'DataVencimento=' + Vencimento6);
WriteLn(F,'Valor=' + ValorDup6);
End;
WriteLn(F,'[DadosAdicionais]');
WriteLn(F,'Complemento=' + Complemento + '")');
finally
CloseFile(F);
End;
AssignFile(E,'D:\SISOBRA\Email\Email' + NotaE + '.TXT');
Rewrite(E);
try
WriteLn(E,'' + Email);
finally
CloseFile(E);
end;
Agora como acima citado como faço para transformar em xml para enviar para o sefaz
deste de ja agradeço pela ajuda _________________ Reter Conhecimento e a maior ignorancia que um ser humano pode cometer. |
|
Voltar ao Topo |
|
 |
joemil Moderador

Registrado: Quinta-Feira, 25 de Março de 2004 Mensagens: 9099 Localização: Sinop-MT
|
Enviada: Ter Mai 22, 2012 12:33 pm Assunto: |
|
|
esse procedimento é vc mesmo q fez?
pq ao inves de gerar um txt, nao usa o acbrnfe e gera a nota automaticamente? o proprio abcrnfe ja gera o xml, basta preencher suas propriedades.
tem um exemplo de como usar o acbrnfe _________________ <b>SEMPRE COLOQUE [RESOLVIDO] NO SEU POST</b>
Enviar imagens: http://tinypic.com/ |
|
Voltar ao Topo |
|
 |
pssmaia Novato

Registrado: Terça-Feira, 17 de Mai de 2011 Mensagens: 73
|
Enviada: Ter Mai 22, 2012 12:46 pm Assunto: |
|
|
Voce tem um exemplo e como gerar xml com o acbr? se sim por favor me envie _________________ Reter Conhecimento e a maior ignorancia que um ser humano pode cometer. |
|
Voltar ao Topo |
|
 |
pssmaia Novato

Registrado: Terça-Feira, 17 de Mai de 2011 Mensagens: 73
|
Enviada: Ter Mai 22, 2012 12:48 pm Assunto: |
|
|
Sobre o procedimento sim foi eu que fiz _________________ Reter Conhecimento e a maior ignorancia que um ser humano pode cometer. |
|
Voltar ao Topo |
|
 |
Ghost_Rider Colaborador

Registrado: Segunda-Feira, 6 de Outubro de 2003 Mensagens: 4437
|
Enviada: Ter Mai 22, 2012 1:38 pm Assunto: |
|
|
Cara, baixa o componente do acbr e instala...lá tem uma pasta de exemplos... |
|
Voltar ao Topo |
|
 |
joemil Moderador

Registrado: Quinta-Feira, 25 de Março de 2004 Mensagens: 9099 Localização: Sinop-MT
|
Enviada: Ter Mai 22, 2012 3:03 pm Assunto: |
|
|
Ghost_Rider escreveu: | Cara, baixa o componente do acbr e instala...lá tem uma pasta de exemplos... |
isso mesmo. ta tudo mastigado no exemplo. so pegar, adaptar e usar. show de bola _________________ <b>SEMPRE COLOQUE [RESOLVIDO] NO SEU POST</b>
Enviar imagens: http://tinypic.com/ |
|
Voltar ao Topo |
|
 |
|
|
Enviar Mensagens Novas: Proibido. Responder Tópicos Proibido Editar Mensagens: Proibido. Excluir Mensagens: Proibido. Votar em Enquetes: Proibido.
|
|