0% found this document useful (0 votes)
131 views3 pages

GMM Report

The document contains a SQL query that selects data from multiple tables related to inventory, batches, production orders, and raw material issuance. The query returns document entry, number, line number, main item group, series name, document date, item code, description, quantities, batch numbers, production order details, and raw material details for inventory and delivery documents within a specified date range where the document type is 'I' and the series name or main item group match certain values.

Uploaded by

Karan Patel
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)
131 views3 pages

GMM Report

The document contains a SQL query that selects data from multiple tables related to inventory, batches, production orders, and raw material issuance. The query returns document entry, number, line number, main item group, series name, document date, item code, description, quantities, batch numbers, production order details, and raw material details for inventory and delivery documents within a specified date range where the document type is 'I' and the series name or main item group match certain values.

Uploaded by

Karan Patel
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/ 3

Select DISTINCT TT1."DocEntry",TT1."DocNum",T0."LineNum",T7.

"ItmsGrpNam" "Main Item


Group",
T3."SeriesName",TT1."DocDate",T0."ItemCode",T0."Dscription",T0."Quantity",
T1."BatchNum" "Inv Batch",T1."Quantity" as "Batch
Qty",T1."BsDocEntry",T10."ItemCode",
TT11."ItmsGrpNam",(I1."Quantity"/T9."CmpltQty")*T1."Quantity" "RM Selected"
,I1."BatchNum" "Iss Batch",I0."Dscription" "Iss Desc" ,I0."BaseRef",
(T10."LineNum"+1)"lIne Num",T0."LineTotal",T9."CmpltQty"
,T1."CardName" "FG OP",I1."Quantity"
,(sELECT TT8."CardName" FROM "{?Schema@}".IBT1 TT8 Where
TT8."BatchNum"=I1."BatchNum" and TT8."BaseType"=310000001 AND
TT8."ItemCode"=I1."ItemCode")"RM OP"

from
"{?Schema@}".INV1 T0
Inner Join "{?Schema@}".OINV TT1 on TT1."DocEntry"=T0."DocEntry"
INNER JOIN "{?Schema@}".IBT1_LINK T1 On T0."DocEntry" = T1."BaseEntry" and
T0."ObjType" = T1."BaseType" and T0."LineNum" = T1."BaseLinNum"
INNER JOIN "{?Schema@}".OBTN T2 On T2."DistNumber" = T1."BatchNum" and
T0."ItemCode" = T1."ItemCode"
left outer join "{?Schema@}".NNM1 T3 on T3."Series"=TT1."Series"
left outer join "{?Schema@}".OITM T4 on T4."ItemCode"=T0."ItemCode"
left outer join "{?Schema@}".OITB T7 on T7."ItmsGrpCod"=T4."ItmsGrpCod"
left outer join "{?Schema@}".IBT1 T8 on T8."BatchNum"=T1."BatchNum" and
T8."BaseType"=59 AND T8."ItemCode"=T1."ItemCode"
left outer join "{?Schema@}".OWOR T9 on T9."DocEntry"=T8."BsDocEntry" and
T9."Type"<>'D'
Left outer join "{?Schema@}".WOR1 T10 On T10."DocEntry"=T9."DocEntry"
left outer join "{?Schema@}".OITM TT10 on T10."ItemCode"=TT10."ItemCode"
left outer join "{?Schema@}".OITB TT11 on TT11."ItmsGrpCod"=TT10."ItmsGrpCod"
Inner Join "{?Schema@}".IGE1 I0 on I0."BaseEntry"=T9."DocEntry" and
I0."ItemCode"=T10."ItemCode" and T10."LineNum"=I0."BaseLine"
INNER JOIN "{?Schema@}".IBT1_LINK I1 On I0."DocEntry" = I1."BaseEntry" and
I0."ObjType" = I1."BaseType" and I0."LineNum" = I1."BaseLinNum"

Where TT1."DocDate">= {?FDate@} and TT1."DocDate"<= {?TDate@} and


TT1."DocType"='I'
and (T3."SeriesName" like 'EXP%' or T3."SeriesName" like 'Dom%' or T3."SeriesName"
like 'Exp%' ) and T7."ItmsGrpCod"=100 and TT1."CANCELED"='N'

Union all

Select DISTINCT TT5."DocEntry",TT5."DocNum",TT4."LineNum",T7."ItmsGrpNam" "Main


Item Group",
T3."SeriesName",TT5."DocDate",TT4."ItemCode",TT4."Dscription",TT4."Quantity",
T1."BatchNum" "Inv Batch",T1."Quantity" as "Batch
Qty",T1."BsDocEntry",T10."ItemCode",TT11."ItmsGrpNam",
(I1."Quantity"/T9."CmpltQty")*T1."Quantity" "RM Selected"
,I1."BatchNum" "Iss Batch",I0."Dscription" "Iss Desc" ,I0."BaseRef",
(T10."LineNum"+1)"lIne Num",TT4."LineTotal",T9."CmpltQty"
,T1."CardName" "FG OP",I1."Quantity"
,(sELECT TT8."CardName" FROM "{?Schema@}".IBT1 TT8 Where
TT8."BatchNum"=I1."BatchNum" and TT8."BaseType"=310000001 AND
TT8."ItemCode"=I1."ItemCode")"RM OP"

from
"{?Schema@}".DLN1 T0
Inner Join "{?Schema@}".ODLN TT1 on TT1."DocEntry"=T0."DocEntry"
left outer join "{?Schema@}".INV1 TT4 on T0."DocEntry"=TT4."BaseEntry" and
T0."LineNum"=TT4."BaseLine"
Left outer join "{?Schema@}".OINV TT5 on TT5."DocEntry"=TT4."DocEntry"
INNER JOIN "{?Schema@}".IBT1_LINK T1 On T0."DocEntry" = T1."BaseEntry" and
T0."ObjType" = T1."BaseType" and T0."LineNum" = T1."BaseLinNum"
INNER JOIN "{?Schema@}".OBTN T2 On T2."DistNumber" = T1."BatchNum" and
T0."ItemCode" = T1."ItemCode"
left outer join "{?Schema@}".NNM1 T3 on T3."Series"=TT5."Series"
left outer join "{?Schema@}".OITM T4 on T4."ItemCode"=T0."ItemCode"
left outer join "{?Schema@}".OITB T7 on T7."ItmsGrpCod"=T4."ItmsGrpCod"
left outer join "{?Schema@}".IBT1 T8 on T8."BatchNum"=T1."BatchNum" and
T8."BaseType"=59 AND T8."ItemCode"=T1."ItemCode"
left outer join "{?Schema@}".OWOR T9 on T9."DocEntry"=T8."BsDocEntry" and
T9."Type"<>'D'
Left outer join "{?Schema@}".WOR1 T10 On T10."DocEntry"=T9."DocEntry"
left outer join "{?Schema@}".OITM TT10 on T10."ItemCode"=TT10."ItemCode"
left outer join "{?Schema@}".OITB TT11 on TT11."ItmsGrpCod"=TT10."ItmsGrpCod"
Inner Join "{?Schema@}".IGE1 I0 on I0."BaseEntry"=T9."DocEntry" and
I0."ItemCode"=T10."ItemCode" and T10."LineNum"=I0."BaseLine"
INNER JOIN "{?Schema@}".IBT1_LINK I1 On I0."DocEntry" = I1."BaseEntry" and
I0."ObjType" = I1."BaseType" and I0."LineNum" = I1."BaseLinNum"

Where TT5."DocDate">={?FDate@} and TT5."DocDate"<= {?TDate@} and TT1."DocType"='I'


and (T3."SeriesName" like 'EXP%' or T3."SeriesName" like 'Dom%' or T3."SeriesName"
like 'Exp%') and T7."ItmsGrpCod"=100 and TT5."CANCELED"='N'

Union all

Select DISTINCT TT1."DocEntry",TT1."DocNum",T0."LineNum",T7."ItmsGrpNam" "Main Item


Group",
T3."SeriesName",TT1."DocDate",T0."ItemCode",T0."Dscription",T0."Quantity"
,T1."BatchNum" "Inv Batch",T1."Quantity" as "Batch Qty",T1."BsDocEntry",
'' "ItemCode" ,'' "ItmsGrpNam",0 "RM Selected",'' "Iss Batch",'' "Iss Desc" ,''
"BaseRef",0 "lIne Num"
,T0."LineTotal",T8."Quantity" "CmpltQty" ,T8."CardName" "FG OP",0 "Quantity",''
"RM OP"
from
"{?Schema@}".INV1 T0
Inner Join "{?Schema@}".OINV TT1 on TT1."DocEntry"=T0."DocEntry"
INNER JOIN "{?Schema@}".IBT1_LINK T1 On T0."DocEntry" = T1."BaseEntry" and
T0."ObjType" = T1."BaseType" and T0."LineNum" = T1."BaseLinNum"
INNER JOIN "{?Schema@}".OBTN T2 On T2."DistNumber" = T1."BatchNum" and
T0."ItemCode" = T1."ItemCode"
left outer join "{?Schema@}".NNM1 T3 on T3."Series"=TT1."Series"
left outer join "{?Schema@}".OITM T4 on T4."ItemCode"=T0."ItemCode"
left outer join "{?Schema@}".OITB T7 on T7."ItmsGrpCod"=T4."ItmsGrpCod"
Inner Join "{?Schema@}".IBT1 T8 on T8."BatchNum"=T1."BatchNum" and
T8."BaseType"=310000001 AND T8."ItemCode"=T1."ItemCode"

Where TT1."DocDate">= {?FDate@} and TT1."DocDate"<= {?TDate@} and


TT1."DocType"='I'
and (T3."SeriesName" like 'EXP%' or T3."SeriesName" like 'Dom%' or T3."SeriesName"
like 'Exp%' ) and T7."ItmsGrpCod"=100 and TT1."CANCELED"='N'

Union all

Select DISTINCT TT5."DocEntry",TT5."DocNum",TT4."LineNum",T7."ItmsGrpNam" "Main


Item Group",
T3."SeriesName",TT5."DocDate",TT4."ItemCode",TT4."Dscription",TT4."Quantity"
,T1."BatchNum" "Inv Batch",T1."Quantity" as "Batch Qty",T1."BsDocEntry",
'' "ItemCode",'' "ItmsGrpNam",0 "RM Selected",'' "Iss Batch",'' "Iss Desc" ,''
"BaseRef",0 "lIne Num"
,T0."LineTotal",T8."Quantity" "CmpltQty" ,T8."CardName" "FG OP",0 "Quantity",'' "RM
OP"
from
"{?Schema@}".DLN1 T0
Inner Join "{?Schema@}".ODLN TT1 on TT1."DocEntry"=T0."DocEntry"
left outer join "{?Schema@}".INV1 TT4 on T0."DocEntry"=TT4."BaseEntry" and
T0."LineNum"=TT4."BaseLine"
Left outer join "{?Schema@}".OINV TT5 on TT5."DocEntry"=TT4."DocEntry"
INNER JOIN "{?Schema@}".IBT1_LINK T1 On T0."DocEntry" = T1."BaseEntry" and
T0."ObjType" = T1."BaseType" and T0."LineNum" = T1."BaseLinNum"
INNER JOIN "{?Schema@}".OBTN T2 On T2."DistNumber" = T1."BatchNum" and
T0."ItemCode" = T1."ItemCode"
left outer join "{?Schema@}".NNM1 T3 on T3."Series"=TT5."Series"
left outer join "{?Schema@}".OITM T4 on T4."ItemCode"=T0."ItemCode"
left outer join "{?Schema@}".OITB T7 on T7."ItmsGrpCod"=T4."ItmsGrpCod"
Inner Join "{?Schema@}".IBT1 T8 on T8."BatchNum"=T1."BatchNum" and
T8."BaseType"=310000001 AND T8."ItemCode"=T1."ItemCode"

Where TT5."DocDate">= {?FDate@} and TT5."DocDate"<= {?TDate@} and


TT1."DocType"='I'
and (T3."SeriesName" like 'EXP%' or T3."SeriesName" like 'Dom%' or T3."SeriesName"
like 'Exp%') and T7."ItmsGrpCod"=100 and TT5."CANCELED"='N'

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