DBA Data[Home] [Help]

PACKAGE BODY: APPS.JTF_TERR_DEFINITION_PARAM_PVT

Source


1 PACKAGE BODY JTF_TERR_DEFINITION_PARAM_PVT AS
2 /* $Header: jtftrpdb.pls 120.0 2005/06/02 18:21:45 appldev ship $ */
3 
4 --
5 --g_image_prefix varchar2(250) := '/OA_MEDIA/'||icx_sec.getid(icx_sec.pv_language_code)||'/';
6    l_user_id      number;
7    v_date_time    varchar2(30);
8    l_agent        varchar2(200);
9    ctr1           integer        := 0;
10    ctr2           integer        := 0;
11 --   G_DATE_FORMAT  varchar2(20)   := as_ofl_util_pkg.get_date_format;
12    G_DATE_FORMAT  varchar2(20)  := 'MM/DD/YY';
13 
14 
15   procedure header is
16 
17 -----------------------------------------------------------------------------------------------
18 --
19 --  PROCEDURE: header
20 --
21 --  DESCRIPTION:  This procedure is creates the descriptive header in the parameter form
22 --
23 -----------------------------------------------------------------------------------------------
24    begin
25      select to_char(sysdate,G_DATE_FORMAT) into v_date_time from dual;
26      htp.htmlopen;
27      htp.headOpen;
28      htp.title('Territory Defintion Report');
29      htp.headClose;
30      htp.bodyopen(cattributes=>'bgcolor="#CCCCCC"');
31      htp.tableOpen('border="0"  ');
32      htp.tableRowOpen( calign => 'TOP' );
33      --htp.tableData( htf.img(curl=>'terman32.gif'));
34      htp.tableData( '<FONT size=+1 face="times new roman">' || 'Territory Definition Report', cnowrap => 'TRUE');
35      htp.tableData(htf.bold(v_date_time),calign => 'right',ccolspan => '110');
36      htp.tableRowClose;
37      htp.tableClose;
38      htp.tableOpen(  cattributes => 'border=0 cellspacing=0 cellpadding=0 width=561' );
39      htp.tableRowOpen( cvalign => 'top' );
40      htp.tableData( ' ', ccolspan => '2', cattributes => ' height=9');
41      htp.tableData( '<FONT face="Times New Roman">' ||htf.bold( 'Please specify the criteria and select OK.  ') ||
42                     '</FONT>', calign => 'center', crowspan => '2', ccolspan => '110', cattributes => ' width=346');
43      htp.tableData( ' ', ccolspan => '6');
44      htp.Br;
45      htp.tableRowClose;
46      htp.tableClose;
47      htp.bodyClose;
48      htp.headClose;
49      htp.htmlClose;
50    end;
51 -----------------------------------------------------------------------------------------------
52 procedure terr_definition_paramform is
53 
54 -----------------------------------------------------------------------------------------------
55 --
56 --  PROCEDURE: terr_definition_paramform
57 --
58 --  DESCRIPTION:  This procedure is main body of the parameter form
59 --
60 -----------------------------------------------------------------------------------------------
61 
62 /* this resource cursor to be used in final delivery*/
63 Cursor cur_salesrep is
64     select -1 resource_id, 'ALL' resource_name
65     from dual
66  union
67     select distinct resource_id, wf_notification.substitutespecialchars(resource_name) resource_name
68     from jtf_terr_resources_v
69     order by resource_name;
70 
71 /* qualifier cursor */
72 Cursor cur_qual is
73     select -1  qual_usg_id ,'ALL' seeded_qual_name
74     from dual
75  union
76     select qual_usg_id , wf_notification.substitutespecialchars(usage) || ' - ' ||
77                          wf_notification.substitutespecialchars(seeded_qual_name) seeded_qual_name
78     from jtf_seeded_qual_usgs_v
79     where enabled_flag = 'Y' and not (qual_type_id = -1001)
80  order by seeded_qual_name;
81 
82 BEGIN
83 
84  fnd_client_info.set_org_context(fnd_profile.value('ORG_ID'));
85 
86 if (icx_sec.validateSession(c_function_code => 'JTF_TERR_DFN_RPT', c_validate_only => 'Y')) then
87        header;
88 
89        l_user_id := icx_sec.getID(icx_sec.PV_USER_ID);
90        -------------------- Returns login user Id--------------------------
91        htp.FormOpen(owa_util.Get_Owa_Service_Path||'JTF_TERR_DEFINITION_REPORT_PVT.report_wrapper', cattributes => ' NAME="param"');
92        htp.htmlopen;
93        htp.headOpen;
94        htp.title('Territory Definition Report');
95        htp.headClose;
96        htp.bodyopen(cattributes=>'bgcolor="#CCCCCC"');
97        htp.tableopen;
98        htp.tableRowOpen( cvalign => 'top' );
99        htp.tableData( ' ', cattributes => ' height=9');
100        htp.tableData( '<FONT size=2 face="Times New Roman">' || '</FONT>', calign => 'right', crowspan => '2', ccolspan => '3', cattributes => ' width=154');
101        htp.tableData( ' ');
102        htp.tableRowClose;
103        htp.tableClose;
104        htp.tableOpen(cattributes=>'width="600" ');
105 /* Output format control */
106        htp.tableRowOpen();
107        htp.p('<td align="RIGHT" width="35%"valign="top">Select Output Format</td>');
108        htp.p('<td>');
109        htp.p('<SELECT name="p_response">');
110        htp.FormSelectOption('Excel');
111        htp.FormSelectOption('HTML', cselected => 'TRUE');
112        htp.FormSelectClose;
113        htp.tableRowClose;
114 /* Sales Rep Search Restriction */
115        htp.tableRowOpen();
116        htp.p('<td align="RIGHT" width="32%" valign="top">Sales Rep</td>');
117        htp.p('<td>');
118        htp.p ('<SELECT name="p_srp">');
119          FOR rec_salesrep IN cur_salesrep  LOOP
120            htp.FormSelectOption(rec_salesrep.resource_name,cattributes => ' value= '||rec_salesrep.resource_id);
121          END LOOP;
122        htp.FormSelectClose;
123        htp.p('</td>');
124        htp.tableRowClose;
125 /* Qualifier Search Restriction */
126      htp.tableRowOpen();
127        htp.p('<td align="RIGHT" width="32%" valign="top">Qualifiers</td>');
128        htp.p('<td>');
129        htp.p ('<SELECT name="p_qual">');
130          FOR rec_qual IN cur_qual LOOP
131            htp.FormSelectOption(rec_qual.seeded_qual_name, cattributes => ' value= '||rec_qual.qual_usg_id);
132          END LOOP;
133 
134        htp.FormSelectClose;
135        htp.p('</td>');
136        htp.tableRowClose;
137 
138        htp.tableClose;
139        htp.Br;
140        htp.Br;
141        htp.Br;
142        footer;
143        htp.FormClose;
144        htp.bodyclose;
145        htp.htmlclose;
146  else
147   htp.p('Invalid session');
148      end if;
149      exception
150         when others then
151                 htp.p(SQLERRM);
152    END terr_definition_paramform;
153 
154 
155    procedure footer is
156    BEGIN
157       l_agent := owa_util.get_cgi_env('SCRIPT_NAME');
158       htp.htmlopen;
159       htp.tableRowOpen;
160       htp.tableData( htf.hr, crowspan => '1', ccolspan => '190', cnowrap => 'TRUE');
161       htp.tableRowClose;
162       htp.tableOpen( calign => 'center', cattributes => ' border=0 cellspacing=2 cellpadding=2' );
163       htp.tableRowOpen;
164       htp.formOpen( curl => l_agent||'JTF_TERR_DEFINITION_REPORT_PVT.report_wrapper', cmethod => 'post', cattributes => ' NAME="MyForm" TARGET="_top"');
165       htp.tableData( htf.formSubmit( cvalue => 'OK', cattributes => ' onMouseOver="window.status=''OK'';return true"'));
166       htp.tableData( '<INPUT type=button value="Cancel" onClick="history.back()" onMouseOver="window.status="Cancel";return true">');
167       htp.tableRowClose;
168       htp.tableClose;
169       htp.htmlClose;
170    END footer;
171 END;