0% found this document useful (0 votes)
7 views2 pages

Audit Report Script

Audit report script

Uploaded by

onuma.p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Audit Report Script

Audit report script

Uploaded by

onuma.p
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

select 'Header Level' as TransactionType, T0.Transtype as BaseType,T0.

CreatedBy as
BaseEntry,T0.BASE_REF as BaseNum,T0.DocDate as PostingDate ,T0.Cardcode as
CardCode,T0.CardName as CardName,T0.JrnlMemo as Memo,
T0.ItemCode as ItemCode,T0.Dscription as ItemName,
D2.ItmsGrpNam as ItemGroup,--D3.UgpName as UOMGroup,
D1.CntUnitMsr as InvenUOM,
(SELECT TOP (1) Descr
FROM dbo.UFD1 AS Z1
WHERE (TableID = 'OITM') AND (FldValue = D1.U_SubGroup))
AS SubGroup,
(SELECT TOP (1) Name
FROM dbo.[@TSR_CATEGORYGROUP] AS Z2
WHERE (Code = D1.U_TSR_CategoryGroup)) AS CategoryGroup,
(SELECT TOP (1) Name
FROM dbo.[@TSR_CATEGORY] AS Z3
WHERE (Code = D1.U_TSR_Category)) AS Category,
(SELECT TOP (1) Name
FROM dbo.[@TSR_SPEC] AS Z4
WHERE (Code = D1.U_TSR_Spec)) AS Spec,
(SELECT TOP (1) Name
FROM dbo.[@TSR_SHAPE] AS Z5
WHERE (Code = D1.U_TSR_Shape)) AS Shape,
(SELECT TOP (1) Name
FROM dbo.[@TSR_SIZE] AS Z6
WHERE (Code = D1.U_TSR_Size)) AS Size,
(SELECT TOP (1) Name
FROM dbo.[@TSR_PLANT] AS Z7
WHERE (Code = D1.U_TSR_Plant)) AS Plant,
'' as BatchNum, T0.InQty,T0.OutQty * -1 as OutQty,T0.TransValue
from OINM T0 left outer join
OITM D1 ON T0.ItemCode = D1.ItemCode left outer join
OITB D2 ON D1.ItmsGrpCod = D2.ItmsGrpCod left outer join
OUGP D3 ON D2.UgpEntry = D3.UgpEntry
where D1.ItmsGrpCod = '103' --and T0.ItemCode = 'TM101013'

Union all

select 'Batch Level' as TransactionType, BT1.BaseType as BaseType, BT1.BaseEntry as


BaseEntry, BT1.BaseNum as BaseNum, BT1.DocDate as Postingdate, BT1.CardCode as
CardCode, BT1.CardName as cardName, ' ' as Memo,
BT1.ItemCode as ItemCode, BT1.ItemName as ItemName,
(select top 1 D1.ItmsGrpNam from OITB D1 inner join OITM D2 on D1.ItmsGrpCod =
D2.ItmsGrpCod where D2.ItemCode = BT1.ItemCode) as ItemGroup,
--(select top 1 D3.UgpName from OUGP D3 inner join OITB D4 on D3.UgpEntry =
D4.UgpEntry inner join OITM D6 on D6.ItemCode = BT1.ItemCode where D6.ItemCode =
BT1.ItemCode) as UOMGroup,
(select top 1 D5.CntUnitMsr from OITM D5 where D5.ItemCode = BT1.ItemCode) as
InvenUOM,

' ' AS SubGroup,


' ' AS CategoryGroup,
' ' AS Category,
' ' AS Spec,
' ' AS Shape,
' ' AS Size,
' ' AS Plant,
BT1.Batchnum as BatchNum,
Case WHEN BT1.Direction = 0 THEN BT1.Quantity ELSE 0 END AS InQty,
Case WHEN BT1.Direction = 1 THEN BT1.Quantity * -1 ELSE 0 END AS OutQty,
'0.000000' as TransValue
from IBT1 BT1
--where (BT1.ItemCode = 'TM101013'
where exists (
select *
from OITM
where OITM.ItemCode = BT1.ItemCode
and OITM.ItmsGrpCod = '103'

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy