Hi All,
I have the query for purchase tax report. Now i want to add few fields from AP Credit Memo.
Query:
/*select from ORDR t0*/ declare @start as datetime /* where */ set @start = /* t0.taxdate*/ '[%0]' /*select from ORDR t0*/
declare @end as datetime /* where */ set @end = /* t0.taxdate*/ '[%1]'
SELECT DISTINCT T0.DocDate ,T0.DocNum ,
T0.NumAtCard AS 'Ex Invoice No', T0.CardCode as 'Customer Code', T0.CardName as 'Customer Name', T0.Address,T3.TaxId0 AS' PAN No',T3.TaxId1 as 'TIN No',T3.TaxId3 as'service tax number',
T0.DocTotal as 'Invoice Total', T0.VatSum as 'Total Tax', T4.[Location],
ISNULL((SELECT SUM(Z0.BaseSum) FROM PCH4 Z0 WHERE Z0.DocEntry = T0.DocEntry AND Z0.staType IN(5)),0) AS 'Base Amount',
ISNULL((SELECT SUM(Z0.TaxSum) FROM PCH4 Z0 WHERE Z0.DocEntry = T0.DocEntry AND Z0.staType IN(5)),0) as 'Service Tax Amt',
ISNULL((SELECT SUM(Z0.TaxSum) FROM PCH4 Z0 WHERE Z0.DocEntry = T0.DocEntry AND Z0.staType IN(6)),0) as 'Service _Cess Amt',
ISNULL((SELECT SUM(Z0.TaxSum) FROM PCH4 Z0 WHERE Z0.DocEntry = T0.DocEntry AND Z0.staType IN(-10)),0) as 'Service_HCess Amt'
FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN PCH4 T2 ON T0.DocEntry = T2.DocEntry
LEFT OUTER JOIN PCH12 T3 ON T0.DocEntry=T3.DocEntry left JOIN OLCT T4 ON T1.LocCode = T4.Code
WHERE (T0.docdate >= @start and T0.docdate <= @end) AND (T2.[staType]=5) ORDER BY 'DocNum'
i need AP credit memo(ORPC) docdate, doc num, base amount, total tax, document total, remarks fields to be added and like against which AP invoice the AP credit memo has been raised.
Please do the needful.
Thanks & Regards,
Ravi.