1 PACKAGE OZF_ALLOCATION_ENGINE_PVT AUTHID CURRENT_USER AS
2 /* $Header: ozfvaegs.pls 120.1 2005/09/08 17:50:26 appldev ship $ */
3 VERSION CONSTANT CHAR(80) := '$Header: ozfvaegs.pls 120.1 2005/09/08 17:50:26 appldev ship $';
4
5 -- ------------------------
6 -- Public Procedures
7 -- ------------------------
8
9 -- ------------------------------------------------------------------
10 -- Name: SETUP PRODUCT SPREAD
11 -- Desc: 1. Setup product spread for Root Node, Normal Node and Facts
12 -- in the Worksheet.
13 -- 2. Update or Delete the product spread
14 -- 3. Add-on Quota on subsequent call
15 -- -----------------------------------------------------------------
16 PROCEDURE setup_product_spread(
17 p_api_version IN NUMBER,
18 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
19 p_commit IN VARCHAR2 := FND_API.G_FALSE,
20 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
21 x_return_status OUT NOCOPY VARCHAR2,
22 x_error_number OUT NOCOPY NUMBER,
23 x_error_message OUT NOCOPY VARCHAR2,
24 p_mode IN VARCHAR2,
25 p_obj_id IN NUMBER,
26 p_context IN VARCHAR2
27 );
28
29 -- ------------------------------------------------------------------
30 -- Name: CASCADE PRODUCT SPREAD
31 -- Desc: 1. Cascade product spread for Creator Node to all other Nodes
32 -- who are part of same hierarchy.
33 -- -----------------------------------------------------------------
34 PROCEDURE cascade_product_spread(
35 p_api_version IN NUMBER,
36 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
37 p_commit IN VARCHAR2 := FND_API.G_FALSE,
38 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
39 x_return_status OUT NOCOPY VARCHAR2,
40 x_error_number OUT NOCOPY NUMBER,
41 x_error_message OUT NOCOPY VARCHAR2,
42 p_mode IN VARCHAR2,
43 p_fund_id IN NUMBER,
44 p_item_id IN NUMBER,
45 p_item_type IN VARCHAR2
46 );
47
48 -- ------------------------------------------------------------------
49 -- Name: ALLOCATE TARGET
50 -- Desc: 1. Allocate Target across Accounts and Products for Sales Rep
51 -- 2. Add-on Target on subsequent call
52 -- -----------------------------------------------------------------
53 PROCEDURE allocate_target
54 (
55 p_api_version IN NUMBER,
56 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
57 p_commit IN VARCHAR2 := FND_API.G_FALSE,
58 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
59 x_return_status OUT NOCOPY VARCHAR2,
60 x_error_number OUT NOCOPY NUMBER,
61 x_error_message OUT NOCOPY VARCHAR2,
62 p_mode IN VARCHAR2,
63 p_fund_id IN NUMBER,
64 p_old_start_date IN DATE,
65 p_new_end_date IN DATE,
66 p_addon_fact_id IN NUMBER,
67 p_addon_amount IN NUMBER
68 );
69
70 -- ------------------------------------------------------------------
71 -- Name: Called from Account Spread and Product Spread UI
72 -- Desc: This is part of the tweaking to swap DB rows to UI columns
73 -- after brainstorming with ATG, Performance, Arch teams.
74 -- Note: Distinct allocation_for are = { CUST, PROD }
75 -- ------------------------------------------------------------------
76 FUNCTION GET_TARGET
77 (
78 p_allocation_for_id IN number,
79 p_time_id IN number,
80 p_allocation_for IN varchar2 DEFAULT 'PROD'
81 ) RETURN NUMBER;
82
83 -- ------------------------------------------------------------------
84 -- Name: Called from Account Spread and Product Spread UI
85 -- Desc: This is part of the tweaking to swap DB rows to UI columns
86 -- after brainstorming with ATG, Performance, Arch teams.
87 -- Note: Distinct allocation_for are = { CUST, PROD }
88 -- ------------------------------------------------------------------
89 FUNCTION GET_TARGET_PKEY
90 (
91 p_allocation_for_id IN number,
92 p_time_id IN number,
93 p_allocation_for IN varchar2 DEFAULT 'PROD'
94 ) RETURN NUMBER;
95
96 -- ------------------------------------------------------------------
97 -- Name: Called from Account Spread and Product Spread UI
98 -- Desc: This is part of the tweaking to swap DB rows to UI columns
99 -- after brainstorming with ATG, Performance, Arch teams.
100 -- Note: Distinct allocation_for are = { CUST, PROD }
101 -- ------------------------------------------------------------------
102 FUNCTION GET_SALES
103 (
104 p_allocation_for_id IN number,
105 p_time_id IN number,
106 p_allocation_for IN varchar2 DEFAULT 'PROD'
107 ) RETURN NUMBER;
108
109 -- ------------------------------------------------------------------
110 -- Name: Called from Product Spread UI and from private apis
111 -- Desc: This function will calculate and return LYSP sales of the newly
112 -- added Product or Category on the Product Spread UI for ROOT fund
113 -- for or any ShipTo Customer
114 -- Note: Distinct object types are = { ROOT, CUST }
115 -- ------------------------------------------------------------------
116 FUNCTION GET_SALES
117 (
118 p_object_type IN VARCHAR2,
119 p_object_id IN NUMBER,
120 p_item_id IN NUMBER,
121 p_item_type IN VARCHAR2,
122 p_time_id IN NUMBER
123 ) RETURN NUMBER;
124
125 -- ------------------------
126 -- Public Function
127 -- ------------------------
128 -- ------------------------------------------------------------------
129 -- Name: Called from Quota Create APIs
130 -- Desc: This is for checking if product allocation for a particular
131 -- fund is already done.
132 --
133 -- -----------------------------------------------------------------
134 FUNCTION GET_PROD_ALLOC_COUNT
135 (
136 p_fund_id IN number
137 ) RETURN NUMBER;
138
139 -- ------------------------
140 -- ------------------------
141 -- Public Procedure
142 -- ------------------------
143 -- ------------------------------------------------------------------
144 -- Name: ADJUST_ACCOUNT_TARGETS
145 -- Desc: 1. Create new target allocation records,
146 -- when an account is newly assigned to a territory
147 -- 2. Adjust old target allocation records,
148 -- when an account is moved away from a territory
149 -- History
150 -- 09-SEP-05 mkothari created
151 --
152 -- -----------------------------------------------------------------
153 PROCEDURE adjust_account_targets
154 (
155 x_error_number OUT NOCOPY NUMBER,
156 x_error_message OUT NOCOPY VARCHAR2,
157 p_terr_id IN NUMBER := NULL
158 );
159
160 END OZF_ALLOCATION_ENGINE_PVT;