271: where invoice_id = p_invoice_id
272: and invoice_distribution_id_prepay = p_invoice_distribution_id
273: and essi_threshold_trx_id_apply is not null;
274:
275: cursor c_gl_sets_of_books(cp_set_of_books_id number) is
276: select currency_code
277: from gl_sets_of_books
278: where set_of_books_id = cp_set_of_books_id;
279:
273: and essi_threshold_trx_id_apply is not null;
274:
275: cursor c_gl_sets_of_books(cp_set_of_books_id number) is
276: select currency_code
277: from gl_sets_of_books
278: where set_of_books_id = cp_set_of_books_id;
279:
280: cursor c_get_tds_tax_id(p_invoice_id number, p_prepay_distribution_id number) is
281: select tds_tax_id_prepay
309:
310:
311: r_get_total_prepayment_tax c_get_total_prepayment_tax%rowtype;
312: r_tds_details_apply c_tds_details_apply%rowtype;
313: r_gl_sets_of_books c_gl_sets_of_books%rowtype;
314:
315: lv_invoice_to_tds_num ap_invoices_all.invoice_num%type;
316: lv_invoice_to_vendor_num ap_invoices_all.invoice_num%type;
317: ln_threshold_trx_id_apply number;
328:
329: begin
330: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.process_unapply', 'START'); /* 1 */
331:
332: open c_gl_sets_of_books(p_set_of_books_id);
333: fetch c_gl_sets_of_books into r_gl_sets_of_books;
334: close c_gl_sets_of_books;
335:
336: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
329: begin
330: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.process_unapply', 'START'); /* 1 */
331:
332: open c_gl_sets_of_books(p_set_of_books_id);
333: fetch c_gl_sets_of_books into r_gl_sets_of_books;
334: close c_gl_sets_of_books;
335:
336: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
337: /* Foreign currency invoice */
330: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.process_unapply', 'START'); /* 1 */
331:
332: open c_gl_sets_of_books(p_set_of_books_id);
333: fetch c_gl_sets_of_books into r_gl_sets_of_books;
334: close c_gl_sets_of_books;
335:
336: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
337: /* Foreign currency invoice */
338: p_codepath := jai_general_pkg.plot_codepath(2, p_codepath); /* 2 */
332: open c_gl_sets_of_books(p_set_of_books_id);
333: fetch c_gl_sets_of_books into r_gl_sets_of_books;
334: close c_gl_sets_of_books;
335:
336: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
337: /* Foreign currency invoice */
338: p_codepath := jai_general_pkg.plot_codepath(2, p_codepath); /* 2 */
339: ln_exchange_rate := p_exchange_rate;
340: end if;
929: p_codepath in out nocopy varchar2
930: )
931: is
932:
933: cursor c_gl_sets_of_books(cp_set_of_books_id number) is
934: select currency_code
935: from gl_sets_of_books
936: where set_of_books_id = cp_set_of_books_id;
937:
931: is
932:
933: cursor c_gl_sets_of_books(cp_set_of_books_id number) is
934: select currency_code
935: from gl_sets_of_books
936: where set_of_books_id = cp_set_of_books_id;
937:
938: cursor c_jai_ap_tds_prepayments(p_invoice_id number, p_invoice_distribution_id number) is
939: select tds_prepayment_id,
1022: );
1023:
1024:
1025:
1026: r_gl_sets_of_books c_gl_sets_of_books%rowtype;
1027: r_ja_in_tax_codes c_ja_in_tax_codes%rowtype;
1028: r_get_total_prepayment_tax c_get_total_prepayment_tax%rowtype;
1029:
1030: ln_exchange_rate number;
1064: begin
1065:
1066: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.process_tds_invoices', 'START'); /* 1 */
1067:
1068: open c_gl_sets_of_books(p_set_of_books_id);
1069: fetch c_gl_sets_of_books into r_gl_sets_of_books;
1070: close c_gl_sets_of_books;
1071:
1072: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
1065:
1066: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.process_tds_invoices', 'START'); /* 1 */
1067:
1068: open c_gl_sets_of_books(p_set_of_books_id);
1069: fetch c_gl_sets_of_books into r_gl_sets_of_books;
1070: close c_gl_sets_of_books;
1071:
1072: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
1073: /* Foreign currency invoice */
1066: p_codepath := jai_general_pkg.plot_codepath(1, p_codepath, 'jai_ap_tds_prepayemnts_pkg.process_tds_invoices', 'START'); /* 1 */
1067:
1068: open c_gl_sets_of_books(p_set_of_books_id);
1069: fetch c_gl_sets_of_books into r_gl_sets_of_books;
1070: close c_gl_sets_of_books;
1071:
1072: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
1073: /* Foreign currency invoice */
1074: p_codepath := jai_general_pkg.plot_codepath(6.1, p_codepath); /* 6.1 */
1068: open c_gl_sets_of_books(p_set_of_books_id);
1069: fetch c_gl_sets_of_books into r_gl_sets_of_books;
1070: close c_gl_sets_of_books;
1071:
1072: if r_gl_sets_of_books.currency_code <> p_invoice_currency_code then
1073: /* Foreign currency invoice */
1074: p_codepath := jai_general_pkg.plot_codepath(6.1, p_codepath); /* 6.1 */
1075: ln_exchange_rate := p_exchange_rate;
1076: end if;
1098: /* Bug 5722028. Addd by CSahoo
1099: * Need to round the value as per the setup.
1100: */
1101: ln_tds_tmp_amt := 0;
1102: if r_gl_sets_of_books.currency_code = p_invoice_currency_code then
1103: ln_tds_tmp_amt := round(cur_rec.application_amount *ln_exchange_rate
1104: * (r_ja_in_tax_codes.tax_rate/100),
1105: jai_ap_tds_generation_pkg.g_inr_currency_rounding);
1106: else
1133: /* Bug 5722028. Addd by CSahoo
1134: * Need to round the value as per the setup.
1135: */
1136: ln_tds_tmp_amt := 0;
1137: if r_gl_sets_of_books.currency_code = p_invoice_currency_code then
1138: ln_tds_tmp_amt := round(cur_rec.application_amount *ln_exchange_rate
1139: * (r_ja_in_tax_codes.tax_rate/100),
1140: jai_ap_tds_generation_pkg.g_inr_currency_rounding);
1141: else
1172: /* Bug 5722028. Addd by Lakshmi Gopalsami
1173: * Need to round the value as per the setup.
1174: */
1175: ln_tds_tmp_amt := 0;
1176: if r_gl_sets_of_books.currency_code = p_invoice_currency_code then
1177: ln_tds_tmp_amt := round(cur_rec.application_amount *ln_exchange_rate
1178: * (r_ja_in_tax_codes.tax_rate/100),
1179: jai_ap_tds_generation_pkg.g_inr_currency_rounding);
1180: else