20: BEGIN
21: pv_return_code := jai_constants.successful ;
22: /*------------------------------------------------------------------------------------------------------------
23: Trigger Functionality:
24: When a new TDS year is defined, then this trigger gets fired and inserts data into JAI_AP_TDS_CERT_NUMS for
25: any organization (legal entity/operating unit) in which tan number is defined. If tan number is not defined for
26: any operating unit, then we cannot find a record in this table for the same OU, in this case while generating TDS
27: certificates the tan number defined at legal entity should be used where in organization_id of the record will be NULL
28: ------------------------------------------------------------------------------------------------------------
40:
41: revamped the code for this, old code is attached at the end.
42:
43: 3 20/02/2004 Vijay Shankar for Bug# 2762636, FileVersion: 618.1
44: - Added the code to insert data into JAI_AP_TDS_CERT_NUMS table for LE
45:
46: 4. 2/05/2005 rchandan for bug#4323338. Version 116.1
47: India Org Info DFF is eliminated as a part of JA migration. A table by name ja_in_ap_tds_org_tan is dropped
48: and a view jai_ap_tds_org_tan_v is created to capture the PAN No,TAN NO and WARD NO. The code changes are done
54: 6. 13-Jun-2005 File Version: 116.2
55: Ramananda for bug#4428980. Removal of SQL LITERALs is done
56:
57: 7 07/12/2005 Hjujjuru for the bug 4866533 File version 120.1
58: added the who columns in the insert to the table JAI_AP_TDS_CERT_NUMS
59: Dependencies Due to this bug:-
60: None
61:
62: 8. 12-Dec-2005 Hjujjuru for Bug 4873356 , File Version 120.3
59: Dependencies Due to this bug:-
60: None
61:
62: 8. 12-Dec-2005 Hjujjuru for Bug 4873356 , File Version 120.3
63: Changed the value of TAN no from v_leg_org_tan_num to pr_new.tan_no in the insert to the table JAI_AP_TDS_CERT_NUMS.
64:
65: Modified the SQL%NOTFOUND to SQL%ROWCOUNT before the insert into the table JAI_AP_TDS_CERT_NUMS.
66:
67:
61:
62: 8. 12-Dec-2005 Hjujjuru for Bug 4873356 , File Version 120.3
63: Changed the value of TAN no from v_leg_org_tan_num to pr_new.tan_no in the insert to the table JAI_AP_TDS_CERT_NUMS.
64:
65: Modified the SQL%NOTFOUND to SQL%ROWCOUNT before the insert into the table JAI_AP_TDS_CERT_NUMS.
66:
67:
68: --------------------------------------------------------------------------------------------------------------*/
69:
85:
86:
87: IF pr_new.tan_no IS NOT NULL THEN
88:
89: UPDATE JAI_AP_TDS_CERT_NUMS
90: SET org_tan_num = pr_new.tan_no
91: WHERE legal_entity = pr_new.Legal_Entity_Id
92: AND (organization_id IS NULL OR organization_id = to_number(pr_new.Legal_Entity_Id) )
93: AND fin_yr = pr_new.Fin_Year
93: AND fin_yr = pr_new.Fin_Year
94: AND legal_entity = to_number(pr_new.Legal_Entity_Id);
95:
96: IF SQL%ROWCOUNT = 0 THEN -- Harshita for Bug 4873356
97: INSERT INTO JAI_AP_TDS_CERT_NUMS (FIN_YR_CERT_ID,
98: organization_id, legal_entity, fin_yr,
99: CERTIFICATE_NUM, LINE_NUM, Org_tan_num,
100: -- added, Harshita for Bug 4866533
101: created_by, creation_date, last_updated_by, last_update_date
98: organization_id, legal_entity, fin_yr,
99: CERTIFICATE_NUM, LINE_NUM, Org_tan_num,
100: -- added, Harshita for Bug 4866533
101: created_by, creation_date, last_updated_by, last_update_date
102: ) VALUES ( JAI_AP_TDS_CERT_NUMS_S.nextval,
103: to_number(pr_new.Legal_Entity_Id), to_number(pr_new.Legal_Entity_Id), pr_new.Fin_Year,
104: NULL, NULL, pr_new.tan_no , --v_leg_org_tan_num, -- Harshita for Bug 4873356
105: -- added, Harshita for Bug 4866533
106: fnd_global.user_id, sysdate, fnd_global.user_id, sysdate
149: IF v_leg_org_tan_num IS NULL AND v_org_tan_num IS NULL THEN
150: RAISE NO_DATA_FOUND;
151: END IF; */
152:
153: UPDATE JAI_AP_TDS_CERT_NUMS
154: SET org_tan_num = pr_new.tan_no --nvl(v_org_tan_num, v_leg_org_tan_num)
155: WHERE organization_id = c_org_id.organization_id
156: -- AND legal_entity = pr_new.Legal_Entity_Id
157: AND fin_yr = pr_new.Fin_Year;
157: AND fin_yr = pr_new.Fin_Year;
158:
159:
160: IF SQL%ROWCOUNT = 0 THEN -- Harshita for Bug 4873356
161: INSERT INTO JAI_AP_TDS_CERT_NUMS (FIN_YR_CERT_ID,
162: organization_id, legal_entity, fin_yr,
163: CERTIFICATE_NUM, LINE_NUM, Org_tan_num,
164: -- added, Harshita for Bug 4866533
165: created_by, creation_date, last_updated_by, last_update_date
162: organization_id, legal_entity, fin_yr,
163: CERTIFICATE_NUM, LINE_NUM, Org_tan_num,
164: -- added, Harshita for Bug 4866533
165: created_by, creation_date, last_updated_by, last_update_date
166: ) VALUES ( JAI_AP_TDS_CERT_NUMS_S.nextval,
167: c_org_id.Organization_id,
168: /* Bug 5388544. Added by Lakshmi Gopalsami
169: * Checked the value of legal_entity_id, If it is 0, insert the
170: * same else insert the value of c_org_id.organization_id.