web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Accounts Payable Aging and Creating Excel Query

(0) ShareShare
ReportReport
Posted on by 5

I need some assistance in creating a Specialized AP Aging Report in excel.  I am able to run this report directly from SL but cannot convert the report to excel or convert a pdf without manipulating the data.  I have tried to pull in tables like AP_Balance thinking I would have a listing of Vendors with their open balances or even just invoice balances for the current year but that has not been successful either.  Are there any other tables I could link with AP_Balance  which would result in a listing of open invoices, inv date, and due date?  I could do formulas to calculate the aging (30,60,90+)

I have the same question (0)
  • Brian_IL Profile Picture
    719 on at

    You may want to try using Quick Query - AP Documents view. The view could be filtered by document balance not equal to 0, then exported to Excel.

    Most SL Crystal reports are formatted for readability on paper copies, exporting would require cleanup to use in another program. A new Crystal report format could be added for exporting that data by removing report headers / footers and paying attention to alignment of column headings with the details.

  • Suggested answer
    Manuel VelaU Profile Picture
    15 on at

    Hola, yo lo que hice fue crear una vista en SQL y luego ejecutar un script en excel para esa visa. no es lo mas fino pero si funcional:

    CREATE VIEW XDocumentosCxP  AS

    SELECT

    Tipo='V',

    --Parent = d.RefNbr,

    --Acct = d.Acct,

    --CpnyID = d.CpnyID,

    --Sub = d.Sub,

    VendID=d.VendId,

       VName =Rtrim(d.VendID)+' '+Rtrim(v.Name),

    dStatus = d.Status,

    RefNbr = d.RefNbr,

    PONbr=d.PONbr,

    DueDate = d.DueDate,

    PayDate = d.PayDate,

    DiscDate = d.DiscDate,

    DocDate = d.DocDate,

    InvcNbr = d.InvcNbr,

    InvcDate = d.InvcDate,

    DocType = d.DocType,

       PerEnt = d.PerEnt,

       InvtID='',

       --MasterDocNbr = d.MasterDocNbr,

    PerPost = d.PerPost,

    --PerClosed = d.PerClosed,

    OrigDocAmt = d.OrigDocAmt * (CASE d.DocType WHEN 'AD' THEN -1 WHEN 'PP' THEN -1 ELSE 1 END),

    DocBal = CASE d.DocType WHEN 'AD' THEN -d.DocBal

                                    WHEN 'PP' then isnull((SELECT -sum(j.adjamt) from apadjust j where d.refnbr = j.adjdrefnbr and j.adjddoctype='PP'),0)

    ELSE d.DocBal END,

    CuryOrigDocAmt = d.CuryOrigDocAmt * (CASE d.DocType WHEN 'AD' THEN -1 WHEN 'PP' THEN -1 ELSE 1 END),

    CuryDocBal = CASE d.DocType WHEN 'AD' THEN -d.CuryDocBal

                                    WHEN 'PP' then isnull((SELECT -sum(j.curyadjdamt) from apadjust j where d.refnbr = j.adjdrefnbr and j.adjddoctype='PP'),0)

    ELSE d.CuryDocBal END,

    CuryID = d.CuryID,

    ParentType = d.DocType,

       vStatus = v.Status,

       vCuryID = v.CuryID,

    ClassID =Rtrim(v.ClassID)+' '+Rtrim(C.Descr)

    FROM Vendor v

    INNER JOIN APDoc d ON d.VendID=v.VendID

    INNER JOIN dbo.VendClass C ON v.ClassID = C.ClassID

    WHERE d.Rlsed = 1 AND d.DocType NOT IN ('CK','HC','ZC', 'VC', 'VM', 'VT') AND (d.DocBal<>0 OR d.DocType='PP')

    este es el script que puedes correr desde excel:

    SELECT

    Tipo='V',

    'Tipo_Prov'=SUBSTRING(VendID,1,1),

    'Descripcion'=VName,

    'Clase'=ClassID,

    'Referencia'=RefNbr,

    'StatusDoc'= dStatus,

    'Moneda'=CuryID,

    'OC'=PONbr,

    'Factura'=InvcNbr,

    'Tipo Doc'=DocType,

    'Fecha Factura'=InvcDate,

    'No. de Parte'= '',

    'Cantidad'= '',

    'P. Unitario'= '',

    Total=DocBal,

    'Fecha Vencimeinto'=DueDate,

    'Fecha Arribo'= '',

    Actual = SUM(CASE

    WHEN CAST(DATEDIFF(DAY, 0, GETDATE()) AS DATETIME)  <= DueDate THEN DocBal ELSE 0 END),

    'Semana 1' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) <= CONVERT(INT, 7) AND

    DATEDIFF(Day, DueDate, GETDATE() ) >= 1 THEN DocBal

    ELSE 0 END),

    'Semana 2' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) <= CONVERT(INT, 14) AND

    DATEDIFF(Day, DueDate, GETDATE() ) > CONVERT(INT, 7) THEN DocBal

    ELSE 0 END),

    'Semana 3' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) <= CONVERT(INT, 21) AND

    DATEDIFF(Day, DueDate, GETDATE() ) > CONVERT(INT, 14) THEN DocBal

    ELSE 0 END),

    ----------------------------------------------

    'Semana 4' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) <= CONVERT(INT, 28) AND

    DATEDIFF(Day, DueDate, GETDATE() ) > CONVERT(INT, 21) THEN DocBal

    ELSE 0 END),

    '31-60' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) <= CONVERT(INT, 60) AND

    DATEDIFF(Day, DueDate, GETDATE() ) > CONVERT(INT, 28) THEN DocBal

    ELSE 0 END),

    '61-90' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) <= CONVERT(INT, 90) AND

    DATEDIFF(Day, DueDate, GETDATE() ) > CONVERT(INT, 60) THEN DocBal

    ELSE 0 END),

    'Mas de 90' = SUM(CASE

    WHEN DATEDIFF(Day, DueDate, GETDATE() ) > CONVERT(INT, 90) THEN DocBal

    ELSE 0 END)

    FROM XDocumentosCxP

    WHERE DocBal <>0

    GROUP BY VendID,VName,ClassID,RefNbr,dStatus,PONbr,InvcNbr,CuryID,DocType,InvcDate,DocBal,DueDate

    espero te sirva

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans