72: l_gs_amount NUMBER ; -- Secondary Currency Amount
73: l_f_amount NUMBER ; -- Functional Amount
74:
75:
76: --FND Logging
77: l_full_path VARCHAR2(50) ;
78: --gaflog_value CONSTANT VARCHAR2(10) ;
79: gaflog_value CONSTANT VARCHAR2(10) := fnd_profile.value('AFLOG_ENABLED');
80: --Profile is : FND: Debug Log Enabled and FND: Debug Log Level for Log Level
82: BEGIN
83:
84: --gaflog_value := fnd_profile.value('AFLOG_ENABLED');
85:
86: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
87: fnd_log.string(fnd_log.level_statement,l_full_path,'Visitor Conversion Trend Report BEGIN');
88: END IF;
89:
90:
83:
84: --gaflog_value := fnd_profile.value('AFLOG_ENABLED');
85:
86: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
87: fnd_log.string(fnd_log.level_statement,l_full_path,'Visitor Conversion Trend Report BEGIN');
88: END IF;
89:
90:
91: -- initilization
98:
99: --Fetch all the Parameters into the Local Variables.
100:
101:
102: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
103: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package to get parameter values');
104: END IF;
105:
106: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
99: --Fetch all the Parameters into the Local Variables.
100:
101:
102: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
103: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package to get parameter values');
104: END IF;
105:
106: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
107: (
119: X_CAMPAIGN => l_campaign, --Not Wanted
120: X_VIEW_BY => l_view_by --Not Wanted
121: );
122:
123: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
124: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
125: END IF;
126:
127: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
120: X_VIEW_BY => l_view_by --Not Wanted
121: );
122:
123: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
124: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
125: END IF;
126:
127: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
128: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site || ' l_cust_class : ' || l_cust_class );
123: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
124: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
125: END IF;
126:
127: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
128: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site || ' l_cust_class : ' || l_cust_class );
129: END IF;
130:
131:
124: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
125: END IF;
126:
127: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
128: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site || ' l_cust_class : ' || l_cust_class );
129: END IF;
130:
131:
132: --Initializing section starts
286: fii.start_date = s.start_date(+)
287: ORDER BY fii.start_date';
288:
289:
290: --IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
291: -- fnd_log.string(fnd_log.level_unexpected,l_full_path,'Visitor Conversion Trend Portlet Query : ' || l_custom_sql);
292: -- END IF;
293:
294:
287: ORDER BY fii.start_date';
288:
289:
290: --IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
291: -- fnd_log.string(fnd_log.level_unexpected,l_full_path,'Visitor Conversion Trend Portlet Query : ' || l_custom_sql);
292: -- END IF;
293:
294:
295: x_custom_sql := l_custom_sql;
318: l_custom_rec.attribute_data_type := BIS_PMV_PARAMETERS_PUB.VARCHAR2_BIND;
319: x_custom_output.EXTEND;
320: x_custom_output(3) := l_custom_rec;
321:
322: --IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
323: -- fnd_log.string(fnd_log.level_unexpected,l_full_path,'Visitor Conversion Trend Portlet Query ended');
324: -- END IF;
325:
326: EXCEPTION
319: x_custom_output.EXTEND;
320: x_custom_output(3) := l_custom_rec;
321:
322: --IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
323: -- fnd_log.string(fnd_log.level_unexpected,l_full_path,'Visitor Conversion Trend Portlet Query ended');
324: -- END IF;
325:
326: EXCEPTION
327: WHEN OTHERS THEN
324: -- END IF;
325:
326: EXCEPTION
327: WHEN OTHERS THEN
328: if (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
329: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
330: end if;
331: END GET_VISTR_CONV_TRND_SQL;
332:
325:
326: EXCEPTION
327: WHEN OTHERS THEN
328: if (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
329: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
330: end if;
331: END GET_VISTR_CONV_TRND_SQL;
332:
333:
405: l_gs_amount NUMBER ; -- Secondary Currency Amount Not required for this report
406: l_f_amount NUMBER ; -- Functional Amount Not required for this report
407:
408:
409: --FND Logging
410: l_full_path VARCHAR2(50) ;
411: --gaflog_value CONSTANT VARCHAR2(10);
412:
413: gaflog_value CONSTANT VARCHAR2(10) := fnd_profile.value('AFLOG_ENABLED');
416: BEGIN
417:
418: --gaflog_value := fnd_profile.value('AFLOG_ENABLED');
419:
420: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
421: fnd_log.string(fnd_log.level_statement,l_full_path,'Visit Trend Report BEGIN');
422: END IF;
423:
424: --initialization
417:
418: --gaflog_value := fnd_profile.value('AFLOG_ENABLED');
419:
420: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
421: fnd_log.string(fnd_log.level_statement,l_full_path,'Visit Trend Report BEGIN');
422: END IF;
423:
424: --initialization
425:
429: l_full_path := 'ibw.plsql.ibwbvtrb.get_visit_trend_sql';
430: --gaflog_value := fnd_profile.value('AFLOG_ENABLED');
431: --Fetch all the Parameters into the Local Variables.
432:
433: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
434: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package to get parameter values');
435: END IF;
436:
437: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
430: --gaflog_value := fnd_profile.value('AFLOG_ENABLED');
431: --Fetch all the Parameters into the Local Variables.
432:
433: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
434: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package to get parameter values');
435: END IF;
436:
437: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
438: (
450: X_CAMPAIGN => l_campaign, --Not Wanted
451: X_VIEW_BY => l_view_by --Not Wanted
452: );
453:
454: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
455: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
456: END IF;
457:
458: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
451: X_VIEW_BY => l_view_by --Not Wanted
452: );
453:
454: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
455: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
456: END IF;
457:
458: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
459: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site || ' l_cust_class : ' || l_cust_class );
454: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
455: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
456: END IF;
457:
458: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
459: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site || ' l_cust_class : ' || l_cust_class );
460: END IF;
461:
462:
455: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
456: END IF;
457:
458: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
459: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site || ' l_cust_class : ' || l_cust_class );
460: END IF;
461:
462:
463:
615: WHERE fii.start_date BETWEEN &BIS_CURRENT_REPORT_START_DATE AND &BIS_CURRENT_ASOF_DATE AND
616: fii.start_date = s.start_date(+)
617: ORDER BY fii.start_date';
618:
619: -- IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
620: -- fnd_log.string(fnd_log.level_unexpected,l_full_path,'Visit Trend Portlet Query : ' || l_custom_sql);
621: -- END IF;
622:
623:
616: fii.start_date = s.start_date(+)
617: ORDER BY fii.start_date';
618:
619: -- IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
620: -- fnd_log.string(fnd_log.level_unexpected,l_full_path,'Visit Trend Portlet Query : ' || l_custom_sql);
621: -- END IF;
622:
623:
624:
630:
631:
632: EXCEPTION
633: WHEN OTHERS THEN
634: if (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
635: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
636: end if;
637: END GET_VISIT_TREND_SQL;
638:
631:
632: EXCEPTION
633: WHEN OTHERS THEN
634: if (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
635: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
636: end if;
637: END GET_VISIT_TREND_SQL;
638:
639:
704: l_ord_by VARCHAR2(3200) ; -- Order By
705: l_prev_date DATE; -- Previous Date
706: l_prod_catg VARCHAR2(3200) ; -- Product Category
707: l_prod VARCHAR2(3200) ; -- Product
708: --FND Logging
709: l_full_path VARCHAR2(50) ;
710:
711: --Profile is : FND: Debug Log Enabled
712: gaflog_value CONSTANT VARCHAR2(10) := fnd_profile.value('AFLOG_ENABLED');
716:
717:
718: /*
719: Open issues :
720: 1. fnd_log.string(fnd_log.level_unexpected,l_full_path,l_custom_sql); to be removed
721: 2. gaflog_value CONSTANT VARCHAR2(10) := fnd_profile.value('AFLOG_ENABLED') to be removed
722: 3. Sum of Grand Totals with Division to be handled.
723:
724: */
723:
724: */
725:
726: --Fetch all the Parameters into the Local Variables.
727: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
728: fnd_log.string(fnd_log.level_statement,l_full_path,'begin');
729: end if;
730:
731:
724: */
725:
726: --Fetch all the Parameters into the Local Variables.
727: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
728: fnd_log.string(fnd_log.level_statement,l_full_path,'begin');
729: end if;
730:
731:
732: l_full_path := 'ibw.plsql.ibwrepab.page_int_nontrend_sql'; --This is the path which would be referred in fnd_log_messages.module
728: fnd_log.string(fnd_log.level_statement,l_full_path,'begin');
729: end if;
730:
731:
732: l_full_path := 'ibw.plsql.ibwrepab.page_int_nontrend_sql'; --This is the path which would be referred in fnd_log_messages.module
733:
734: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
735: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package');
736: END IF;
730:
731:
732: l_full_path := 'ibw.plsql.ibwrepab.page_int_nontrend_sql'; --This is the path which would be referred in fnd_log_messages.module
733:
734: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
735: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package');
736: END IF;
737:
738: --To get all the Page Parameters.
731:
732: l_full_path := 'ibw.plsql.ibwrepab.page_int_nontrend_sql'; --This is the path which would be referred in fnd_log_messages.module
733:
734: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
735: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package');
736: END IF;
737:
738: --To get all the Page Parameters.
739: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
752: , x_campaign => l_campaign --Campaign
753: , x_view_by => l_view_by --Either Campaign or Site.
754: );
755:
756: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
757: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
758: END IF;
759:
760: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
753: , x_view_by => l_view_by --Either Campaign or Site.
754: );
755:
756: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
757: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
758: END IF;
759:
760: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
761: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site' || l_site ||' l_view_by '|| l_view_by ||' l_campaign: '|| l_campaign||' l_currency '|| l_currency );
756: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
757: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
758: END IF;
759:
760: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
761: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site' || l_site ||' l_view_by '|| l_view_by ||' l_campaign: '|| l_campaign||' l_currency '|| l_currency );
762: end if;
763:
764:
757: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
758: END IF;
759:
760: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
761: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site' || l_site ||' l_view_by '|| l_view_by ||' l_campaign: '|| l_campaign||' l_currency '|| l_currency );
762: end if;
763:
764:
765: l_where := '';
822: --' SUM(DECODE(Carts,0,null,null,null, orders / carts)) OVER() IBW_G_TOT8, '|| Grand Total Change
823: ' DECODE(SUM(Carts) over(),0,null,null,null, ((SUM(orders) over() / SUM(Carts) over())*100)) IBW_G_TOT8, '||
824: ' SUM(nvl(booked_orders_amount,0)) OVER() IBW_G_TOT9 ';
825:
826: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
827: fnd_log.string(fnd_log.level_statement,l_full_path,'After Outer Select' );
828: end if;
829:
830: l_inner_select := ' SUM(visits) visits, SUM(visit_duration) visit_duration, ' ||
823: ' DECODE(SUM(Carts) over(),0,null,null,null, ((SUM(orders) over() / SUM(Carts) over())*100)) IBW_G_TOT8, '||
824: ' SUM(nvl(booked_orders_amount,0)) OVER() IBW_G_TOT9 ';
825:
826: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
827: fnd_log.string(fnd_log.level_statement,l_full_path,'After Outer Select' );
828: end if;
829:
830: l_inner_select := ' SUM(visits) visits, SUM(visit_duration) visit_duration, ' ||
831: ' SUM(page_views) page_views, SUM(daily_uniq_visitors) daily_uniq_visitors, ' ||
842: ' OR SUM(carts) > 0 ' ||
843: ' OR SUM(orders) > 0 ' ||
844: ' OR SUM(decode(:l_currency,:l_gp_currency,booked_amt_g,:l_gs_currency,booked_amt_g1,cmp_mv.currency_cd_f,booked_amt_f)) > 0 ' ;
845:
846: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
847: fnd_log.string(fnd_log.level_statement,l_full_path,'After Inner Select' );
848: end if;
849:
850: l_from := ' IBW_CMPANLYS_CMPDIM_TIME_MV CMP_MV ' ||
843: ' OR SUM(orders) > 0 ' ||
844: ' OR SUM(decode(:l_currency,:l_gp_currency,booked_amt_g,:l_gs_currency,booked_amt_g1,cmp_mv.currency_cd_f,booked_amt_f)) > 0 ' ;
845:
846: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
847: fnd_log.string(fnd_log.level_statement,l_full_path,'After Inner Select' );
848: end if;
849:
850: l_from := ' IBW_CMPANLYS_CMPDIM_TIME_MV CMP_MV ' ||
851: ' , FII_TIME_RPT_STRUCT_V CAL ';
855: ' AND BITAND(CAL.RECORD_TYPE_ID,&BIS_NESTED_PATTERN)= CAL.RECORD_TYPE_ID '||
856: ' AND CMP_MV.TIME_ID = CAL.TIME_ID ' ||
857: ' AND CAL.CALENDAR_ID = -1 '; --Indicates Enterprise Calendar
858:
859: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
860: fnd_log.string(fnd_log.level_statement,l_full_path,'Before the View By Condition' );
861: end if;
862:
863: -- Fetching Site Name or Campaign Name according to the View by
856: ' AND CMP_MV.TIME_ID = CAL.TIME_ID ' ||
857: ' AND CAL.CALENDAR_ID = -1 '; --Indicates Enterprise Calendar
858:
859: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
860: fnd_log.string(fnd_log.level_statement,l_full_path,'Before the View By Condition' );
861: end if;
862:
863: -- Fetching Site Name or Campaign Name according to the View by
864: IF l_view_by = 'SITE+SITE' THEN --View by is Site
918: ' HAVING ' || l_having ||
919: ' ) ' ||
920: ' &ORDER_BY_CLAUSE ' ;
921:
922: --fnd_log.string(fnd_log.level_unexpected,l_full_path,l_custom_sql); --To be removed Later
923:
924:
925: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
921:
922: --fnd_log.string(fnd_log.level_unexpected,l_full_path,l_custom_sql); --To be removed Later
923:
924:
925: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
922: --fnd_log.string(fnd_log.level_unexpected,l_full_path,l_custom_sql); --To be removed Later
923:
924:
925: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
930: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_group_by ' || l_inner_group_by);
923:
924:
925: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
930: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_group_by ' || l_inner_group_by);
931: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql' || l_custom_sql);
924:
925: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
930: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_group_by ' || l_inner_group_by);
931: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql' || l_custom_sql);
932: end if;
925: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
930: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_group_by ' || l_inner_group_by);
931: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql' || l_custom_sql);
932: end if;
933:
926: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_select' || l_outer_select);
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
930: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_group_by ' || l_inner_group_by);
931: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql' || l_custom_sql);
932: end if;
933:
934:
927: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_select' || l_inner_select);
928: fnd_log.string(fnd_log.level_statement,l_full_path,'l_from' || l_from);
929: fnd_log.string(fnd_log.level_statement,l_full_path,'l_where' || l_where);
930: fnd_log.string(fnd_log.level_statement,l_full_path,'l_inner_group_by ' || l_inner_group_by);
931: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql' || l_custom_sql);
932: end if;
933:
934:
935: --Build the Tokens
961: x_custom_output.EXTEND;
962:
963: x_custom_output(3) := l_custom_rec;
964:
965: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
966: fnd_log.string(fnd_log.level_statement,l_full_path,'end');
967: end if;
968:
969: EXCEPTION
962:
963: x_custom_output(3) := l_custom_rec;
964:
965: if gaflog_value ='Y' and (fnd_log.level_statement >= fnd_log.g_current_runtime_level) then
966: fnd_log.string(fnd_log.level_statement,l_full_path,'end');
967: end if;
968:
969: EXCEPTION
970: WHEN OTHERS THEN
967: end if;
968:
969: EXCEPTION
970: WHEN OTHERS THEN
971: if (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
972: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
973: end if;
974: END GET_WEB_CAMPAIGN_SQL;
975:
968:
969: EXCEPTION
970: WHEN OTHERS THEN
971: if (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
972: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
973: end if;
974: END GET_WEB_CAMPAIGN_SQL;
975:
976: -- Procedure for the KPI's
1055:
1056: BEGIN
1057:
1058: --Profiles for FND Debugging are : FND: Log Enabled , FND: Log Level
1059: l_full_path := 'ibw.plsql.ibwbvckb.GET_KPI_SQL'; --This would be stored in FND_LOG_MESSAGES.MODULE column
1060: gaflog_value := fnd_profile.value('AFLOG_ENABLED');
1061:
1062: -- initialization
1063:
1065: l_gs_currency := '''FII_GLOBAL2''' ;
1066:
1067: --Fetch all the Parameters into the Local Variables.
1068:
1069: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1070: fnd_log.string(fnd_log.level_statement,l_full_path,'Begin');
1071: END IF;
1072:
1073: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1066:
1067: --Fetch all the Parameters into the Local Variables.
1068:
1069: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1070: fnd_log.string(fnd_log.level_statement,l_full_path,'Begin');
1071: END IF;
1072:
1073: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1074: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package');
1069: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1070: fnd_log.string(fnd_log.level_statement,l_full_path,'Begin');
1071: END IF;
1072:
1073: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1074: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package');
1075: END IF;
1076:
1077: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
1070: fnd_log.string(fnd_log.level_statement,l_full_path,'Begin');
1071: END IF;
1072:
1073: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1074: fnd_log.string(fnd_log.level_procedure,l_full_path,'Before the Call to UTL Package');
1075: END IF;
1076:
1077: IBW_BI_UTL_PVT.GET_PAGE_PARAMETERS
1078: (
1090: X_CAMPAIGN => l_campaign, --Not Wanted
1091: X_VIEW_BY => l_view_by --Not Wanted
1092: );
1093:
1094: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1095: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
1096: END IF;
1097:
1098: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1091: X_VIEW_BY => l_view_by --Not Wanted
1092: );
1093:
1094: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1095: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
1096: END IF;
1097:
1098: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1099: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site ||' l_currency : '|| l_currency );
1094: IF gaflog_value ='Y' AND (fnd_log.level_procedure >= fnd_log.g_current_runtime_level) THEN
1095: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
1096: END IF;
1097:
1098: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1099: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site ||' l_currency : '|| l_currency );
1100: END IF;
1101: --Initializing section starts
1102:
1095: fnd_log.string(fnd_log.level_procedure,l_full_path,'After the Call to UTL Package');
1096: END IF;
1097:
1098: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1099: fnd_log.string(fnd_log.level_statement,l_full_path,'l_site : ' || l_site ||' l_currency : '|| l_currency );
1100: END IF;
1101: --Initializing section starts
1102:
1103: l_outer_where_clause := '';
1110: l_table_list := ' IBW_KPI_METRICS_TIME_MV FACT' ||
1111: ' ,FII_TIME_RPT_STRUCT_V CAL' ;
1112:
1113:
1114: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1115: fnd_log.string(fnd_log.level_statement,l_full_path,'l_table_list: ' || l_table_list);
1116: END IF;
1117:
1118: -- Initialising where clause based on the site parameter selection
1111: ' ,FII_TIME_RPT_STRUCT_V CAL' ;
1112:
1113:
1114: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1115: fnd_log.string(fnd_log.level_statement,l_full_path,'l_table_list: ' || l_table_list);
1116: END IF;
1117:
1118: -- Initialising where clause based on the site parameter selection
1119: --Added for Bug#:4660266
1121: l_outer_where_clause := l_outer_where_clause || ' AND FACT.SITE_ID in (&SITE+SITE) ' ;
1122: --The Else Condition is not needed here as the same is used already in the custom_sql below.
1123: END IF;
1124:
1125: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1126: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_where_clause: ' || l_outer_where_clause);
1127: END IF;
1128:
1129: l_custom_sql1:= 'SELECT ID VIEWBYID, SITE_VAL VIEWBY, ID IBW_VAL1,
1122: --The Else Condition is not needed here as the same is used already in the custom_sql below.
1123: END IF;
1124:
1125: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1126: fnd_log.string(fnd_log.level_statement,l_full_path,'l_outer_where_clause: ' || l_outer_where_clause);
1127: END IF;
1128:
1129: l_custom_sql1:= 'SELECT ID VIEWBYID, SITE_VAL VIEWBY, ID IBW_VAL1,
1130: nvl(Visits_cur,0) IBW_VAL2,
1159: nvl(REGISTERED_CARTS_pre,0) IBW_VAL48,
1160: sum(nvl(REGISTERED_CARTS_cur,0)) over() IBW_VAL50,
1161: sum(nvl(REGISTERED_CARTS_pre,0)) over() IBW_VAL51 ';
1162:
1163: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1164: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql1: ' || l_custom_sql1);
1165: END IF;
1166:
1167: l_custom_sql2:=' FROM (
1160: sum(nvl(REGISTERED_CARTS_cur,0)) over() IBW_VAL50,
1161: sum(nvl(REGISTERED_CARTS_pre,0)) over() IBW_VAL51 ';
1162:
1163: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1164: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql1: ' || l_custom_sql1);
1165: END IF;
1166:
1167: l_custom_sql2:=' FROM (
1168: SELECT ID, SITE_VAL,
1254: )
1255: GROUP BY ID,SITE_VAL
1256: )';
1257:
1258: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1259: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql2: ' || l_custom_sql2);
1260: END IF;
1261:
1262: x_custom_sql := l_custom_sql1 ||l_custom_sql2;
1255: GROUP BY ID,SITE_VAL
1256: )';
1257:
1258: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1259: fnd_log.string(fnd_log.level_statement,l_full_path,'l_custom_sql2: ' || l_custom_sql2);
1260: END IF;
1261:
1262: x_custom_sql := l_custom_sql1 ||l_custom_sql2;
1263:
1286: l_custom_rec.attribute_data_type := BIS_PMV_PARAMETERS_PUB.VARCHAR2_BIND;
1287:
1288: x_custom_output(3) := l_custom_rec;
1289:
1290: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1291: fnd_log.string(fnd_log.level_statement,l_full_path,'End ' );
1292: END IF;
1293:
1294: EXCEPTION
1287:
1288: x_custom_output(3) := l_custom_rec;
1289:
1290: IF gaflog_value ='Y' AND (fnd_log.level_statement >= fnd_log.g_current_runtime_level) THEN
1291: fnd_log.string(fnd_log.level_statement,l_full_path,'End ' );
1292: END IF;
1293:
1294: EXCEPTION
1295: WHEN OTHERS THEN
1292: END IF;
1293:
1294: EXCEPTION
1295: WHEN OTHERS THEN
1296: if gaflog_value ='Y' AND (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
1297: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
1298: end if;
1299:
1300: END GET_KPI_SQL;
1293:
1294: EXCEPTION
1295: WHEN OTHERS THEN
1296: if gaflog_value ='Y' AND (fnd_log.level_unexpected >= fnd_log.g_current_runtime_level) then
1297: fnd_log.string(fnd_log.level_unexpected,l_full_path,SQLERRM);
1298: end if;
1299:
1300: END GET_KPI_SQL;
1301: