1 package FS::part_event::Condition::balance_age_under;
4 use base qw( FS::part_event::Condition );
6 sub description { 'Customer balance age (under)'; }
10 'balance' => { 'label' => 'Balance under (or equal to)',
12 'value' => '0.00', #default
14 'age' => { 'label' => 'Age',
21 my($self, $object, %opt) = @_;
23 my $cust_main = $self->cust_main($object);
25 my $under = $self->option('balance');
26 $under = 0 unless length($under);
28 my $age = $self->option_age_from('age', $opt{'time'} );
30 $cust_main->balance_date($age) <= $under;
34 my( $class, $table, %opt ) = @_;
36 my $under = $class->condition_sql_option('balance');
37 my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
39 my $balance_sql = FS::cust_main->balance_date_sql( $age );
41 "$balance_sql <= CAST( $under AS DECIMAL(10,2) )";
45 shift->condition_sql_option_age('age');
48 sub order_sql_weight {