1 package FS::part_event::Action::cust_bill_fee_greater_percent_or_flat;
4 use base qw( FS::part_event::Action::fee );
7 sub description { 'Late fee (greater of percentage of invoice or flat fee)'; }
9 sub eventtable_hashref {
16 my $t = tie my %option_fields, 'Tie::IxHash', $class->SUPER::option_fields();
17 $t->Shift; #assumes charge is first
18 $t->Unshift( 'flat_fee' => { label=>'Flat Fee', type=>'money', } );
19 $t->Unshift( 'percent' => { label=>'Percent', size=>2, } );
25 my( $self, $cust_bill ) = @_;
26 my $percent = sprintf('%.2f', $cust_bill->owed * $self->option('percent') / 100 );
27 my $flat_fee = $self->option('flat_fee');
29 my $num = $flat_fee - $percent;