=cut
# Caution: this gets used by FS::ClientAPI::MyAccount::billing_history,
-# and also payment_history_text, which should both be kept customer-friendly.
+# and also for sending customer statements, which should both be kept customer-friendly.
# If you add anything that shouldn't be passed on through the API or exposed
# to customers, add a new option to include it, don't include it by default
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;
'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;
'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;
'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;
'amount' => $_->refund,
'refund' => $_->refund,
'date' => $_->_date,
- 'date_pretty' => time2str('%m/%d/%Y', $_->_date ),
+ 'date_pretty' => $self->time2str_local('short', $_->_date ),
}
foreach $self->cust_refund;
return @out;
}
-=item payment_history_text
-
-Accepts the same options as L</payment_history> and returns those
-results as a string table with fixed-width columns, max width 80 char.
-
-=cut
-
-sub payment_history_text {
- my $self = shift;
- my $opt = ref($_[0]) ? $_[0] : { @_ };
- my $out = sprintf("%-12s",'Date');
- $out .= sprintf("%11s",'Amount') . ' ';
- $out .= sprintf("%11s",'Balance') . ' ';
- $out .= 'Description'; #don't need to pad with spaces
- $out .= "\n";
- foreach my $item ($self->payment_history($opt)) {
- $out .= sprintf("%-10.10s",$$item{'date_pretty'}) . ' '; #12 width
- $out .= sprintf("%11.11s",$$item{'amount_pretty'}) . ' '; #13 width
- $out .= sprintf("%11.11s",$$item{'balance_pretty'}) . ' '; #13 width
- $out .= sprintf("%.42s",$$item{'description'}); #max 42 width
- $out .= "\n";
- }
- return $out;
-}
-
=back
=head1 CLASS METHODS