DBA Data[Home] [Help]

APPS.JAI_RGM_THHOLD_PROC_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 37

	                      Update for get TCS financial year from TCS regime setup.
    ---------------------------------------------------------------------------- */

  /*----------------------------------------- PRIVATE MEMBERS DECLRATION -------------------------------------*/

      /** Package level variables used in debug package*/
      lv_object_name  jai_cmn_debug_contexts.log_context%type default 'TCS.JAI_RGM_THHOLD_PROC_PKG';
Line: 84

  SELECT jrr.ATTRIBUTE_VALUE
  FROM   JAI_RGM_DEFINITIONS       jrd,
         JAI_RGM_REGISTRATIONS     jrr
  WHERE  jrd.REGIME_ID = jrr.REGIME_ID
  AND    jrr.ATTRIBUTE_CODE = cp_attr_code
  AND    jrd.REGIME_CODE = cp_rgm_code;
Line: 95

  SELECT a.PERIOD_YEAR
  FROM   GL_PERIODS a
       , gl_period_sets b
  WHERE  a.PERIOD_SET_NAME = b.period_set_name
  AND    b.period_set_id = cp_calendar_id
  AND    cp_accounting_date BETWEEN a.START_DATE AND a.END_DATE;
Line: 171

    select hdr.regime_id
          ,hdr.threshold_slab_id
          ,dtls.threshold_dtl_id
          ,dtls.threshold_base_amt
          ,dtls.item_classification
          ,nvl(dtls.manual_surcharge_amt,0) manual_surcharge_amt
          ,nvl(dtls.system_surcharge_amt,0) system_surcharge_amt
          ,nvl(dtls.system_surcharge_cess_amt,0) system_surcharge_cess_amt
          ,nvl(dtls.system_surcharge_sh_cess_amt,0) system_surcharge_sh_cess_amt --Bgowrava for forward porting bug#5989740
    from   jai_rgm_threshold_dtls dtls
          ,jai_rgm_thresholds hdr
    where  hdr.threshold_id   = p_threshold_id
    and    dtls.threshold_id   = hdr.threshold_id ;
Line: 187

      select currency_code
      from    gl_sets_of_books gsb
            , hr_operating_units hou
      where  gsb.set_of_books_id = hou.set_of_books_id
      and    hou.organization_id = cp_org_id;
Line: 197

        select *
        from   jai_rgm_refs_all
        where  (  (cp_transaction_id is not null and transaction_id = cp_transaction_id)
              or  (cp_trx_ref_id     is not null and trx_ref_id = cp_trx_ref_id)
               );
Line: 209

        select tax_id
              ,tax_type
              ,tax_rate
        from  jai_rgm_taxes
        where trx_ref_id = ( select max(trx_ref_id)
                             from   jai_rgm_refs_all
                             where  source_document_id  =  jai_constants.tcs_surcharge_id
                             and    org_tan_no          = cp_org_tan_no
                             and    fin_year            = cp_fin_year
                             and    party_id            = cp_party_id
                             and    item_classification = cp_item_classification
                             and    party_type          = jai_constants.party_type_customer
                            );
Line: 232

     SELECT
             jai_rgm_refs_all_s2.nextval
     FROM
             dual;
Line: 263

        select  tax.tax_rate
              , tax.rounding_factor
              , tax.tax_id
              , cat.line_no
        from   JAI_CMN_TAXES_ALL tax
              ,JAI_CMN_TAX_CTG_LINES cat
        where  cat.tax_id = tax.tax_id
        and    cat.tax_category_id = p_threshold_tax_cat_id
        and    tax.tax_type = cp_tax_type
        and    cat.precedence_1 = nvl(cp_line_no, cat.precedence_1);     -- This will check that for CESS precedence should be of surcharge
Line: 529

        goto update_and_return;
Line: 592

      || Insert repository reference for the document to be generated
      */

  /*    jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'Before: JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_REFERENCES',jai_cmn_debug_contexts_pkg.summary);*/ --commented by bgowrava for bug#5631784
Line: 596

      jai_ar_tcs_rep_pkg.insert_repository_references
          ( p_regime_id                  =>              r_thhold_info.regime_id
          , p_transaction_id             =>              ln_transaction_id
          , p_source_ref_document_id     =>              r_ref_dtls.source_ref_document_id
          , p_source_ref_document_type   =>              r_ref_dtls.source_ref_document_type
          , p_parent_transaction_id      =>              r_ref_dtls.parent_transaction_id
          , p_org_tan_no                 =>              r_ref_dtls.org_tan_no
          , p_document_id                =>              jai_constants.tcs_surcharge_id
          , p_document_type              =>              jai_constants.tcs_event_surcharge
          , p_document_line_id           =>              jai_constants.tcs_surcharge_id
          , p_document_date              =>              r_ref_dtls.source_document_date
          , p_table_name                 =>              jai_constants.jai_rgm_thresholds
          , p_line_amount                =>              (ln_surcharge_doc_amt + ln_surcharge_doc_cess_amt + ln_surcharge_doc_sh_cess_amt) --Bgowrava for forward porting bug#5989740
          , p_document_amount            =>              (ln_surcharge_doc_amt + ln_surcharge_doc_cess_amt + ln_surcharge_doc_sh_cess_amt) --Bgowrava for forward porting bug#5989740
          , p_org_id                     =>              r_ref_dtls.org_id
          , p_organization_id            =>              r_ref_dtls.organization_id
          , p_party_id                   =>              r_ref_dtls.party_id
          , p_party_site_id              =>              r_ref_dtls.party_site_id
          , p_item_classification        =>              r_thhold_info.item_classification
          , p_trx_ref_id                 =>              ln_trx_ref_id
          , p_process_flag               =>              p_process_flag
          , p_process_message            =>              p_process_message
          );
Line: 619

  /*    jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'After: JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_REFERENCES',jai_cmn_debug_contexts_pkg.summary);
Line: 631

      || Insert repository taxes
      */
      /*
        Insert surcharge type of tax
      */

 /*     jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'Before Surcharge Tax: JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_TAXES',jai_cmn_debug_contexts_pkg.summary);*/ --commented by bgowrava for bug#5631784
Line: 638

      jai_ar_tcs_rep_pkg.insert_repository_taxes
        (
           p_trx_ref_id       =>   ln_trx_ref_id
        ,  p_tax_id           =>   ln_surcharge_tax_id
        ,  p_tax_type         =>   jai_constants.tax_type_tcs_surcharge
        ,  p_tax_rate         =>   ln_surcharge_tax_rate
        ,  p_tax_amount       =>   ln_surcharge_doc_amt
        ,  p_func_tax_amount  =>   ln_surcharge_doc_amt /* Functional currency is same as trx currency */
        ,  p_currency_code    =>   ln_currency_code
        ,  p_process_flag     =>   p_process_flag
        ,  p_process_message  =>   p_process_message
        );
Line: 650

  /*     jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'After Surcharge Tax: JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_TAXES',jai_cmn_debug_contexts_pkg.summary);
Line: 657

  /*    jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'Before Surcharge Cess : JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_TAXES',jai_cmn_debug_contexts_pkg.summary);*/ --commented by bgowrava for bug#5631784
Line: 658

       /* Insert surcharge cess type of tax */
      jai_ar_tcs_rep_pkg.insert_repository_taxes
        (
           p_trx_ref_id       =>   ln_trx_ref_id
        ,  p_tax_id           =>   ln_surcharge_cess_tax_id
        ,  p_tax_type         =>   jai_constants.tax_type_tcs_cess
        ,  p_tax_rate         =>   ln_surcharge_cess_tax_rate
        ,  p_tax_amount       =>   ln_surcharge_doc_cess_amt
        ,  p_func_tax_amount  =>   ln_surcharge_doc_cess_amt /* Functional currency is same as trx currency */
        ,  p_currency_code    =>   ln_currency_code
        ,  p_process_flag     =>   p_process_flag
        ,  p_process_message  =>   p_process_message
        );
Line: 671

   /*     jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'After Surcharge Cess : JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_TAXES',jai_cmn_debug_contexts_pkg.summary);
Line: 680

		       jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'Before Secondary and higher Surcharge Cess : JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_TAXES',jai_cmn_debug_contexts_pkg.summary);
Line: 681

		        /* Insert surcharge cess type of tax */
		       jai_ar_tcs_rep_pkg.insert_repository_taxes
		         (
		            p_trx_ref_id       =>   ln_trx_ref_id
		         ,  p_tax_id           =>   ln_surcharge_cess_tax_id
		         ,  p_tax_type         =>   jai_constants.tax_type_sh_tcs_edu_cess
		         ,  p_tax_rate         =>   ln_surcharge_cess_tax_rate
		         ,  p_tax_amount       =>   ln_surcharge_doc_sh_cess_amt
		         ,  p_func_tax_amount  =>   ln_surcharge_doc_sh_cess_amt /* Functional currency is same as trx currency */
		         ,  p_currency_code    =>   ln_currency_code
		         ,  p_process_flag     =>   p_process_flag
		         ,  p_process_message  =>   p_process_message
		         );
Line: 694

		         jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'After Surcharge Cess : JAI_AR_TCS_REP_PKG.INSERT_REPOSITORY_TAXES',jai_cmn_debug_contexts_pkg.summary);
Line: 708

        || Get Repository Reference for consolidated document record inserted above
        */
        open  c_get_ref_dtls (cp_trx_ref_id => ln_trx_ref_id) ;
Line: 731

      <>
      /** Update System surcharge/cess amouts */
      update  jai_rgm_threshold_dtls
      set     system_surcharge_amt      =   system_surcharge_amt      + ln_surcharge_doc_amt
      ,       system_surcharge_cess_amt =   system_surcharge_cess_amt + ln_surcharge_doc_cess_amt
      ,       system_surcharge_sh_cess_amt =   system_surcharge_sh_cess_amt + ln_surcharge_doc_sh_cess_amt --Bgowrava for forward porting bug#5989740
      ,       last_update_date          =   sysdate
      ,       last_updated_by           =   ln_user_id
      ,       last_update_login         =   ln_login_id
      where   threshold_dtl_id          =   r_thhold_info.threshold_dtl_id;
Line: 809

    select
           attribute_value org_tan_no
    from
           JAI_RGM_ORG_REGNS_V rgm_attr_v
    where
           rgm_attr_v.regime_id           =   cp_regime_id
    and    rgm_attr_v.attribute_code      =   cp_attribute_code
    and    rgm_attr_v.attribute_type_code =   cp_attribute_type_code
    and    rgm_attr_v.organization_id     =   cp_organization_id;
Line: 830

    select
            thslbs.threshold_slab_id
    from
            jai_ap_tds_thhold_slabs thslbs
           ,jai_ap_tds_thhold_types thtyps
           ,jai_ap_tds_thhold_hdrs  thhdrs
           ,jai_rgm_thresholds      rgmths
    where
            thslbs.threshold_type_id  = thtyps.threshold_type_id
     and    thtyps.threshold_hdr_id   = thhdrs.threshold_hdr_id
     and    thhdrs.regime_id          = rgmths.regime_id
     and    thtyps.threshold_type     = jai_constants.thhold_typ_cumulative
     and    rgmths.fin_year           = cp_fin_year
     and    rgmths.party_id           = cp_party_id
     and    rgmths.org_tan_no         = cp_org_tan_no
     and    rgmths.party_type         = cp_party_type
     and    thhdrs.customer_type_lookup_code = cp_customer_type_lkup_code
     and    trunc(p_source_trx_date)      between thtyps.from_date
                                          and     nvl(thtyps.to_date, trunc(p_source_trx_date))
     and    nvl(rgmths.total_threshold_amt,0)    between thslbs.from_amount
                                          and nvl(thslbs.to_amount,nvl(rgmths.total_threshold_amt,0));
Line: 861

    select threshold_slab_id
    from   jai_rgm_thresholds
    where  fin_year     =   cp_fin_year
    and    org_tan_no   =   cp_org_tan_no
    and    party_type   =   cp_party_type
    and    party_id     =   cp_party_id
    and    regime_id    =   p_regime_id;
Line: 871

      select tcs_customer_type
      from   JAI_CMN_CUS_ADDRESSES
      where  customer_id  = p_party_id
      AND tcs_customer_type IS NOT NULL;  --added the AND condition for bug#6156619
Line: 978

    /** This is an internal call.  Hence fetch the applicable slab id for amount updated in the jai_rgm_thresholds */

      /**
        Assumption: To fetch slab from the setup transaction date is mandatory
      */
      if p_source_trx_date is null then
        p_process_flag    := jai_constants.expected_error;
Line: 1078

    select
            thtaxes.tax_category_id
    from
            jai_ap_tds_thhold_taxes thtaxes
    where
            thtaxes.threshold_slab_id = p_threshold_slab_id
    and     operating_unit_id         = p_org_id;
Line: 1226

              select 1
              from   JAI_OM_WSH_LINE_TAXES line, JAI_CMN_TAX_CTG_LINES cat
              where  line.tax_id              =   cat.tax_id
              and    line.delivery_detail_id  =   p_source_trx_line_id
              and    cat.tax_category_id      =   p_threshold_tax_cat_id;
Line: 1242

              select 1
              from   JAI_AR_TRX_TAX_LINES line, JAI_CMN_TAX_CTG_LINES cat
              where  line.tax_id                    =   cat.tax_id
              and    line.link_to_cust_trx_line_id  =   p_source_trx_line_id
              and    cat.tax_category_id            =   p_threshold_tax_cat_id;
Line: 1278

        insert into JAI_OM_WSH_LINE_TAXES
                    (    picking_line_id
                     ,   tax_line_no
                     ,   precedence_1
                     ,   precedence_2
                     ,   precedence_3
                     ,   precedence_4
                     ,   precedence_5
                     ,   tax_id
                     ,   tax_rate
                     ,   qty_rate
                     ,   uom
                     ,   tax_amount
                     ,   func_tax_amount
                     ,   base_tax_amount
                     ,   creation_date
                     ,   created_by
                     ,   last_update_date
                     ,   last_updated_by
                     ,   last_update_login
                     ,   delivery_detail_id
                     ,   precedence_6
                     ,   precedence_7
                     ,   precedence_8
                     ,   precedence_9
                     ,   precedence_10
                    )
        values      (    null
                    ,    r_taxes.lno
                    ,    r_taxes.p_1
                    ,    r_taxes.p_2
                    ,    r_taxes.p_3
                    ,    r_taxes.p_4
                    ,    r_taxes.p_5
                    ,    r_taxes.tax_id
                    ,    r_taxes.tax_rate
                    ,    null
                    ,    r_taxes.tax_amount
                    ,    r_taxes.uom_code
                    ,    null
                    ,    null
                    ,    sysdate
                    ,    ln_user_id
                    ,    sysdate
                    ,    ln_user_id
                    ,    ln_login_id
                    ,    p_source_trx_line_id
                    ,    r_taxes.p_6
                    ,    r_taxes.p_7
                    ,    r_taxes.p_8
                    ,    r_taxes.p_9
                    ,    r_taxes.p_10
                    );
Line: 1332

        insert into JAI_AR_TRX_TAX_LINES
                  (
                     tax_line_no
                    ,customer_trx_line_id
                    ,link_to_cust_trx_line_id
                    ,precedence_1
                    ,precedence_2
                    ,precedence_3
                    ,precedence_4
                    ,precedence_5
                    ,tax_id
                    ,tax_rate
                    ,qty_rate
                    ,uom
                    ,tax_amount
                    ,invoice_class
                    ,func_tax_amount
                    ,base_tax_amount
                    ,creation_date
                    ,created_by
                    ,last_update_date
                    ,last_updated_by
                    ,last_update_login
                    ,precedence_6
                    ,precedence_7
                    ,precedence_8
                    ,precedence_9
                    ,precedence_10
                  )
          values  (
                     r_taxes.lno                                  --tax_line_no
                   , ra_customer_trx_lines_s.nextval              --customer_trx_line_id
                   , p_source_trx_line_id                         --link_to_cust_trx_line_id
                   , r_taxes.p_1                                  --precedence_1
                   , r_taxes.p_2                                  --precedence_2
                   , r_taxes.p_3                                  --precedence_3
                   , r_taxes.p_4                                  --precedence_4
                   , r_taxes.p_5                                  --precedence_5
                   , r_taxes.tax_id                               --tax_id
                   , r_taxes.tax_rate                             --tax_rate
                   , null                                         --qty_rate
                   , r_taxes.uom_code                             --uom
                   , null                                         --tax_amount
                   , null                                         --invoice_class
                   , null                                         --func_tax_amount
                   , null                                         --base_tax_amount
                   , sysdate                                      --creation_date
                   , ln_user_id                                   --created_by
                   , sysdate                                      --last_update_date
                   , ln_user_id                                   --last_updated_by
                   , ln_login_id                                  --last_update_login
                   , r_taxes.p_6                                  --precedence_6
                   , r_taxes.p_7                                  --precedence_7
                   , r_taxes.p_8                                  --precedence_8
                   , r_taxes.p_9                                  --precedence_9
                   , r_taxes.p_10                                 --precedence_10
                  );
Line: 1398

    /** Call ja_in_calc_prec_taxes procedure in recalculate taxes mode to recalculate taxes and update the related table */
    ln_tax_amount := p_base_tax_amt ;
Line: 1415

                ,  p_last_update_date      =>    sysdate
                ,  p_last_updated_by       =>    ln_user_id
                ,  p_last_update_login     =>    ln_login_id
                ,  p_vat_assessable_value  =>    p_vat_assessable_value
                ,  p_thhold_cat_base_tax_typ=>   jai_constants.tax_type_tcs
                ,  p_threshold_tax_cat_id  =>    p_threshold_tax_cat_id
                ,  p_source_trx_type       =>    p_source_event
                ,  p_action                =>    jai_constants.recalculate_taxes
				-- Commented by Chong for revert GST changes 2012/10/19
                --,  pn_gst_assessable_value =>    pn_gst_assessable_value   -- Added by Jia for GST Bug#10091373 on 2010/09/10
                );
Line: 1456

      select regime_id
           , org_tan_no
           , party_id
           , party_type
           , fin_year
           , item_classification
           , source_document_type
           , sum(nvl(source_document_amt,0)) source_document_amt
           , source_document_date
           , org_id
      from  jai_rgm_refs_all trxref
      where trxref.transaction_id = p_transaction_id
      group by
             regime_id
           , org_tan_no
           , party_id
           , party_type
           , fin_year
           , item_classification
           , source_document_type
           , source_document_date
           , org_id;
Line: 1486

      select  threshold_id
            , threshold_slab_id
      from    jai_rgm_thresholds
      where   regime_id   = cp_regime_id
      and     org_tan_no  = cp_org_tan_no
      and     party_id    = cp_party_id
      and     party_type  = cp_party_type
      and     fin_year    = cp_fin_year;
Line: 1499

      select  threshold_dtl_id
            , invoice_amt
            , cash_receipt_amt
            , application_amt
            , unapplication_amt
            , reversal_amt
            , threshold_base_amt
            , manual_surcharge_amt
            , system_surcharge_amt
            , system_surcharge_cess_amt
            , system_surcharge_sh_cess_amt --Bgowrava for forward porting bug#5989740
      from   jai_rgm_threshold_dtls
      where  threshold_id         = cp_threshold_id
      and    item_classification  = cp_item_classification;
Line: 1516

      select   pan_no
      from     JAI_CMN_CUS_ADDRESSES
      where    customer_id = cp_customer_id
      and      confirm_pan = jai_constants.yes;
Line: 1523

      select   sum(rtax.func_tax_amt)
      from     jai_rgm_taxes rtax
             , jai_rgm_refs_all refs
      where    rtax.trx_ref_id     = refs.trx_ref_id
      and      refs.transaction_id = p_transaction_id
      and      rtax.tax_type       = cp_base_tax_type;
Line: 1534

      select   sum(rtax.func_tax_amt)
      from     jai_rgm_taxes        rtax
             , jai_rgm_refs_all     refs
      where    rtax.trx_ref_id      = refs.trx_ref_id
      and      rtax.tax_type        = cp_tax_type
      and      refs.transaction_id  = p_transaction_id
      and      rtax.tax_modified_by = nvl(cp_tax_modified_by,rtax.tax_modified_by);
Line: 1551

      select  sum(rtax.func_tax_amt)
      from    jai_rgm_taxes             rtax
            , jai_rgm_refs_all          refs
            , JAI_CMN_TAX_CTG_LINES  srch
            , JAI_CMN_TAX_CTG_LINES  srchcess
            , JAI_CMN_TAXES_ALL           tax
      where   rtax.trx_ref_id      = refs.trx_ref_id
      and     rtax.tax_type        = jai_constants.tax_type_tcs_cess
      and     srch.tax_category_id = cp_thhold_tax_cat_id
      and     srchcess.tax_category_id = srch.tax_category_id
      and     srchcess.precedence_1 = srch.line_no
      and     srchcess.tax_id       = rtax.tax_id
      and     srch.tax_id           = tax.tax_id
      and     tax.tax_type          = jai_constants.tax_type_tcs_surcharge
      and     refs.transaction_id   = p_transaction_id;
Line: 1571

      select  sum(rtax.func_tax_amt)
      from    jai_rgm_taxes             rtax
            , jai_rgm_refs_all          refs
            , JAI_CMN_TAX_CTG_LINES  srch
            , JAI_CMN_TAX_CTG_LINES  srchcess
            , JAI_CMN_TAXES_ALL           tax
      where   rtax.trx_ref_id      = refs.trx_ref_id
      and     rtax.tax_type        = jai_constants.tax_type_sh_tcs_edu_cess
      and     srch.tax_category_id = cp_thhold_tax_cat_id
      and     srchcess.tax_category_id = srch.tax_category_id
      and     srchcess.precedence_1 = srch.line_no
      and     srchcess.tax_id       = rtax.tax_id
      and     srch.tax_id           = tax.tax_id
      and     tax.tax_type          = jai_constants.tax_type_tcs_surcharge
      and     refs.transaction_id   = p_transaction_id;
Line: 1699

        lr_hdr_record.last_update_date          :=  sysdate                 ;
Line: 1700

        lr_hdr_record.last_updated_by           :=  ln_user_id              ;
Line: 1701

        lr_hdr_record.last_update_login         :=  ln_login_id             ;
Line: 1705

                                , 'Before insert into jai_rgm_thresholds'    || chr(10)
                                ||'lr_hdr_record.threshold_id              ='||lr_hdr_record.threshold_id             ||  chr(10)
                                ||'lr_hdr_record.regime_id                 ='||lr_hdr_record.regime_id                ||  chr(10)
                                ||'lr_hdr_record.org_tan_no                ='||lr_hdr_record.org_tan_no               ||  chr(10)
                                ||'lr_hdr_record.party_id                  ='||lr_hdr_record.party_id                 ||  chr(10)
                                ||'lr_hdr_record.party_type                ='||lr_hdr_record.party_type               ||  chr(10)
                                ||'lr_hdr_record.party_pan_no              ='||lr_hdr_record.party_pan_no             ||  chr(10)
                                ||'lr_hdr_record.threshold_slab_id         ='||lr_hdr_record.threshold_slab_id        ||  chr(10)
                                ||'lr_hdr_record.fin_year                  ='||lr_hdr_record.fin_year                 ||  chr(10)
                                ||'lr_hdr_record.total_threshold_amt       ='||lr_hdr_record.total_threshold_amt      ||  chr(10)
                                ||'lr_hdr_record.total_threshold_base_amt  ='||lr_hdr_record.total_threshold_base_amt ||  chr(10)
                                ||'lr_hdr_record.creation_date             ='||lr_hdr_record.creation_date            ||  chr(10)
                                ||'lr_hdr_record.created_by                ='||lr_hdr_record.created_by               ||  chr(10)
                                ||'lr_hdr_record.last_update_date          ='||lr_hdr_record.last_update_date         ||  chr(10)
                                ||'lr_hdr_record.last_updated_by           ='||lr_hdr_record.last_updated_by          ||  chr(10)
                                ||'lr_hdr_record.last_update_login         ='||lr_hdr_record.last_update_login        ||  chr(10)
                                );*/ --commented by bgowrava for bug#5631784
Line: 1723

        insert_threshold_hdr   (  p_record          =>    lr_hdr_record
                                , p_threshold_id    =>    ln_threshold_id
                                , p_row_id          =>    lx_row_id
                               );
Line: 1732

      ||Part -2 :- CREATE OR UPDATE TABLE JAI_RGM_THRESHOLD_DTLS
      ***************************************************************************************/
      /**
        Assumption:  When control comes here ln_threshold_id should NOT BE NULL.
      */
      if ln_threshold_id is null then
        p_process_flag    :=  jai_constants.expected_error;
Line: 1947

      lr_dtl_record.last_update_date     :=   sysdate;
Line: 1948

      lr_dtl_record.last_updated_by      :=   ln_user_id;
Line: 1949

      lr_dtl_record.last_update_login    :=   ln_login_id;
Line: 1970

        insert_threshold_dtl  ( p_record              =>  lr_dtl_record
                              , p_threshold_dtl_id    =>  ln_threshold_dtl_id
                              , p_row_id              =>  lx_row_id
                              );
Line: 1975

      else  /** Threshold detils record already exists.  Hence update the existing record to increment
            per item classificaton amounts */

    /*    jai_cmn_debug_contexts_pkg.print (ln_reg_id
                                ,'Updating JAI_RGM_THRESHOLD_DTLS' || chr(10)
                                ||'invoice_amt               ='||lr_dtl_record.invoice_amt          ||  chr(10)
                                ||'cash_receipt_amt          ='||lr_dtl_record.cash_receipt_amt     ||  chr(10)
                                ||'application_amt           ='||lr_dtl_record.application_amt      ||  chr(10)
                                ||'unapplication_amt         ='||lr_dtl_record.unapplication_amt    ||  chr(10)
                                ||'reversal_amt              ='||lr_dtl_record.reversal_amt         ||  chr(10)
                                ||'manual_surcharge_amt      ='||lr_dtl_record.manual_surcharge_amt ||  chr(10)
                                ||'system_surcharge_amt      ='||lr_dtl_record.system_surcharge_amt ||  chr(10)
                                ||'system_surcharge_cess_amt ='||lr_dtl_record.system_surcharge_cess_amt ||  chr(10)
                                ||'threshold_base_amt        ='||lr_dtl_record.threshold_base_amt   ||  chr(10)
                                ||'last_update_date          ='||sysdate                            ||  chr(10)
                                ||'last_updated_by           ='||ln_user_id                         ||  chr(10)
                                ||'last_update_login         ='||ln_login_id                        ||  chr(10)
                                ||'last_update_login         ='||ln_threshold_dtl_id
                                );	*/ --commented by bgowrava for bug#5631784
Line: 1995

        update jai_rgm_threshold_dtls
        set           invoice_amt                 =       lr_dtl_record.invoice_amt
                    , cash_receipt_amt            =       lr_dtl_record.cash_receipt_amt
                    , application_amt             =       lr_dtl_record.application_amt
                    , unapplication_amt           =       lr_dtl_record.unapplication_amt
                    , reversal_amt                =       lr_dtl_record.reversal_amt
                    , manual_surcharge_amt        =       lr_dtl_record.manual_surcharge_amt
                    , system_surcharge_amt        =       lr_dtl_record.system_surcharge_amt
                    , system_surcharge_cess_amt   =       lr_dtl_record.system_surcharge_cess_amt
                    , system_surcharge_sh_cess_amt   =       lr_dtl_record.system_surcharge_sh_cess_amt --Bgowrava for forward porting bug#5989740
                    , threshold_base_amt          =       lr_dtl_record.threshold_base_amt
                    , last_update_date            =       sysdate
                    , last_updated_by             =       ln_user_id
                    , last_update_login           =       ln_login_id
        where       threshold_dtl_id              =       lr_dtl_record.threshold_dtl_id;
Line: 2015

        ||  This is the last line of the document, so update the summary amounts maintained by header table.
        ||  As repository package is always making a call at document level (not at line level), this flag will
        ||  always be yes
        */
   /*     jai_cmn_debug_contexts_pkg.print ( ln_reg_id, 'Before : sync_threshold_header'); */ --commented by bgowrava for bug#5631784
Line: 2039

        /** Update jai_rgm_refs_all to punch the threshold_slab_id against all the transaction lines */

        if ln_new_thhold_slab_id is not null then
          update jai_rgm_refs_all
          set    threshold_slab_id = ln_new_thhold_slab_id
          where  transaction_id    = p_transaction_id;
Line: 2091

   procedure insert_threshold_dtl ( p_record              in          jai_rgm_threshold_dtls%rowtype
                                  , p_threshold_dtl_id    out nocopy  jai_rgm_threshold_dtls.threshold_dtl_id%type
                                  , p_row_id              out nocopy  rowid
                                  )
   is

   begin

    if p_record.threshold_dtl_id is null then
      select  jai_rgm_thresholds_s.nextval
      into    p_threshold_dtl_id
      from    dual;
Line: 2105

        insert into jai_rgm_threshold_dtls
                    ( threshold_dtl_id
                    , threshold_id
                    , item_classification
                    , invoice_amt
                    , cash_receipt_amt
                    , application_amt
                    , unapplication_amt
                    , reversal_amt
                    , manual_surcharge_amt
                    , system_surcharge_amt
                    , system_surcharge_cess_amt
                    , system_surcharge_sh_cess_amt --Bgowrava for forward porting bug#5989740
                    , threshold_base_amt
                    , creation_date
                    , created_by
                    , last_update_date
                    , last_updated_by
                    , last_update_login
                    )
        values
                    (
                      p_threshold_dtl_id
                    , p_record.threshold_id
                    , p_record.item_classification
                    , p_record.invoice_amt
                    , p_record.cash_receipt_amt
                    , p_record.application_amt
                    , p_record.unapplication_amt
                    , p_record.reversal_amt
                    , p_record.manual_surcharge_amt
                    , p_record.system_surcharge_amt
                    , p_record.system_surcharge_cess_amt
                    , p_record.system_surcharge_sh_cess_amt --Bgowrava for forward porting bug#5989740
                    , p_record.threshold_base_amt
                    , p_record.creation_date
                    , p_record.created_by
                    , p_record.last_update_date
                    , p_record.last_updated_by
                    , p_record.last_update_login
                    )
                    returning   rowid
                               ,threshold_dtl_id
                        into    p_row_id
                               ,p_threshold_dtl_id ;
Line: 2156

   end insert_threshold_dtl;
Line: 2158

  procedure insert_threshold_hdr   ( p_record          in            jai_rgm_thresholds%rowtype
                                    , p_threshold_id    out nocopy    jai_rgm_thresholds.threshold_id%type
                                    , p_row_id          out nocopy    rowid
                                    )
  is
  begin

    if p_record.threshold_id is null then
      select jai_rgm_thresholds_s.nextval
      into   p_threshold_id
      from   dual;
Line: 2171

    insert into jai_rgm_thresholds
                ( threshold_id
                , regime_id
                , org_tan_no
                , party_id
                , party_type
                , party_pan_no
                , threshold_slab_id
                , fin_year
                , total_threshold_amt
                , total_threshold_base_amt
                , creation_date
                , created_by
                , last_update_date
                , last_updated_by
                , last_update_login
                )
         values
                ( p_threshold_id
                , p_record.regime_id
                , p_record.org_tan_no
                , p_record.party_id
                , p_record.party_type
                , p_record.party_pan_no
                , p_record.threshold_slab_id
                , p_record.fin_year
                , p_record.total_threshold_amt
                , p_record.total_threshold_base_amt
                , p_record.creation_date
                , p_record.created_by
                , p_record.last_update_date
                , p_record.last_updated_by
                , p_record.last_update_login
                )
                returning   rowid
                           ,threshold_id
                    into    p_row_id
                           ,p_threshold_id ;
Line: 2214

  end insert_threshold_hdr;
Line: 2230

      select sum (   nvl(invoice_amt        ,0)
                   + nvl(cash_receipt_amt   ,0)
                   + nvl(application_amt    ,0)
                   + nvl(unapplication_amt  ,0)
                   + nvl(reversal_amt       ,0)
                  )         total_threshold_amt
            ,sum (   nvl(threshold_base_amt ,0)
                 )          total_threshold_base_amt
      from jai_rgm_threshold_dtls
      where threshold_id = p_threshold_id;
Line: 2243

      select regime_id
            ,org_tan_no
            ,party_type
            ,party_id
            ,fin_year
            ,threshold_slab_id
      from  jai_rgm_thresholds
      where threshold_id = p_threshold_id;
Line: 2295

    update jai_rgm_thresholds
    set    total_threshold_amt      =   ln_total_thhold_amt
          ,total_threshold_base_amt =   ln_total_thhold_base_amt
          ,last_updated_by          =   ln_user_id
          ,last_update_date         =   sysdate
          ,last_update_login        =   ln_login_id
    where threshold_id = p_threshold_id;
Line: 2341

      /** Slab is changed.  Hence update threshold slab in the jai_rgm_thresholds */
      update jai_rgm_thresholds
      set    threshold_slab_id  =  ln_new_thhold_slab_id
            ,last_update_date   =  sysdate
            ,last_updated_by    =  ln_user_id
            ,last_update_login  =  ln_login_id
      where  threshold_id       =  p_threshold_id;