ddv_PayablesWithPOs

This is a view of all open Payables documents with links to POP receipts and POs where available. 

Since there can be more than one Receipt and/or PO for a voucher, we've provided them in a comma separated list. 

The code makes use of two different functions ddf_CommaSeparatedPOs and ddf_CommaSeparatedReceipts

 

-- Drop the view if it already exists
IF object_id(N'ddv_PayablesWithPOs', 'V') IS NOT NULL
    DROP VIEW ddv_PayablesWithPOs
GO
    
CREATE view ddv_PayablesWithPOs
    
AS
 
--  select * from ddv_PayablesWithPOs order by InvoiceNumber
 
select
        pt.VENDORID as VendorID,
        v.VENDNAME as VendorName,
        pt.VCHRNMBR as InvoiceNumber,
        pt.docnumbr as VendorDocument,
        pt.DOCAMNT as Amount,
        PT.DOCDATE as InvoiceDate,
        dbo.ddf_CommaSeparatedReceipts(pt.VENDORID, pt.DOCNUMBR) as Receipt,
        dbo.ddf_CommaSeparatedPOs(pt.VENDORID, pt.DOCNUMBR) as PONumber,
        case when pt.CURTRXAM = 0 then 'Yes' else 'No' end as Paid
    from PM20000 pt
        join pm00200 v on v.vendorid = pt.vendorid
    where pt.DOCTYPE = 1
 
GO
 
grant select on ddv_PayablesWithPOs to public

 

 

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences