Hi,
Please try this query:
SELECT T0.[DocDate], case when T0.[TransType] = 13 then 'AR'
when T0.[TransType] = 14 then 'ARCredit'
when T0.[TransType] = 15 then 'Delivery'
when T0.[TransType] = 16 then 'SalesReturn'
when T0.[TransType] = 203 then 'ARDown'
when T0.[TransType] = 20 then 'Goods Receipt'
when T0.[TransType] = 21 then 'Goods Return'
when T0.[TransType] = 204 then 'APDown'
when T0.[TransType] = 18 then 'APInvoice'
when T0.[TransType] = 13 then 'AP Credit Memo'
when T0.[TransType] = 69 then 'LandedCost'
when T0.[TransType] = 24 then 'Incoming Payment'
when T0.[TransType] = 25 then 'Deposit'
when T0.[TransType] = 46 then 'VendorPayment'
when T0.[TransType] = 57 then 'Check for Payment'
when T0.[TransType] = 76 then 'Postdated Check'
when T0.[TransType] = 58 then 'Inventory list'
when T0.[TransType] = 59 then 'Good Receipt'
when T0.[TransType] = 60 then 'Good Issue'
when T0.[TransType] = 67 then 'Inventory Transfer'
when T0.[TransType] = 68 then 'Work Instruction'
when T0.[TransType] = 162 then 'Inventory Valuation'
when T0.[TransType] = 202 then 'Production order'
when T0.[TransType] = -2 then 'Opening Balance'
when T0.[TransType] = -3 then 'Closing Balance'
when T0.[TransType] = 30 then 'Journal Entry'
when T0.[TransType] = 321 then 'Internal Reconilation'
when T0.[TransType] = 10000046 then 'Data archive'
when T0.[TransType] = 310000001 then 'Initial Qty'
when T0.[TransType] = 10000071 then 'Inventory posting' end as 'Doc Type',T0.[BASE_REF] as Document, T0.[Warehouse] as Whse, T1.[FormatCode] as 'G/L Acct/BP Code', T1.[AcctName] as 'G/L Acct/BP Name', sum(T0.[InQty]) as 'Rec.Qty', sum(T0.[OutQty]) as 'Iss. Qty', T0.[Currency], T0.[Price] as 'Price after Disc.',sum(T0.[InQty] - T0.[OutQty]) as 'Balance.' FROM OINM T0 INNER JOIN OACT T1 ON t0.cardcode = T1.AcctCode WHERE T0.[ItemCode] = '[%0]' group by T0.[DocDate],T0.[TransType],T0.[BASE_REF],T0.[Warehouse],T1.[FormatCode],T1.[AcctName],T0.[Currency], T0.[Price]
union
SELECT T0.[DocDate], case when T0.[TransType] = 13 then 'AR'
when T0.[TransType] = 14 then 'ARCredit'
when T0.[TransType] = 15 then 'Delivery'
when T0.[TransType] = 16 then 'SalesReturn'
when T0.[TransType] = 203 then 'ARDown'
when T0.[TransType] = 20 then 'Goods Receipt'
when T0.[TransType] = 21 then 'Goods Return'
when T0.[TransType] = 204 then 'APDown'
when T0.[TransType] = 18 then 'APInvoice'
when T0.[TransType] = 13 then 'AP Credit Memo'
when T0.[TransType] = 69 then 'LandedCost'
when T0.[TransType] = 24 then 'Incoming Payment'
when T0.[TransType] = 25 then 'Deposit'
when T0.[TransType] = 46 then 'VendorPayment'
when T0.[TransType] = 57 then 'Check for Payment'
when T0.[TransType] = 76 then 'Postdated Check'
when T0.[TransType] = 58 then 'Inventory list'
when T0.[TransType] = 59 then 'Good Receipt'
when T0.[TransType] = 60 then 'Good Issue'
when T0.[TransType] = 67 then 'Inventory Transfer'
when T0.[TransType] = 68 then 'Work Instruction'
when T0.[TransType] = 162 then 'Inventory Valuation'
when T0.[TransType] = 202 then 'Production order'
when T0.[TransType] = -2 then 'Opening Balance'
when T0.[TransType] = -3 then 'Closing Balance'
when T0.[TransType] = 30 then 'Journal Entry'
when T0.[TransType] = 321 then 'Internal Reconilation'
when T0.[TransType] = 10000046 then 'Data archive'
when T0.[TransType] = 310000001 then 'Initial Qty'
when T0.[TransType] = 10000071 then 'Inventory posting' end as 'Doc Type',T0.[BASE_REF] as Document, T0.[Warehouse] as Whse, T1.[cardCode] as 'G/L Acct/BP Code', T1.[cardName] as 'G/L Acct/BP Name', sum(T0.[InQty]) as 'Rec.Qty', sum(T0.[OutQty]) as 'Iss. Qty', T0.[Currency], T0.[Price] as 'Price after Disc.',sum(T0.[InQty] - T0.[OutQty]) as 'Balance.' FROM OINM T0 INNER JOIN OCRD T1 ON t0.cardcode = T1.cardcode WHERE T0.[ItemCode] = '[%0]' group by T0.[DocDate],T0.[TransType],T0.[BASE_REF],T0.[Warehouse],T1.[cardCode],T1.[cardName],T0.[Currency], T0.[Price]
Note: There is a small difference in this query result with system report. This query is taking all transaction even without posting journal entry. But system report will consider only with journal posting.
Thanks