Ir para conteúdo
  • Cadastre-se

dev botao

  • Este tópico foi criado há 4225 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

Postado

Galera peguei o exemplo do ACBrPAF pra gera meu arquivo de DAVs emitidos mas percebi que ele não pega a numeração do DAV, ele pega uma e repete ela em todos os registros D3.

 

Não entendi como ele faz essa amarração com o registro D2, no exemplo mesmo ele poem vários DAVs com a numeração ZERADA, depois ele faz uma sequência alguém aqui pode me ajudar nessa questão?

Grande abraço....

Postado (editado)

Ta dentro do loop... 

 

 

 


      

 

   if FileExists(pNomeArquivo) then
            DeleteFile(pNomeArquivo);


PreencherHeader(ACBrPAF.PAF_D.RegistroD1); // preencher header do arquivo


ACBrPAF.PAF_D.RegistroD2.Clear;
         while not QDav.Eof do
         begin
            D2              := ACBrPAF.PAF_D.RegistroD2.New;
            D2.NUM_FAB      := emSerialECF;
            D2.MF_ADICIONAL := LetraMFAds;
            D2.TIPO_ECF     := emTipoECF;
            D2.MARCA_ECF    := emMarcaECF;
            D2.MODELO_ECF   := emModeloECF;




            if GeraLerMD5_Tabela_Dados(1,QDav.FieldByName('dav').AsInteger,0,'ORCAMENTO','','', Dados.Vendas_GDB,Dados.Transacao) then
               D2.RegistroValido := True // diz quando o registro foi modificado no banco
            else
               D2.RegistroValido := False;




            D2.COO          := QDav.FieldByName('COO').AsString;
            D2.NUM_DAV      := ZeroEsquerda(QDav.FieldByName('dav').AsString,13);
            D2.DT_DAV       := QDav.FieldByName('emissao').AsDateTime;
            D2.TIT_DAV      := 'ORCAMENTO';
            D2.VLT_DAV      := QDav.FieldByname('total_liquido').AsCurrency;
            D2.COO_DFV      := QDav.FieldByName('COO').AsString;
            D2.NUMERO_ECF   := Copy(numECF,2,3);
            D2.NOME_CLIENTE := QDav.FieldByName('NOME').AsString;
            D2.CPF_CNPJ     := FiltraNumero(QDav.FieldByName('CNPJ').AsString);
            QDav.Next;
         end;


         qDavIte := TMDOQuery.Create(nil);
         qDavIte.Database := Dados.Vendas_GDB;
         qDavIte.Transaction := Dados.IBVendas;
         if FileExists(pNomeArquivo) then
            DeleteFile(pNomeArquivo);


         PreencherHeader(ACBrPAF.PAF_D.RegistroD1); // preencher header do arquivo


         ACBrPAF.PAF_D.RegistroD2.Clear;
         while not QDav.Eof do
         begin
            D2              := ACBrPAF.PAF_D.RegistroD2.New;
            D2.NUM_FAB      := emSerialECF;
            D2.MF_ADICIONAL := LetraMFAds;
            D2.TIPO_ECF     := emTipoECF;
            D2.MARCA_ECF    := emMarcaECF;
            D2.MODELO_ECF   := emModeloECF;
            D2.COO          := QDav.FieldByName('COO').AsString;
            D2.NUM_DAV      := ZeroEsquerda(QDav.FieldByName('dav').AsString,13);
            D2.DT_DAV       := QDav.FieldByName('emissao').AsDateTime;
            D2.TIT_DAV      := 'ORCAMENTO';
            D2.VLT_DAV      := QDav.FieldByname('total_liquido').AsCurrency;
            D2.COO_DFV      := QDav.FieldByName('COO').AsString;
            D2.NUMERO_ECF   := Copy(numECF,2,3);
            D2.NOME_CLIENTE := QDav.FieldByName('NOME').AsString;
            D2.CPF_CNPJ     := FiltraNumero(QDav.FieldByName('CNPJ').AsString);


            if GeraLerMD5_Tabela_Dados(1,QDav.FieldByName('dav').AsInteger,0,'ORCAMENTO','','', Dados.Vendas_GDB,Dados.Transacao) then
               D2.RegistroValido := True // diz quando o registro foi modificado no banco
            else
               D2.RegistroValido := False;


  QDav.Next;
         end;


         qDavIte := TMDOQuery.Create(nil);
         qDavIte.Database := Dados.Vendas_GDB;
         qDavIte.Transaction := Dados.IBVendas;


         qDavIte.First;
         while not qDavIte.Eof do
         begin
            with D2.RegistroD3.New do
            begin
              DT_INCLUSAO   := qDavIte.FieldByName('data_inclusao').AsDateTime;
              NUM_ITEM      := qDavIte.FieldByName('nitem').AsInteger;
              COD_ITEM      := ZeroEsquerda(qDavIte.FieldByName('produto').AsString,14);
              DESC_ITEM     := qDavIte.FieldByName('descricao').AsString;
              QTDE_ITEM     := qDavIte.FieldByName('qtde').AsCurrency;
              UNI_ITEM      := qDavIte.FieldByName('un').AsString;
              VL_UNIT       := qDavIte.FieldByName('vlunit').AsCurrency;




              if qDavIte.FieldByName('desconto').AsFloat < 0 then
                 xDesc := qDavIte.FieldByName('desconto').AsFloat * (-1)
              else
                 xDesc := qDavIte.FieldByName('desconto').AsFloat;




              VL_DESCTO     := xDesc;
              VL_ACRES      := qDavIte.FieldByName('acrescimo').AsCurrency;
              VL_TOTAL      := qDavIte.FieldByName('vliquido').AsCurrency;
              SIT_TRIB      := qDavIte.FieldByName('cst').AsString;
              ALIQ          := qDavIte.FieldByName('aliq').AsCurrency;
              IND_CANC      := qDavIte.FieldByName('canc').AsString;
              DEC_QTDE_ITEM := 4;
              DEC_VL_UNIT   := 4;




              if GeraLerMD5_Tabela_Dados(1,qDavIte.FieldByName('cod_venda').AsInteger,qDavIte.FieldByName('produto').AsInteger,'ORC_ITENS','','',
                 Dados.Vendas_GDB,Dados.Transacao) then
                 RegistroValido := True
              else
                 RegistroValido := False;




            end;
            qDavIte.Next
         end;
Editado por CleitonMaciel
  • 3 meses depois ...
Postado

Preciso de ajuda....

Estou iniciando o desenvolvimento dos arquivos Paf, executei o ACBR_PAF_Demo.exe, e cliquei em Tipo D, ele gerou o arquivo PAF_D.txt

aí validei esse arquivo no Projeto Acbr - Verificador de arquivos do Paf-ECF Versao da ER 01.13 aí foram encontrados alguns erros,
exemplo: linha 2 tamanho da linha 206 menor do que o esperado 212.
Será se existe alguma coisa errada com meus componentes ?

D1007126213304072836267621242 72417268477011DEMO PAF                                         
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 0000000            20130509Pedido                        77000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 0000040            20130504Pedido                        6000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00002211           20130504Pedido                        42000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00001012           20130503Pedido                        51000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00001815           20130501Pedido                        58000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00003618           20130509Pedido                        68000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00000824           20130507Pedido                        6000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00002035           20130505Pedido                        58000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00002040           20130501Pedido                        11000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00005640           20130502Pedido                        62000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00004242           20130508Pedido                        18000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00000045           20130507Pedido                        71000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00001260           20130503Pedido                        60000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 00004270           20130506Pedido                        64000000001NOME CLIENTE                            00012345678921
D200712621330407NUMFAB78901234567890 ECF-IF ACBr                PAF                 000045105          20130502Pedido                        10000000001NOME CLIENTE                            00012345678921
D30            20130509110            descricao do item                                                                                   10UN 10010T7N22
D30            20130509210            descricao do item                                                                                   10UN 10010T7N22
D30            20130509310            descricao do item                                                                                   10UN 10010T7N22
D30            20130509410            descricao do item                                                                                   10UN 10010T7N22
D30            20130509510            descricao do item                                                                                   10UN 10010T7N22
D30            20130509110            descricao do item                                                                                   10UN 10010T7N22
D30            20130509210            descricao do item                                                                                   10UN 10010T7N22
D30            20130509310            descricao do item                                                                                   10UN 10010T7N22
D30            20130509410            descricao do item                                                                                   10UN 10010T7N22
D30            20130509510            descricao do item                                                                                   10UN 10010T7N22
D311           20130509110            descricao do item                                                                                   10UN 10010T7N22
D311           20130509210            descricao do item                                                                                   10UN 10010T7N22
D311           20130509310            descricao do item                                                                                   10UN 10010T7N22
D311           20130509410            descricao do item                                                                                   10UN 10010T7N22
D311           20130509510            descricao do item                                                                                   10UN 10010T7N22
D312           20130509110            descricao do item                                                                                   10UN 10010T7N22
D312           20130509210            descricao do item                                                                                   10UN 10010T7N22
D312           20130509310            descricao do item                                                                                   10UN 10010T7N22
D312           20130509410            descricao do item                                                                                   10UN 10010T7N22
D312           20130509510            descricao do item                                                                                   10UN 10010T7N22
D315           20130509110            descricao do item                                                                                   10UN 10010T7N22
D315           20130509210            descricao do item                                                                                   10UN 10010T7N22
D315           20130509310            descricao do item                                                                                   10UN 10010T7N22
D315           20130509410            descricao do item                                                                                   10UN 10010T7N22
D315           20130509510            descricao do item                                                                                   10UN 10010T7N22
D318           20130509110            descricao do item                                                                                   10UN 10010T7N22
D318           20130509210            descricao do item                                                                                   10UN 10010T7N22
D318           20130509310            descricao do item                                                                                   10UN 10010T7N22
D318           20130509410            descricao do item                                                                                   10UN 10010T7N22
D318           20130509510            descricao do item                                                                                   10UN 10010T7N22
D324           20130509110            descricao do item                                                                                   10UN 10010T7N22
D324           20130509210            descricao do item                                                                                   10UN 10010T7N22
D324           20130509310            descricao do item                                                                                   10UN 10010T7N22
D324           20130509410            descricao do item                                                                                   10UN 10010T7N22
D324           20130509510            descricao do item                                                                                   10UN 10010T7N22
D335           20130509110            descricao do item                                                                                   10UN 10010T7N22
D335           20130509210            descricao do item                                                                                   10UN 10010T7N22
D335           20130509310            descricao do item                                                                                   10UN 10010T7N22
D335           20130509410            descricao do item                                                                                   10UN 10010T7N22
D335           20130509510            descricao do item                                                                                   10UN 10010T7N22
D340           20130509110            descricao do item                                                                                   10UN 10010T7N22
D340           20130509210            descricao do item                                                                                   10UN 10010T7N22
D340           20130509310            descricao do item                                                                                   10UN 10010T7N22
D340           20130509410            descricao do item                                                                                   10UN 10010T7N22
D340           20130509510            descricao do item                                                                                   10UN 10010T7N22
D340           20130509110            descricao do item                                                                                   10UN 10010T7N22
D340           20130509210            descricao do item                                                                                   10UN 10010T7N22
D340           20130509310            descricao do item                                                                                   10UN 10010T7N22
D340           20130509410            descricao do item                                                                                   10UN 10010T7N22
D340           20130509510            descricao do item                                                                                   10UN 10010T7N22
D342           20130509110            descricao do item                                                                                   10UN 10010T7N22
D342           20130509210            descricao do item                                                                                   10UN 10010T7N22
D342           20130509310            descricao do item                                                                                   10UN 10010T7N22
D342           20130509410            descricao do item                                                                                   10UN 10010T7N22
D342           20130509510            descricao do item                                                                                   10UN 10010T7N22
D345           20130509110            descricao do item                                                                                   10UN 10010T7N22
D345           20130509210            descricao do item                                                                                   10UN 10010T7N22
D345           20130509310            descricao do item                                                                                   10UN 10010T7N22
D345           20130509410            descricao do item                                                                                   10UN 10010T7N22
D345           20130509510            descricao do item                                                                                   10UN 10010T7N22
D360           20130509110            descricao do item                                                                                   10UN 10010T7N22
D360           20130509210            descricao do item                                                                                   10UN 10010T7N22
D360           20130509310            descricao do item                                                                                   10UN 10010T7N22
D360           20130509410            descricao do item                                                                                   10UN 10010T7N22
D360           20130509510            descricao do item                                                                                   10UN 10010T7N22
D370           20130509110            descricao do item                                                                                   10UN 10010T7N22
D370           20130509210            descricao do item                                                                                   10UN 10010T7N22
D370           20130509310            descricao do item                                                                                   10UN 10010T7N22
D370           20130509410            descricao do item                                                                                   10UN 10010T7N22
D370           20130509510            descricao do item                                                                                   10UN 10010T7N22
D3105          20130509110            descricao do item                                                                                   10UN 10010T7N22
D3105          20130509210            descricao do item                                                                                   10UN 10010T7N22
D3105          20130509310            descricao do item                                                                                   10UN 10010T7N22
D3105          20130509410            descricao do item                                                                                   10UN 10010T7N22
D3105          20130509510            descricao do item                                                                                   10UN 10010T7N22
D9007126213304072836267621242 1575
 

  • Este tópico foi criado há 4225 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.