X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=35ce48c35ebfe665d4a2414f9528c61e7aae090f;hp=ef6dc7bee233051f8ee29187f024f506de273a5a;hb=395cc72629d31c8dcd138acf423e66d2d73d89d2;hpb=c5e31619e5a3071506cff19578e9e377753a96f4 diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index ef6dc7bee..35ce48c35 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -144,6 +144,8 @@ Specific use cases =item agent_invid - legacy invoice number +=item promised_date - customer promised payment date, for collection + =back =head1 METHODS @@ -2991,7 +2993,7 @@ sub print_generic { } } - unless ( $conf->exists('disable_previous_balance') + unless ( $conf->exists('disable_previous_balance', $agentnum) || $conf->exists('previous_balance-summary_only') ) { @@ -3025,7 +3027,8 @@ sub print_generic { } - if ( @pr_cust_bill && !$conf->exists('disable_previous_balance') ) { + if ( @pr_cust_bill && !$conf->exists('disable_previous_balance', $agentnum) ) + { push @buf, ['','-----------']; push @buf, [ $self->mt('Total Previous Balance'), $money_char. sprintf("%10.2f", $pr_total) ]; @@ -3141,7 +3144,7 @@ sub print_generic { $invoice_data{current_less_finance} = sprintf('%.2f', $self->charged - $invoice_data{finance_amount} ); - if ( $multisection && !$conf->exists('disable_previous_balance') + if ( $multisection && !$conf->exists('disable_previous_balance', $agentnum) || $conf->exists('previous_balance-summary_only') ) { unshift @sections, $previous_section if $pr_total; @@ -3205,7 +3208,7 @@ sub print_generic { push @buf,['','-----------']; push @buf,[$self->mt( - $conf->exists('disable_previous_balance') + $conf->exists('disable_previous_balance', $agentnum) ? 'Total Charges' : 'Total New Charges' ), @@ -3219,7 +3222,7 @@ sub print_generic { || 'Total New Charges' if $conf->exists('previous_balance-exclude_from_total'); my $amount = $self->charged + - ( $conf->exists('disable_previous_balance') || + ( $conf->exists('disable_previous_balance', $agentnum) || $conf->exists('previous_balance-exclude_from_total') ? 0 : $pr_total @@ -3246,7 +3249,7 @@ sub print_generic { push @buf,['','']; } - unless ( $conf->exists('disable_previous_balance') ) { + unless ( $conf->exists('disable_previous_balance', $agentnum) ) { #foreach my $thing ( sort { $a->_date <=> $b->_date } $self->_items_credits, $self->_items_payments # credits @@ -4984,11 +4987,20 @@ sub _items_cust_bill_pkg { my $description = ($is_summary && $type && $type eq 'U') ? "Usage charges" : $desc; - $description .= " (" . time2str($date_format, $cust_bill_pkg->sdate). - " - ". time2str($date_format, $cust_bill_pkg->edate). - ")" - unless $conf->exists('disable_line_item_date_ranges') - || $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1); + unless ( + $conf->exists('disable_line_item_date_ranges') + || $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1) + ) { + my $time_period; + my $date_style = $conf->config('cust_bill-line_item-date_style'); + if ( $date_style eq 'month_of' ) { + $time_period = time2str('The month of %B', $cust_bill_pkg->sdate); + } else { + $time_period = time2str($date_format, $cust_bill_pkg->sdate). + " - ". time2str($date_format, $cust_bill_pkg->edate); + } + $description .= " ($time_period)"; + } my @d = (); my @seconds = (); # for display of usage info @@ -5622,6 +5634,15 @@ sub search_sql_where { } + #promised_date - also has an option to accept nulls + if ( $param->{promised_date} ) { + my($beginning, $ending, $null) = @{$param->{promised_date}}; + + push @search, "(( cust_bill.promised_date >= $beginning AND ". + "cust_bill.promised_date < $ending )" . + ($null ? ' OR cust_bill.promised_date IS NULL ) ' : ')'); + } + #agent virtualization my $curuser = $FS::CurrentUser::CurrentUser; if ( $curuser->username eq 'fs_queue'