45: l_gt_hint varchar2(500);
46: BEGIN
47:
48: /* Reset Global Variables */
49: fii_ar_util_pkg.reset_globals;
50:
51:
52: /* Get the parameters that the user has selected */
53: fii_ar_util_pkg.get_parameters(p_page_parameter_tbl);
49: fii_ar_util_pkg.reset_globals;
50:
51:
52: /* Get the parameters that the user has selected */
53: fii_ar_util_pkg.get_parameters(p_page_parameter_tbl);
54:
55:
56: /* Populate the dimension combination(s) that the user has access to */
57: fii_ar_util_pkg.populate_summary_gt_tables;
53: fii_ar_util_pkg.get_parameters(p_page_parameter_tbl);
54:
55:
56: /* Populate the dimension combination(s) that the user has access to */
57: fii_ar_util_pkg.populate_summary_gt_tables;
58:
59: l_gt_hint := ' leading(t) cardinality(t 1) ';
60:
61: -- Get the view by
58:
59: l_gt_hint := ' leading(t) cardinality(t 1) ';
60:
61: -- Get the view by
62: l_view_by := fii_ar_util_pkg.g_view_by;
63:
64: /* Check whether join on party is is reqd. or not */
65: IF (fii_ar_util_pkg.g_party_id <> '-111' OR l_view_by = 'CUSTOMER+FII_CUSTOMERS') THEN
66: l_child_party_where := ' AND f.party_id = gt.party_id ';
61: -- Get the view by
62: l_view_by := fii_ar_util_pkg.g_view_by;
63:
64: /* Check whether join on party is is reqd. or not */
65: IF (fii_ar_util_pkg.g_party_id <> '-111' OR l_view_by = 'CUSTOMER+FII_CUSTOMERS') THEN
66: l_child_party_where := ' AND f.party_id = gt.party_id ';
67: END IF;
68:
69: -- Check whether we need a filter for parent_party_id. This is applicable only if the Ct. dimension is hierarchial and view by
67: END IF;
68:
69: -- Check whether we need a filter for parent_party_id. This is applicable only if the Ct. dimension is hierarchial and view by
70: -- is customer.
71: IF fii_ar_util_pkg.g_is_hierarchical_flag = 'Y' and l_view_by = 'CUSTOMER+FII_CUSTOMERS' THEN
72: l_customer_where := ' and f.parent_party_id = gt.parent_party_id';
73: l_view_by_flag :=2; -- for Customer
74: END IF;
75:
87:
88: /* Check whether industry filter is reqd or not */
89: IF l_view_by = 'CUSTOMER+FII_CUSTOMERS' THEN
90: l_industry_where := NULL;
91: ELSIF fii_ar_util_pkg.g_industry_id <> '-111' OR l_view_by = 'FII_TRADING_PARTNER_CLASS+FII_TRADING_PARTNER_MKT_CLASS' THEN
92: l_industry_where := ' and f.class_code=gt.class_code and f.class_category=gt.class_category';
93: END IF;
94:
95:
109: --vkazhipu added for bug 5960517
110: IF l_view_by = 'ORGANIZATION+FII_OPERATING_UNITS' OR
111: l_view_by = 'FII_TRADING_PARTNER_CLASS+FII_TRADING_PARTNER_MKT_CLASS' THEN
112: l_view_by_flag:=1; -- for ou,industry
113: IF (fii_ar_util_pkg.g_party_id <> '-111') THEN
114: l_amount_drill := 'pFunctionName=FII_AR_BILL_ACT_TRX_CLASS&VIEW_BY=CUSTOMER+FII_CUSTOMER_ACCOUNTS&pParamIds=Y&VIEW_BY_NAME=VIEW_BY_ID';
115: ELSE
116: l_amount_drill := 'pFunctionName=FII_AR_BILL_ACT_TRX_CLASS&pParamIds=Y&VIEW_BY_NAME=VIEW_BY_ID';
117: END IF;
145: l_cust_acct_or_leaf_cb_drill:= 'pFunctionName=FII_AR_CB_ACT_DTL&VIEW_BY_NAME=VIEW_BY_ID&pParamIds=Y';
146: END IF;
147:
148: -- Construct the order by
149: IF(instr(fii_ar_util_pkg.g_order_by,',') <> 0) THEN
150:
151: /*This means no particular sort column is selected in the report
152: So sort on the default column in descending order
153: NVL is added to make sure the NULL values appear last*/
153: NVL is added to make sure the NULL values appear last*/
154:
155: l_order_by := 'ORDER BY NVL(FII_AR_BILL_ACT_AMT, -999999999) DESC';
156:
157: ELSIF(instr(fii_ar_util_pkg.g_order_by, ' DESC') <> 0)THEN
158:
159: /*This means a particular sort column is clicked to have descending order
160: in which case we would want all the NULL values to appear last in the
161: report so add an NVL to that column*/
159: /*This means a particular sort column is clicked to have descending order
160: in which case we would want all the NULL values to appear last in the
161: report so add an NVL to that column*/
162:
163: l_order_column := substr(fii_ar_util_pkg.g_order_by,1,instr(fii_ar_util_pkg.g_order_by, ' DESC'));
164: l_order_by := 'ORDER BY NVL('|| l_order_column ||', -999999999) DESC';
165:
166: ELSE
167:
172:
173: END IF;
174:
175: IF l_view_by_flag=3 THEN /* Viewby is Ct. acct */
176: l_inner_from_clause := fii_ar_util_pkg.get_from_statement;
177: l_inner_where_clause := ' and '||fii_ar_util_pkg.get_where_statement;
178: ELSE
179: l_inner_from_clause := 'fii_ar_summary_gt ';
180: l_inner_where_clause := NULL;
173: END IF;
174:
175: IF l_view_by_flag=3 THEN /* Viewby is Ct. acct */
176: l_inner_from_clause := fii_ar_util_pkg.get_from_statement;
177: l_inner_where_clause := ' and '||fii_ar_util_pkg.get_where_statement;
178: ELSE
179: l_inner_from_clause := 'fii_ar_summary_gt ';
180: l_inner_where_clause := NULL;
181: END IF;
179: l_inner_from_clause := 'fii_ar_summary_gt ';
180: l_inner_where_clause := NULL;
181: END IF;
182:
183: l_cust_suffix := fii_ar_util_pkg.g_cust_suffix;
184: l_curr_suffix := fii_ar_util_pkg.g_curr_suffix;
185:
186: -- Now the variable initialization is done, Start to build the PMV Query
187:
180: l_inner_where_clause := NULL;
181: END IF;
182:
183: l_cust_suffix := fii_ar_util_pkg.g_cust_suffix;
184: l_curr_suffix := fii_ar_util_pkg.g_curr_suffix;
185:
186: -- Now the variable initialization is done, Start to build the PMV Query
187:
188: l_sql_stmt := l_sql_stmt || 'SELECT VIEWBY,
235: DECODE(NVL(SUM(FII_AR_BA_DM_AMT),0),0,'''','''|| l_amount_drill ||''') FII_AR_BA_DM_AMT_DRILL ,
236: DECODE(NVL(SUM(FII_AR_BA_CB_AMT),0),0,'''','''|| l_amount_drill ||''') FII_AR_BA_CB_AMT_DRILL ,
237: NULL FII_AR_VIEW_BY_DRILL';
238: ELSIF /*( l_view_by_flag = 3 )
239: or */ (l_view_by = 'CUSTOMER+FII_CUSTOMERS' and fii_ar_util_pkg.g_is_hierarchical_flag = 'N' ) THEN
240:
241: l_sql_stmt := l_sql_stmt ||'DECODE(NVL(SUM(FII_AR_BILL_ACT_AMT),0),0,'''','''|| l_cust_acct_or_leaf_amt_drill || ''') FII_AR_BILL_ACT_AMT_DRILL ,
242: DECODE(NVL(SUM(FII_AR_BA_INV_AMT),0),0,'''','''||l_cust_acct_or_leaf_inv_drill || ''') FII_AR_BA_INV_AMT_DRILL ,
243: DECODE(NVL(SUM(FII_AR_BA_DM_AMT),0),0,'''','''||l_cust_acct_or_leaf_dm_drill || ''') FII_AR_BA_DM_AMT_DRILL ,
326: l_sql_stmt := l_sql_stmt || l_order_by;
327:
328:
329: /* Pass back the pmv sql along with bind variables to PMV */
330: fii_ar_util_pkg.bind_variable(l_sql_stmt, p_page_parameter_tbl, ba_trx_class_sum_sql, ba_trx_class_sum_out);
331:
332: END get_bill_act_trx_class;
333:
334: