DBA Data[Home] [Help]

PACKAGE BODY: APPS.JE_ZZ_AUTO_INVOICE

Source


1 PACKAGE BODY JE_ZZ_AUTO_INVOICE as
2 /* $Header: jezzraib.pls 120.3.12010000.2 2008/08/04 12:28:02 vgadde ship $ */
3 
4 /*----------------------------------------------------------------------------*
5  |   PUBLIC FUNCTIONS/PROCEDURES  					      |
6  *----------------------------------------------------------------------------*/
7 
8 /*----------------------------------------------------------------------------*
9  | FUNCTION                                                                   |
10  |    validate_gdff                                                           |
11  |                                                                            |
12  | DESCRIPTION                                                                |
13  |                                                                            |
14  | PARAMETERS                                                                 |
15  |   INPUT                                                                    |
16  |      p_request_id            Number   -- Concurrent Request_id             |
17  |                                                                            |
18  | RETURNS                                                                    |
19  |      0                       Number   -- Validation Fails, if there is any |
20  |                                          exceptional case which is handled |
21  |                                          in WHEN OTHERS                    |
22  |      1                       Number   -- Validation Succeeds               |
23  |  Although this package was really meant for validation we can 'bend' its   |
24  |  use to insert the HU data we want and pass back to the JG package         |
25  |  indicating that everything passes validation.                             |
26  *----------------------------------------------------------------------------*/
27   PG_DEBUG varchar2(1);
28 
29 FUNCTION validate_gdff (p_request_id  IN NUMBER) RETURN NUMBER IS
30 
31     return_code    NUMBER (1);
32     l_country_code VARCHAR2(2);
33 
34 
35   ------------------------------------------------------------
36   -- Main function body.                                    --
37   ------------------------------------------------------------
38   BEGIN
39 
40   PG_DEBUG  := NVL(FND_PROFILE.value('MSC_ATP_DEBUG'), 'N');
41 
42     IF PG_DEBUG in ('Y', 'C') THEN
43     	arp_standard.debug('JE_ZZ_AUTO_INVOICE.validate_gdff()+');
44     END IF;
45 
46     return_code := 1;
47     l_country_code := fnd_profile.value ('JGZZ_COUNTRY_CODE');
48 
49     IF PG_DEBUG in ('Y', 'C') THEN
50     	arp_standard.debug('validate_gdff: ' || '-- Country Code: '||l_country_code);
51     	arp_standard.debug('validate_gdff: ' || '-- Request Id: '||to_char(p_request_id));
52     END IF;
53 
54     ------------------------------------------------------------
55     -- Check for HU country code, if present then we want to  --
56     -- enter the context and attribute1 data                  --
57     ------------------------------------------------------------
58 
59       IF l_country_code =  'HU' THEN
60 
61 
62          IF PG_DEBUG in ('Y', 'C') THEN
63          	arp_standard.debug('validate_gdff: ' || '-- Inserting HU specific GDF data');
64          END IF;
65 
66 	 update ra_interface_lines_gt
67 	 set HEADER_GDF_ATTR_CATEGORY = 'JE.HU.ARXTWMAI.TAX_DATE'
68 	 ,   HEADER_GDF_ATTRIBUTE1    = fnd_date.date_to_canonical(GL_DATE)
69 	 where request_id = p_request_id ;
70 
71 
72     ------------------------------------------------------------
73     -- Check for PL country code, if present then we want to  --
74     -- enter the context and attribute1 data                  --
75     ------------------------------------------------------------
76 
77      ELSIF  l_country_code =  'PL' THEN
78 
79 
80          IF PG_DEBUG in ('Y', 'C') THEN
81          	arp_standard.debug('validate_gdff: ' || '-- Inserting PL specific GDF data');
82          END IF;
83 
84          update ra_interface_lines_gt
85          set HEADER_GDF_ATTR_CATEGORY = 'JE.PL.ARXTWMAI.TAX_DATE'
86          ,   HEADER_GDF_ATTRIBUTE1    = fnd_date.date_to_canonical(GL_DATE)
87          where request_id = p_request_id ;
88 
89     ------------------------------------------------------------
90     -- Check for CZ country code, if present then we want to  --
91     -- enter the context and attribute1 data                  --
92     -- Czech requirements are that the tax date should be:    --
93     -- Tax Date : = Booking date of Sales Order if item is    --
94     -- not shippable or the oldest Ship Confirm date from all --
95     -- item lines if item is ship. These are the rules        --
96     -- Autoinvoice uses to derive the GL date so we can just  --
97     -- use that as the tax date                               --
98     ------------------------------------------------------------
99 
100 
101 
102      ELSIF  l_country_code =  'CZ' THEN
103 
104          IF PG_DEBUG in ('Y', 'C') THEN
105          	arp_standard.debug('validate_gdff: ' || '-- Inserting CZ specific GDF data');
106          END IF;
107 
108          update ra_interface_lines_gt
109          set HEADER_GDF_ATTR_CATEGORY = 'JE.CZ.ARXTWMAI.TAX_DATE'
110          ,   HEADER_GDF_ATTRIBUTE1    = fnd_date.date_to_canonical(GL_DATE)
111          where request_id = p_request_id ;
112 
113 
114 
115      END IF;
116 
117 
118     RETURN return_code;
119 
120   EXCEPTION
121     WHEN OTHERS THEN
122 
123       IF PG_DEBUG in ('Y', 'C') THEN
124       	arp_standard.debug('validate_gdff: ' || '-- Return From Exception when others');
125       	arp_standard.debug('validate_gdff: ' || '-- Return Code: 0');
126       	arp_standard.debug('JE_ZZ_AUTO_INVOICE.validate_gdff()-');
127       END IF;
128 
129       RETURN 0;
130 
131   END validate_gdff;
132 
133 
134 END JE_ZZ_AUTO_INVOICE;