DBA Data[Home] [Help]

PACKAGE: APPS.ZX_AR_TAX_CLASSIFICATN_DEF_PKG

Source


4 
1 package ZX_AR_TAX_CLASSIFICATN_DEF_PKG AUTHID CURRENT_USER as
2 /* $Header: zxartxclsdefpkgs.pls 120.9 2011/01/19 19:08:24 ssanka ship $ */
3 -- PRAGMA RESTRICT_REFERENCES( ARP_TAX, WNDS, WNPS, RNPS );
5 /*-----------------------------------------------------------------------*/
6 /*       Constants                                                       */
7 /*-----------------------------------------------------------------------*/
8 MAX_NR_TAX_RATE CONSTANT NUMBER := 100;
9 MTHD_SALES CONSTANT VARCHAR2(10) := 'EBTAX';
10 MTHD_VAT CONSTANT VARCHAR2(10)   := 'EBTAX';
11 MTHD_LATIN CONSTANT VARCHAR2(10) := 'LTE';
12 
13 TAX_TYPE_INACTIVE CONSTANT NUMBER := 0;
14 TAX_TYPE_LOCATION CONSTANT NUMBER := 1;
15 TAX_TYPE_SALES    CONSTANT NUMBER := 2;
16 TAX_TYPE_VAT 	  CONSTANT NUMBER := 3;
17 
18 TAX_SUCCESS       CONSTANT VARCHAR2(1) := '0';
19 TAX_NO_VENDOR 	  CONSTANT VARCHAR2(1) := '1';
20 TAX_RC_NO_RATE    CONSTANT VARCHAR2(1) := '2';
21 TAX_RC_OERR       CONSTANT VARCHAR2(1) := '9';
22 TAX_RC_SYSERR     CONSTANT VARCHAR2(2) := '10';
23 --
24 -- Tax Defaulting level constants
25 --
26 TAX_DEFAULT_SITE      CONSTANT  VARCHAR2(30) := 'SHIP_TO_PARTY_SITE';
27 TAX_DEFAULT_CUSTOMER  CONSTANT  VARCHAR2(30) := 'SHIP_TO_PARTY';
28 TAX_DEFAULT_PRODUCT   CONSTANT  VARCHAR2(30) := 'PRODUCT';
29 TAX_DEFAULT_ACCOUNT   CONSTANT  VARCHAR2(30) := 'REVENUE_ACCOUNT';
30 TAX_DEFAULT_SYSTEM    CONSTANT  VARCHAR2(30) := 'SYSTEM_OPTIONS';
31 TAX_DEFAULT_PROJECT   CONSTANT  VARCHAR2(30) := 'PROJECT';
32 TAX_DEFAULT_EXP_EV    CONSTANT	VARCHAR2(30) := 'TYPE';
33 TAX_DEFAULT_EXTENSION CONSTANT	VARCHAR2(30) := 'CLIENT_EXTENSION';
34 TAX_DEFAULT_AR_PARAM  CONSTANT	VARCHAR2(30) := 'SYSTEM_OPTIONS';
35 
36 /*-----------------------------------------------------------------------*/
37 /*       User Defined Exceptions                                         */
38 /*-----------------------------------------------------------------------*/
39 AR_TAX_EXCEPTION	EXCEPTION;	/* General Exception raised for all Tax errors  */
40 TAX_NO_RATE		EXCEPTION;	/* Could not deduce tax rate for line */
41 TAX_NO_CODE		EXCEPTION;	/* Could not deduce tax code for line */
42 TAX_NO_AMOUNT		EXCEPTION;	/* Amount in RA_INTERFACE_LINES was null */
43 TAX_NO_PRECISION	EXCEPTION;	/* Precision is null, no rate returned */
44 TAX_NO_DATA		EXCEPTION;	/* Sales Tax compounding was unable to find any data */
45 TAX_NEED_POSTAL		EXCEPTION;	/* Postal Code was not found, could not deduce Sales tax rate */
46 TAX_CODE_INACTIVE	EXCEPTION;	/* Tax code passed is Inactive for the trx date */
47 TAX_BAD_DATA		EXCEPTION;	/* Fatal Data Error - Sales Tax Calculation aborted */
48 TAX_OERR		EXCEPTION;	/* Oracle Error */
49 
50 /*-----------------------------------------------------------------------*/
51 /*       Table/Record Types                                              */
52 /*-----------------------------------------------------------------------*/
53 
54 TYPE VARCHAR2_30_tab_type IS TABLE OF
55         VARCHAR2(30) INDEX BY BINARY_INTEGER;
56 
57 TYPE system_info_rec_type IS RECORD
58 (
59   --
60   -- This record holds general information used by the Tax Entity handler
61   -- and its associated functions.
62   --
63 	sysparam		 ar_system_parameters%ROWTYPE,
64 	/* nipatel added for eTax uptake */
65 	ar_product_options_rec zx_product_options_all%ROWTYPE,
66 	pa_product_options_rec zx_product_options_all%ROWTYPE,
67         tax_enforce_account_flag VARCHAR2(1),
68 	chart_of_accounts_id	 gl_sets_of_books.chart_of_accounts_id%TYPE,
69 	base_precision		 fnd_currencies.precision%TYPE,
70 	func_precision		 fnd_currencies.precision%TYPE,
71 	min_accountable_unit	 fnd_currencies.minimum_accountable_unit%TYPE,
72 	insert_tax_lines	 CHAR,	/* If 'N', no inserts or Autoaccounting calls will be made */
73 	call_auto_acctng	 CHAR,	/* If 'N', Autoaccounting will not be called, 'N' when called from 'C' */
74 	tax_view_set		 VARCHAR2(2),	/* Tax view Name space. '_A' for Taxware, '_V' for Vertex etc. NULL for Oracle Tax views */
75 	appl_short_name		 VARCHAR2(30),	/* AR or OE */
76 	func_short_name		 VARCHAR2(30),	/* GL_ACCT_FIRST, ACCT_RULES or ACCT_DIST */
77 	base_currency_code	 fnd_currencies.currency_code%TYPE, /* functional currency code */
78 	allow_multiple_inclusive CHAR, /* If 'N', multiple inclusive taxes are not allowed */
79 	search_hierarchy_tab     VARCHAR2_30_tab_type, /* Tax defaulting hierarchy table */
80 	search_pa_hierarchy_tab  VARCHAR2_30_tab_type  /* PA Tax defaulting hierarchy table */
81 );
82 
83 sysinfo	system_info_rec_type;
84 
85 TYPE tax_code_rec_type IS RECORD
86     (ORG_ID                   ZX_LINES.INTERNAL_ORGANIZATION_ID%TYPE,
87      LOOKUP_CODE              ZX_RATES_B.TAX_RATE_CODE%TYPE,
88      DET_DATE                 RA_CUSTOMER_TRX.TRX_DATE%TYPE,
89      TAX_CODE                 ZX_RATES_B.TAX_RATE_CODE%TYPE
90     );
91 
92 TYPE tax_code_tbl_type IS TABLE OF tax_code_rec_type INDEX BY BINARY_INTEGER;
93 
94 tax_code_tbl tax_code_tbl_type;
95 
96 TYPE profile_info_rec_type IS RECORD
97 (
98   --
99   -- This record holds profile information used by the Tax Entity Handlers
100   -- and its associated functions.
101   --
102 	application_id		BINARY_INTEGER,
103 	user_id			BINARY_INTEGER,
104 	so_organization_id	BINARY_INTEGER
105 );
106 
107 profinfo profile_info_rec_type;
108 
109 
110 TYPE tax_info_rec_type IS RECORD
111 (
112 
113 -- This record holds general information used by the tax engine about
114 -- each transaction, transaction line and tax line. Records in this
115 -- global can change on each row returned from any of the tax views.
116 --
117 
118 /*-----------------------------------------------------------------------*/
122 bill_to_cust_id                  ra_customer_trx.bill_to_customer_id%TYPE,
119 /*       Transaction Header Data                                         */
120 /*-----------------------------------------------------------------------*/
121 
123 ship_to_cust_id                  ra_customer_trx.ship_to_customer_id%TYPE,
124 
125 customer_trx_id                  NUMBER,
126 
127 trx_number			 ra_customer_trx.trx_number%TYPE,
128 bill_to_customer_number		 hz_cust_accounts.account_number%TYPE,
129 ship_to_customer_number		 hz_cust_accounts.account_number%TYPE,
130 bill_to_customer_name		 hz_parties.party_name%TYPE,
131 ship_to_customer_name		 hz_parties.party_name%TYPE,
132 previous_customer_trx_id	 ra_customer_trx_lines.previous_customer_trx_id%TYPE,
133 previous_trx_number		 ra_customer_trx.trx_number%TYPE,
134 trx_date                         ra_customer_trx.trx_date%TYPE,
135 gl_date				 ra_cust_trx_line_gl_dist.gl_date%TYPE,
136 ship_to_site_use_id              hz_cust_site_uses.site_use_id%TYPE,
137 bill_to_site_use_id              hz_cust_site_uses.site_use_id%TYPE,
138 ship_to_postal_code              hz_locations.postal_code%TYPE,
139 bill_to_postal_code              hz_locations.postal_code%TYPE,
140 ship_to_location_id              NUMBER,
141 bill_to_location_id              NUMBER,
142 invoicing_rule_id                ra_customer_trx.invoicing_rule_id%TYPE,
143 fob_point                        ra_customer_trx.fob_point%TYPE,
144 trx_currency_code                ra_customer_trx.invoice_currency_code%TYPE,
145 trx_exchange_rate                ra_customer_trx.exchange_rate%TYPE,
146 minimum_accountable_unit         fnd_currencies.minimum_accountable_unit%TYPE,
147 precision                        fnd_currencies.precision%TYPE,
148 tax_header_level_flag            hz_cust_accounts.tax_header_level_flag%TYPE,
149 tax_rounding_rule                hz_cust_accounts.tax_rounding_rule%TYPE,
150 /*-----------------------------------------------------------------------*/
151 /*       Release 11 Transaction header data                              */
152 /*-----------------------------------------------------------------------*/
153 trx_type_id                	 ra_cust_trx_types.cust_trx_type_id%TYPE,
154 ship_from_warehouse_id           NUMBER,
155 payment_term_id                	 ra_customer_trx.term_id%TYPE,
156 
157 
158 /*-----------------------------------------------------------------------*/
159 /*       Transaction Line Data                                           */
160 /*-----------------------------------------------------------------------*/
161 customer_trx_line_id             NUMBER,
162 
163 previous_customer_trx_line_id    ra_customer_trx_lines.previous_customer_trx_line_id%TYPE,
164 link_to_cust_trx_line_id         ra_customer_trx_lines.link_to_cust_trx_line_id%TYPE,
165 memo_line_id                     ra_customer_trx_lines.memo_line_id%TYPE,
166 taxed_quantity                   ra_customer_trx_lines.quantity_invoiced%TYPE,
167 inventory_item_id                mtl_system_items.inventory_item_id%TYPE,
168 extended_amount                  ra_customer_trx_lines.extended_amount%TYPE,
169 entered_amount			 ra_customer_trx_lines.extended_amount%TYPE,
170 
171 tax_code                         ar_vat_tax.tax_code%TYPE,
172 vat_tax_id                       ar_vat_tax.vat_tax_id%TYPE,
173 tax_exemption_id                 ra_tax_exemptions.tax_exemption_id%TYPE,
174 item_exception_rate_id           ra_item_exception_rates.item_exception_rate_id%TYPE,
175 tax_rate                         ar_vat_tax.tax_rate%TYPE,
176 
177 default_ussgl_transaction_code   ra_customer_trx_lines.default_ussgl_transaction_code%TYPE,
178 default_ussgl_trx_code_context   ra_customer_trx_lines.default_ussgl_trx_code_context%TYPE,
179 /*-----------------------------------------------------------------------*/
180 /*       Release 11 Transaction Line data                                */
181 /*-----------------------------------------------------------------------*/
182 amount_includes_tax_flag         CHAR,           /* 'Y' if line amount includes tax */
183 taxable_basis         		 VARCHAR2(30),   /* Taxable basis */
184 tax_calculation_plsql_block      VARCHAR2(2000), /* Tax rules */
185 payment_terms_discount_percent   NUMBER, 	 /* Discount Percent */
186 
187 
188 /*-----------------------------------------------------------------------*/
189 /*       Tax Extension Parameters, these are defined specifically to     */
190 /*                       support AVP(tm) and Vertex(tm)                  */
191 /*-----------------------------------------------------------------------*/
192 
193 audit_flag			 CHAR,	 	  /* 'Y' if this record should be audited */
194 qualifier                        VARCHAR2(30),    /* LOCATION_QUALIFIER */
195 ship_from_code                   VARCHAR2(30),    /* SHIP_FROM_CODE */
196 ship_to_code                     VARCHAR2(30),    /* SHIP_TO_CODE */
197 poo_code                         VARCHAR2(30),    /* Point of Order Origin */
198 poa_code                         VARCHAR2(30),    /* Point of Order Acceptance */
199 
200 vdrctrl_exempt                   VARCHAR(30),    /* Vendor Control of Tax Exmeptions */
201 
202 tax_control                      ra_customer_trx_lines.tax_exempt_flag%TYPE,
203 xmpt_cert_no                     ra_tax_exemptions.customer_exemption_number%TYPE,
204 xmpt_reason                      ra_tax_exemptions.reason_code%TYPE,
205 xmpt_percent                     ra_tax_exemptions.percent_exempt%TYPE,
206 
207 trx_line_type			 VARCHAR2(30),   /* Sale / Service / Purchase / Rental */
208 part_no                          VARCHAR2(40),   /* Part Number as understood by Vendor */
209 division_code			 VARCHAR2(30),	 /* Organization Attributes */
210 company_code			 VARCHAR2(30),
211 
212 
213 /*-----------------------------------------------------------------------*/
214 /*       Release 11 has 5 more character and numeric attributes.         */
215 /*-----------------------------------------------------------------------*/
216 userf1                           VARCHAR2(80),    /* User Defined Strings */
217 userf2                           VARCHAR2(80),
218 userf3                           VARCHAR2(80),
219 userf4                           VARCHAR2(80),
220 userf5                           VARCHAR2(80),
221 userf6                           VARCHAR2(80),
222 userf7                           VARCHAR2(80),
223 userf8                           VARCHAR2(80),
224 userf9                           VARCHAR2(80),
225 userf10                          VARCHAR2(80),
226 
227 usern1                           NUMBER,         /* User Defined Numbers */
228 usern2                           NUMBER,
229 usern3                           NUMBER,
230 usern4                           NUMBER,
231 usern5                           NUMBER,
232 usern6                           NUMBER,
233 usern7                           NUMBER,
234 usern8                           NUMBER,
235 usern9                           NUMBER,
236 usern10                          NUMBER,
237 
238 calculate_tax                    CHAR,           /* if 'Y' calculate tax, else add only */
239                                                  /* taxable amount                      */
240 
241 /*-----------------------------------------------------------------------*/
242 /*       Tax Line Data                                                   */
243 /*-----------------------------------------------------------------------*/
244 
245 status                           NUMBER,
246 credit_memo_flag           	 BOOLEAN, /* If TRUE, the tax engine will copy the tax rates as passed without validation for Adhoc Tax Codes */
247 tax_type                         NUMBER,          /* Internal flags */
248 
249 sales_tax_id                     NUMBER,
250 location_segment_id              NUMBER,
251 tax_line_number                  ra_customer_trx_lines.line_number%TYPE,
252 tax_amount                       ra_customer_trx_lines.extended_amount%TYPE,
253 tax_vendor_return_code           ra_customer_trx_lines.tax_vendor_return_code%TYPE,
254 tax_precedence                   ra_customer_trx_lines.tax_precedence%TYPE,
255 compound_amount                  NUMBER,           /* Amount of Compounded Tax already held in extended_amount */
256 effective_tax_rate		NUMBER,		/* Effective tax rate to be used to calculate tax. */
257 
258 
259 /*-----------------------------------------------------------------------*/
260 /*       Global Descriptive Flexfields                                   */
261 /*-----------------------------------------------------------------------*/
262 global_attribute1		varchar2(150),
263 global_attribute2		varchar2(150),
264 global_attribute3		varchar2(150),
265 global_attribute4		varchar2(150),
266 global_attribute5		varchar2(150),
267 global_attribute6		varchar2(150),
268 global_attribute7		varchar2(150),
269 global_attribute8		varchar2(150),
270 global_attribute9		varchar2(150),
271 global_attribute10		varchar2(150),
272 global_attribute11		varchar2(150),
273 global_attribute12		varchar2(150),
274 global_attribute13		varchar2(150),
275 global_attribute14		varchar2(150),
276 global_attribute15		varchar2(150),
277 global_attribute16		varchar2(150),
278 global_attribute17		varchar2(150),
279 global_attribute18		varchar2(150),
280 global_attribute19		varchar2(150),
281 global_attribute20		varchar2(150),
282 global_attribute_category	varchar2(30),
283 
284 
285 /*---------------------------------------*/
286 /* added for R11.5                       */
287 /*---------------------------------------*/
288 customer_trx_charge_line_id     NUMBER(15),
289 poo_id                          NUMBER(15),
290 poa_id                          NUMBER(15),
291 taxable_amount			NUMBER,
292 override_tax_rate               NUMBER
293 
294 /*---------------------------------------*/
295 /* CRM releated changes                  */
296 /*---------------------------------------*/
297 --crm
298 , party_flag                    VARCHAR2(1) -- 'Y' if address info is from party
299                                             -- instead of customer
300 ,cm_type                        VARCHAR2(20),
301 
302 
303 /*----------------------------------------*/
304 /* columns added for eTax integration     */
305 /*----------------------------------------*/
306  internal_organization_id               number,
307  internal_org_location_id               number,
308  application_id           		number,
309  entity_code 				varchar2(30),
310  event_class_code                	varchar2(30),
311  ledger_id                              number,
312  legal_entity_id                 	number,
313  rounding_ship_to_party_id              number,
314  rounding_bill_to_party_id        	number,
315  rndg_ship_to_party_site_id             number,
316  rndg_bill_to_party_site_id             number,
317  establishment_id                       number,
318  default_taxation_country               varchar2(2),
319  currency_conversion_date               date,
320  currency_conversion_type               varchar2(30),
321  currency_conversion_rate               number,
322  trx_communicated_date                  date,
323  batch_source_id                        number,
324  batch_source_name                      varchar2(150),
325  doc_seq_id                             number,
326  doc_seq_name                           varchar2(150),
327  doc_seq_value                          varchar2(240),
328  trx_due_date                           date,
329  trx_type_description                   varchar2(240),
330  billing_trading_partner_name           varchar2(150),
331  billing_trading_partner_number         varchar2(150),
332  billing_tp_tax_reporting_flg           varchar2(1),
333  billing_tp_taxpayer_id                 varchar2(80),
334  document_sub_type                      varchar2(240),
335  tax_invoice_date                       date,
336  tax_invoice_number                     varchar2(150),
337  doc_event_status                       varchar2(30),
338  trx_level_type				varchar2(30),
339  line_class				varchar2(30),
340  trx_shipping_date			date,
341  trx_receipt_date			date,
342 -- already present  trx_line_type				varchar2(30),
343  trx_line_date				date,
344  trx_business_category			varchar2(240),
345  line_intended_use			varchar2(240),
346  user_defined_fisc_class		varchar2(30),
347  line_amt_includes_tax_flg		varchar2(1),
348  unit_price				number,
349  cash_discount				number,
350  volume_discount			number,
351  trading_discount			number,
352  transfer_charge			number,
353  transportation_charge			number,
354  insurance_charge			number,
355  other_charge				number,
356  product_id				number,
357  product_fisc_classification		varchar2(240),
358  product_org_id				number,
359  uom_code				varchar2(30),
360  product_type				varchar2(240),
361  product_code			        ZX_LINES_DET_FACTORS.product_code%TYPE,
362  product_category			varchar2(240),
363  trx_sic_code				varchar2(150),
364 --  already present    fob_point				varchar2(30),
365  ship_to_party_id			number,
366  ship_from_party_id			number,
367  poa_party_id				number,
368  poo_party_id				number,
369  bill_to_party_id			number,
370  bill_from_party_id			number,
371  merchant_party_id			number,
372  ship_to_party_site_id			number,
373  ship_from_party_site_id		number,
374  poa_party_site_id			number,
375  poo_party_site_id			number,
376  bill_to_party_site_id			number,
377  bill_from_party_site_id		number,
378 --  already present   ship_to_location_id			number,
379  ship_from_location_id			number,
380  poa_location_id			number,
381  poo_location_id			number,
382 --  already present   bill_to_location_id			number,
383  bill_from_location_id			number,
384  account_ccid				number,
385  account_string				varchar2(2000),
386  adjusted_doc_application_id            number,
387  adjusted_doc_entity_code               varchar2(30),
388  adjusted_doc_event_class_code          varchar2(30),
389  adjusted_doc_trx_id                    number,
390  adj_doc_hdr_trx_user_key1              varchar2(150),
391  adj_doc_hdr_trx_user_key2              varchar2(150),
392  adj_doc_hdr_trx_user_key3              varchar2(150),
393  adj_doc_hdr_trx_user_key4              varchar2(150),
394  adj_doc_hdr_trx_user_key5              varchar2(150),
395  adj_doc_hdr_trx_user_key6              varchar2(150),
396  adjusted_doc_line_id			number,
397  adj_doc_lin_trx_user_key1		varchar2(150),
398  adj_doc_lin_trx_user_key2		varchar2(150),
399  adj_doc_lin_trx_user_key3		varchar2(150),
400  adj_doc_lin_trx_user_key4		varchar2(150),
401  adj_doc_lin_trx_user_key5		varchar2(150),
402  adj_doc_lin_trx_user_key6		varchar2(150),
403  adjusted_doc_number			varchar2(150),
404  adjusted_doc_date			date,
405  assessable_value			number,
406  tax_classification_code		varchar2(30),
407  trx_id_level2				number,
408  trx_id_level3				number,
409  trx_id_level4				number,
413  trx_line_number			number,
410  trx_id_level5				number,
411  trx_id_level6				number,
412 
414  historical_flg				varchar2(1),
415  trx_line_description			varchar2(240),
416  product_description			varchar2(240),
417  trx_waybill_number			varchar2(50),
418 --  already present   trx_line_gl_date			date,
419  paying_party_id			number,
420  own_hq_party_id			number,
421  trading_hq_party_id			number,
422  poi_party_id				number,
423  pod_party_id				number,
424  title_transfer_party_id		number,
425  paying_party_site_id			number,
426  own_hq_party_site_id			number,
427  trading_hq_party_site_id		number,
428  poi_party_site_id			number,
429  pod_party_site_id			number,
430  title_transfer_party_site_id		number,
431  paying_location_id			number,
432  own_hq_location_id			number,
433  trading_hq_location_id			number,
434  poc_location_id			number,
435  poi_location_id			number,
436  pod_location_id			number,
437  title_transfer_location_id		number,
438  banking_tp_taxpayer_id			varchar2(80),
439 
440 -- Output tax line columns
441 
442  tax_regime_code           varchar2(30),
443  tax                       varchar2(30),
444  tax_rate_code             varchar2(30) ,
445  tax_status_code           varchar2(30) ,
446  tax_regime_id             number,
447  tax_id			   number,
448  tax_rate_id               number,
449  tax_status_id             number,
450 
451 -- Columns added for LTE integration with eTax
452  tax_currency_code                      fnd_currencies.currency_code%TYPE,
453  tax_currency_conversion_date		date,
454  tax_currency_conversion_type		varchar2(30),
455  tax_currency_conversion_rate		number,
456  tax_apportionment_line_number		number,
457  tax_base_modifier_rate			number,
458  unrounded_taxable_amt			number,
459  unrounded_tax_amt			number,
460  tax_date				date,
461  tax_determine_date			date,
462  tax_point_date				date,
463  tax_type_code				varchar2(30),
464  rounding_level_code			varchar2(30),
465  rounding_rule_code			varchar2(30),
466  rounding_lvl_party_tax_prof_id		number,
467  rounding_lvl_party_type		varchar2(30),
468  cal_tax_amt				number,
469  cancel_flag				varchar2(1),
470  purge_flag				varchar2(1),
471  delete_flag				varchar2(1),
472  tax_amt_included_flag			varchar2(1),
473  self_assessed_flag			varchar2(1),
474  overridden_flag			varchar2(1),
475  manually_entered_flag			varchar2(1),
476  reporting_only_flag			varchar2(1),
477  freeze_until_overridden_flag		varchar2(1),
478  copied_from_other_doc_flag		varchar2(1),
479  recalc_required_flag			varchar2(1),
480  settlement_flag			varchar2(1),
481  item_dist_changed_flag			varchar2(1),
482  associated_child_frozen_flag		varchar2(1),
483  compounding_dep_tax_flag		varchar2(1),
484  legal_justification_text1		varchar2(240),
485  legal_justification_text2		varchar2(240),
486  legal_justification_text3		varchar2(240),
487  ctrl_total_line_tx_amt			number,
488 
489  mrc_tax_line_flag                      varchar2(1),
490  offset_flag                            varchar2(1),
491  process_for_recovery_flag              varchar2(1),
492  compounding_tax_flag                   varchar2(1),
493  historical_flag                        varchar2(1),
494  tax_apportionment_flag                 varchar2(1),
495  tax_only_line_flag                     varchar2(1),
496  enforce_from_natural_acct_flag         varchar2(1)
497 );
498 
499 
500 tax_info_rec tax_info_rec_type;
501 
502 /*-----------------------------------------------------------------------*/
503 /* Table of Code Combination Ids. Used by the tax engine to get tax      */
504 /* information from General Ledger.                                      */
505 
506 /*-----------------------------------------------------------------------*/
507 TYPE CCID_tab_type IS TABLE OF
508         gl_code_combinations.code_combination_id%TYPE
509 
510         INDEX BY BINARY_INTEGER;
511 
512 /*-----------------------------------------------------------------------*/
513 /* Control flags, initialised by this package once, and used on each     */
514 /* subsequent invocation.                                                */
515 /*-----------------------------------------------------------------------*/
516 TYPE tax_gbl_rec_type IS RECORD
517 (
518 dump_cache_stats                 BOOLEAN,     /* If true Cache Size information will be dumped to AFWRT_LOG */
519 
520 called_by_order_entry            BOOLEAN,     /* TRUE if OE is the calling application */
521 
522 insert_tax_lines                 BOOLEAN,     /* If False no inserts or auto-accounting */
523                                               /* calls will be made when generating tax */
524                                               /* lines */
525 /* BugFix 645089 */
526 get_adhoc                        BOOLEAN,     /* True if this call is for an update and */
527                                               /* the adhoc tax rate/amount should be    */
528                                               /* retrieved from the original tax line   */
529 
530 tax_no_rate                      NUMBER,      /* Number of Transaction lines found with */
531                                               /* no code or rate information */
532 
533 total_tax_amount                 NUMBER,      /* Cumulated Tax amount for this call     */
534                                               /* used by the "SALESTAX SUMMARY API"     */
535 
536 one_err_msg_flag                 CHAR,        /* Y: means displays only one message and */
537                                               /*    the message has not yet displayed   */
538                                               /* D: means display only one message and  */
539                                               /*    the message has been displayed      */
540                                               /* N: means could display more than one   */
541 
542 trx_line_id                      NUMBER,      /* Trx Line ID used for Error reporting   */
543 trx_line_number                  VARCHAR(40), /* Line Number usable for Error reporting */
544 
545 total_taxable_amount             NUMBER,                    /* caculates the total taxable amount   */
546 
547 /*-----------------------------------------------------------------------*/
548 /*       Data used by Calculate and its supporting functions             */
552 loc_tax_code_count		NUMBER(3) 		   /* Stores the no. of Location tax codes */
549 /*-----------------------------------------------------------------------*/
550 tax_accnt_column		VARCHAR2(50),		   /* Stores the segment column name of the Tax account qualifier */
551 natural_acct_column             VARCHAR2(30),              /* Stores the segment column name of the Natural account */
553 );
554 
555 tax_gbl_rec tax_gbl_rec_type;
556 
557 TYPE tax_rec_tbl_type is TABLE of RA_CUSTOMER_TRX_LINES%ROWTYPE index by
558   binary_integer;
559 
560 TYPE tax_info_rec_tbl_type is TABLE of tax_info_rec_type index by
561   binary_integer;
562 
563 tax_rec_tbl 		tax_rec_tbl_type;
564 tax_info_rec_tbl	tax_info_rec_tbl_type;
565 old_line_rec		ra_customer_trx_lines%rowtype;
566 new_line_rec		ra_customer_trx_lines%rowtype;
567 /*
568 TYPE om_tax_out_rec_type IS RECORD
569 (vat_tax_id             ar_vat_tax.vat_tax_id%type,
570  extended_amount        ra_customer_trx_lines.extended_amount%TYPE,
571  tax_rate               ar_vat_tax.tax_rate%TYPE);*/
572 
573 TYPE om_tax_out_tab_type IS TABLE of tax_info_rec_type index by
574   binary_integer;
575 
576 
577 om_tax_info_rec_tbl om_tax_out_tab_type;
578 
579    TYPE trx_type_tbl_type IS TABLE OF ra_cust_trx_types.type%type index by binary_integer;
580    trx_type_tbl      trx_type_tbl_type;
581 
585  |                                                                            |
582 /*----------------------------------------------------------------------------*
583  | PUBLIC PROCEDURE                                                           |
584  |    get_default_tax_classification                                          |
586  | DESCRIPTION                                                                |
587  |  Returns default tax classification code based on AR defaulting hierarchy. |
588  |                                                                            |
589  | SCOPE: Public                                                              |
590  |                                                                            |
591  *----------------------------------------------------------------------------*/
592 
593  PROCEDURE  get_default_tax_classification ( p_ship_to_site_use_id     IN NUMBER
594                                             ,p_bill_to_site_use_id     IN NUMBER
595                                             ,p_inventory_item_id       IN NUMBER
596                                             ,p_organization_id         IN NUMBER
597                                             -- ,p_warehouse_id            IN NUMBER
598                                             ,p_set_of_books_id         IN NUMBER
599                                             ,p_trx_date                IN DATE
600                                             ,p_trx_type_id             IN NUMBER
601                                             ,p_tax_classification_code    OUT NOCOPY VARCHAR2
602                                             -- ,p_vat_tax_id                 OUT NOCOPY NUMBER
603                                             -- ,p_amt_incl_tax_flag          OUT NOCOPY VARCHAR2
604                                             -- ,p_amt_incl_tax_override      OUT NOCOPY VARCHAR2
605                                             ,p_cust_trx_id             IN NUMBER default null
606                                             ,p_cust_trx_line_id        IN NUMBER default null
607                                             ,p_customer_id             IN NUMBER default null
608                                             ,p_memo_line_id            IN NUMBER default null
609                                             ,APPL_SHORT_NAME           IN VARCHAR2 default NULL
610                                             ,FUNC_SHORT_NAME           IN VARCHAR2 default NULL
611                                             ,p_party_flag              IN VARCHAR2 default NULL
612                                             ,p_party_location_id       IN VARCHAR2 default NULL
613                                             ,p_entity_code             IN VARCHAR2
614                                             ,p_event_class_code        IN VARCHAR2
615                                             ,p_application_id          IN NUMBER
616                                             ,p_internal_organization_id IN NUMBER
617                                             ,p_ccid                     IN NUMBER  default null);
618 
619 
620 
621 
622 
623 /*----------------------------------------------------------------------------*
624  | PUBLIC PROCEDURE                                                           |
625  |    get_pa_default_classification                                           |
626  |                                                                            |
627  | DESCRIPTION                                                                |
628  |  Returns default tax code for Project Accounting's Draft invoice.          |
629  |                                                                            |
630  | SCOPE: Public                                                              |
631  |                                                                            |
632  | CALLED FROM:                                                               |
633  |  Project Accounting's Tax Defaulting api                                   |
634  |                                                                            |
635  *----------------------------------------------------------------------------*/
636 
637  PROCEDURE  get_pa_default_classification
638        (p_project_id              IN            NUMBER
639        ,p_customer_id             IN            NUMBER
640        ,p_ship_to_site_use_id     IN            NUMBER
641        ,p_bill_to_site_use_id     IN            NUMBER
642        ,p_set_of_books_id         IN            NUMBER
643        ,p_event_id                IN            NUMBER
644        ,p_expenditure_item_id     IN            NUMBER
645        ,p_line_type               IN            VARCHAR2
646        ,p_request_id              IN            NUMBER
647        ,p_user_id                 IN            NUMBER
648        ,p_trx_date                IN            DATE
649        ,p_tax_classification_code    OUT NOCOPY VARCHAR2
650        ,p_application_id           IN  NUMBER
651        ,p_internal_organization_id IN  NUMBER);
652 
653  /* bug 2759960 Create Overloaded API for PA's support for customer account relationship.*/
654 
655  PROCEDURE  get_pa_default_classification
656        (p_project_id               IN            NUMBER
657        ,p_project_customer_id      IN            NUMBER
658        ,p_ship_to_site_use_id      IN            NUMBER
659        ,p_bill_to_site_use_id      IN            NUMBER
660        ,p_set_of_books_id          IN            NUMBER
661        ,p_event_id                 IN            NUMBER
663        ,p_line_type                IN            VARCHAR2
664        ,p_request_id               IN            NUMBER
665        ,p_user_id                  IN            NUMBER
666        ,p_trx_date                 IN            DATE
667        ,p_tax_classification_code     OUT NOCOPY VARCHAR2
668        ,p_ship_to_customer_id      IN            NUMBER
669        ,p_bill_to_customer_id      IN            NUMBER
670        ,p_application_id           IN            NUMBER
671        ,p_internal_organization_id IN            NUMBER);
672 
673 
674 PROCEDURE get_gl_tax_info (
675          p_ccid                     IN NUMBER
676         ,p_internal_organization_id IN NUMBER
677         ,p_trx_date            	    IN DATE
678         ,p_set_of_books_id          IN NUMBER
679         ,p_check_override_only 	    IN CHAR
680         ,p_tax_classification_code  OUT NOCOPY VARCHAR2
681         ,p_override_flag            OUT NOCOPY CHAR
682         ,p_validate_tax_code_flag   IN BOOLEAN default TRUE );
683 
684 
685 PROCEDURE initialize;
686 
687 
688 END ZX_AR_TAX_CLASSIFICATN_DEF_PKG;
689 
662        ,p_expenditure_item_id      IN            NUMBER