Hello All
I'm trying to generate a query/report to allow managers to see the items booked to a certain cost code. I have generated the query below which gives most of teh required information. However, there is no description for each of teh entries. Is there a anyone who can assist to confirm the best column and table to extract that from please, i.e. do I have to track back to the PO line or is there somewhere else where this is held inthe DB?
SELECT
T3.glseg AS [Account],
LTRIM(T0.ivcnum) AS [Invoice Number],
T1.ivclinnum AS [Invoice Line Number],
--T0.ivsmoi,
--T1.invsumm_oi,
T1.amtbas_amt AS [Line Total Amount Net],
T1.amtbas_amt+ISNULL(T2.TaxAmount_amt,0) AS [Line Total Amount Gross],
ISNULL(T2.TaxAmount_amt,0) AS [Total Line Tax],
T1.amtbas_cur AS [Currency],
T4.id AS [Vendor Number],
T4.aenm AS [Vendor Name],
T1.apptext
FROM
mc.IVCSUM T0
LEFT OUTER JOIN MC.IVCLINE T1 ON T0.IVSMOI = T1.INVSUMM_OI
LEFT OUTER JOIN MC.INVTAX T2 ON T1.IVLNOI = T2.IVCLINREF_OI
LEFT OUTER JOIN MC.FMLINE T3 ON T1.ivlnoi = T3.ivclinref_oi
LEFT OUTER JOIN MC.VENDOR T4 ON T1.PAYTOVEND_OI = T4.VENDOI
WHERE
(1=1)
AND ivcnum LIKE '%1234567'
AND T3.glseg LIKE '1234-%-12345'
AND T0.ivcsent_date BETWEEN '2016-01-01' AND dateadd(day,1,'2016-12-31')
ORDER BY
T3.glseg,
LTRIM(T0.ivcnum),
T1.ivclinnum
Thanks
Regards
Dan