[Home] [Help]
PACKAGE BODY: APPS.OTA_GENERIC_REPORT_PKG
Source
1 Package Body ota_generic_report_pkg as
2 /* $Header: otagenrp.pkb 115.0 99/07/16 00:49:31 porting ship $ */
3
4
5 ---------------------------------------------------------------------------
6 --|--------------------< Private Global Definition >----------------------|
7 ---------------------------------------------------------------------------
8 -- Description:
9 -- Global package name.
10
11 g_package varchar2(50) := 'ota_generic_report_pkg';
12
13 --
14 --
15 ----------------------------------------------------------------------------
16 --|---------------------< different_currency > ----------------------------|
17 ----------------------------------------------------------------------------
18 --Description:
19 -- This function checks to see if the currencies of the totals to be sumed
20 -- are the same. If they are, the total is calculated.
21
22
23 Function different_currency (event in number,
24 tablename in varchar2
25 ) RETURN Boolean
26 IS
27
28 --
29 --
30 v_currency_code varchar2(30);
31 counter number;
32 --
33 --
34 Cursor sel_currency_student is
35 select distinct
36 fl.currency_code
37 from
38 ota_finance_lines fl,
39 ota_events e,
40 ota_delegate_bookings db
41 where db.event_id = event
42 and db.booking_id = fl.booking_id;
43 --
44 --
45 Cursor sel_currency_resource_event is
46 select distinct
47 fl.currency_code
48 from
49 ota_finance_lines fl,
50 ota_events e,
51 ota_resource_bookings rb,
52 ota_activity_versions av
53 where rb.event_id = event
54 and rb.resource_booking_id = fl.resource_booking_id;
55 --
56 --
57 BEGIN
58 --
59 --
60 -- For the delegate bookings table
61 --
62 IF tablename like 'student' THEN
63 --
64 counter:=0;
65 --
66 OPEN sel_currency_student;
67 --
68 LOOP
69 --
70 FETCH sel_currency_student INTO
71 v_currency_code;
72 --
73 EXIT when sel_currency_student%notfound or counter > 1 ;
74 --
75 counter:=counter+1;
76 --
77 END LOOP;
78 --
79 CLOSE sel_currency_student;
80 --
81 IF counter <= 1 THEN
82 --
83 RETURN(false);
84 --
85 ELSIF counter > 1 THEN
86 --
87 RETURN(true);
88 --
89 END IF;
90 --
91 --
92 --
93 --
94 -- For the resource bookings table
95 --
96 --
97 ELSIF tablename like 'resource' THEN
98 --
99 counter:=0;
100 --
101 OPEN sel_currency_resource_event;
102 --
103 LOOP
104 --
105 FETCH sel_currency_resource_event INTO
106 v_currency_code;
107 --
108 EXIT when sel_currency_resource_event%notfound or counter > 1;
109 --
110 counter:=counter+1;
111 --
112 END LOOP;
113 --
114 CLOSE sel_currency_resource_event;
115 --
116 IF counter <= 1 THEN
117 --
118 RETURN(false);
119 --
120 ELSIF counter > 1 THEN
121 --
122 RETURN(true);
123 --
124 END IF;
125 --
126 --
127 END IF;
128
129 END different_currency;
130 --
131
132 END ota_generic_report_pkg;