DBA Data[Home] [Help]

APPS.JAI_AP_DTC_PREPAYMENTS_PKG dependencies on JAI_AP_TDS_INV_TAXES

Line 465: FROM jai_ap_tds_prepayments tp, jai_ap_tds_inv_taxes tt

461: where threshold_trx_id = p_threshold_trx_id;
462: --Added by Wenqiong for bug13359892 begin
463: CURSOR c_get_tax_cat_section_code (p_invoice_distribution_id NUMBER) IS
464: SELECT tt.tax_category_id, tt.actual_section_code
465: FROM jai_ap_tds_prepayments tp, jai_ap_tds_inv_taxes tt
466: WHERE tp.invoice_distribution_id_prepay = p_invoice_distribution_id AND
467: tp.invoice_distribution_id = tt.invoice_distribution_id AND rownum = 1;
468: --Added by Wenqiong for bug13359892 end
469:

Line 504: ln_tax_category_id jai_ap_tds_inv_taxes.tax_category_id%TYPE;

500: /*Bug 5751783 - End*/
501: -- Bug 6031679. Added by Lakshmi Gopalsami
502: ln_inv_dist_id_apply ap_invoice_distributions_all.invoice_distribution_id%TYPE ;
503: --Added by Wenqiong for bug13359892 begin
504: ln_tax_category_id jai_ap_tds_inv_taxes.tax_category_id%TYPE;
505: lv_section_code jai_ap_tds_inv_taxes.actual_section_code%TYPE;
506: ln_tot_tds_amt NUMBER;
507: --Added by Wenqiong for bug13359892 end
508: pre_pay_inv_id ap_invoice_distributions_all.invoice_id%TYPE; -- Added by Chong.Lei for bug#13787158

Line 505: lv_section_code jai_ap_tds_inv_taxes.actual_section_code%TYPE;

501: -- Bug 6031679. Added by Lakshmi Gopalsami
502: ln_inv_dist_id_apply ap_invoice_distributions_all.invoice_distribution_id%TYPE ;
503: --Added by Wenqiong for bug13359892 begin
504: ln_tax_category_id jai_ap_tds_inv_taxes.tax_category_id%TYPE;
505: lv_section_code jai_ap_tds_inv_taxes.actual_section_code%TYPE;
506: ln_tot_tds_amt NUMBER;
507: --Added by Wenqiong for bug13359892 end
508: pre_pay_inv_id ap_invoice_distributions_all.invoice_id%TYPE; -- Added by Chong.Lei for bug#13787158
509: l_api_name CONSTANT VARCHAR2(50) := 'process_unapply()';

Line 1042: \*Bug 9494469 - Removed parameter cp_section_type from c_jai_ap_tds_inv_taxes*\

1038: p_process_message out nocopy varchar2,
1039: p_codepath in out nocopy varchar2
1040: )
1041: is
1042: \*Bug 9494469 - Removed parameter cp_section_type from c_jai_ap_tds_inv_taxes*\
1043: cursor c_jai_ap_tds_inv_taxes(p_invoice_id number, p_prepay_distribution_id number) is
1044: select invoice_distribution_id, amount, invoice_line_number, invoice_id
1045: from jai_ap_tds_inv_taxes
1046: where invoice_id = p_invoice_id

Line 1043: cursor c_jai_ap_tds_inv_taxes(p_invoice_id number, p_prepay_distribution_id number) is

1039: p_codepath in out nocopy varchar2
1040: )
1041: is
1042: \*Bug 9494469 - Removed parameter cp_section_type from c_jai_ap_tds_inv_taxes*\
1043: cursor c_jai_ap_tds_inv_taxes(p_invoice_id number, p_prepay_distribution_id number) is
1044: select invoice_distribution_id, amount, invoice_line_number, invoice_id
1045: from jai_ap_tds_inv_taxes
1046: where invoice_id = p_invoice_id
1047: and invoice_distribution_id <> p_prepay_distribution_id

Line 1045: from jai_ap_tds_inv_taxes

1041: is
1042: \*Bug 9494469 - Removed parameter cp_section_type from c_jai_ap_tds_inv_taxes*\
1043: cursor c_jai_ap_tds_inv_taxes(p_invoice_id number, p_prepay_distribution_id number) is
1044: select invoice_distribution_id, amount, invoice_line_number, invoice_id
1045: from jai_ap_tds_inv_taxes
1046: where invoice_id = p_invoice_id
1047: and invoice_distribution_id <> p_prepay_distribution_id
1048: --and section_type = cp_section_type \*Commented for Bug 9494469*\
1049: and nvl(actual_tax_id, default_tax_id) is not null \*Bug 8431516*\

Line 1061: from jai_ap_tds_inv_taxes

1057:
1058: \*START, Added by bgowrava for bug#9214036*\
1059: cursor c_get_effective_available_amt(p_invoice_id number, p_invoice_line_num number) is
1060: select sum(amount) amount
1061: from jai_ap_tds_inv_taxes
1062: where invoice_id = p_invoice_id
1063: and invoice_line_number = p_invoice_line_num
1064: and amount < 0;
1065: \*END, Added by bgowrava for bug#9214036*\

Line 1080: \* Loop through to get the taxable basis for each line in jai_ap_tds_inv_taxes *\

1076: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.allocate_prepayment', 'START'); \* 1 *\
1077:
1078: ln_remaining_prepayment_amount := abs(p_prepay_amount); \* Apply amount is negative *\
1079:
1080: \* Loop through to get the taxable basis for each line in jai_ap_tds_inv_taxes *\
1081: \* It is ok to loop through section_type = 'TDS_SECTION as considering any one section type
1082: is ok and tds section will always be there *\
1083:
1084: -- Bug 4754213. Added by Lakshmi Gopalsami

Line 1085: for cur_si_distributions_rec in c_jai_ap_tds_inv_taxes(p_invoice_id, p_invoice_distribution_id) \*Bug 9494469 - Removed parameter cp_section_type*\

1081: \* It is ok to loop through section_type = 'TDS_SECTION as considering any one section type
1082: is ok and tds section will always be there *\
1083:
1084: -- Bug 4754213. Added by Lakshmi Gopalsami
1085: for cur_si_distributions_rec in c_jai_ap_tds_inv_taxes(p_invoice_id, p_invoice_distribution_id) \*Bug 9494469 - Removed parameter cp_section_type*\
1086: loop
1087:
1088: lv_reversal_flag := get_reversal_flag(cur_si_distributions_rec.invoice_distribution_id); \*Bug 8431516*\
1089: if lv_reversal_flag = 'N' then \*Bug 8431516*\

Line 1152: end loop; \* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes *\

1148: end if;
1149:
1150: end if; \*if lv_reversal_flag = 'N' then*\
1151:
1152: end loop; \* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes *\
1153:
1154:
1155: << exit_from_procedure >>
1156: p_codepath := jai_general_pkg.plot_codepath(100, p_codepath, null, 'END'); \* 100 *\

Line 1183: from jai_ap_tds_inv_taxes

1179: cursor c_get_tax_details_pp_inv_dist(p_pre_pay_inv_id number, p_prepay_distribution_id number) is -- Added parameter p_pre_pay_inv_id by Jia for FP bug6929483
1180: select section_type,
1181: nvl(actual_section_code, default_section_code) section_code, --Added NVL condition for Bug 8431516
1182: nvl(actual_tax_id, default_tax_id) tax_id --Added NVL condition for Bug 8431516
1183: from jai_ap_tds_inv_taxes
1184: where invoice_id = p_pre_pay_inv_id -- Added where clause p_pre_pay_inv_id by Jia for FP bug6929483
1185: and invoice_distribution_id = p_prepay_distribution_id
1186: and nvl(actual_tax_id, default_tax_id) is not null; --Added NVL condition for Bug 8431516
1187:

Line 1192: from jai_ap_tds_inv_taxes

1188: cursor c_get_tax_details_si_inv_dist(p_invoice_id number, p_invoice_distribution_id number) is
1189: select section_type,
1190: nvl(actual_section_code, default_section_code) section_code,
1191: nvl(actual_tax_id, default_tax_id) tax_id
1192: from jai_ap_tds_inv_taxes
1193: where invoice_id = p_invoice_id
1194: and invoice_distribution_id = p_invoice_distribution_id;
1195:
1196:

Line 1208: from jai_ap_tds_inv_taxes

1204:
1205:
1206: cursor c_get_tds_application_basis(p_invoice_id number) is
1207: select 'N'
1208: from jai_ap_tds_inv_taxes
1209: where invoice_id = p_invoice_id
1210: and nvl(match_status_flag, 'N') <> 'A';
1211:
1212: \* Bug 5751783 - Start*\

Line 1217: FROM jai_ap_tds_inv_taxes

1213: \* added parameter p_pre_pay_inv_id to cursor for bug 6929483*\
1214: CURSOR get_threshold_trx_id (p_pre_pay_inv_id number, p_invoice_distribution_id IN NUMBER )
1215: IS
1216: SELECT threshold_trx_id
1217: FROM jai_ap_tds_inv_taxes
1218: WHERE invoice_id = p_pre_pay_inv_id
1219: AND invoice_distribution_id = p_invoice_distribution_id ;
1220:
1221: lv_si_thhold_trx_id jai_ap_tds_thhold_trxs.threshold_trx_id%TYPE;

Line 1270: * jai_ap_tds_inv_taxes.

1266: * for the deriving the basis is changed.
1267: * We should get the details of the invoice which is created latest in the
1268: * system. i.e., whichever is validated later in the system. We can get
1269: * these details by getting the value of threshold_trx_id from
1270: * jai_ap_tds_inv_taxes.
1271: *\
1272:
1273: -- Get the tds_threshold_trx_id of the prepay invoice.
1274: OPEN get_threshold_trx_id (pre_pay_inv_id,p_prepay_distribution_id );

Line 1281: FROM jai_ap_tds_inv_taxes

1277:
1278: -- Get the threshold_trx_id of the standard invoice.
1279: SELECT max(nvl(threshold_trx_id, 0))
1280: INTO lv_si_thhold_trx_id
1281: FROM jai_ap_tds_inv_taxes
1282: WHERE invoice_id = p_invoice_id ;
1283:
1284: IF (lv_si_thhold_trx_id > NVL (lv_pp_thhold_trx_id,0 )) THEN
1285: lv_application_basis := 'STANDARD INVOICE';

Line 1444: cursor c_get_prepayment_thgroup(p_pre_pay_inv_id number, p_prepay_distribution_id number,cp_section_type jai_ap_tds_inv_taxes.section_type%type) IS --rchandan for bug#4428980

1440: from JAI_CMN_TAXES_ALL
1441: where tax_id = p_tax_id;
1442:
1443: --Add parameter p_pre_pay_inv_id in cursor c_get_prepayment_throup by Jia for FP bug6929483, Begin
1444: cursor c_get_prepayment_thgroup(p_pre_pay_inv_id number, p_prepay_distribution_id number,cp_section_type jai_ap_tds_inv_taxes.section_type%type) IS --rchandan for bug#4428980
1445: select threshold_grp_id,
1446: actual_tax_id,
1447: threshold_trx_id \*Bug 6363056*\
1448: from jai_ap_tds_inv_taxes

Line 1448: from jai_ap_tds_inv_taxes

1444: cursor c_get_prepayment_thgroup(p_pre_pay_inv_id number, p_prepay_distribution_id number,cp_section_type jai_ap_tds_inv_taxes.section_type%type) IS --rchandan for bug#4428980
1445: select threshold_grp_id,
1446: actual_tax_id,
1447: threshold_trx_id \*Bug 6363056*\
1448: from jai_ap_tds_inv_taxes
1449: where invoice_id = p_pre_pay_inv_id -- Added by Jia for FP bug6929483
1450: and invoice_distribution_id = p_prepay_distribution_id
1451: and section_type = cp_section_type; --rchandan for bug#4428980
1452:

Line 1455: from jai_ap_tds_inv_taxes

1451: and section_type = cp_section_type; --rchandan for bug#4428980
1452:
1453: cursor c_get_pp_section_tax_id(p_prepay_distribution_id number, p_section_type varchar2) is
1454: select actual_tax_id, invoice_id \*Bug 5751783*\
1455: from jai_ap_tds_inv_taxes
1456: where invoice_distribution_id = p_prepay_distribution_id
1457: and section_type = p_section_type;
1458:
1459:

Line 1470: from jai_ap_tds_inv_taxes \* ap_invoice_distributions not used for mutation problem *\

1466: select invoice_num, invoice_id \*Bug 5751783*\
1467: from ap_invoices_all
1468: where invoice_id in
1469: ( select invoice_id
1470: from jai_ap_tds_inv_taxes \* ap_invoice_distributions not used for mutation problem *\
1471: where invoice_distribution_id = p_invoice_distribution_id);
1472:
1473:
1474: cursor c_get_total_prepayment_tax

Line 1490: from jai_ap_tds_inv_taxes

1486: \* Bug 4522507. Added by Lakshmi Gopalsami *\
1487:
1488: cursor c_get_if_tds_inv_generated_pp(p_prepay_distribution_id number) is
1489: select threshold_trx_id
1490: from jai_ap_tds_inv_taxes
1491: where invoice_distribution_id = p_prepay_distribution_id
1492: -- Bug 4754213. Added by Lakshmi Gopalsami
1493: and section_type = 'TDS_SECTION';
1494:

Line 1505: from jai_ap_tds_inv_taxes

1501: \*Bug 6363056. Added invoice_distribution_id condition also*\
1502: and invoice_distribution_id = p_item_distribution_id
1503: and tds_applicable_flag = 'Y'
1504: and exists (select '1'
1505: from jai_ap_tds_inv_taxes
1506: where invoice_distribution_id = jatp.invoice_distribution_id
1507: -- Bug 4754213. Added by Lakshmi Gopalsami
1508: and section_type = 'TDS_SECTION'
1509: and threshold_trx_id is not null

Line 1530: from jai_ap_tds_inv_taxes

1526:
1527: cursor c_get_grp_details_si_inv_dist(p_invoice_id number, p_invoice_distribution_id number)
1528: is
1529: select threshold_grp_id
1530: from jai_ap_tds_inv_taxes
1531: where invoice_id = p_invoice_id
1532: and invoice_distribution_id = p_invoice_distribution_id
1533: and section_type = 'TDS_SECTION'; --Added for bug#8855650 by JMEENA
1534:

Line 1560: FROM jai_ap_tds_inv_taxes

1556: \*Fetch the taxable basis for which TDS would be generated*\
1557: CURSOR c_available_amount (p_invoice_id number, p_exchange_rate NUMBER)
1558: IS
1559: SELECT nvl(sum(amount*nvl(p_exchange_rate, 1)), 0)
1560: FROM jai_ap_tds_inv_taxes
1561: WHERE invoice_id = p_invoice_id
1562: AND nvl(actual_tax_id, default_tax_id) is not null
1563: AND section_type = 'TDS_SECTION'
1564: AND actual_section_code IS NOT NULL

Line 1594: ln_threshold_trx_id_prepay jai_ap_tds_inv_taxes.threshold_trx_id%type;

1590: ln_pp_section_tax_id number;
1591: ln_threshold_grp_audit_id number;
1592: lv_application_basis jai_ap_tds_prepayments.application_basis%type;
1593: \* Bug 4522507. Added by Lakshmi Gopalsami *\
1594: ln_threshold_trx_id_prepay jai_ap_tds_inv_taxes.threshold_trx_id%type;
1595: ln_amt_tds_inv_generated_si number;
1596: --Added the below 6 variables by Sanjikum for Bug#5131075(4718907)
1597: ln_threshold_slab_id jai_ap_tds_thhold_slabs.threshold_slab_id%TYPE;
1598: lv_threshold_type jai_ap_tds_thhold_types.threshold_type%TYPE;

Line 1928: from jai_ap_tdS_inv_taxes

1924: AND invoice_distribution_id_prepay = p_invoice_distribution_id
1925: AND jattt.invoice_id = p_invoice_id
1926: AND jatp.invoice_distribution_id in
1927: (select invoice_distribution_id
1928: from jai_ap_tdS_inv_taxes
1929: where threshold_trx_id = jattt.threshold_trx_id
1930: and invoice_id = p_invoice_id
1931: and section_type ='TDS_SECTION'
1932: )

Line 2025: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution

2021: ELSE
2022: \*Bug 8606302 - Start*\
2023: \*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
2024: suffer TDS when it was validated initially, but only when Threshold was breached
2025: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution
2026: ID of the Prepayment Invoice*\
2027: get_prepay_invoice_id(p_prepay_distribution_id, ln_parent_invoice_id);
2028: OPEN c_si_ap_invoices_all (ln_parent_invoice_id);
2029: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;

Line 2066: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution

2062: ELSE
2063: \*Bug 8606302 - Start*\
2064: \*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
2065: suffer TDS when it was validated initially, but only when Threshold was breached
2066: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution
2067: ID of the Prepayment Invoice*\
2068: get_prepay_invoice_id(p_prepay_distribution_id, ln_parent_invoice_id);
2069: OPEN c_si_ap_invoices_all (ln_parent_invoice_id);
2070: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;

Line 2354: from jai_ap_tds_inv_taxes

2350:
2351: /* Following cursor definition has been changed to cater for the obsoletion of table ja_in_ap_tds_inv_temp */
2352: cursor c_tds_count_unapp(p_invoice_id number, p_section_type varchar2) IS --rchandan for bug#4428980
2353: select count(1)
2354: from jai_ap_tds_inv_taxes
2355: where invoice_id = p_invoice_id
2356: and section_type = p_section_type; --rchandan for bug#4428980
2357:
2358: ln_tds_count_attribute1 number;

Line 2623: CURSOR C_JAI_AP_TDS_INV_TAXES

2619: p_process_message out nocopy varchar2,
2620: p_codepath in out nocopy varchar2
2621: ) IS
2622: --cursor get applied taxes
2623: CURSOR C_JAI_AP_TDS_INV_TAXES
2624: (CN_INVOICE_ID NUMBER,
2625: CN_PREPAY_DISTRIBUTION_ID NUMBER,
2626: CV_TDS_SECTION_CODE VARCHAR2,
2627: CV_WCT_APPLICABLE VARCHAR2,

Line 2636: FROM JAI_AP_TDS_INV_TAXES

2632: AMOUNT,
2633: INVOICE_LINE_NUMBER,
2634: INVOICE_ID,
2635: (SELECT DISTINCT ACTUAL_SECTION_CODE
2636: FROM JAI_AP_TDS_INV_TAXES
2637: WHERE INVOICE_ID = CN_INVOICE_ID AND
2638: INVOICE_DISTRIBUTION_ID = JATIT.INVOICE_DISTRIBUTION_ID AND
2639: ACTUAL_SECTION_CODE IS NOT NULL AND
2640: SECTION_TYPE = 'TDS_SECTION' AND

Line 2645: FROM JAI_AP_TDS_INV_TAXES JATIT

2641: ACTUAL_SECTION_CODE = CV_TDS_SECTION_CODE AND
2642: ROWNUM = 1) TDS_SECTION_CODE,
2643: wct_essi_applicable(CN_INVOICE_ID,JATIT.INVOICE_DISTRIBUTION_ID,'WCT_SECTION') WCT_APPLICABLE,
2644: wct_essi_applicable(CN_INVOICE_ID,JATIT.INVOICE_DISTRIBUTION_ID,'ESSI_SECTION') ESSI_APPLICABLE
2645: FROM JAI_AP_TDS_INV_TAXES JATIT
2646: WHERE INVOICE_ID = CN_INVOICE_ID AND
2647: INVOICE_DISTRIBUTION_ID <> CN_PREPAY_DISTRIBUTION_ID AND
2648: --ACTUAL_TAX_ID IS NOT NULL AND --Commented by Zhiwei Hou on 20120116
2649: (wct_essi_applicable(CN_INVOICE_ID,JATIT.INVOICE_DISTRIBUTION_ID,'WCT_SECTION') = CV_WCT_APPLICABLE OR

Line 2663: FROM jai_ap_tds_inv_taxes

2659: WHERE invoice_id = cn_invoice_id;
2660: --cursor get section code of prepay distribution id
2661: CURSOR c_section_code IS
2662: SELECT distinct actual_section_code
2663: FROM jai_ap_tds_inv_taxes
2664: WHERE invoice_distribution_id = p_prepay_distribution_id;
2665:
2666: CURSOR c_applicable (cn_section_type Varchar2,cn_dist_id NUMBER) IS
2667: SELECT 'Y'

Line 2668: FROM JAI_AP_TDS_INV_TAXES

2664: WHERE invoice_distribution_id = p_prepay_distribution_id;
2665:
2666: CURSOR c_applicable (cn_section_type Varchar2,cn_dist_id NUMBER) IS
2667: SELECT 'Y'
2668: FROM JAI_AP_TDS_INV_TAXES
2669: WHERE INVOICE_DISTRIBUTION_ID = cn_dist_id AND
2670: SECTION_TYPE = cn_section_type;
2671:
2672: CURSOR c_applied_amount(cn_invoice_distribution_id NUMBER) IS

Line 2680: from jai_ap_tds_inv_taxes

2676: AND nvl(unapply_flag, 'N') <> 'Y';
2677:
2678: cursor c_get_effective_available_amt(cn_invoice_id number, cn_invoice_line_num number) is
2679: select sum(amount) amount
2680: from jai_ap_tds_inv_taxes
2681: where invoice_id = cn_invoice_id
2682: and invoice_line_number = cn_invoice_line_num
2683: and amount < 0;
2684:

Line 2741: IN c_jai_ap_tds_inv_taxes(p_invoice_id,

2737: lv_ppay_essi_applicable := nvl(lv_ppay_essi_applicable,'N');
2738:
2739: /*Ensure allotment is first made to distributions that match across TDS, WCT and ESSI*/
2740: FOR cur_si_distributions_rec
2741: IN c_jai_ap_tds_inv_taxes(p_invoice_id,
2742: p_invoice_distribution_id,
2743: lv_ppay_tds_section_code,
2744: lv_ppay_wct_applicable,
2745: lv_ppay_essi_applicable)

Line 2834: END LOOP; /* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes */

2830: );
2831:
2832: ln_remaining_prepayment_amount := ln_remaining_prepayment_amount - ln_application_amount;
2833: END IF;
2834: END LOOP; /* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes */
2835:
2836: /*Ensure allotment is first made to distributions that match only to TDS*/
2837: FOR cur_si_distributions_rec
2838: IN c_jai_ap_tds_inv_taxes(p_invoice_id,

Line 2838: IN c_jai_ap_tds_inv_taxes(p_invoice_id,

2834: END LOOP; /* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes */
2835:
2836: /*Ensure allotment is first made to distributions that match only to TDS*/
2837: FOR cur_si_distributions_rec
2838: IN c_jai_ap_tds_inv_taxes(p_invoice_id,
2839: p_invoice_distribution_id,
2840: lv_ppay_tds_section_code,
2841: NULL,
2842: NULL)

Line 2930: END LOOP; /* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes */

2926:
2927: ln_remaining_prepayment_amount := ln_remaining_prepayment_amount - ln_application_amount;
2928:
2929: END IF;
2930: END LOOP; /* cur_si_distributions_rec in c_jai_ap_tds_inv_taxes */
2931:
2932: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_PROCEDURE, G_MODULE_NAME||l_api_name||'.END', G_PKG_NAME || ': '||l_api_name||'()-');
2933: IF ln_remaining_prepayment_amount > 0 THEN
2934: p_process_flag := 'E';

Line 3012: FROM jai_ap_tds_inv_taxes

3008: and invoice_distribution_id_prepay = p_invoice_distribution_id;
3009:
3010: CURSOR c_jai_tds_tax(cn_invoice_distribution_id number, cv_section_code VARCHAR2, cv_section_type VARCHAR2) IS
3011: SELECT SUM(nvl(tax_amount,0))
3012: FROM jai_ap_tds_inv_taxes
3013: --WHERE invoice_distribution_id = cn_invoice_distribution_id --Commented by Chong for issue120920-66 2012/10/09
3014: WHERE (invoice_distribution_id = cn_invoice_distribution_id --Added by Chong for issue120920-66 2012/10/09
3015: OR invoice_distribution_id = 1) --Added by Chong for issue120920-66 2012/10/09
3016: AND invoice_id = p_invoice_id --Added by Chong for issue120920-66 2012/10/09

Line 3022: FROM jai_ap_tds_inv_taxes

3018: AND section_type = cv_section_type;
3019:
3020: CURSOR c_jai_dist_amount(cn_invoice_distribution_id number) IS
3021: SELECT nvl(amount,0)
3022: FROM jai_ap_tds_inv_taxes
3023: --WHERE invoice_distribution_id = cn_invoice_distribution_id --Commented by Chong for issue120920-66 2012/10/09
3024: WHERE (invoice_distribution_id = cn_invoice_distribution_id --Added by Chong for issue120920-66 2012/10/09
3025: OR invoice_distribution_id = 1) --Added by Chong for issue120920-66 2012/10/09
3026: AND invoice_id = p_invoice_id --Added by Chong for issue120920-66 2012/10/09

Line 3036: cursor c_get_prepayment_thgroup(p_pre_pay_inv_id number, p_prepay_distribution_id number,cp_section_type jai_ap_tds_inv_taxes.section_type%type) IS --rchandan for bug#4428980

3032: from jai_ap_tds_prepayments
3033: where invoice_id = p_invoice_id
3034: and invoice_distribution_id_prepay = p_invoice_distribution_id;
3035:
3036: cursor c_get_prepayment_thgroup(p_pre_pay_inv_id number, p_prepay_distribution_id number,cp_section_type jai_ap_tds_inv_taxes.section_type%type) IS --rchandan for bug#4428980
3037: select threshold_grp_id,
3038: actual_tax_id,
3039: threshold_trx_id
3040: from jai_ap_tds_inv_taxes

Line 3040: from jai_ap_tds_inv_taxes

3036: cursor c_get_prepayment_thgroup(p_pre_pay_inv_id number, p_prepay_distribution_id number,cp_section_type jai_ap_tds_inv_taxes.section_type%type) IS --rchandan for bug#4428980
3037: select threshold_grp_id,
3038: actual_tax_id,
3039: threshold_trx_id
3040: from jai_ap_tds_inv_taxes
3041: where invoice_id = p_pre_pay_inv_id
3042: and invoice_distribution_id = p_prepay_distribution_id
3043: and section_type = cp_section_type;
3044:

Line 3065: from jai_ap_tds_inv_taxes

3061: and invoice_distribution_id_prepay = p_invoice_distribution_id
3062: and invoice_distribution_id = p_item_distribution_id
3063: and tds_applicable_flag = 'Y'
3064: and exists (select '1'
3065: from jai_ap_tds_inv_taxes
3066: where invoice_distribution_id = jatp.invoice_distribution_id
3067: and section_type = 'TDS_SECTION'
3068: --and threshold_trx_id is not null --Commented by Chong for issue120920-66 2012/10/09
3069: );

Line 3073: FROM JAI_AP_TDS_PREPAYMENTS tp, JAI_AP_TDS_INV_TAXES tt

3069: );
3070:
3071: CURSOR c_get_section_code IS
3072: SELECT DISTINCT tt.actual_SECTION_CODE
3073: FROM JAI_AP_TDS_PREPAYMENTS tp, JAI_AP_TDS_INV_TAXES tt
3074: WHERE tp.invoice_distribution_id = tt.invoice_distribution_id
3075: AND tp.tds_section_code_other = tt.actual_section_code
3076: AND tp.invoice_distribution_id_prepay = p_invoice_distribution_id;
3077:

Line 3080: FROM JAI_AP_TDS_INV_TAXES tt

3076: AND tp.invoice_distribution_id_prepay = p_invoice_distribution_id;
3077:
3078: CURSOR c_get_tds_cate(cn_invoice_distribution_id NUMBER) IS
3079: SELECT DISTINCT tt.tax_category_id
3080: FROM JAI_AP_TDS_INV_TAXES tt
3081: WHERE tt.invoice_distribution_id = cn_invoice_distribution_id;
3082:
3083: /*Update for adding exchange rate for bug13833254 */
3084: --Updated by Wenqiong for bug13787605 begin

Line 3155: from jai_ap_tds_inv_taxes

3151:
3152: cursor c_get_grp_details_si_inv_dist(p_invoice_id number, p_invoice_distribution_id number)
3153: is
3154: select threshold_grp_id
3155: from jai_ap_tds_inv_taxes
3156: where invoice_id = p_invoice_id
3157: and invoice_distribution_id = p_invoice_distribution_id
3158: and section_type = 'TDS_SECTION';
3159:

Line 3176: FROM jai_ap_tds_inv_taxes

3172: /*Fetch the taxable basis for which TDS would be generated*/
3173: CURSOR c_available_amount (p_invoice_id number, p_exchange_rate NUMBER)
3174: IS
3175: SELECT nvl(sum(amount), 0)--Remove multiple rate for bug13833254
3176: FROM jai_ap_tds_inv_taxes
3177: WHERE invoice_id = p_invoice_id
3178: AND nvl(actual_tax_id, default_tax_id) is not null
3179: AND section_type = 'TDS_SECTION'
3180: AND actual_section_code IS NOT NULL

Line 3188: FROM JAI_AP_TDS_INV_TAXES

3184: CURSOR c_tds_tax(cn_invoice_distribution_id NUMBER) IS
3185: SELECT tax_category_id,
3186: section_type,
3187: actual_section_code
3188: FROM JAI_AP_TDS_INV_TAXES
3189: WHERE INVOICE_DISTRIBUTION_ID = cn_invoice_distribution_id
3190: AND ROWNUM = 1;
3191:
3192: r_gl_sets_of_books c_gl_sets_of_books%rowtype;

Line 3210: ln_threshold_trx_id_prepay jai_ap_tds_inv_taxes.threshold_trx_id%type;

3206: ln_prepayment_amount number;
3207: ln_pp_section_tax_id number;
3208: ln_threshold_grp_audit_id number;
3209: lv_application_basis jai_ap_tds_prepayments.application_basis%type;
3210: ln_threshold_trx_id_prepay jai_ap_tds_inv_taxes.threshold_trx_id%type;
3211: ln_amt_tds_inv_generated_si number;
3212: ln_threshold_slab_id jai_ap_tds_thhold_slabs.threshold_slab_id%TYPE;
3213: lv_threshold_type jai_ap_tds_thhold_types.threshold_type%TYPE;
3214: ln_after_threshold_slab_id jai_ap_tds_thhold_slabs.threshold_slab_id%TYPE;

Line 3238: lv_section_type JAI_AP_TDS_INV_TAXES.section_type%TYPE;

3234: ln_tax_amount NUMBER;
3235: ln_taxable_basis NUMBER;
3236:
3237: ln_tax_category_id NUMBER;
3238: lv_section_type JAI_AP_TDS_INV_TAXES.section_type%TYPE;
3239: lv_section_code JAI_AP_TDS_INV_TAXES.actual_section_code%TYPE;
3240: l_api_name CONSTANT VARCHAR2(50) := 'generate_rtn()';
3241:
3242: begin

Line 3239: lv_section_code JAI_AP_TDS_INV_TAXES.actual_section_code%TYPE;

3235: ln_taxable_basis NUMBER;
3236:
3237: ln_tax_category_id NUMBER;
3238: lv_section_type JAI_AP_TDS_INV_TAXES.section_type%TYPE;
3239: lv_section_code JAI_AP_TDS_INV_TAXES.actual_section_code%TYPE;
3240: l_api_name CONSTANT VARCHAR2(50) := 'generate_rtn()';
3241:
3242: begin
3243: jai_cmn_utils_pkg.WRITE_FND_LOG(G_LEVEL_PROCEDURE, G_MODULE_NAME||l_api_name||'.BEGIN', G_PKG_NAME || ': '||l_api_name||'()+');

Line 3495: from jai_ap_tdS_inv_taxes

3491: AND invoice_distribution_id_prepay = p_invoice_distribution_id
3492: AND jattt.invoice_id = p_invoice_id
3493: AND jatp.invoice_distribution_id in
3494: (select invoice_distribution_id
3495: from jai_ap_tdS_inv_taxes
3496: where --threshold_trx_id = jattt.threshold_trx_id --Commented by Chong for issue120920-66 2012/10/09
3497: actual_section_code = jattt.tds_section_code --Added by Chong for issue120920-66 2012/10/09
3498: and invoice_id = p_invoice_id
3499: and section_type ='TDS_SECTION'

Line 3599: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution

3595: ELSE
3596:
3597: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3598: suffer TDS when it was validated initially, but only when Threshold was breached
3599: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution
3600: ID of the Prepayment Invoice*/
3601: get_prepay_invoice_id(p_prepay_distribution_id, ln_parent_invoice_id);
3602: OPEN c_si_ap_invoices_all (ln_parent_invoice_id);
3603: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;

Line 3648: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution

3644:
3645: ELSE
3646: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3647: suffer TDS when it was validated initially, but only when Threshold was breached
3648: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution
3649: ID of the Prepayment Invoice*/
3650: get_prepay_invoice_id(p_prepay_distribution_id, ln_parent_invoice_id);
3651: OPEN c_si_ap_invoices_all (ln_parent_invoice_id);
3652: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;

Line 3733: AND EXISTS (SELECT 1 FROM JAI_AP_TDS_INV_TAXES tds_tax WHERE

3729: set tds_threshold_trx_id_apply = ln_threshold_trx_id_tds
3730: where tds_threshold_trx_id_apply = -999
3731: and invoice_id = p_invoice_id
3732: and invoice_distribution_id_prepay = p_invoice_distribution_id
3733: AND EXISTS (SELECT 1 FROM JAI_AP_TDS_INV_TAXES tds_tax WHERE
3734: --tds_tax.invoice_distribution_id = tds_prepay.invoice_distribution_id --Commented by Chong for issue120920-66 2012/10/09
3735: tds_tax.actual_section_code = tds_prepay.tds_section_code_prepay --Added by Chong for issue120920-66 2012/10/09
3736: AND tds_tax.invoice_id = p_invoice_id
3737: AND tds_tax.tax_category_id = ln_tax_category_id);

Line 3866: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution

3862: CLOSE c_si_ap_invoices_all;
3863: ELSE
3864: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3865: suffer TDS when it was validated initially, but only when Threshold was breached
3866: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution
3867: ID of the Prepayment Invoice*/
3868: get_prepay_invoice_id(p_prepay_distribution_id, ln_parent_invoice_id);
3869: OPEN c_si_ap_invoices_all (ln_parent_invoice_id);
3870: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;

Line 3920: AND EXISTS (SELECT 1 FROM JAI_AP_TDS_INV_TAXES tds_tax WHERE

3916: set wct_threshold_trx_id_apply = ln_threshold_trx_id_wct
3917: where invoice_id = p_invoice_id
3918: and invoice_distribution_id_prepay = p_invoice_distribution_id
3919: and wct_applicable_flag = 'Y'
3920: AND EXISTS (SELECT 1 FROM JAI_AP_TDS_INV_TAXES tds_tax WHERE
3921: tds_tax.invoice_distribution_id = tds_prepay.invoice_distribution_id
3922: AND tds_tax.invoice_id = p_invoice_id
3923: AND tds_tax.tax_category_id = ln_tax_category_id);
3924: ELSE

Line 3950: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution

3946:
3947: ELSE
3948: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3949: suffer TDS when it was validated initially, but only when Threshold was breached
3950: In the above case there would be no records in jai_ap_tds_inv_taxes with the distribution
3951: ID of the Prepayment Invoice*/
3952: get_prepay_invoice_id(p_prepay_distribution_id, ln_parent_invoice_id);
3953: OPEN c_si_ap_invoices_all (ln_parent_invoice_id);
3954: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;

Line 4001: AND EXISTS (SELECT 1 FROM JAI_AP_TDS_INV_TAXES tds_tax WHERE

3997: set essi_threshold_trx_id_apply = ln_threshold_trx_id_essi
3998: where invoice_id = p_invoice_id
3999: and invoice_distribution_id_prepay = p_invoice_distribution_id
4000: and essi_applicable_flag = 'Y'
4001: AND EXISTS (SELECT 1 FROM JAI_AP_TDS_INV_TAXES tds_tax WHERE
4002: tds_tax.invoice_distribution_id = tds_prepay.invoice_distribution_id
4003: AND tds_tax.invoice_id = p_invoice_id
4004: AND tds_tax.tax_category_id = ln_tax_category_id);
4005: ELSE

Line 4071: SELECT 'Y' FROM JAI_AP_TDS_INV_TAXES

4067:
4068: FUNCTION wct_essi_applicable(cn_invoice_id NUMBER, cn_distribution_id NUMBER, cv_section_type VARCHAR2)
4069: RETURN VARCHAR2 IS
4070: CURSOR wct_essi_applicable IS
4071: SELECT 'Y' FROM JAI_AP_TDS_INV_TAXES
4072: WHERE INVOICE_ID = cn_invoice_id
4073: AND INVOICE_DISTRIBUTION_ID = cn_distribution_id
4074: AND SECTION_TYPE = cv_section_type;
4075: lv_applicable VARCHAR2(1) := 'N';

Line 4087: SELECT DISTINCT tax_category_id FROM JAI_AP_TDS_INV_TAXES

4083: FUNCTION get_tax_category(cn_distribution_id NUMBER)
4084: RETURN NUMBER IS
4085: /* --Commented by Chong for issue120920-66 2012/10/09
4086: CURSOR get_tax_category IS
4087: SELECT DISTINCT tax_category_id FROM JAI_AP_TDS_INV_TAXES
4088: WHERE INVOICE_DISTRIBUTION_ID = cn_distribution_id;
4089: */
4090: --Added by Chong for issue120920-66 2012/10/09 start
4091: --------------------------------------------------------------

Line 4094: FROM JAI_AP_TDS_INV_TAXES jatit

4090: --Added by Chong for issue120920-66 2012/10/09 start
4091: --------------------------------------------------------------
4092: CURSOR get_tax_category IS
4093: SELECT DISTINCT jatit.tax_category_id
4094: FROM JAI_AP_TDS_INV_TAXES jatit
4095: ,(
4096: SELECT DISTINCT invoice_id
4097: ,actual_section_code
4098: FROM JAI_AP_TDS_INV_TAXES

Line 4098: FROM JAI_AP_TDS_INV_TAXES

4094: FROM JAI_AP_TDS_INV_TAXES jatit
4095: ,(
4096: SELECT DISTINCT invoice_id
4097: ,actual_section_code
4098: FROM JAI_AP_TDS_INV_TAXES
4099: WHERE INVOICE_DISTRIBUTION_ID = cn_distribution_id
4100: ) jatit_sct
4101: WHERE jatit.invoice_id =jatit_sct.invoice_id
4102: AND jatit.actual_section_code =jatit_sct.actual_section_code