DBA Data[Home] [Help]

APPS.JAI_AP_DTC_GENERATION_PKG dependencies on AP_INVOICES_ALL

Line 579: FROM AP_INVOICES_ALL

575: )
576: AND EXISTS
577: (
578: SELECT 1
579: FROM AP_INVOICES_ALL
580: WHERE INVOICE_ID = JATIT.INVOICE_ID
581: and cancelled_date is null
582: AND INVOICE_TYPE_LOOKUP_CODE <> ''PREPAYMENT''
583: )

Line 689: FROM AP_INVOICES_ALL aia

685: WHERE JAITTT.INVOICE_ID = DIST.INVOICE_ID)
686: )
687: AND NOT EXISTS(
688: SELECT 1
689: FROM AP_INVOICES_ALL aia
690: WHERE aia.invoice_id = JATIT.invoice_id
691: AND aia.cancelled_date IS NOT NULL
692: )
693: )

Line 777: FROM AP_INVOICES_ALL

773: )
774: AND EXISTS
775: (
776: SELECT 1
777: FROM AP_INVOICES_ALL
778: WHERE INVOICE_ID = AIDA.INVOICE_ID
779: AND INVOICE_TYPE_LOOKUP_CODE = ''PREPAYMENT'')
780: AND (NOT EXISTS (SELECT 1
781: FROM JAI_AP_TDS_THHOLD_TRXS

Line 819: FROM AP_INVOICES_ALL

815: AND JATIT.THRESHOLD_GRP_ID = $$P_THRESHOLD_GRP_ID$$
816: AND EXISTS
817: (
818: SELECT 1
819: FROM AP_INVOICES_ALL
820: WHERE INVOICE_ID = JATIT.INVOICE_ID
821: AND INVOICE_TYPE_LOOKUP_CODE = ''PREPAYMENT'')
822: AND (NOT EXISTS (SELECT 1
823: FROM JAI_AP_TDS_THHOLD_TRXS

Line 1173: from ap_invoices_all

1169: is
1170: --PRAGMA AUTONOMOUS_TRANSACTION; --commented by Cholei for ZX integration bug#14040855
1171: BEGIN
1172: select org_id into p_org_id
1173: from ap_invoices_all
1174: where invoice_id = p_invoice_id;
1175: EXCEPTION
1176: WHEN NO_DATA_FOUND THEN
1177: p_org_id := NULL;

Line 1353: from ap_invoices_all

1349: from hr_operating_units
1350: where organization_id in(
1351: select
1352: org_id
1353: from ap_invoices_all
1354: where invoice_id = pn_invoice_id
1355: )
1356: );
1357: ln_rounding_factor number;

Line 1383: from ap_invoices_all

1379: default_legal_context_id
1380: from hr_operating_units
1381: where organization_id in(
1382: select org_id
1383: from ap_invoices_all
1384: where invoice_id = pn_invoice_id
1385: )
1386: )
1387: and ROUNDING_BASIS in(

Line 1437: from ap_invoices_all

1433: from hr_operating_units
1434: where organization_id in(
1435: select
1436: org_id
1437: from ap_invoices_all
1438: where invoice_id = pn_invoice_id
1439: )
1440: );
1441:

Line 1468: from ap_invoices_all

1464: default_legal_context_id
1465: from hr_operating_units
1466: where organization_id in(
1467: select org_id
1468: from ap_invoices_all
1469: where invoice_id = pn_invoice_id
1470: )
1471: )
1472: and ROUNDING_BASIS in(

Line 2206: ap_invoices_all hdrs

2202: FOR rec_trxs in (
2203:
2204: select hdrs.*
2205: from
2206: ap_invoices_all hdrs
2207: where org_id = ln_org_id
2208: and exists
2209: (
2210: select 1 from ap_invoice_distributions_all dist

Line 2348: rec_trxs.invoice_num, --get from ap_invoices_all --INVOICE_NUMBER ,

2344: (
2345:
2346:
2347: rec_trxs.invoice_id, --INVOICE_ID ,
2348: rec_trxs.invoice_num, --get from ap_invoices_all --INVOICE_NUMBER ,
2349: nvl(rec_dist_info.parent_invoice_id,rec_trxs.invoice_id),
2350: --1, --get from ap_invoice_lines_all --INVOICE_LINE_ID ,
2351: --rec_dist_info.invoice_line_number, --get from ap_invoice_lines_all -- LINE_NUMBER ,
2352: --rec_tds_taxes.invoice_distribution_id, --INVOICE_DISTRIBUTION_ID ,

Line 2570: FROM ap_invoices_all

2566: WHERE (pan_no IN ('PANAPPLIED','PANNOTAVBL','PANINVALID')
2567: OR (pan_no IS NOT NULL AND confirm_pan_flag IS NULL))
2568: AND vendor_site_id = 0
2569: AND vendor_id = (SELECT vendor_id
2570: FROM ap_invoices_all
2571: WHERE invoice_id = p_invoice_id
2572: )
2573: )
2574: )

Line 2709: from ap_invoices_all

2705:
2706: /*START, Added by xiao for Bug#6596019*/
2707: cursor c_get_prepayment_amt(p_invoice_id number) is
2708: select amount_paid
2709: from ap_invoices_all
2710: where invoice_id = p_invoice_id;
2711:
2712:
2713: CURSOR c_check_valid_tax(p_invoice_id number)

Line 2770: lv_tds_invoice_num ap_invoices_all.invoice_num%type;

2766: ln_threshold_slab_id_after number;
2767: ln_threshold_slab_id_single number;
2768: lv_generate_all_invoices varchar2(1);
2769: ln_threshold_trx_id number;
2770: lv_tds_invoice_num ap_invoices_all.invoice_num%type;
2771: lv_tds_cm_num ap_invoices_all.invoice_num%type;
2772:
2773: lv_pan_no JAI_AP_TDS_VENDOR_HDRS.pan_no%type;
2774: lv_tan_no jai_ap_tds_org_tan_v.org_tan_num %type; --rchandan for bug#4323338

Line 2771: lv_tds_cm_num ap_invoices_all.invoice_num%type;

2767: ln_threshold_slab_id_single number;
2768: lv_generate_all_invoices varchar2(1);
2769: ln_threshold_trx_id number;
2770: lv_tds_invoice_num ap_invoices_all.invoice_num%type;
2771: lv_tds_cm_num ap_invoices_all.invoice_num%type;
2772:
2773: lv_pan_no JAI_AP_TDS_VENDOR_HDRS.pan_no%type;
2774: lv_tan_no jai_ap_tds_org_tan_v.org_tan_num %type; --rchandan for bug#4323338
2775: lv_confirm_pan_flag JAI_AP_TDS_VENDOR_HDRS.confirm_pan_flag%type; /*Bug 11896260*/

Line 3062: from ap_invoices_all

3058:
3059: Cursor get_invoice_type(cn_invoice_id number)
3060: IS
3061: select invoice_type_lookup_code
3062: from ap_invoices_all
3063: where invoice_id = cn_invoice_id;
3064:
3065: CURSOR get_default_from_rgm(cn_org_id number)
3066: is

Line 3092: FROM AP_INVOICES_ALL AIA, JAI_AP_TDS_INV_TAXES JATIT

3088:
3089: cursor get_non_match_ven(cn_invoice_id number)
3090: is
3091: SELECT count(1)
3092: FROM AP_INVOICES_ALL AIA, JAI_AP_TDS_INV_TAXES JATIT
3093: WHERE AIA.INVOICE_ID = JATIT.INVOICE_ID
3094: and aia.invoice_id = cn_invoice_id
3095: AND ( AIA.VENDOR_ID <> JATIT.VENDOR_ID
3096: OR AIA.VENDOR_SITE_ID <> JATIT.VENDOR_SITE_ID) -- Updated for bug13735926 by Wenqiong on 21-FEB-2012

Line 3161: lv_invoice_type ap_invoices_all.invoice_type_lookup_code%type;

3157: ------------------------------------------------------------
3158: --Added by Zhiwei Hou for Bug#13818183 on 20120308 end
3159:
3160: lv_default_option JAI_RGM_ORG_REGNS_V.attribute_value%type;
3161: lv_invoice_type ap_invoices_all.invoice_type_lookup_code%type;
3162: lv_natural_account JAI_DTC_SCTN_ACCOUNT_MAPPING.natural_account_value%type;
3163: lv_prospective_flag varchar2(1);
3164: ln_hdr_id number;
3165: ln_default_option number; --1:vendor site default; 2:TDS regime.

Line 3207: FROM AP_INVOICES_ALL

3203: SELECT
3204: LEGAL_ENTITY_ID,
3205: SET_OF_BOOKS_ID
3206:
3207: FROM AP_INVOICES_ALL
3208: WHERE INVOICE_ID = cn_invoice_id;
3209:
3210: ln_legal_entity_id number;
3211: ln_set_book_id number;

Line 5166: from ap_invoices_all

5162:
5163: Cursor get_ap_info(cn_invoice_id number)
5164: is
5165: select vendor_id,invoice_currency_code,exchange_rate,vendor_site_id
5166: from ap_invoices_all
5167: where invoice_id = cn_invoice_id;
5168:
5169: ln_vendor_id number;
5170: ln_vendor_site_id number;

Line 5171: lv_invoice_curr_code ap_invoices_all.invoice_currency_code%type;

5167: where invoice_id = cn_invoice_id;
5168:
5169: ln_vendor_id number;
5170: ln_vendor_site_id number;
5171: lv_invoice_curr_code ap_invoices_all.invoice_currency_code%type;
5172: ln_exchange_rate ap_invoices_all.exchange_rate%type;
5173:
5174: cursor get_tax_info(cn_tax_id number)
5175: is

Line 5172: ln_exchange_rate ap_invoices_all.exchange_rate%type;

5168:
5169: ln_vendor_id number;
5170: ln_vendor_site_id number;
5171: lv_invoice_curr_code ap_invoices_all.invoice_currency_code%type;
5172: ln_exchange_rate ap_invoices_all.exchange_rate%type;
5173:
5174: cursor get_tax_info(cn_tax_id number)
5175: is
5176: select tax_type,section_type

Line 5269: FROM ap_invoices_all aia

5265: ------------------------------------------------
5266: --Added by Chong for bug#15976304 20121212 End
5267: AND NOT EXISTS(
5268: SELECT 1
5269: FROM ap_invoices_all aia
5270: WHERE jattt.invoice_id = aia.invoice_id
5271: AND aia.cancelled_date IS NOT NULL
5272: )
5273: ;

Line 5277: lv_tds_invoice_num ap_invoices_all.invoice_num%type;

5273: ;
5274: ------------------------------------------------------------
5275: --Added by Chong for bug#13359892 20120927 end
5276:
5277: lv_tds_invoice_num ap_invoices_all.invoice_num%type;
5278: lv_tds_cm_num ap_invoices_all.invoice_num%type;
5279:
5280: ln_threshold_grp_id number;
5281:

Line 5278: lv_tds_cm_num ap_invoices_all.invoice_num%type;

5274: ------------------------------------------------------------
5275: --Added by Chong for bug#13359892 20120927 end
5276:
5277: lv_tds_invoice_num ap_invoices_all.invoice_num%type;
5278: lv_tds_cm_num ap_invoices_all.invoice_num%type;
5279:
5280: ln_threshold_grp_id number;
5281:
5282: ln_surcharge_amount number;

Line 5858: cursor c_ap_invoices_all(cp_invoice_id number) is

5854: p_process_message out nocopy varchar2
5855: )
5856: is
5857:
5858: cursor c_ap_invoices_all(cp_invoice_id number) is
5859: select invoice_num,
5860: vendor_id,
5861: vendor_site_id,
5862: invoice_currency_code,

Line 5876: from ap_invoices_all

5872: nvl(exchange_rate, 1) exchange_rate,
5873: set_of_books_id,
5874: payment_method_code, -- Bug 7109056
5875: accts_pay_code_combination_id -- Bug 9759709
5876: from ap_invoices_all
5877: where invoice_id = cp_invoice_id;
5878:
5879: cursor c_po_vendor_sites_all(cp_vendor_id number, cp_vendor_site_id number) is
5880: select terms_id,

Line 5946: r_ap_invoices_all c_ap_invoices_all%rowtype;

5942: );
5943: ----------------------------------------------------------------------
5944: --Add by Chong on 20130130 for bug#16048702 end
5945:
5946: r_ap_invoices_all c_ap_invoices_all%rowtype;
5947: r_ja_in_tax_codes c_ja_in_tax_codes%rowtype;
5948: r_po_vendor_sites_all c_po_vendor_sites_all%rowtype;
5949: r_po_vendors c_po_vendors%rowtype;
5950: r_gl_sets_of_books c_gl_sets_of_books%rowtype;

Line 5956: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;

5952:
5953:
5954: lv_source varchar2(30); --File.Sql.35 Cbabu := 'TDS';
5955:
5956: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
5957: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
5958:
5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;

Line 5957: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;

5953:
5954: lv_source varchar2(30); --File.Sql.35 Cbabu := 'TDS';
5955:
5956: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
5957: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
5958:
5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
5961:

Line 5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;

5955:
5956: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
5957: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
5958:
5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
5961:
5962: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
5963: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;

Line 5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;

5956: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
5957: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
5958:
5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
5961:
5962: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
5963: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
5964:

Line 5962: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;

5958:
5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
5961:
5962: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
5963: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
5964:
5965: ln_invoice_to_tds_line_id ap_invoice_lines_interface.invoice_line_id%type;
5966: ln_invoice_to_vendor_line_id ap_invoice_lines_interface.invoice_line_id%type;

Line 5963: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;

5959: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
5960: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
5961:
5962: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
5963: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
5964:
5965: ln_invoice_to_tds_line_id ap_invoice_lines_interface.invoice_line_id%type;
5966: ln_invoice_to_vendor_line_id ap_invoice_lines_interface.invoice_line_id%type;
5967:

Line 5986: lv_invoice_num ap_invoices_all.invoice_num%type;

5982: ld_accounting_date date;
5983: lv_open_period ap_invoice_distributions_all.period_name%type;
5984: ln_tax_amount number;
5985:
5986: lv_invoice_num ap_invoices_all.invoice_num%type;
5987: lv_source_attribute jai_ap_tds_invoices.source_attribute%TYPE ; --rchandan for bug#4428980
5988:
5989: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801
5990:

Line 5989: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801

5985:
5986: lv_invoice_num ap_invoices_all.invoice_num%type;
5987: lv_source_attribute jai_ap_tds_invoices.source_attribute%TYPE ; --rchandan for bug#4428980
5988:
5989: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801
5990:
5991: lv_group_id VARCHAR2(80); --Added by Sanjikum for Bug#5131075(4722011)
5992:
5993: /* Bug 5722028. Added by Lakshmi Gopalsami

Line 6042: open c_ap_invoices_all(pn_invoice_id);

6038: p_process_message := 'TDS amount must be greater than 0 ';
6039: goto exit_from_procedure;
6040: end if;
6041:
6042: open c_ap_invoices_all(pn_invoice_id);
6043: fetch c_ap_invoices_all into r_ap_invoices_all;
6044: close c_ap_invoices_all;
6045:
6046: /*

Line 6043: fetch c_ap_invoices_all into r_ap_invoices_all;

6039: goto exit_from_procedure;
6040: end if;
6041:
6042: open c_ap_invoices_all(pn_invoice_id);
6043: fetch c_ap_invoices_all into r_ap_invoices_all;
6044: close c_ap_invoices_all;
6045:
6046: /*
6047: || moved this up from the under the cursor - c_po_vendor_sites_all by Ramananda for Bug#4562793

Line 6044: close c_ap_invoices_all;

6040: end if;
6041:
6042: open c_ap_invoices_all(pn_invoice_id);
6043: fetch c_ap_invoices_all into r_ap_invoices_all;
6044: close c_ap_invoices_all;
6045:
6046: /*
6047: || moved this up from the under the cursor - c_po_vendor_sites_all by Ramananda for Bug#4562793
6048: */

Line 6054: || open c_po_vendors(r_ap_invoices_all.vendor_id);

6050: fetch c_ja_in_tax_codes into r_ja_in_tax_codes;
6051: close c_ja_in_tax_codes;
6052:
6053: /*
6054: || open c_po_vendors(r_ap_invoices_all.vendor_id);
6055: || Commented the above and added the below by Ramananda for Bug#4562793
6056: */
6057: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
6058: fetch c_po_vendors into r_po_vendors;

Line 6062: || open c_po_vendor_sites_all(r_ap_invoices_all.vendor_id, r_ap_invoices_all.vendor_site_id);

6058: fetch c_po_vendors into r_po_vendors;
6059: close c_po_vendors;
6060:
6061: /*
6062: || open c_po_vendor_sites_all(r_ap_invoices_all.vendor_id, r_ap_invoices_all.vendor_site_id);
6063: || Commented the above and added the below by sanjikum for Bug#4562793
6064: */
6065: open c_po_vendor_sites_all(r_ja_in_tax_codes.vendor_id, r_ja_in_tax_codes.vendor_site_id);
6066: fetch c_po_vendor_sites_all into r_po_vendor_sites_all;

Line 6069: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);

6065: open c_po_vendor_sites_all(r_ja_in_tax_codes.vendor_id, r_ja_in_tax_codes.vendor_site_id);
6066: fetch c_po_vendor_sites_all into r_po_vendor_sites_all;
6067: close c_po_vendor_sites_all;
6068:
6069: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);
6070: fetch c_gl_sets_of_books into r_gl_sets_of_books;
6071: close c_gl_sets_of_books;
6072:
6073: /*Bug # 7410219 - Derive the Section Name*/

Line 6117: lv_invoice_num := substr(r_ap_invoices_all.invoice_num, 1, 30);

6113: open c_get_ja_in_ap_inv_id;
6114: fetch c_get_ja_in_ap_inv_id into lv_ja_in_ap_inv_id;
6115: close c_get_ja_in_ap_inv_id;
6116:
6117: lv_invoice_num := substr(r_ap_invoices_all.invoice_num, 1, 30);
6118:
6119: /* Invoice Numbers, type for the invoice pair that is being created */
6120: if ( (pv_tds_event = 'INVOICE VALIDATE') or (pv_tds_event like 'THRESHOLD TRANSITION%') ) then
6121:

Line 6232: r_ap_invoices_all.org_id

6228: Added org_id to ap_utilities_pkg
6229: */
6230: lv_open_period:= ap_utilities_pkg.get_current_gl_date
6231: (pd_accounting_date,
6232: r_ap_invoices_all.org_id
6233: );
6234:
6235: /* Bug 4559756. Added by Lakshmi Gopalsami
6236: Added org_id to ap_utilities_pkg

Line 6246: r_ap_invoices_all.org_id

6242: (
6243: pd_accounting_date,
6244: lv_open_period,
6245: ld_accounting_date,
6246: r_ap_invoices_all.org_id
6247: );
6248:
6249: if lv_open_period is null then
6250: p_process_flag := 'E';

Line 6265: pv_invoice_date := r_ap_invoices_all.invoice_date; --Added by Bgowrava for Bug#9186263

6261: lv_group_id := to_char(pn_invoice_id)||pv_tds_event;
6262: pv_invoice_date := ld_accounting_date; --Added by Bgowrava for Bug#9186263
6263: ELSE
6264: lv_group_id := to_char(pn_invoice_id);
6265: pv_invoice_date := r_ap_invoices_all.invoice_date; --Added by Bgowrava for Bug#9186263
6266: END IF;
6267:
6268:
6269: /* Invoice to TDS Authority */

Line 6331: p_org_id => r_ap_invoices_all.org_id,

6327: p_voucher_num => lv_invoice_to_tds_num,
6328: --p_payment_method_lookup_code => lv_payment_method_lookup_code,
6329: --commented by Sanjikum for Bug#4482462
6330: p_pay_group_lookup_code => lv_pay_group_lookup_code,
6331: p_org_id => r_ap_invoices_all.org_id,
6332: p_attribute_category => 'India Original Invoice for TDS',
6333: p_attribute1 => pn_invoice_id,
6334: --added the below by Sanjikum for Bug#5131075(4722011)
6335: p_group_id => lv_group_id, -- Bug# 6119216, changed to lv_group_id instead of to_char(p_invoice_id)

Line 6380: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3

6376: /* Bug 12965614. Added by Avanija
6377: * Added the following condition to handle for prepayment unapplication for foreign currency invoices.
6378: */
6379: IF pv_tds_event = 'PREPAYMENT UNAPPLICATION' THEN --2
6380: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3
6381: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
6382: IF trunc(pd_creation_date) >= trunc(jai_ap_tds_generation_pkg.gd_tds_rounding_effective_date) THEN
6383: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
6384: END IF;

Line 6385: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

6381: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
6382: IF trunc(pd_creation_date) >= trunc(jai_ap_tds_generation_pkg.gd_tds_rounding_effective_date) THEN
6383: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
6384: END IF;
6385: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
6386: END IF; --3
6387:
6388: ELSE --2
6389:

Line 6390: if r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code then

6386: END IF; --3
6387:
6388: ELSE --2
6389:
6390: if r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code then
6391: /*START, Bgowrava for Bug#8995604 , Adding below IF statement to round the INR TDS CM invoice to
6392: the TDS rounding factor before converting it to a foreign currency CM*/
6393: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
6394: IF trunc(pd_creation_date) >= trunc(jai_ap_tds_generation_pkg.gd_tds_rounding_effective_date)

Line 6399: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

6395: and pn_threshold_grp_id is not null THEN
6396: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
6397: END IF;
6398: /*END, Bgowrava for Bug#8995604 */
6399: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
6400: ELSE
6401: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
6402: /*START, Bgowrava for Bug#8995604 , Adding below IF statement to round the INR TDS CM invoice to the TDS rounding factor*/
6403: IF trunc(pd_creation_date) >= trunc(jai_ap_tds_generation_pkg.gd_tds_rounding_effective_date)

Line 6423: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then

6419: fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value after round per setup - vendor invoice'||ln_invoice_to_vendor_amount);
6420: END IF; */ --commented by bgowrava for Bug#8995604
6421:
6422:
6423: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then
6424: ln_exchange_rate := r_ap_invoices_all.exchange_rate;
6425: else
6426: ln_exchange_rate := null;
6427: end if;

Line 6424: ln_exchange_rate := r_ap_invoices_all.exchange_rate;

6420: END IF; */ --commented by bgowrava for Bug#8995604
6421:
6422:
6423: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then
6424: ln_exchange_rate := r_ap_invoices_all.exchange_rate;
6425: else
6426: ln_exchange_rate := null;
6427: end if;
6428:

Line 6435: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then

6431: /*Bug 9759709 - Liability Account for the Credit Note must be fetched from the Standard Invoice
6432: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
6433: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
6434: from setup*/
6435: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
6436: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
6437: else
6438: ln_accts_pay_ccid := NULL;
6439: end if;

Line 6436: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;

6432: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
6433: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
6434: from setup*/
6435: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
6436: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
6437: else
6438: ln_accts_pay_ccid := NULL;
6439: end if;
6440:

Line 6449: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263

6445: p_jai_source => lv_this_procedure,
6446: p_invoice_id => ln_invoice_to_vendor_id,
6447: p_invoice_num => lv_invoice_to_vendor_num,
6448: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
6449: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
6450: p_gl_date => ld_accounting_date,
6451: p_vendor_id => r_ap_invoices_all.vendor_id,
6452: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
6453: p_invoice_amount => ln_invoice_to_vendor_amount,

Line 6451: p_vendor_id => r_ap_invoices_all.vendor_id,

6447: p_invoice_num => lv_invoice_to_vendor_num,
6448: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
6449: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
6450: p_gl_date => ld_accounting_date,
6451: p_vendor_id => r_ap_invoices_all.vendor_id,
6452: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
6453: p_invoice_amount => ln_invoice_to_vendor_amount,
6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
6455: p_exchange_rate => ln_exchange_rate,

Line 6452: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,

6448: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
6449: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
6450: p_gl_date => ld_accounting_date,
6451: p_vendor_id => r_ap_invoices_all.vendor_id,
6452: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
6453: p_invoice_amount => ln_invoice_to_vendor_amount,
6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
6455: p_exchange_rate => ln_exchange_rate,
6456: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,

Line 6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,

6450: p_gl_date => ld_accounting_date,
6451: p_vendor_id => r_ap_invoices_all.vendor_id,
6452: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
6453: p_invoice_amount => ln_invoice_to_vendor_amount,
6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
6455: p_exchange_rate => ln_exchange_rate,
6456: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
6457: p_exchange_date => r_ap_invoices_all.exchange_date,
6458: p_terms_id => r_ap_invoices_all.terms_id,

Line 6456: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,

6452: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
6453: p_invoice_amount => ln_invoice_to_vendor_amount,
6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
6455: p_exchange_rate => ln_exchange_rate,
6456: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
6457: p_exchange_date => r_ap_invoices_all.exchange_date,
6458: p_terms_id => r_ap_invoices_all.terms_id,
6459: p_description => lv_invoice_to_vendor_num,
6460: p_last_update_date => sysdate,

Line 6457: p_exchange_date => r_ap_invoices_all.exchange_date,

6453: p_invoice_amount => ln_invoice_to_vendor_amount,
6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
6455: p_exchange_rate => ln_exchange_rate,
6456: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
6457: p_exchange_date => r_ap_invoices_all.exchange_date,
6458: p_terms_id => r_ap_invoices_all.terms_id,
6459: p_description => lv_invoice_to_vendor_num,
6460: p_last_update_date => sysdate,
6461: p_last_updated_by => fnd_global.user_id,

Line 6458: p_terms_id => r_ap_invoices_all.terms_id,

6454: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
6455: p_exchange_rate => ln_exchange_rate,
6456: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
6457: p_exchange_date => r_ap_invoices_all.exchange_date,
6458: p_terms_id => r_ap_invoices_all.terms_id,
6459: p_description => lv_invoice_to_vendor_num,
6460: p_last_update_date => sysdate,
6461: p_last_updated_by => fnd_global.user_id,
6462: p_last_update_login => fnd_global.login_id,

Line 6468: p_payment_method_code => r_ap_invoices_all.payment_method_code,

6464: p_created_by => fnd_global.user_id,
6465: p_source => lv_source,
6466: p_voucher_num => lv_invoice_to_vendor_num,
6467: -- Bug 7109056. Added by Lakshmi Gopalsami
6468: p_payment_method_code => r_ap_invoices_all.payment_method_code,
6469: --commented by Sanjikum for Bug#4482462
6470: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
6471: p_goods_received_date => r_ap_invoices_all.goods_received_date,
6472: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,

Line 6470: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,

6466: p_voucher_num => lv_invoice_to_vendor_num,
6467: -- Bug 7109056. Added by Lakshmi Gopalsami
6468: p_payment_method_code => r_ap_invoices_all.payment_method_code,
6469: --commented by Sanjikum for Bug#4482462
6470: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
6471: p_goods_received_date => r_ap_invoices_all.goods_received_date,
6472: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
6473: p_org_id => r_ap_invoices_all.org_id,
6474: p_attribute_category => 'India Original Invoice for TDS',

Line 6471: p_goods_received_date => r_ap_invoices_all.goods_received_date,

6467: -- Bug 7109056. Added by Lakshmi Gopalsami
6468: p_payment_method_code => r_ap_invoices_all.payment_method_code,
6469: --commented by Sanjikum for Bug#4482462
6470: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
6471: p_goods_received_date => r_ap_invoices_all.goods_received_date,
6472: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
6473: p_org_id => r_ap_invoices_all.org_id,
6474: p_attribute_category => 'India Original Invoice for TDS',
6475: p_attribute1 => pn_invoice_id,

Line 6472: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,

6468: p_payment_method_code => r_ap_invoices_all.payment_method_code,
6469: --commented by Sanjikum for Bug#4482462
6470: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
6471: p_goods_received_date => r_ap_invoices_all.goods_received_date,
6472: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
6473: p_org_id => r_ap_invoices_all.org_id,
6474: p_attribute_category => 'India Original Invoice for TDS',
6475: p_attribute1 => pn_invoice_id,
6476: --commented the above and added the below by Sanjikum for Bug#5131075(4722011)

Line 6473: p_org_id => r_ap_invoices_all.org_id,

6469: --commented by Sanjikum for Bug#4482462
6470: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
6471: p_goods_received_date => r_ap_invoices_all.goods_received_date,
6472: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
6473: p_org_id => r_ap_invoices_all.org_id,
6474: p_attribute_category => 'India Original Invoice for TDS',
6475: p_attribute1 => pn_invoice_id,
6476: --commented the above and added the below by Sanjikum for Bug#5131075(4722011)
6477: p_group_id => lv_group_id,

Line 6549: fnd_file.put_line(FND_FILE.LOG, 'org id '|| r_ap_invoices_all.org_id);

6545: fnd_file.put_line(FND_FILE.LOG, 'tax rate'|| r_ja_in_tax_codes.tax_rate);
6546: fnd_file.put_line(FND_FILE.LOG, 'tds amt'||ln_invoice_to_tds_amount);
6547: fnd_file.put_line(FND_FILE.LOG, 'sec code '||r_ja_in_tax_codes.section_code);
6548: fnd_file.put_line(FND_FILE.LOG, 'stformtype '||r_ja_in_tax_codes.stform_type);
6549: fnd_file.put_line(FND_FILE.LOG, 'org id '|| r_ap_invoices_all.org_id);
6550: fnd_file.put_line(FND_FILE.LOG, 'src att'||lv_source_attribute);
6551:
6552: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'ln_invoice_amount: ' || ln_invoice_amount);
6553: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'invoice to tds inv num'|| lv_invoice_to_tds_num);

Line 6560: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'org id '|| r_ap_invoices_all.org_id);

6556: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'tax rate'|| r_ja_in_tax_codes.tax_rate);
6557: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'tds amt'||ln_invoice_to_tds_amount);
6558: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'sec code '||r_ja_in_tax_codes.section_code);
6559: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'stformtype '||r_ja_in_tax_codes.stform_type);
6560: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'org id '|| r_ap_invoices_all.org_id);
6561: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_STATEMENT, G_MODULE_NAME||l_api_name, 'src att'||lv_source_attribute);
6562:
6563: IF NVL(ln_invoice_amount,0) <> 0 THEN --Added the condition by bgowrava for Bug#4549019
6564: insert into JAI_AP_TDS_INVOICES

Line 6598: --r_ap_invoices_all.org_id,

6594: r_ja_in_tax_codes.tax_rate,
6595: ln_invoice_to_tds_amount,
6596: r_ja_in_tax_codes.section_code,
6597: r_ja_in_tax_codes.stform_type,
6598: --r_ap_invoices_all.org_id,
6599: r_ap_invoices_all.org_id,
6600: lv_source_attribute, --rchandan for bug#4428980
6601: /* Ramananda for bug#4560109 during R12 Sanity Testing. Added the WHO columns */
6602: fnd_global.user_id ,

Line 6599: r_ap_invoices_all.org_id,

6595: ln_invoice_to_tds_amount,
6596: r_ja_in_tax_codes.section_code,
6597: r_ja_in_tax_codes.stform_type,
6598: --r_ap_invoices_all.org_id,
6599: r_ap_invoices_all.org_id,
6600: lv_source_attribute, --rchandan for bug#4428980
6601: /* Ramananda for bug#4560109 during R12 Sanity Testing. Added the WHO columns */
6602: fnd_global.user_id ,
6603: sysdate ,

Line 6616: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3

6612: ln_tds_rnding_factor := 0;
6613: ln_tds_rnded_amt := pn_tax_amount;
6614: /* Added the below if condition for bug 12965614 */
6615: IF pv_tds_event = 'PREPAYMENT UNAPPLICATION' THEN --2
6616: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3
6617: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount , g_inr_currency_rounding);
6618: IF (trunc(pd_creation_date) >= trunc(jai_ap_tds_generation_pkg.gd_tds_rounding_effective_date)) THEN --4
6619: ln_tds_rnding_factor := jai_ap_tds_generation_pkg.gn_tds_rounding_factor;
6620: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);

Line 6622: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

6618: IF (trunc(pd_creation_date) >= trunc(jai_ap_tds_generation_pkg.gd_tds_rounding_effective_date)) THEN --4
6619: ln_tds_rnding_factor := jai_ap_tds_generation_pkg.gn_tds_rounding_factor;
6620: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);
6621: END IF; --4
6622: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
6623: END IF; --3
6624: ELSE --2
6625: /*IF pv_tds_event NOT IN
6626: -- Bug 7280925. commented by Lakshmi Gopalsami ('INVOICE CANCEL',

Line 6628: IF r_ap_invoices_all.invoice_currency_code = r_gl_sets_of_books.currency_code THEN

6624: ELSE --2
6625: /*IF pv_tds_event NOT IN
6626: -- Bug 7280925. commented by Lakshmi Gopalsami ('INVOICE CANCEL',
6627: ('PREPAYMENT UNAPPLICATION') THEN */
6628: IF r_ap_invoices_all.invoice_currency_code = r_gl_sets_of_books.currency_code THEN
6629: ln_tds_rnded_amt := ROUND(pn_tax_amount , g_inr_currency_rounding);
6630: --moved this if-endif block from below to here for bug#8995604
6631: ELSE
6632: ln_tds_rnded_amt := ROUND(pn_tax_amount , g_inr_currency_rounding);

Line 6645: ln_tds_rnded_amt := ROUND(pn_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

6641: ln_tds_rnding_factor := jai_ap_tds_generation_pkg.gn_tds_rounding_factor;
6642: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);
6643: fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value after round before insert into trxs'||ln_tds_rnded_amt);
6644: END IF;
6645: ln_tds_rnded_amt := ROUND(pn_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
6646: END IF ;
6647: fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value before round '||ln_tds_rnded_amt);
6648:
6649: END IF;

Line 6712: r_ap_invoices_all.vendor_id ,

6708: lv_invoice_to_tds_num ,
6709: lv_invoice_to_tds_type ,
6710: r_gl_sets_of_books.currency_code ,
6711: ln_invoice_to_tds_amount ,
6712: r_ap_invoices_all.vendor_id ,
6713: r_ap_invoices_all.vendor_site_id ,
6714: lv_invoice_to_vendor_num ,
6715: lv_invoice_to_vendor_type ,
6716: r_ap_invoices_all.invoice_currency_code ,

Line 6713: r_ap_invoices_all.vendor_site_id ,

6709: lv_invoice_to_tds_type ,
6710: r_gl_sets_of_books.currency_code ,
6711: ln_invoice_to_tds_amount ,
6712: r_ap_invoices_all.vendor_id ,
6713: r_ap_invoices_all.vendor_site_id ,
6714: lv_invoice_to_vendor_num ,
6715: lv_invoice_to_vendor_type ,
6716: r_ap_invoices_all.invoice_currency_code ,
6717: ln_invoice_to_vendor_amount ,

Line 6716: r_ap_invoices_all.invoice_currency_code ,

6712: r_ap_invoices_all.vendor_id ,
6713: r_ap_invoices_all.vendor_site_id ,
6714: lv_invoice_to_vendor_num ,
6715: lv_invoice_to_vendor_type ,
6716: r_ap_invoices_all.invoice_currency_code ,
6717: ln_invoice_to_vendor_amount ,
6718: r_ap_payment_schedules_all.payment_priority ,
6719: r_ap_invoices_all.exchange_rate ,
6720: fnd_global.user_id ,

Line 6719: r_ap_invoices_all.exchange_rate ,

6715: lv_invoice_to_vendor_type ,
6716: r_ap_invoices_all.invoice_currency_code ,
6717: ln_invoice_to_vendor_amount ,
6718: r_ap_payment_schedules_all.payment_priority ,
6719: r_ap_invoices_all.exchange_rate ,
6720: fnd_global.user_id ,
6721: sysdate ,
6722: fnd_global.user_id ,
6723: sysdate ,

Line 6778: cursor c_ap_invoices_all(cp_invoice_id number) is

6774: p_process_message out nocopy varchar2
6775: )
6776: is
6777:
6778: cursor c_ap_invoices_all(cp_invoice_id number) is
6779: select invoice_num,
6780: vendor_id,
6781: vendor_site_id,
6782: invoice_currency_code,

Line 6796: from ap_invoices_all

6792: nvl(exchange_rate, 1) exchange_rate,
6793: set_of_books_id,
6794: payment_method_code, -- Bug 7109056
6795: accts_pay_code_combination_id -- Bug 9759709
6796: from ap_invoices_all
6797: where invoice_id = cp_invoice_id;
6798:
6799: cursor c_po_vendor_sites_all(cp_vendor_id number, cp_vendor_site_id number) is
6800: select terms_id,

Line 6841: r_ap_invoices_all c_ap_invoices_all%rowtype;

6837: select payment_priority
6838: from ap_payment_schedules_all
6839: where invoice_id = p_invoice_id;
6840:
6841: r_ap_invoices_all c_ap_invoices_all%rowtype;
6842: r_ja_in_tax_codes c_ja_in_tax_codes%rowtype;
6843: r_po_vendor_sites_all c_po_vendor_sites_all%rowtype;
6844: r_po_vendors c_po_vendors%rowtype;
6845: r_gl_sets_of_books c_gl_sets_of_books%rowtype;

Line 6851: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;

6847:
6848:
6849: lv_source varchar2(30); --File.Sql.35 Cbabu := 'TDS';
6850:
6851: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
6852: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
6853:
6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;

Line 6852: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;

6848:
6849: lv_source varchar2(30); --File.Sql.35 Cbabu := 'TDS';
6850:
6851: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
6852: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
6853:
6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
6856:

Line 6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;

6850:
6851: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
6852: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
6853:
6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
6856:
6857: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
6858: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;

Line 6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;

6851: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
6852: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
6853:
6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
6856:
6857: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
6858: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
6859:

Line 6857: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;

6853:
6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
6856:
6857: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
6858: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
6859:
6860: ln_invoice_to_tds_line_id ap_invoice_lines_interface.invoice_line_id%type;
6861: ln_invoice_to_vendor_line_id ap_invoice_lines_interface.invoice_line_id%type;

Line 6858: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;

6854: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
6855: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
6856:
6857: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
6858: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
6859:
6860: ln_invoice_to_tds_line_id ap_invoice_lines_interface.invoice_line_id%type;
6861: ln_invoice_to_vendor_line_id ap_invoice_lines_interface.invoice_line_id%type;
6862:

Line 6881: lv_invoice_num ap_invoices_all.invoice_num%type;

6877: ld_accounting_date date;
6878: lv_open_period ap_invoice_distributions_all.period_name%type;
6879: ln_tax_amount number;
6880:
6881: lv_invoice_num ap_invoices_all.invoice_num%type;
6882: lv_source_attribute jai_ap_tds_invoices.source_attribute%TYPE ; --rchandan for bug#4428980
6883:
6884: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801
6885:

Line 6884: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801

6880:
6881: lv_invoice_num ap_invoices_all.invoice_num%type;
6882: lv_source_attribute jai_ap_tds_invoices.source_attribute%TYPE ; --rchandan for bug#4428980
6883:
6884: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801
6885:
6886: lv_group_id VARCHAR2(80); --Added by Sanjikum for Bug#5131075(4722011)
6887:
6888: /* Bug 5722028. Added by Lakshmi Gopalsami

Line 7101: open c_ap_invoices_all(pn_invoice_id);

7097: --ln_tax_amount := round(ln_tax_amount,get_tax_rounding(pn_invoice_id));--Comment by Zhiwei Hou on 20120109
7098: ----------------------------------------------------------------------
7099: --Add by Zhiwei Hou on 20120106 end
7100:
7101: open c_ap_invoices_all(pn_invoice_id);
7102: fetch c_ap_invoices_all into r_ap_invoices_all;
7103: close c_ap_invoices_all;
7104:
7105: /*

Line 7102: fetch c_ap_invoices_all into r_ap_invoices_all;

7098: ----------------------------------------------------------------------
7099: --Add by Zhiwei Hou on 20120106 end
7100:
7101: open c_ap_invoices_all(pn_invoice_id);
7102: fetch c_ap_invoices_all into r_ap_invoices_all;
7103: close c_ap_invoices_all;
7104:
7105: /*
7106: || moved this up from the under the cursor - c_po_vendor_sites_all by Ramananda for Bug#4562793

Line 7103: close c_ap_invoices_all;

7099: --Add by Zhiwei Hou on 20120106 end
7100:
7101: open c_ap_invoices_all(pn_invoice_id);
7102: fetch c_ap_invoices_all into r_ap_invoices_all;
7103: close c_ap_invoices_all;
7104:
7105: /*
7106: || moved this up from the under the cursor - c_po_vendor_sites_all by Ramananda for Bug#4562793
7107: */

Line 7110: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);

7106: || moved this up from the under the cursor - c_po_vendor_sites_all by Ramananda for Bug#4562793
7107: */
7108:
7109:
7110: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);
7111: fetch c_gl_sets_of_books into r_gl_sets_of_books;
7112: close c_gl_sets_of_books;
7113:
7114: /*Bug # 7410219 - Derive the Section Name*/

Line 7139: lv_invoice_num := substr(r_ap_invoices_all.invoice_num, 1, 30);

7135: open c_get_ja_in_ap_inv_id;
7136: fetch c_get_ja_in_ap_inv_id into lv_ja_in_ap_inv_id;
7137: close c_get_ja_in_ap_inv_id;
7138:
7139: lv_invoice_num := substr(r_ap_invoices_all.invoice_num, 1, 30);
7140:
7141: /* Invoice Numbers, type for the invoice pair that is being created */
7142: if ( (pv_tds_event = 'INVOICE VALIDATE') or (pv_tds_event like 'THRESHOLD TRANSITION%') ) then
7143:

Line 7240: r_ap_invoices_all.org_id

7236: Added org_id to ap_utilities_pkg
7237: */
7238: lv_open_period:= ap_utilities_pkg.get_current_gl_date
7239: (pd_accounting_date,
7240: r_ap_invoices_all.org_id
7241: );
7242:
7243: /* Bug 4559756. Added by Lakshmi Gopalsami
7244: Added org_id to ap_utilities_pkg

Line 7254: r_ap_invoices_all.org_id

7250: (
7251: pd_accounting_date,
7252: lv_open_period,
7253: ld_accounting_date,
7254: r_ap_invoices_all.org_id
7255: );
7256:
7257: if lv_open_period is null then
7258: p_process_flag := 'E';

Line 7273: pv_invoice_date := r_ap_invoices_all.invoice_date; --Added by Bgowrava for Bug#9186263

7269: lv_group_id := to_char(pn_invoice_id)||pv_tds_event;
7270: pv_invoice_date := ld_accounting_date; --Added by Bgowrava for Bug#9186263
7271: ELSE
7272: lv_group_id := to_char(pn_invoice_id);
7273: pv_invoice_date := r_ap_invoices_all.invoice_date; --Added by Bgowrava for Bug#9186263
7274: END IF;
7275:
7276:
7277: /* Invoice to TDS Authority */

Line 7322: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3

7318: --------------------------------------------------------------------------------------------
7319: if lv_invoice_to_vendor_num is not null and lv_invoice_to_vendor_type is not null then
7320:
7321: IF pv_tds_event = 'PREPAYMENT UNAPPLICATION' THEN --2
7322: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3
7323: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
7324: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date) THEN
7325: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
7326: END IF;

Line 7327: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

7323: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
7324: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date) THEN
7325: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
7326: END IF;
7327: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
7328: END IF; --3
7329:
7330: ELSE --2
7331:

Line 7332: if r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code then

7328: END IF; --3
7329:
7330: ELSE --2
7331:
7332: if r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code then
7333: /*START, Bgowrava for Bug#8995604 , Adding below IF statement to round the INR TDS CM invoice to
7334: the TDS rounding factor before converting it to a foreign currency CM*/
7335: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
7336: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)

Line 7342: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

7338:
7339: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
7340: END IF;
7341: /*END, Bgowrava for Bug#8995604 */
7342: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
7343: ELSE
7344: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
7345: /*START, Bgowrava for Bug#8995604 , Adding below IF statement to round the INR TDS CM invoice to the TDS rounding factor*/
7346: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)

Line 7365: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then

7361: );
7362:
7363: END IF;
7364:
7365: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then
7366: ln_exchange_rate := r_ap_invoices_all.exchange_rate;
7367: else
7368: ln_exchange_rate := null;
7369: end if;

Line 7366: ln_exchange_rate := r_ap_invoices_all.exchange_rate;

7362:
7363: END IF;
7364:
7365: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then
7366: ln_exchange_rate := r_ap_invoices_all.exchange_rate;
7367: else
7368: ln_exchange_rate := null;
7369: end if;
7370:

Line 7386: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then

7382: /*Bug 9759709 - Liability Account for the Credit Note must be fetched from the Standard Invoice
7383: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
7384: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
7385: from setup*/
7386: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
7387: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
7388: else
7389: ln_accts_pay_ccid := NULL;
7390: end if;

Line 7387: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;

7383: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
7384: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
7385: from setup*/
7386: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
7387: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
7388: else
7389: ln_accts_pay_ccid := NULL;
7390: end if;
7391: end if;

Line 7509: p_org_id => r_ap_invoices_all.org_id,

7505: p_created_by => fnd_global.user_id,
7506: p_source => lv_source,
7507: p_voucher_num => lv_invoice_to_tds_num,
7508: p_pay_group_lookup_code => lv_pay_group_lookup_code,
7509: p_org_id => r_ap_invoices_all.org_id,
7510: p_attribute_category => 'India Original Invoice for TDS',
7511: p_attribute1 => pn_invoice_id,
7512: p_group_id => lv_group_id, -- Bug# 6119216, changed to lv_group_id instead of to_char(p_invoice_id)
7513: p_Calc_Tax_During_Import_Flag => 'Y' --Added by Qiong for AP Open Interface

Line 7572: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263

7568: p_jai_source => lv_this_procedure,
7569: p_invoice_id => ln_invoice_to_vendor_id,
7570: p_invoice_num => lv_invoice_to_vendor_num,
7571: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
7572: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
7573: p_gl_date => ld_accounting_date,
7574: p_vendor_id => r_ap_invoices_all.vendor_id,
7575: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
7576: p_invoice_amount => ln_invoice_to_vendor_amount,

Line 7574: p_vendor_id => r_ap_invoices_all.vendor_id,

7570: p_invoice_num => lv_invoice_to_vendor_num,
7571: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
7572: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
7573: p_gl_date => ld_accounting_date,
7574: p_vendor_id => r_ap_invoices_all.vendor_id,
7575: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
7576: p_invoice_amount => ln_invoice_to_vendor_amount,
7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
7578: p_exchange_rate => ln_exchange_rate,

Line 7575: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,

7571: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
7572: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
7573: p_gl_date => ld_accounting_date,
7574: p_vendor_id => r_ap_invoices_all.vendor_id,
7575: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
7576: p_invoice_amount => ln_invoice_to_vendor_amount,
7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
7578: p_exchange_rate => ln_exchange_rate,
7579: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,

Line 7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,

7573: p_gl_date => ld_accounting_date,
7574: p_vendor_id => r_ap_invoices_all.vendor_id,
7575: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
7576: p_invoice_amount => ln_invoice_to_vendor_amount,
7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
7578: p_exchange_rate => ln_exchange_rate,
7579: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
7580: p_exchange_date => r_ap_invoices_all.exchange_date,
7581: p_terms_id => r_ap_invoices_all.terms_id,

Line 7579: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,

7575: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
7576: p_invoice_amount => ln_invoice_to_vendor_amount,
7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
7578: p_exchange_rate => ln_exchange_rate,
7579: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
7580: p_exchange_date => r_ap_invoices_all.exchange_date,
7581: p_terms_id => r_ap_invoices_all.terms_id,
7582: p_description => lv_invoice_to_vendor_num,
7583: p_last_update_date => sysdate,

Line 7580: p_exchange_date => r_ap_invoices_all.exchange_date,

7576: p_invoice_amount => ln_invoice_to_vendor_amount,
7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
7578: p_exchange_rate => ln_exchange_rate,
7579: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
7580: p_exchange_date => r_ap_invoices_all.exchange_date,
7581: p_terms_id => r_ap_invoices_all.terms_id,
7582: p_description => lv_invoice_to_vendor_num,
7583: p_last_update_date => sysdate,
7584: p_last_updated_by => fnd_global.user_id,

Line 7581: p_terms_id => r_ap_invoices_all.terms_id,

7577: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
7578: p_exchange_rate => ln_exchange_rate,
7579: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
7580: p_exchange_date => r_ap_invoices_all.exchange_date,
7581: p_terms_id => r_ap_invoices_all.terms_id,
7582: p_description => lv_invoice_to_vendor_num,
7583: p_last_update_date => sysdate,
7584: p_last_updated_by => fnd_global.user_id,
7585: p_last_update_login => fnd_global.login_id,

Line 7590: p_payment_method_code => r_ap_invoices_all.payment_method_code,

7586: p_creation_date => sysdate,
7587: p_created_by => fnd_global.user_id,
7588: p_source => lv_source,
7589: p_voucher_num => lv_invoice_to_vendor_num,
7590: p_payment_method_code => r_ap_invoices_all.payment_method_code,
7591: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
7592: p_goods_received_date => r_ap_invoices_all.goods_received_date,
7593: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
7594: p_org_id => r_ap_invoices_all.org_id,

Line 7591: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,

7587: p_created_by => fnd_global.user_id,
7588: p_source => lv_source,
7589: p_voucher_num => lv_invoice_to_vendor_num,
7590: p_payment_method_code => r_ap_invoices_all.payment_method_code,
7591: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
7592: p_goods_received_date => r_ap_invoices_all.goods_received_date,
7593: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
7594: p_org_id => r_ap_invoices_all.org_id,
7595: p_attribute_category => 'India Original Invoice for TDS',

Line 7592: p_goods_received_date => r_ap_invoices_all.goods_received_date,

7588: p_source => lv_source,
7589: p_voucher_num => lv_invoice_to_vendor_num,
7590: p_payment_method_code => r_ap_invoices_all.payment_method_code,
7591: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
7592: p_goods_received_date => r_ap_invoices_all.goods_received_date,
7593: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
7594: p_org_id => r_ap_invoices_all.org_id,
7595: p_attribute_category => 'India Original Invoice for TDS',
7596: p_attribute1 => pn_invoice_id,

Line 7593: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,

7589: p_voucher_num => lv_invoice_to_vendor_num,
7590: p_payment_method_code => r_ap_invoices_all.payment_method_code,
7591: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
7592: p_goods_received_date => r_ap_invoices_all.goods_received_date,
7593: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
7594: p_org_id => r_ap_invoices_all.org_id,
7595: p_attribute_category => 'India Original Invoice for TDS',
7596: p_attribute1 => pn_invoice_id,
7597: p_group_id => lv_group_id,

Line 7594: p_org_id => r_ap_invoices_all.org_id,

7590: p_payment_method_code => r_ap_invoices_all.payment_method_code,
7591: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
7592: p_goods_received_date => r_ap_invoices_all.goods_received_date,
7593: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
7594: p_org_id => r_ap_invoices_all.org_id,
7595: p_attribute_category => 'India Original Invoice for TDS',
7596: p_attribute1 => pn_invoice_id,
7597: p_group_id => lv_group_id,
7598: p_accts_pay_ccid => ln_accts_pay_ccid, /*Bug 9759709*/

Line 7760: --fnd_file.put_line(FND_FILE.LOG, 'org id '|| r_ap_invoices_all.org_id);

7756: --fnd_file.put_line(FND_FILE.LOG, 'tax rate'|| r_ja_in_tax_codes.tax_rate);
7757: --fnd_file.put_line(FND_FILE.LOG, 'tds amt'||ln_invoice_to_tds_amount);
7758: --fnd_file.put_line(FND_FILE.LOG, 'sec code '||pv_section_code);
7759: --fnd_file.put_line(FND_FILE.LOG, 'stformtype '||lv_stform_type);
7760: --fnd_file.put_line(FND_FILE.LOG, 'org id '|| r_ap_invoices_all.org_id);
7761: --fnd_file.put_line(FND_FILE.LOG, 'src att'||lv_source_attribute);
7762:
7763: IF NVL(ln_invoice_amount,0) <> 0 THEN --Added the condition by bgowrava for Bug#4549019
7764: insert into JAI_AP_TDS_INVOICES

Line 7800: --r_ap_invoices_all.org_id,

7796: --r_ja_in_tax_codes.tax_rate,
7797: ln_invoice_to_tds_amount,
7798: pv_section_code,--r_ja_in_tax_codes.section_code,
7799: lv_stform_type,--r_ja_in_tax_codes.stform_type,
7800: --r_ap_invoices_all.org_id,
7801: r_ap_invoices_all.org_id,
7802: lv_source_attribute, --rchandan for bug#4428980
7803: /* Ramananda for bug#4560109 during R12 Sanity Testing. Added the WHO columns */
7804: fnd_global.user_id ,

Line 7801: r_ap_invoices_all.org_id,

7797: ln_invoice_to_tds_amount,
7798: pv_section_code,--r_ja_in_tax_codes.section_code,
7799: lv_stform_type,--r_ja_in_tax_codes.stform_type,
7800: --r_ap_invoices_all.org_id,
7801: r_ap_invoices_all.org_id,
7802: lv_source_attribute, --rchandan for bug#4428980
7803: /* Ramananda for bug#4560109 during R12 Sanity Testing. Added the WHO columns */
7804: fnd_global.user_id ,
7805: sysdate ,

Line 7818: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3

7814: ln_tds_rnding_factor := 0;
7815: ln_tds_rnded_amt := pn_tax_amount;
7816: /* Added the below if condition for bug 12965614 */
7817: IF pv_tds_event = 'PREPAYMENT UNAPPLICATION' THEN --2
7818: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3
7819: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount , g_inr_currency_rounding);
7820: IF (trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)) THEN --4
7821: ln_tds_rnding_factor := jai_ap_dtc_generation_pkg.gn_tds_rounding_factor;
7822: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);

Line 7824: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

7820: IF (trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)) THEN --4
7821: ln_tds_rnding_factor := jai_ap_dtc_generation_pkg.gn_tds_rounding_factor;
7822: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);
7823: END IF; --4
7824: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
7825: END IF; --3
7826: ELSE --2
7827: /*IF pv_tds_event NOT IN
7828: -- Bug 7280925. commented by Lakshmi Gopalsami ('INVOICE CANCEL',

Line 7830: IF r_ap_invoices_all.invoice_currency_code = r_gl_sets_of_books.currency_code THEN

7826: ELSE --2
7827: /*IF pv_tds_event NOT IN
7828: -- Bug 7280925. commented by Lakshmi Gopalsami ('INVOICE CANCEL',
7829: ('PREPAYMENT UNAPPLICATION') THEN */
7830: IF r_ap_invoices_all.invoice_currency_code = r_gl_sets_of_books.currency_code THEN
7831: ln_tds_rnded_amt := ROUND(pn_tax_amount , g_inr_currency_rounding);
7832: --moved this if-endif block from below to here for bug#8995604
7833: ELSE
7834: ln_tds_rnded_amt := ROUND(pn_tax_amount , g_inr_currency_rounding);

Line 7847: ln_tds_rnded_amt := ROUND(pn_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

7843: ln_tds_rnding_factor := jai_ap_dtc_generation_pkg.gn_tds_rounding_factor;
7844: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);
7845: --fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value after round before insert into trxs'||ln_tds_rnded_amt);
7846: END IF;
7847: ln_tds_rnded_amt := ROUND(pn_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
7848: END IF ;
7849: --fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value before round '||ln_tds_rnded_amt);
7850:
7851: END IF;

Line 7917: r_ap_invoices_all.vendor_id ,

7913: lv_invoice_to_tds_num ,
7914: lv_invoice_to_tds_type ,
7915: r_gl_sets_of_books.currency_code ,
7916: ln_invoice_to_tds_amount ,
7917: r_ap_invoices_all.vendor_id ,
7918: r_ap_invoices_all.vendor_site_id ,
7919: lv_invoice_to_vendor_num ,
7920: lv_invoice_to_vendor_type ,
7921: r_ap_invoices_all.invoice_currency_code ,

Line 7918: r_ap_invoices_all.vendor_site_id ,

7914: lv_invoice_to_tds_type ,
7915: r_gl_sets_of_books.currency_code ,
7916: ln_invoice_to_tds_amount ,
7917: r_ap_invoices_all.vendor_id ,
7918: r_ap_invoices_all.vendor_site_id ,
7919: lv_invoice_to_vendor_num ,
7920: lv_invoice_to_vendor_type ,
7921: r_ap_invoices_all.invoice_currency_code ,
7922: ln_invoice_to_vendor_amount ,

Line 7921: r_ap_invoices_all.invoice_currency_code ,

7917: r_ap_invoices_all.vendor_id ,
7918: r_ap_invoices_all.vendor_site_id ,
7919: lv_invoice_to_vendor_num ,
7920: lv_invoice_to_vendor_type ,
7921: r_ap_invoices_all.invoice_currency_code ,
7922: ln_invoice_to_vendor_amount ,
7923: r_ap_payment_schedules_all.payment_priority ,
7924: r_ap_invoices_all.exchange_rate ,
7925: fnd_global.user_id ,

Line 7924: r_ap_invoices_all.exchange_rate ,

7920: lv_invoice_to_vendor_type ,
7921: r_ap_invoices_all.invoice_currency_code ,
7922: ln_invoice_to_vendor_amount ,
7923: r_ap_payment_schedules_all.payment_priority ,
7924: r_ap_invoices_all.exchange_rate ,
7925: fnd_global.user_id ,
7926: sysdate ,
7927: fnd_global.user_id ,
7928: sysdate ,

Line 7967: cursor c_ap_invoices_all(p_invoice_id number) is

7963: p_process_message out nocopy varchar2
7964: )
7965: is
7966:
7967: cursor c_ap_invoices_all(p_invoice_id number) is
7968: select vendor_id,
7969: vendor_site_id,
7970: org_id
7971: from ap_invoices_all

Line 7971: from ap_invoices_all

7967: cursor c_ap_invoices_all(p_invoice_id number) is
7968: select vendor_id,
7969: vendor_site_id,
7970: org_id
7971: from ap_invoices_all
7972: where invoice_id = p_invoice_id;
7973:
7974: cursor c_ja_in_po_vendor_sites(p_vendor_id number, p_vendor_site_id number) is
7975: select nvl( approved_invoice_flag, 'N' ) approved_invoice_flag

Line 7981: r_ap_invoices_all c_ap_invoices_all%rowtype;

7977: where vendor_id = p_vendor_id
7978: and vendor_site_id = p_vendor_site_id;
7979:
7980:
7981: r_ap_invoices_all c_ap_invoices_all%rowtype;
7982:
7983: lb_result boolean;
7984: ln_import_request_id number;
7985: ln_approve_request_id number;

Line 8019: open c_ap_invoices_all(p_invoice_id);

8015: /* Invoke payables open interface */
8016:
8017: lb_result := fnd_request.set_mode(true);
8018:
8019: open c_ap_invoices_all(p_invoice_id);
8020: fetch c_ap_invoices_all into r_ap_invoices_all;
8021: close c_ap_invoices_all;
8022:
8023: lv_batch_name := jai_ap_utils_pkg.get_tds_invoice_batch(p_invoice_id, r_ap_invoices_all.org_id); --Ramananda for bug#4584221 --added org_id parameter for Bug#9149941

Line 8020: fetch c_ap_invoices_all into r_ap_invoices_all;

8016:
8017: lb_result := fnd_request.set_mode(true);
8018:
8019: open c_ap_invoices_all(p_invoice_id);
8020: fetch c_ap_invoices_all into r_ap_invoices_all;
8021: close c_ap_invoices_all;
8022:
8023: lv_batch_name := jai_ap_utils_pkg.get_tds_invoice_batch(p_invoice_id, r_ap_invoices_all.org_id); --Ramananda for bug#4584221 --added org_id parameter for Bug#9149941
8024: /*Comment for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng begin

Line 8021: close c_ap_invoices_all;

8017: lb_result := fnd_request.set_mode(true);
8018:
8019: open c_ap_invoices_all(p_invoice_id);
8020: fetch c_ap_invoices_all into r_ap_invoices_all;
8021: close c_ap_invoices_all;
8022:
8023: lv_batch_name := jai_ap_utils_pkg.get_tds_invoice_batch(p_invoice_id, r_ap_invoices_all.org_id); --Ramananda for bug#4584221 --added org_id parameter for Bug#9149941
8024: /*Comment for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng begin
8025: ln_import_request_id :=

Line 8023: lv_batch_name := jai_ap_utils_pkg.get_tds_invoice_batch(p_invoice_id, r_ap_invoices_all.org_id); --Ramananda for bug#4584221 --added org_id parameter for Bug#9149941

8019: open c_ap_invoices_all(p_invoice_id);
8020: fetch c_ap_invoices_all into r_ap_invoices_all;
8021: close c_ap_invoices_all;
8022:
8023: lv_batch_name := jai_ap_utils_pkg.get_tds_invoice_batch(p_invoice_id, r_ap_invoices_all.org_id); --Ramananda for bug#4584221 --added org_id parameter for Bug#9149941
8024: /*Comment for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng begin
8025: ln_import_request_id :=
8026: fnd_request.submit_request
8027: (

Line 8116: /* open c_ap_invoices_all(p_invoice_id);

8112: ,p_calling_sequence => NULL);*/
8113: /*Added for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng end*/
8114:
8115: /* Get vendor and site for the invoice */
8116: /* open c_ap_invoices_all(p_invoice_id);
8117: fetch c_ap_invoices_all into r_ap_invoices_all;
8118: close c_ap_invoices_all;*/ --moved this code to the start of the procedure for Bug#9149941
8119:
8120: /* Check if Pre-approved TDS invoices setup has been set for the vendor */

Line 8117: fetch c_ap_invoices_all into r_ap_invoices_all;

8113: /*Added for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng end*/
8114:
8115: /* Get vendor and site for the invoice */
8116: /* open c_ap_invoices_all(p_invoice_id);
8117: fetch c_ap_invoices_all into r_ap_invoices_all;
8118: close c_ap_invoices_all;*/ --moved this code to the start of the procedure for Bug#9149941
8119:
8120: /* Check if Pre-approved TDS invoices setup has been set for the vendor */
8121:

Line 8118: close c_ap_invoices_all;*/ --moved this code to the start of the procedure for Bug#9149941

8114:
8115: /* Get vendor and site for the invoice */
8116: /* open c_ap_invoices_all(p_invoice_id);
8117: fetch c_ap_invoices_all into r_ap_invoices_all;
8118: close c_ap_invoices_all;*/ --moved this code to the start of the procedure for Bug#9149941
8119:
8120: /* Check if Pre-approved TDS invoices setup has been set for the vendor */
8121:
8122: /* Check for vendor and site */

Line 8123: open c_ja_in_po_vendor_sites(r_ap_invoices_all.vendor_id, r_ap_invoices_all.vendor_site_id);

8119:
8120: /* Check if Pre-approved TDS invoices setup has been set for the vendor */
8121:
8122: /* Check for vendor and site */
8123: open c_ja_in_po_vendor_sites(r_ap_invoices_all.vendor_id, r_ap_invoices_all.vendor_site_id);
8124: fetch c_ja_in_po_vendor_sites into lv_approved_invoice_flag;
8125: close c_ja_in_po_vendor_sites;
8126:
8127: if nvl(lv_approved_invoice_flag, 'N') <> 'Y' then

Line 8129: open c_ja_in_po_vendor_sites(r_ap_invoices_all.vendor_id, 0);

8125: close c_ja_in_po_vendor_sites;
8126:
8127: if nvl(lv_approved_invoice_flag, 'N') <> 'Y' then
8128: /* Pre-approved TDS invoice is not set for vendor and site, Check for vendor and null site */
8129: open c_ja_in_po_vendor_sites(r_ap_invoices_all.vendor_id, 0);
8130: fetch c_ja_in_po_vendor_sites into lv_approved_invoice_flag;
8131: close c_ja_in_po_vendor_sites;
8132: end if;
8133:

Line 8155: r_ap_invoices_all.vendor_id,

8151: sysdate,
8152: false,
8153: ln_import_request_id,
8154: p_invoice_id,
8155: r_ap_invoices_all.vendor_id,
8156: r_ap_invoices_all.vendor_site_id,
8157: p_start_thhold_trx_id
8158: );
8159: /*Added for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng begin*/

Line 8156: r_ap_invoices_all.vendor_site_id,

8152: false,
8153: ln_import_request_id,
8154: p_invoice_id,
8155: r_ap_invoices_all.vendor_id,
8156: r_ap_invoices_all.vendor_site_id,
8157: p_start_thhold_trx_id
8158: );
8159: /*Added for bug#15915537 TDS Performance ER on 26-Nov-2012 by Qimeng begin*/
8160: /*Commented by Chong to revert back to CP mode 2013/04/19 Start

Line 8166: ,p_vendor_id => r_ap_invoices_all.vendor_id

8162: approve_tds_invoices(errbuf => lv_errbuf
8163: ,retcode => lv_retcode
8164: ,p_parent_request_id => NULL
8165: ,p_invoice_id => p_invoice_id
8166: ,p_vendor_id => r_ap_invoices_all.vendor_id
8167: ,p_vendor_site_id => r_ap_invoices_all.vendor_site_id
8168: ,p_start_thhold_trx_id => p_start_thhold_trx_id);
8169: end if;
8170: Commented by Chong to revert back to CP mode 2013/04/19 End

Line 8167: ,p_vendor_site_id => r_ap_invoices_all.vendor_site_id

8163: ,retcode => lv_retcode
8164: ,p_parent_request_id => NULL
8165: ,p_invoice_id => p_invoice_id
8166: ,p_vendor_id => r_ap_invoices_all.vendor_id
8167: ,p_vendor_site_id => r_ap_invoices_all.vendor_site_id
8168: ,p_start_thhold_trx_id => p_start_thhold_trx_id);
8169: end if;
8170: Commented by Chong to revert back to CP mode 2013/04/19 End
8171: */

Line 8216: FROM ap_invoices_all

8212:
8213: CURSOR c_jai_chk_tds_inv (p_invoice_id number) IS
8214: SELECT invoice_id, org_id,
8215: set_of_books_id -- bug 6819855. Added by Lakshmi Gopalsami
8216: FROM ap_invoices_all
8217: WHERE invoice_id = p_invoice_id;
8218:
8219: lb_request_status boolean;
8220: lv_phase varchar2(100);

Line 8511: ln_invoice_id ap_invoices_all.invoice_id%type;

8507: and invoice_to_vendor_id is null;
8508:
8509: r_check_inv_to_tds c_check_inv_to_tds_authority%rowtype; --Added by Chong for bug#16414088 eTDS ER
8510: ln_threshold_trx_id jai_ap_tds_thhold_trxs.threshold_trx_id%type;
8511: ln_invoice_id ap_invoices_all.invoice_id%type;
8512: l_api_name CONSTANT VARCHAR2(50) := 'populate_tds_invoice_id()';
8513:
8514: begin
8515: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_PROCEDURE, G_MODULE_NAME||l_api_name||'.BEGIN', G_PKG_NAME || ': '||l_api_name||'()+');

Line 8765: from ap_invoices_all

8761:
8762: -- Bug 5722028. Added by Lakshmi Gopalsami
8763: cursor get_creation_date is
8764: select creation_date
8765: from ap_invoices_all
8766: where invoice_id = p_invoice_id;
8767: ld_creation_date DATE;
8768: -- End for bug 5722028.
8769:

Line 8875: ap_invoices_all b

8871: b.invoice_currency_code,
8872: b.exchange_rate,
8873: b.set_of_books_id
8874: FROM ap_invoice_distributions_all a,
8875: ap_invoices_all b
8876: WHERE a.invoice_id = b.invoice_id
8877: AND b.invoice_id = p_invoice_id
8878: AND a.line_type_lookup_code = 'PREPAY'
8879: AND b.source <> 'TDS'

Line 9024: FROM ap_invoices_all

9020: /*Get Natural account by CCID --->*/
9021: CURSOR cur_get_invoice_info IS
9022: SELECT set_of_books_id
9023: ,legal_entity_id
9024: FROM ap_invoices_all
9025: WHERE invoice_id = p_invoice_id;
9026: /*Get distribution id by section code and*/
9027: CURSOR c_distribution_id(p_invoice_id NUMBER,
9028: p_section_type VARCHAR2,

Line 9363: FROM ap_invoices_all

9359: );
9360:
9361: CURSOR c_get_invoice_num(cn_invoice_id NUMBER) IS
9362: SELECT invoice_num
9363: FROM ap_invoices_all
9364: WHERE invoice_id = cn_invoice_id;
9365:
9366: CURSOR c_ap_invoices_all(p_invoice_id number) is
9367: SELECT invoice_id,

Line 9366: CURSOR c_ap_invoices_all(p_invoice_id number) is

9362: SELECT invoice_num
9363: FROM ap_invoices_all
9364: WHERE invoice_id = cn_invoice_id;
9365:
9366: CURSOR c_ap_invoices_all(p_invoice_id number) is
9367: SELECT invoice_id,
9368: cancelled_date,
9369: payment_status_flag,
9370: invoice_amount,

Line 9374: FROM ap_invoices_all

9370: invoice_amount,
9371: set_of_books_id,
9372: invoice_num,
9373: org_id
9374: FROM ap_invoices_all
9375: Where invoice_id = p_invoice_id;
9376:
9377: CURSOR c_get_surcharge_trxs IS
9378: SELECT threshold_trx_id,

Line 9396: CURSOR get_dist_gl_date(cp_invoice_id IN ap_invoices_all.invoice_id%TYPE) IS

9392: AND TDS_EVENT LIKE 'SURCHARGE_CALCULATE'
9393: AND THRESHOLD_GRP_ID = p_threshold_grp_id
9394: ORDER BY threshold_trx_id;
9395:
9396: CURSOR get_dist_gl_date(cp_invoice_id IN ap_invoices_all.invoice_id%TYPE) IS
9397: SELECT accounting_date
9398: ,creation_date --Added by Chong for Bug#13802244 2012/09/17
9399: FROM ap_invoice_distributions_all
9400: WHERE invoice_id = cp_invoice_id

Line 9405: CURSOR c_get_lines_acct_date(cp_invoice_id IN ap_invoices_all.invoice_id%TYPE) IS

9401: AND distribution_line_number = 1;
9402:
9403: /*Get Accounting Date from AP_INVOICE_LINES_ALL.
9404: This is fail safe if Distributions does not have accounting date*/
9405: CURSOR c_get_lines_acct_date(cp_invoice_id IN ap_invoices_all.invoice_id%TYPE) IS
9406: SELECT accounting_date
9407: ,creation_date --Added by Chong for Bug#13802244 2012/09/17
9408: FROM ap_invoice_lines_all
9409: WHERE invoice_id = cp_invoice_id

Line 9428: ,ap_invoices_all aia

9424: ,aia.exchange_rate
9425: ,aia.set_of_books_id
9426: ,aia.org_id
9427: FROM jai_ap_tds_thhold_trxs jattt
9428: ,ap_invoices_all aia
9429: WHERE aia.invoice_id = jattt.invoice_id
9430: AND jattt.threshold_grp_id = p_threshold_grp_id
9431: AND NVL(jattt.tds_rollbacked,'N') = 'Y'
9432: AND tds_section_code is not null

Line 9469: lv_tds_invoice_num ap_invoices_all.invoice_num%TYPE;

9465: ln_taxable_amount NUMBER;
9466: ln_tax_amount NUMBER;
9467: ln_tax_category_id NUMBER;
9468: ln_threshold_trx_id NUMBER;
9469: lv_tds_invoice_num ap_invoices_all.invoice_num%TYPE;
9470: lv_cm_invoice_num ap_invoices_all.invoice_num%TYPE;
9471: lv_section_type JAI_AP_TDS_INV_TAXES.section_type%TYPE;
9472: lv_section_code JAI_AP_TDS_INV_TAXES.actual_section_code%TYPE;
9473: lv_prepay_invoice_num ap_invoices_all.invoice_num%TYPE;

Line 9470: lv_cm_invoice_num ap_invoices_all.invoice_num%TYPE;

9466: ln_tax_amount NUMBER;
9467: ln_tax_category_id NUMBER;
9468: ln_threshold_trx_id NUMBER;
9469: lv_tds_invoice_num ap_invoices_all.invoice_num%TYPE;
9470: lv_cm_invoice_num ap_invoices_all.invoice_num%TYPE;
9471: lv_section_type JAI_AP_TDS_INV_TAXES.section_type%TYPE;
9472: lv_section_code JAI_AP_TDS_INV_TAXES.actual_section_code%TYPE;
9473: lv_prepay_invoice_num ap_invoices_all.invoice_num%TYPE;
9474: lv_prepay_invoice_id NUMBER;

Line 9473: lv_prepay_invoice_num ap_invoices_all.invoice_num%TYPE;

9469: lv_tds_invoice_num ap_invoices_all.invoice_num%TYPE;
9470: lv_cm_invoice_num ap_invoices_all.invoice_num%TYPE;
9471: lv_section_type JAI_AP_TDS_INV_TAXES.section_type%TYPE;
9472: lv_section_code JAI_AP_TDS_INV_TAXES.actual_section_code%TYPE;
9473: lv_prepay_invoice_num ap_invoices_all.invoice_num%TYPE;
9474: lv_prepay_invoice_id NUMBER;
9475: ln_threshold_grp_audit_id NUMBER;
9476: lv_codepath jai_ap_tds_inv_taxes.codepath%TYPE;
9477: r_ap_invoices_all_au c_ap_invoices_all%ROWTYPE;

Line 9477: r_ap_invoices_all_au c_ap_invoices_all%ROWTYPE;

9473: lv_prepay_invoice_num ap_invoices_all.invoice_num%TYPE;
9474: lv_prepay_invoice_id NUMBER;
9475: ln_threshold_grp_audit_id NUMBER;
9476: lv_codepath jai_ap_tds_inv_taxes.codepath%TYPE;
9477: r_ap_invoices_all_au c_ap_invoices_all%ROWTYPE;
9478: r_ap_invoices_all_cm c_ap_invoices_all%ROWTYPE;
9479: lb_return_value BOOLEAN;
9480: ld_accounting_date DATE;
9481: ld_creation_date DATE; --Added by Chong for Bug#13802244 2012/09/17

Line 9478: r_ap_invoices_all_cm c_ap_invoices_all%ROWTYPE;

9474: lv_prepay_invoice_id NUMBER;
9475: ln_threshold_grp_audit_id NUMBER;
9476: lv_codepath jai_ap_tds_inv_taxes.codepath%TYPE;
9477: r_ap_invoices_all_au c_ap_invoices_all%ROWTYPE;
9478: r_ap_invoices_all_cm c_ap_invoices_all%ROWTYPE;
9479: lb_return_value BOOLEAN;
9480: ld_accounting_date DATE;
9481: ld_creation_date DATE; --Added by Chong for Bug#13802244 2012/09/17
9482: lv_open_period ap_invoice_distributions_all.period_name%TYPE;

Line 9485: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;

9481: ld_creation_date DATE; --Added by Chong for Bug#13802244 2012/09/17
9482: lv_open_period ap_invoice_distributions_all.period_name%TYPE;
9483: ld_ret_accounting_date DATE;
9484: lv_token VARCHAR2(4000);
9485: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
9486: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
9487: lv_tds_credit_memo_flag varchar2(1);
9488: lv_tds_credit_memo_message varchar2(250);
9489: lv_process_flag varchar2(1);

Line 9486: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;

9482: lv_open_period ap_invoice_distributions_all.period_name%TYPE;
9483: ld_ret_accounting_date DATE;
9484: lv_token VARCHAR2(4000);
9485: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
9486: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
9487: lv_tds_credit_memo_flag varchar2(1);
9488: lv_tds_credit_memo_message varchar2(250);
9489: lv_process_flag varchar2(1);
9490: lv_process_message varchar2(250);

Line 9769: r_ap_invoices_all_au := NULL;

9765:
9766: --Fetch the Surcharge Invoice from JAI_AP_TDS_THHOLD_TRXS
9767: FOR cur_rec IN c_get_surcharge_trxs
9768: LOOP
9769: r_ap_invoices_all_au := NULL;
9770: r_ap_invoices_all_cm := NULL;
9771: /* Get the details of the Invoice to TDS authority invoice*/
9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);
9773: FETCH c_ap_invoices_all

Line 9770: r_ap_invoices_all_cm := NULL;

9766: --Fetch the Surcharge Invoice from JAI_AP_TDS_THHOLD_TRXS
9767: FOR cur_rec IN c_get_surcharge_trxs
9768: LOOP
9769: r_ap_invoices_all_au := NULL;
9770: r_ap_invoices_all_cm := NULL;
9771: /* Get the details of the Invoice to TDS authority invoice*/
9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);
9773: FETCH c_ap_invoices_all
9774: INTO r_ap_invoices_all_au;

Line 9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);

9768: LOOP
9769: r_ap_invoices_all_au := NULL;
9770: r_ap_invoices_all_cm := NULL;
9771: /* Get the details of the Invoice to TDS authority invoice*/
9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);
9773: FETCH c_ap_invoices_all
9774: INTO r_ap_invoices_all_au;
9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/

Line 9773: FETCH c_ap_invoices_all

9769: r_ap_invoices_all_au := NULL;
9770: r_ap_invoices_all_cm := NULL;
9771: /* Get the details of the Invoice to TDS authority invoice*/
9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);
9773: FETCH c_ap_invoices_all
9774: INTO r_ap_invoices_all_au;
9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);

Line 9774: INTO r_ap_invoices_all_au;

9770: r_ap_invoices_all_cm := NULL;
9771: /* Get the details of the Invoice to TDS authority invoice*/
9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);
9773: FETCH c_ap_invoices_all
9774: INTO r_ap_invoices_all_au;
9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);
9778: FETCH c_ap_invoices_all

Line 9775: CLOSE c_ap_invoices_all;

9771: /* Get the details of the Invoice to TDS authority invoice*/
9772: OPEN c_ap_invoices_all(cur_rec.invoice_to_tds_authority_id);
9773: FETCH c_ap_invoices_all
9774: INTO r_ap_invoices_all_au;
9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);
9778: FETCH c_ap_invoices_all
9779: INTO r_ap_invoices_all_cm;

Line 9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);

9773: FETCH c_ap_invoices_all
9774: INTO r_ap_invoices_all_au;
9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);
9778: FETCH c_ap_invoices_all
9779: INTO r_ap_invoices_all_cm;
9780: CLOSE c_ap_invoices_all;
9781:

Line 9778: FETCH c_ap_invoices_all

9774: INTO r_ap_invoices_all_au;
9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);
9778: FETCH c_ap_invoices_all
9779: INTO r_ap_invoices_all_cm;
9780: CLOSE c_ap_invoices_all;
9781:
9782: /*Derivced the accounting_date of the original distribution

Line 9779: INTO r_ap_invoices_all_cm;

9775: CLOSE c_ap_invoices_all;
9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);
9778: FETCH c_ap_invoices_all
9779: INTO r_ap_invoices_all_cm;
9780: CLOSE c_ap_invoices_all;
9781:
9782: /*Derivced the accounting_date of the original distribution
9783: * as this value is also getting passed for Threshold adjustments if the

Line 9780: CLOSE c_ap_invoices_all;

9776: /* Get the details of the Invoice to CM invoice*/
9777: OPEN c_ap_invoices_all(cur_rec.invoice_to_vendor_id);
9778: FETCH c_ap_invoices_all
9779: INTO r_ap_invoices_all_cm;
9780: CLOSE c_ap_invoices_all;
9781:
9782: /*Derivced the accounting_date of the original distribution
9783: * as this value is also getting passed for Threshold adjustments if the
9784: * TDS invoice is already paid/cancelled.

Line 9786: OPEN get_dist_gl_date(r_ap_invoices_all_au.invoice_id);

9782: /*Derivced the accounting_date of the original distribution
9783: * as this value is also getting passed for Threshold adjustments if the
9784: * TDS invoice is already paid/cancelled.
9785: */
9786: OPEN get_dist_gl_date(r_ap_invoices_all_au.invoice_id);
9787: FETCH get_dist_gl_date
9788: INTO ld_accounting_date, ld_creation_date; --Added creation_date by Chong for Bug#13802244 2012/09/17
9789: CLOSE get_dist_gl_date;
9790:

Line 9793: OPEN c_get_lines_acct_date(r_ap_invoices_all_au.invoice_id);

9789: CLOSE get_dist_gl_date;
9790:
9791: /*Fetch Accouting Date from AP_INVOICE_LINES_ALL if Distributions are not saved yet*/
9792: IF (ld_accounting_date IS NULL) THEN
9793: OPEN c_get_lines_acct_date(r_ap_invoices_all_au.invoice_id);
9794: FETCH c_get_lines_acct_date
9795: INTO ld_accounting_date, ld_creation_date; --Added creation_date by Chong for Bug#13802244 2012/09/17
9796: CLOSE c_get_lines_acct_date;
9797: END IF;

Line 9800: IF r_ap_invoices_all_au.payment_status_flag <> 'N' THEN

9796: CLOSE c_get_lines_acct_date;
9797: END IF;
9798:
9799: /* Check if the TDS invoice is paid, no processing is required if it is already paid. */
9800: IF r_ap_invoices_all_au.payment_status_flag <> 'N' THEN
9801:
9802: /*lv_tds_invoice_flag := 'X';
9803: lv_tds_invoice_message := 'Invoice to TDS Authority is already paid.';
9804: lv_tds_credit_memo_flag := 'X';

Line 9815: if r_ap_invoices_all_au.cancelled_date is not null then

9811:
9812: /* Check if the invoice to TDS authority is already canccelled,
9813: if yes, no need to do the cancel processing of the invoice */
9814: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath); /* 5 */
9815: if r_ap_invoices_all_au.cancelled_date is not null then
9816: lv_codepath := jai_general_pkg.plot_codepath(6,lv_codepath); /* 6 */
9817: lv_tds_invoice_flag := 'X';
9818: lv_tds_invoice_message := ' Invoice to TDS Authority is already Cancelled.';
9819: goto credit_memo_processing;

Line 9845: P_Org_Id => r_ap_invoices_all_au.org_id);

9841: | created for cancellation.
9842: */
9843: --Check if the given date is in current open period
9844: lv_open_period := ap_utilities_pkg.get_current_gl_date(P_Date => ld_accounting_date,
9845: P_Org_Id => r_ap_invoices_all_au.org_id);
9846: if lv_open_period is null then
9847:
9848: lv_codepath := jai_general_pkg.plot_codepath(1.1, lv_codepath); /* 1.1 */
9849:

Line 9853: P_Org_Id => r_ap_invoices_all_au.org_id);

9849:
9850: ap_utilities_pkg.get_open_gl_date(p_date => ld_accounting_date, /* In date */
9851: p_period_name => lv_open_period, /* out Period */
9852: p_gl_date => ld_accounting_date, /* out date */
9853: P_Org_Id => r_ap_invoices_all_au.org_id);
9854:
9855: if lv_open_period is null then
9856: lv_codepath := jai_general_pkg.plot_codepath(1.2,lv_codepath); /* 1.2 */
9857: lv_process_flag := 'E';

Line 9866: mo_global.set_policy_context('S', r_ap_invoices_all_au.org_id);

9862:
9863: end if; /* lv_open_period is null */
9864: ld_ret_accounting_date := NULL;
9865:
9866: mo_global.set_policy_context('S', r_ap_invoices_all_au.org_id);
9867:
9868: lb_return_value := ap_cancel_pkg.ap_cancel_single_invoice(P_invoice_id => cur_rec.invoice_to_tds_authority_id,
9869: P_last_updated_by => fnd_global.user_id,
9870: P_last_update_login => fnd_global.login_id,

Line 9898: update ap_invoices_all

9894: EXCEPTION_CODE => NULL,
9895: EXCEPTION_TEXT => lv_token);
9896: End if;
9897:
9898: update ap_invoices_all
9899: set invoice_amount = ln_out_invoice_amount,
9900: base_amount = ln_out_base_amount,
9901: temp_cancelled_amount = ln_out_temp_cancelled_amount,
9902: cancelled_by = ln_out_cancelled_by,

Line 9922: OPEN get_dist_gl_date(r_ap_invoices_all_cm.invoice_id);

9918: /*Derivced the accounting_date of the original distribution
9919: * as this value is also getting passed for Threshold adjustments if the
9920: * TDS CM invoice is already paid/cancelled.
9921: */
9922: OPEN get_dist_gl_date(r_ap_invoices_all_cm.invoice_id);
9923: FETCH get_dist_gl_date
9924: INTO ld_accounting_date, ld_creation_date; --Added creation_date by Chong for Bug#13802244 2012/09/17
9925: CLOSE get_dist_gl_date;
9926:

Line 9929: OPEN c_get_lines_acct_date(r_ap_invoices_all_cm.invoice_id);

9925: CLOSE get_dist_gl_date;
9926:
9927: /*Fetch Accouting Date from AP_INVOICE_LINES_ALL if Distributions are not saved yet*/
9928: if (ld_accounting_date is NULL) then
9929: OPEN c_get_lines_acct_date(r_ap_invoices_all_cm.invoice_id);
9930: FETCH c_get_lines_acct_date
9931: INTO ld_accounting_date, ld_creation_date; --Added creation_date by Chong for Bug#13802244 2012/09/17
9932: CLOSE c_get_lines_acct_date;
9933: end if;

Line 9938: if r_ap_invoices_all_cm.cancelled_date is not null then

9934:
9935: /* Check if the Credit memo to the supplier for TDS already canccelled,
9936: if yes, no need to cancel it again here */
9937:
9938: if r_ap_invoices_all_cm.cancelled_date is not null then
9939: lv_codepath := jai_general_pkg.plot_codepath(10,
9940: lv_codepath); /* 10 */
9941: lv_tds_credit_memo_flag := 'X';
9942: lv_tds_credit_memo_message := 'Credit memo to the supplier for TDS is already Cancelled.';

Line 9948: IF r_ap_invoices_all_cm.payment_status_flag = 'N' THEN

9944: end if;
9945:
9946: /*Check if the Credit memo to the supplier for TDS is paid,
9947: if yes a separate invoice needs to be generated, or else the same credit memo can be cancelled */
9948: IF r_ap_invoices_all_cm.payment_status_flag = 'N' THEN
9949: lv_codepath := jai_general_pkg.plot_codepath(11, lv_codepath); /* 11 */
9950: /* Credit memo not paid, can cancel the same */
9951: lv_tds_credit_memo_flag := 'Y';
9952: lv_tds_credit_memo_message := 'Cancelling Credit memo to the supplier for TDS as it is not paid ';

Line 9976: P_Org_Id => r_ap_invoices_all_cm.org_id);

9972: | created for cancellation.
9973: */
9974: --Check if the given date is in current open period
9975: lv_open_period := ap_utilities_pkg.get_current_gl_date(P_Date => ld_accounting_date,
9976: P_Org_Id => r_ap_invoices_all_cm.org_id);
9977: if lv_open_period is null then
9978:
9979: lv_codepath := jai_general_pkg.plot_codepath(1.1, lv_codepath); /* 1.1 */
9980:

Line 9984: P_Org_Id => r_ap_invoices_all_cm.org_id);

9980:
9981: ap_utilities_pkg.get_open_gl_date(p_date => ld_accounting_date, /* In date */
9982: p_period_name => lv_open_period, /* out Period */
9983: p_gl_date => ld_accounting_date, /* out date */
9984: P_Org_Id => r_ap_invoices_all_cm.org_id);
9985:
9986: if lv_open_period is null then
9987: lv_codepath := jai_general_pkg.plot_codepath(1.2,
9988: lv_codepath); /* 1.2 */

Line 9998: mo_global.set_policy_context('S', r_ap_invoices_all_cm.org_id);

9994: ld_accounting_date := ld_ret_accounting_date;
9995: end if; /* lv_open_period is null */
9996: ld_ret_accounting_date := NULL;
9997:
9998: mo_global.set_policy_context('S', r_ap_invoices_all_cm.org_id);
9999:
10000: lb_return_value := ap_cancel_pkg.ap_cancel_single_invoice(P_invoice_id => r_ap_invoices_all_cm.invoice_id,
10001: P_last_updated_by => fnd_global.user_id,
10002: P_last_update_login => fnd_global.login_id,

Line 10000: lb_return_value := ap_cancel_pkg.ap_cancel_single_invoice(P_invoice_id => r_ap_invoices_all_cm.invoice_id,

9996: ld_ret_accounting_date := NULL;
9997:
9998: mo_global.set_policy_context('S', r_ap_invoices_all_cm.org_id);
9999:
10000: lb_return_value := ap_cancel_pkg.ap_cancel_single_invoice(P_invoice_id => r_ap_invoices_all_cm.invoice_id,
10001: P_last_updated_by => fnd_global.user_id,
10002: P_last_update_login => fnd_global.login_id,
10003: P_accounting_date => ld_accounting_date,
10004: P_message_name => lv_out_message_name,

Line 10027: update ap_invoices_all

10023: EXCEPTION_CODE => NULL,
10024: EXCEPTION_TEXT => lv_token);
10025: End if;
10026:
10027: update ap_invoices_all
10028: set invoice_amount = ln_out_invoice_amount,
10029: base_amount = ln_out_base_amount,
10030: temp_cancelled_amount = ln_out_temp_cancelled_amount,
10031: cancelled_by = ln_out_cancelled_by,

Line 10048: pv_invoice_num_to_vendor_can => r_ap_invoices_all_cm.invoice_num,

10044: lv_invoice_to_tds_num := null;
10045: lv_invoice_to_vendor_num := null;
10046:
10047: jai_ap_dtc_generation_pkg.generate_dtc_invoices(pn_invoice_id => cur_rec.invoice_id,
10048: pv_invoice_num_to_vendor_can => r_ap_invoices_all_cm.invoice_num,
10049: pn_taxable_amount => cur_rec.taxable_amount,
10050: pn_tax_amount => cur_rec.tax_amount,
10051: pn_tax_category_id => cur_rec.tax_category_id,
10052: pv_section_type => lv_section_type, -- 'TDS_SECTION_TYPE'

Line 10134: FROM AP_INVOICES_ALL aia

10130: AND jcta.tax_type = 'TDS_SURCHARGE'
10131: )
10132: AND NOT EXISTS(
10133: SELECT 1
10134: FROM AP_INVOICES_ALL aia
10135: WHERE aia.invoice_id = jattt.invoice_id
10136: AND aia.cancelled_date IS NOT NULL
10137: )
10138: ;

Line 10145: ,AP_INVOICES_ALL aia

10141: FROM AP_INVOICE_LINES_ALL aila
10142: WHERE INVOICE_ID IN (
10143: SELECT NVL(jattt.invoice_to_tds_authority_id, jattt.invoice_to_vendor_id)
10144: FROM JAI_AP_TDS_THHOLD_TRXS jattt
10145: ,AP_INVOICES_ALL aia
10146: WHERE jattt.invoice_id = aia.invoice_id
10147: AND jattt.tds_event NOT in (G_SURCHARGE_CALCULATE)
10148: AND aia.cancelled_date IS NULL
10149: AND jattt.tds_rollbacked IS NULL

Line 10296: cursor c_ap_invoices_all(cp_invoice_id number) is

10292: p_codepath in out nocopy varchar2
10293: )
10294: is
10295:
10296: cursor c_ap_invoices_all(cp_invoice_id number) is
10297: select invoice_num,
10298: invoice_id,
10299: vendor_id,
10300: vendor_site_id,

Line 10315: from ap_invoices_all

10311: nvl(exchange_rate, 1) exchange_rate,
10312: set_of_books_id,
10313: payment_method_code, -- Bug 7109056
10314: accts_pay_code_combination_id -- Bug 9759709
10315: from ap_invoices_all
10316: where invoice_id = cp_invoice_id;
10317:
10318: cursor c_po_vendor_sites_all(cp_vendor_id number, cp_vendor_site_id number) is
10319: select terms_id,

Line 10370: r_ap_invoices_all c_ap_invoices_all%rowtype;

10366: select payment_priority
10367: from ap_payment_schedules_all
10368: where invoice_id = p_invoice_id;
10369:
10370: r_ap_invoices_all c_ap_invoices_all%rowtype;
10371: r_ja_in_tax_codes c_ja_in_tax_codes%rowtype;
10372: r_po_vendor_sites_all c_po_vendor_sites_all%rowtype;
10373: r_po_vendors c_po_vendors%rowtype;
10374: r_gl_sets_of_books c_gl_sets_of_books%rowtype;

Line 10380: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;

10376:
10377:
10378: lv_source varchar2(30); --File.Sql.35 Cbabu := 'TDS';
10379:
10380: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
10381: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
10382:
10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;

Line 10381: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;

10377:
10378: lv_source varchar2(30); --File.Sql.35 Cbabu := 'TDS';
10379:
10380: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
10381: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
10382:
10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
10385:

Line 10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;

10379:
10380: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
10381: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
10382:
10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
10385:
10386: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
10387: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;

Line 10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;

10380: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
10381: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
10382:
10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
10385:
10386: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
10387: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
10388:

Line 10386: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;

10382:
10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
10385:
10386: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
10387: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
10388:
10389: ln_invoice_to_tds_line_id ap_invoice_lines_interface.invoice_line_id%type;
10390: ln_invoice_to_vendor_line_id ap_invoice_lines_interface.invoice_line_id%type;

Line 10387: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;

10383: lv_invoice_to_tds_type ap_invoices_all.invoice_type_lookup_code%type;
10384: lv_invoice_to_vendor_type ap_invoices_all.invoice_type_lookup_code%type;
10385:
10386: ln_invoice_to_tds_id ap_invoices_all.invoice_id%type;
10387: ln_invoice_to_vendor_id ap_invoices_all.invoice_id%type;
10388:
10389: ln_invoice_to_tds_line_id ap_invoice_lines_interface.invoice_line_id%type;
10390: ln_invoice_to_vendor_line_id ap_invoice_lines_interface.invoice_line_id%type;
10391:

Line 10410: lv_invoice_num ap_invoices_all.invoice_num%type;

10406: ld_accounting_date date;
10407: lv_open_period ap_invoice_distributions_all.period_name%type;
10408: ln_tax_amount number;
10409:
10410: lv_invoice_num ap_invoices_all.invoice_num%type;
10411: lv_source_attribute jai_ap_tds_invoices.source_attribute%TYPE ; --rchandan for bug#4428980
10412:
10413: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801
10414:

Line 10413: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801

10409:
10410: lv_invoice_num ap_invoices_all.invoice_num%type;
10411: lv_source_attribute jai_ap_tds_invoices.source_attribute%TYPE ; --rchandan for bug#4428980
10412:
10413: ln_invoice_amount ap_invoices_all.invoice_amount%TYPE; --Added by Ramananda for Bug#4562801
10414:
10415: lv_group_id VARCHAR2(80); --Added by Sanjikum for Bug#5131075(4722011)
10416:
10417: /* Bug 5722028. Added by Lakshmi Gopalsami

Line 10516: open c_ap_invoices_all(pn_invoice_id);

10512: p_process_message := 'TDS amount must be greater than 0 ';
10513: goto exit_from_procedure;
10514: end if;
10515:
10516: open c_ap_invoices_all(pn_invoice_id);
10517: fetch c_ap_invoices_all into r_ap_invoices_all;
10518: close c_ap_invoices_all;
10519:
10520:

Line 10517: fetch c_ap_invoices_all into r_ap_invoices_all;

10513: goto exit_from_procedure;
10514: end if;
10515:
10516: open c_ap_invoices_all(pn_invoice_id);
10517: fetch c_ap_invoices_all into r_ap_invoices_all;
10518: close c_ap_invoices_all;
10519:
10520:
10521: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);

Line 10518: close c_ap_invoices_all;

10514: end if;
10515:
10516: open c_ap_invoices_all(pn_invoice_id);
10517: fetch c_ap_invoices_all into r_ap_invoices_all;
10518: close c_ap_invoices_all;
10519:
10520:
10521: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);
10522: fetch c_gl_sets_of_books into r_gl_sets_of_books;

Line 10521: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);

10517: fetch c_ap_invoices_all into r_ap_invoices_all;
10518: close c_ap_invoices_all;
10519:
10520:
10521: open c_gl_sets_of_books(r_ap_invoices_all.set_of_books_id);
10522: fetch c_gl_sets_of_books into r_gl_sets_of_books;
10523: close c_gl_sets_of_books;
10524:
10525: /*Bug # 7410219 - Derive the Section Name*/

Line 10542: lv_invoice_num := substr(r_ap_invoices_all.invoice_num, 1, 30);

10538: open c_get_ja_in_ap_inv_id;
10539: fetch c_get_ja_in_ap_inv_id into lv_ja_in_ap_inv_id;
10540: close c_get_ja_in_ap_inv_id;
10541:
10542: lv_invoice_num := substr(r_ap_invoices_all.invoice_num, 1, 30);
10543:
10544: /*Only for threshold rollback*/
10545: if pv_tds_event like 'THRESHOLD ROLLBACK%' then
10546:

Line 10568: r_ap_invoices_all.org_id

10564: Added org_id to ap_utilities_pkg
10565: */
10566: lv_open_period:= ap_utilities_pkg.get_current_gl_date
10567: (pd_accounting_date,
10568: r_ap_invoices_all.org_id
10569: );
10570:
10571: /* Bug 4559756. Added by Lakshmi Gopalsami
10572: Added org_id to ap_utilities_pkg

Line 10582: r_ap_invoices_all.org_id

10578: (
10579: pd_accounting_date,
10580: lv_open_period,
10581: ld_accounting_date,
10582: r_ap_invoices_all.org_id
10583: );
10584:
10585: if lv_open_period is null then
10586: p_process_flag := 'E';

Line 10597: pv_invoice_date := r_ap_invoices_all.invoice_date; --Added by Bgowrava for Bug#9186263

10593: end if; /* ld_accounting_date */
10594:
10595:
10596: lv_group_id := to_char(pn_invoice_id);
10597: pv_invoice_date := r_ap_invoices_all.invoice_date; --Added by Bgowrava for Bug#9186263
10598:
10599:
10600: -- ln_invoice_to_tds_amount := ROUND(ln_invoice_to_tds_amount,0);
10601: /* Bug 5722028. Added by csahoo

Line 10633: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3

10629: END IF ; -- pv_tds_event not in
10630: if lv_invoice_to_vendor_num is not null and lv_invoice_to_vendor_type is not null then
10631:
10632: IF pv_tds_event = 'PREPAYMENT UNAPPLICATION' THEN --2
10633: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3
10634: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
10635: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date) THEN
10636: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
10637: END IF;

Line 10638: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

10634: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
10635: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date) THEN
10636: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
10637: END IF;
10638: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
10639: END IF; --3
10640:
10641: ELSE --2
10642:

Line 10643: if r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code then

10639: END IF; --3
10640:
10641: ELSE --2
10642:
10643: if r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code then
10644: /*START, Bgowrava for Bug#8995604 , Adding below IF statement to round the INR TDS CM invoice to
10645: the TDS rounding factor before converting it to a foreign currency CM*/
10646: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
10647: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)

Line 10653: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

10649:
10650: ln_invoice_to_vendor_amount := get_rnded_value(ln_invoice_to_vendor_amount);
10651: END IF;
10652: /*END, Bgowrava for Bug#8995604 */
10653: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
10654: ELSE
10655: ln_invoice_to_vendor_amount := round( ln_invoice_to_vendor_amount, g_inr_currency_rounding);
10656: /*START, Bgowrava for Bug#8995604 , Adding below IF statement to round the INR TDS CM invoice to the TDS rounding factor*/
10657: IF trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)

Line 10676: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then

10672: );
10673:
10674: END IF;
10675:
10676: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then
10677: ln_exchange_rate := r_ap_invoices_all.exchange_rate;
10678: else
10679: ln_exchange_rate := null;
10680: end if;

Line 10677: ln_exchange_rate := r_ap_invoices_all.exchange_rate;

10673:
10674: END IF;
10675:
10676: if upper(r_ap_invoices_all.exchange_rate_type) = 'USER' then
10677: ln_exchange_rate := r_ap_invoices_all.exchange_rate;
10678: else
10679: ln_exchange_rate := null;
10680: end if;
10681:

Line 10697: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then

10693: /*Bug 9759709 - Liability Account for the Credit Note must be fetched from the Standard Invoice
10694: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
10695: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
10696: from setup*/
10697: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
10698: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
10699: else
10700: ln_accts_pay_ccid := NULL;
10701: end if;

Line 10698: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;

10694: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
10695: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
10696: from setup*/
10697: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
10698: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
10699: else
10700: ln_accts_pay_ccid := NULL;
10701: end if;
10702: end if;

Line 10793: p_org_id => r_ap_invoices_all.org_id,

10789: p_created_by => fnd_global.user_id,
10790: p_source => lv_source,
10791: p_voucher_num => lv_invoice_to_tds_num,
10792: p_pay_group_lookup_code => lv_pay_group_lookup_code,
10793: p_org_id => r_ap_invoices_all.org_id,
10794: p_attribute_category => 'India Original Invoice for TDS',
10795: p_group_id => lv_group_id,
10796: p_Calc_Tax_During_Import_Flag => 'Y' --Added by Qiong for AP Open Interface
10797: );

Line 10865: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then

10861: If it is not present, then it needs to be defaulted from Vendor Site Setup. Passing NULL to
10862: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
10863: from setup*/
10864: /*there will be only one liability Account in one threshold group*/
10865: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
10866: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
10867: else
10868: ln_accts_pay_ccid := NULL;
10869: end if;

Line 10866: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;

10862: parameter p_accts_pay_ccid in jai_ap_utils_pkg.insert_ap_inv_interface would cause it to default
10863: from setup*/
10864: /*there will be only one liability Account in one threshold group*/
10865: if (r_ap_invoices_all.accts_pay_code_combination_id is not NULL) then
10866: ln_accts_pay_ccid := r_ap_invoices_all.accts_pay_code_combination_id;
10867: else
10868: ln_accts_pay_ccid := NULL;
10869: end if;
10870: /* Invoices Interface */

Line 10878: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263

10874: p_jai_source => lv_this_procedure,
10875: p_invoice_id => ln_invoice_to_vendor_id,
10876: p_invoice_num => lv_invoice_to_vendor_num,
10877: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
10878: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
10879: p_gl_date => ld_accounting_date,
10880: p_vendor_id => r_ap_invoices_all.vendor_id,
10881: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
10882: p_invoice_amount => ln_invoice_to_vendor_amount,

Line 10880: p_vendor_id => r_ap_invoices_all.vendor_id,

10876: p_invoice_num => lv_invoice_to_vendor_num,
10877: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
10878: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
10879: p_gl_date => ld_accounting_date,
10880: p_vendor_id => r_ap_invoices_all.vendor_id,
10881: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
10882: p_invoice_amount => ln_invoice_to_vendor_amount,
10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
10884: p_exchange_rate => NULL, --ln_exchange_rate,

Line 10881: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,

10877: p_invoice_type_lookup_code => lv_invoice_to_vendor_type,
10878: p_invoice_date => pv_invoice_date,--r_ap_invoices_all.invoice_date, --Modified to ld_accounting_date for Bug#9186263
10879: p_gl_date => ld_accounting_date,
10880: p_vendor_id => r_ap_invoices_all.vendor_id,
10881: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
10882: p_invoice_amount => ln_invoice_to_vendor_amount,
10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
10884: p_exchange_rate => NULL, --ln_exchange_rate,
10885: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,

Line 10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,

10879: p_gl_date => ld_accounting_date,
10880: p_vendor_id => r_ap_invoices_all.vendor_id,
10881: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
10882: p_invoice_amount => ln_invoice_to_vendor_amount,
10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
10884: p_exchange_rate => NULL, --ln_exchange_rate,
10885: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
10886: p_exchange_date => r_ap_invoices_all.exchange_date,
10887: p_terms_id => r_ap_invoices_all.terms_id,

Line 10885: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,

10881: p_vendor_site_id => r_ap_invoices_all.vendor_site_id,
10882: p_invoice_amount => ln_invoice_to_vendor_amount,
10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
10884: p_exchange_rate => NULL, --ln_exchange_rate,
10885: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
10886: p_exchange_date => r_ap_invoices_all.exchange_date,
10887: p_terms_id => r_ap_invoices_all.terms_id,
10888: p_description => lv_invoice_to_vendor_num,
10889: p_last_update_date => sysdate,

Line 10886: p_exchange_date => r_ap_invoices_all.exchange_date,

10882: p_invoice_amount => ln_invoice_to_vendor_amount,
10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
10884: p_exchange_rate => NULL, --ln_exchange_rate,
10885: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
10886: p_exchange_date => r_ap_invoices_all.exchange_date,
10887: p_terms_id => r_ap_invoices_all.terms_id,
10888: p_description => lv_invoice_to_vendor_num,
10889: p_last_update_date => sysdate,
10890: p_last_updated_by => fnd_global.user_id,

Line 10887: p_terms_id => r_ap_invoices_all.terms_id,

10883: p_invoice_currency_code => r_ap_invoices_all.invoice_currency_code,
10884: p_exchange_rate => NULL, --ln_exchange_rate,
10885: p_exchange_rate_type => r_ap_invoices_all.exchange_rate_type,
10886: p_exchange_date => r_ap_invoices_all.exchange_date,
10887: p_terms_id => r_ap_invoices_all.terms_id,
10888: p_description => lv_invoice_to_vendor_num,
10889: p_last_update_date => sysdate,
10890: p_last_updated_by => fnd_global.user_id,
10891: p_last_update_login => fnd_global.login_id,

Line 10896: p_payment_method_code => r_ap_invoices_all.payment_method_code,

10892: p_creation_date => sysdate,
10893: p_created_by => fnd_global.user_id,
10894: p_source => lv_source,
10895: p_voucher_num => lv_invoice_to_vendor_num,
10896: p_payment_method_code => r_ap_invoices_all.payment_method_code,
10897: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
10898: p_goods_received_date => r_ap_invoices_all.goods_received_date,
10899: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
10900: p_org_id => r_ap_invoices_all.org_id,

Line 10897: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,

10893: p_created_by => fnd_global.user_id,
10894: p_source => lv_source,
10895: p_voucher_num => lv_invoice_to_vendor_num,
10896: p_payment_method_code => r_ap_invoices_all.payment_method_code,
10897: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
10898: p_goods_received_date => r_ap_invoices_all.goods_received_date,
10899: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
10900: p_org_id => r_ap_invoices_all.org_id,
10901: p_attribute_category => 'India Original Invoice for TDS',

Line 10898: p_goods_received_date => r_ap_invoices_all.goods_received_date,

10894: p_source => lv_source,
10895: p_voucher_num => lv_invoice_to_vendor_num,
10896: p_payment_method_code => r_ap_invoices_all.payment_method_code,
10897: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
10898: p_goods_received_date => r_ap_invoices_all.goods_received_date,
10899: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
10900: p_org_id => r_ap_invoices_all.org_id,
10901: p_attribute_category => 'India Original Invoice for TDS',
10902: p_group_id => lv_group_id,

Line 10899: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,

10895: p_voucher_num => lv_invoice_to_vendor_num,
10896: p_payment_method_code => r_ap_invoices_all.payment_method_code,
10897: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
10898: p_goods_received_date => r_ap_invoices_all.goods_received_date,
10899: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
10900: p_org_id => r_ap_invoices_all.org_id,
10901: p_attribute_category => 'India Original Invoice for TDS',
10902: p_group_id => lv_group_id,
10903: p_accts_pay_ccid => ln_accts_pay_ccid,

Line 10900: p_org_id => r_ap_invoices_all.org_id,

10896: p_payment_method_code => r_ap_invoices_all.payment_method_code,
10897: p_pay_group_lookup_code => r_ap_invoices_all.pay_group_lookup_code,
10898: p_goods_received_date => r_ap_invoices_all.goods_received_date,
10899: p_invoice_received_date => r_ap_invoices_all.invoice_received_date,
10900: p_org_id => r_ap_invoices_all.org_id,
10901: p_attribute_category => 'India Original Invoice for TDS',
10902: p_group_id => lv_group_id,
10903: p_accts_pay_ccid => ln_accts_pay_ccid,
10904: p_Calc_Tax_During_Import_Flag => 'Y' --Added by Qiong for AP Open Interface

Line 10961: open c_ap_payment_schedules_all(r_ap_invoices_all.invoice_id);

10957: end if;
10958:
10959:
10960: /* Store the parent invoices payment priority as this is to be used in the credit memo generated for the supplier */
10961: open c_ap_payment_schedules_all(r_ap_invoices_all.invoice_id);
10962: fetch c_ap_payment_schedules_all into r_ap_payment_schedules_all;
10963: close c_ap_payment_schedules_all;
10964:
10965:

Line 10998: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3

10994: ln_tds_rnding_factor := 0;
10995: ln_tds_rnded_amt := pn_tax_amount;
10996: /* Added the below if condition for bug 12965614 */
10997: IF pv_tds_event = 'PREPAYMENT UNAPPLICATION' THEN --2
10998: IF r_ap_invoices_all.invoice_currency_code <> r_gl_sets_of_books.currency_code THEN --3
10999: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount , jai_ap_dtc_generation_pkg.g_inr_currency_rounding);
11000: IF (trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)) THEN --4
11001: ln_tds_rnding_factor := jai_ap_dtc_generation_pkg.gn_tds_rounding_factor;
11002: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);

Line 11004: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

11000: IF (trunc(pd_creation_date) >= trunc(jai_ap_dtc_generation_pkg.gd_tds_rounding_effective_date)) THEN --4
11001: ln_tds_rnding_factor := jai_ap_dtc_generation_pkg.gn_tds_rounding_factor;
11002: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);
11003: END IF; --4
11004: ln_tds_rnded_amt := ROUND(pn_calc_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
11005:
11006: END IF; --3
11007: ELSE --2
11008: /*IF pv_tds_event NOT IN

Line 11011: IF r_ap_invoices_all.invoice_currency_code = r_gl_sets_of_books.currency_code THEN

11007: ELSE --2
11008: /*IF pv_tds_event NOT IN
11009: -- Bug 7280925. commented by Lakshmi Gopalsami ('INVOICE CANCEL',
11010: ('PREPAYMENT UNAPPLICATION') THEN */
11011: IF r_ap_invoices_all.invoice_currency_code = r_gl_sets_of_books.currency_code THEN
11012: ln_tds_rnded_amt := ROUND(pn_tax_amount , jai_ap_dtc_generation_pkg.g_inr_currency_rounding);
11013: --moved this if-endif block from below to here for bug#8995604
11014: ELSE
11015: ln_tds_rnded_amt := ROUND(pn_tax_amount , jai_ap_dtc_generation_pkg.g_inr_currency_rounding);

Line 11028: ln_tds_rnded_amt := ROUND(pn_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);

11024: ln_tds_rnding_factor := jai_ap_dtc_generation_pkg.gn_tds_rounding_factor;
11025: ln_tds_rnded_amt := get_rnded_value(ln_tds_rnded_amt);
11026: --fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value after round before insert into trxs'||ln_tds_rnded_amt);
11027: END IF;
11028: ln_tds_rnded_amt := ROUND(pn_tax_amount / r_ap_invoices_all.exchange_rate, g_fcy_currency_rounding);
11029: END IF ;
11030: --fnd_file.put_line(FND_FILE.LOG, ' Bug 7280925 - value before round '||ln_tds_rnded_amt);
11031:
11032: END IF;

Line 11089: r_ap_invoices_all.vendor_id ,

11085: lv_invoice_to_tds_num ,
11086: lv_invoice_to_tds_type ,
11087: r_gl_sets_of_books.currency_code ,
11088: ln_invoice_to_tds_amount ,
11089: r_ap_invoices_all.vendor_id ,
11090: r_ap_invoices_all.vendor_site_id ,
11091: lv_invoice_to_vendor_num ,
11092: lv_invoice_to_vendor_type ,
11093: r_ap_invoices_all.invoice_currency_code ,

Line 11090: r_ap_invoices_all.vendor_site_id ,

11086: lv_invoice_to_tds_type ,
11087: r_gl_sets_of_books.currency_code ,
11088: ln_invoice_to_tds_amount ,
11089: r_ap_invoices_all.vendor_id ,
11090: r_ap_invoices_all.vendor_site_id ,
11091: lv_invoice_to_vendor_num ,
11092: lv_invoice_to_vendor_type ,
11093: r_ap_invoices_all.invoice_currency_code ,
11094: ln_invoice_to_vendor_amount ,

Line 11093: r_ap_invoices_all.invoice_currency_code ,

11089: r_ap_invoices_all.vendor_id ,
11090: r_ap_invoices_all.vendor_site_id ,
11091: lv_invoice_to_vendor_num ,
11092: lv_invoice_to_vendor_type ,
11093: r_ap_invoices_all.invoice_currency_code ,
11094: ln_invoice_to_vendor_amount ,
11095: r_ap_payment_schedules_all.payment_priority ,
11096: r_ap_invoices_all.exchange_rate ,
11097: fnd_global.user_id ,

Line 11096: r_ap_invoices_all.exchange_rate ,

11092: lv_invoice_to_vendor_type ,
11093: r_ap_invoices_all.invoice_currency_code ,
11094: ln_invoice_to_vendor_amount ,
11095: r_ap_payment_schedules_all.payment_priority ,
11096: r_ap_invoices_all.exchange_rate ,
11097: fnd_global.user_id ,
11098: sysdate ,
11099: fnd_global.user_id ,
11100: sysdate ,