DBA Data[Home] [Help]

PACKAGE: APPS.AP_IMPORT_VALIDATION_PKG

Source


1 PACKAGE AP_IMPORT_VALIDATION_PKG AS
2 /* $Header: apiimvts.pls 120.29.12010000.5 2009/02/16 10:18:49 amitmukh ship $ */
3 
4 TYPE r_dset_line_info IS RECORD
5   (
6    dist_code_combination_id
7                    AP_DISTRIBUTION_SET_LINES.dist_code_combination_id%TYPE
8   ,percent_distribution AP_DISTRIBUTION_SET_LINES.percent_distribution%TYPE
9   ,type_1099            AP_DISTRIBUTION_SET_LINES.type_1099%TYPE
10   ,description          AP_DISTRIBUTION_SET_LINES.description%TYPE
11   ,distribution_set_line_number
12                    AP_DISTRIBUTION_SET_LINES.distribution_set_line_number%TYPE
13   ,attribute_category   AP_DISTRIBUTION_SET_LINES.attribute_category%TYPE
14   ,attribute1           AP_DISTRIBUTION_SET_LINES.attribute1%TYPE
15   ,attribute2           AP_DISTRIBUTION_SET_LINES.attribute2%TYPE
16   ,attribute3           AP_DISTRIBUTION_SET_LINES.attribute3%TYPE
17   ,attribute4           AP_DISTRIBUTION_SET_LINES.attribute4%TYPE
18   ,attribute5           AP_DISTRIBUTION_SET_LINES.attribute5%TYPE
19   ,attribute6           AP_DISTRIBUTION_SET_LINES.attribute6%TYPE
20   ,attribute7           AP_DISTRIBUTION_SET_LINES.attribute7%TYPE
21   ,attribute8           AP_DISTRIBUTION_SET_LINES.attribute8%TYPE
22   ,attribute9           AP_DISTRIBUTION_SET_LINES.attribute9%TYPE
23   ,attribute10          AP_DISTRIBUTION_SET_LINES.attribute10%TYPE
24   ,attribute11          AP_DISTRIBUTION_SET_LINES.attribute11%TYPE
25   ,attribute12          AP_DISTRIBUTION_SET_LINES.attribute12%TYPE
26   ,attribute13          AP_DISTRIBUTION_SET_LINES.attribute13%TYPE
27   ,attribute14          AP_DISTRIBUTION_SET_LINES.attribute14%TYPE
28   ,attribute15          AP_DISTRIBUTION_SET_LINES.attribute15%TYPE
29   ,project_source       VARCHAR2(30)
30   ,project_accounting_context
31                     AP_DISTRIBUTION_SET_LINES.project_accounting_context%TYPE
32   ,project_id           AP_DISTRIBUTION_SET_LINES.project_id%TYPE
33   ,task_id              AP_DISTRIBUTION_SET_LINES.task_id%TYPE
34   ,expenditure_organization_id
35                     AP_DISTRIBUTION_SET_LINES.expenditure_organization_id%TYPE
36   ,expenditure_type     AP_DISTRIBUTION_SET_LINES.expenditure_type%TYPE
37   ,pa_quantity          AP_INVOICE_DISTRIBUTIONS.pa_quantity%TYPE
38   ,pa_addition_flag     AP_INVOICE_DISTRIBUTIONS.pa_addition_flag%TYPE
39   ,org_id               AP_DISTRIBUTION_SET_LINES.org_id%TYPE
40   ,award_id             AP_DISTRIBUTION_SET_LINES.award_id%TYPE
41   ,amount               AP_INVOICE_DISTRIBUTIONS.amount%TYPE
42   ,base_amount          AP_INVOICE_DISTRIBUTIONS.base_amount%TYPE);
43 
44   TYPE dset_line_tab_type IS TABLE OF r_dset_line_info
45               INDEX BY BINARY_INTEGER;
46 
47   /*========================================================================*/
48   /*                                                                        */
49   /* Function V_CHECK_INVOICE_VALIDATION performs the following             */
50   /* invoice level validations:                                             */
51   /* 1. Invalid PO                                                          */
52   /* 2. Invalid Supplier (only if no PO)                                    */
53   /* 3. Invalid Supplier Site (only if no PO)                               */
54   /* 4. Invalid Invoice Num                                                 */
55   /* 5. Invalid Invoice Type and Amount                                     */
56   /* 6. Invalid AWT Group                                                   */
57   /* 7. Invalid pay AWT Group                                               */
58   /* 7. Invalid Exchange Rate Type                                          */
59   /* 8. Invalid Invoice Currency Code                                       */
60   /* 9. Invalid Terms Info                                                  */
61   /* 10. Check Misc Info (Liablilty, Pay Method, Pay Group.                 */
62   /* 11. Invalid Payment Currency info                                      */
63   /* 12. Invalid GDFF info                                                  */
64   /* IN OUT invoice record is updated with data as the data is validated.   */
65   /* Fatal error flag is set if there is no valid supplier or supplier site.*/
66   /*                                                                        */
67   /*========================================================================*/
68   FUNCTION v_check_invoice_validation(
69     p_invoice_rec      IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
70     p_match_mode                     OUT NOCOPY VARCHAR2,
71     p_min_acct_unit_inv_curr         OUT NOCOPY NUMBER,
72     p_precision_inv_curr             OUT NOCOPY NUMBER,
73     p_positive_price_tolerance       OUT NOCOPY      NUMBER,
74     p_negative_price_tolerance       OUT NOCOPY      NUMBER,
75     p_qty_tolerance                  OUT NOCOPY      NUMBER,
76     p_qty_rec_tolerance              OUT NOCOPY      NUMBER,
77     p_max_qty_ord_tolerance          OUT NOCOPY      NUMBER,
78     p_max_qty_rec_tolerance          OUT NOCOPY      NUMBER,
79     p_amt_tolerance		     OUT NOCOPY	     NUMBER,
80     p_amt_rec_tolerance		     OUT NOCOPY	     NUMBER,
81     p_max_amt_ord_tolerance          OUT NOCOPY      NUMBER,
82     p_max_amt_rec_tolerance          OUT NOCOPY      NUMBER,
83     p_goods_ship_amt_tolerance       OUT NOCOPY      NUMBER,
84     p_goods_rate_amt_tolerance       OUT NOCOPY      NUMBER,
85     p_goods_total_amt_tolerance      OUT NOCOPY      NUMBER,
86     p_services_ship_amt_tolerance    OUT NOCOPY      NUMBER,
87     p_services_rate_amt_tolerance    OUT NOCOPY      NUMBER,
88     p_services_total_amt_tolerance   OUT NOCOPY      NUMBER,
89     p_base_currency_code             IN         VARCHAR2,
90     p_multi_currency_flag            IN         VARCHAR2,
91     p_set_of_books_id                IN         NUMBER,
92     p_default_exchange_rate_type     IN         VARCHAR2,
93     p_make_rate_mandatory_flag       IN         VARCHAR2,
94     p_default_last_updated_by        IN         NUMBER,
95     p_default_last_update_login      IN         NUMBER,
96     p_fatal_error_flag               OUT NOCOPY VARCHAR2,
97     p_current_invoice_status         IN OUT NOCOPY VARCHAR2,
98     p_calc_user_xrate                IN         VARCHAR2,
99     p_prepay_period_name          IN OUT NOCOPY VARCHAR2,
100     p_prepay_invoice_id		     OUT NOCOPY NUMBER,	 --Contract Payments
101     p_prepay_case_name		     OUT NOCOPY VARCHAR2, --Contract Payments
102     p_request_id                  IN            NUMBER,
103     p_allow_interest_invoices	     IN		VARCHAR2,  --bug4113223
104     p_calling_sequence               IN         VARCHAR2)   RETURN BOOLEAN;
105 
106   /*========================================================================*/
107   /*                                                                        */
108   /* Function V_CHECK_INVALID_PO performs the following validations related */
109   /* to PO information and rejects if appropriate:                          */
110   /* 1. PO is closed                                                        */
111   /* 2. PO number is invalid                                                */
112   /* 3. PO vendor information is inconsistent                               */
113   /*                                                                        */
114   /*========================================================================*/
115   FUNCTION v_check_invalid_po (
116     p_invoice_rec                IN   AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
117     p_default_last_updated_by    IN            NUMBER,
118     p_default_last_update_login  IN            NUMBER,
119     p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
120     p_po_vendor_id                  OUT NOCOPY NUMBER,
121     p_po_vendor_site_id             OUT NOCOPY NUMBER,
122     p_po_exists_flag                OUT NOCOPY VARCHAR2,
123     p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
124 
125   /*=========================================================================*/
126   /*                                                                         */
127   /* Function V_CHECK_INVALID_SUPPLIER performs the following validations    */
128   /* to supplier information and rejects if appropriate:                     */
129   /* 1. No Supplier provided                                                 */
130   /* 2. Inconsistent Supplier information provided between ID, Supplier Num  */
131   /*    and/or Supplier Name                                                 */
132   /* 3. Invalid Supplier provided                                            */
133   /*                                                                         */
134   /*=========================================================================*/
135   FUNCTION v_check_invalid_supplier (
136     p_invoice_rec                 IN   AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
137     p_default_last_updated_by     IN            NUMBER,
138     p_default_last_update_login   IN            NUMBER,
139     p_return_vendor_id               OUT NOCOPY NUMBER,
140     p_current_invoice_status      IN OUT NOCOPY VARCHAR2,
141     p_calling_sequence            IN            VARCHAR2) RETURN BOOLEAN;
142 
143 
144   /*=========================================================================*/
145   /*                                                                         */
146   /* Function V_CHECK_INVALID_SUPPLIER_SITE performs the following           */
147   /* validations to supplier site information and rejects if appropriate:    */
148   /* 1. No Supplier Site provided                                            */
149   /* 2. Inconsistent Supplier Site information provided between ID, and Site */
150   /*    Code and/or Supplier                                                 */
151   /* 3. Supplier Site is not a pay site                                      */
152   /* 4. Supplier Site is invalid                                             */
153   /*                                                                         */
154   /*=========================================================================*/
155   FUNCTION v_check_invalid_supplier_site (
156     p_invoice_rec                IN
157     AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
158     p_vendor_site_id_per_po      IN               NUMBER,
159     p_default_last_updated_by    IN               NUMBER,
160     p_default_last_update_login  IN               NUMBER,
161     p_return_vendor_site_id         OUT NOCOPY    NUMBER,
162     p_terms_date_basis              OUT NOCOPY    VARCHAR2,
163     p_current_invoice_status     IN OUT NOCOPY    VARCHAR2,
164     p_calling_sequence           IN               VARCHAR2) RETURN BOOLEAN;
165 
166 
167   /*=========================================================================*/
168   /* Added for Payment Requests project                                      */
169   /* Function V_CHECK_INVALID_PARTY performs the following validations       */
170   /* to party information for payment request invoices and rejects if        */
171   /* appropriate:                                                            */
172   /* 1. No party provided                                                    */
173   /* 2. Invalid Party provided                                               */
174   /*                                                                         */
175   /*=========================================================================*/
176 FUNCTION v_check_invalid_party(
177          p_invoice_rec   IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
178          p_default_last_updated_by     IN            NUMBER,
179          p_default_last_update_login   IN            NUMBER,
180          p_current_invoice_status      IN OUT NOCOPY VARCHAR2,
181          p_calling_sequence            IN            VARCHAR2) RETURN BOOLEAN;
182 
183 
184   /*=========================================================================*/
185   /* Added for Payment Requests project                                      */
186   /* Function V_CHECK_INVALID_PARTY_SITE performs the following              */
187   /* validations to party site information for payment request type of       */
188   /* invoices and rejects if appropriate:                                    */
189   /* 1. No Party Site provided                                            */
190   /* 4. Party Site is invalid                                             */
191   /*                                                                         */
192   /*=========================================================================*/
193 FUNCTION v_check_invalid_party_site (
194          p_invoice_rec  IN  AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
195          p_default_last_updated_by    IN            NUMBER,
196          p_default_last_update_login  IN            NUMBER,
197          p_return_party_site_id       OUT NOCOPY    NUMBER,
198          p_terms_date_basis           OUT NOCOPY    VARCHAR2,
199          p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
200          p_calling_sequence           IN VARCHAR2) RETURN BOOLEAN;
201 
202 
203   /*=========================================================================*/
204   /*                                                                         */
205   /* Function V_CHECK_INVALID_INVOICE_NUM performs the following             */
206   /* validations to the invoice number and rejects if appropriate:           */
207   /* 1. NULL Invoice Number                                                  */
208   /* 2. Duplicate Invoice Number either in permanent transaction system or   */
209   /*    the interface.                                                       */
210   /*                                                                         */
211   /*=========================================================================*/
212     FUNCTION v_check_invalid_invoice_num (
213       p_invoice_rec             IN   AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
214       p_allow_interest_invoices    IN VARCHAR2, --Bug4113223
215       p_invoice_num                   OUT NOCOPY VARCHAR2,
216       p_default_last_updated_by    IN            NUMBER,
217       p_default_last_update_login  IN            NUMBER,
218       p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
219       p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
220 
221 
222   /*=========================================================================*/
223   /*                                                                         */
224   /* Function V_CHECK_INVALID_INV_CURR_CODE performs the following           */
225   /* validations to the invoice and rejects if appropriate:                  */
226   /* 1. Invoice Currency Code is Inactive                                    */
227   /* 2. Invoice Currency Code is Invalid                                     */
228   /* Function gets currency code from Supplier Site if NULL.  It also reads  */
229   /* minimum accountable unit and precision for the currency.                */
230   /*                                                                         */
231   /*=========================================================================*/
232   FUNCTION v_check_invalid_inv_curr_code (
233     p_invoice_rec             IN     AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
234     p_inv_currency_code            OUT NOCOPY VARCHAR2,
235     p_min_acc_unit_inv_curr        OUT NOCOPY NUMBER,
236     p_precision_inv_curr           OUT NOCOPY NUMBER,
237     p_default_last_updated_by   IN            NUMBER,
238     p_default_last_update_login IN            NUMBER,
239     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
240     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
241 
242   /*=========================================================================*/
243   /*                                                                         */
247   /* 2. Invoice amount is null                                               */
244   /* Function V_CHECK_INVOICE_TYPE_AMOUNT performs the following             */
245   /* validations to the invoice and rejects if appropriate:                  */
246   /* 1. Invoice type other than STANDARD OR CREDIT                           */
248   /* 3. Invoice type is STANDARD but amount is <0                            */
249   /* 4. Invoice type is CREDI but amount >=0                                 */
250   /* 5. Invoice amount is <> sum of lines amount and source is EDI GATEWAY   */
251   /* 6. Number of invoice lines is 0                                         */
252   /* 7. Invoice amount exceeds invoice currency precision                    */
253   /* If invoice type is null and amount <0, set type to CREDIT.              */
254   /* If invoice type is null and amount >=0, set type to STANDARD            */
255   /* If invoice type is STANDARD set match mode to MI                        */
256   /* If invoice type is CREDIT set match mode to MC                          */
257   /*                                                                         */
258   /*=========================================================================*/
259   FUNCTION v_check_invoice_type_amount (
260     p_invoice_rec               IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
261     p_invoice_type_lookup_code     OUT NOCOPY VARCHAR2,
262     p_match_mode                   OUT NOCOPY VARCHAR2,
263     p_precision_inv_curr        IN            NUMBER,
264     p_default_last_updated_by   IN            NUMBER,
265     p_default_last_update_login IN            NUMBER,
266     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
267     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
268 
269   /*=========================================================================*/
270   /*                                                                         */
271   /* Function V_CHECK_INVALID_AWT_GROUP performs the following               */
272   /* validations to awt group data and rejects if appropriate:               */
273   /* 1. AWT Group Id and AWT Group Name are inconsistent                     */
274   /* 2. AWT Group is Invalid                                                 */
275   /* 3. AWT Group is Inactive                                                */
276   /* Returns the awt_group_id if any read from either the awt_group_id in    */
277   /* the record or the awt_group_id from the awt_group_name if awt_group_id  */
278   /* in the record was null.                                                 */
279   /*                                                                         */
280   /*=========================================================================*/
281   FUNCTION v_check_invalid_awt_group (
282     p_invoice_rec               IN  AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
283     p_awt_group_id                 OUT NOCOPY NUMBER,
284     p_default_last_updated_by   IN            NUMBER,
285     p_default_last_update_login IN            NUMBER,
286     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
287     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
288   --bug6639866
289   /*=================================================================================*/
290   /*                                                                                 */
291   /* Function V_CHECK_INVALID_PAY_AWT_GROUP performs the following                   */
292   /* validations to awt group data and rejects if appropriate:                       */
293   /* 1. Pay AWT Group Id and Pay AWT Group Name are inconsistent                     */
294   /* 2. Pay AWT Group is Invalid                                                     */
295   /* 3. Pay AWT Group is Inactive                                                    */
296   /* Returns the pay_awt_group_id if any read from either the pay_awt_group_id in    */
297   /* the record or the pay_awt_group_id from the awt_group_name if pay_awt_group_id  */
298   /* in the record was null.                                                         */
299   /*                                                                                 */
300   /*=================================================================================*/
301   FUNCTION v_check_invalid_pay_awt_group (
302     p_invoice_rec               IN  AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
303     p_pay_awt_group_id             OUT NOCOPY NUMBER,
304     p_default_last_updated_by   IN            NUMBER,
305     p_default_last_update_login IN            NUMBER,
306     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
307     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
308 
309 
310   /*=========================================================================*/
311   /*                                                                         */
312   /* Function V_CHECK_EXCHANGE_RATE_TYPE performs the following              */
313   /* validations to exchange rate information and rejects if needed:         */
314   /* 1. Conversion Type does not exist in gl_daily_conversion_types and      */
315   /*    rate is required.                                                    */
316   /* 2. Conversion Type is other than User and an Exchange Rate is provided. */
317   /* Returns the exchange rate and exchange date.                            */
318   /*                                                                         */
319   /*=========================================================================*/
320   FUNCTION v_check_exchange_rate_type (
321     p_invoice_rec                IN    AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
322     p_exchange_rate                 OUT NOCOPY NUMBER,
323     p_exchange_date                 OUT NOCOPY DATE,
324     p_base_currency_code         IN            VARCHAR2,
325     p_multi_currency_flag        IN            VARCHAR2,
329     p_default_last_updated_by    IN            NUMBER,
326     p_set_of_books_id            IN            NUMBER,
327     p_default_exchange_rate_type IN            VARCHAR2,
328     p_make_rate_mandatory_flag   IN            VARCHAR2,
330     p_default_last_update_login  IN            NUMBER,
331     p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
332     p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
333 
334   /*=========================================================================*/
335   /*                                                                         */
336   /* Function V_CHECK_INVALID_TERMS performs the following validations       */
337   /* relative to Payment terms and rejects if necessary:                     */
338   /* 1. Inconsistent Terms Name and Terms ID                                 */
339   /* 2. Invalid Terms                                                        */
340   /* 3. Inactive Terms                                                       */
341   /* 4. Terms Date Basis is Invoice received date but invoice received date  */
342   /*    is null.                                                             */
343   /* 5. Terms Date Basis is Goods received date but goods received date is   */
344   /*    null.                                                                */
345   /* If neither terms name nor terms id are provided in the invoice, then    */
346   /* obtain based on PO Information either at header or line level or        */
347   /* from supplier site.                                                     */
348   /*                                                                         */
349   /*=========================================================================*/
350     FUNCTION v_check_invalid_terms (
351       p_invoice_rec               IN
352                     AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
353       p_terms_id                     OUT NOCOPY NUMBER,
354       p_terms_date                   OUT NOCOPY DATE,
355       p_terms_date_basis          IN            VARCHAR2,
356       p_default_last_updated_by   IN            NUMBER,
357       p_default_last_update_login IN            NUMBER,
358       p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
359       p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
360 
361   /*=========================================================================*/
362   /*                                                                         */
363   /* Function V_CHECK_MISC_INVOICE_INFO performs the following validations   */
364   /* relative to the invoice and rejects if necessary:                       */
365   /* 1. Is Liability Account Valid?                                          */
366   /* 2. Is Payment Method Valid?                                             */
367   /* 3. Is Pay Group Valid?                                                  */
368   /* 4. Is Voucher Num a duplicate Num?                                      */
369   /* 5. Is Requester a valid employee?                                       */
370   /*                                                                         */
371   /*=========================================================================*/
372   FUNCTION v_check_misc_invoice_info (
373     p_invoice_rec            IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
374     -- Bug 6509776
375     p_set_of_books_id           IN            NUMBER,
376     p_default_last_updated_by   IN            NUMBER,
377     p_default_last_update_login IN            NUMBER,
378     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
379     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
380 
381   /*=========================================================================*/
382   /*                                                                         */
383   /* Function V_CHECK_LEGAL_ENTITY_INFO performs the following validations   */
384   /* relative to the invoice and rejects if necessary:                       */
385   /* 1. Is LegalEntity ID Valid?                                             */
386   /* 2. REG Code and Number Derive Valid LE                                  */
387   /*                                                                         */
388   /*=========================================================================*/
389   FUNCTION v_check_legal_entity_info (
390     p_invoice_rec               IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
391     p_set_of_books_id           IN            NUMBER,
392     p_default_last_updated_by   IN            NUMBER,
393     p_default_last_update_login IN            NUMBER,
394     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
395     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
396 
397   /*=========================================================================*/
398   /*                                                                         */
399   /* Function V_CHECK_INVALID_PAY_CURR performs the following validations    */
400   /* relative to the payment currency and rejects if necessary:              */
401   /* 1. Is Payment Currency inactive?                                        */
402   /* 2. Is Payment Currency Valid?                                           */
403   /* 3. Is Invoice to Payment Currency fixed rate?                           */
404   /* Set payment currency to invoice currency if payment currency is null    */
405   /* Set payment cross rate date to invoice date if payment cross rate date  */
406   /* is null.                                                                */
407   /*                                                                         */
408   /*=========================================================================*/
409   FUNCTION v_check_invalid_pay_curr (
413          p_payment_cross_rate           OUT NOCOPY NUMBER,
410          p_invoice_rec               IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
411          p_pay_currency_code            OUT NOCOPY VARCHAR2,
412          p_payment_cross_rate_date      OUT NOCOPY DATE,
414          p_payment_cross_rate_type      OUT NOCOPY VARCHAR2,
415          p_default_last_updated_by   IN            NUMBER,
416          p_default_last_update_login IN            NUMBER,
417          p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
418          p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
419   /*=========================================================================*/
420   /*                                                                         */
421   /* Function V_CHECK_PREPAY_INFO is intended to verify prepayment           */
422   /* application information but will remain a placeholder during Uptake     */
423   /* Stage I of Lines.                                                       */
424   /*                                                                         */
425   /*=========================================================================*/
426 
427   FUNCTION v_check_prepay_info(
428     p_invoice_rec               IN OUT NOCOPY
429                                 AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
430     p_base_currency_code        IN            VARCHAR2,
431     p_prepay_period_name        IN OUT NOCOPY VARCHAR2,
432     p_prepay_invoice_id		OUT    NOCOPY NUMBER,	--Contract Payments
433     p_prepay_case_name		OUT    NOCOPY VARCHAR2, --Contract Payments
434     p_request_id                IN            NUMBER,
435     p_default_last_updated_by   IN            NUMBER,
436     p_default_last_update_login IN            NUMBER,
437     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
438     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
439 
440   /*=========================================================================*/
441   /*                                                                         */
442   /* Function V_CHECK_NO_XRATE_BASE_AMOUNT performs the following validations*/
443   /* relative to the rate information vs. base amount information provided   */
444   /* in the invoice.  It rejects if needed:                                  */
445   /* 1. Is Calculation of rate based on base amount allowed?  If not, is the */
446   /*    base amount provided?                                                */
447   /* 2. Is Calculation of rate based on base amount allowed and the base     */
448   /*    amount and rate (including rate type)information if any consistent?  */
449   /* 3. Derives base amount if possible.
450   /*                                                                         */
451   /*=========================================================================*/
452   FUNCTION v_check_no_xrate_base_amount (
453     p_invoice_rec               IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
454     p_base_currency_code        IN            VARCHAR2,
455     p_multi_currency_flag       IN            VARCHAR2,
456     p_calc_user_xrate           IN            VARCHAR2,
457     p_default_last_updated_by   IN            NUMBER,
458     p_default_last_update_login IN            NUMBER,
459     p_invoice_base_amount          OUT NOCOPY NUMBER,
460     p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
461     p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
462 
463 /*=========================================================================*/
464 /*                                                                         */
465 /* Function V_CHECK_LINES_VALIDATION reads interface lines into a plsql    */
466 /* table and performs the following validations relative to each line:     */
467 /* 1. Is org_id populated on the line?  If so, is it consistent with the   */
468 /*    invoice org_id?                                                      */
469 /* 2. Read employee id from vendor.                                        */
470 /* 3. Validate line amount not to exceed invoice currency precision.       */
471 /* 4. For ITEM type lines, validate PO information.                        */
472 /*                                                                         */
473 /*=========================================================================*/
474   FUNCTION v_check_lines_validation (
475     p_invoice_rec       IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
476     p_invoice_lines_tab IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.t_lines_table,  --Retropricing
477     p_gl_date_from_get_info        IN            DATE,
478     p_gl_date_from_receipt_flag    IN            VARCHAR2,
479     p_positive_price_tolerance     IN            NUMBER,
480     p_pa_installed                 IN            VARCHAR2,
481     p_qty_ord_tolerance            IN            NUMBER,
482     p_amt_ord_tolerance		   IN		 NUMBER,
483     p_max_qty_ord_tolerance        IN            NUMBER,
484     p_max_amt_ord_tolerance        IN            NUMBER,
485     p_min_acct_unit_inv_curr       IN            NUMBER,
486     p_precision_inv_curr           IN            NUMBER,
487     p_base_currency_code           IN            VARCHAR2,
488     p_base_min_acct_unit           IN            NUMBER,
489     p_base_precision               IN            NUMBER,
490     p_set_of_books_id              IN            NUMBER,
491     p_asset_book_type              IN            VARCHAR2,  -- Bug 5448579
492     p_chart_of_accounts_id         IN            NUMBER,
493     p_freight_code_combination_id  IN            NUMBER,
494     p_purch_encumbrance_flag       IN            VARCHAR2,
495     p_retainage_ccid		   IN		 NUMBER,
496     p_default_last_updated_by      IN            NUMBER,
497     p_default_last_update_login    IN            NUMBER,
501 
498     p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
499     p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
500 
502 
503   /*=======================================================================*/
504   /*                                                                       */
505   /* Function V_CHECK_INVOICE_LINES_AMOUNT performs the following          */
506   /* validation for the line amount.  It rejects if necessary.             */
507   /* 1. Does the line amount exceed the invoice currency precision?        */
508   /*                                                                       */
509   /*=======================================================================*/
510   FUNCTION v_check_invoice_line_amount (
511     p_invoice_lines_rec      IN AP_IMPORT_INVOICES_PKG.r_line_info_rec,
512     p_precision_inv_curr           IN            NUMBER,
513     p_default_last_updated_by      IN            NUMBER,
514     p_default_last_update_login    IN            NUMBER,
515     p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
516     p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
517 
518 
519   /*=======================================================================*/
520   /*                                                                       */
521   /* Function V_CHECK_LINE_PO_INFO performs validation on all PO data for  */
522   /* validity and consistency.  It rejects if necessary.                   */
523   /*                                                                       */
524   /*=======================================================================*/
525   FUNCTION v_check_line_po_info (
526     p_invoice_rec       IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
527     p_invoice_lines_rec IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
528     p_set_of_books_id              IN            NUMBER,
529     p_positive_price_tolerance     IN            NUMBER,
530     p_qty_ord_tolerance            IN            NUMBER,
531     p_amt_ord_tolerance		   IN		 NUMBER,
532     p_max_qty_ord_tolerance        IN            NUMBER,
533     p_max_amt_ord_tolerance	   IN		 NUMBER,
534     p_default_last_updated_by      IN            NUMBER,
535     p_default_last_update_login    IN            NUMBER,
536     p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
537     p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
538 
539 
540   /*=======================================================================*/
541   /*                                                                       */
542   /* Function V_CHECK_LINE_PO_INFO2 performs validation on PO data as      */
543   /* follows.  Rejects if necessary.                                       */
544   /* 1.Unit Price Variance for both Shipment/Line level matching           */
545   /*   (uses tolerances)                                                   */
546   /* 2.Quantity Variance for both Shipment/Line level matching             */
547   /*   (uses tolerances)                                                   */
548   /* 3.Unit of Measure consistency                                         */
549   /* 4.Line Price Break for allowing Line level match                      */
550   /* 5.Invalid Shipment Type for unapproved PO's                           */
551   /* 6.Shipment is not Finally Closed                                      */
552   /*                                                                       */
553   /*=======================================================================*/
554 
555   FUNCTION v_check_line_po_info2 (
556     p_invoice_rec         IN  AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
557     p_invoice_lines_rec   IN  AP_IMPORT_INVOICES_PKG.r_line_info_rec,
558     p_positive_price_tolerance     IN             NUMBER,
559     p_qty_ord_tolerance            IN             NUMBER,
560     p_amt_ord_tolerance		   IN		  NUMBER,
561     p_max_qty_ord_tolerance        IN             NUMBER,
562     p_max_amt_ord_tolerance	   IN		  NUMBER,
563     p_po_header_id                 IN             NUMBER,
564     p_po_line_id                   IN             NUMBER,
565     p_po_line_location_id          IN             NUMBER,
566     p_po_distribution_id           IN             NUMBER,
567     p_match_option                    OUT NOCOPY  VARCHAR2,
568     p_calc_quantity_invoiced          OUT NOCOPY  NUMBER,
569     p_calc_unit_price                 OUT NOCOPY  NUMBER,
570     p_calc_line_amount                OUT NOCOPY  NUMBER, /* Amount Based Matching */
571     p_default_last_updated_by      IN             NUMBER,
572     p_default_last_update_login    IN             NUMBER,
573     p_current_invoice_status       IN OUT NOCOPY  VARCHAR2,
574     p_match_basis                  IN             VARCHAR2, /* Amount Based Matching */
575     p_calling_sequence             IN             VARCHAR2) RETURN BOOLEAN;
576 
577 /*=========================================================================*/
578 /*                                                                         */
579 /* Function V_CHECK_PO_OVERLAY performs validation relative to overlay     */
580 /* information for PO matched lines.                                       */
581 /*                                                                         */
582 /*=========================================================================*/
583 --Contract Payments: Added the p_invoice_rec to the signature.
584 FUNCTION v_check_po_overlay (
585    p_invoice_rec		IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
586    p_invoice_lines_rec          IN AP_IMPORT_INVOICES_PKG.r_line_info_rec,
587    p_po_line_id                 IN            NUMBER,
588    p_po_line_location_id        IN            NUMBER,
589    p_po_distribution_id         IN            NUMBER,
593    p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
590    p_set_of_books_id            IN            NUMBER,
591    p_default_last_updated_by    IN            NUMBER,
592    p_default_last_update_login  IN            NUMBER,
594    p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
595 
596 /*=========================================================================*/
597 /*                                                                         */
598 /* Function V_CHECK_RECEIPT_INFO performs validation relative to receipt   */
599 /* information for RCV matched lines.                                      */
600 /*                                                                         */
601 /*=========================================================================*/
602 FUNCTION v_check_receipt_info (
603    p_invoice_rec	IN	      AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
604    p_invoice_lines_rec  IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
605    p_default_last_updated_by    IN            NUMBER,
606    p_default_last_update_login  IN            NUMBER,
607    p_temp_line_status              OUT NOCOPY VARCHAR2,
608    p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
609 
610 
611 /*=========================================================================*/
612 /*                                                                         */
613 /* Function V_CHECK_LINE_ACCOUNTING_DATE performs validation relative to   */
614 /* accounting date information.                                            */
615 /* Populates line record with accounting date and period name if possible  */
616 /* and validated.                                                          */
617 /*                                                                         */
618 /*=========================================================================*/
619 FUNCTION v_check_line_accounting_date (
620    p_invoice_rec        IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
621    p_invoice_lines_rec  IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
622    p_gl_date_from_get_info        IN            DATE,
623    p_gl_date_from_receipt_flag    IN            VARCHAR2,
624    p_set_of_books_id              IN            NUMBER,
625    p_purch_encumbrance_flag       IN            VARCHAR2,
626    p_default_last_updated_by      IN            NUMBER,
627    p_default_last_update_login    IN            NUMBER,
628    p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
629    p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
630 
631 /*=========================================================================*/
632 /*                                                                         */
633 /* Function V_CHECK_LINE_PROJECT_INFO performs validation relative to line */
634 /* level project information.                                              */
635 /*                                                                         */
636 /*=========================================================================*/
637 FUNCTION v_check_line_project_info (
638    p_invoice_rec          IN     AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
639    p_invoice_lines_rec    IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
640    p_accounting_date           IN            DATE,
641    p_pa_installed              IN            VARCHAR2,
642    p_employee_id               IN            NUMBER,
643    p_base_currency_code        IN            VARCHAR2,
644    p_set_of_books_id           IN            NUMBER,
645    p_chart_of_accounts_id      IN            NUMBER,
646    p_default_last_updated_by   IN            NUMBER,
647    p_default_last_update_login IN            NUMBER,
648    p_pa_built_account          OUT NOCOPY NUMBER,
649    p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
650    p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
651 
652 
653 /*=========================================================================*/
654 /*                                                                         */
655 /* Function V_CHECK_LINE_ACCOUNT_INFO performs validation relative to line */
656 /* accounting information.                                                 */
657 /* If possible it builds account by overlaying and stores in line record.  */
658 /*                                                                         */
659 /*=========================================================================*/
660 FUNCTION v_check_line_account_info (
661    p_invoice_lines_rec    IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
662    p_freight_code_combination_id  IN            NUMBER,
663    p_pa_built_account             IN            NUMBER,
664    p_accounting_date              IN            DATE,
665    p_set_of_books_id              IN            NUMBER,
666    p_chart_of_accounts_id         IN            NUMBER,
667    p_default_last_updated_by      IN            NUMBER,
668    p_default_last_update_login    IN            NUMBER,
669    p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
670    p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
671 
672 
673 
674 /*=========================================================================*/
675 /*                                                                         */
676 /* Function V_CHECK_DEFERRED_ACCOUNTING performs validation relative to    */
677 /* line level deferred accounting information.                             */
678 /* It validates that:                                                      */
679 /* 1) DEFERRED ACCTG FLAG has one of 2 possible values: Yes (Y) or No (N). */
680 /*    If other value provided, reject with 'INVALID DEFERRED FLAG'         */
681 /*    rejection reason.                                                    */
685 /*    to Y. Must fall in the same Open Period as the GL DATE, which        */
682 /* 2) If DEFERRED ACCT FLAG is set to N but other deferred related data    */
683 /*    is provided, reject with 'INVALID DEFERRED FLAG'.                    */
684 /* 2) DEF ACCTG START DATE is populated if DEFERRED ACCTG FLAG is set      */
686 /*    should be common to all distributions for the line. If validation    */
687 /*    fails, reject with 'INVALID DEF START DATE'                          */
688 /* 3) DEF ACCTG END DATE must be larger than DEF ACCTG START DATE.   If    */
689 /*    validation fails, reject with 'INVALID DEF END DATE'.                */
690 /* 4) DEF ACCTG NUMBER OF PERIODS must be populated if DEF ACCTG PERIOD    */
691 /*    TYPE is populated.  Value must be a positive integer.  If validation */
692 /*    fails, reject with 'INVALID DEF NUM OF PER'                          */
693 /* 5) DEF ACCTG PERIOD TYPE must be provided if DEF ACCTG NUMBER OF        */
694 /*    PERIODS is populated.  It is validated against the set of lookup     */
695 /*    codes with lookup type =  'XLA_DEFERRED_PERIOD_TYPE'. Mutually       */
696 /*    Exclusive Field: DEF ACCTG END DATE.  If validation fails, reject    */
697 /*    with 'INVALID DEF PER TYPE'                                          */
698 /* 6) A check for complete deferred accounting information will be         */
699 /*    performed to ensure that proper deferred accounting can be generated.*/
700 /*    The check will validate that the DEF ACCTG START DATE and either the */
701 /*    DEF ACCTG END DATE or the DEF ACCTG NUMBER OF PERIODS were provided. */
702 /*    If this validation fails,reject with 'INCOMPLETE DEF ACCTG INFO'.    */
703 /*                                                                         */
704 /*=========================================================================*/
705 FUNCTION v_check_deferred_accounting (
706          p_invoice_lines_rec
707            IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
708          p_set_of_books_id              IN            NUMBER,
709          p_default_last_updated_by      IN            NUMBER,
710          p_default_last_update_login    IN            NUMBER,
711          p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
712          p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
713 
714 
715 
716 /*========================================================================*/
717 /*                                                                        */
718 /* Function V_CHECK_LINE_DIST_SET performs validation relative to dist    */
719 /* set information.                                                       */
720 /*                                                                        */
721 /*========================================================================*/
722  FUNCTION v_check_line_dist_set (
723          p_invoice_rec                  IN
724          AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
725          p_invoice_lines_rec            IN OUT NOCOPY
726      AP_IMPORT_INVOICES_PKG.r_line_info_rec,
727          p_base_currency_code           IN            VARCHAR2,
728          p_employee_id                  IN            NUMBER,
729          p_gl_date_from_get_info        IN            DATE,
730          p_set_of_books_id              IN            NUMBER,
731          p_chart_of_accounts_id         IN            NUMBER,
732          p_pa_installed                 IN            VARCHAR2,
733          p_default_last_updated_by      IN            NUMBER,
734          p_default_last_update_login    IN            NUMBER,
735          p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
736          p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
737 
738  /*=========================================================================*/
739  /*                                                                         */
740  /* Function V_CHECK_QTY_UOM_NON_PO performs validation relative to qty and */
741  /* UOM information whenever a line is not PO matched.                      */
742  /* The following checks are performed:                                     */
743  /* 1) If QUANTITY INVOICED AND/OR UNIT PRICE is provided but the UNIT OF   */
744  /*    MEAS LOOKUP CODE is not provided reject with 'INCOMPLETE QTY INFO'   */
745  /* 2) If UNIT OF MEAS LOOKUP CODE is provided, validate against active set */
746  /*    of units of measure as per validation stated in the Invoice Solution */
747  /*    Component.  If validation fails, reject with 'INVALID UOM'.          */
748  /* 3) If QUANTITY INVOICED OR UNIT OF MEAS LOOKUP CODE is provided for non */
749  /*    Item lines, reject with 'INVALID QTY INFO'.                          */
750  /* 4) If QUANTITY INVOICED is 0 reject with 'INVALID QTY INFO'             */
751  /* 5) If QUANTITY INVOICED * UNIT_PRICE is OTHER THAN AMOUNT then reject   */
752  /*    with 'INCONSISTENT QTY RELATED INFO'                                 */
753  /* If UNIT PRICE was not provided, default based on AMOUNT and QUANTITY    */
754  /* INVOICED if possible.  If QUANTITY INVOICED was not provided, default   */
755  /* based on AMOUNT and UNIT PRICE if possible.                             */
756  /*                                                                         */
757  /*=========================================================================*/
758 FUNCTION v_check_qty_uom_non_po (
759      p_invoice_rec
760        IN            AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
761          p_invoice_lines_rec
762            IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
763          p_default_last_updated_by      IN            NUMBER,
764          p_default_last_update_login    IN            NUMBER,
765          p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
766          p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
767 
771 /* awt group information at the line level.                                */
768 /*=========================================================================*/
769 /*                                                                         */
770 /* Function V_CHECK_INVALID_LINE_AWT_GROUP performs validation relative to */
772 /* If awt group data not available at the line level, default from header  */
773 /* Line record should be populated with awt information at the end of this */
774 /* function  unless an error or rejection occurs.                          */
775 /*                                                                         */
776 /*=========================================================================*/
777 FUNCTION v_check_invalid_line_awt_group (
778    p_invoice_rec        IN          AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
779    p_invoice_lines_rec  IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
780    p_default_last_updated_by    IN            NUMBER,
781    p_default_last_update_login  IN            NUMBER,
782    p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
783    p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
784 --bug6639866
785 /*=============================================================================*/
786 /*                                                                             */
787 /* Function V_CHECK_INVALID_LINE_PAY_AWT_G performs validation relative to     */
788 /* pay awt group information at the line level.                                */
789 /* If pay awt group data not available at the line level, default from header  */
790 /* Line record should be populated with pay awt information at the end of this */
791 /* function  unless an error or rejection occurs.                              */
792 /*                                                                             */
793 /*=============================================================================*/
794 FUNCTION v_check_invalid_line_pay_awt_g (
795    p_invoice_rec        IN          AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
796    p_invoice_lines_rec  IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
797    p_default_last_updated_by    IN            NUMBER,
798    p_default_last_update_login  IN            NUMBER,
799    p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
800    p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
801 
802 
803 /*=========================================================================*/
804 /*                                                                         */
805 /* Function V_CHECK_DUPLICATE_LINE_NUM verifies that there is no duplicate */
806 /* line number for the invoice in the interface.                           */
807 /* If null, the line number is populated after this call in the lines      */
808 /* validation function.                                                    */
809 /*                                                                         */
810 /*=========================================================================*/
811 FUNCTION v_check_duplicate_line_num (
812    p_invoice_rec          IN        AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
813    p_invoice_lines_rec    IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
814    p_default_last_updated_by    IN            NUMBER,
815    p_default_last_update_login  IN            NUMBER,
816    p_current_invoice_status     IN OUT NOCOPY VARCHAR2,
817    p_calling_sequence           IN            VARCHAR2) RETURN BOOLEAN;
818 
819 
820 /*=========================================================================*/
821 /*                                                                         */
822 /* Function V_CHECK_MISC_LINE_INFO verifies several pieces of data on the  */
823 /* line including type 1099, etc.                                          */
824 /*                                                                         */
825 /*=========================================================================*/
826 
827 FUNCTION v_check_misc_line_info (
828    p_invoice_rec          		  IN
829 						AP_IMPORT_INVOICES_PKG.r_invoice_info_rec, -- bug 7599916
830    p_invoice_lines_rec  IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
831    p_default_last_updated_by      IN            NUMBER,
832    p_default_last_update_login    IN            NUMBER,
833    p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
834    p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
835 
836 
837 /*=========================================================================*/
838 /*                                                                         */
839 /* Function V_CHECK_PRORATE_INFO verifies proration information for non    */
840 /* item lines.                                                             */
841 /*                                                                         */
842 /*=========================================================================*/
843 FUNCTION v_check_prorate_info (
844    p_invoice_rec                  IN
845     AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
846    p_invoice_lines_rec   IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
847    p_default_last_updated_by      IN            NUMBER,
848    p_default_last_update_login    IN            NUMBER,
849    p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
850    p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN ;
851 
852 /*=========================================================================*/
853 /*                                                                         */
854 /* Function V_CHECK_ASSET_INFO verifies proper population of the following */
855 /* pieces of asset information:                                            */
856 /* 1. Serial Number                                                        */
860 /* If any of the above is populated for a non-item line, the same will be  */
857 /* 2. Manufactuer                                                          */
858 /* 3. Model Number                                                         */
859 /* 4. Warranty Number                                                      */
861 /* rejected with an appropriate rejection.                                 */
862 /* It also validates asset_book_type_code and asset_category.  It populates*/
863 /* asset book type code if possible.                                       */
864 /*                                                                         */
865 /*=========================================================================*/
866 FUNCTION v_check_asset_info (
867      p_invoice_lines_rec IN OUT NOCOPY
868          AP_IMPORT_INVOICES_PKG.r_line_info_rec,
869          p_set_of_books_id              IN            NUMBER,
870          p_asset_book_type              IN            VARCHAR2, -- Bug 5448579
871          p_default_last_updated_by      IN            NUMBER,
872          p_default_last_update_login    IN            NUMBER,
873          p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
874          p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
875 
876 /*=============================================================================
877  |  FUNCTION - V_Check_Tax_Info()
878  |
879  |  DESCRIPTION
880  |      This function will validate the following fields included in the
881  |      ap_invoices_interface table as part of the eTax Uptake project:
882  |        control_amount
883  |        tax_related_invoice_id
884  |        calc_tax_during_import_flag
885  |        will not validate it.
886  |
887  |      The other tax fields will be validated by the eTax API.  See DLD for
888  |      details.
889  |
890  |  PARAMETERS
891  |    p_invoice_rec - record for invoice header
892  |    p_default_last_updated_by - default last updated by
893  |    p_default_last_update_login - default last update login
894  |    p_current_invoice_status - return the status of the invoice after the
895  |                               validation
896  |    P_calling_sequence -  Calling sequence
897  |
898  |  MODIFICATION HISTORY
899  |    DATE          Author         Action
900  |    20-JAN-2004   SYIDNER        Created
901  |
902  *============================================================================*/
903 
904 FUNCTION v_check_tax_info(
905      p_invoice_rec               IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
906      p_default_last_updated_by   IN            NUMBER,
907      p_default_last_update_login IN            NUMBER,
908      p_current_invoice_status    IN OUT NOCOPY VARCHAR2,
909      p_calling_sequence          IN            VARCHAR2) RETURN BOOLEAN;
910 
911 /*=============================================================================
912  |  FUNCTION - V_Check_Tax_Line_Info()
913  |
914  |  DESCRIPTION
915  |      This function will validate the following fields included in the
916  |      ap_invoice_lines_interface table as part of the eTax Uptake project:
917  |        control_amount
918  |        assessable_value
919  |        incl_in_taxable_line_flag
920  |        ship_to_location_id
921  |
922  |      The other tax fields will be validated by the eTax API.  See DLD for
923  |      details.
924  |
925  |  PARAMETERS
926  |    p_invoice_rec - record for invoice header
927  |    p_default_last_updated_by - default last updated by
928  |    p_default_last_update_login - default last update login
929  |    p_current_invoice_status - return the status of the invoice after the
930  |                               validation
931  |    P_calling_sequence -  Calling sequence
932  |
933  |  MODIFICATION HISTORY
934  |    DATE          Author         Action
935  |    20-JAN-2004   SYIDNER        Created
936  |
937  *============================================================================*/
938   FUNCTION v_check_tax_line_info (
939      p_invoice_lines_rec   IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
940      p_default_last_updated_by      IN            NUMBER,
941      p_default_last_update_login    IN            NUMBER,
942      p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
943      p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
944 
945 
946 
947 /*=============================================================================
948  |  FUNCTION - V_Check_Line_Purch_Category_Info()
949  |
950  |  DESCRIPTION
951  |      This function will validate the following fields included in the
952  |      ap_invoice_lines_interface table as part of the Invoice Lines project:
953  |
954  |	Purchasing_Category_Id
955  |	Purchasing_Category
956  |
957  |  PARAMETERS
958  |    p_invoice_rec - record for invoice header
959  |    p_default_last_updated_by - default last updated by
960  |    p_default_last_update_login - default last update login
961  |    p_current_invoice_status - return the status of the invoice after the
962  |                               validation
963  |    P_calling_sequence -  Calling sequence
964  |
965  |  MODIFICATION HISTORY
966  |    DATE          Author         Action
967  |    20-JAN-2005   SMYADAM        Created
968  |
969  *============================================================================*/
970 
971  FUNCTION v_check_line_purch_category(
972         p_invoice_lines_rec   IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
973         p_default_last_updated_by      IN            NUMBER,
977 
974         p_default_last_update_login    IN            NUMBER,
975         p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
976         p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
978 
979 
980 /*=============================================================================
981  |  FUNCTION - V_Check_Line_Cost_Factor
982  |
983  |  DESCRIPTION
984  |      This function will validate the following fields included in the
985  |      ap_invoice_lines_interface table as part of the Invoice Lines project:
986  |
987  |	Cost_Factor_Id
988  |	Cost_Factor_Name
989  |
990  |  PARAMETERS
991  |    p_invoice_rec - record for invoice header
992  |    p_default_last_updated_by - default last updated by
993  |    p_default_last_update_login - default last update login
994  |    p_current_invoice_status - return the status of the invoice after the
995  |                               validation
996  |    P_calling_sequence -  Calling sequence
997  |
998  |  MODIFICATION HISTORY
999  |    DATE          Author         Action
1000  |    07-MAR-2005   SMYADAM        Created
1001  |
1002  *============================================================================*/
1003 
1004  FUNCTION v_check_line_cost_factor(
1005         p_invoice_lines_rec   IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
1006         p_default_last_updated_by      IN            NUMBER,
1007         p_default_last_update_login    IN            NUMBER,
1008         p_current_invoice_status       IN OUT NOCOPY VARCHAR2,
1009         p_calling_sequence             IN            VARCHAR2) RETURN BOOLEAN;
1010 
1011 /*=============================================================================
1012  |  FUNCTION - V_Check_Line_Retainage()
1013  |
1014  |  DESCRIPTION
1015  |      This function will fetch the retainage amount for a po shipment. This
1016  |      will be used for creating retainage distributions during invoice match.
1017  |      It will reject the invoice if there is no retainage account defined and
1018  |      the po shipment has retainage.
1019  |
1020  *============================================================================*/
1021 
1022   FUNCTION v_check_line_retainage(
1023         p_invoice_lines_rec		IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
1024 	p_retainage_ccid		IN            NUMBER,
1025 	p_default_last_updated_by	IN            NUMBER,
1026 	p_default_last_update_login	IN            NUMBER,
1027 	p_current_invoice_status	IN OUT NOCOPY VARCHAR2,
1028 	p_calling_sequence		IN            VARCHAR2) RETURN BOOLEAN;
1029 
1030 
1031   FUNCTION v_check_payment_defaults(
1032     p_invoice_rec               IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
1033     p_current_invoice_status	IN OUT NOCOPY VARCHAR2,
1034     p_calling_sequence          IN            VARCHAR2,
1035     p_default_last_updated_by   IN            NUMBER,
1036     p_default_last_update_login IN            NUMBER
1037     ) return boolean;
1038 
1039 
1040   FUNCTION v_check_party_vendor(
1041     p_invoice_rec               IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
1042     p_current_invoice_status	IN OUT NOCOPY VARCHAR2,
1043     p_calling_sequence          IN            VARCHAR2,
1044     p_default_last_updated_by   IN            NUMBER,
1045     p_default_last_update_login IN            NUMBER
1046     ) return boolean;
1047 
1048 
1049   --bugfix:5565310
1050   FUNCTION v_check_line_get_po_tax_attr(p_invoice_rec IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
1051                                         p_invoice_lines_rec IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_line_info_rec,
1055   FUNCTION v_check_ship_to_location_code(
1052 			                p_calling_sequence IN VARCHAR2) return boolean;
1053 
1054   --bugfix:6989166
1056 		p_invoice_rec	IN AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
1057 		p_invoice_line_rec  IN AP_IMPORT_INVOICES_PKG.r_line_info_rec,
1058                 p_default_last_updated_by      IN            NUMBER,
1059 		p_default_last_update_login    IN            NUMBER,
1060 		p_current_invoice_status	IN OUT NOCOPY VARCHAR2,
1061 	        p_calling_sequence IN VARCHAR2) return boolean;
1062 
1063 --For third party payments project
1064 
1065    /*=========================================================================*/
1066    /*                                                                         */
1067    /* Function V_CHECK_INVALID_REMIT_TO_SUPPLIER performs the following       */
1068    /* validations on remit to supplier columns and rejects if appropriate:    */
1069    /*                                                                         */
1070    /*=========================================================================*/
1071 
1072   FUNCTION v_check_invalid_remit_supplier(
1073 		 p_invoice_rec      IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
1074 		 p_default_last_updated_by     IN            NUMBER,
1075 		 p_default_last_update_login   IN            NUMBER,
1076 		 p_current_invoice_status      IN OUT NOCOPY VARCHAR2,
1077 		 p_calling_sequence            IN            VARCHAR2) RETURN BOOLEAN;
1078 
1079 
1080 END AP_IMPORT_VALIDATION_PKG;
1081