X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fdetail_format%2Fsum_count.pm;h=253956f0d6d6ec64ea3db629de1558f27e597c62;hb=674cb2d9d7105f4cc2871539b2e9f7088cdaa750;hp=5597de2b201b800891e1d166dbb8458af5ae9eac;hpb=0e256e7b9dcc00dedacf499b92bd1c945248a3b9;p=freeside.git diff --git a/FS/FS/detail_format/sum_count.pm b/FS/FS/detail_format/sum_count.pm index 5597de2b2..253956f0d 100644 --- a/FS/FS/detail_format/sum_count.pm +++ b/FS/FS/detail_format/sum_count.pm @@ -2,7 +2,7 @@ package FS::detail_format::sum_count; use strict; use vars qw( $DEBUG ); -use parent qw(FS::detail_format); +use base qw(FS::detail_format); use FS::Record qw(qsearchs); use FS::cust_svc; use FS::svc_Common; # for label @@ -24,6 +24,7 @@ sub header_detail { sub append { my $self = shift; my $svcnums = ($self->{svcnums} ||= {}); + my $acctids = $self->{acctids} ||= []; foreach my $cdr (@_) { my $object = $self->{inbound} ? $cdr->cdr_termination(1) : $cdr; my $svcnum = $object->svcnum; # yes, $object->svcnum. @@ -31,7 +32,10 @@ sub append { my $subtotal = ($svcnums->{$svcnum} ||= { count => 0, duration => 0, amount => 0 }); $subtotal->{count}++; - $subtotal->{amount} += $object->rated_price; + $subtotal->{amount} += $object->rated_price + if $object->freesidestatus ne 'no-charge'; + + push @$acctids, $cdr->acctid; } } @@ -67,6 +71,7 @@ sub finish { startdate => '', #could use the earliest startdate in the bunch? regionname => '', #no, we're using prefix instead detail => $self->csv->string, + acctid => $self->{acctids}, }); } #foreach $svcnum