Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Wiki Change:

omfgppc
2009-03-10
2013-03-08
  • omfgppc
    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:

      Now that we have defined ''what'' we have to do and how we think it shoul=
    d look to the user, we can describe the ''internal'' structure of the appli=
    cation. If possible, outline the architecture of the feature implementation=
    here. Then in the sections below describe the changes and additions to the=
    application to create this architecture.
      =

      =3D=3D Basic Algorithms =3D=3D
    - Are there particular algorithms required to implement this feature? If so=
    , describe them here.
    + A new table function will be created that takes the an input of tax zone,=
    tax type and currency amount to produce a set of detail records describing =
    tax detail:
      =

      {{{
    + create table f
    - If you are going to outline a particular algorithm in pseudo-code
    - =

    -     put it in a programlisting
    - =

    -     try to limit lines to approximately 80 characters
    - =

    -     try to limit programming constructs while still being clear about int=
    ent
    - =

    - end if // a programming construct that may be unavoidable to maintain cla=
    rity
      =

      }}}
      =3D=3D Custom Widget Changes =3D=3D
    @@ -436, +428 @@

      );
      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_parent_id IS 'Source parent id.'; =

    + COMMENT ON COLUMN taxhist.taxhist_parent_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.';
    @@ -453, +445 @@

      {{{
      CREATE TABLE cohisttax
      (
    -     PRIMARY KEY (taxhist_id), =

    +     PRIMARY KEY (taxhist_id),
    -     FOREIGN KEY (taxhist_source_id) REFERENCES cohist (cohist_id) ON DELE=
    TE CASCADE, =

    +     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.  The advantage of using table inheritence is tha=
    t it will enforce structural integrity, simplify queries and functions that=
    must sum tax from multiple tables and likely future maintenance as well.  =
    A new table should be made for each table that currently stores historical =
    tax data.  The naming convention will be {tablename} + tax per the example =
    above for each of these 12 tables: '''asohist, cmhead, cmitem, cobill, cobm=
    isc, cohist, invchead, invcitem, tohead, toitem, vohead, voitem.'''  Each t=
    able should have foreign keys referencing the parent and tax table ids as s=
    how above.
    - =

      =

      =3D=3D=3D Updated Tables =3D=3D=3D
      The following tables will need to be updated to include a taxzone column =
    as such:
    @@ -534, +525 @@

       * postbillingselectionconsolidated
       * selectforbilling
       * selectuninvoicedshipment
    + =

    + All functions relating to tax
    +  * archivesaleshistory
    +  * calculatetax
    +  * changecmheadtaxauth
    +  * changecobtaxauth
    +  * changeinvoicetaxauth
    +  * changequotetaxauth
    +  * changesotaxauth
    +  * changetotaxauth
    +  * convertcustomertoprospect
    +  * convertprospecttocustomer
    +  * convertquote
    +  * copyinvoice
    +  * copyitem
    +  * copypo
    +  * copyso
    +  * copytransferorder
    +  * createbillingheader
    +  * deleteaccount
    +  * deletecrmaccount
    +  * deletecustomer
    +  * deleteitem
    +  * deletetax
    +  * deletetaxauthority
    +  * deletetaxtype
    +  * deletevendor
    +  * getfreighttaxselection
    +  * getfreighttaxtypeid
    +  * getitemtaxtype
    +  * gettaxselection
    +  * gettaxtype
    +  * postbillingselection
    +  * postbillingselectionconsolidated
    +  * postcheck
    +  * postcreditmemo
    +  * postinvoice
    +  * postinvoices
    +  * recalculatecmheadtaxtotal
    +  * recalculatecobmisctaxtotal
    +  * recalculateinvcheadtaxtotal
    +  * releasecrmaccountnumber
    +  * restoresaleshistory
    +  * selectforbilling
    +  * selectuninvoicedshipment
    +  * site
    +  * transitwhs
      =

      The triggers on cohead and quhead will need to be altered to reference ta=
    x zone instead of tax authority. The following api views will need to be al=
    tered to reference tax zone instead of tax authority:
      =