DBA Data[Home] [Help]

PACKAGE: APPS.AP_IMPORT_VALIDATION_PKG

Source


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