472: r_wct_details_apply c_wct_details_apply%ROWTYPE;
473: r_essi_details_apply c_essi_details_apply%ROWTYPE;
474: r_gl_sets_of_books c_gl_sets_of_books%rowtype;
475:
476: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
477: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
478: ln_threshold_trx_id_apply number;
479: ln_threshold_trx_id_tds number;
480: ln_threshold_trx_id_wct number;
473: r_essi_details_apply c_essi_details_apply%ROWTYPE;
474: r_gl_sets_of_books c_gl_sets_of_books%rowtype;
475:
476: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
477: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
478: ln_threshold_trx_id_apply number;
479: ln_threshold_trx_id_tds number;
480: ln_threshold_trx_id_wct number;
481: ln_threshold_trx_id_essi number;
483: ln_exchange_rate number;
484: ln_tax_id number;
485: ln_threshold_grp_id number;
486: ln_threshold_grp_audit_id number;
487: lv_invoice_num_to_tds_apply ap_invoices_all.invoice_num%type;
488: lv_invoice_num_to_vendor_apply ap_invoices_all.invoice_num%type;
489: /*Bug 5751783 - Start*/
490: ln_parent_pp_invoice_id NUMBER ;
491: ln_threshold_slab_id jai_ap_tds_thhold_slabs.threshold_slab_id%TYPE;
484: ln_tax_id number;
485: ln_threshold_grp_id number;
486: ln_threshold_grp_audit_id number;
487: lv_invoice_num_to_tds_apply ap_invoices_all.invoice_num%type;
488: lv_invoice_num_to_vendor_apply ap_invoices_all.invoice_num%type;
489: /*Bug 5751783 - Start*/
490: ln_parent_pp_invoice_id NUMBER ;
491: ln_threshold_slab_id jai_ap_tds_thhold_slabs.threshold_slab_id%TYPE;
492: lv_threshold_type jai_ap_tds_thhold_types.threshold_type%TYPE;
494: lv_after_threshold_type jai_ap_tds_thhold_types.threshold_type%TYPE;
495: ln_temp_threshold_grp_id jai_ap_tds_thhold_grps.threshold_grp_id%TYPE;
496: ln_temp_threshold_hdr_id jai_ap_tds_thhold_hdrs.threshold_hdr_id%TYPE;
497: lv_slab_transition_tds_event jai_ap_tds_thhold_trxs.tds_event%type;
498: lv_ppu_tds_inv_num ap_invoices_all.invoice_num%type;
499: lv_ppu_tds_cm_num ap_invoices_all.invoice_num%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 ;
495: ln_temp_threshold_grp_id jai_ap_tds_thhold_grps.threshold_grp_id%TYPE;
496: ln_temp_threshold_hdr_id jai_ap_tds_thhold_hdrs.threshold_hdr_id%TYPE;
497: lv_slab_transition_tds_event jai_ap_tds_thhold_trxs.tds_event%type;
498: lv_ppu_tds_inv_num ap_invoices_all.invoice_num%type;
499: lv_ppu_tds_cm_num ap_invoices_all.invoice_num%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
1461: select nvl(current_threshold_slab_id, 0) current_threshold_slab_id
1462: from jai_ap_tds_thhold_grps
1463: where threshold_grp_id = p_threshold_grp_id;
1464:
1465: cursor c_ap_invoices_all (p_invoice_distribution_id number) is
1466: select invoice_num, invoice_id \*Bug 5751783*\
1467: from ap_invoices_all
1468: where invoice_id in
1469: ( select invoice_id
1463: where threshold_grp_id = p_threshold_grp_id;
1464:
1465: cursor c_ap_invoices_all (p_invoice_distribution_id number) is
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);
1509: and threshold_trx_id is not null
1510: );
1511:
1512: \*Bug 6363056 Start*\
1513: cursor c_si_ap_invoices_all (p_invoice_id number) is
1514: select invoice_num, invoice_id
1515: from ap_invoices_all
1516: where invoice_id = p_invoice_id;
1517:
1511:
1512: \*Bug 6363056 Start*\
1513: cursor c_si_ap_invoices_all (p_invoice_id number) is
1514: select invoice_num, invoice_id
1515: from ap_invoices_all
1516: where invoice_id = p_invoice_id;
1517:
1518: CURSOR c_get_thgrp_det ( p_threshold_grp_id NUMBER ) IS
1519: SELECT *
1575: ln_total_tds_amount number;
1576: ln_current_threshold_slab_id jai_ap_tds_thhold_grps.current_threshold_slab_id%type;
1577: ln_prepay_tax_id number;
1578:
1579: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
1580: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
1581: lv_invoice_num_prepay_apply ap_invoices_all.invoice_num%type;
1582: ln_threshold_trx_id_tds number;
1583: ln_threshold_trx_id_wct number;
1576: ln_current_threshold_slab_id jai_ap_tds_thhold_grps.current_threshold_slab_id%type;
1577: ln_prepay_tax_id number;
1578:
1579: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
1580: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
1581: lv_invoice_num_prepay_apply ap_invoices_all.invoice_num%type;
1582: ln_threshold_trx_id_tds number;
1583: ln_threshold_trx_id_wct number;
1584: ln_threshold_trx_id_essi number;
1577: ln_prepay_tax_id number;
1578:
1579: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
1580: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
1581: lv_invoice_num_prepay_apply ap_invoices_all.invoice_num%type;
1582: ln_threshold_trx_id_tds number;
1583: ln_threshold_trx_id_wct number;
1584: ln_threshold_trx_id_essi number;
1585: ln_start_threshold_trx_id number;
2014:
2015: IF ln_amt_tds_inv_generated_si > 0 THEN
2016: IF lv_application_basis = 'STANDARD INVOICE' THEN
2017: \* get the standard invoice number *\
2018: OPEN c_si_ap_invoices_all(p_invoice_id);
2019: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2020: CLOSE c_si_ap_invoices_all;
2021: ELSE
2022: \*Bug 8606302 - Start*\
2015: IF ln_amt_tds_inv_generated_si > 0 THEN
2016: IF lv_application_basis = 'STANDARD INVOICE' THEN
2017: \* get the standard invoice number *\
2018: OPEN c_si_ap_invoices_all(p_invoice_id);
2019: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2020: CLOSE c_si_ap_invoices_all;
2021: ELSE
2022: \*Bug 8606302 - Start*\
2023: \*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
2016: IF lv_application_basis = 'STANDARD INVOICE' THEN
2017: \* get the standard invoice number *\
2018: OPEN c_si_ap_invoices_all(p_invoice_id);
2019: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2020: CLOSE c_si_ap_invoices_all;
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
2019: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2020: CLOSE c_si_ap_invoices_all;
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);
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;
2030: CLOSE c_si_ap_invoices_all;
2031: \*Bug 8606302 - End*\
2032: END IF ; \* lv_application_basis*\
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;
2030: CLOSE c_si_ap_invoices_all;
2031: \*Bug 8606302 - End*\
2032: END IF ; \* lv_application_basis*\
2033: end if; \* if ln_amt_tds_inv_generated_si > 0 then *\
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;
2030: CLOSE c_si_ap_invoices_all;
2031: \*Bug 8606302 - End*\
2032: END IF ; \* lv_application_basis*\
2033: end if; \* if ln_amt_tds_inv_generated_si > 0 then *\
2034: end if ;
2055: \*Bug 8431516 - Start*\
2056: IF ln_tot_tds_amt > 0 THEN
2057: IF lv_application_basis = 'STANDARD INVOICE' THEN
2058: \* get the standard invoice number *\
2059: OPEN c_si_ap_invoices_all(p_invoice_id);
2060: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2061: CLOSE c_si_ap_invoices_all;
2062: ELSE
2063: \*Bug 8606302 - Start*\
2056: IF ln_tot_tds_amt > 0 THEN
2057: IF lv_application_basis = 'STANDARD INVOICE' THEN
2058: \* get the standard invoice number *\
2059: OPEN c_si_ap_invoices_all(p_invoice_id);
2060: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2061: CLOSE c_si_ap_invoices_all;
2062: ELSE
2063: \*Bug 8606302 - Start*\
2064: \*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
2057: IF lv_application_basis = 'STANDARD INVOICE' THEN
2058: \* get the standard invoice number *\
2059: OPEN c_si_ap_invoices_all(p_invoice_id);
2060: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2061: CLOSE c_si_ap_invoices_all;
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
2060: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
2061: CLOSE c_si_ap_invoices_all;
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);
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;
2071: CLOSE c_si_ap_invoices_all;
2072: \*Bug 8606302 - End*\
2073: END IF ; \* lv_application_basis*\
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;
2071: CLOSE c_si_ap_invoices_all;
2072: \*Bug 8606302 - End*\
2073: END IF ; \* lv_application_basis*\
2074:
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;
2071: CLOSE c_si_ap_invoices_all;
2072: \*Bug 8606302 - End*\
2073: END IF ; \* lv_application_basis*\
2074:
2075: fnd_file.put_line(FND_FILE.log, ' value of dist id '|| p_invoice_distribution_id);
2654: AMOUNT > 0;
2655: --cursor get gl date of invoice
2656: CURSOR c_gl_date(cn_invoice_id NUMBER) IS
2657: SELECT gl_date
2658: FROM ap_invoices_all
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
3138: GROUP BY get_tax_category(decode(jatp.application_basis,'STANDARD',jatp.invoice_distribution_id,p_prepay_distribution_id));
3139: -- modified by zhiwei.xin for bug 13837788 on 14-Mar-2012 end.
3140: --Updated by Wenqiong for bug13787605.
3141:
3142: cursor c_si_ap_invoices_all (p_invoice_id number) is
3143: select invoice_num, invoice_id
3144: from ap_invoices_all
3145: where invoice_id = p_invoice_id;
3146:
3140: --Updated by Wenqiong for bug13787605.
3141:
3142: cursor c_si_ap_invoices_all (p_invoice_id number) is
3143: select invoice_num, invoice_id
3144: from ap_invoices_all
3145: where invoice_id = p_invoice_id;
3146:
3147: CURSOR c_get_thgrp_det ( p_threshold_grp_id NUMBER ) IS
3148: SELECT *
3195: ln_exchange_rate number;
3196: ln_threshold_grp_id number;
3197: ln_prepay_tax_id number;
3198:
3199: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
3200: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
3201: lv_invoice_num_prepay_apply ap_invoices_all.invoice_num%type;
3202: ln_threshold_trx_id_tds number;
3203: ln_threshold_trx_id_wct number;
3196: ln_threshold_grp_id number;
3197: ln_prepay_tax_id number;
3198:
3199: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
3200: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
3201: lv_invoice_num_prepay_apply ap_invoices_all.invoice_num%type;
3202: ln_threshold_trx_id_tds number;
3203: ln_threshold_trx_id_wct number;
3204: ln_threshold_trx_id_essi number;
3197: ln_prepay_tax_id number;
3198:
3199: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
3200: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
3201: lv_invoice_num_prepay_apply ap_invoices_all.invoice_num%type;
3202: ln_threshold_trx_id_tds number;
3203: ln_threshold_trx_id_wct number;
3204: ln_threshold_trx_id_essi number;
3205: ln_start_threshold_trx_id number;
3588:
3589: IF ln_amt_tds_inv_generated_si > 0 THEN
3590: IF lv_application_basis = 'STANDARD' THEN
3591: /* get the standard invoice number */
3592: OPEN c_si_ap_invoices_all(p_invoice_id);
3593: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3594: CLOSE c_si_ap_invoices_all;
3595: ELSE
3596:
3589: IF ln_amt_tds_inv_generated_si > 0 THEN
3590: IF lv_application_basis = 'STANDARD' THEN
3591: /* get the standard invoice number */
3592: OPEN c_si_ap_invoices_all(p_invoice_id);
3593: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3594: CLOSE c_si_ap_invoices_all;
3595: ELSE
3596:
3597: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3590: IF lv_application_basis = 'STANDARD' THEN
3591: /* get the standard invoice number */
3592: OPEN c_si_ap_invoices_all(p_invoice_id);
3593: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3594: CLOSE c_si_ap_invoices_all;
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
3593: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3594: CLOSE c_si_ap_invoices_all;
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);
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;
3604: CLOSE c_si_ap_invoices_all;
3605:
3606: END IF ; /* lv_application_basis*/
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;
3604: CLOSE c_si_ap_invoices_all;
3605:
3606: END IF ; /* lv_application_basis*/
3607: end if; /* if ln_amt_tds_inv_generated_si > 0 then */
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;
3604: CLOSE c_si_ap_invoices_all;
3605:
3606: END IF ; /* lv_application_basis*/
3607: end if; /* if ln_amt_tds_inv_generated_si > 0 then */
3608: end if ;
3637:
3638: IF ln_tot_tds_amt > 0 THEN
3639: IF lv_application_basis = 'STANDARD' THEN
3640: /* get the standard invoice number */
3641: OPEN c_si_ap_invoices_all(p_invoice_id);
3642: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3643: CLOSE c_si_ap_invoices_all;
3644:
3645: ELSE
3638: IF ln_tot_tds_amt > 0 THEN
3639: IF lv_application_basis = 'STANDARD' THEN
3640: /* get the standard invoice number */
3641: OPEN c_si_ap_invoices_all(p_invoice_id);
3642: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3643: CLOSE c_si_ap_invoices_all;
3644:
3645: ELSE
3646: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3639: IF lv_application_basis = 'STANDARD' THEN
3640: /* get the standard invoice number */
3641: OPEN c_si_ap_invoices_all(p_invoice_id);
3642: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3643: CLOSE c_si_ap_invoices_all;
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
3642: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3643: CLOSE c_si_ap_invoices_all;
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);
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;
3653: CLOSE c_si_ap_invoices_all;
3654:
3655: END IF ; /* lv_application_basis*/
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;
3653: CLOSE c_si_ap_invoices_all;
3654:
3655: END IF ; /* lv_application_basis*/
3656:
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;
3653: CLOSE c_si_ap_invoices_all;
3654:
3655: END IF ; /* lv_application_basis*/
3656:
3657: lv_section_type := 'TDS_SECTION';
3856: if r_get_total_prepayment_tax.wct_amount > 0 THEN
3857:
3858: IF lv_application_basis = 'STANDARD' THEN
3859: /* get the standard invoice number */
3860: OPEN c_si_ap_invoices_all(p_invoice_id);
3861: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
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
3857:
3858: IF lv_application_basis = 'STANDARD' THEN
3859: /* get the standard invoice number */
3860: OPEN c_si_ap_invoices_all(p_invoice_id);
3861: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
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
3858: IF lv_application_basis = 'STANDARD' THEN
3859: /* get the standard invoice number */
3860: OPEN c_si_ap_invoices_all(p_invoice_id);
3861: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
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
3860: OPEN c_si_ap_invoices_all(p_invoice_id);
3861: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
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);
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;
3871: CLOSE c_si_ap_invoices_all;
3872:
3873: END IF ; /* lv_application_basis*/
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;
3871: CLOSE c_si_ap_invoices_all;
3872:
3873: END IF ; /* lv_application_basis*/
3874:
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;
3871: CLOSE c_si_ap_invoices_all;
3872:
3873: END IF ; /* lv_application_basis*/
3874:
3875: lv_section_type := 'WCT_SECTION';
3939:
3940: if r_get_total_prepayment_tax.essi_amount > 0 then
3941: IF lv_application_basis = 'STANDARD' THEN
3942: /* get the standard invoice number */
3943: OPEN c_si_ap_invoices_all(p_invoice_id);
3944: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3945: CLOSE c_si_ap_invoices_all;
3946:
3947: ELSE
3940: if r_get_total_prepayment_tax.essi_amount > 0 then
3941: IF lv_application_basis = 'STANDARD' THEN
3942: /* get the standard invoice number */
3943: OPEN c_si_ap_invoices_all(p_invoice_id);
3944: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3945: CLOSE c_si_ap_invoices_all;
3946:
3947: ELSE
3948: /*cursor c_ap_invoices_all would not fetch the Invoice ID if the Prepayment did not
3941: IF lv_application_basis = 'STANDARD' THEN
3942: /* get the standard invoice number */
3943: OPEN c_si_ap_invoices_all(p_invoice_id);
3944: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3945: CLOSE c_si_ap_invoices_all;
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
3944: FETCH c_si_ap_invoices_all INTO lv_invoice_num_prepay_apply, ln_parent_invoice_id;
3945: CLOSE c_si_ap_invoices_all;
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);
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;
3955: CLOSE c_si_ap_invoices_all;
3956:
3957: END IF ; /* lv_application_basis*/
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;
3955: CLOSE c_si_ap_invoices_all;
3956:
3957: END IF ; /* lv_application_basis*/
3958: lv_section_type := 'ESSI_SECTION';
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;
3955: CLOSE c_si_ap_invoices_all;
3956:
3957: END IF ; /* lv_application_basis*/
3958: lv_section_type := 'ESSI_SECTION';
3959: FOR r_get_essi_group_amt IN c_get_essi_group_amt(lv_section_code)