summaryrefslogtreecommitdiff
path: root/httemplate/elements/customer-statement.html
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-06-25 00:51:02 -0500
committerJonathan Prykop <jonathan@freeside.biz>2015-06-25 00:51:02 -0500
commit3b46d452696901ff2dec41125f68c689ecffd5b9 (patch)
treeffd388c4526f859f44bae630a1cbc7c7680c85be /httemplate/elements/customer-statement.html
parent458f6fc84389aa3d4679380bb15aad74bdec0cb3 (diff)
RT#34078: Payment History Report / Statement [refactor to not use msg_template]
Diffstat (limited to 'httemplate/elements/customer-statement.html')
-rw-r--r--httemplate/elements/customer-statement.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/httemplate/elements/customer-statement.html b/httemplate/elements/customer-statement.html
new file mode 100644
index 000000000..63c21cba3
--- /dev/null
+++ b/httemplate/elements/customer-statement.html
@@ -0,0 +1,45 @@
+<%doc>
+
+Formats customer payment history into a table.
+
+ include('/elements/customer-statement.html',
+ 'history' => \@history
+ );
+
+Option 'history' should be of the form returned by $cust_main->payment_history.
+This element might be used directly by selfservice, so it does not (and should not)
+pull data from the database.
+
+</%doc>
+
+% my $style = 'text-align: left; margin: 0; padding: 0 1em 0 0;';
+% my $moneystyle = 'text-align: right; margin: 0; padding: 0 1em 0 0;';
+
+<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>
+ <TH STYLE="<% $moneystyle %> background: #ff9999;">Balance</TH>
+ </TR>
+
+% my $col1 = "#ffffff";
+% my $col2 = "#dddddd";
+% my $col = $col1;
+% foreach my $item (@{$opt{'history'}}) {
+ <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_pretty'} %></TD>
+ <TD STYLE="<% $moneystyle %> background: <% $col %>;"><% $$item{'balance_pretty'} %></TD>
+ </TR>
+% $col = $col eq $col1 ? $col2 : $col1;
+% }
+
+</TABLE>
+
+<%init>
+my %opt = @_;
+
+die "Invalid type for history" unless ref($opt{'history'}) eq 'ARRAY';
+</%init>