ePages 6.10 - DE_EPAGES/Tax/API/Object/TaxMatrix.pm

Package DE_EPAGES::Tax::API::Object::TaxMatrix

object interface for TaxMatrix.

Base
DE_EPAGES::Object::API::Object::Object

Functions

className
clone
dbPackage
defaultTaxArea
defaultTaxClass
exportXMLElements
fallbackTaxArea
gross2net
net2gross
taxAreaByCountry
taxAreaCountries
taxRate

className

Returns the class name, used for DAL access.

Syntax
$ClassName = $TaxMatrix->className;
Return
$ClassName (String)
class name

clone

Inserts a new object into the database as copy from old object. This function copies also tax rates of the matrix, which are no objects.

Syntax
$Clone = $Object->clone( $hInfo );
$Clone = $Object->clone( $hInfo, $Recursive );
Input
$hInfo (hash ref)
hash with mandatory attribute values.
  • ClassID - class id - int
  • Alias - alias - varchar(255)
  • ParentID - parent objectid - int
  • Inherit - (optional) inherit permissions from parent object - boolean
$Recursive (boolean)
clone child object too (optional, default is false)
Return
$Clone (object)
the new object

dbPackage

Returns the database package, used for DAL access.

Syntax
$DbPackage = $TaxMatrix->dbPackage;
Return
$DbPackage (String)
database package name

defaultTaxArea

Gets the default tax area of the matrix

Syntax
$TaxArea = $TaxMatrix->defaultTaxArea;
Return
$Area (object)
tax area

defaultTaxClass

Gets the default tax class of the matrix

Syntax
$TaxClass = $TaxMatrix->defaultTaxClass;
Return
$TaxClass (object)
tax class

exportXMLElements

add tax rates elements of tax class

Syntax
$Object->exportXMLElements($Driver, $allAttributes);

fallbackTaxArea

Gets the default tax area of the matrix for undefined countries

Syntax
$TaxArea = $TaxMatrix->fallbackTaxArea;
Return
$Area (object)
tax area

gross2net

Calculates the net price from the gross price if required by the given tax model. Uses the tax rate for the given tax class from the default tax area if no area is given. Adds one extra digit of precision for example: 16.798 EUR (unless Precision is passed as parameter).

Syntax
$NetPrice = $TaxMatrix->gross2net($CurrencyID, $GrossPrice, $hTaxParams);
Example
$NetPrice = $TaxMatrix->gross2net('EUR', 19.99,
                           {'TaxModel' => $TaxModel,
                            'TaxArea' =>  $TaxArea,
                            'TaxClass' => $TaxMatrix->defaultTaxClass, });
Input
$hTaxParams (hash ref)
hash with tax parameters.
  • TaxModel - tax model - object
  • TaxArea - (optional) tax area - object
  • TaxClass - tax class - object
  • Precision - (optional) number of digits after comma - integer
$CurrencyID (object)
currency id
$GrossPrice (float)
gross price
Return
$NetPrice (float)
net price

net2gross

Calculates the gross price from the net price if required by the given tax model. Uses the tax rate for the given tax class from the default tax area if no tax area is given. Rounds the result to the standard precision of the currency, for example: 19.99 EUR.

Syntax
$GrossPrice = $TaxMatrix->net2gross($CurrencyID, $NetPrice,$hTaxParams,$ExtraPrecision);
Example
$GrossPrice = $TaxMatrix->net2gross('EUR', 16.798,
                           {'TaxModel' => $TaxModel,
                            'TaxArea' =>  $TaxArea,
                            'TaxClass' => $TaxMatrix->defaultTaxClass, },1);
Input
$hTaxParams (hash ref)
hash with tax parameters.
  • TaxModel - tax model - object
  • TaxArea - (optional) tax area - object
  • TaxClass - tax class - object
  • Precision - (optional) number of digits after comma - integer
$CurrencyID (object)
currency id
$NetPrice (float)
net price
$ExtraPrecision (int)
extra precision
Return
$GrossPrice (float)
gross price

taxAreaByCountry

Returns the TaxArea by identifier.

Syntax
$TaxArea = $TaxMatrix->taxAreaByCountry($CountryID);
Input
$TaxMatrix (int)
tax matrix
$CountryID (int)
country id
Return
$TaxArea (object)
tax area

taxAreaCountries

Returns objects of TaxAreaCountry by TaxMatrix.

Syntax
$TaxArea = $TaxMatrix->taxAreaCountries();
Input
$TaxMatrix (int)
tax matrix
Return
$ahTaxAreaCountries (reference to array of hashes)
with following keys:
  • TaxMatrixID - tax matrix id (part of primary key)- int
  • CountryID - country id (part of primary key)- int
  • TaxAreaID - tax area id - int

taxRate

Tax rate of matrix defined by tax area and class.

Syntax
$TaxRate = $TaxMatrix->taxRate($Area, $Class);
Input
$Area (object)
tax area
$Class (object)
tax class
Return
$TaxRate (float)
percentage of tax (eg 0.16 for 16 %)