Bug 24339: Remove SIP payment types from staff pay screens
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / boraccount.tt
blob4d7adbb41df0b71457b836406c29ab3e7306e76a
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 %]
12 [% PROCESS 'accounts.inc' %]
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>
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> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Account for [% INCLUDE 'patron-title.inc' %]</div>
25 <div class="main container-fluid">
26     <div class="row">
27         <div class="col-sm-10 col-sm-push-2">
28             <main>
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">
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>Account type</th>
48           <th>Description of charges</th>
49           <th>Barcode</th>
50           <th>Due date</th>
51           <th>Return date</th>
52           <th>Home library</th>
53           <th>Note</th>
54           <th>Amount</th>
55           <th>Outstanding</th>
56           <th>Actions</th>
57         </tr>
58     </thead>
60         <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
61   [% FOREACH account IN accounts %]
63    <tr>
64    <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
65         <td>[% PROCESS account_type_description account=account %]</td>
66       <td>
67         [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
68         [%- IF account.description %][% account.description | html %][% END %]
69         &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>
70       <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>
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>
77       <td class="actions">
78         [% IF ( account.is_credit ) %]
79           <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>
80         [% ELSE %]
81           <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>
82         [% END %]
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&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>
86         [% END %]
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>
89         [% END %]
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>
92         [% END %]
93       </td>
94     </tr>
96   [% END %]
97 <tfoot>
98   <tr>
99     <td colspan="9">Total due</td>
100     [% IF ( totalcredit ) %]
101         <td class="credit" style="text-align: right;">[% total | $Price %]</td>
102     [% ELSE %]
103        <td class="debit"style="text-align: right;">[% total | $Price %]</td>
104     [% END %]
105     <td></td>
106   </tr>
107   </tfoot>
108 </table>
109 </div>
110 </div>
112             </main>
113         </div> <!-- /.col-sm-10.col-sm-push-2 -->
115         <div class="col-sm-2 col-sm-pull-10">
116             <aside>
117                 [% INCLUDE 'circ-menu.inc' %]
118             </aside>
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">&times;</span></button>
132                         <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
133                     </div>
134                     <div class="modal-body">
135                         <fieldset class="rows">
136                             <ol>
137                                 <li>
138                                     <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
139                                 </li>
140                                 <li>
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>
144                                 </li>
145                                 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
146                                 [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
147                                 [% IF payment_types > 3 %]
148                                 <li>
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>
154                                             [% END %]
155                                         [% END %]
156                                     </select>
157                                 </li>
158                                 [% END %]
160                                 [% IF Koha.Preference('UseCashRegisters') %]
161                                 <li>
162                                     <label for="cash_register">Cash register: </label>
163                                     <select name="cash_register" id="cash_register">
164                                         [% FOREACH register IN registers %]
165                                           [% IF register.id == registerid %]
166                                         <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
167                                           [% ELSE %]
168                                         <option value="[% register.id | html %]">[% register.name | html %]</option>
169                                           [% END %]
170                                         [% END %]
171                                     </select>
172                                 </li>
173                                 [% END %]
175                             </ol>
176                         </fieldset> <!-- /.rows -->
177                     </div> <!-- /.modal-body -->
178                     <div class="modal-footer">
179                         <input type="hidden" name="registerid" value="[% register.id | html %]">
180                         <input type="hidden" name="op" value="payout">
181                         <button type="submit" class="btn btn-default">Confirm</button>
182                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
183                     </div> <!-- /.modal-footer -->
184                 </div> <!-- /.modal-content -->
185             </div> <!-- /.modal-dialog -->
186         </form> <!-- /#payout_form -->
187     </div> <!-- /#issuePayoutModal -->
189     <!-- Issue refund modal -->
190     <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
191         <form  id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
192             <input type="hidden" name="accountlines_id" value="" id="refundline">
193             <input type="hidden" name="action" value="refund">
194             <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
195             <div class="modal-dialog" role="document">
196                 <div class="modal-content">
197                     <div class="modal-header">
198                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
199                         <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
200                     </div>
201                     <div class="modal-body">
202                         <fieldset class="rows">
203                             <ol>
204                                 <li>
205                                     <span id="item" class="label">Account: </span><span></span>
206                                 </li>
207                                 <li>
208                                     <span id="paid" class="label">Amount paid: </span><span></span>
209                                 </li>
210                                 <li>
211                                     <label class="required" for="amount">Returned to patron: </label>
212                                     <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
213                                     <span class="required">Required</span>
214                                 </li>
215                                 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
216                                 <li>
217                                     <label for="transaction_type">Transaction type: </label>
218                                     <select name="transaction_type" id="transaction_type">
219                                         <option value="AC">Account credit</option>
220                                         [% IF payment_types %]
221                                         [% FOREACH pt IN payment_types %]
222                                         <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
223                                         [% END %]
224                                         [% END %]
225                                     </select>
226                                 </li>
228                                 [% IF Koha.Preference('UseCashRegisters') %]
229                                 <li>
230                                     <label for="cash_register">Cash register: </label>
231                                     <select name="cash_register" id="cash_register">
232                                         [% FOREACH register IN registers %]
233                                           [% IF register.id == registerid %]
234                                         <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
235                                           [% ELSE %]
236                                         <option value="[% register.id | html %]">[% register.name | html %]</option>
237                                           [% END %]
238                                         [% END %]
239                                     </select>
240                                 </li>
241                                 [% END %]
243                             </ol>
244                         </fieldset> <!-- /.rows -->
245                     </div> <!-- /.modal-body -->
246                     <div class="modal-footer">
247                         <input type="hidden" name="registerid" value="[% register.id | html %]">
248                         <input type="hidden" name="op" value="refund">
249                         <button type="submit" class="btn btn-default">Confirm</button>
250                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
251                     </div> <!-- /.modal-footer -->
252                 </div> <!-- /.modal-content -->
253             </div> <!-- /.modal-dialog -->
254         </form> <!-- /#refund_form -->
255     </div> <!-- /#issueRefundModal -->
257 [% MACRO jsinclude BLOCK %]
258     [% INCLUDE 'datatables.inc' %]
259     [% INCLUDE 'columns_settings.inc' %]
260     [% INCLUDE 'str/members-menu.inc' %]
261     [% Asset.js("js/members-menu.js") | $raw %]
262     <script>
263         $(document).ready(function() {
264             [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
265                 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             [% END %]
268             var txtActivefilter = _("Filter paid transactions");
269             var txtInactivefilter = _("Show all transactions");
270             var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
271             var table_account_fines = KohaTable("table_account_fines", {
272                 "sPaginationType": "full",
273                 'aaSorting': [[0, 'desc']],
274                 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
275                 "aoColumnDefs": [
276                     { "sType": "title-string", "aTargets" : [ "title-string" ] },
277                     { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
278                 ]
279             }, columns_settings);
280             $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
281             $('#filter_transacs').click(function(e) {
282                 e.preventDefault();
283                 if ($(this).hasClass('filtered')) {
284                     var filteredValue = '';
285                     $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
286                 } else { //Not filtered. Let's do it!
287                     var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
288                     $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
289                 }
290                 table_account_fines.fnFilter(filteredValue, 9, true, false);
291                 $(this).toggleClass('filtered');
292             });
294             $(".void").on("click",function(e){
295                 if( confirm( _("Are you sure you want to void this credit?") ) ) {
296                     return true;
297                 } else {
298                     e.preventDefault();
299                 }
300             });
302             $("#issuePayoutModal").on("shown.bs.modal", function(e){
303                 var button = $(e.relatedTarget);
304                 var accountline = button.data('accountline');
305                 $('#payoutline').val(accountline);
306                 var amount = button.data('amount') * -1;
307                 $("#paid + span").replaceWith(amount);
308                 $("#amount").attr({ "value": amount, "max": amount });
309                 $("#amount, #transaction_type").focus();
310             });
312             $("#issueRefundModal").on("shown.bs.modal", function(e){
313                 var button = $(e.relatedTarget);
314                 var item = button.data('item');
315                 $("#item + span").replaceWith(item);
316                 var accountline = button.data('accountline');
317                 $('#refundline').val(accountline);
318                 var amount = button.data('amount');
319                 var amountoutstanding = button.data('amountoutstanding');
320                 var paid = amount - amountoutstanding;
321                 $("#paid + span").replaceWith(paid);
322                 $("#returned").attr({ "value": paid, "max": paid });
323                 $("#returned, #transaction_type").focus();
324             });
325         });
326     </script>
327 [% END %]
329 [% INCLUDE 'intranet-bottom.inc' %]