Bug 18790: Add ability to void payments
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / boraccount.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE ColumnsSettings %]
5 [% USE AuthorisedValues %]
6 [% USE Price %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% Asset.css("css/datatables.css") %]
12 </head>
13
14 <body id="pat_borraccount" class="pat">
15 [% INCLUDE 'header.inc' %]
16 [% INCLUDE 'patron-search.inc' %]
17
18 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</div>
19
20 <div id="doc3" class="yui-t2">
21    <div id="bd">
22         <div id="yui-main">
23         <div class="yui-b">
24 [% INCLUDE 'members-toolbar.inc' %]
25 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" /></form>
26
27 <!-- The manual invoice and credit buttons -->
28 <div class="statictabs">
29 <ul>
30     <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Account</a></li>
31     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]" >Pay fines</a></li>
32     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual invoice</a></li>
33     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual credit</a></li>
34 </ul>
35 <div class="tabs-container">
36 <!-- The table with the account items -->
37 <table id="table_account_fines">
38     <thead>
39       <tr>
40           <th class="title-string">Date</th>
41           <th>Description of charges</th>
42           <th>Note</th>
43           <th>Amount</th>
44           <th>Outstanding</th>
45           [% IF ( reverse_col ) %]
46               <th>Actions</th>
47           [% ELSE %]
48               <th>&nbsp;</th>
49           [% END %]
50         </tr>
51     </thead>
52
53         <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
54   [% FOREACH account IN accounts %]
55
56    <tr>
57    <td><span title="[% account.date %]">[% account.date |$KohaDates %]</span></td>
58       <td>
59         [% SWITCH account.accounttype %]
60           [% CASE 'Pay' %]Payment, thanks
61           [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
62           [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
63           [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
64           [% CASE 'VOID' %]Payment, Voided
65           [% CASE 'N' %]New card
66           [% CASE 'F' %]Fine
67           [% CASE 'A' %]Account management fee
68           [% CASE 'M' %]Sundry
69           [% CASE 'L' %]Lost item
70           [% CASE 'W' %]Writeoff
71           [% CASE 'FU' %]Accruing fine
72           [% CASE 'HE' %]Hold waiting too long
73           [% CASE 'Rent' %]Rental fee
74           [% CASE 'FOR' %]Forgiven
75           [% CASE 'LR' %]Lost item fee refund
76           [% CASE 'PF' %]Processing fee
77           [% CASE 'PAY' %]Payment
78           [% CASE 'WO' %]Writeoff
79           [% CASE 'C' %]Credit
80           [% CASE 'CR' %]Credit
81           [% CASE %][% account.accounttype %]
82         [%- END -%]
83         [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) %][% END %]
84         [%- IF account.description %], [% account.description %][% END %]
85         &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% account.item.biblio.title |html %]</a>[% END %]</td>
86       <td>[% account.note | html_line_break %]</td>
87       [% IF ( account.amountcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
88       [% IF ( account.amountoutstandingcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
89       <td class="actions">
90         [% IF ( account.payment ) %]
91           <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
92         [% ELSE %]
93           <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
94         [% END %]
95         [% IF ( reverse_col) %]
96           [% IF ( account.payment ) %]
97             <a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
98             <a href="boraccount.pl?action=void&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-ban"></i> Void</a>
99           [% ELSE %][% SET footerjs = 1 %]
100             &nbsp;
101           [% END %]
102         [% END %]
103       </td>
104     </tr>
105
106   [% END %]
107 <tfoot>
108   <tr>
109     <td colspan="4">Total due</td>
110     [% IF ( totalcredit ) %]
111         <td class="credit" style="text-align: right;">[% total | $Price %]</td>
112     [% ELSE %]
113        <td class="debit"style="text-align: right;">[% total | $Price %]</td>
114     [% END %]
115     <td></td>
116   </tr>
117   </tfoot>
118 </table>
119 </div></div>
120
121 </div>
122 </div>
123
124 <div class="yui-b">
125 [% INCLUDE 'circ-menu.inc' %]
126 </div>
127 </div>
128
129 [% MACRO jsinclude BLOCK %]
130     [% INCLUDE 'datatables.inc' %]
131     [% INCLUDE 'columns_settings.inc' %]
132     [% Asset.js("js/members-menu.js") %]
133     <script type="text/javascript">
134         var dateformat = "[% Koha.Preference('dateformat') %]";
135         $(document).ready(function() {
136             var txtActivefilter = _("Filter paid transactions");
137             var txtInactivefilter = _("Show all transactions");
138             var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') %];
139             var table_account_fines = KohaTable("table_account_fines", {
140                 "sPaginationType": "four_button",
141                 'aaSorting': [[0, 'desc']],
142                 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
143                 "aoColumnDefs": [
144                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
145                     { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
146                 ]
147             }, columns_settings);
148             $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
149             $('#filter_transacs').click(function(e) {
150                 e.preventDefault();
151                 if ($(this).hasClass('filtered')) {
152                     var filteredValue = '';
153                     $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
154                 } else { //Not filtered. Let's do it!
155                     var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
156                     $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
157                 }
158                 table_account_fines.fnFilter(filteredValue, 4, true, false);
159                 $(this).toggleClass('filtered');
160             });
161         });
162     </script>
163 [% END %]
164
165 [% INCLUDE 'intranet-bottom.inc' %]