3 Formats customer payment history into a table.
5 include('/elements/customer-statement.html',
9 Option 'history' should be of the form returned by $cust_main->payment_history.
10 This element might be used directly by selfservice, so it does not (and should not)
11 pull data from the database.
15 % my $style = 'text-align: left; margin: 0; padding: 0 1em 0 0;';
16 % my $moneystyle = 'text-align: right; margin: 0; padding: 0 1em 0 0;';
18 <TABLE STYLE="margin: 0;" CELLSPACING="0">
20 <TH STYLE="<% $style %> background: #ff9999;">Date</TH>
21 <TH STYLE="<% $style %> background: #ff9999;">Description</TH>
22 <TH STYLE="<% $moneystyle %> background: #ff9999;">Amount</TH>
23 <TH STYLE="<% $moneystyle %> background: #ff9999;">Balance</TH>
26 % my $col1 = "#ffffff";
27 % my $col2 = "#dddddd";
29 % foreach my $item (@{$opt{'history'}}) {
31 <TD STYLE="<% $style %> background: <% $col %>;"><% $$item{'date_pretty'} %></TD>
32 <TD STYLE="<% $style %> background: <% $col %>;"><% $$item{'description'} %></TD>
33 <TD STYLE="<% $moneystyle %> background: <% $col %>;"><% $$item{'amount_pretty'} %></TD>
34 <TD STYLE="<% $moneystyle %> background: <% $col %>;"><% $$item{'balance_pretty'} %></TD>
36 % $col = $col eq $col1 ? $col2 : $col1;
44 die "Invalid type for history" unless ref($opt{'history'}) eq 'ARRAY';