DBA Data[Home] [Help]

APPS.JAI_AP_TDS_CANCELLATION_PKG SQL Statements

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

Line: 40

                         and also commented the update for tax_amount
                         (2)Also raised exception if P_TOKEN is not null

5.      23-Aug-2005     Bug4559756. Added by Lakshmi Gopalsami version 120.3
                        (1) Added org_id in cursor c_ap_invoices_all
			(2) Fetched the same before calling ap_utilities_pkg
			    and passed the same the package call.
			 To get the period name and date.

6.    22-nov-2005  Bug 47541213. Added by Lakshmi Gopalsami
                          Changed JAI_TDS_SECTION to TDS_SECTION

7.    03/11/2006   Sanjikum for Bug#5131075, File Version 120.5
                   1) Changes are done for forward porting of bugs - 4718907, 5193852, 4947469

                   Dependency Due to this Bug
                   --------------------------
                   Yes, as Package spec is changed and there are multiple files changed as part of current

 8.		03/05/2007   Bug 5722028. Added by CSahoo 120.6
 									 Forward porting to R12.
                	 passed parameter pd_creation_Date to generate_tdS_invoices
										changed the value to tax_amount instead of calc_tax_amount.
										Depedencies:
										=============
										jai_ap_tds_gen.pls - 120.5
										jai_ap_tds_gen.plb - 120.19
										jai_ap_tds_ppay.pls - 120.2
										jai_ap_tds_ppay.plb - 120.5
										jai_ap_tds_can.plb - 120.6

9. 14/05/2007	bduvarag for the Bug#5722028.
		Removed redundant column names that were causing error

---------------------------------------------------------------------------- */

/***********************************************************************************************/

  procedure process_invoice
  (
    errbuf                               out    nocopy     varchar2,
    retcode                              out    nocopy     varchar2,
    p_invoice_id                         in                number
  )
  is

    cursor c_jai_ap_tds_thhold_trxs (p_invoice_id number,cp_tds_event jai_ap_tds_thhold_trxs.tds_event%type) is--rchandan for bug#4428980
      select threshold_trx_id,
             threshold_grp_id,
             threshold_hdr_id,  --Added by Sanjikum for Bug#5131075(4718907)
             tax_id,
             taxable_amount,
             tax_amount,
             invoice_to_tds_authority_id,
             invoice_to_vendor_id
      from   jai_ap_tds_thhold_trxs
      where  invoice_id = p_invoice_id
      and    tds_event = cp_tds_event;--rchandan for bug#4428980
Line: 100

        select  vendor_id,
                vendor_site_id,
                tax_rate
        from    JAI_CMN_TAXES_ALL
        where   tax_id = p_tax_id;
Line: 111

        select invoice_id,
               cancelled_date,
               payment_status_flag,
               invoice_amount,
               set_of_books_id,
               invoice_num,
               org_id
        from   ap_invoices_all
        where  invoice_id = p_invoice_id;
Line: 122

      select   set_of_books_id,
               invoice_currency_code,
               exchange_rate
      from     ap_invoices_all
      where    invoice_id = p_invoice_id;
Line: 130

      select  threshold_grp_id,
              actual_tax_id tax_id,
              sum(amount) taxable_amount,
              sum(tax_amount) tax_amount
      from    jai_ap_tds_inv_taxes jtdsi
      where   invoice_id = p_invoice_id
      and     section_type =  cp_section_type --cp_section_type--rchandan for bug#4428980
      and     threshold_grp_id is not null
      and     threshold_trx_id is null
      group by threshold_grp_id, actual_tax_id;
Line: 142

      select currency_code
      from   gl_sets_of_books
      where  set_of_books_id = cp_set_of_books_id;
Line: 153

    SELECT accounting_date
      FROM ap_invoice_distributions_all
     WHERE invoice_id = cp_invoice_id
       AND distribution_line_number = 1;
Line: 185

    ld_out_last_update_date             date;
Line: 331

      ld_out_last_update_date         :=      null;
Line: 390

         P_last_updated_by                =>    fnd_global.user_id                       ,
         P_last_update_login              =>    fnd_global.login_id                      ,
         --P_set_of_books_id              =>    r_ap_invoices_all.set_of_books_id        ,
         P_accounting_date                =>    ld_accounting_date                       ,
         --P_period_name                  =>    lv_open_period                           ,
         P_message_name                   =>    lv_out_message_name                      ,
         P_invoice_amount                 =>    ln_out_invoice_amount                    ,
         P_base_amount                    =>    ln_out_base_amount                       ,
         --P_tax_amount                   =>    ln_out_tax_amount                        ,
         P_temp_cancelled_amount          =>    ln_out_temp_cancelled_amount             ,
         P_cancelled_by                   =>    ln_out_cancelled_by                      ,
         P_cancelled_amount               =>    ln_out_cancelled_amount                  ,
         P_cancelled_date                 =>    ld_out_cancelled_date                    ,
         P_last_update_date               =>    ld_out_last_update_date                  ,
         P_original_prepayment_amount     =>    ln_out_original_prepay_amount            ,
         --P_check_id                     =>    null                                     ,
         P_pay_curr_invoice_amount        =>    ln_out_pay_curr_inv_amount               ,
         P_Token                          =>    lv_token,
         P_calling_sequence               =>    'India Localization - cancel TDS invoice'
      );
Line: 424

         Commented the tax_amount update */

      update  ap_invoices_all
      set     invoice_amount                =           ln_out_invoice_amount           ,
              base_amount                   =           ln_out_base_amount              ,
              --tax_amount                    =           ln_out_tax_amount               ,
              temp_cancelled_amount         =           ln_out_temp_cancelled_amount    ,
              cancelled_by                  =           ln_out_cancelled_by             ,
              cancelled_amount              =           ln_out_cancelled_amount         ,
              cancelled_date                =           ld_out_cancelled_date           ,
              last_update_date              =           ld_out_last_update_date         ,
              original_prepayment_amount    =           ln_out_original_prepay_amount   ,
              pay_curr_invoice_amount       =           ln_out_pay_curr_inv_amount
      where   invoice_id  =   cur_rec.invoice_to_tds_authority_id;
Line: 492

        ld_out_last_update_date         :=      null;
Line: 551

           P_last_updated_by                =>    fnd_global.user_id                       ,
           P_last_update_login              =>    fnd_global.login_id                      ,
           --P_set_of_books_id              =>    r_ap_invoices_all.set_of_books_id        ,
           P_accounting_date                =>    ld_accounting_date                       ,
           --P_period_name                  =>    lv_open_period                           ,
           P_message_name                   =>    lv_out_message_name                      ,
           P_invoice_amount                 =>    ln_out_invoice_amount                    ,
           P_base_amount                    =>    ln_out_base_amount                       ,
           --P_tax_amount                   =>    ln_out_tax_amount                        ,
           P_temp_cancelled_amount          =>    ln_out_temp_cancelled_amount             ,
           P_cancelled_by                   =>    ln_out_cancelled_by                      ,
           P_cancelled_amount               =>    ln_out_cancelled_amount                  ,
           P_cancelled_date                 =>    ld_out_cancelled_date                    ,
           P_last_update_date               =>    ld_out_last_update_date                  ,
           P_original_prepayment_amount     =>    ln_out_original_prepay_amount            ,
           --P_check_id                     =>    null                                     ,
           P_pay_curr_invoice_amount        =>    ln_out_pay_curr_inv_amount               ,
           P_token                          =>    lv_token                                 ,
           P_calling_sequence               =>    'India Localization - cancel TDS invoice'
        );
Line: 584

         Commented the tax_amount update */
        update  ap_invoices_all
        set     invoice_amount                =           ln_out_invoice_amount           ,
                base_amount                   =           ln_out_base_amount              ,
               -- tax_amount                    =           ln_out_tax_amount               ,
                temp_cancelled_amount         =           ln_out_temp_cancelled_amount    ,
                cancelled_by                  =           ln_out_cancelled_by             ,
                cancelled_amount              =           ln_out_cancelled_amount         ,
                cancelled_date                =           ld_out_cancelled_date           ,
                last_update_date              =           ld_out_last_update_date         ,
                original_prepayment_amount    =           ln_out_original_prepay_amount   ,
                pay_curr_invoice_amount       =           ln_out_pay_curr_inv_amount
        where   invoice_id  =   cur_rec.invoice_to_vendor_id;
Line: 643

        /* Update the total tax amount for which Cancel invoice was raised */


      end if; /* Credit memo to the supplier paid / not paid */
Line: 668

      /* Update threshold for the cancel invoice amount */

    	ln_threshold_grp_id := cur_rec.threshold_grp_id;/*added by rchandan for bug#5131075(4947469)*/
Line: 684

      /* insert into JAI_AP_TDS_INV_CANCELS */
      lv_codepath := jai_general_pkg.plot_codepath(19, lv_codepath); /* 19 */
Line: 687

      insert into jai_ap_tds_inv_cancels
      (
        tds_inv_cancel_id                       ,
        invoice_id                              ,
        threshold_grp_id                        ,
        cancel_amount                           ,
        parent_threshold_trx_id                 ,
        tax_id                                  ,
        tds_invoice_flag                        ,
        tds_invoice_message                     ,
        tds_credit_memo_flag                    ,
        tds_credit_memo_message                 ,
        threshold_trx_id_cancel                 ,
        created_by                              ,
        creation_date                           ,
        last_updated_by                         ,
        last_update_date                        ,
        last_update_login
      )
      values
      (
        jai_ap_tds_inv_cancels_s.nextval        ,
        p_invoice_id                            ,
        cur_rec.threshold_grp_id                ,
        cur_rec.taxable_amount                  ,
        cur_rec.threshold_trx_id                ,
        cur_rec.tax_id                          ,
        lv_tds_invoice_flag                     ,
        lv_tds_invoice_message                  ,
        lv_tds_credit_memo_flag                 ,
        lv_tds_credit_memo_message              ,
        ln_threshold_trx_id                     ,
        fnd_global.user_id                      ,
        sysdate                                 ,
        fnd_global.user_id                      ,
        sysdate                                 ,
        fnd_global.login_id
      );
Line: 856

      insert into jai_ap_tds_inv_cancels
      (
        tds_inv_cancel_id                       ,
        invoice_id                              ,
        threshold_grp_id                        ,
        cancel_amount                           ,
        parent_threshold_trx_id                 ,
        tax_id                                  ,
        tds_invoice_flag                        ,
        tds_invoice_message                     ,
        tds_credit_memo_flag                    ,
        tds_credit_memo_message                 ,
        threshold_trx_id_cancel                 ,
        created_by                              ,
        creation_date                           ,
        last_updated_by                         ,
        last_update_date                        ,
        last_update_login
      )
      values
      (
        jai_ap_tds_inv_cancels_s.nextval        ,
        p_invoice_id                            ,
        cur_rec.threshold_grp_id                ,
        ln_taxable_amount                       ,
        null                                    ,
        cur_rec.tax_id                          ,
        null                                    ,
        null                                    ,
        null                                    ,
        null                                    ,
        null                                    ,
        fnd_global.user_id                      ,
        sysdate                                 ,
        fnd_global.user_id                      ,
        sysdate                                 ,
        fnd_global.login_id
      );