Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN
- FOR
- SELECT
- P.ID ,
- P.LANC_SITUACAO,
- P.DATA,
- P.HORA,
- LEFT(P.USUARIO,15),
- P.CLI_ID,
- P.SAT_SIT,
- P.NFE_ID,
- P.ENTREGA_SIT,
- P.NFE_SIT,
- P.SIT_PAGAMENTO,
- P.TIPO_LANC,
- P.CHNFE,
- P.VTOTALPROD,
- P.VDESC,
- P.VACRES,
- P.VTOTAL,
- P.QTDITENS,
- P.VTOTSDESC,
- P.OBSPED,
- P.OBSNFE,
- D.CLI_ID,
- D.CLI_NOME,
- D.ID_PED,
- D.ID,
- D.CLI_CPFCNPJ
- FROM NFEPED_DESTINATARIO D
- LEFT JOIN NFEPED P ON (D.ID = P.CLI_ID)
- WHERE
- (
- ( P.DATA BETWEEN :PDATEINI AND :PDATEFIM )
- )
- AND
- (
- ( D.CLI_NOME LIKE :PDEST )
- )
- AND
- (
- ( P.ID LIKE :PIDLANC )
- )
- AND
- (
- ( D.CLI_CPFCNPJ LIKE :PCPFCNPJ )
- )
- AND
- (
- ( P.usuario LIKE :PUSER )
- )
- AND
- (
- ( P.SAT_SIT LIKE :PSATSIT )
- OR ( :PSATSIT IS NOT NULL )
- OR ( :psatsit <> 'TODOS' )
- )
- AND
- (
- ( P.lanc_situacao LIKE :PSITLANCAMENTO )
- OR ( :PSITLANCAMENTO IS NULL )
- )
- AND
- (
- ( P.nfe_sit LIKE :PSITNFE ) OR ( :PSITNFE IS NULL )
- )
- AND
- (
- ( P.entrega_sit LIKE :PSITENTREGA ) OR ( :PSITENTREGA IS NOT NULL )
- OR ( :PSITENTREGA <> 'TODOS' )
- )
- AND
- (
- ( P.chnfe LIKE :PCHAVENFE ) OR ( :PCHAVENFE IS NOT NULL )
- )
- AND
- (
- EXISTS( SELECT nfe_peditens.numped,
- nfe_peditens.det_items_prod_xprod
- FROM nfe_peditens
- WHERE
- (
- ( nfe_peditens.numped = P.id )
- ) AND
- (
- ( nfe_peditens.det_items_prod_xprod
- CONTAINING :PDESCPROD )
- ) )
- )
- ORDER BY DATA ASC
- INTO :ID,
- :LANC_SITUACAO,
- :DATA,
- :HORA,
- :USUARIO,
- :CLI_ID,
- :SAT_SIT,
- :NFE_ID,
- :ENTREGA_SIT,
- :NFE_SIT,
- :SIT_PAGAMENTO,
- :TIPO_LANC,
- :CHNFE,
- :VTOTALPROD,
- :VDESC,
- :VACRES,
- :VTOTAL,
- :QTDITENS,
- :VTOTSDESC,
- :OBSPED,
- :OBSNFE,
- :CLI_ID1,
- :CLI_NOME,
- :ID_PED,
- :ID1,
- :CLI_CPFCNPJ
- DO
- BEGIN
- SUSPEND;
- END
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement