1 PACKAGE AHL_WARRANTY_ENTL_PVT AUTHID CURRENT_USER AS
2 /* $Header: AHLVENTS.pls 120.2.12020000.2 2012/12/14 08:51:10 shnatu ship $ */
3
4 -- Operations
5 G_OP_CREATE CONSTANT VARCHAR2(1) := 'C';
6 G_OP_UPDATE CONSTANT VARCHAR2(1) := 'U';
7 G_OP_DELETE CONSTANT VARCHAR2(1) := 'D';
8 G_OP_APPROVE CONSTANT VARCHAR2(1) := 'A';
9
10 -- Approvals
11 G_APPR_ACCEPT CONSTANT VARCHAR2(1) := 'A';
12 G_APPR_REJECT CONSTANT VARCHAR2(1) := 'R';
13
14 -- User roles
15 G_USER_PLANNER CONSTANT VARCHAR2(1) := 'P';
16 G_USER_NONPLANNER CONSTANT VARCHAR2(2) := 'NP';
17
18 -- object names mapped to the Workflow process, as defined in the lookup AHL_APPR_OBJECT_TYPE
19 G_WF_ENTL_OBJ CONSTANT VARCHAR2(30) := 'W_ENTL'; -- Warranty Entitlement
20 G_WF_EXPR_OBJ CONSTANT VARCHAR2(30) := 'W_EXPR'; -- Warranty Expiration
21 G_WF_WOCL_OBJ CONSTANT VARCHAR2(30) := 'W_WOCL'; -- Warranty Workorder Completion
22
23 -- AOL function names for the OA regions in the notification body
24 G_WARRANTY_ENTL_FN CONSTANT VARCHAR2(30) := 'AHL_WARRANTY_ENTL_NTFCN'; -- Warranty Entitlement Notification
25 G_WARRANTY_EXPR_FN CONSTANT VARCHAR2(30) := 'AHL_WARRANTY_EXPR_NTFCN'; -- Warranty Expiration Notification
26 G_WARRANTY_WOCL_FN CONSTANT VARCHAR2(30) := 'AHL_WARRANTY_WOCL_NTFCN'; -- Warranty Workorder Completion Notification
27
28 -- names of the parameters, if any, required by the OA regions in the notification body
29 G_ENTL_FN_PARAM1 CONSTANT VARCHAR2(30) := 'WarrantyEntlId'; -- warranty entitlement id
30
31 -- AOL message codes for the notification subjects
32 G_WARRANTY_ENTL_SBJ CONSTANT VARCHAR2(30) := 'AHL_WARRANTY_ENTL_NTFCN_SBJ'; -- Warranty entitlement review notification
33 G_WARRANTY_EXPR_SBJ CONSTANT VARCHAR2(30) := 'AHL_WARRANTY_EXPR_NTFCN_SBJ'; -- Warranty expiration notification
34 G_WARRANTY_WOCL_SBJ CONSTANT VARCHAR2(30) := 'AHL_WARRANTY_WOCL_NTFCN_SBJ'; -- Warranty workorder completion notification
35
36 -- record structure for the DB table AHL_WARRANTY_ENTITLEMENTS
37 TYPE Warranty_Entl_Rec_Type IS RECORD (
38 warranty_entitlement_id NUMBER,
39 operation_flag VARCHAR2(1),
40 object_version_number NUMBER,
41 last_update_date DATE,
42 last_updated_by NUMBER,
43 creation_date DATE,
44 created_by NUMBER,
45 last_update_login NUMBER,
46 security_group_id NUMBER,
47 warranty_contract_id NUMBER,
48 entitlement_status_code VARCHAR2(30),
49 warranty_claim_id NUMBER,
50 po_header_id NUMBER,
51 sr_incident_id NUMBER,
52 visit_task_id NUMBER,
53 workorder_id NUMBER := NULL,
54 osp_order_line_id NUMBER,
55 warranty_labour_capture VARCHAR2(1),
56 warranty_mtl_capture VARCHAR2(1),
57 order_claim_amount NUMBER,
58 attribute_category VARCHAR2(30),
59 attribute1 VARCHAR2(150),
60 attribute2 VARCHAR2(150),
61 attribute3 VARCHAR2(150),
62 attribute4 VARCHAR2(150),
63 attribute5 VARCHAR2(150),
64 attribute6 VARCHAR2(150),
65 attribute7 VARCHAR2(150),
66 attribute8 VARCHAR2(150),
67 attribute9 VARCHAR2(150),
68 attribute10 VARCHAR2(150),
69 attribute11 VARCHAR2(150),
70 attribute12 VARCHAR2(150),
71 attribute13 VARCHAR2(150),
72 attribute14 VARCHAR2(150),
73 attribute15 VARCHAR2(150)
74 );
75
76 -- table type for the above record structure
77 TYPE Warranty_Entl_Tbl_Type IS TABLE OF Warranty_Entl_Rec_Type
78 INDEX BY BINARY_INTEGER;
79
80 ------------------------------------------------------------------------------------
81 -- Start of Comments
82 -- Procedure name : Process_Warranty_Entitlements
83 -- Type : Public
84 -- Function : Create, Update, Delete or Approve the Warranty Entitlements records.
85 -- Pre-reqs :
86 -- Parameters :
87 --
88 -- Process_Item_Group Parameters:
89 -- p_user_role IN Either of G_USER_PLANNER or G_USER_NONPLANNER Required
90 -- p_appr_action IN Either of G_APPR_ACCEPT or G_APPR_REJECT Required
91 -- p_x_warranty_entl_tbl IN OUT Warranty_Entl_Tbl_Type Required
92 --
93 -- End of Comments
94
95 PROCEDURE Process_Warranty_Entitlements (
96 p_api_version IN NUMBER := 1.0,
97 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
98 p_commit IN VARCHAR2 := FND_API.G_FALSE,
99 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
100 p_module_type IN VARCHAR2 := NULL,
101 p_user_role IN VARCHAR2,
102 p_appr_action IN VARCHAR2 := NULL,
103 p_x_warranty_entl_tbl IN OUT NOCOPY Warranty_Entl_Tbl_Type,
104 x_return_status OUT NOCOPY VARCHAR2,
105 x_msg_count OUT NOCOPY NUMBER,
106 x_msg_data OUT NOCOPY VARCHAR2
107 );
108
109 ------------------------------------------------------------------------------------
110 -- Start of Comments
111 -- Function name : Is_Task_Warranty_Available
112 -- Type : Public
113 -- Function : To Check whether the visit task is warranty enabled
114 -- Return 'Y' for the following cases:
115 -- 1. If the originating MR or Route had a Warranty Template assigned.
116 -- This will just identify that there could be the possibility of an applicable warranty.
117 -- Return 'N' otherwise
118 -- 1. If the originating MR or Route did not have a Warranty Template assigned.
119 -- Pre-reqs :
120 -- Parameters : p_task_id IN NUMBER Required : Visit Task id
121 --
122 -- End of Comments
123
124 FUNCTION Is_Task_Warranty_Available(
125 P_TASK_ID IN NUMBER
126 ) RETURN VARCHAR2;
127
128 ------------------------------------------------------------------------------------
129 -- Start of Comments
130 -- Procedure name : Launch_Entl_Notification
131 -- Type : Public
132 -- Function : Launches a Workflow notification for an entitlement for review
133 -- Pre-reqs :
134 -- Parameters :
135 --
136 -- Launch_Entl_Notification Parameters:
137 -- p_entitlement_id IN Entitlement id Required
138 -- p_commit IN Commit flag. Workflow will be launched only Required
139 -- after a commit.
140 -- x_item_key OUT Item key of the launched notification Required
141 -- x_return_status OUT Return status. Item key to be used only if Required
142 -- this status is FND_API.G_RET_STS_SUCCESS.
143 --
144 -- End of Comments
145
146 PROCEDURE Launch_Entl_Notification (
147 p_entitlement_id IN NUMBER,
148 p_commit IN VARCHAR2 := FND_API.G_FALSE,
149 x_item_key OUT NOCOPY VARCHAR2,
150 x_return_status OUT NOCOPY VARCHAR2
151 );
152
153 ------------------------------------------------------------------------------------
154 -- Start of Comments
155 -- Procedure name : Launch_Expr_Notification
156 -- Type : Public
157 -- Function : Launches a Workflow notification for warranty expiration. Will be configured
158 -- as a concurrent program
159 -- Pre-reqs :
160 -- Parameters :
161 --
162 -- End of Comments
163
164 PROCEDURE Launch_Expr_Notification (
165 errbuf OUT NOCOPY VARCHAR2,
166 retcode OUT NOCOPY NUMBER
167 );
168
169 ------------------------------------------------------------------------------------
170 -- Start of Comments
171 -- Procedure name : Launch_WOCl_Notification
172 -- Type : Public
173 -- Function : Launches a Workflow notification for completed Workorders. Will be configured
174 -- as a concurrent program
175 -- Pre-reqs :
176 -- Parameters :
177 --
178 -- End of Comments
179
180 PROCEDURE Launch_WOCl_Notification (
181 errbuf OUT NOCOPY VARCHAR2,
182 retcode OUT NOCOPY NUMBER
183 );
184
185 ------------------------------------------------------------------------------------
186 -- Start of Comments
187 -- Function name : Get_Entitlement_Instance
188 -- Type : Public
189 -- Function : Gets the instance id for the given warranty entitlement id
190 -- Returns NULL if not found.
191 --
192 -- Pre-reqs :
193 -- Parameters :
194 --
195 -- Get_Entitlement_Instance Parameters:
196 -- p_entitlement_id IN Entitlement id Required
197 --
198 -- End of Comments
199
200 FUNCTION Get_Entitlement_Instance(
201 p_entitlement_id IN NUMBER
202 ) RETURN NUMBER;
203
204 ------------------------------------------------------------------------------------
205 -- Start of Comments
206 -- Function name : Get_OSP_Order_Number
207 -- Type : Public
208 -- Function : Gets the OSP order number for the given OSP line id.
209 -- Returns NULL if not found.
210 --
211 -- Pre-reqs :
212 -- Parameters :
213 --
214 -- Get_OSP_Order_Number Parameters:
215 -- p_osp_line_id IN OSP line id Required
216 --
217 -- End of Comments
218
219 FUNCTION Get_OSP_Order_Number(
220 p_osp_line_id IN NUMBER
221 ) RETURN NUMBER;
222
223 ------------------------------------------------------------------------------------
224 -- Start of Comments
225 -- Function name : Get_OSP_Line_Number
226 -- Type : Public
227 -- Function : Gets the OSP line number for the given OSP line id.
228 -- Returns NULL if not found.
229 --
230 -- Pre-reqs :
231 -- Parameters :
232 --
233 -- Get_OSP_Line_Number Parameters:
234 -- p_osp_line_id IN OSP line id Required
235 --
236 -- End of Comments
237
238 FUNCTION Get_OSP_Line_Number(
239 p_osp_line_id IN NUMBER
240 ) RETURN NUMBER;
241
242 ------------------------------------------------------------------------------------
243 -- Start of Comments
244 -- Function name : Get_OSP_Line_Status
245 -- Type : Public
246 -- Function : Gets the OSP line status for the given OSP line id.
247 -- Returns NULL if not found.
248 --
249 -- Pre-reqs :
250 -- Parameters :
251 --
252 -- Get_OSP_Line_Status Parameters:
253 -- p_osp_line_id IN OSP line id Required
254 --
255 -- End of Comments
256
257 FUNCTION Get_OSP_Line_Status(
258 p_osp_line_id IN NUMBER
259 ) RETURN VARCHAR2;
260
261 END AHL_WARRANTY_ENTL_PVT;