GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Interchange6::Schema::Result::Tax(3) User Contributed Perl Documentation Interchange6::Schema::Result::Tax(3)

Interchange6::Schema::Result::Tax

The taxes table contains taxes such as sales tax and VAT. Each tax has a unique tax_name but can contain multiple rows for each tax_name to allow for changes in tax rates over time. When there is more than one row for a single tax_name then the valid_from and valid_to periods may not overlap.

Primary key.

Name of tax, e.g.: vat_full

Description of tax, e.g.: New York sales tax

Percent rate of tax, e.g.: 19.9775

Number of decimal_places of precision required for tax cost and reporting.

Defaults to 2.

Default rounding is half round up to the number of decimal_places. To use floor or ceiling set rounding to 'f' or 'c' as appropriate. The rounding value is automatically converted to lower case and any invalid value passed in will cause an exception to be thrown.

Is nullable.

Date from which tax is valid. Defaults to time record is created.

Final date on which tax is valid.

Is nullable.

FK on "country_iso_code" in Interchange6::Schema::Result::Country.

Is nullable.

FK on "states_id" in Interchange6::Schema::Result::State.

Is nullable.

Date and time when this record was created returned as DateTime object. Value is auto-set on insert.

Date and time when this record was last modified returned as DateTime object. Value is auto-set on insert and update.

Type: belongs_to

Related object: Interchange6::Schema::Result::State

Type: belongs_to

Related object: Interchange6::Schema::Result::Country

Calculate tax

Arguments should be a hash ref of the following arguments:

  • price

    Price of product either inclusive or exclusive of tax - required.

  • tax_included

    Boolean indicating whether price is inclusive of tax or not. Defaults to 0 which means exclusive of tax.

    Will throw an exception if the price us not numeric.

Usage example:

    my $tax = $taxrecord->caclulate({ price => 13.47, tax_included => 1 });

    # with percentage 18 our tax is 2.05

We overload the new method to set default values on certain rows at create time.

Called during table creation to add indexes on the following columns:
  • tax_name
  • valid_from
  • valid_to

Validity checks that cannot be enforced using primary key, unique or other database methods using Interchange6::Schema::Component::Validation. The validity checks enforce the following rules:
  • Check country_iso_code is valid
  • If both valid_from and valid_to are defined then valid_to must be a later date than valid_from.
  • A single tax_name may appear more than once in the table to allow for changes in tax rates but valid_from/valid_to date ranges must not overlap.
2016-07-16 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.