X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=41124bc365510e63c17663a08041415bd08e9808;hb=fed12e8214a8a951377961ccbe7a09171b1e38c2;hp=dad54348eac778ce46fef8799c0b18a730c89fa1;hpb=eccc8de2366e2e004a37761b8da2b447ec861ecb;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index dad54348e..41124bc36 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1330,6 +1330,8 @@ invoice and all older invoices is greater than the specified amount. I, if specified, overrides "Invoice" as the name of the sent document (templates from 10/2009 or newer required) +I, if specified, is passed to + =cut sub queueable_send { @@ -1354,6 +1356,7 @@ sub send { my( $template, $invoice_from, $notice_name ); my $agentnums = ''; my $balance_over = 0; + my $lpr = ''; if ( ref($_[0]) ) { my $opt = shift; @@ -1364,6 +1367,7 @@ sub send { $invoice_from = $opt->{'invoice_from'}; $balance_over = $opt->{'balance_over'} if $opt->{'balance_over'}; $notice_name = $opt->{'notice_name'}; + $lpr = $opt->{'lpr'} } else { $template = scalar(@_) ? shift : ''; if ( scalar(@_) && $_[0] ) { @@ -1397,10 +1401,12 @@ sub send { if ( grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list or !@invoicing_list ) && ! $self->invoice_noemail; + $opt{'lpr'} = $lpr; #$self->print_invoice(\%opt) $self->print(\%opt) if grep { $_ eq 'POST' } @invoicing_list; #postal + #this has never been used post-$ORIGINAL_ISP afaik $self->fax_invoice(\%opt) if grep { $_ eq 'FAX' } @invoicing_list; #fax @@ -1564,14 +1570,16 @@ sub print { return if $self->hide; my $conf = $self->conf; - my( $template, $notice_name ); + my( $template, $notice_name, $lpr ); if ( ref($_[0]) ) { my $opt = shift; $template = $opt->{'template'} || ''; $notice_name = $opt->{'notice_name'} || 'Invoice'; + $lpr = $opt->{'lpr'} } else { $template = scalar(@_) ? shift : ''; $notice_name = 'Invoice'; + $lpr = ''; } my %opt = ( @@ -1584,7 +1592,11 @@ sub print { $self->batch_invoice(\%opt); } else { - do_print $self->lpr_data(\%opt); + do_print( + $self->lpr_data(\%opt), + 'agentnum' => $self->cust_main->agentnum, + 'lpr' => $lpr, + ); } } @@ -2029,7 +2041,7 @@ header line only, with the fields: Agent number, agent name, customer number, first name, last name, address line 1, address line 2, city, state, zip, invoice date, invoice number, -amount charged, amount due, +amount charged, amount due, previous balance, due date. and then, for each line item, three columns containing the package number, description, and amount. @@ -2115,6 +2127,7 @@ sub print_csv { } elsif ( $format eq 'oneline' ) { #name my ($previous_balance) = $self->previous; + $previous_balance = sprintf('%.2f', $previous_balance); my $totaldue = sprintf('%.2f', $self->owed + $previous_balance); my @items = map { ($_->{pkgnum} || ''), @@ -2139,6 +2152,8 @@ sub print_csv { $self->invnum, $self->charged, $totaldue, + $previous_balance, + $self->due_date2str("%x"), @items, ); @@ -2248,11 +2263,12 @@ sub print_csv { $part_svc_class->classname : ''; } - + + my @h_label = $cust_svc->label(@dates, 'I'); push @details, sprintf('01%-9s%-20s%-47s', $cust_svc->svcnum, $svc_class{$svcpart}, - $cust_svc->svc_x->label, + $h_label[1], ); } #foreach $cust_svc } #if $cust_pkg @@ -3425,6 +3441,15 @@ sub search_sql_where { push @search, "cust_bill.custnum = $1"; } + #customer classnum + if ( $param->{'cust_classnum'} ) { + my $classnums = $param->{'cust_classnum'}; + $classnums = [ $classnums ] if !ref($classnums); + $classnums = [ grep /^\d+$/, @$classnums ]; + push @search, 'cust_main.classnum in ('.join(',',@$classnums).')' + if @$classnums; + } + #_date if ( $param->{_date} ) { my($beginning, $ending) = @{$param->{_date}};