1 PACKAGE BODY CSP_PROD_TASK_HIST_RULE as
2 /* $Header: cspgphrb.pls 115.2 2002/11/26 07:54:12 hhaugeru ship $ */
3 -- Start of Comments
4 -- Package name : CSP_PROD_TASK_HIST_RULE
5 -- Purpose : This package includes the functions that decide whether to use the history
6 -- of Product-Task-Parts details based on value defined in CSP_PROD_TASK_HIST_RULE profile.
7 -- History : 03-Aug-2001, Arul Joseph.
8 -- NOTE :
9 -- End of Comments
10
11 Function get_quantity
12 (p_prod_task_times_used number,
13 p_manual_quantity number,
14 p_rollup_quantity_used number,
15 p_rollup_times_used number,
16 p_quantity_used number,
17 p_part_actual_times_used number
18 ) return number IS
19 l_value Varchar2(100);
20 l_quantity Number;
21 Begin
22 Fnd_profile.get('CSP_PROD_TASK_HIST_RULE',L_VALUE);
23 If p_manual_quantity is not null then
24 l_quantity := p_manual_quantity;
25 Else
26 if l_value > p_prod_task_times_used then
27 l_quantity := null;
28 elsif l_value <= p_prod_task_times_used then
29 l_quantity := Nvl((p_rollup_quantity_used/p_rollup_times_used),(p_quantity_used/p_part_actual_times_used));
30 end if;
31 end if;
32 return l_quantity;
33 End;
34
35 Function get_percentage
36 (p_prod_task_times_used number,
37 p_manual_percentage number,
38 p_rollup_times_used number,
39 p_part_actual_times_used number)
40 return number IS
41 l_value Varchar2(100);
42 l_percentage number;
43 Begin
44 Fnd_profile.get('CSP_PROD_TASK_HIST_RULE',L_VALUE);
45 If p_manual_percentage is not null then
46 l_percentage := p_manual_percentage;
47 Else
48 if l_value > p_prod_task_times_used then
49 l_percentage := null;
50 elsif l_value <= p_prod_task_times_used then
51 l_percentage := Nvl((p_rollup_times_used/p_prod_task_times_used)*100, ((p_part_actual_times_used/p_prod_task_times_used)*100));
52 end if;
53 end if;
54 return l_percentage;
55 End;
56 END CSP_PROD_TASK_HIST_RULE;