<% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>

FS::commission_schedule

NAME

FS::commission_schedule - Object methods for commission_schedule records

SYNOPSIS

  use FS::commission_schedule;

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

  $error = $record->insert;

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

  $error = $record->delete;

  $error = $record->check;

DESCRIPTION

An FS::commission_schedule object represents a bundle of one or more commission rates for invoices. FS::commission_schedule inherits from FS::Record. The following fields are currently supported:

schedulenum - primary key
schedulename - descriptive name
reasonnum - the credit reason (FS::reason) that will be assigned to these commission credits
basis - for percentage credits, which component of the invoice charges the percentage will be calculated on: - setuprecur (total charges) - setup - recur - setup_cost - recur_cost - setup_margin (setup - setup_cost) - recur_margin_permonth ((recur - recur_cost) / freq)

METHODS

new HASHREF

Creates a new commission schedule. To add the object 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 record. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.

part_event

Returns a list of billing events (FS::part_event objects) that pay commission on this schedule.

calc_credit INVOICE

Takes an FS::cust_bill object and calculates credit on this schedule. Returns the amount to credit. If there's no rate defined for this invoice, returns nothing.

SEE ALSO

FS::Record, FS::part_event, FS::commission_rate

<% include ('/elements/footer.html' ) %>