Bug 23115: Tweak display of totals on 'Fines and charges' page
[koha-equinox.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / account-table.inc
1 <h3>Fines and charges</h3>
2
3 [% IF ( ACCOUNT_LINES ) %]
4     <form method="post" action="opac-account-pay.pl" class="form-horizontal">
5     <table class="table table-bordered table-striped" id="finestable">
6         <thead>
7             <tr>
8                 [% IF ENABLE_OPAC_PAYMENTS %]<th>&nbsp;</th>[% END %]
9                 <th class="title-string">Date</th>
10                 <th>Type</th>
11                 <th>Description</th>
12                 <th>Amount</th>
13                 <th>Amount outstanding</th>
14             </tr>
15         </thead>
16
17         <tbody>
18             [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
19                 <tr [% IF ACCOUNT_LINE.amountoutstanding > 0 || ACCOUNT_LINE.amountoutstanding < 0 %]class="outstanding"[% END%]>
20                     [% IF ENABLE_OPAC_PAYMENTS %]
21                         <td>
22                             [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
23                                 [% SET DISPLAY_PAYMENT_BLOCK = 1 %]
24                                 <input class="checkbox-pay pay-online hidden" name="accountline" type="checkbox" id="checkbox-pay-[% ACCOUNT_LINE.accountlines_id | html %]" value="[% ACCOUNT_LINE.accountlines_id | html %]">
25                                 <input type="hidden" id="amount-[% ACCOUNT_LINE.accountlines_id | html %]" value="[% ACCOUNT_LINE.amountoutstanding | html %]" />
26                             [% END %]
27                         </td>
28                     [% END %]
29                     <td><span title="[% ACCOUNT_LINE.date | html %]">[% ACCOUNT_LINE.date | $KohaDates %]</span></td>
30                     <td>
31                         [% SWITCH ACCOUNT_LINE.accounttype %]
32                         [% CASE 'Pay' %]Payment
33                         [% CASE 'Pay00' %]Payment (cash via SIP2)
34                         [% CASE 'Pay01' %]Payment (VISA via SIP2)
35                         [% CASE 'Pay02' %]Payment (credit card via SIP2)
36                         [% CASE 'VOID' %]Voided
37                         [% CASE 'N' %]New card
38                         [% CASE 'OVERDUE' %]Fine
39                         [% CASE 'A' %]Account management fee
40                         [% CASE 'M' %]Sundry
41                         [% CASE 'L' %]Lost item
42                         [% CASE 'W' %]Writeoff
43                         [% CASE 'HE' %]Hold waiting too long
44                         [% CASE 'Rent' %]Rental fee
45                         [% CASE 'FOR' %]Forgiven
46                         [% CASE 'LR' %]Lost item fee refund
47                         [% CASE 'PF' %]Lost item processing fee
48                         [% CASE 'PAY' %]Payment
49                         [% CASE 'WO' %]Writeoff
50                         [% CASE 'C' %]Credit
51                         [% CASE 'CR' %]Credit
52                         [%-CASE 'Res' %]Hold fee
53                         [% CASE %][% ACCOUNT_LINE.accounttype | html %]
54                         [%- END -%]
55                         [%- PROCESS account_status_description account=ACCOUNT_LINE -%]
56                     </td>
57                     <td>
58                         [%- IF ACCOUNT_LINE.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
59                         [%- IF ACCOUNT_LINE.description %][% ACCOUNT_LINE.description | html %][% END %]
60                         [% IF ACCOUNT_LINE.itemnumber %]([% ACCOUNT_LINE.item.biblio.title | html %])[% END %]
61                     </td>
62                     [% IF ( ACCOUNT_LINE.is_credit ) %]<td class="credit">[% ACCOUNT_LINE.amount * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amount | $Price %][% END %]</td>
63                     [% IF ( ACCOUNT_LINE.is_credit ) %]<td class="credit">[% ACCOUNT_LINE.amountoutstanding * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amountoutstanding | $Price %][% END %]</td>
64                 </tr>
65             [% END %]
66         </tbody>
67
68         <tfoot>
69             <tr>
70                 [%- IF ENABLE_OPAC_PAYMENTS -%]
71                     [%- SET COLSPAN = 5 -%]
72                 [%- ELSE -%]
73                     [%- SET COLSPAN = 4 -%]
74                 [%- END -%]
75                 <th class="sum" colspan="[% COLSPAN | html %]">Total due</th>
76                 <td class="sum">[% total | $Price %]</td>
77             </tr>
78             [% IF outstanding_credits.total_outstanding < 0 %]
79             [% FOREACH outstanding_credit IN outstanding_credits %]
80                 <tr [% IF outstanding_credit.amountoutstanding < 0 %]class="outstanding"[% END%]>
81                     [% IF ENABLE_OPAC_PAYMENTS %]<td></td>[% END %]
82                     <td><span title="[% outstanding_credit.date | html %]">[% outstanding_credit.date | $KohaDates %]</span></td>
83                     <td>
84                         [% SWITCH outstanding_credit.accounttype %]
85                         [% CASE 'Pay' %]Payment
86                         [% CASE 'Pay00' %]Payment (cash via SIP2)
87                         [% CASE 'Pay01' %]Payment (VISA via SIP2)
88                         [% CASE 'Pay02' %]Payment (credit card via SIP2)
89                         [% CASE 'VOID' %]Voided
90                         [% CASE 'N' %]New card
91                         [% CASE 'OVERDUE' %]Fine
92                         [% CASE 'A' %]Account management fee
93                         [% CASE 'M' %]Sundry
94                         [% CASE 'L' %]Lost item
95                         [% CASE 'W' %]Writeoff
96                         [% CASE 'HE' %]Hold waiting too long
97                         [% CASE 'Rent' %]Rental fee
98                         [% CASE 'FOR' %]Forgiven
99                         [% CASE 'LR' %]Lost item fee refund
100                         [% CASE 'PF' %]Lost item processing fee
101                         [% CASE 'PAY' %]Payment
102                         [% CASE 'WO' %]Writeoff
103                         [% CASE 'C' %]Credit
104                         [% CASE 'CR' %]Credit
105                         [%-CASE 'Res' %]Hold fee
106                         [% CASE %][% outstanding_credit.accounttype | html %]
107                         [%- END -%]
108                         [%- PROCESS account_status_description account=outstanding_credit -%]
109                     </td>
110                     <td>
111                         [%- IF outstanding_credit.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', outstanding_credit.payment_type, 1) | html %][% END %]
112                         [%- IF outstanding_credit.description %][% outstanding_credit.description | html %][% END %]
113                         [% IF outstanding_credit.itemnumber %]([% outstanding_credit.item.biblio.title | html %])[% END %]
114                     </td>
115                     <td class="credit">[% outstanding_credit.amount * -1 | $Price %]</td>
116                     <td class="credit">[% outstanding_credit.amountoutstanding * -1 | $Price %]</td>
117                 </tr>
118             [% END %]
119             <tr>
120                 <th class="sum" colspan="[% COLSPAN | html %]">Total due if credit(s) applied:</th>
121                 <td class="sum">[% total + outstanding_credits.total_outstanding | $Price %]</td>
122             </tr>
123             [% END %]
124         </tfoot>
125
126     </table>
127
128         [% IF ENABLE_OPAC_PAYMENTS && DISPLAY_PAYMENT_BLOCK %]
129             <fieldset class="pay-online hidden">
130                 <legend>Pay selected fines and charges</legend>
131                     <span class="help-block"><h3>Payment method</h3></span>
132
133                     [% IF Koha.Preference('EnablePayPalOpacPayments') %]
134                         <div class="control-group">
135                             <label class="radio">
136                                 <input type="radio" name="payment_method" id="payment_method-paypal" value="paypal" checked="checked">
137                                 <!-- PayPal Logo --><a href="https://www.paypal.com/webapps/mpp/paypal-popup" title="How PayPal Works" class="paypal"><img src="https://www.paypalobjects.com/webstatic/mktg/logo/AM_SbyPP_mc_vs_dc_ae.jpg" border="0" alt="PayPal Acceptance Mark"></a><!-- PayPal Logo -->
138                             </label>
139                         </div>
140                     [% END %]
141
142                     [% FOREACH p IN plugins %]
143                         <div class="control-group">
144                             <label class="radio">
145                                 <input type="radio" name="payment_method" id="payment_method-[% p.class | html %]" value="[% p.class | html %]" checked="checked">
146                                 [% p.get_metadata.name | html %]
147                             </label>
148                         </div>
149                     [% END %]
150
151                     <div class="control-group">
152                         <input type="hidden" id="payment-amount" name="payment_amount" value="0" />
153                         <button id="submit-pay" type="submit" class="btn" disabled="disabled">Make payment</button>
154                         <span id="amount-to-pay-label">
155                             Amount to pay: <span id="amount-to-pay">0.00</span>
156                         </span>
157                     </div>
158             </fieldset>
159         [% END %]
160     </form>
161 [% ELSE %]
162     <h4>You have no fines or charges</h4>
163 [% END %]
164
165 [%- BLOCK account_status_description -%]
166     [%- SWITCH account.status -%]
167         [%- CASE 'UNRETURNED' -%]<span> (Accruing)</span>
168         [%- CASE 'RETURNED'   -%]<span> (Returned)</span>
169         [%- CASE 'REPLACED'   -%]<span> (Replaced)</span>
170         [%- CASE 'FORGIVEN'   -%]<span> (Forgiven)</span>
171         [%- CASE 'VOID'       -%]<span> (Voided)</span>
172         [%- CASE              -%]
173     [%- END -%]
174 [%- END -%]