Freeside:1.9:Documentation:Developer/FS/tax rate

From Freeside
Jump to: navigation, search

NAME

FS::tax_rate - Object methods for tax_rate objects

SYNOPSIS

 use FS::tax_rate;

 $record = new FS::tax_rate \%hash;
 $record = new FS::tax_rate { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::tax_rate object represents a tax rate, defined by locale. FS::tax_rate inherits from FS::Record. The following fields are currently supported:

taxnum
primary key (assigned automatically for new tax rates)
geocode
a geographic location code provided by a tax data vendor
data_vendor
the tax data vendor
location
a location code provided by a tax authority
taxclassnum
a foreign key into FS::tax_class - the type of tax referenced but FS::part_pkg_taxrate eitem effective_date
the time after which the tax applies
tax
percentage
excessrate
second bracket percentage
taxbase
the amount to which the tax applies (first bracket)
taxmax
a cap on the amount of tax if a cap exists
usetax
percentage on out of jurisdiction purchases
useexcessrate
second bracket percentage on out of jurisdiction purchases
unittype
one of the values in %tax_unittypes
fee
amount of tax per unit
excessfee
second bracket amount of tax per unit
feebase
the number of units to which the fee applies (first bracket)
feemax
the most units to which fees apply (first and second brackets)
maxtype
a value from %tax_maxtypes indicating how brackets accumulate (i.e. monthly, per invoice, etc)
taxname
if defined, printed on invoices instead of "Tax"
taxauth
a value from %tax_authorities
basetype
a value from %tax_basetypes indicating the tax basis
passtype
a value from %tax_passtypes indicating how the tax should displayed to the customer
passflag
'Y', 'N', or blank indicating the tax can be passed to the customer
setuptax
if 'Y', this tax does not apply to setup fees
recurtax
if 'Y', this tax does not apply to recurring fees
manual
if 'Y', has been manually edited

METHODS

new HASHREF
Creates a new tax rate. To add the tax rate to the database, see "insert".
insert
Adds this tax rate to the database. If there is an error, returns the error, otherwise returns false.
delete
Deletes this tax rate from the database. If there is an error, returns the error, otherwise returns false.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid tax rate. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
taxclass_description
Returns the human understandable value associated with the related FS::tax_class.
unittype_name
Returns the human understandable value associated with the unittype column
maxtype_name
Returns the human understandable value associated with the maxtype column
basetype_name
Returns the human understandable value associated with the basetype column
taxauth_name
Returns the human understandable value associated with the taxauth column
passtype_name
Returns the human understandable value associated with the passtype column
taxline TAXABLES, [ OPTIONSHASH ]
Returns a listref of a name and an amount of tax calculated for the list of packages/amounts referenced by TAXABLES. If an error occurs, a message is returned as a scalar.
tax_on_tax CUST_MAIN
Returns a list of taxes which are candidates for taxing taxes for the given customer (see FS::cust_main)

SUBROUTINES

batch_import; process_batch_import
Load a batch import as a queued JSRPC job
browse_queries PARAMS
Returns a list consisting of a hashref suited for use as the argument to qsearch, and sql query string. Each is based on the PARAMS hashref of keys and values which frequently would be passed as scalar($cgi-Vars)> from a form. This conveniently creates the query hashref and count_query string required by the browse and search elements. As a side effect, the PARAMS hashref is untainted and keys with unexpected values are removed.

BUGS

 Mixing automatic and manual editing works poorly at present.

SEE ALSO

FS::Record, FS::cust_main, FS::cust_bill, schema.html from the base documentation.