SELECT BUSINESS_UNIT ,PO_ID ,SUM(MERCHANDISE_AMT) FROM PS_PO_LINE_SHIP WHERE CANCEL_STATUS <> 'X' GROUP BY BUSINESS_UNIT,PO_ID UNION SELECT S.BUSINESS_UNIT BUSINESS_UNIT ,S.PO_ID PO_ID ,SUM(ADJ_AMT) FROM PS_PO_VAL_ADJ V , PS_PO_LINE_SHIP S WHERE V.adj_impact_type = 'S' AND V.LC_COMP_ON_PO = 'Y' AND V.BUSINESS_UNIT = S.BUSINESS_UNIT AND V.PO_ID = S.PO_ID AND V.LINE_NBR = S.LINE_NBR AND V.SCHED_NBR = S.SCHED_NBR AND S.CANCEL_STATUS <> 'X' GROUP BY S.BUSINESS_UNIT,S.PO_ID UNION SELECT BUSINESS_UNIT ,PO_ID ,SUM(saletx_amt) + SUM( usetax_amt) AMT_TAX FROM PS_PO_LINE_DISTRIB WHERE DISTRIB_LN_STATUS <> 'X' AND SUT_APPLICABILITY <> 'D' GROUP BY BUSINESS_UNIT,PO_ID UNION SELECT S.BUSINESS_UNIT BUSINESS_UNIT ,S.PO_ID PO_ID ,SUM(D.VAT_AMT) AMT_TAX FROM PS_PO_LINE_DISTRIB D , PS_PO_LINE_SHIP S WHERE D.BUSINESS_UNIT = S.BUSINESS_UNIT AND D.PO_ID = S.PO_ID AND D.LINE_NBR = S.LINE_NBR AND D.SCHED_NBR = S.SCHED_NBR AND S.VAT_TREATMENT NOT IN ('SSI', 'SGI') AND D.DISTRIB_LN_STATUS <> 'X' GROUP BY S.BUSINESS_UNIT,S.PO_ID UNION SELECT BUSINESS_UNIT ,PO_ID ,SUM(EXD_TAX_AMT) AMT_TAX FROM PS_PO_DIST_EXS_VW GROUP BY BUSINESS_UNIT ,PO_ID UNION SELECT BUSINESS_UNIT ,PO_ID ,SUM(STX_TAX_AMT) AMT_TAX FROM PS_PO_DIST_EXS_VW GROUP BY BUSINESS_UNIT ,PO_ID UNION SELECT BUSINESS_UNIT ,PO_ID ,SUM(CSD_TAX_AMT) FROM PS_PO_LN_DIST_EXS GROUP BY BUSINESS_UNIT ,PO_ID
|