Difference between revisions of "Freeside:3:Documentation:Developer/FS/discount plan"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
(No difference)

Latest revision as of 20:04, 27 June 2012

NAME

FS::discount_plan - A term discount as applied to an invoice

DESCRIPTION

An FS::discount_plan object represents a term prepayment discount available for an invoice (FS::cust_bill). FS::discount_plan objects are non-persistent and do not inherit from FS::Record.

CLASS METHODS

new OPTIONS
Calculate a discount plan. OPTIONS must include:
cust_bill - the invoice to calculate discounts for
months - the number of months to be prepaid
If there are no line items on the invoice eligible for the discount new() will return undef.
all CUST_BILL
For an FS::cust_bill object, return a hash of all available discount plans, with discount term (months) as the key.

METHODS

discounted_total
Returns the total price for the term after applying discounts. This is the price the customer would have to pay to receive the discount. Note that this includes the monthly fees for all packages (including non-discountable ones) for each month in the term, but only includes fees for other packages as they appear on the current invoice.
base_total
Returns the total price for the term before applying discounts.
pkgnums
Returns a list of package numbers that are receiving discounts under this plan.
list_pkgnums
Returns a true value if any packages listed on the invoice do not receive a discount, either because there isn't one at the specified term length or because they're not monthly recurring packages.