DBA Data[Home] [Help]
Skip to content

PACKAGE BODY: APPS.JAI_ARRA_TRG_PKG

Source


1 PACKAGE BODY jai_arra_trg_pkg  AS
2 /* $Header: jai_arra_trg.plb 120.3 2011/11/21 08:27:42 erma ship $ */
3 
4 
5 /***************************************************************************************************
6 CREATED BY       : CSahoo
7 CREATED DATE     : 01-FEB-2007
8 ENHANCEMENT BUG  : 5631784
9 PURPOSE          : NEW ENH: TAX COLLECTION AT SOURCE IN RECEIVABLES
10 
11 -- #
12 -- # Change History -
13 
14 
15 1.  01/02/2007   CSahoo for bug#5631784. File Version 120.0
16 								 Forward Porting of 11i BUG#4742259 (TAX COLLECTION AT SOURCE IN RECEIVABLES)
17 
18 2.  16-Aug-2011 Bug 12808626
19                 Description: Unable to do Receipt Write Off if TCS Taxes are attached the Receipt
20                 Fix: Skipped the TCS Processing incase the entry in ar_receivable_applications_all is
21                 due to Receipt Write Off
22 
23 *******************************************************************************************************/
24 
25   /* Package levek variables used in debug package */
26   lv_object_name      jai_cmn_debug_contexts.LOG_CONTEXT%TYPE DEFAULT 'TCS.JAI_ARRA_TRG_PKG';
27   lv_member_name      jai_cmn_debug_contexts.LOG_CONTEXT%TYPE;
28   lv_context          jai_cmn_debug_contexts.LOG_CONTEXT%TYPE;
29 
30  PROCEDURE set_debug_context
31  IS
32  BEGIN
33    lv_context  := rtrim(lv_object_name || '.'||lv_member_name,'.');
34  END set_debug_context;
35 
36 
37   PROCEDURE process_app      (    r_new               IN              AR_RECEIVABLE_APPLICATIONS_ALL%ROWTYPE    ,
38                                   r_old               IN              AR_RECEIVABLE_APPLICATIONS_ALL%ROWTYPE    ,
39                                   p_process_flag      OUT NOCOPY      VARCHAR2                                  ,
40                                   p_process_message   OUT NOCOPY      VARCHAR2
41                              )
42 
43   /***********************************************************************************
44   || Created By    : Aiyer
45   || Creation Date : 22-09-2006
46   || Bug No        : 4742259
47   || Purpose       : Trigger package for ar_receivable_applications_all
48   || Called From   : Trigger jai_arra_ariud_trg
49   ************************************************************************************/
50   AS
51 
52     CURSOR c_payment_schedule IS
53     SELECT trx_number
54     FROM ar_payment_schedules_all
55     WHERE payment_schedule_id = r_new.applied_payment_schedule_id;
56 
57     ln_reg_id           NUMBER;
58     lv_process_flag           VARCHAR2(2)                       ;
59     lv_process_message        VARCHAR2(4000)                    ;
60     lv_payment_schedule       VARCHAR2(25)                      ;
61 
62   CURSOR c_get_regime_code (cp_cash_receipt_id NUMBER)
63 	 IS
64 	   SELECT b.regime_code
65 	     FROM JAI_RGM_REGISTRATIONS a,
66 	          JAI_RGM_DEFINITIONS b
67 	     WHERE a.attribute_code = 'AR_RECEIPT_CLASS'
68 	     AND   a.registration_type = 'OTHERS'
69 	     AND   a.attribute_type_code = 'OTHERS'
70 	     AND   a.regime_id = b.regime_id
71 	     AND a.attribute_value IN
72 	   (SELECT r_class.name
73 	      FROM ar_receipt_classes r_class,
74 	           ar_receipt_methods r_method,
75              ar_cash_receipts_all r_cash
76 	      WHERE r_class.receipt_class_id = r_method.receipt_class_id
77           AND r_cash.receipt_method_id = r_method.receipt_method_id
78 	        AND r_cash.cash_receipt_id = cp_cash_receipt_id
79 	    );
80 	 lv_regime_code jai_rgm_definitions.regime_code%TYPE;
81    --Added by Qinglei for the Advanced Receipt for Service Tax enhancement Bug 13361952
82   BEGIN
83     /*########################################################################################################
84     || VARIABLES INITIALIZATION - PART -1
85     ########################################################################################################*/
86     lv_member_name        := 'PROCESS_APP';
87     set_debug_context;
88 
89 
90     lv_process_flag         := jai_constants.successful   ;
91     lv_process_message      := null                       ;
92 
93     p_process_flag          := lv_process_flag            ;
94     p_process_message       := lv_process_message         ;
95 
96     /*########################################################################################################
97     || CALL TCS REPOSITORY PROCESSING - PART -2
98     ########################################################################################################*/
99     /*Bug 12808626 - Process Applications only if they are not Receipt Write Off*/
100     OPEN c_payment_schedule;
101     FETCH c_payment_schedule INTO lv_payment_schedule;
102     CLOSE c_payment_schedule;
103 
104     OPEN c_get_regime_code(r_new.cash_receipt_id);
105     FETCH c_get_regime_code INTO lv_regime_code;
106     CLOSE c_get_regime_code;
107 
108     IF NOT(lv_payment_schedule = 'Receipt Write-off' AND r_new.status = jai_constants.ar_status_activity) THEN
109         IF upper(nvl(lv_regime_code,'###')) = jai_constants.tcs_regime THEN
110               jai_ar_tcs_rep_pkg.process_transactions ( p_event             => r_new.application_type   ,
111                                                       p_araa              => r_new                    ,
112                                                       p_process_flag      => lv_process_flag          ,
113                                                       p_process_message   => lv_process_message
114                                                     );
115          /*Added by Qinglei for the Advanced Receipt for Service Tax enhancement Bug 13361952 Begin*/
116          ELSIF upper(nvl(lv_regime_code,'###')) = jai_constants.service_regime THEN
117                jai_ar_rgm_processing_pkg.process_st_advance_receipts(p_event           => r_new.APPLICATION_TYPE,
118                                                                      p_araa            => r_new,
119                                                                      p_process_flag    => lv_process_flag,
120                                                                      p_process_message => lv_process_message
121                                                   );
122          /*Added by Qinglei for the Advanced Receipt for Service Tax enhancement Bug 13361952 End*/
123          END IF;
124 
125     END IF;
126 
127     IF lv_process_flag = jai_constants.expected_error    OR                      ---------A2
128        lv_process_flag = jai_constants.unexpected_error  OR
129        lv_process_flag = jai_constants.not_applicable
130     THEN
131       /*
132       || As Returned status is an error hence:-
133       || Set out variables p_process_flag and p_process_message accordingly
134       */
135       --call to debug package
136 
137       p_process_flag    := lv_process_flag    ;
138       p_process_message := lv_process_message ;
139       return;
140     END IF;                                                                      ---------A2
141 
142 
143   END process_app;
144 
145 END jai_arra_trg_pkg;