Relação nota-fiscal x tit_acr

100 views
Skip to first unread message

Fabiano Soares da Silva

unread,
Jun 1, 2022, 8:18:29 AM6/1/22
to Progress - 4GL
Bom dia a todos,
alguém sabe me dizer como chego nas notas fiscais de um título de contas a receber.

Estou no TIT_ACR.
image.png

Muito obrigado

Anderson Silvano

unread,
Jun 1, 2022, 9:05:34 AM6/1/22
to progre...@googlegroups.com
Bom dia Fabiano,

Acredito que voce possa relacionar as tabelas assim... se alguém tiver outra forma avise ai... 

Pela tit_acr voce acha a fat-duplic e pela fat-duplic voce busca a nota-fiscal

FOR EACH fat-duplic NO-LOCK:

    IF CAN-FIND(FIRST tit_acr
                WHERE tit_acr.cod_estab     = fat-duplic.cod-estabel
                AND   tit_acr.cod_ser_docto = fat-duplic.serie    
                AND   tit_acr.cod_tit_acr   = fat-duplic.nr-fatura
                AND   tit_acr.cod_parcela   = fat-duplic.parcela) THEN DO:
        MESSAGE "achou Titulo"
            VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
    END.

END.

--
Recebeu esta mensagem porque subscreveu ao grupo "Progress - 4GL" do Grupos do Google.
Para anular a subscrição deste grupo e parar de receber emails do mesmo, envie um email para progress_4gl...@googlegroups.com.
Para ver este debate na Web, visite https://groups.google.com/d/msgid/progress_4gl/CAChj0-BKTuLaHfo8D5tE_S3W6goJJxDWmsBg0sX%3Dx%3D4OK%3D4JGg%40mail.gmail.com.

Marcelo Torres

unread,
Jun 1, 2022, 9:10:18 AM6/1/22
to progre...@googlegroups.com
Bom dia Fabiano.

Tenta pela tabela fat-duplic.
É mais ou menos assim:

nota-fiscal  --->  fat-duplic  ---> tit_acr

Vai encontrar todos os campos da chave da tabela tit_acr na fat-duplic.

tit_acr.cod_estab = fat-duplic.cod-estabel
tit_acr.cod_espec_docto = fat-duplic.cod-esp
tit_acr.cod_ser_docto = fat-duplic.serie
tit_acr.cod_tit_acr = fat-duplic.nr-fatura
tit_acr.cod_parcela = fat-duplic.parcela

Ao mesmo tempo, a tabela fat-duplic tem ligação com a nota-fiscal:

fat-duplic.cod-estabel = nota-fiscal.cod-estabel
fat-duplic.serie = nota-fiscal.serie
fat-duplic.nr-fatura = nota-fiscal.nr-fatura


Lembrando que para um registro na tabela nota-fiscal podem haver mais de um na tabela fat-duplic, alterando apenas o campo "parcela".

Espero ter ajudado.


Att,
Marcelo Torres








--

Fabiano Soares da Silva

unread,
Jun 1, 2022, 9:45:55 AM6/1/22
to Progress - 4GL
Muito obrigado pela ajuda Marcelo Torres e Anderson Silvano.

Para alguns títulos consegui chegar na nota e para outros não.
Vou tentar analisar o motivo.

Segue for each que montei:
for each tit_acr no-lock
    where tit_acr.cod_estab = "112"
    and   tit_acr.cod_tit_acr = "0035420"
    and   tit_acr.cod_parcela = "1"
    ,each fat-duplic no-lock
    where fat-duplic.cod-estabel = tit_acr.cod_estab
    and   fat-duplic.cod-esp     = tit_acr.cod_espec_docto
    and   fat-duplic.serie       = tit_acr.cod_ser_docto
    and   fat-duplic.nr-fatura   = tit_acr.cod_tit_acr
    and   fat-duplic.parcela     = tit_acr.cod_parcela
    ,each nota-fiscal
    where nota-fiscal.cod-estabel = fat-duplic.cod-estabel
    and   nota-fiscal.serie       = fat-duplic.serie
    and   nota-fiscal.nr-nota-fis = fat-duplic.nr-fatura
    no-lock:
    MESSAGE nota-fiscal.serie
        skip
        nota-fiscal.nr-nota-fis

        VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
end.

Marcelo Torres

unread,
Jun 1, 2022, 10:45:30 AM6/1/22
to progre...@googlegroups.com
Seu FIND na tabela nota-fiscal deveria ser:

FIND FIRST nota-fiscal
    WHERE nota-fiscal.cod-estabel = fat-duplic.cod-estabel AND
          nota-fiscal.serie       = fat-duplic.serie AND
          nota-fiscal.nr-fatura   = fat-duplic.nr-fatura
    USE-INDEX ch-fatura
    NO-LOCK NO-ERROR.



Reply all
Reply to author
Forward
0 new messages