1 PACKAGE ozf_accrual_engine AUTHID CURRENT_USER AS
2 /* $Header: ozfacres.pls 120.7 2010/12/09 09:02:54 nirprasa ship $ */
3
4
5 -- constant used for gl_posted_flag in utilization table: do not modify the values as checkbook/claim use Y/N/F/NULL directly
6 -- 'Y': posted to gl successfully
7 -- 'N': waiting to post to gl
8 -- 'F': failed to post to gl
9 -- 'O': do not post to gl, used for customer accrual budget with liability off
10 -- null: do not post to gl,
11 -- 1) for 'REQUEST/TRANSFER',
12 -- 2) for 'UTILIZED' offer, means 'Create GL for off invoice' is off, so utilized/earned/paid updated the same time
13 -- 3) for 'UTILIZED' marketing object, means utilized/earned/paid the same time
14 G_GL_FLAG_YES CONSTANT VARCHAR2(1) := 'Y';
15 G_GL_FLAG_NO CONSTANT VARCHAR2(1) := 'N';
16 G_GL_FLAG_FAIL CONSTANT VARCHAR2(1) := 'F';
17 G_GL_FLAG_NOLIAB CONSTANT VARCHAR2(1) := 'X';
18 G_GL_FLAG_NULL CONSTANT VARCHAR2(1) := NULL;
19 --nirprasa,ER 8399134 add parameter to be used as FAE run date, if FAE runs for more than a day.
20 G_FAE_START_DATE DATE := NULL;
21
22 --
23 -- Procedure Name
24 -- Get_Message
25 -- Purpose
26 -- This procedure collects order updates from the Order Capture Notification
27 -- API. Started from a concurrent process, it is an infinite loop which
28 -- gets the latest notification off of the queue.
29 --
30 PROCEDURE get_message(
31 x_errbuf OUT NOCOPY VARCHAR2
32 ,x_retcode OUT NOCOPY NUMBER
33 ,p_run_exception IN VARCHAR2 := 'N'
34 ,p_debug IN VARCHAR2 := 'N'
35 );
36
37 --
38 -- Procedure Name
39 -- Adjust_Accrual
40 -- Purpose
41 -- This procedure will accept the Line_Adj_tbl_Type and old_Line_Adj_Tbl_Type
42 -- and calculate the accrual difference for a offer, going backward it will find
43 -- out the associated fund and update the accrued amount.
44 PROCEDURE adjust_accrual(
45 p_api_version IN NUMBER
46 ,p_init_msg_list IN VARCHAR2 := fnd_api.g_false
47 ,p_commit IN VARCHAR2 := fnd_api.g_false
48 ,p_validation_level IN NUMBER := fnd_api.g_valid_level_full
49 ,x_return_status OUT NOCOPY VARCHAR2
50 ,x_msg_count OUT NOCOPY NUMBER
51 ,x_msg_data OUT NOCOPY VARCHAR2
52 ,p_line_adj_tbl IN oe_order_pub.line_adj_tbl_type
53 ,p_old_line_adj_tbl IN oe_order_pub.line_adj_tbl_type
54 ,p_header_rec IN oe_order_pub.header_rec_type := NULL
55 ,p_exception_queue IN VARCHAR2 := fnd_api.g_false );
56 --//added by mpande
57 -- Procedure Name
58 -- calculate_accrual_amount
59 -- Purpose
60 -- This procedure will accept p_src_id
61 -- and return a PL/SQL table consisting of all the funds and its
62 -- the contributed amount rolling up to the top most level
63 TYPE ozf_fund_amt_rec_type IS RECORD(
64 ofr_src_type VARCHAR2(40), -- the sys_arc_qualifier for the offer for eg 'FUND','CAMP'
65 ofr_src_id NUMBER, -- the id for the sys_arc_qualifier for eg FUND_ID ,CAMP_ID
66 earned_amount NUMBER, -- the contribution amount of the fund or camp to this offer
67 budget_currency VARCHAR2(20) -- the sys_arc_qualifier for the offer for eg 'FUND','CAMP'
68 );
69 TYPE ozf_fund_amt_tbl_type IS TABLE OF ozf_fund_amt_rec_type
70 INDEX BY BINARY_INTEGER;
71
72 TYPE ozf_adjusted_amt_rec_type IS RECORD(
73 order_header_id NUMBER,
74 order_line_id NUMBER,
75 price_adjustment_id NUMBER,
76 qp_list_header_id NUMBER,
77 product_id NUMBER,
78 earned_amount NUMBER,
79 offer_currency VARCHAR2(30),
80 order_currency VARCHAR2(30) ,
81 --added for ER 10216374
82 cost_price NUMBER,
83 cost_price_currency_code VARCHAR2(30)
84 );
85
86 TYPE ozf_adjusted_amt_tbl_type IS TABLE OF ozf_adjusted_amt_rec_type
87 INDEX BY BINARY_INTEGER;
88
89 ------------------------------------------------------------------------------
90 -- Procedure Name
91 -- calculate_accrual_amount
92 -- Purpose
93 -- This procedure performs accruals for all offers for the folow
94 -- 1) Order Managemnt Accruals
95 -- 2) Backdating Adjustment
96 -- 3) Volume Offer Backdating
97 -- History
98 -- 10/18/2002 mpande Created
99 ------------------------------------------------------------------------------
100
101 PROCEDURE calculate_accrual_amount(
102 x_return_status OUT NOCOPY VARCHAR2
103 ,p_src_id IN NUMBER
104 ,p_earned_amt IN NUMBER
105 ,p_cust_account_type IN VARCHAR2 := NULL
106 ,p_cust_account_id IN NUMBER := NULL
107 ,p_product_item_id IN NUMBER := NULL
108 ,x_fund_amt_tbl OUT NOCOPY ozf_fund_amt_tbl_type);
109
110 ------------------------------------------------------------------------------
111 -- Procedure Name
112 -- Accrue_offers
113 -- Purpose
114 -- This procedure performs accruals for all offers for the folow
115 -- 1) Order Managemnt Accruals
116 -- 2) Backdating Adjustment
117 -- 3) Volume Offer Backdating
118 -- 4) reprocess all failed gl postings
119 -- History
120 -- 10/18/2002 mpande Created
121 ------------------------------------------------------------------------------
122
123 PROCEDURE Accrue_offers (x_errbuf OUT NOCOPY VARCHAR2,
124 x_retcode OUT NOCOPY NUMBER,
125 p_run_exception IN VARCHAR2 := 'N',
126 p_run_backdated_adjustment IN VARCHAR2 := 'N',
127 p_run_volume_off_adjustment IN VARCHAR2 := 'N',
128 p_run_unposted_gl IN VARCHAR2 := 'N',
129 p_process_message_count IN NUMBER, --nirprasa, added for 8435487
130 p_debug IN VARCHAR2 := 'N');
131
132
133 /*----------------------------------------------------------------------------
134 -- Procedure Name
135 -- post_accrual_to_budget
136 -- Purpose
137 -- This procedure will post accrual to budget proportionally, and create utilization records
138 -- extracted from adjust_accrual so it can be reused
139 --
140 -- Parameters:
141 --
142 -- History
143 -- created yzhao 03/21/03
144 ------------------------------------------------------------------------------*/
145 PROCEDURE post_accrual_to_budget (
146 p_adj_amt_tbl IN ozf_adjusted_amt_tbl_type,
147 x_return_status OUT NOCOPY VARCHAR2,
148 x_msg_count OUT NOCOPY NUMBER,
149 x_msg_data OUT NOCOPY VARCHAR2);
150
151
152 ------------------------------------------------------------------------------
153 -- Procedure Name
154 -- post_accrual_to_gl
155 -- Purpose
156 -- This procedure posts one accrual record to GL
157 -- History
158 -- 03/19/2003 Ying Zhao Created
159 ------------------------------------------------------------------------------
160 PROCEDURE post_accrual_to_gl(
161 p_util_utilization_id IN NUMBER,
162 p_util_object_version_number IN NUMBER,
163 p_util_amount IN NUMBER,
164 p_util_plan_type IN VARCHAR2,
165 p_util_plan_id IN NUMBER,
166 p_util_plan_amount IN NUMBER,
167 p_util_utilization_type IN VARCHAR2,
168 p_util_fund_id IN NUMBER,
169 p_util_acctd_amount IN NUMBER,
170 p_adjust_paid_flag IN BOOLEAN := FALSE,
171 p_util_org_id IN NUMBER := NULL,
172 x_gl_posted_flag OUT NOCOPY VARCHAR2,
173 x_return_status OUT NOCOPY VARCHAR2,
174 x_msg_count OUT NOCOPY NUMBER,
175 x_msg_data OUT NOCOPY VARCHAR2
176 );
177
178
179 PROCEDURE post_related_accrual_to_gl(
180 p_utilization_id IN NUMBER,
181 p_utilization_type IN VARCHAR2,
182 p_gl_date IN DATE := NULL,
183 x_return_status OUT NOCOPY VARCHAR2,
184 x_msg_count OUT NOCOPY NUMBER,
185 x_msg_data OUT NOCOPY VARCHAR2);
186
187 /*kdass - funds accrual process by business event descoped due to performance issues
188 PROCEDURE process_order_queue (x_return_status OUT NOCOPY VARCHAR2,
189 x_msg_count OUT NOCOPY NUMBER,
190 x_msg_data OUT NOCOPY VARCHAR2
191 );
192
193
194 PROCEDURE increase_order_message_counter;
195
196 FUNCTION event_subscription
197 (p_subscription_guid in raw,
198 p_event in out NOCOPY wf_event_t) return varchar2;
199 */
200
201 END ozf_accrual_engine;