1 package FS::part_event::Action::Mixin::credit_agent_pkg_class;
3 # calculates a credit percentage on a specific package for use with
4 # credit_pkg or credit_bill, based on an agent's commission table
7 use FS::Record qw(qsearchs);
9 sub _calc_credit_percent {
10 my( $self, $cust_pkg, $agent ) = @_;
12 my $agent_pkg_class = qsearchs( 'agent_pkg_class', {
13 'agentnum' => $agent->agentnum,
14 'classnum' => $cust_pkg->part_pkg->classnum,
17 $agent_pkg_class ? $agent_pkg_class->commission_percent : 0;