diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-07-03 19:46:00 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-07-03 21:12:23 -0500 |
commit | bbac8cacba3eca0712ffdf9012f9b1e3732642ec (patch) | |
tree | fcde3161092948c67d474ea8e1f577798be0918a | |
parent | c112a7e56557acce5a54d3b57e4cdbab7c43ecc5 (diff) |
RT#34078: Payment History Report / Statement
-rw-r--r-- | FS/FS/ClientAPI/MasonComponent.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 10 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/history.html | 41 |
3 files changed, 14 insertions, 38 deletions
diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm index 50597e2cb..3c3bf4cb3 100644 --- a/FS/FS/ClientAPI/MasonComponent.pm +++ b/FS/FS/ClientAPI/MasonComponent.pm @@ -14,6 +14,7 @@ $DEBUG = 0; $me = '[FS::ClientAPI::MasonComponent]'; my %allowed_comps = map { $_=>1 } qw( + /elements/customer-statement.html /elements/select-did.html /misc/areacodes.cgi /misc/exchanges.cgi diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 01a47d0d2..10df0fc63 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -4517,7 +4517,7 @@ sub payment_history { 'amount' => sprintf('%.2f', $_->setup + $_->recur ), 'charged' => sprintf('%.2f', $_->setup + $_->recur ), 'date' => $cust_bill->_date, - 'date_pretty' => time2str('%m/%d/%Y', $cust_bill->_date ), + 'date_pretty' => $self->time2str_local('short', $cust_bill->_date ), } foreach $cust_bill->cust_bill_pkg; @@ -4531,7 +4531,7 @@ sub payment_history { 'amount' => sprintf('%.2f', $_->charged ), 'charged' => sprintf('%.2f', $_->charged ), 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_bill; @@ -4543,7 +4543,7 @@ sub payment_history { 'amount' => sprintf('%.2f', 0 - $_->paid ), 'paid' => sprintf('%.2f', $_->paid ), 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_pay; @@ -4553,7 +4553,7 @@ sub payment_history { 'amount' => sprintf('%.2f', 0 -$_->amount ), 'credit' => sprintf('%.2f', $_->amount ), 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_credit; @@ -4563,7 +4563,7 @@ sub payment_history { 'amount' => $_->refund, 'refund' => $_->refund, 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_refund; diff --git a/fs_selfservice/FS-SelfService/cgi/history.html b/fs_selfservice/FS-SelfService/cgi/history.html index 605bc1cf5..0b6f9ceda 100644 --- a/fs_selfservice/FS-SelfService/cgi/history.html +++ b/fs_selfservice/FS-SelfService/cgi/history.html @@ -1,39 +1,14 @@ <%= include('header', 'Payment History') %> <%= -my $balance = 0; -my $style = 'text-align: left; margin: 0; padding: 0 1em 0 0;'; -my $moneystyle = 'text-align: right; margin: 0; padding: 0 1em 0 0;'; -my $col1 = "#ffffff"; -my $col2 = "#dddddd"; -my $col = $col1; -foreach my $item (@history) { - $balance += $$item{'amount'}; - $$item{'amount'} =~ s/^(-?)/$1$money_char/; - $out .= <<EOF; - <TR> - <TD style="$style background: $col;">$$item{'date_pretty'}</TD> - <TD style="$style background: $col;">$$item{'description'}</TD> - <TD style="$moneystyle background: $col;">$$item{'amount'}</TD> - </TR> -EOF - $col = $col eq $col1 ? $col2 : $col1; -} -$balance = sprintf('%.2f',$balance); -$balance =~ s/^(-?)/$1$money_char/; -$out = <<EOF; -<P>Balance: <B>$balance</B></P> -<TABLE style="margin: 0;" CELLSPACING="0"> - <TR> - <TH style="$style background: #ff9999;">Date</TH> - <TH style="$style background: #ff9999;">Description</TH> - <TH style="$moneystyle background: #ff9999;">Amount</TH> - </TR> -$out -</TABLE> -EOF +my $out = mason_comp( + 'session_id' => $session_id, + 'comp' => '/elements/customer-statement.html', + 'args' => [ + 'history' => \@history, + ] +); +$out->{'output'} || $out->{'error'}; %> -</TABLE> - <%= include('footer') %> |