6 [% USE ColumnsSettings %]
7 [% USE AuthorisedValues %]
10 [% SET footerjs = 1 %]
12 [% PROCESS 'accounts.inc' %]
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
19 <body id="pat_borraccount" class="pat">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'patron-search.inc' %]
23 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Account for [% INCLUDE 'patron-title.inc' %]</div>
25 <div class="main container-fluid">
27 <div class="col-sm-10 col-sm-push-2">
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>
33 <!-- The manual invoice and credit buttons -->
34 <div class="statictabs">
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>
41 <div class="tabs-container">
42 <!-- The table with the account items -->
43 <table id="table_account_fines">
46 <th class="title-string">Date</th>
48 <th>Description of charges</th>
60 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
61 [% FOREACH account IN accounts %]
64 <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
65 <td>[% PROCESS account_type_description account=account %]</td>
67 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
68 [%- IF account.description %][% account.description | html %][% END %]
69 [% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
70 <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
71 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
72 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
73 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
74 <td>[% account.note | html_line_break %]</td>
75 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
76 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
78 [% IF ( account.is_credit ) %]
79 <a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
81 <a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
83 <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>
84 [% IF account.is_credit %]
85 <a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
87 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
88 <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue payout</button>
90 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
91 <button type="button" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue refund</button>
99 <td colspan="9">Total due</td>
100 [% IF ( totalcredit ) %]
101 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
103 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
113 </div> <!-- /.col-sm-10.col-sm-push-2 -->
115 <div class="col-sm-2 col-sm-pull-10">
117 [% INCLUDE 'circ-menu.inc' %]
119 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
120 </div> <!-- /.row -->
122 <!-- Issue payout modal -->
123 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
124 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
125 <input type="hidden" name="accountlines_id" value="" id="payoutline">
126 <input type="hidden" name="action" value="payout">
127 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
128 <div class="modal-dialog" role="document">
129 <div class="modal-content">
130 <div class="modal-header">
131 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
132 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
134 <div class="modal-body">
135 <fieldset class="rows">
138 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
141 <label class="required" for="amount">Returned to patron: </label>
142 <input type="number" step="0.01" id="amount" name="amount" min="0.00" required="required">
143 <span class="required">Required</span>
145 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
146 [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
147 [% IF payment_types > 3 %]
149 <label for="transaction_type">Transaction type: </label>
150 <select name="transaction_type" id="transaction_type">
151 [% FOREACH pt IN payment_types %]
152 [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
153 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
160 [% IF Koha.Preference('UseCashRegisters') %]
162 <label for="registerid">Cash register: </label>
163 <select name="registerid" id="payout_registerid">
164 [% FOREACH register IN registers %]
165 [% IF register.id == registerid %]
166 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
168 <option value="[% register.id | html %]">[% register.name | html %]</option>
176 </fieldset> <!-- /.rows -->
177 </div> <!-- /.modal-body -->
178 <div class="modal-footer">
179 <input type="hidden" name="op" value="payout">
180 <button type="submit" class="btn btn-default">Confirm</button>
181 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
182 </div> <!-- /.modal-footer -->
183 </div> <!-- /.modal-content -->
184 </div> <!-- /.modal-dialog -->
185 </form> <!-- /#payout_form -->
186 </div> <!-- /#issuePayoutModal -->
188 <!-- Issue refund modal -->
189 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
190 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
191 <input type="hidden" name="accountlines_id" value="" id="refundline">
192 <input type="hidden" name="action" value="refund">
193 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
194 <div class="modal-dialog" role="document">
195 <div class="modal-content">
196 <div class="modal-header">
197 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
198 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
200 <div class="modal-body">
201 <fieldset class="rows">
204 <span id="item" class="label">Account: </span><span></span>
207 <span id="paid" class="label">Amount paid: </span><span></span>
210 <label class="required" for="amount">Returned to patron: </label>
211 <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
212 <span class="required">Required</span>
214 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
216 <label for="transaction_type">Transaction type: </label>
217 <select name="transaction_type" id="transaction_type">
218 <option value="AC">Account credit</option>
219 [% IF payment_types %]
220 [% FOREACH pt IN payment_types %]
221 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
227 [% IF Koha.Preference('UseCashRegisters') %]
229 <label for="registerid">Cash register: </label>
230 <select name="registerid" id="refund_registerid">
231 [% FOREACH register IN registers %]
232 [% IF register.id == registerid %]
233 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
235 <option value="[% register.id | html %]">[% register.name | html %]</option>
243 </fieldset> <!-- /.rows -->
244 </div> <!-- /.modal-body -->
245 <div class="modal-footer">
246 <input type="hidden" name="op" value="refund">
247 <button type="submit" class="btn btn-default">Confirm</button>
248 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
249 </div> <!-- /.modal-footer -->
250 </div> <!-- /.modal-content -->
251 </div> <!-- /.modal-dialog -->
252 </form> <!-- /#refund_form -->
253 </div> <!-- /#issueRefundModal -->
255 [% MACRO jsinclude BLOCK %]
256 [% INCLUDE 'datatables.inc' %]
257 [% INCLUDE 'columns_settings.inc' %]
258 [% INCLUDE 'str/members-menu.inc' %]
259 [% Asset.js("js/members-menu.js") | $raw %]
261 $(document).ready(function() {
262 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
263 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
266 var txtActivefilter = _("Filter paid transactions");
267 var txtInactivefilter = _("Show all transactions");
268 var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
269 var table_account_fines = KohaTable("table_account_fines", {
270 "sPaginationType": "full",
271 'aaSorting': [[0, 'desc']],
272 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
274 { "sType": "title-string", "aTargets" : [ "title-string" ] },
275 { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
277 }, columns_settings);
278 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
279 $('#filter_transacs').click(function(e) {
281 if ($(this).hasClass('filtered')) {
282 var filteredValue = '';
283 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
284 } else { //Not filtered. Let's do it!
285 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
286 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
288 table_account_fines.fnFilter(filteredValue, 9, true, false);
289 $(this).toggleClass('filtered');
292 $(".void").on("click",function(e){
293 if( confirm( _("Are you sure you want to void this credit?") ) ) {
300 $("#issuePayoutModal").on("shown.bs.modal", function(e){
301 var button = $(e.relatedTarget);
302 var accountline = button.data('accountline');
303 $('#payoutline').val(accountline);
304 var amount = button.data('amount') * -1;
305 $("#paid + span").replaceWith(amount);
306 $("#amount").attr({ "value": amount, "max": amount });
307 $("#amount, #transaction_type").focus();
310 $("#issueRefundModal").on("shown.bs.modal", function(e){
311 var button = $(e.relatedTarget);
312 var item = button.data('item');
313 $("#item + span").replaceWith(item);
314 var accountline = button.data('accountline');
315 $('#refundline').val(accountline);
316 var amount = button.data('amount');
317 var amountoutstanding = button.data('amountoutstanding');
318 var paid = amount - amountoutstanding;
319 $("#paid + span").replaceWith(paid);
320 $("#returned").attr({ "value": paid, "max": paid });
321 $("#returned, #transaction_type").focus();
327 [% INCLUDE 'intranet-bottom.inc' %]