my( $self, $method ) = @_;
my $cust_main = $self->cust_main;
- my $amount = $self->owed;
+ my $balance = $cust_main->balance;
+ my $amount = ( $balance < $self->owed ) ? $balance : $self->owed;
+ $amount = sprintf("%.2f", $amount);
+ return "not run (balance $balance)" unless $amount > 0;
my $description = 'Internet Services';
if ( $conf->exists('business-onlinepayment-description') ) {
sub balance_due_msg {
my $self = shift;
my $msg = 'Balance Due';
+ return $msg unless $conf->exists('invoice_default_terms');
if ( $conf->config('invoice_default_terms') =~ /^\s*Net\s*(\d+)\s*$/ ) {
$msg .= ' - Please pay by '. time2str("%x", $self->_date + ($1*86400) );
} elsif ( $conf->config('invoice_default_terms') ) {