SELECT INV.timestamp, INV.[Entry No_], INV.[Vendor Ledger Entry No_], INV.[Entry Type] AS InvType, INV.[Posting Date], INV.[Document Type], INV.[Document No_], INV.Amount, INV.[Amount (LCY)], INV.[Vendor No_],
INV.[Transaction No_], INV.[Debit Amount], INV.[Credit Amount], INV.[Debit Amount (LCY)], INV.[Credit Amount (LCY)], INV.[Applied Vend_ Ledger Entry No_], INV.Unapplied, INV.[Unapplied by Entry No_],
INV.[Application No_], PAY.[Entry Type] AS PayType, VLEPAY.[Document Date] AS PaymentDate, VLEPAY.[External Document No_] AS PayExtDoc, VLEINV.[Document No_] AS INVDocNo,
VLEINV.[Document Date] AS INVDocDate, VLEINV.[External Document No_] AS INVExtDoc
FROM dbo.[Pennywise$Detailed Vendor Ledg_ Entry] AS INV INNER JOIN
dbo.[Pennywise$Detailed Vendor Ledg_ Entry] AS PAY ON INV.[Vendor Ledger Entry No_] = PAY.[Vendor Ledger Entry No_] INNER JOIN
dbo.[Pennywise$Vendor Ledger Entry] AS VLEPAY ON PAY.[Document No_] = VLEPAY.[Document No_] INNER JOIN
dbo.[Pennywise$Vendor Ledger Entry] AS VLEINV ON INV.[Vendor Ledger Entry No_] = VLEINV.[Entry No_]
WHERE (INV.[Entry Type] IN (2, 4)) AND (PAY.[Entry Type] = 1) AND (INV.[Debit Amount] > 0)
INV.[Transaction No_], INV.[Debit Amount], INV.[Credit Amount], INV.[Debit Amount (LCY)], INV.[Credit Amount (LCY)], INV.[Applied Vend_ Ledger Entry No_], INV.Unapplied, INV.[Unapplied by Entry No_],
INV.[Application No_], PAY.[Entry Type] AS PayType, VLEPAY.[Document Date] AS PaymentDate, VLEPAY.[External Document No_] AS PayExtDoc, VLEINV.[Document No_] AS INVDocNo,
VLEINV.[Document Date] AS INVDocDate, VLEINV.[External Document No_] AS INVExtDoc
FROM dbo.[Pennywise$Detailed Vendor Ledg_ Entry] AS INV INNER JOIN
dbo.[Pennywise$Detailed Vendor Ledg_ Entry] AS PAY ON INV.[Vendor Ledger Entry No_] = PAY.[Vendor Ledger Entry No_] INNER JOIN
dbo.[Pennywise$Vendor Ledger Entry] AS VLEPAY ON PAY.[Document No_] = VLEPAY.[Document No_] INNER JOIN
dbo.[Pennywise$Vendor Ledger Entry] AS VLEINV ON INV.[Vendor Ledger Entry No_] = VLEINV.[Entry No_]
WHERE (INV.[Entry Type] IN (2, 4)) AND (PAY.[Entry Type] = 1) AND (INV.[Debit Amount] > 0)
No comments:
Post a Comment