DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_COMPLEX_WORK_GRP

Source


1 PACKAGE BODY PO_COMPLEX_WORK_GRP AS
2 -- $Header: PO_COMPLEX_WORK_GRP.plb 120.0 2005/07/07 17:21 spangulu noship $
3 
4 ------------------------------------------------------------------------------
5 --Start of Comments
6 --Name: get_payment_style_settings
7 --Pre-reqs:
8 --  None
9 --Modifies:
10 --  None.
11 --Locks:
12 --  None.
13 --Function:
14 --  This procedure returns all important flags related to complex
15 --  work procurement that can be derived from a style.
16 --Parameters:
17 --IN:
18 --  p_api_version
19 --    Should be 1.0
20 --  p_style_id
21 --    ID of the style to get the complex work flags for.
22 --OUT:
23 --  x_return_status
24 --    FND_API.G_RET_STS_SUCCESS: API completed successfully.
25 --    FND_API.G_RET_STS_UNEXP_ERROR: API was not successful; unexpected error.
26 --  x_complex_work_flag
27 --    'Y': Any document with this style uses progress payments.
28 --    'N': Any document with this style cannot use progress payments.
29 --  x_financing_payments_flag
30 --    'Y': All user entered payitems for a document with this style
31 --         are financing (prepayment) pay items.
32 --    'N': All user entered payitems for a document with this style
33 --         are actual (standard) pay items.
34 --  x_retainage_allowed_flag
35 --    'Y': Retainage terms can be specified as part of the document.
36 --    'N': Retainage terms cannot be specified in the document.
37 --  x_advance_allowed_flag
38 --    'Y': An advance amount can be specified at the line level.
39 --    'N': Advance amounts cannot be specified.
40 --  x_milestone_allowed_flag
41 --    'Y': Complex work POs with this style can contain pay items of type MILESTONE.
42 --    'N': Complex work POs with this style cannot contain pay items of type MILESTONE.
43 --  x_lumpsum_allowed_flag
44 --    'Y': Complex work POs with this style can contain pay items of type LUMPSUM.
45 --    'N': Complex work POs with this style cannot contain pay items of type LUMPSUM.
46 --  x_rate_allowed_flag
47 --    'Y': Complex work POs with this style can contain pay items of type RATE.
48 --    'N': Complex work POs with this style cannot contain pay items of type RATE.
49 --End of Comments
50 -------------------------------------------------------------------------------
51 PROCEDURE get_payment_style_settings(
52   p_api_version              IN          NUMBER
53 , p_style_id                 IN          NUMBER
54 , x_return_status            OUT NOCOPY  VARCHAR2
55 , x_complex_work_flag        OUT NOCOPY  VARCHAR2
56 , x_financing_payments_flag  OUT NOCOPY  VARCHAR2
57 , x_retainage_allowed_flag   OUT NOCOPY  VARCHAR2
58 , x_advance_allowed_flag     OUT NOCOPY  VARCHAR2
59 , x_milestone_allowed_flag   OUT NOCOPY  VARCHAR2
60 , x_lumpsum_allowed_flag     OUT NOCOPY  VARCHAR2
61 , x_rate_allowed_flag        OUT NOCOPY  VARCHAR2
62 )
63 IS
64 
65   d_progress     NUMBER;
66   d_module       VARCHAR2(70) := 'po.plsql.PO_COMPLEX_WORK_GRP.get_payment_style_settings';
67 
68 BEGIN
69 
70   d_progress := 0;
71   IF (PO_LOG.d_proc) THEN
72     PO_LOG.proc_begin(d_module);
73     PO_LOG.proc_begin(d_module, 'p_api_version', p_api_version);
74     PO_LOG.proc_begin(d_module, 'p_style_id', p_style_id);
75   END IF;
76 
77   d_progress := 10;
78 
79   PO_COMPLEX_WORK_PVT.get_payment_style_settings(
80     p_style_id                 => p_style_id
81   , x_complex_work_flag        => x_complex_work_flag
82   , x_financing_payments_flag  => x_financing_payments_flag
83   , x_retainage_allowed_flag   => x_retainage_allowed_flag
84   , x_advance_allowed_flag     => x_advance_allowed_flag
85   , x_milestone_allowed_flag   => x_milestone_allowed_flag
86   , x_lumpsum_allowed_flag     => x_lumpsum_allowed_flag
87   , x_rate_allowed_flag        => x_rate_allowed_flag
88   );
89 
90   d_progress := 20;
91 
92   x_return_status := FND_API.G_RET_STS_SUCCESS;
93 
94   IF (PO_LOG.d_proc) THEN
95     PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
96     PO_LOG.proc_end(d_module, 'x_complex_work_flag', x_complex_work_flag);
97     PO_LOG.proc_end(d_module, 'x_financing_payments_flag', x_financing_payments_flag);
98     PO_LOG.proc_end(d_module, 'x_retainage_allowed_flag', x_retainage_allowed_flag);
99     PO_LOG.proc_end(d_module, 'x_advance_allowed_flag', x_advance_allowed_flag);
100     PO_LOG.proc_end(d_module, 'x_milestone_allowed_flag', x_milestone_allowed_flag);
101     PO_LOG.proc_end(d_module, 'x_lumpsum_allowed_flag', x_lumpsum_allowed_flag);
102     PO_LOG.proc_end(d_module, 'x_rate_allowed_flag', x_rate_allowed_flag);
103     PO_LOG.proc_end(d_module);
104   END IF;
105 
106 EXCEPTION
107   WHEN OTHERS THEN
108     IF (PO_LOG.d_exc) THEN
109       PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
110       PO_LOG.proc_end(d_module);
111     END IF;
112     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
113 END get_payment_style_settings;
114 
115 
116 ------------------------------------------------------------------------------
117 --Start of Comments
118 --Name: is_complex_work_style
119 --Pre-reqs:
120 --  None
121 --Modifies:
122 --  None.
123 --Locks:
124 --  None.
125 --Function:
126 --  This procedure reveals whether a style indicates complex work.
127 --Parameters:
128 --IN:
129 --  p_api_version
130 --    Should be 1.0
131 --  p_style_id
132 --    ID of the style to get the complex work flag for
133 --OUT:
134 --  x_return_status
135 --    FND_API.G_RET_STS_SUCCESS: API completed successfully.
136 --    FND_API.G_RET_STS_UNEXP_ERROR: API was not successful; unexpected error.
137 --  x_is_complex_flag
138 --    'Y': Any document with this style uses progress payments
139 --    'N': Any document with this style cannot use progress payments.
140 --End of Comments
141 -------------------------------------------------------------------------------
142 PROCEDURE is_complex_work_style(
143   p_api_version           IN NUMBER
144 , p_style_id              IN NUMBER
145 , x_return_status         OUT NOCOPY VARCHAR2
146 , x_is_complex_flag       OUT NOCOPY VARCHAR2
147 )
148 IS
149 
150  d_module     VARCHAR2(70) := 'po.plsql.PO_COMPLEX_WORK_GRP.is_complex_work_style';
151  d_progress   NUMBER;
152 
153  l_is_complex_style        BOOLEAN;
154 
155 BEGIN
156 
157   d_progress := 0;
158   IF (PO_LOG.d_proc) THEN
159     PO_LOG.proc_begin(d_module);
160     PO_LOG.proc_begin(d_module, 'p_api_version', p_api_version);
161     PO_LOG.proc_begin(d_module, 'p_style_id', p_style_id);
162   END IF;
163 
164   d_progress := 10;
165 
166   l_is_complex_style := PO_COMPLEX_WORK_PVT.is_complex_work_style(p_style_id);
167 
168   IF (l_is_complex_style) THEN
169     x_is_complex_flag := 'Y';
170   ELSE
171     x_is_complex_flag := 'N';
172   END IF;
173 
174   d_progress := 30;
175 
176   x_return_status := FND_API.G_RET_STS_SUCCESS;
177 
178   IF (PO_LOG.d_proc) THEN
179     PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
180     PO_LOG.proc_end(d_module, 'x_is_complex_flag', x_is_complex_flag);
181     PO_LOG.proc_end(d_module);
182   END IF;
183 
184 EXCEPTION
185   WHEN OTHERS THEN
186     IF (PO_LOG.d_exc) THEN
187       PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
188       PO_LOG.proc_end(d_module);
189     END IF;
190     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
191 END is_complex_work_style;
192 
193 ------------------------------------------------------------------------------
194 --Start of Comments
195 --Name: is_financing_payment_style
196 --Pre-reqs:
197 --  None
198 --Modifies:
199 --  None.
200 --Locks:
201 --  None.
202 --Function:
203 --  This procedure reveals whether a style indicates to use financing pay items
204 --  or actuals pay items.
205 --Parameters:
206 --IN:
207 --  p_api_version
208 --    Should be 1.0
209 --  p_style_id
210 --    ID of the style to get the financing flag for
211 --OUT:
212 --  x_return_status
213 --    FND_API.G_RET_STS_SUCCESS: API completed successfully.
214 --    FND_API.G_RET_STS_UNEXP_ERROR: API was not successful; unexpected error.
215 --  x_is_financing_flag
216 --    'Y': Any document with this style uses financing progress payments
217 --    'N': Any document with this style does not use financing progress
218 --         payments (other than advances).
219 --End of Comments
220 -------------------------------------------------------------------------------
221 PROCEDURE is_financing_payment_style(
222   p_api_version           IN NUMBER
223 , p_style_id              IN NUMBER
224 , x_return_status         OUT NOCOPY VARCHAR2
225 , x_is_financing_flag     OUT NOCOPY VARCHAR2
226 )
227 IS
228 
229  d_module     VARCHAR2(70) := 'po.plsql.PO_COMPLEX_WORK_GRP.is_financing_payment_style';
230  d_progress   NUMBER;
231 
232  l_is_financing_style        BOOLEAN;
233 
234 BEGIN
235 
236   d_progress := 0;
237   IF (PO_LOG.d_proc) THEN
238     PO_LOG.proc_begin(d_module);
239     PO_LOG.proc_begin(d_module, 'p_api_version', p_api_version);
240     PO_LOG.proc_begin(d_module, 'p_style_id', p_style_id);
241   END IF;
242 
243   d_progress := 10;
244 
245   l_is_financing_style :=
246               PO_COMPLEX_WORK_PVT.is_financing_payment_style(p_style_id);
247 
248   IF (l_is_financing_style) THEN
249     x_is_financing_flag := 'Y';
250   ELSE
251     x_is_financing_flag := 'N';
252   END IF;
253 
254   d_progress := 30;
255 
256   x_return_status := FND_API.G_RET_STS_SUCCESS;
257 
258   IF (PO_LOG.d_proc) THEN
259     PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
260     PO_LOG.proc_end(d_module, 'x_is_financing_flag', x_is_financing_flag);
261     PO_LOG.proc_end(d_module);
262   END IF;
263 
264 EXCEPTION
265   WHEN OTHERS THEN
266     IF (PO_LOG.d_exc) THEN
267       PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
268       PO_LOG.proc_end(d_module);
269     END IF;
270     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
271 END is_financing_payment_style;
272 
273 
274 
275 ------------------------------------------------------------------------------
276 --Start of Comments
277 --Name: is_complex_work_po
278 --Pre-reqs:
279 --  None
280 --Modifies:
281 --  None.
282 --Locks:
283 --  None.
284 --Function:
285 --  This procedure reveals whether a PO is a complex work PO.
286 --Parameters:
287 --IN:
288 --  p_api_version
289 --    Should be 1.0
290 --  p_po_header_id
291 --    Header ID of the PO to check whether or not it's a complex work PO
292 --OUT:
293 --  x_return_status
294 --    FND_API.G_RET_STS_SUCCESS: API completed successfully.
295 --    FND_API.G_RET_STS_UNEXP_ERROR: API was not successful; unexpected error.
296 --  x_is_complex_flag
297 --    'Y': This PO uses progress payments
298 --    'N': This PO cannot use progress payments
299 --End of Comments
300 -------------------------------------------------------------------------------
301 PROCEDURE is_complex_work_po(
302   p_api_version           IN NUMBER
303 , p_po_header_id          IN NUMBER
304 , x_return_status         OUT NOCOPY VARCHAR2
305 , x_is_complex_flag       OUT NOCOPY VARCHAR2
306 )
307 IS
308 
309  d_module     VARCHAR2(70) := 'po.plsql.PO_COMPLEX_WORK_GRP.is_complex_work_po';
310  d_progress   NUMBER;
311 
312  l_is_complex_po        BOOLEAN;
313 
314 BEGIN
315 
316   d_progress := 0;
317   IF (PO_LOG.d_proc) THEN
318     PO_LOG.proc_begin(d_module);
319     PO_LOG.proc_begin(d_module, 'p_api_version', p_api_version);
320     PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
321   END IF;
322 
323   d_progress := 10;
324 
325   l_is_complex_po := PO_COMPLEX_WORK_PVT.is_complex_work_po(p_po_header_id);
326 
327   IF (l_is_complex_po) THEN
328     x_is_complex_flag := 'Y';
329   ELSE
330     x_is_complex_flag := 'N';
331   END IF;
332 
333   x_return_status := FND_API.G_RET_STS_SUCCESS;
334 
335   IF (PO_LOG.d_proc) THEN
336     PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
340 
337     PO_LOG.proc_end(d_module, 'x_is_complex_flag', x_is_complex_flag);
338     PO_LOG.proc_end(d_module);
339   END IF;
341 EXCEPTION
342   WHEN OTHERS THEN
343     IF (PO_LOG.d_exc) THEN
344       PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
345       PO_LOG.proc_end(d_module);
346     END IF;
347     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
348 END is_complex_work_po;
349 
350 
351 ------------------------------------------------------------------------------
352 --Start of Comments
353 --Name: is_financing_po
354 --Pre-reqs:
355 --  None
356 --Modifies:
357 --  None.
358 --Locks:
359 --  None.
360 --Function:
361 --  This procedure reveals whether a PO uses financing or actuals pay items.
362 --Parameters:
363 --IN:
364 --  p_api_version
365 --    Should be 1.0
366 --  p_po_header_id
367 --    Header ID of the PO to check whether or not PO uses financing pay items
368 --OUT:
369 --  x_return_status
370 --    FND_API.G_RET_STS_SUCCESS: API completed successfully.
371 --    FND_API.G_RET_STS_UNEXP_ERROR: API was not successful; unexpected error.
372 --  x_is_complex_flag
373 --    'Y': This PO uses financing pay items
374 --    'N': This PO does not use financing pay items, other than for advances
375 --End of Comments
376 -------------------------------------------------------------------------------
377 PROCEDURE is_financing_po(
378   p_api_version           IN NUMBER
379 , p_po_header_id          IN NUMBER
380 , x_return_status         OUT NOCOPY VARCHAR2
381 , x_is_financing_flag     OUT NOCOPY VARCHAR2
382 )
383 IS
384 
385  d_module     VARCHAR2(70) := 'po.plsql.PO_COMPLEX_WORK_GRP.is_financing_po';
386  d_progress   NUMBER;
387 
388  l_is_financing_po        BOOLEAN;
389 
390 BEGIN
391 
392   d_progress := 0;
393   IF (PO_LOG.d_proc) THEN
394     PO_LOG.proc_begin(d_module);
395     PO_LOG.proc_begin(d_module, 'p_api_version', p_api_version);
396     PO_LOG.proc_begin(d_module, 'p_po_header_id', p_po_header_id);
397   END IF;
398 
399   d_progress := 10;
400 
401   l_is_financing_po := PO_COMPLEX_WORK_PVT.is_financing_po(p_po_header_id);
402 
403   IF (l_is_financing_po) THEN
404     x_is_financing_flag := 'Y';
405   ELSE
406     x_is_financing_flag := 'N';
407   END IF;
408 
409   x_return_status := FND_API.G_RET_STS_SUCCESS;
410 
411   IF (PO_LOG.d_proc) THEN
412     PO_LOG.proc_end(d_module, 'x_return_status', x_return_status);
413     PO_LOG.proc_end(d_module, 'x_is_financing_flag', x_is_financing_flag);
414     PO_LOG.proc_end(d_module);
415   END IF;
416 
417 EXCEPTION
418   WHEN OTHERS THEN
419     IF (PO_LOG.d_exc) THEN
420       PO_LOG.exc(d_module, d_progress, SQLCODE || SQLERRM);
421       PO_LOG.proc_end(d_module);
422     END IF;
423     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
424 END is_financing_po;
425 
426 
427 
428 END PO_COMPLEX_WORK_GRP;