Bug 19489: Detailed Description of charges in Patron accounting
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / boraccount.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE KohaDates %]
6 [% USE ColumnsSettings %]
7 [% USE AuthorisedValues %]
8 [% USE Price %]
9 [% USE Branches %]
10 [% SET footerjs = 1 %]
11
12 [% PROCESS 'accounts.inc' %]
13
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>Koha &rsaquo; Patrons &rsaquo; Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 </head>
18
19 <body id="pat_borraccount" class="pat">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'patron-search.inc' %]
22
23 <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>
24
25 <div class="main container-fluid">
26     <div class="row">
27         <div class="col-sm-10 col-sm-push-2">
28             <main>
29
30 [% INCLUDE 'members-toolbar.inc' %]
31 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
32
33 <!-- The manual invoice and credit buttons -->
34 <div class="statictabs">
35 <ul>
36     <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
37     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
38     <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
39     <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
40 </ul>
41 <div class="tabs-container">
42 <!-- The table with the account items -->
43 <table id="table_account_fines">
44     <thead>
45       <tr>
46           <th class="title-string">Date</th>
47           <th>Description of charges</th>
48           <th>Barcode</th>
49           <th>Due date</th>
50           <th>Return date</th>
51           <th>Home library</th>
52           <th>Note</th>
53           <th>Amount</th>
54           <th>Outstanding</th>
55           <th>Actions</th>
56         </tr>
57     </thead>
58
59         <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
60   [% FOREACH account IN accounts %]
61
62    <tr>
63    <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
64       <td>
65         [% PROCESS account_type_description account=account %]
66         [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
67         [%- IF account.description %], [% account.description | html %][% END %]
68         &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
69       <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
70       <td>[% IF ( account.issue_id ) %][% account.issue.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
71       <td>[% IF ( account.issue_id ) %][% account.issue.returndate | $KohaDates with_hours => 1 %][% END %]</td>
72       <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
73       <td>[% account.note | html_line_break %]</td>
74       [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
75       [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
76       <td class="actions">
77         [% IF ( account.is_credit ) %]
78           <a target="_blank" href="printfeercpt.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
79         [% ELSE %]
80           <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
81         [% END %]
82         <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
83         [% IF account.is_credit %]
84           <a href="boraccount.pl?action=void&amp;accountlines_id=[% account.accountlines_id | uri %]&amp;borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
85         [% END %]
86       </td>
87     </tr>
88
89   [% END %]
90 <tfoot>
91   <tr>
92     <td colspan="8">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>
103 </div>
104
105             </main>
106         </div> <!-- /.col-sm-10.col-sm-push-2 -->
107
108         <div class="col-sm-2 col-sm-pull-10">
109             <aside>
110                 [% INCLUDE 'circ-menu.inc' %]
111             </aside>
112         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
113      </div> <!-- /.row -->
114
115 [% MACRO jsinclude BLOCK %]
116     [% INCLUDE 'datatables.inc' %]
117     [% INCLUDE 'columns_settings.inc' %]
118     [% INCLUDE 'str/members-menu.inc' %]
119     [% Asset.js("js/members-menu.js") | $raw %]
120     <script>
121         $(document).ready(function() {
122             var txtActivefilter = _("Filter paid transactions");
123             var txtInactivefilter = _("Show all transactions");
124             var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
125             var table_account_fines = KohaTable("table_account_fines", {
126                 "sPaginationType": "four_button",
127                 'aaSorting': [[0, 'desc']],
128                 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
129                 "aoColumnDefs": [
130                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
131                     { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
132                 ]
133             }, columns_settings);
134             $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
135             $('#filter_transacs').click(function(e) {
136                 e.preventDefault();
137                 if ($(this).hasClass('filtered')) {
138                     var filteredValue = '';
139                     $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
140                 } else { //Not filtered. Let's do it!
141                     var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
142                     $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
143                 }
144                 table_account_fines.fnFilter(filteredValue, 5, true, false);
145                 $(this).toggleClass('filtered');
146             });
147
148             $(".void").on("click",function(e){
149                 if( confirm( _("Are you sure you want to void this credit?") ) ) {
150                     return true;
151                 } else {
152                     e.preventDefault();
153                 }
154             });
155         });
156     </script>
157 [% END %]
158
159 [% INCLUDE 'intranet-bottom.inc' %]