DBA Data[Home] [Help]

PACKAGE: APPS.ZX_AR_TAX_CLASSIFICATN_DEF_PKG

Source


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