omfgppc - 2009-03-10

You have subscribed to a wiki page or wiki category on "xTuple" for change =
notification.

The "EnhancedTaxInternationalization" page has been changed by jrogelstad:

   . '''taxrate''' - Stores tax rate data for tax codes
  =

  {{{
- CREATE TABLE taxrate =

+ CREATE TABLE taxrate
  (
    taxrate_id serial,
    taxrate_tax_id integer NOT NULL REFERENCES tax (tax_id),
@@ -404, +404 @@

  COMMENT ON COLUMN taxass.taxass_taxauth_id IS 'The id of the tax authorit=
y.';
  COMMENT ON COLUMN taxass.taxass_basis_taxass_id IS 'The calculation basis=
of the tax code.  If NULL then base price. If id then the amount of the ta=
x assignment referenced.';
  }}}
-  . taxcum - Used to store cumulative tax assignment information.  Child o=
f taxass.
+  . '''taxcum''' - Used to store cumulative tax assignment information.
  =

  {{{
  CREATE TABLE taxcum
@@ -418, +418 @@

  COMMENT ON COLUMN taxcum.taxcum_taxass_id IS 'The id of the parent tax as=
signment.';
  COMMENT ON COLUMN taxcum.taxcum_cumulative_taxass_id IS 'The id of the ta=
x assignment whose calculation will be added to the parent base price.';
  }}}
- =

   . '''taxhist''' - A master table definition inherited by child tables to=
record tax transaction history.
+ =

  {{{
  CREATE TABLE taxhist
  (
@@ -438, +438 @@

  COMMENT ON TABLE taxhist IS 'A table type to record tax transaction histo=
ry. Inherited by other tables that actually record history. As the parent, =
queries can be run against it that will join all child tables. ';
  COMMENT ON COLUMN taxhist.taxhist_id IS 'Primary key';
  COMMENT ON COLUMN taxhist.taxhist_source IS 'Source type. Only one type s=
hould be allowed per child table.';
- COMMENT ON COLUMN taxhist.taxhist_source_id IS 'Source parent id.'; =

+ COMMENT ON COLUMN taxhist.taxhist_source_id IS 'Source parent id.';
- COMMENT ON COLUMN taxhist.taxhist_tax_id IS 'Tax code id.'; =

+ COMMENT ON COLUMN taxhist.taxhist_tax_id IS 'Tax code id.';
  COMMENT ON COLUMN taxhist.taxhist_basis IS 'Base price amount on which th=
e tax calculation is based.';
  COMMENT ON COLUMN taxhist.taxhist_basis_tax_id IS 'Tax rate calculation b=
asis.  If null, then the amount of the parent document, otherwise calculate=
d on the result amount of the tax code id referenced.';
- COMMENT ON COLUMN taxhist.taxhist_cum_taxhist_ids IS 'An array that conta=
ins references to other tax hist records that were cumulatively added to th=
e basis.'; =

+ COMMENT ON COLUMN taxhist.taxhist_cum_taxhist_ids IS 'An array that conta=
ins references to other tax hist records that were cumulatively added to th=
e basis.';
- COMMENT ON COLUMN taxhist.taxhist_rate IS 'Tax rate percentage.'; =

+ COMMENT ON COLUMN taxhist.taxhist_rate IS 'Tax rate percentage.';
  COMMENT ON COLUMN taxhist.taxhist_amount IS 'Tax amount transacted';
  COMMENT ON COLUMN taxhist.taxhist_docdate IS 'The date of the parent docu=
ment.';
  COMMENT ON COLUMN taxhist.taxhist_docdate IS 'The G/L distribution date o=
f the parent document.';
  }}}
+  . '''Tax history tables'''
+ =

+ The taxhist table will provide a common framework for several other tax h=
istory tables.  Here's an example of a tax table for cohist (sales order hi=
story).
+ =

+ {{{
+ CREATE TABLE cohisttax
+ (
+     PRIMARY KEY (taxhist_id),
+     CHECK (taxhist_source =3D 'CH'),
+     FOREIGN KEY (taxhist_source_id) REFERENCES cohist (cohist_id) ON DELE=
TE CASCADE,
+     FOREIGN KEY (taxhist_tax_id) REFERENCES tax (tax_id),
+     FOREIGN KEY (taxhist_basis_tax_id) REFERENCES tax (tax_id)
+ )
+ INHERITS (taxhist);
+ }}}
+ All that needed to be defined on this table were the constraints, the res=
t is inherited by taxhist.  Tables like this should be made according to th=
is matrix:
+ =

+ ||<tablewidth=3D"653px" tableheight=3D"430px" tablealign=3D"">Parent Tabl=
e||New Child Table||Source Type Code||
+ ||asohist||asohisttax|| ||
+ ||cmhead||cmheadtax|| ||
+ ||cmitem||cmitemtax|| ||
+ ||cobill||cobilltax|| ||
+ ||cobmisc||cobmisctax|| ||
+ ||cohist||cohisttax|| ||
+ ||invchead||invcheadtax|| ||
+ ||invcitem||invcitemtax|| ||
+ ||tohead||toheadtax|| ||
+ ||toitem||toitemtax|| ||
+ ||vohead||voheadtax|| ||
+ ||voitem||voitemtax|| ||
  =

  =

  =