1 PACKAGE PO_CONTERMS_UTL_GRP AS
2 /* $Header: POXGCTUS.pls 120.4 2005/09/01 16:45:39 dreddy noship $ */
3
4 -- Read the profile option that enables/disables the debug log
5 g_fnd_debug CONSTANT VARCHAR2(1) :=
6 NVL (FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
7
8 -- Read profile option 'contracts enabled'
9 g_contracts_enabled CONSTANT VARCHAR2(1) :=
10 NVL (FND_PROFILE.VALUE('POC_ENABLED'),'N');
11
12 -- <11i10+ Contracts ER Auto Apply terms>
13 -- Read profile option 'Auto Apply Contracts template'
14 g_auto_apply_template CONSTANT VARCHAR2(1) :=
15 NVL (FND_PROFILE.VALUE('PO_AUTO_APPLY_TEMPLATE'),'N');
16
17 -- declare categories table type based on contracts item category type dfn
18 SUBTYPE item_category_tbl_type IS OKC_TERMS_UTIL_GRP.category_tbl_type;
19
20 -- declare items table type based on contracts items table type definition
21 SUBTYPE item_tbl_type IS OKC_TERMS_UTIL_GRP.item_tbl_type;
22
23 -- define table type for supplier user list
24 SUBTYPE external_user_tbl_type IS PO_VENDORS_GRP.external_user_tbl_type;
25
26 -- Contracts variable codes TBL Type
27 SUBTYPE variable_code_tbl_type IS OKC_TERMS_UTIL_GRP.variable_code_tbl_type;
28
29 -- Contracts variable values TBL Type
30 SUBTYPE variable_value_tbl_type IS OKC_TERMS_UTIL_GRP.sys_var_value_tbl_type;
31
32 -- other
33 g_pkg_name CONSTANT VARCHAR2(30) := 'PO_CONTERMS_UTL_GRP';
34 g_module_prefix CONSTANT VARCHAR2(50) := 'po.plsql.'||g_pkg_name||'.';
35
36 ---------------------------------------------------------------------------------
37 -- API to indicate if Procurement Contracts has been enabled or not.
38 ---------------------------------------------------------------------------------
39 FUNCTION is_contracts_enabled RETURN VARCHAR2;
40
41 ---------------------------------------------------------------------------------
42 -- Overloaded PROCEDURE to indicate if Contracts has been enabled or not.
43 ---------------------------------------------------------------------------------
44 PROCEDURE is_contracts_enabled
45 (p_api_version IN NUMBER --bug4028805
46 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
47 ,x_return_status OUT NOCOPY VARCHAR2
48 ,x_msg_count OUT NOCOPY NUMBER
49 ,x_msg_data OUT NOCOPY VARCHAR2
50 ,x_contracts_enabled OUT NOCOPY VARCHAR2);
51
52 ---------------------------------------------------------------------------------
53 -- Returns the Contract document type to be used for a purchase order
54 ---------------------------------------------------------------------------------
55 FUNCTION Get_Po_Contract_Doctype(p_sub_doc_type IN VARCHAR2) RETURN VARCHAR2;
56
57 ---------------------------------------------------------------------------------
58 -- API to return supplier users for the given PO document. Please check cooments
59 -- body for more details.
60 ---------------------------------------------------------------------------------
61 PROCEDURE get_external_userlist
62 (p_api_version IN NUMBER --bug4028805
63 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
64 ,p_document_id IN NUMBER
65 ,p_document_type IN VARCHAR2
66 ,p_external_contact_id IN NUMBER DEFAULT NULL
67 ,x_return_status OUT NOCOPY VARCHAR2
68 ,x_msg_count OUT NOCOPY NUMBER
69 ,x_msg_data OUT NOCOPY VARCHAR2
70 ,x_external_user_tbl OUT NOCOPY external_user_tbl_type);
71
72
73 ---------------------------------------------------------------------------------
74 -- Overloaded API to return supplier users for the given PO document.
75 -- Please check comments section in the body for more details.
76 ---------------------------------------------------------------------------------
77 PROCEDURE get_external_userlist
78 (p_api_version IN NUMBER --bug4028805
79 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
80 ,p_document_id IN NUMBER
81 ,p_document_type IN VARCHAR2
82 ,p_external_contact_id IN NUMBER DEFAULT NULL
83 ,x_return_status OUT NOCOPY VARCHAR2
84 ,x_msg_count OUT NOCOPY NUMBER
85 ,x_msg_data OUT NOCOPY VARCHAR2
86 ,x_external_userlist OUT NOCOPY VARCHAR2);
87
88 ---------------------------------------------------------------------------------
89 -- API to generate the list of distinct item categories used in a PO document.
90 -- For more details please check the comments section in the body.
91 ---------------------------------------------------------------------------------
92 PROCEDURE get_item_categorylist
93 (p_api_version IN NUMBER
94 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
95 ,p_document_id IN NUMBER
96 ,x_return_status OUT NOCOPY VARCHAR2
97 ,x_msg_count OUT NOCOPY NUMBER
98 ,x_msg_data OUT NOCOPY VARCHAR2
99 ,x_category_tbl OUT NOCOPY item_category_tbl_type
100 ,x_item_tbl OUT NOCOPY item_tbl_type);
101
102 ---------------------------------------------------------------------------------
103 -- API to allow saving of changes to contract terms based on PO status
104 -- For more details on usage and assumptions, please check the comments section
105 -- in the package body
106 ---------------------------------------------------------------------------------
107 PROCEDURE IS_Po_Update_Allowed (
108 p_api_version IN NUMBER,
109 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
110 p_header_id IN NUMBER,
111 p_callout_string IN VARCHAR2,
112 p_lock_flag IN VARCHAR2 DEFAULT 'N',
113 x_update_allowed OUT NOCOPY VARCHAR2,
114 x_return_status OUT NOCOPY VARCHAR2,
115 x_msg_data OUT NOCOPY VARCHAR2,
116 x_msg_count OUT NOCOPY NUMBER);
117
118 ----------------------------------------------------------------------------------------
119 -- API to make changes to Po headers whe template is attached or dropped from a
120 -- purchase order. For more details on usage and auumptions, please check comments
121 -- in package body
122 ----------------------------------------------------------------------------------------
123 PROCEDURE Apply_Template_Change (
124 p_api_version IN NUMBER,
125 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
126 p_header_id IN NUMBER,
127 p_callout_string IN VARCHAR2,
128 p_template_changed IN VARCHAR2 DEFAULT 'N',
129 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
130 x_update_allowed OUT NOCOPY VARCHAR2,
131 x_return_status OUT NOCOPY VARCHAR2,
132 x_msg_data OUT NOCOPY VARCHAR2,
133 x_msg_count OUT NOCOPY NUMBER);
134
135 ----------------------------------------------------------------------------------------
136 -- API to check which variable values changed since last PO revision
137 -- For more details on usage and auumptions, please check comments
138 -- in package body
139 ----------------------------------------------------------------------------------------
140 PROCEDURE Attribute_Value_Changed (
141 p_api_version IN NUMBER,
142 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
143 p_doc_id IN NUMBER,
144 p_sys_var_tbl IN OUT NOCOPY VARIABLE_CODE_TBL_TYPE,
145 x_return_status OUT NOCOPY VARCHAR2,
146 x_msg_data OUT NOCOPY VARCHAR2,
147 x_msg_count OUT NOCOPY NUMBER);
148
149 ----------------------------------------------------------------------------------------
150 -- API to return value of po attributes reffered in Contract Terms
151 -- For more details on usage and auumptions, please check comments
152 -- in package body
153 ----------------------------------------------------------------------------------------
154 PROCEDURE Get_PO_Attribute_Values(
155 p_api_version IN NUMBER,
156 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
157 p_doc_id IN NUMBER,
158 p_sys_var_value_tbl IN OUT NOCOPY VARIABLE_VALUE_TBL_TYPE,
159 x_return_status OUT NOCOPY VARCHAR2,
160 x_msg_data OUT NOCOPY VARCHAR2,
161 x_msg_count OUT NOCOPY NUMBER);
162
163 ---------------------------------------------------------------------------------
164 -- API to return last Signed or Approved(no signature required)revision number
165 -- For more details on usage and assumptions, please check the comments section
166 -- in the package body
167 ---------------------------------------------------------------------------------
168 PROCEDURE Get_Last_Signed_Revision (
169 p_api_version IN NUMBER,
170 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
171 p_header_id IN NUMBER,
172 p_revision_num IN NUMBER,
173 x_signed_revision_num OUT NOCOPY NUMBER,
174 x_signed_records OUT NOCOPY VARCHAR2,
175 x_return_status OUT NOCOPY VARCHAR2,
176 x_msg_data OUT NOCOPY VARCHAR2,
177 x_msg_count OUT NOCOPY NUMBER);
178
179 ---------------------------------------------------------------------------------
180 -- <11i10+ Contracts ER Auto Apply terms>
181 -- API to apply the default contract template to a purchasing document
182 -- For more details on usage and assumptions, please check the comments section
183 -- in the package body
184 ---------------------------------------------------------------------------------
185 PROCEDURE Auto_Apply_ConTerms (
186 p_document_id IN NUMBER,
187 p_template_id IN NUMBER,
188 x_return_status OUT NOCOPY VARCHAR2);
189
190 ---------------------------------------------------------------------------------
191 -- <Contracts ER Auto Apply terms>
192 -- API to get the default contract template to a purchasing document
193 -- For more details on usage and assumptions, please check the comments section
194 -- in the package body
195 ---------------------------------------------------------------------------------
196 PROCEDURE get_def_proc_contract_info (
197 p_doc_subtype IN VARCHAR2,
198 p_org_id IN NUMBER,
199 p_conterms_exist_flag IN VARCHAR2,
200 x_template_id OUT NOCOPY VARCHAR2,
201 x_template_name OUT NOCOPY VARCHAR2,
202 x_authoring_party OUT NOCOPY VARCHAR2,
203 x_return_status OUT NOCOPY VARCHAR2);
204
205
206 ---------------------------------------------------------------------------------
207 -- <R12 Procurement Contracts Integration>
208 -- API to get authoring party and template name from a document.
209 -- For more details on usage and assumptions, please check the comments section
210 -- in the package body
211 ---------------------------------------------------------------------------------
212 Procedure Get_Contract_Details(
213 x_return_status OUT NOCOPY VARCHAR2,
214 p_doc_type IN VARCHAR2,
215 p_doc_subtype IN VARCHAR2,
216 p_document_id IN NUMBER,
217 x_authoring_party OUT NOCOPY VARCHAR2,
218 x_template_name OUT NOCOPY VARCHAR2
219 );
220
221 ---------------------------------------------------------------------------------
222 -- FP CU2-R12: Migrate PO
223 -- Function to check if the last archived version has conterms
224 ---------------------------------------------------------------------------------
225 FUNCTION get_archive_conterms_flag (p_po_header_id IN NUMBER)
226 RETURN VARCHAR2;
227
228 END PO_CONTERMS_UTL_GRP;