[Home] [Help]
68:
69: 4 19/03/2005 Vijay Shankar for Bug#4250236(4245089). FileVersion: 115.3
70: .added two new procedure insert_vat_repository_entry and do_vat_accounting, a function get_rgm_attribute_value
71: as part of VAT Impl.
72: .user_je_category_name that is populated into GL_INTERFACE as jai_constants.je_category_rg_entry ('Register India')
73:
74: * This is a Dependant Bug for future Versions of the Object *
75:
76: 5. 08-Jun-2005 File Version 116.2 Object is Modified to refer to New DB Entity names in place of Old DB Entity Names
230: p_discounted_amount IN OUT NOCOPY NUMBER,
231: p_inv_organization_id IN NUMBER DEFAULT NULL,
232: p_settlement_id IN NUMBER DEFAULT NULL,
233: -- Following all parameters are required for GL Accounting if p_balancing_account_id value is not passed to this procedure call
234: p_accntg_required_flag IN VARCHAR2, -- DEFAULT jai_constants.yes File.Sql.35 by Brathod
235: p_accounting_date IN DATE , -- DEFAULT sysdate File.Sql.35 by Brathod
236: p_balancing_orgn_type IN VARCHAR2 DEFAULT NULL,
237: p_balancing_orgn_id IN NUMBER DEFAULT NULL,
238: p_balancing_location_id IN NUMBER DEFAULT NULL,
237: p_balancing_orgn_id IN NUMBER DEFAULT NULL,
238: p_balancing_location_id IN NUMBER DEFAULT NULL,
239: p_balancing_tax_type IN VARCHAR2 DEFAULT NULL,
240: p_balancing_accnt_name IN VARCHAR2 DEFAULT NULL,
241: p_currency_code IN VARCHAR2 , -- DEFAULT jai_constants.func_curr File.Sql.35 by Brathod
242: p_curr_conv_date IN VARCHAR2 DEFAULT NULL,
243: p_curr_conv_type IN VARCHAR2 DEFAULT NULL,
244: p_curr_conv_rate IN VARCHAR2 DEFAULT NULL,
245: p_trx_amount IN NUMBER DEFAULT NULL, -- recovered/liable service tax amount in foreign currency
303: FROM JAI_RGM_ORG_REGNS_V
304: WHERE regime_id = p_regime_id
305: AND organization_id = p_organization_id
306: AND organization_type = p_organization_type
307: AND registration_type = jai_constants.regn_type_others
308: AND attribute_Type_code = p_att_type_code; --rchandan for bug#4428980
309:
310: lv_primary_regime_regno JAI_RGM_REGISTRATIONS.ATTRIBUTE_VALUE%TYPE;
311:
335: CLOSE cur_fetch_ou;
336:
337: lv_statement := '1';
338: -- REGIME Validation
339: IF lv_regime_code <> jai_constants.service_regime THEN
340: lv_codepath := jai_general_pkg.plot_codepath(2, lv_codepath);
341: p_process_flag := jai_constants.expected_error;
342: p_process_message := 'Transactions other than SERVICE regime are not supported';
343: FND_FILE.put_line( FND_FILE.log, p_process_message);
337: lv_statement := '1';
338: -- REGIME Validation
339: IF lv_regime_code <> jai_constants.service_regime THEN
340: lv_codepath := jai_general_pkg.plot_codepath(2, lv_codepath);
341: p_process_flag := jai_constants.expected_error;
342: p_process_message := 'Transactions other than SERVICE regime are not supported';
343: FND_FILE.put_line( FND_FILE.log, p_process_message);
344: fnd_file.put_line(fnd_file.log,p_process_message);
345: RETURN;
345: RETURN;
346: END IF;
347:
348: -- Rounding of Service Tax that is hitting repository
349: p_amount := round(p_amount, jai_constants.service_rgm_rnd_factor);
350: p_discounted_amount := round(p_discounted_amount, jai_constants.service_rgm_rnd_factor);
351: IF p_trx_amount = 0 OR p_trx_amount IS NULL THEN
352: ln_trx_amount := NULL;
353: ELSE
346: END IF;
347:
348: -- Rounding of Service Tax that is hitting repository
349: p_amount := round(p_amount, jai_constants.service_rgm_rnd_factor);
350: p_discounted_amount := round(p_discounted_amount, jai_constants.service_rgm_rnd_factor);
351: IF p_trx_amount = 0 OR p_trx_amount IS NULL THEN
352: ln_trx_amount := NULL;
353: ELSE
354: ln_trx_amount := round(p_trx_amount, jai_constants.service_rgm_rnd_factor);
350: p_discounted_amount := round(p_discounted_amount, jai_constants.service_rgm_rnd_factor);
351: IF p_trx_amount = 0 OR p_trx_amount IS NULL THEN
352: ln_trx_amount := NULL;
353: ELSE
354: ln_trx_amount := round(p_trx_amount, jai_constants.service_rgm_rnd_factor);
355: END IF;
356:
357: lv_statement := '2';
358: IF p_source IN (jai_constants.source_settle_in, jai_constants.source_settle_out) THEN
354: ln_trx_amount := round(p_trx_amount, jai_constants.service_rgm_rnd_factor);
355: END IF;
356:
357: lv_statement := '2';
358: IF p_source IN (jai_constants.source_settle_in, jai_constants.source_settle_out) THEN
359: ld_transaction_date := p_transaction_date;
360: lv_codepath := jai_general_pkg.plot_codepath(2.1, lv_codepath);
361:
362: ELSE
372:
373: lv_statement := '2.1';
374: -- ~~~~~~~~~~~~~~~~~~~~~~~ Start of Repository Entry ~~~~~~~~~~~~~~~~~~~
375:
376: IF p_source = jai_constants.source_ap THEN
377: lv_statement := '3';
378: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
379: lv_register_entry_type := jai_constants.credit;
380: lv_account_name := jai_constants.recovery;
375:
376: IF p_source = jai_constants.source_ap THEN
377: lv_statement := '3';
378: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
379: lv_register_entry_type := jai_constants.credit;
380: lv_account_name := jai_constants.recovery;
381: lv_charge_entry_type := jai_constants.debit;
382: lv_balancing_accnt_name := jai_constants.recovery_interim;
383: lv_balancing_entry_type := jai_constants.credit;
376: IF p_source = jai_constants.source_ap THEN
377: lv_statement := '3';
378: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
379: lv_register_entry_type := jai_constants.credit;
380: lv_account_name := jai_constants.recovery;
381: lv_charge_entry_type := jai_constants.debit;
382: lv_balancing_accnt_name := jai_constants.recovery_interim;
383: lv_balancing_entry_type := jai_constants.credit;
384:
377: lv_statement := '3';
378: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
379: lv_register_entry_type := jai_constants.credit;
380: lv_account_name := jai_constants.recovery;
381: lv_charge_entry_type := jai_constants.debit;
382: lv_balancing_accnt_name := jai_constants.recovery_interim;
383: lv_balancing_entry_type := jai_constants.credit;
384:
385: ELSIF p_source = jai_constants.source_ar THEN
378: lv_codepath := jai_general_pkg.plot_codepath(3, lv_codepath);
379: lv_register_entry_type := jai_constants.credit;
380: lv_account_name := jai_constants.recovery;
381: lv_charge_entry_type := jai_constants.debit;
382: lv_balancing_accnt_name := jai_constants.recovery_interim;
383: lv_balancing_entry_type := jai_constants.credit;
384:
385: ELSIF p_source = jai_constants.source_ar THEN
386: lv_statement := '4';
379: lv_register_entry_type := jai_constants.credit;
380: lv_account_name := jai_constants.recovery;
381: lv_charge_entry_type := jai_constants.debit;
382: lv_balancing_accnt_name := jai_constants.recovery_interim;
383: lv_balancing_entry_type := jai_constants.credit;
384:
385: ELSIF p_source = jai_constants.source_ar THEN
386: lv_statement := '4';
387: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
381: lv_charge_entry_type := jai_constants.debit;
382: lv_balancing_accnt_name := jai_constants.recovery_interim;
383: lv_balancing_entry_type := jai_constants.credit;
384:
385: ELSIF p_source = jai_constants.source_ar THEN
386: lv_statement := '4';
387: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
388: lv_register_entry_type := jai_constants.debit;
389: lv_account_name := jai_constants.liability;
384:
385: ELSIF p_source = jai_constants.source_ar THEN
386: lv_statement := '4';
387: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
388: lv_register_entry_type := jai_constants.debit;
389: lv_account_name := jai_constants.liability;
390: lv_charge_entry_type := jai_constants.credit;
391: lv_balancing_accnt_name := jai_constants.liability_interim;
392: lv_balancing_entry_type := jai_constants.debit;
385: ELSIF p_source = jai_constants.source_ar THEN
386: lv_statement := '4';
387: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
388: lv_register_entry_type := jai_constants.debit;
389: lv_account_name := jai_constants.liability;
390: lv_charge_entry_type := jai_constants.credit;
391: lv_balancing_accnt_name := jai_constants.liability_interim;
392: lv_balancing_entry_type := jai_constants.debit;
393:
386: lv_statement := '4';
387: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
388: lv_register_entry_type := jai_constants.debit;
389: lv_account_name := jai_constants.liability;
390: lv_charge_entry_type := jai_constants.credit;
391: lv_balancing_accnt_name := jai_constants.liability_interim;
392: lv_balancing_entry_type := jai_constants.debit;
393:
394: ELSIF p_source = jai_constants.source_manual_entry THEN
387: lv_codepath := jai_general_pkg.plot_codepath(4, lv_codepath);
388: lv_register_entry_type := jai_constants.debit;
389: lv_account_name := jai_constants.liability;
390: lv_charge_entry_type := jai_constants.credit;
391: lv_balancing_accnt_name := jai_constants.liability_interim;
392: lv_balancing_entry_type := jai_constants.debit;
393:
394: ELSIF p_source = jai_constants.source_manual_entry THEN
395: /*No need to Set Balancing Account Name as there is no need to derive balancing account because User ENTERs it in MANUAL
388: lv_register_entry_type := jai_constants.debit;
389: lv_account_name := jai_constants.liability;
390: lv_charge_entry_type := jai_constants.credit;
391: lv_balancing_accnt_name := jai_constants.liability_interim;
392: lv_balancing_entry_type := jai_constants.debit;
393:
394: ELSIF p_source = jai_constants.source_manual_entry THEN
395: /*No need to Set Balancing Account Name as there is no need to derive balancing account because User ENTERs it in MANUAL
396: ENTRY Form*/
390: lv_charge_entry_type := jai_constants.credit;
391: lv_balancing_accnt_name := jai_constants.liability_interim;
392: lv_balancing_entry_type := jai_constants.debit;
393:
394: ELSIF p_source = jai_constants.source_manual_entry THEN
395: /*No need to Set Balancing Account Name as there is no need to derive balancing account because User ENTERs it in MANUAL
396: ENTRY Form*/
397: lv_statement := '5';
398: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
396: ENTRY Form*/
397: lv_statement := '5';
398: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
399: lv_account_name := p_account_name;
400: IF lv_account_name IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
401: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
402: lv_register_entry_type := jai_constants.credit;
403: lv_charge_entry_type := jai_constants.debit;
404: lv_balancing_entry_type := jai_constants.credit;
398: lv_codepath := jai_general_pkg.plot_codepath(5, lv_codepath);
399: lv_account_name := p_account_name;
400: IF lv_account_name IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
401: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
402: lv_register_entry_type := jai_constants.credit;
403: lv_charge_entry_type := jai_constants.debit;
404: lv_balancing_entry_type := jai_constants.credit;
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
399: lv_account_name := p_account_name;
400: IF lv_account_name IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
401: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
402: lv_register_entry_type := jai_constants.credit;
403: lv_charge_entry_type := jai_constants.debit;
404: lv_balancing_entry_type := jai_constants.credit;
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
407: lv_register_entry_type := jai_constants.debit;
400: IF lv_account_name IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
401: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
402: lv_register_entry_type := jai_constants.credit;
403: lv_charge_entry_type := jai_constants.debit;
404: lv_balancing_entry_type := jai_constants.credit;
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
407: lv_register_entry_type := jai_constants.debit;
408: lv_charge_entry_type := jai_constants.credit;
401: lv_codepath := jai_general_pkg.plot_codepath(6, lv_codepath);
402: lv_register_entry_type := jai_constants.credit;
403: lv_charge_entry_type := jai_constants.debit;
404: lv_balancing_entry_type := jai_constants.credit;
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
407: lv_register_entry_type := jai_constants.debit;
408: lv_charge_entry_type := jai_constants.credit;
409: lv_balancing_entry_type := jai_constants.debit;
403: lv_charge_entry_type := jai_constants.debit;
404: lv_balancing_entry_type := jai_constants.credit;
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
407: lv_register_entry_type := jai_constants.debit;
408: lv_charge_entry_type := jai_constants.credit;
409: lv_balancing_entry_type := jai_constants.debit;
410: END IF;
411:
404: lv_balancing_entry_type := jai_constants.credit;
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
407: lv_register_entry_type := jai_constants.debit;
408: lv_charge_entry_type := jai_constants.credit;
409: lv_balancing_entry_type := jai_constants.debit;
410: END IF;
411:
412: /* Incase of Distributions and settlements, we hit only recovery account and decrease/increase
405: ELSIF lv_account_name IN (jai_constants.liability, jai_constants.liability_interim) THEN
406: lv_codepath := jai_general_pkg.plot_codepath(7, lv_codepath);
407: lv_register_entry_type := jai_constants.debit;
408: lv_charge_entry_type := jai_constants.credit;
409: lv_balancing_entry_type := jai_constants.debit;
410: END IF;
411:
412: /* Incase of Distributions and settlements, we hit only recovery account and decrease/increase
413: repository amounts as per _OUT/_IN trxns*/
410: END IF;
411:
412: /* Incase of Distributions and settlements, we hit only recovery account and decrease/increase
413: repository amounts as per _OUT/_IN trxns*/
414: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
415: lv_statement := '6';
416: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
417: lv_register_entry_type := jai_constants.debit;
418: /* following is changed as per Shekhars finding. this is because incase of distributions and settlements,
413: repository amounts as per _OUT/_IN trxns*/
414: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
415: lv_statement := '6';
416: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
417: lv_register_entry_type := jai_constants.debit;
418: /* following is changed as per Shekhars finding. this is because incase of distributions and settlements,
419: we should hit only recovery accounts*/
420: lv_account_name := jai_constants.recovery; -- jai_constants.liability; This is changed as per Shekhars finding
421: lv_charge_entry_type := jai_constants.credit;
416: lv_codepath := jai_general_pkg.plot_codepath(8, lv_codepath);
417: lv_register_entry_type := jai_constants.debit;
418: /* following is changed as per Shekhars finding. this is because incase of distributions and settlements,
419: we should hit only recovery accounts*/
420: lv_account_name := jai_constants.recovery; -- jai_constants.liability; This is changed as per Shekhars finding
421: lv_charge_entry_type := jai_constants.credit;
422: lv_balancing_accnt_name := jai_constants.recovery;
423: lv_balancing_entry_type := jai_constants.debit;
424:
417: lv_register_entry_type := jai_constants.debit;
418: /* following is changed as per Shekhars finding. this is because incase of distributions and settlements,
419: we should hit only recovery accounts*/
420: lv_account_name := jai_constants.recovery; -- jai_constants.liability; This is changed as per Shekhars finding
421: lv_charge_entry_type := jai_constants.credit;
422: lv_balancing_accnt_name := jai_constants.recovery;
423: lv_balancing_entry_type := jai_constants.debit;
424:
425: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
418: /* following is changed as per Shekhars finding. this is because incase of distributions and settlements,
419: we should hit only recovery accounts*/
420: lv_account_name := jai_constants.recovery; -- jai_constants.liability; This is changed as per Shekhars finding
421: lv_charge_entry_type := jai_constants.credit;
422: lv_balancing_accnt_name := jai_constants.recovery;
423: lv_balancing_entry_type := jai_constants.debit;
424:
425: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
426: lv_statement := '7';
419: we should hit only recovery accounts*/
420: lv_account_name := jai_constants.recovery; -- jai_constants.liability; This is changed as per Shekhars finding
421: lv_charge_entry_type := jai_constants.credit;
422: lv_balancing_accnt_name := jai_constants.recovery;
423: lv_balancing_entry_type := jai_constants.debit;
424:
425: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
426: lv_statement := '7';
427: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
421: lv_charge_entry_type := jai_constants.credit;
422: lv_balancing_accnt_name := jai_constants.recovery;
423: lv_balancing_entry_type := jai_constants.debit;
424:
425: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
426: lv_statement := '7';
427: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
428: lv_register_entry_type := jai_constants.credit;
429: lv_account_name := jai_constants.recovery;
424:
425: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
426: lv_statement := '7';
427: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
428: lv_register_entry_type := jai_constants.credit;
429: lv_account_name := jai_constants.recovery;
430: lv_charge_entry_type := jai_constants.debit;
431: lv_balancing_entry_type := jai_constants.credit;
432: lv_balancing_accnt_name := jai_constants.recovery; -- jai_constants.liability;
425: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
426: lv_statement := '7';
427: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
428: lv_register_entry_type := jai_constants.credit;
429: lv_account_name := jai_constants.recovery;
430: lv_charge_entry_type := jai_constants.debit;
431: lv_balancing_entry_type := jai_constants.credit;
432: lv_balancing_accnt_name := jai_constants.recovery; -- jai_constants.liability;
433: END IF;
426: lv_statement := '7';
427: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
428: lv_register_entry_type := jai_constants.credit;
429: lv_account_name := jai_constants.recovery;
430: lv_charge_entry_type := jai_constants.debit;
431: lv_balancing_entry_type := jai_constants.credit;
432: lv_balancing_accnt_name := jai_constants.recovery; -- jai_constants.liability;
433: END IF;
434:
427: lv_codepath := jai_general_pkg.plot_codepath(9, lv_codepath);
428: lv_register_entry_type := jai_constants.credit;
429: lv_account_name := jai_constants.recovery;
430: lv_charge_entry_type := jai_constants.debit;
431: lv_balancing_entry_type := jai_constants.credit;
432: lv_balancing_accnt_name := jai_constants.recovery; -- jai_constants.liability;
433: END IF;
434:
435: IF lv_register_entry_type = jai_constants.debit THEN
428: lv_register_entry_type := jai_constants.credit;
429: lv_account_name := jai_constants.recovery;
430: lv_charge_entry_type := jai_constants.debit;
431: lv_balancing_entry_type := jai_constants.credit;
432: lv_balancing_accnt_name := jai_constants.recovery; -- jai_constants.liability;
433: END IF;
434:
435: IF lv_register_entry_type = jai_constants.debit THEN
436: lv_statement := '8';
431: lv_balancing_entry_type := jai_constants.credit;
432: lv_balancing_accnt_name := jai_constants.recovery; -- jai_constants.liability;
433: END IF;
434:
435: IF lv_register_entry_type = jai_constants.debit THEN
436: lv_statement := '8';
437: lv_codepath := jai_general_pkg.plot_codepath(10, lv_codepath);
438: ln_debit := p_amount;
439: ln_credit := NULL;
529:
530: -- ~~~~~~~~~~~~~~~~~~~~~~~ Accounting of Recovered/Liable Service Tax ~~~~~~~~~~~~~~~~~~~~~
531:
532: lv_statement := '11';
533: IF p_accntg_required_flag = jai_constants.yes THEN
534:
535: lv_statement := '15';
536: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
537: IF ln_charge_account_id IS NULL THEN
535: lv_statement := '15';
536: lv_codepath := jai_general_pkg.plot_codepath(16, lv_codepath);
537: IF ln_charge_account_id IS NULL THEN
538: lv_codepath := jai_general_pkg.plot_codepath(17, lv_codepath);
539: p_process_flag := jai_constants.expected_error;
540: p_process_message := 'Charge Account('||lv_account_name||') not defined for tax type '||p_tax_type;
541: FND_FILE.put_line( FND_FILE.log, p_process_message); fnd_file.put_line(fnd_file.log,p_process_message);
542: GOTO end_of_repository_entry;
543: END IF;
552:
553: lv_statement := '18';
554: IF ln_balancing_account_id IS NULL THEN
555: lv_codepath := jai_general_pkg.plot_codepath(18, lv_codepath);
556: p_process_flag := jai_constants.expected_error;
557: p_process_message := 'Balancing Account('||lv_balancing_accnt_name||') not defined for tax type '||lv_balancing_tax_type;
558: FND_FILE.put_line( FND_FILE.log, p_process_message); fnd_file.put_line(fnd_file.log,p_process_message);
559: GOTO end_of_repository_entry;
560: END IF;
559: GOTO end_of_repository_entry;
560: END IF;
561:
562: ln_reference_id := p_reference_id;
563: IF p_source IN ( jai_constants.source_ap, jai_constants.source_ar) THEN
564: lv_reference_name := jai_constants.rgm_trx_refs;
565: END IF;
566:
567: lv_statement := '19';
560: END IF;
561:
562: ln_reference_id := p_reference_id;
563: IF p_source IN ( jai_constants.source_ap, jai_constants.source_ar) THEN
564: lv_reference_name := jai_constants.rgm_trx_refs;
565: END IF;
566:
567: lv_statement := '19';
568: -- INITIAL_ENTRY
565: END IF;
566:
567: lv_statement := '19';
568: -- INITIAL_ENTRY
569: IF lv_charge_entry_type = jai_constants.debit THEN
570: lv_codepath := jai_general_pkg.plot_codepath(19, lv_codepath);
571: ln_debit := p_amount;
572: ln_credit := NULL;
573: ln_trx_debit := nvl(ln_trx_amount, p_amount);
598: p_accounted_dr => ln_debit,
599: p_accounting_date => p_accounting_date,
600: p_transaction_date => ld_transaction_date,
601: p_calling_object => p_called_from,
602: p_repository_name => jai_constants.repository_name,
603: p_repository_id => p_repository_id,
604: p_reference_name => lv_reference_name,
605: p_reference_id => ln_reference_id,
606: p_currency_code => p_currency_code,
614: -- Discount related code needs to be added here
615: lv_statement := '20.1';
616: lv_codepath := jai_general_pkg.plot_codepath(21, lv_codepath);
617:
618: IF p_source = jai_constants.source_ar THEN
619:
620: lv_codepath := jai_general_pkg.plot_codepath(21.1, lv_codepath);
621: jai_ar_rgm_processing_pkg.get_ar_tax_disc_accnt (
622: p_receivable_application_id => p_source_document_id,
629: p_process_flag => p_process_flag,
630: p_process_message => p_process_message
631: );
632:
633: IF p_process_flag IN (jai_constants.expected_error, jai_constants.unexpected_error) THEN
634: lv_codepath := jai_general_pkg.plot_codepath(21.2, lv_codepath);
635: -- some problem in the above call
636: RETURN;
637: ELSIF nvl(ln_earned_discount, 0) + nvl(ln_unearned_discount, 0) <> NVL(p_discounted_amount,0) THEN
635: -- some problem in the above call
636: RETURN;
637: ELSIF nvl(ln_earned_discount, 0) + nvl(ln_unearned_discount, 0) <> NVL(p_discounted_amount,0) THEN
638: lv_codepath := jai_general_pkg.plot_codepath(21.3, lv_codepath);
639: p_process_flag := jai_constants.expected_error;
640: p_process_message := 'There is a discrepency in earned + unearned = discounted';
641: RETURN;
642: END IF;
643:
643:
644: --- following will be used for first accounting entry incase of AR Receipt Application
645: IF nvl(ln_earned_discount,0) <> 0 THEN
646: ln_discount_ccid := ln_earned_disc_accnt;
647: IF lv_charge_entry_type = jai_constants.debit THEN
648: lv_codepath := jai_general_pkg.plot_codepath(21.4, lv_codepath);
649: ln_disc_credit := null;
650: ln_disc_debit := ln_earned_discount;
651: ELSE
672: );
673:
674: IF ln_discount_ccid IS NULL THEN
675: lv_codepath := jai_general_pkg.plot_codepath(18, lv_codepath);
676: p_process_flag := jai_constants.expected_error;
677: p_process_message := 'Discount Account is not defined in '||p_source;
678: FND_FILE.put_line( FND_FILE.log, p_process_message); fnd_file.put_line(fnd_file.log,p_process_message);
679: FND_FILE.put_line( FND_FILE.log, ln_org_id);
680: GOTO end_of_repository_entry;
679: FND_FILE.put_line( FND_FILE.log, ln_org_id);
680: GOTO end_of_repository_entry;
681: END IF;
682:
683: IF lv_charge_entry_type = jai_constants.debit THEN
684: ln_disc_credit := null;
685: ln_disc_debit := p_discounted_amount;
686: ELSE
687: ln_disc_debit := null;
709: p_accounted_dr => ln_disc_debit,
710: p_accounting_date => p_accounting_date,
711: p_transaction_date => ld_transaction_date,
712: p_calling_object => p_called_from,
713: p_repository_name => jai_constants.repository_name,
714: p_repository_id => p_repository_id,
715: p_reference_name => lv_reference_name,
716: p_reference_id => ln_reference_id,
717: p_currency_code => p_currency_code,
725: -- following entry will happen only in case of AR Transactions
726: IF nvl(ln_unearned_discount,0) <> 0 THEN
727: lv_codepath := jai_general_pkg.plot_codepath(21.7, lv_codepath);
728: ln_discount_ccid := ln_unearned_disc_accnt;
729: IF lv_charge_entry_type = jai_constants.debit THEN
730: ln_disc_credit := null;
731: ln_disc_debit := ln_unearned_discount;
732: ELSE
733: ln_disc_credit := ln_unearned_discount;
750: p_accounted_dr => ln_disc_debit,
751: p_accounting_date => p_accounting_date,
752: p_transaction_date => ld_transaction_date,
753: p_calling_object => p_called_from,
754: p_repository_name => jai_constants.repository_name,
755: p_repository_id => p_repository_id,
756: p_reference_name => lv_reference_name,
757: p_reference_id => ln_reference_id,
758: p_currency_code => p_currency_code,
769:
770:
771: lv_statement := '21';
772: -- BALANCING_ENTRY
773: IF lv_balancing_entry_type = jai_constants.debit THEN
774: lv_codepath := jai_general_pkg.plot_codepath(22, lv_codepath);
775: ln_debit := p_amount + nvl(p_discounted_amount,0);
776: ln_credit := NULL;
777: ln_trx_debit := nvl(ln_trx_amount, p_amount)+ nvl(p_discounted_amount,0);
801: p_accounted_dr => ln_debit,
802: p_accounting_date => p_accounting_date,
803: p_transaction_date => ld_transaction_date,
804: p_calling_object => p_called_from,
805: p_repository_name => jai_constants.repository_name,
806: p_repository_id => p_repository_id,
807: p_reference_name => lv_reference_name,
808: p_reference_id => ln_reference_id,
809: p_currency_code => p_currency_code,
814:
815: END IF;
816:
817: lv_statement := '23';
818: p_process_flag := jai_constants.successful;
819: p_process_message := 'Successful';
820:
821: lv_statement := '24';
822: <
823: lv_codepath := jai_general_pkg.plot_codepath(23, lv_codepath, 'Insert_Repository_entry', 'END');
824:
825: EXCEPTION
826: WHEN OTHERS THEN
827: p_process_flag := jai_constants.unexpected_error;
828: p_process_message := 'Repository Error(Stmt:'||lv_statement||') Occured:'||SQLERRM;
829: lv_codepath := jai_general_pkg.plot_codepath(-999, lv_codepath);
830: Fnd_file.put_line( fnd_file.log, 'Error in Insert_Repository_entry. Codepath:'||lv_codepath);
831:
884:
885: lv_regime_code JAI_RGM_DEFINITIONS.regime_code%TYPE;
886: lv_reference_name VARCHAR2(30);
887: ln_reference_id NUMBER(15);
888: lv_gl_je_category varchar2(30); --File.Sql.35 Cbabu jai_constants.je_category_rg_entry%type;
889: lv_status gl_interface.status%TYPE ; --rchandan for bug#4428980
890: lv_source_name VARCHAR2(30); -- modified by csahoo for bug#6155839
891: /*Begin-Added the following by kunkumar for forward porting 5051541 to R12*/
892:
945: with different values for different Journal. Hence the following logic of the IF condition is used to derive the
946: value for reference1 for all the Journals that are part of the Distribution (Service tax or any duty distribution
947: */
948:
949: IF lv_source IN (jai_constants.service_src_distribute_in, jai_constants.service_src_distribute_out,
950: 'DISTRIBUTE_IN', 'DISTRIBUTE_OUT')
951: THEN
952: lv_reference1 := '' ;
953:
975:
976: -- ended, ssumaith for Bug 6664855
977:
978: /* following condition introduced for VAT Impl. Vijay Shankar for Bug#4250236(4245089) */
979: IF p_regime_code = jai_constants.service_regime THEN
980: lv_reference10 := 'Service Tax Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
981: lv_source_name := jai_constants.service_tax_source; -- added by csahoo for bug#6155839
982: ELSIF p_regime_code = jai_constants.vat_regime THEN
983: lv_reference10 := 'VAT Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
977:
978: /* following condition introduced for VAT Impl. Vijay Shankar for Bug#4250236(4245089) */
979: IF p_regime_code = jai_constants.service_regime THEN
980: lv_reference10 := 'Service Tax Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
981: lv_source_name := jai_constants.service_tax_source; -- added by csahoo for bug#6155839
982: ELSIF p_regime_code = jai_constants.vat_regime THEN
983: lv_reference10 := 'VAT Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
984: lv_source_name := jai_constants.vat_source; -- modified by csahoo for bug#6155839
985: jai_cmn_utils_pkg.print_log('6395039.log', lv_reference10);
978: /* following condition introduced for VAT Impl. Vijay Shankar for Bug#4250236(4245089) */
979: IF p_regime_code = jai_constants.service_regime THEN
980: lv_reference10 := 'Service Tax Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
981: lv_source_name := jai_constants.service_tax_source; -- added by csahoo for bug#6155839
982: ELSIF p_regime_code = jai_constants.vat_regime THEN
983: lv_reference10 := 'VAT Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
984: lv_source_name := jai_constants.vat_source; -- modified by csahoo for bug#6155839
985: jai_cmn_utils_pkg.print_log('6395039.log', lv_reference10);
986: END IF;
980: lv_reference10 := 'Service Tax Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
981: lv_source_name := jai_constants.service_tax_source; -- added by csahoo for bug#6155839
982: ELSIF p_regime_code = jai_constants.vat_regime THEN
983: lv_reference10 := 'VAT Accounting for '||p_source||'. Transaction Type:'||nvl(p_source_trx_type,'~~');
984: lv_source_name := jai_constants.vat_source; -- modified by csahoo for bug#6155839
985: jai_cmn_utils_pkg.print_log('6395039.log', lv_reference10);
986: END IF;
987:
988: ld_accounting_date := nvl( trunc(p_accounting_date), trunc(sysdate) );
1022: );
1023: jai_cmn_utils_pkg.print_log('6395039.log', 'after call to get_period_name');
1024:
1025: /* following added by Vijay Shankar for Bug#4250236(4245089). VAT Impl. */
1026: lv_gl_je_category := jai_constants.je_category_rg_entry;
1027: lv_status := 'NEW';--rchandan for bug#4428980
1028: jai_cmn_utils_pkg.print_log('6395039.log', 'before insert inot gl_interface');
1029: INSERT INTO gl_interface (
1030: status, set_of_books_id, user_je_source_name, user_je_category_name,
1037: lv_status, ln_sob_id, lv_source_name, lv_gl_je_category,
1038: ld_accounting_date, p_currency_code, sysdate, FND_GLOBAL.user_id,
1039: 'A', ln_entered_cr, ln_entered_dr, ln_accounted_cr, ln_accounted_dr, p_transaction_date,
1040: p_code_combination_id, p_curr_conv_date, p_curr_conv_type, p_curr_conv_rate,
1041: lv_reference10, jai_constants.gl_je_source_name, p_calling_object, lv_reference1,
1042: -- commented lv_organization_code and passed refererence1 ssumaith bug#6664855
1043: --Bug 5051541 kunkumar
1044: p_source_table_name, p_source_document_id, p_repository_name, p_organization_id
1045: );
1171: fnd_global.user_id,
1172: fnd_global.login_id
1173: ) RETURNING reference_id INTO p_reference_id;
1174:
1175: p_process_flag := jai_constants.successful;
1176:
1177: EXCEPTION
1178: WHEN OTHERS THEN
1179: p_process_flag := jai_constants.unexpected_error;
1175: p_process_flag := jai_constants.successful;
1176:
1177: EXCEPTION
1178: WHEN OTHERS THEN
1179: p_process_flag := jai_constants.unexpected_error;
1180: p_process_message := 'jai_cmn_rgm_recording_pkg.insert_reference failed with error - '||SQLERRM;
1181: fnd_file.put_line( fnd_file.log, p_process_message);
1182: END insert_reference;
1183:
1194: lv_object_name CONSTANT VARCHAR2(61) := 'jai_cmn_rgm_recording_pkg.get_account';
1195:
1196: CURSOR c_orgn_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1197: SELECT decode(cp_register_type,
1198: jai_constants.register_type_a, modvat_rm_account_id,
1199: jai_constants.register_type_c, modvat_cg_account_id,
1200: jai_constants.register_type_pla, modvat_pla_account_id
1201: )
1202: FROM JAI_CMN_INVENTORY_ORGS a
1195:
1196: CURSOR c_orgn_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1197: SELECT decode(cp_register_type,
1198: jai_constants.register_type_a, modvat_rm_account_id,
1199: jai_constants.register_type_c, modvat_cg_account_id,
1200: jai_constants.register_type_pla, modvat_pla_account_id
1201: )
1202: FROM JAI_CMN_INVENTORY_ORGS a
1203: WHERE organization_id = cp_organization_id
1196: CURSOR c_orgn_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1197: SELECT decode(cp_register_type,
1198: jai_constants.register_type_a, modvat_rm_account_id,
1199: jai_constants.register_type_c, modvat_cg_account_id,
1200: jai_constants.register_type_pla, modvat_pla_account_id
1201: )
1202: FROM JAI_CMN_INVENTORY_ORGS a
1203: WHERE organization_id = cp_organization_id
1204: AND ( (cp_location_id IS NOT NULL AND a.location_id = cp_location_id)
1210: || Start of Bug#4546114
1211: */
1212: CURSOR c_orgn_cess_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1213: SELECT decode(cp_register_type,
1214: jai_constants.register_type_a, excise_edu_cess_rm_account ,
1215: jai_constants.register_type_c, excise_edu_cess_cg_account ,
1216: jai_constants.register_type_pla, modvat_pla_account_id
1217: )
1218: FROM JAI_CMN_INVENTORY_ORGS a
1211: */
1212: CURSOR c_orgn_cess_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1213: SELECT decode(cp_register_type,
1214: jai_constants.register_type_a, excise_edu_cess_rm_account ,
1215: jai_constants.register_type_c, excise_edu_cess_cg_account ,
1216: jai_constants.register_type_pla, modvat_pla_account_id
1217: )
1218: FROM JAI_CMN_INVENTORY_ORGS a
1219: WHERE organization_id = cp_organization_id
1212: CURSOR c_orgn_cess_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1213: SELECT decode(cp_register_type,
1214: jai_constants.register_type_a, excise_edu_cess_rm_account ,
1215: jai_constants.register_type_c, excise_edu_cess_cg_account ,
1216: jai_constants.register_type_pla, modvat_pla_account_id
1217: )
1218: FROM JAI_CMN_INVENTORY_ORGS a
1219: WHERE organization_id = cp_organization_id
1220: AND ( (cp_location_id IS NOT NULL AND a.location_id = cp_location_id)
1230:
1231:
1232: CURSOR c_orgn_sh_cess_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1233: SELECT decode(cp_register_type,
1234: jai_constants.register_type_a, SH_CESS_RM_ACCOUNT ,
1235: jai_constants.register_type_c, SH_CESS_CG_ACCOUNT_ID ,
1236: jai_constants.register_type_pla, modvat_pla_account_id
1237: )
1238: FROM JAI_CMN_INVENTORY_ORGS a
1231:
1232: CURSOR c_orgn_sh_cess_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1233: SELECT decode(cp_register_type,
1234: jai_constants.register_type_a, SH_CESS_RM_ACCOUNT ,
1235: jai_constants.register_type_c, SH_CESS_CG_ACCOUNT_ID ,
1236: jai_constants.register_type_pla, modvat_pla_account_id
1237: )
1238: FROM JAI_CMN_INVENTORY_ORGS a
1239: WHERE organization_id = cp_organization_id
1232: CURSOR c_orgn_sh_cess_account(cp_organization_id IN NUMBER, cp_location_id IN NUMBER, cp_register_type IN VARCHAR2) IS
1233: SELECT decode(cp_register_type,
1234: jai_constants.register_type_a, SH_CESS_RM_ACCOUNT ,
1235: jai_constants.register_type_c, SH_CESS_CG_ACCOUNT_ID ,
1236: jai_constants.register_type_pla, modvat_pla_account_id
1237: )
1238: FROM JAI_CMN_INVENTORY_ORGS a
1239: WHERE organization_id = cp_organization_id
1240: AND ( (cp_location_id IS NOT NULL AND a.location_id = cp_location_id)
1248: cp_tax_type IN VARCHAR2, cp_account_name IN VARCHAR2) IS
1249: SELECT to_number(accnts.attribute_value)
1250: FROM JAI_RGM_REGISTRATIONS tax_types, JAI_RGM_ORG_REGNS_V accnts
1251: WHERE tax_types.regime_id = cp_regime_id
1252: AND tax_types.registration_type = jai_constants.regn_type_tax_types
1253: AND tax_types.attribute_code = cp_tax_type
1254: AND accnts.regime_id = tax_types.regime_id
1255: AND accnts.registration_type = jai_constants.regn_type_accounts
1256: AND accnts.parent_registration_id = tax_types.registration_id
1251: WHERE tax_types.regime_id = cp_regime_id
1252: AND tax_types.registration_type = jai_constants.regn_type_tax_types
1253: AND tax_types.attribute_code = cp_tax_type
1254: AND accnts.regime_id = tax_types.regime_id
1255: AND accnts.registration_type = jai_constants.regn_type_accounts
1256: AND accnts.parent_registration_id = tax_types.registration_id
1257: AND accnts.attribute_code = cp_account_name
1258: AND accnts.organization_type = cp_organization_type
1259: AND accnts.organization_id = cp_organization_id
1275: jai_rgm_parties jrp ,
1276: JAI_RGM_REGISTRATIONS accnts
1277: WHERE tax_types.regime_id = cp_regime_id
1278: AND jrp.regime_id = -accnts.regime_id
1279: AND tax_types.registration_type = jai_constants.regn_type_tax_types
1280: AND tax_types.attribute_code = cp_tax_type
1281: AND accnts.regime_id = tax_types.regime_id
1282: AND accnts.registration_type = jai_constants.regn_type_accounts
1283: AND accnts.parent_registration_id = tax_types.registration_id
1278: AND jrp.regime_id = -accnts.regime_id
1279: AND tax_types.registration_type = jai_constants.regn_type_tax_types
1280: AND tax_types.attribute_code = cp_tax_type
1281: AND accnts.regime_id = tax_types.regime_id
1282: AND accnts.registration_type = jai_constants.regn_type_accounts
1283: AND accnts.parent_registration_id = tax_types.registration_id
1284: AND accnts.attribute_code = cp_account_name
1285: AND jrp.organization_type = cp_organization_type
1286: AND jrp.organization_id = cp_organization_id ;
1320: OPEN c_regime_code(p_regime_id);
1321: FETCH c_regime_code INTO lv_regime_code;
1322: CLOSE c_regime_code;
1323:
1324: IF lv_regime_code = jai_constants.service_regime
1325: AND p_location_id IS NULL AND p_organization_type = jai_constants.orgn_type_io
1326: THEN
1327: lv_organization_type := jai_constants.orgn_type_ou;
1328:
1321: FETCH c_regime_code INTO lv_regime_code;
1322: CLOSE c_regime_code;
1323:
1324: IF lv_regime_code = jai_constants.service_regime
1325: AND p_location_id IS NULL AND p_organization_type = jai_constants.orgn_type_io
1326: THEN
1327: lv_organization_type := jai_constants.orgn_type_ou;
1328:
1329: OPEN c_operating_unit_of_inv_org(p_organization_id);
1323:
1324: IF lv_regime_code = jai_constants.service_regime
1325: AND p_location_id IS NULL AND p_organization_type = jai_constants.orgn_type_io
1326: THEN
1327: lv_organization_type := jai_constants.orgn_type_ou;
1328:
1329: OPEN c_operating_unit_of_inv_org(p_organization_id);
1330: FETCH c_operating_unit_of_inv_org INTO ln_organization_id;
1331: CLOSE c_operating_unit_of_inv_org;
1334: lv_organization_type := p_organization_type;
1335: ln_organization_id := p_organization_id;
1336: END IF;
1337:
1338: IF lv_regime_code = jai_constants.service_regime
1339: AND lv_organization_type = jai_constants.orgn_type_io
1340: THEN
1341:
1342: IF upper(p_tax_type) = UPPER(jai_constants.tax_type_excise) THEN /* IF condition added by Ramananda - bug#4546114 */
1335: ln_organization_id := p_organization_id;
1336: END IF;
1337:
1338: IF lv_regime_code = jai_constants.service_regime
1339: AND lv_organization_type = jai_constants.orgn_type_io
1340: THEN
1341:
1342: IF upper(p_tax_type) = UPPER(jai_constants.tax_type_excise) THEN /* IF condition added by Ramananda - bug#4546114 */
1343: OPEN c_orgn_account(ln_organization_id, p_location_id, p_account_name);
1338: IF lv_regime_code = jai_constants.service_regime
1339: AND lv_organization_type = jai_constants.orgn_type_io
1340: THEN
1341:
1342: IF upper(p_tax_type) = UPPER(jai_constants.tax_type_excise) THEN /* IF condition added by Ramananda - bug#4546114 */
1343: OPEN c_orgn_account(ln_organization_id, p_location_id, p_account_name);
1344: FETCH c_orgn_account INTO ln_code_combination_id;
1345: CLOSE c_orgn_account;
1346:
1356: || Following IF condition and the cursor in it added by Ramananda
1357: || Start of Bug#4546114
1358: */
1359: ELSIF upper(p_tax_type) IN (lv_excise_cess ,
1360: jai_constants.tax_type_exc_edu_cess,
1361: jai_constants.tax_type_cvd_edu_cess ,
1362: jai_constants.tax_type_customs_edu_cess
1363: ) THEN
1364:
1357: || Start of Bug#4546114
1358: */
1359: ELSIF upper(p_tax_type) IN (lv_excise_cess ,
1360: jai_constants.tax_type_exc_edu_cess,
1361: jai_constants.tax_type_cvd_edu_cess ,
1362: jai_constants.tax_type_customs_edu_cess
1363: ) THEN
1364:
1365: OPEN c_orgn_cess_account(ln_organization_id, p_location_id, p_account_name);
1358: */
1359: ELSIF upper(p_tax_type) IN (lv_excise_cess ,
1360: jai_constants.tax_type_exc_edu_cess,
1361: jai_constants.tax_type_cvd_edu_cess ,
1362: jai_constants.tax_type_customs_edu_cess
1363: ) THEN
1364:
1365: OPEN c_orgn_cess_account(ln_organization_id, p_location_id, p_account_name);
1366: FETCH c_orgn_cess_account INTO ln_code_combination_id;
1372: CLOSE c_orgn_Cess_account;
1373: END IF;
1374: --Date 05/03/2007 by vkaranam for bug#5989740
1375: -- start 5989740
1376: ELSIF upper(p_tax_type) IN (jai_constants.tax_type_sh_exc_edu_cess ,
1377: jai_constants.tax_type_sh_cvd_edu_cess ,
1378: jai_constants.tax_type_sh_customs_edu_Cess
1379: ) THEN
1380:
1373: END IF;
1374: --Date 05/03/2007 by vkaranam for bug#5989740
1375: -- start 5989740
1376: ELSIF upper(p_tax_type) IN (jai_constants.tax_type_sh_exc_edu_cess ,
1377: jai_constants.tax_type_sh_cvd_edu_cess ,
1378: jai_constants.tax_type_sh_customs_edu_Cess
1379: ) THEN
1380:
1381: OPEN c_orgn_sh_cess_account(ln_organization_id, p_location_id, p_account_name);
1374: --Date 05/03/2007 by vkaranam for bug#5989740
1375: -- start 5989740
1376: ELSIF upper(p_tax_type) IN (jai_constants.tax_type_sh_exc_edu_cess ,
1377: jai_constants.tax_type_sh_cvd_edu_cess ,
1378: jai_constants.tax_type_sh_customs_edu_Cess
1379: ) THEN
1380:
1381: OPEN c_orgn_sh_cess_account(ln_organization_id, p_location_id, p_account_name);
1382: FETCH c_orgn_sh_cess_account INTO ln_code_combination_id;
1398: END IF;
1399: /*
1400: || End of Bug#4546114
1401: */
1402: ELSIF lv_regime_code = jai_constants.vat_regime
1403: AND lv_organization_type = jai_constants.orgn_type_io
1404: THEN
1405: OPEN c_orgn_tax_type_account(p_regime_id, lv_organization_type, ln_organization_id,
1406: p_location_id, p_tax_type, p_account_name);
1399: /*
1400: || End of Bug#4546114
1401: */
1402: ELSIF lv_regime_code = jai_constants.vat_regime
1403: AND lv_organization_type = jai_constants.orgn_type_io
1404: THEN
1405: OPEN c_orgn_tax_type_account(p_regime_id, lv_organization_type, ln_organization_id,
1406: p_location_id, p_tax_type, p_account_name);
1407: FETCH c_orgn_tax_type_account INTO ln_code_combination_id;
1407: FETCH c_orgn_tax_type_account INTO ln_code_combination_id;
1408: CLOSE c_orgn_tax_type_account;
1409:
1410: /*Added by CSahoo Bug# 5631784*/
1411: ELSIF lv_regime_code = jai_constants.tcs_regime THEN
1412:
1413: OPEN c_orgn_tax_type_account(p_regime_id, lv_organization_type, ln_organization_id,
1414: p_location_id, p_tax_type, p_account_name);
1415: FETCH c_orgn_tax_type_account INTO ln_code_combination_id;
1414: p_location_id, p_tax_type, p_account_name);
1415: FETCH c_orgn_tax_type_account INTO ln_code_combination_id;
1416: CLOSE c_orgn_tax_type_account;
1417:
1418: ELSIF lv_organization_type = jai_constants.orgn_type_ou THEN
1419:
1420: /* added by ssawant for bug 5879769 */
1421: IF lv_regime_code = jai_constants.service_regime THEN
1422:
1417:
1418: ELSIF lv_organization_type = jai_constants.orgn_type_ou THEN
1419:
1420: /* added by ssawant for bug 5879769 */
1421: IF lv_regime_code = jai_constants.service_regime THEN
1422:
1423: OPEN c_orgn_tax_type_account_ou(p_regime_id, jai_constants.orgn_type_ou, ln_organization_id,
1424: null, p_tax_type, p_account_name);
1425: FETCH c_orgn_tax_type_account_ou INTO ln_code_combination_id;
1419:
1420: /* added by ssawant for bug 5879769 */
1421: IF lv_regime_code = jai_constants.service_regime THEN
1422:
1423: OPEN c_orgn_tax_type_account_ou(p_regime_id, jai_constants.orgn_type_ou, ln_organization_id,
1424: null, p_tax_type, p_account_name);
1425: FETCH c_orgn_tax_type_account_ou INTO ln_code_combination_id;
1426: CLOSE c_orgn_tax_type_account_ou;
1427: ELSE
1424: null, p_tax_type, p_account_name);
1425: FETCH c_orgn_tax_type_account_ou INTO ln_code_combination_id;
1426: CLOSE c_orgn_tax_type_account_ou;
1427: ELSE
1428: OPEN c_orgn_tax_type_account(p_regime_id, jai_constants.orgn_type_ou, ln_organization_id,
1429: null, p_tax_type, p_account_name);
1430: FETCH c_orgn_tax_type_account INTO ln_code_combination_id;
1431: CLOSE c_orgn_tax_type_account;
1432: END IF;
1465: */
1466: CURSOR c_period_dtl(cp_sob_id IN NUMBER, cp_accounting_date IN DATE) IS
1467: SELECT period_name, start_date, end_date, closing_status
1468: FROM gl_period_statuses
1469: WHERE application_id = jai_constants.gl_application_id
1470: AND set_of_books_id = cp_sob_id
1471: AND cp_accounting_date BETWEEN start_date AND end_date;
1472:
1473: r_period_dtl c_period_dtl%ROWTYPE;
1505: ELSE
1506:
1507: FOR period IN ( SELECT period_name, start_date, end_date, closing_status
1508: FROM gl_period_statuses
1509: WHERE application_id = jai_constants.gl_application_id
1510: AND set_of_books_id = ln_sob_id
1511: AND start_date > p_accounting_date
1512: ORDER BY period_year, period_num
1513: )
1557: BEGIN
1558:
1559: -- following IF - ELSIF is valid for Organization Type OU w.r.t account_name and entry_type
1560: -- where as for Organization Type IO, it is valid only for entry_type
1561: IF p_source = jai_constants.source_receive THEN
1562: p_account_name := jai_constants.recovery_interim;
1563: p_account_entry_type := jai_constants.debit;
1564:
1565: ELSIF p_source = jai_constants.source_rtv THEN
1558:
1559: -- following IF - ELSIF is valid for Organization Type OU w.r.t account_name and entry_type
1560: -- where as for Organization Type IO, it is valid only for entry_type
1561: IF p_source = jai_constants.source_receive THEN
1562: p_account_name := jai_constants.recovery_interim;
1563: p_account_entry_type := jai_constants.debit;
1564:
1565: ELSIF p_source = jai_constants.source_rtv THEN
1566: p_account_name := jai_constants.liability_interim;
1559: -- following IF - ELSIF is valid for Organization Type OU w.r.t account_name and entry_type
1560: -- where as for Organization Type IO, it is valid only for entry_type
1561: IF p_source = jai_constants.source_receive THEN
1562: p_account_name := jai_constants.recovery_interim;
1563: p_account_entry_type := jai_constants.debit;
1564:
1565: ELSIF p_source = jai_constants.source_rtv THEN
1566: p_account_name := jai_constants.liability_interim;
1567: p_account_entry_type := jai_constants.credit;
1561: IF p_source = jai_constants.source_receive THEN
1562: p_account_name := jai_constants.recovery_interim;
1563: p_account_entry_type := jai_constants.debit;
1564:
1565: ELSIF p_source = jai_constants.source_rtv THEN
1566: p_account_name := jai_constants.liability_interim;
1567: p_account_entry_type := jai_constants.credit;
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1562: p_account_name := jai_constants.recovery_interim;
1563: p_account_entry_type := jai_constants.debit;
1564:
1565: ELSIF p_source = jai_constants.source_rtv THEN
1566: p_account_name := jai_constants.liability_interim;
1567: p_account_entry_type := jai_constants.credit;
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1563: p_account_entry_type := jai_constants.debit;
1564:
1565: ELSIF p_source = jai_constants.source_rtv THEN
1566: p_account_name := jai_constants.liability_interim;
1567: p_account_entry_type := jai_constants.credit;
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1565: ELSIF p_source = jai_constants.source_rtv THEN
1566: p_account_name := jai_constants.liability_interim;
1567: p_account_entry_type := jai_constants.credit;
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1566: p_account_name := jai_constants.liability_interim;
1567: p_account_entry_type := jai_constants.credit;
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1574: p_account_entry_type := jai_constants.credit;
1567: p_account_entry_type := jai_constants.credit;
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1574: p_account_entry_type := jai_constants.credit;
1575:
1568:
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1574: p_account_entry_type := jai_constants.credit;
1575:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1569: ELSIF p_source = jai_constants.source_ap THEN
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1574: p_account_entry_type := jai_constants.credit;
1575:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1577: --lv_account_name := p_account_name;
1570: p_account_name := jai_constants.recovery;
1571: p_account_entry_type := jai_constants.debit;
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1574: p_account_entry_type := jai_constants.credit;
1575:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1577: --lv_account_name := p_account_name;
1578: IF p_src_trx_type IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
1572: ELSIF p_source = jai_constants.source_ar THEN
1573: p_account_name := jai_constants.liability;
1574: p_account_entry_type := jai_constants.credit;
1575:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1577: --lv_account_name := p_account_name;
1578: IF p_src_trx_type IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
1579: p_account_entry_type := jai_constants.debit;
1580: ELSIF p_src_trx_type IN (jai_constants.liability, jai_constants.liability_interim) THEN
1574: p_account_entry_type := jai_constants.credit;
1575:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1577: --lv_account_name := p_account_name;
1578: IF p_src_trx_type IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
1579: p_account_entry_type := jai_constants.debit;
1580: ELSIF p_src_trx_type IN (jai_constants.liability, jai_constants.liability_interim) THEN
1581: p_account_entry_type := jai_constants.credit;
1582: END IF;
1575:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1577: --lv_account_name := p_account_name;
1578: IF p_src_trx_type IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
1579: p_account_entry_type := jai_constants.debit;
1580: ELSIF p_src_trx_type IN (jai_constants.liability, jai_constants.liability_interim) THEN
1581: p_account_entry_type := jai_constants.credit;
1582: END IF;
1583:
1576: ELSIF p_source = jai_constants.source_manual_entry THEN
1577: --lv_account_name := p_account_name;
1578: IF p_src_trx_type IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
1579: p_account_entry_type := jai_constants.debit;
1580: ELSIF p_src_trx_type IN (jai_constants.liability, jai_constants.liability_interim) THEN
1581: p_account_entry_type := jai_constants.credit;
1582: END IF;
1583:
1584: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
1577: --lv_account_name := p_account_name;
1578: IF p_src_trx_type IN (jai_constants.recovery, jai_constants.recovery_interim) THEN
1579: p_account_entry_type := jai_constants.debit;
1580: ELSIF p_src_trx_type IN (jai_constants.liability, jai_constants.liability_interim) THEN
1581: p_account_entry_type := jai_constants.credit;
1582: END IF;
1583:
1584: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
1585: p_account_name := jai_constants.liability;
1580: ELSIF p_src_trx_type IN (jai_constants.liability, jai_constants.liability_interim) THEN
1581: p_account_entry_type := jai_constants.credit;
1582: END IF;
1583:
1584: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
1585: p_account_name := jai_constants.liability;
1586: p_account_entry_type := jai_constants.credit;
1587:
1588: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
1581: p_account_entry_type := jai_constants.credit;
1582: END IF;
1583:
1584: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
1585: p_account_name := jai_constants.liability;
1586: p_account_entry_type := jai_constants.credit;
1587:
1588: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
1589: p_account_name := jai_constants.recovery;
1582: END IF;
1583:
1584: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
1585: p_account_name := jai_constants.liability;
1586: p_account_entry_type := jai_constants.credit;
1587:
1588: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
1589: p_account_name := jai_constants.recovery;
1590: p_account_entry_type := jai_constants.debit;
1584: ELSIF p_source IN (jai_constants.service_src_distribute_out, jai_constants.source_settle_out) THEN
1585: p_account_name := jai_constants.liability;
1586: p_account_entry_type := jai_constants.credit;
1587:
1588: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
1589: p_account_name := jai_constants.recovery;
1590: p_account_entry_type := jai_constants.debit;
1591: END IF;
1592:
1585: p_account_name := jai_constants.liability;
1586: p_account_entry_type := jai_constants.credit;
1587:
1588: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
1589: p_account_name := jai_constants.recovery;
1590: p_account_entry_type := jai_constants.debit;
1591: END IF;
1592:
1593: IF p_organization_type = jai_constants.orgn_type_io THEN
1586: p_account_entry_type := jai_constants.credit;
1587:
1588: ELSIF p_source IN (jai_constants.service_src_distribute_in, jai_constants.source_settle_in) THEN
1589: p_account_name := jai_constants.recovery;
1590: p_account_entry_type := jai_constants.debit;
1591: END IF;
1592:
1593: IF p_organization_type = jai_constants.orgn_type_io THEN
1594: p_account_name := jai_constants.register_type_a;
1589: p_account_name := jai_constants.recovery;
1590: p_account_entry_type := jai_constants.debit;
1591: END IF;
1592:
1593: IF p_organization_type = jai_constants.orgn_type_io THEN
1594: p_account_name := jai_constants.register_type_a;
1595: END IF;
1596:
1597:
1590: p_account_entry_type := jai_constants.debit;
1591: END IF;
1592:
1593: IF p_organization_type = jai_constants.orgn_type_io THEN
1594: p_account_name := jai_constants.register_type_a;
1595: END IF;
1596:
1597:
1598: /* Added by Ramananda for bug#4407165 */
1627: last_updated_by = fnd_global.user_id
1628: WHERE reference_id = p_reference_id;
1629:
1630: lv_statement := '2';
1631: p_process_flag := jai_constants.successful;
1632:
1633: EXCEPTION
1634: WHEN OTHERS THEN
1635: p_process_flag := jai_constants.unexpected_error;
1631: p_process_flag := jai_constants.successful;
1632:
1633: EXCEPTION
1634: WHEN OTHERS THEN
1635: p_process_flag := jai_constants.unexpected_error;
1636: p_process_message := 'jai_cmn_rgm_recording_pkg.update_reference (Stmt'||lv_statement||') Error Occured:'||SQLERRM;
1637: END update_reference;
1638:
1639:
1681: WHERE regime_id = cp_regime_id
1682: AND organization_type = cp_orgn_type
1683: AND organization_id = cp_orgn_id
1684: and (cp_location_id is null or location_id = cp_location_id)
1685: AND registration_type = jai_constants.regn_type_others
1686: AND attribute_type_code = p_att_type_code;
1687:
1688: lv_regime_code JAI_RGM_DEFINITIONS.regime_code%TYPE;
1689: ld_transaction_date DATE;
1710: CLOSE c_primary_regno;
1711:
1712: lv_statement_id := '4';
1713: /* Rounding */
1714: pn_credit_amount := round( pn_credit_amount, jai_constants.vat_rgm_rnd_factor);
1715: pn_debit_amount := round( pn_debit_amount, jai_constants.vat_rgm_rnd_factor);
1716:
1717: lv_statement_id := '5';
1718: INSERT INTO jai_rgm_trx_records(
1711:
1712: lv_statement_id := '4';
1713: /* Rounding */
1714: pn_credit_amount := round( pn_credit_amount, jai_constants.vat_rgm_rnd_factor);
1715: pn_debit_amount := round( pn_debit_amount, jai_constants.vat_rgm_rnd_factor);
1716:
1717: lv_statement_id := '5';
1718: INSERT INTO jai_rgm_trx_records(
1719: repository_id, regime_code, tax_type, source,
1730: pn_source_id, pv_source_table_name, ld_transaction_date, pn_debit_amount, pn_credit_amount,
1731: null, null, null, pv_organization_type,
1732: pn_organization_id, pn_location_id, pv_account_name, pn_charge_account_id, pn_balancing_account_id,
1733: pn_reference_id, pv_source_trx_type, pn_tax_rate, pn_assessable_value, pn_batch_id,
1734: jai_constants.func_curr, null, null, pn_credit_amount, pn_debit_amount,
1735: sysdate, FND_GLOBAL.user_id, sysdate, FND_GLOBAL.user_id, fnd_global.login_id,
1736: pv_attribute_context, pv_attribute1, pv_attribute2, pv_attribute3, pv_attribute4, pv_attribute5
1737: , pn_inv_organization_id, lv_primary_regime_regno, pv_invoice_no, pd_invoice_date
1738: ) RETURNING repository_id INTO pn_repository_id;
1736: pv_attribute_context, pv_attribute1, pv_attribute2, pv_attribute3, pv_attribute4, pv_attribute5
1737: , pn_inv_organization_id, lv_primary_regime_regno, pv_invoice_no, pd_invoice_date
1738: ) RETURNING repository_id INTO pn_repository_id;
1739:
1740: pv_process_flag := jai_constants.successful;
1741: lv_statement_id := '6';
1742:
1743: EXCEPTION
1744: WHEN OTHERS THEN
1741: lv_statement_id := '6';
1742:
1743: EXCEPTION
1744: WHEN OTHERS THEN
1745: pv_process_flag := jai_constants.unexpected_error;
1746: pv_process_message := 'insert_vat_repository_entry Error(Stmt:'||lv_statement_id||') Occured:'||SQLERRM;
1747: --lv_codepath := jai_general_pkg.plot_codepath(-999, lv_codepath);
1748: Fnd_file.put_line( fnd_file.log, 'Error in insert_vat_repository_entry. Stmt:'||lv_statement_id);
1749: END insert_vat_repository_entry;
1831: lv_source := r_repo_dtl.source;
1832: lv_source_trx_type := r_repo_dtl.source_trx_type;
1833: lv_source_table_name := r_repo_dtl.source_table_name;
1834: ln_source_id := r_repo_dtl.source_document_id;
1835: lv_repository_name := jai_constants.repository_name;
1836: ln_repository_id := pn_repository_id;
1837: END IF;
1838:
1839: lv_statement_id := '4';
1885: p_repository_name => lv_repository_name,
1886: p_repository_id => ln_repository_id,
1887: p_reference_name => null, --lv_reference_name,
1888: p_reference_id => null, --ln_reference_id,
1889: p_currency_code => jai_constants.func_curr, --p_currency_code,
1890: p_curr_conv_date => null, --p_curr_conv_date,
1891: p_curr_conv_type => null, -- p_curr_conv_type,
1892: p_curr_conv_rate => null --p_curr_conv_rate
1893: );
1927: p_repository_name => lv_repository_name,
1928: p_repository_id => ln_repository_id,
1929: p_reference_name => null, --lv_reference_name,
1930: p_reference_id => null, --ln_reference_id,
1931: p_currency_code => jai_constants.func_curr, --p_currency_code,
1932: p_curr_conv_date => null, --p_curr_conv_date,
1933: p_curr_conv_type => null, -- p_curr_conv_type,
1934: p_curr_conv_rate => null --p_curr_conv_rate
1935: );
1935: );
1936:
1937: END IF;
1938:
1939: pv_process_flag := jai_constants.successful;
1940: lv_statement_id := '15';
1941: jai_cmn_utils_pkg.print_log('6395039.log',lv_statement_id);
1942:
1943: EXCEPTION
1941: jai_cmn_utils_pkg.print_log('6395039.log',lv_statement_id);
1942:
1943: EXCEPTION
1944: WHEN OTHERS THEN
1945: pv_process_flag := jai_constants.unexpected_error;
1946: pv_process_message := 'doVatAccounting Error(Stmt:'||lv_statement_id||') Occured:'||SQLERRM;
1947: --lv_codepath := jai_general_pkg.plot_codepath(-999, lv_codepath);
1948: jai_cmn_utils_pkg.print_log('6395039.log', 'Error in doVatAccounting. Stmt:'||lv_statement_id);
1949: Fnd_file.put_line( fnd_file.log, 'Error in doVatAccounting. Stmt:'||lv_statement_id);