1 PACKAGE BODY JAI_APTAX_PKG_CLIENT_EXTN
2 /* $Header: jai_aptax_pkg_client_extn.plb 120.1.12020000.1 2012/07/18 15:46:13 nkodakan noship $ */
3 AS
4
5
6 procedure JAI_CALC_APMATCH_TAX (
7 P_MATCH_TYPE IN VARCHAR2 ,
8 P_INVOICE_ID IN NUMBER,
9 P_INVOICE_line_no IN NUMBER,
10 P_TAX_ID IN NUMBER,
11 P_line_location_id IN number default null,
12 p_rcv_transaction_id in number default null,
13 P_tax_amount IN OUT NOCOPY NUMBER
14 )
15 IS
16 BEGIN
17 --step 1 : CHECK FOR THE adhoc tax flag for p_tax_id provided (table :jai_cmn_taxes_all)
18 --step 2: if the adhoc_flag ='Y' return p_tax_amount ;
19 --step 3: if the adhoc_flag ='N'
20 --step 3.1: if P_MATCH_TYPE ='PO_MATCHING' then
21 --step 3.1.1: get the precedences from jai_po_taxes with tax_id condition and line_location_id condition
22 --step 3.1 : if P_match_type='RCV_MATCHING' then
23 --step 3.1.2 :get the precedences from jai_rcv_line_taxes with tax_id condition and rcv_transaction_id (tables to be used jai_rcv_line_taxes jrl
24 --, rcv_shipment_lines rsl, rcv_transactions rt, jai_cmn_taxes_all jcta)
25 --step 3.2 : get the amount/tax amount based on the precedences
26 --precedence_0 is the line aamount
27 --precedence_1 is the tax_amount in the jai_ap_match_inv_taxes ,query can be like :
28 --select tax_amount from jai_ap_match_inv_taxes where invoice_id= and line_number=value_in_precedence_1 and tax_id=
29 --step 3.2 :get the total tax target amount by summing the amounts fetched in step 3.2
30 --step 3.3 : get the tax amount by applying the tax rate to the tax target amount retrieved in step 3.2
31 -- step 3.4 : procedure shall return the tax_amount
32 NULL;
33 END JAI_CALC_APMATCH_TAX;
34
35 END JAI_APTAX_PKG_CLIENT_EXTN;