1605: FROM jai_ap_tds_thhold_types
1606: WHERE threshold_hdr_id = cp_thr_hdr_id
1607: AND cp_accounting_date between nvl(from_date, cp_accounting_date) and nvl(to_date, cp_accounting_date);
1608:
1609: cursor c_po_vendors(p_vendor_id number) is
1610: select tds_vendor_type_lookup_code
1611: from JAI_AP_TDS_VNDR_TYPE_V
1612: where vendor_id = p_vendor_id;
1613: lv_vendor_type_lookup_code JAI_AP_TDS_VENDOR_HDRS.TDS_VENDOR_TYPE_LOOKUP_CODE%TYPE;
1643: --Added commented by Chong for bug#16580553 20130402 Begin
1644: -------------------------------------------------------------
1645: --by given vendor and vendor site, if already existing exception transactions, will not show normal records in JAI_AP_TDS_TH_VSITE_V.
1646: --So we can't get noraml threshold setup by vendor and vendor site. we should derive normal threshold setup by vendor type
1647: open c_po_vendors(cn_vendor_id); --Added by Chong for bug#16580553 20130402
1648: fetch c_po_vendors into lv_vendor_type_lookup_code;
1649: close c_po_vendors;
1650:
1651: open c_get_threshold_normal(lv_vendor_type_lookup_code, cv_section_code);
1644: -------------------------------------------------------------
1645: --by given vendor and vendor site, if already existing exception transactions, will not show normal records in JAI_AP_TDS_TH_VSITE_V.
1646: --So we can't get noraml threshold setup by vendor and vendor site. we should derive normal threshold setup by vendor type
1647: open c_po_vendors(cn_vendor_id); --Added by Chong for bug#16580553 20130402
1648: fetch c_po_vendors into lv_vendor_type_lookup_code;
1649: close c_po_vendors;
1650:
1651: open c_get_threshold_normal(lv_vendor_type_lookup_code, cv_section_code);
1652: -------------------------------------------------------------
1645: --by given vendor and vendor site, if already existing exception transactions, will not show normal records in JAI_AP_TDS_TH_VSITE_V.
1646: --So we can't get noraml threshold setup by vendor and vendor site. we should derive normal threshold setup by vendor type
1647: open c_po_vendors(cn_vendor_id); --Added by Chong for bug#16580553 20130402
1648: fetch c_po_vendors into lv_vendor_type_lookup_code;
1649: close c_po_vendors;
1650:
1651: open c_get_threshold_normal(lv_vendor_type_lookup_code, cv_section_code);
1652: -------------------------------------------------------------
1653: --Added commented by Chong for bug#16580553 20130402 End
2119:
2120: cursor get_vendor_name(cn_vendor_id number)
2121: is
2122: select vendor_name
2123: FROM po_vendors
2124: where vendor_id = cn_vendor_id;
2125:
2126: cursor get_vendor_site_name(cn_vendor_site_id number)
2127: is
2129: FROM po_vendor_sites_all
2130: where vendor_site_id = cn_vendor_site_id;
2131:
2132:
2133: lv_vendor_name po_vendors.vendor_name%type;
2134: lv_vendor_site_name po_vendor_sites_all.vendor_site_code%type;
2135:
2136: lv_attr_code VARCHAR2(25);
2137: lv_attr_type_code VARCHAR2(25);
2453: and actual_section_code is not null
2454: group by actual_section_code;
2455: --having sum(tax_amount) <> 0; --Commented by Bgowrava for Bug#8254510
2456:
2457: cursor c_po_vendors(p_vendor_id number) is
2458: select tds_vendor_type_lookup_code
2459: from JAI_AP_TDS_VNDR_TYPE_V
2460: where vendor_id = p_vendor_id;
2461:
2578: cursor c_get_vendor_pan_tan(p_vendor_id number , p_vendor_site_id number) is
2579: select c.pan_no pan_no,
2580: d.org_tan_num tan_no,
2581: c.confirm_pan_flag confirm_pan_flag /*Fixing QA Bug 12431997 - Included in 11896260*/
2582: from po_vendors a,
2583: po_vendor_sites_all b,
2584: JAI_AP_TDS_VENDOR_HDRS c,
2585: jai_ap_tds_org_tan_v d --rchandan for bug#4323338
2586: where a.vendor_id = b.vendor_id
2757: ln_cnt_already_processed number:= 0;
2758: ln_tax_id number;
2759: ln_tax_amount number;
2760: ln_threshold_grp_id number;
2761: lv_vendor_type_lookup_code po_vendors.vendor_type_lookup_code%type;
2762: ln_threshold_hdr_id number;
2763: r_jai_ap_tds_thhold_slabs c_jai_ap_tds_thhold_slabs%rowtype;
2764: ln_total_invoice_amount number;
2765: ln_threshold_slab_id_before number;
3642: --Added commented by Chong for bug#16580553 20130402 Begin
3643: -------------------------------------------------------------
3644: --by given vendor and vendor site, if already existing exception transactions, will not show normal records in JAI_AP_TDS_TH_VSITE_V.
3645: --So we can't get noraml threshold setup by vendor and vendor site. we should derive normal threshold setup by vendor type
3646: open c_po_vendors(p_vendor_id); --Added by Chong for bug#16580553 20130402
3647: fetch c_po_vendors into lv_vendor_type_lookup_code;
3648: close c_po_vendors;
3649:
3650: open c_get_threshold_normal(lv_vendor_type_lookup_code, c_rec1.section_code);
3643: -------------------------------------------------------------
3644: --by given vendor and vendor site, if already existing exception transactions, will not show normal records in JAI_AP_TDS_TH_VSITE_V.
3645: --So we can't get noraml threshold setup by vendor and vendor site. we should derive normal threshold setup by vendor type
3646: open c_po_vendors(p_vendor_id); --Added by Chong for bug#16580553 20130402
3647: fetch c_po_vendors into lv_vendor_type_lookup_code;
3648: close c_po_vendors;
3649:
3650: open c_get_threshold_normal(lv_vendor_type_lookup_code, c_rec1.section_code);
3651: -------------------------------------------------------------
3644: --by given vendor and vendor site, if already existing exception transactions, will not show normal records in JAI_AP_TDS_TH_VSITE_V.
3645: --So we can't get noraml threshold setup by vendor and vendor site. we should derive normal threshold setup by vendor type
3646: open c_po_vendors(p_vendor_id); --Added by Chong for bug#16580553 20130402
3647: fetch c_po_vendors into lv_vendor_type_lookup_code;
3648: close c_po_vendors;
3649:
3650: open c_get_threshold_normal(lv_vendor_type_lookup_code, c_rec1.section_code);
3651: -------------------------------------------------------------
3652: --Added commented by Chong for bug#16580553 20130402 End
3942: /* Get vendor_type_lookup_code */
3943: p_codepath := jai_general_pkg.plot_codepath(8, p_codepath); /* 8 */
3944:
3945:
3946: open c_po_vendors(p_vendor_id);
3947: fetch c_po_vendors into lv_vendor_type_lookup_code;
3948: close c_po_vendors;
3949:
3950:
3943: p_codepath := jai_general_pkg.plot_codepath(8, p_codepath); /* 8 */
3944:
3945:
3946: open c_po_vendors(p_vendor_id);
3947: fetch c_po_vendors into lv_vendor_type_lookup_code;
3948: close c_po_vendors;
3949:
3950:
3951: IF ( ln_proc_level >= ln_dbg_level)
3944:
3945:
3946: open c_po_vendors(p_vendor_id);
3947: fetch c_po_vendors into lv_vendor_type_lookup_code;
3948: close c_po_vendors;
3949:
3950:
3951: IF ( ln_proc_level >= ln_dbg_level)
3952: THEN
5883: from po_vendor_sites_all
5884: where vendor_id = cp_vendor_id
5885: and vendor_site_id = cp_vendor_site_id;
5886:
5887: cursor c_po_vendors(cp_vendor_id number) is
5888: select terms_id,
5889: --payment_method_lookup_code, --commented by Sanjikum for Bug#4482462
5890: pay_group_lookup_code
5891: from po_vendors
5887: cursor c_po_vendors(cp_vendor_id number) is
5888: select terms_id,
5889: --payment_method_lookup_code, --commented by Sanjikum for Bug#4482462
5890: pay_group_lookup_code
5891: from po_vendors
5892: where vendor_id = cp_vendor_id;
5893:
5894:
5895: cursor c_ja_in_tax_codes (pn_tax_id number) is
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;
5951: r_ap_payment_schedules_all c_ap_payment_schedules_all%rowtype;
5952:
5953:
5973:
5974: ln_exchange_rate number;
5975: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
5976:
5977: ln_terms_id po_vendors.terms_id%type;
5978: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
5979: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
5980:
5981: lv_ja_in_ap_inv_id varchar2(15);
5974: ln_exchange_rate number;
5975: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
5976:
5977: ln_terms_id po_vendors.terms_id%type;
5978: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
5979: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
5980:
5981: lv_ja_in_ap_inv_id varchar2(15);
5982: ld_accounting_date date;
5975: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
5976:
5977: ln_terms_id po_vendors.terms_id%type;
5978: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
5979: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
5980:
5981: lv_ja_in_ap_inv_id varchar2(15);
5982: ld_accounting_date date;
5983: lv_open_period ap_invoice_distributions_all.period_name%type;
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;
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;
6059: close c_po_vendors;
6060:
6061: /*
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;
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);
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;
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
6101: )
6102: then
6103:
6104: /* Get the payment details from the vendor as it has been not defined for the site */
6105: ln_terms_id := r_po_vendors.terms_id;
6106: -- lv_payment_method_lookup_code := r_po_vendors.payment_method_lookup_code; --commented by Sanjikum for Bug#4482462
6107: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
6108:
6109: end if;
6102: then
6103:
6104: /* Get the payment details from the vendor as it has been not defined for the site */
6105: ln_terms_id := r_po_vendors.terms_id;
6106: -- lv_payment_method_lookup_code := r_po_vendors.payment_method_lookup_code; --commented by Sanjikum for Bug#4482462
6107: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
6108:
6109: end if;
6110:
6103:
6104: /* Get the payment details from the vendor as it has been not defined for the site */
6105: ln_terms_id := r_po_vendors.terms_id;
6106: -- lv_payment_method_lookup_code := r_po_vendors.payment_method_lookup_code; --commented by Sanjikum for Bug#4482462
6107: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
6108:
6109: end if;
6110:
6111:
6803: from po_vendor_sites_all
6804: where vendor_id = cp_vendor_id
6805: and vendor_site_id = cp_vendor_site_id;
6806:
6807: cursor c_po_vendors(cp_vendor_id number) is
6808: select terms_id,
6809: --payment_method_lookup_code, --commented by Sanjikum for Bug#4482462
6810: pay_group_lookup_code
6811: from po_vendors
6807: cursor c_po_vendors(cp_vendor_id number) is
6808: select terms_id,
6809: --payment_method_lookup_code, --commented by Sanjikum for Bug#4482462
6810: pay_group_lookup_code
6811: from po_vendors
6812: where vendor_id = cp_vendor_id;
6813:
6814:
6815: cursor c_ja_in_tax_codes (pn_tax_id number) is
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;
6846: r_ap_payment_schedules_all c_ap_payment_schedules_all%rowtype;
6847:
6848:
6868:
6869: ln_exchange_rate number;
6870: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
6871:
6872: ln_terms_id po_vendors.terms_id%type;
6873: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
6874: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
6875:
6876: lv_ja_in_ap_inv_id varchar2(15);
6869: ln_exchange_rate number;
6870: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
6871:
6872: ln_terms_id po_vendors.terms_id%type;
6873: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
6874: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
6875:
6876: lv_ja_in_ap_inv_id varchar2(15);
6877: ld_accounting_date date;
6870: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
6871:
6872: ln_terms_id po_vendors.terms_id%type;
6873: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
6874: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
6875:
6876: lv_ja_in_ap_inv_id varchar2(15);
6877: ld_accounting_date date;
6878: lv_open_period ap_invoice_distributions_all.period_name%type;
7446: ln_vendor_site_id := r_ja_in_tax_codes.vendor_site_id;
7447:
7448: lv_stform_type := r_ja_in_tax_codes.stform_type;
7449:
7450: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
7451: fetch c_po_vendors into r_po_vendors;
7452: close c_po_vendors;
7453:
7454:
7447:
7448: lv_stform_type := r_ja_in_tax_codes.stform_type;
7449:
7450: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
7451: fetch c_po_vendors into r_po_vendors;
7452: close c_po_vendors;
7453:
7454:
7455: open c_po_vendor_sites_all(r_ja_in_tax_codes.vendor_id, r_ja_in_tax_codes.vendor_site_id);
7448: lv_stform_type := r_ja_in_tax_codes.stform_type;
7449:
7450: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
7451: fetch c_po_vendors into r_po_vendors;
7452: close c_po_vendors;
7453:
7454:
7455: open c_po_vendor_sites_all(r_ja_in_tax_codes.vendor_id, r_ja_in_tax_codes.vendor_site_id);
7456: fetch c_po_vendor_sites_all into r_po_vendor_sites_all;
7462:
7463:
7464: if ((ln_terms_id is null) or (lv_pay_group_lookup_code is null))then
7465:
7466: ln_terms_id := r_po_vendors.terms_id;
7467: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
7468:
7469: end if;
7470:
7463:
7464: if ((ln_terms_id is null) or (lv_pay_group_lookup_code is null))then
7465:
7466: ln_terms_id := r_po_vendors.terms_id;
7467: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
7468:
7469: end if;
7470:
7471: open get_amt_for_type(rec_tax.tax_type);
10322: from po_vendor_sites_all
10323: where vendor_id = cp_vendor_id
10324: and vendor_site_id = cp_vendor_site_id;
10325:
10326: cursor c_po_vendors(cp_vendor_id number) is
10327: select terms_id,
10328: --payment_method_lookup_code, --commented by Sanjikum for Bug#4482462
10329: pay_group_lookup_code
10330: from po_vendors
10326: cursor c_po_vendors(cp_vendor_id number) is
10327: select terms_id,
10328: --payment_method_lookup_code, --commented by Sanjikum for Bug#4482462
10329: pay_group_lookup_code
10330: from po_vendors
10331: where vendor_id = cp_vendor_id;
10332:
10333: --Get tax info by tax_account_id
10334: --cursor c_ja_in_tax_codes (cn_tax_account jai_cmn_taxes_all.tax_account_id%type) is
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;
10375: r_ap_payment_schedules_all c_ap_payment_schedules_all%rowtype;
10376:
10377:
10397:
10398: ln_exchange_rate number;
10399: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
10400:
10401: ln_terms_id po_vendors.terms_id%type;
10402: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
10403: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
10404:
10405: lv_ja_in_ap_inv_id varchar2(15);
10398: ln_exchange_rate number;
10399: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
10400:
10401: ln_terms_id po_vendors.terms_id%type;
10402: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
10403: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
10404:
10405: lv_ja_in_ap_inv_id varchar2(15);
10406: ld_accounting_date date;
10399: lv_this_procedure varchar2(50); --File.Sql.35 Cbabu := 'jaiap.generate_tds_invoice';
10400:
10401: ln_terms_id po_vendors.terms_id%type;
10402: -- lv_payment_method_lookup_code po_vendors.payment_method_lookup_code%type; --commented by Sanjikum for Bug#4482462
10403: lv_pay_group_lookup_code po_vendors.pay_group_lookup_code%type;
10404:
10405: lv_ja_in_ap_inv_id varchar2(15);
10406: ld_accounting_date date;
10407: lv_open_period ap_invoice_distributions_all.period_name%type;
10742: ln_vendor_site_id := r_ja_in_tax_codes.vendor_site_id;
10743:
10744: lv_stform_type := r_ja_in_tax_codes.stform_type;
10745:
10746: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
10747: fetch c_po_vendors into r_po_vendors;
10748: close c_po_vendors;
10749:
10750:
10743:
10744: lv_stform_type := r_ja_in_tax_codes.stform_type;
10745:
10746: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
10747: fetch c_po_vendors into r_po_vendors;
10748: close c_po_vendors;
10749:
10750:
10751: open c_po_vendor_sites_all(r_ja_in_tax_codes.vendor_id, r_ja_in_tax_codes.vendor_site_id);
10744: lv_stform_type := r_ja_in_tax_codes.stform_type;
10745:
10746: open c_po_vendors(r_ja_in_tax_codes.vendor_id);
10747: fetch c_po_vendors into r_po_vendors;
10748: close c_po_vendors;
10749:
10750:
10751: open c_po_vendor_sites_all(r_ja_in_tax_codes.vendor_id, r_ja_in_tax_codes.vendor_site_id);
10752: fetch c_po_vendor_sites_all into r_po_vendor_sites_all;
10758:
10759:
10760: if ((ln_terms_id is null) or (lv_pay_group_lookup_code is null))then
10761:
10762: ln_terms_id := r_po_vendors.terms_id;
10763: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
10764:
10765: end if;
10766:
10759:
10760: if ((ln_terms_id is null) or (lv_pay_group_lookup_code is null))then
10761:
10762: ln_terms_id := r_po_vendors.terms_id;
10763: lv_pay_group_lookup_code := r_po_vendors.pay_group_lookup_code;
10764:
10765: end if;
10766:
10767: