+[% USE raw %]
+[% USE Asset %]
+[% USE Koha %]
+[% USE Branches %]
+[% USE KohaDates %]
+[% USE ColumnsSettings %]
+[% USE AuthorisedValues %]
+[% USE Price %]
+[% USE Branches %]
+[% SET footerjs = 1 %]
+
+[% PROCESS 'accounts.inc' %]
+
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' %]</title>
+<title>Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
+
<body id="pat_borraccount" class="pat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
<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>
-<div id="doc3" class="yui-t2">
-
- <div id="bd">
- <div id="yui-main">
- <div class="yui-b">
+<div class="main container-fluid">
+ <div class="row">
+ <div class="col-sm-10 col-sm-push-2">
+ <main>
+
[% INCLUDE 'members-toolbar.inc' %]
-<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" /></form>
+<form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
<!-- The manual invoice and credit buttons -->
<div class="statictabs">
<ul>
- <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
- <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
- <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a></li>
- <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a></li>
+ <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
+ <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
+ <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
+ <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
</ul>
<div class="tabs-container">
<!-- The table with the account items -->
-<table>
- <tr>
- <th>Date</th>
- <th>Description of charges</th>
- <th>Note</th>
- <th>Amount</th>
- <th>Outstanding</th>
- [% IF ( reverse_col ) %]
- <th> </th>
- [% END %]
- <th>Print</th>
- </tr>
+<table id="table_account_fines">
+ <thead>
+ <tr>
+ <th class="title-string">Date</th>
+ <th>Account type</th>
+ <th>Description of charges</th>
+ <th>Barcode</th>
+ <th>Due date</th>
+ <th>Return date</th>
+ <th>Home library</th>
+ <th>Note</th>
+ <th>Amount</th>
+ <th>Outstanding</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
<!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
[% FOREACH account IN accounts %]
- [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
- <td>[% account.date %]</td>
- <td>[% account.description %] [% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&itemnumber=[% account.itemnumber %]">View item</a> [% END %][% account.title |html %]</td>
- <td>[% account.note %]</td>
- [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount %]</td>
- [% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding %]</td>
- [% IF ( reverse_col ) %]
+ <tr>
+ <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
+ <td>[% PROCESS account_type_description account=account %]</td>
<td>
- [% IF ( account.payment ) %]
- <a href="boraccount.pl?action=reverse&accountlines_id=[% account.accountlines_id %]&borrowernumber=[% account.borrowernumber %]">Reverse</a>
- [% ELSE %]
-
- [% END %]
- </td>
- [% END %]
-<td>
- [% IF ( account.payment ) %]
- <a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id %]&borrowernumber=[% account.borrowernumber %]">Print</a>
- [% ELSE %]
- <a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id %]&borrowernumber=[% account.borrowernumber %]">Print</a>
- [% END %]
+ [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
+ [%- IF account.description %][% account.description | html %][% END %]
+ [% 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>
+ <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>
+ <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
+ <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
+ <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
+ <td>[% account.note | html_line_break %]</td>
+ [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
+ [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
+ <td class="actions">
+ [% IF ( account.is_credit ) %]
+ <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>
+ [% ELSE %]
+ <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>
+ [% END %]
+ <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>
+ [% IF account.is_credit %]
+ <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>
+ [% END %]
+ [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
+ <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>
+ [% END %]
</td>
</tr>
[% END %]
<tfoot>
<tr>
- <td colspan="4">Total due</td>
+ <td colspan="9">Total due</td>
[% IF ( totalcredit ) %]
- [% IF ( reverse_col ) %]
- <td colspan="3" class="credit">
- [% ELSE %]
- <td colspan="2" class="credit">
- [% END %]
+ <td class="credit" style="text-align: right;">[% total | $Price %]</td>
[% ELSE %]
- [% IF ( reverse_col ) %]
- <td colspan="3" class="debit">
- [% ELSE %]
- <td colspan="2" class="credit">
- [% END %]
+ <td class="debit"style="text-align: right;">[% total | $Price %]</td>
[% END %]
- [% total %]</td>
+ <td></td>
</tr>
</tfoot>
</table>
-</div></div>
-
</div>
</div>
-<div class="yui-b">
-[% INCLUDE 'circ-menu.inc' %]
-</div>
-</div>
+ </main>
+ </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+ <div class="col-sm-2 col-sm-pull-10">
+ <aside>
+ [% INCLUDE 'circ-menu.inc' %]
+ </aside>
+ </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+ </div> <!-- /.row -->
+
+ <!-- Issue payout modal -->
+ <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
+ <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
+ <input type="hidden" name="accountlines_id" value="" id="payoutline">
+ <input type="hidden" name="action" value="payout">
+ <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
+ </div>
+ <div class="modal-body">
+ <fieldset class="rows">
+ <ol>
+ <li>
+ <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
+ </li>
+ <li>
+ <label class="required" for="amount">Returned to patron: </label>
+ <input type="number" step="0.01" id="amount" name="amount" min="0.00" required="required">
+ <span class="required">Required</span>
+ </li>
+ [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
+ [% IF payment_types %]
+ <li>
+ <label for="transaction_type">Transaction type: </label>
+ <select name="transaction_type" id="transaction_type">
+ [% FOREACH pt IN payment_types %]
+ <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
+ [% END %]
+ </select>
+ </li>
+ [% END %]
+
+ [% IF Koha.Preference('UseCashRegisters') %]
+ <li>
+ <label for="cash_register">Cash register: </label>
+ <select name="cash_register" id="cash_register">
+ [% FOREACH register IN registers %]
+ [% IF register.id == registerid %]
+ <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
+ [% ELSE %]
+ <option value="[% register.id | html %]">[% register.name | html %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ [% END %]
+
+ </ol>
+ </fieldset> <!-- /.rows -->
+ </div> <!-- /.modal-body -->
+ <div class="modal-footer">
+ <input type="hidden" name="registerid" value="[% register.id | html %]">
+ <input type="hidden" name="op" value="payout">
+ <button type="submit" class="btn btn-default">Confirm</button>
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ </div> <!-- /.modal-footer -->
+ </div> <!-- /.modal-content -->
+ </div> <!-- /.modal-dialog -->
+ </form> <!-- /#payout_form -->
+ </div> <!-- /#issuePayoutModal -->
+
+[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'datatables.inc' %]
+ [% INCLUDE 'columns_settings.inc' %]
+ [% INCLUDE 'str/members-menu.inc' %]
+ [% Asset.js("js/members-menu.js") | $raw %]
+ <script>
+ $(document).ready(function() {
+ [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
+ 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');
+ [% END %]
+
+ var txtActivefilter = _("Filter paid transactions");
+ var txtInactivefilter = _("Show all transactions");
+ var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
+ var table_account_fines = KohaTable("table_account_fines", {
+ "sPaginationType": "full",
+ 'aaSorting': [[0, 'desc']],
+ "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
+ "aoColumnDefs": [
+ { "sType": "title-string", "aTargets" : [ "title-string" ] },
+ { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
+ ]
+ }, columns_settings);
+ $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
+ $('#filter_transacs').click(function(e) {
+ e.preventDefault();
+ if ($(this).hasClass('filtered')) {
+ var filteredValue = '';
+ $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
+ } else { //Not filtered. Let's do it!
+ var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
+ $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
+ }
+ table_account_fines.fnFilter(filteredValue, 9, true, false);
+ $(this).toggleClass('filtered');
+ });
+
+ $(".void").on("click",function(e){
+ if( confirm( _("Are you sure you want to void this credit?") ) ) {
+ return true;
+ } else {
+ e.preventDefault();
+ }
+ });
+
+ $("#issuePayoutModal").on("shown.bs.modal", function(e){
+ var button = $(e.relatedTarget);
+ var accountline = button.data('accountline');
+ $('#payoutline').val(accountline);
+ var amount = button.data('amount') * -1;
+ $("#paid + span").replaceWith(amount);
+ $("#amount").attr({ "value": amount, "max": amount });
+ $("#amount, #transaction_type").focus();
+ });
+ });
+ </script>
+[% END %]
+
[% INCLUDE 'intranet-bottom.inc' %]