Freeside:4:Documentation:Developer/FS/part fee

From Freeside
< Freeside:4:Documentation:Developer‎ | FS
Revision as of 07:25, 18 November 2015 by Jeremyd (talk | contribs) (Edit via perl MediaWiki framework (1.13))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NAME

FS::part_fee - Object methods for part_fee records

SYNOPSIS

 use FS::part_fee;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::part_fee object represents the definition of a fee

Fees are like packages, but instead of being ordered and then billed on a cycle, they are created by the operation of events and added to a single invoice. The fee definition specifies the fee's description, how the amount is calculated (a flat fee or a percentage of the customer's balance), and how to classify the fee for tax and reporting purposes.

FS::part_fee inherits from FS::Record. The following fields are currently supported:

feepart - primary key; comment - a description of the fee for employee use, not shown on the invoice; disabled - 'Y' if the fee is disabled; classnum - the FS::pkg_class that the fee belongs to, for reporting and placement on multisection invoices. Unlike packages, fees must be assigned to a class; they will default to class named "Fees", which belongs to the same invoice section that normally contains taxes.; taxable - 'Y' if this fee should be considered a taxable sale. Currently, taxable fees will be treated like they exist at the customer's default service location.; taxclass - the tax class the fee belongs to, as a string, for the internal tax system; taxproductnum - the tax product family the fee belongs to, for the external tax system in use, if any; pay_weight - Weight (relative to credit_weight and other package/fee definitions) that controls payment application to specific line items.; credit_weight - Weight that controls credit application to specific line items.; agentnum - the agent (FS::agent) who uses this fee definition.; amount - the flat fee to charge, as a decimal amount; percent - the percentage of the base to charge (out of 100). If both this and "amount" are specified, the fee will be the sum of the two.; basis - the method for calculating the base: currently one of "charged", "owed", or null.; minimum - the minimum fee that should be charged; maximum - the maximum fee that should be charged; limit_credit - 'Y' to set the maximum fee at the customer's credit balance, if any.; setuprecur - whether the fee should be classified as 'setup' or 'recur', for reporting purposes.

METHODS

new HASHREF
Creates a new fee definition. To add the record to the database, see "insert".
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database.
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 example. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
explanation
Returns a string describing how this fee is calculated.
lineitem INVOICE
Given INVOICE (an FS::cust_bill), returns an FS::cust_bill_pkg object representing the invoice line item for the fee, with linked FS::cust_bill_pkg_fee record(s) allocating the fee to the invoice or its line items, as appropriate.
If the fee is going to be charged on the upcoming invoice (credit card processing fees, postal invoice fees), INVOICE should be an uninserted FS::cust_bill object where the 'cust_bill_pkg' property is an arrayref of the non-fee line items that will appear on the invoice.
itemdesc_locale LOCALE
Returns a customer-viewable description of this fee for the given locale, from the part_fee_msgcat table. If the locale is empty or no localized fee description exists, returns part_fee.itemdesc.
tax_rates DATA_PROVIDER, GEOCODE
Returns the external taxes (FS::tax_rate objects) that apply to this fee, in the location specified by GEOCODE.
categoryname
Returns the package category name, or the empty string if there is no package category.

BUGS

SEE ALSO

FS::Record