Bug 20703: Add ability to void any credit
[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 [% USE Branches %]
8 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% Asset.css("css/datatables.css") %]
13 </head>
14
15 <body id="pat_borraccount" class="pat">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'patron-search.inc' %]
18
19 <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>
20
21 <div id="doc3" class="yui-t2">
22    <div id="bd">
23         <div id="yui-main">
24         <div class="yui-b">
25 [% INCLUDE 'members-toolbar.inc' %]
26 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" /></form>
27
28 <!-- The manual invoice and credit buttons -->
29 <div class="statictabs">
30 <ul>
31     <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Account</a></li>
32     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]" >Pay fines</a></li>
33     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual invoice</a></li>
34     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual credit</a></li>
35 </ul>
36 <div class="tabs-container">
37 <!-- The table with the account items -->
38 <table id="table_account_fines">
39     <thead>
40       <tr>
41           <th class="title-string">Date</th>
42           <th>Description of charges</th>
43           <th>Note</th>
44           <th>Amount</th>
45           <th>Outstanding</th>
46           [% IF ( reverse_col ) %]
47               <th>Actions</th>
48           [% ELSE %]
49               <th>&nbsp;</th>
50           [% END %]
51         </tr>
52     </thead>
53
54         <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
55   [% FOREACH account IN accounts %]
56
57    <tr>
58    <td><span title="[% account.date %]">[% account.date |$KohaDates %]</span></td>
59       <td>
60         [% INCLUDE 'accounttype.inc' accountline => account %]
61         [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) %][% END %]
62         [%- IF account.description %], [% account.description %][% END %]
63         &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>
64       <td>[% account.note | html_line_break %]</td>
65       [% IF ( account.amountcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
66       [% IF ( account.amountoutstandingcredit ) %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
67       <td class="actions">
68         [% IF ( account.payment ) %]
69           <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>
70         [% ELSE %]
71           <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>
72         [% END %]
73         <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
74         [% IF ( reverse_col) %]
75           [% IF ( account.payment || account.amount < 0 ) %]
76                 [% IF account.payment %]
77                     <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>
78                 [% END %]
79                 [% IF account.amount < 0 %]
80                     <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>
81                 [% END %]
82           [% ELSE %]
83             &nbsp;
84           [% END %]
85         [% END %]
86       </td>
87     </tr>
88
89   [% END %]
90 <tfoot>
91   <tr>
92     <td colspan="4">Total due</td>
93     [% IF ( totalcredit ) %]
94         <td class="credit" style="text-align: right;">[% total | $Price %]</td>
95     [% ELSE %]
96        <td class="debit"style="text-align: right;">[% total | $Price %]</td>
97     [% END %]
98     <td></td>
99   </tr>
100   </tfoot>
101 </table>
102 </div></div>
103
104 </div>
105 </div>
106
107 <div class="yui-b">
108 [% INCLUDE 'circ-menu.inc' %]
109 </div>
110 </div>
111
112 [% MACRO jsinclude BLOCK %]
113     [% INCLUDE 'datatables.inc' %]
114     [% INCLUDE 'columns_settings.inc' %]
115     [% Asset.js("js/members-menu.js") %]
116     <script type="text/javascript">
117         var dateformat = "[% Koha.Preference('dateformat') %]";
118         $(document).ready(function() {
119             var txtActivefilter = _("Filter paid transactions");
120             var txtInactivefilter = _("Show all transactions");
121             var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') %];
122             var table_account_fines = KohaTable("table_account_fines", {
123                 "sPaginationType": "four_button",
124                 'aaSorting': [[0, 'desc']],
125                 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
126                 "aoColumnDefs": [
127                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
128                     { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
129                 ]
130             }, columns_settings);
131             $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
132             $('#filter_transacs').click(function(e) {
133                 e.preventDefault();
134                 if ($(this).hasClass('filtered')) {
135                     var filteredValue = '';
136                     $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
137                 } else { //Not filtered. Let's do it!
138                     var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
139                     $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
140                 }
141                 table_account_fines.fnFilter(filteredValue, 4, true, false);
142                 $(this).toggleClass('filtered');
143             });
144         });
145     </script>
146 [% END %]
147
148 [% INCLUDE 'intranet-bottom.inc' %]