1 PACKAGE PO_TERMS_SV AUTHID CURRENT_USER AS
2 /* $Header: POXPOTES.pls 115.7 2003/12/03 20:17:09 bao ship $*/
3
4 -- <GC FPJ START>
5 -- Define a record that includes terms and conditions to be compared in
6 -- compare_terms_conditions procedure
7
8 -- bug3225062 START
9
10 G_COMPARISON_SCOPE_GLOBAL CONSTANT VARCHAR2(10) := 'GLOBAL';
11 G_COMPARISON_SCOPE_LOCAL CONSTANT VARCHAR2(10) := 'LOCAL';
12 G_COMPARISON_SCOPE_ALL CONSTANT VARCHAR2(10) := 'ALL';
13
14
15 TYPE terms_and_cond_rec_type IS RECORD (
16 terms_id PO_HEADERS_ALL.terms_id%TYPE,
17 fob_lookup_code PO_HEADERS_ALL.fob_lookup_code%TYPE,
18 freight_terms_lookup_code PO_HEADERS_ALL.freight_terms_lookup_code%TYPE,
19 note_to_vendor PO_HEADERS_ALL.note_to_vendor%TYPE,
20 note_to_receiver PO_HEADERS_ALL.note_to_receiver%TYPE,
21 shipping_control PO_HEADERS_ALL.shipping_control%TYPE, -- <INBOUND LOGISTICS FPJ>
22 pay_on_code PO_HEADERS_ALL.pay_on_code%TYPE,
23 bill_to_location_id PO_HEADERS_ALL.bill_to_location_id%TYPE,
24 ship_to_location_id PO_HEADERS_ALL.ship_to_location_id%TYPE,
25 ship_via_lookup_code PO_HEADERS_ALL.ship_via_lookup_code%TYPE
26 );
27
28 TYPE terms_cond_comp_rec_type IS RECORD (
29 terms_id_eq VARCHAR2(1),
30 fob_lookup_code_eq VARCHAR2(1),
31 freight_terms_lookup_code_eq VARCHAR2(1),
32 note_to_vendor_eq VARCHAR2(1),
33 note_to_receiver_eq VARCHAR2(1),
34 shipping_control_eq VARCHAR2(1),
35 pay_on_code_eq VARCHAR2(1),
36 bill_to_location_id_eq VARCHAR2(1),
37 ship_to_location_id_eq VARCHAR2(1),
38 ship_via_lookup_code_eq VARCHAR2(1)
39 );
40
41 -- bug3225062 END
42
43 -- <GC FPJ END>
44
45
46
47 /*===========================================================================
48 FUNCTION NAME: val_payment_terms
49
50 DESCRIPTION: This is a cover routine to val_ap_terms allowing for
51 standard calling: id in, boolean return result.
52 Ultimately, this will become the standard validation
53 function for payment terms.
54
55
56 PARAMETERS: X_ap_terms_id IN NUMBER
57
58 RETURN TYPE: BOOLEAN
59
60 DESIGN REFERENCES:
61
62 ALGORITHM:
63
64 NOTES:
65
66 OPEN ISSUES:
67
68 CLOSED ISSUES:
69
70 CHANGE HISTORY: Created 14-AUG-95 LBROADBE
71 ===========================================================================*/
72 FUNCTION val_payment_terms(X_ap_terms_id IN NUMBER) return BOOLEAN;
73
74 /*===========================================================================
75 FUNCTION NAME: val_fob_code
76
77 DESCRIPTION: This is a cover routine to val_fob allowing for
78 standard calling: code in, boolean return result.
79 Ultimately, this will become the standard validation
80 function for the fob code.
81
82
83 PARAMETERS: X_fob_lookup_code IN VARCHAR2
84
85 RETURN TYPE: BOOLEAN
86
87 DESIGN REFERENCES:
88
89 ALGORITHM:
90
91 NOTES:
92
93 OPEN ISSUES:
94
95 CLOSED ISSUES:
96
97 CHANGE HISTORY: Created 14-AUG-95 LBROADBE
98 ===========================================================================*/
99 FUNCTION val_fob_code(X_fob_lookup_code IN VARCHAR2) return BOOLEAN;
100
101 /*===========================================================================
102 FUNCTION NAME: val_ship_via
103
104 DESCRIPTION: This is a cover routine to val_freight_carrier allowing for
105 standard calling: code in, boolean return result.
106 Ultimately, this will become the standard validation
107 function for the ship via code.
108
109
110 PARAMETERS: X_ship_via_code IN VARCHAR2,
111 X_org_id IN NUMBER
112
113 RETURN TYPE: BOOLEAN
114
115 DESIGN REFERENCES:
116
117 ALGORITHM:
118
119 NOTES:
120
121 OPEN ISSUES:
122
123 CLOSED ISSUES:
124
125 CHANGE HISTORY: Created 14-AUG-95 LBROADBE
126 ===========================================================================*/
127 FUNCTION val_ship_via(X_ship_via_code IN VARCHAR2,
128 X_org_id IN NUMBER) return BOOLEAN;
129
130 /*===========================================================================
131 FUNCTION NAME: val_freight_code
132
133 DESCRIPTION: This is a cover routine to val_freight_terms allowing for
134 standard calling: code in, boolean return result.
135 Ultimately, this will become the standard validation
136 function for freight code.
137
138
139 PARAMETERS: X_freight_terms_code IN NUMBER
140
141 RETURN TYPE: BOOLEAN
142
143 DESIGN REFERENCES:
144
145 ALGORITHM:
146
147 NOTES:
148
149 OPEN ISSUES:
150
151 CLOSED ISSUES:
152
153 CHANGE HISTORY: Created 14-AUG-95 LBROADBE
154 ===========================================================================*/
155 FUNCTION val_freight_code(X_freight_terms_code IN VARCHAR2) return BOOLEAN;
156
157 /*===========================================================================
158 PROCEDURE NAME: val_ap_terms()
159
160 DESCRIPTION: This procedure decides if the given payment_terms_id
161 is valid (ie., if it is still an active lookupcode)
162
163 PARAMETERS:
164
165 DESIGN REFERENCES: ../POXPOMPO.doc
166
167 ALGORITHM:
168
169 NOTES:
170
171 OPEN ISSUES:
172
173 CLOSED ISSUES:
174
175 CHANGE HISTORY: Sudha Iyer 04/95
176 ===========================================================================*/
177
178 PROCEDURE val_ap_terms(X_temp_terms_id IN number, X_res_terms_id IN OUT NOCOPY number);
179
180 /*===========================================================================
181 PROCEDURE NAME: get_terms_name()
182
183 DESCRIPTION: This procedure gets the terms name for a specific
184 terms id.
185
186 PARAMETERS:
187
188 DESIGN REFERENCES: ../POXPOMPO.doc
189 ../POXSCERQ.dd
190
191 ALGORITHM:
192
193 NOTES:
194
195 OPEN ISSUES:
196
197 CLOSED ISSUES:
198
199 CHANGE HISTORY: 12/14/95 MSNYDER Created.
200 ===========================================================================*/
201
202 PROCEDURE get_terms_name (X_terms_id IN number,
203 X_terms_name IN OUT NOCOPY varchar2);
204
205 /*===========================================================================
206 PROCEDURE NAME: derive_payment_terms_info()
207
208 DESCRIPTION: This procedure derives the missing components of the
209 payment terms record based on the components that
210 have values
211
212 PARAMETERS: p_pay_record IN OUT RCV_SHIPMENT_HEADER_SV.PayRecType
213
214 DESIGN REFERENCES:
215
216 ALGORITHM:
217
218 NOTES: uses dbms_sql to generate WHERE clause based on the
219 components that have values
220
221 OPEN ISSUES:
222
223 CLOSED ISSUES:
224
225 CHANGE HISTORY: 10/25/96 Raj Bhakta Created.
226 ===========================================================================*/
227
228 PROCEDURE derive_payment_terms_info(
229 p_pay_record IN OUT NOCOPY RCV_SHIPMENT_HEADER_SV.PayRecType);
230
231 /*===========================================================================
232 PROCEDURE NAME: validate_payment_terms_info()
233
234 DESCRIPTION: This procedure validates the payment terms record based
235 on the components that have values. It applies business
236 rules and retuen error status and error messages based
237 on the success and failure of the business rules.
238
239 PARAMETERS: p_pay_record IN OUT RCV_SHIPMENT_HEADER_SV.PayRecType
240
241 DESIGN REFERENCES:
242
243 ALGORITHM:
244
245 NOTES: uses dbms_sql to generate WHERE clause based on the
246 components that have values
247
248 OPEN ISSUES:
249
250 CLOSED ISSUES:
251
252 CHANGE HISTORY: 10/25/96 Raj Bhakta Created.
253 ===========================================================================*/
254
255 PROCEDURE validate_payment_terms_info(
256 p_pay_record IN OUT NOCOPY RCV_SHIPMENT_HEADER_SV.PayRecType);
257
258
259 /*===========================================================================
260 PROCEDURE NAME: validate_freight_carrier_info()
261
262 DESCRIPTION: This procedure validates the freight carrier record and
263 returns error status and error messages based on
264 business rules.
265
266 PARAMETERS: p_carrier_rec IN OUT RCV_SHIPMENT_HEADER_SV.FreightRecType
267
268 DESIGN REFERENCES:
269
270 ALGORITHM:
271
272 NOTES:
273
274 OPEN ISSUES:
275
276 CLOSED ISSUES:
277
278 CHANGE HISTORY: Raj Bhakta 10/29/96 Created
279 ===========================================================================*/
280
281 PROCEDURE validate_freight_carrier_info(
282 p_carrier_rec IN OUT NOCOPY rcv_shipment_header_sv.FreightRecType);
283
284 PROCEDURE get_global_terms_conditions -- <2699404>
285 ( p_po_header_id IN PO_HEADERS_ALL.po_header_id%TYPE
286 , x_terms_id OUT NOCOPY PO_HEADERS_ALL.terms_id%TYPE
287 , x_fob_lookup_code OUT NOCOPY PO_HEADERS_ALL.fob_lookup_code%TYPE
288 , x_freight_terms OUT NOCOPY PO_HEADERS_ALL.freight_terms_lookup_code%TYPE
289 , x_supplier_note OUT NOCOPY PO_HEADERS_ALL.note_to_vendor%TYPE
290 , x_receiver_note OUT NOCOPY PO_HEADERS_ALL.note_to_receiver%TYPE
291 , x_shipping_control OUT NOCOPY PO_HEADERS_ALL.shipping_control%TYPE -- <INBOUND LOGISTICS FPJ>
292 );
293
294 PROCEDURE get_local_terms_conditions -- <2699404>
295 ( p_po_header_id IN PO_HEADERS_ALL.po_header_id%TYPE
296 , x_pay_on_code OUT NOCOPY PO_HEADERS_ALL.pay_on_code%TYPE
297 , x_bill_to_id OUT NOCOPY PO_HEADERS_ALL.bill_to_location_id%TYPE
298 , x_ship_to_id OUT NOCOPY PO_HEADERS_ALL.ship_to_location_id%TYPE
299 , x_ship_via_code OUT NOCOPY PO_HEADERS_ALL.ship_via_lookup_code%TYPE
300 );
301
302 -- <GC FPJ START>
303
304 --bug3225062
305 PROCEDURE compare_terms_conditions
306 ( p_comparison_scope IN VARCHAR2,
307 p_terms_rec1 IN terms_and_cond_rec_type,
308 p_terms_rec2 IN terms_and_cond_rec_type,
309 x_same_terms OUT NOCOPY VARCHAR2,
310 x_comparison_result OUT NOCOPY terms_cond_comp_rec_type
311 );
312
313 --bug3225062
314 PROCEDURE set_terms_comparison_msg
315 ( p_ref_doc_type IN VARCHAR2,
316 p_comparison_scope IN VARCHAR2,
317 p_terms_rec1 IN terms_and_cond_rec_type,
318 p_terms_rec2 IN terms_and_cond_rec_type,
319 p_comparison_result IN terms_cond_comp_rec_type
320 );
321
322 -- <GC FPJ END>
323
324 END PO_TERMS_SV;