Bug 32409: Fix cashup searching with non latin-1 chars
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / pos / register.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AuthorisedValues %]
6 [% USE Price %]
7 [% SET footerjs = 1 %]
8 [% PROCESS 'accounts.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Cashup &rsaquo; Koha</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %]
13 </head>
14
15 <body id="register" class="pos">
16 [% WRAPPER 'header.inc' %]
17     [% INCLUDE 'circ-search.inc' %]
18 [% END %]
19
20 [% WRAPPER 'sub-header.inc' %]
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22     <ol>
23         <li>
24             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25         </li>
26         <li>
27             <a href="/cgi-bin/koha/pos/pay.pl">Cash management</a>
28         </li>
29         <li>
30             <a href="#" aria-current="page">
31                 Transaction history for [% register.name | html %]
32             </a>
33         </li>
34     </ol>
35 </nav>
36 [% END %]
37
38 <div class="main container-fluid">
39     <div class="row">
40         <div class="col-sm-10 col-sm-push-2">
41
42             [% IF ( error_registers ) %]
43                 <div id="error_message" class="dialog message">
44                     <p>
45                         You must have at least one cash register associated with the library before you can record payments.
46                     </p>
47                     [% IF ( CAN_user_parameters_manage_cash_registers ) %]
48                         <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
49                             <input type="hidden" name="op" value="add_form" />
50                             <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
51                         </form>
52                     [% END %]
53                 </div>
54             [% ELSE %]
55
56             [% IF ( error_cashup_permission ) %]
57             <div id="error_message" class="dialog alert">
58                 You do not have permission to perform cashup actions.
59             </div>
60             [% END %]
61
62             [% IF ( error_refund_permission ) %]
63             <div id="error_message" class="dialog alert">
64                 You do not have permission to perform refund actions.
65             </div>
66             [% END %]
67
68             [% IF ( CAN_user_cash_management_cashup ) %]
69             <div id="toolbar" class="btn-toolbar">
70                 <button id="pos_cashup" type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" ><i class="fa fa-money"></i> Record cashup</button>
71             </div>
72             [% END %]
73
74             <h1>Transaction history for [% register.name | html %]</h1>
75
76             <h2>Summary</h2>
77             <ul>
78                 [% IF register.last_cashup %]
79                 <li>Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] (<a data-toggle="modal" data-cashup="[% register.last_cashup.id | html %]" data-register="[% register.description | html %]" href="#cashupSummaryModal" class="button">Summary</a>)</li>
80                 [% END %]
81                 <li>Float: [% register.starting_float | $Price %]</li>
82                 <li>Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])</li>
83                 <li>Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])</li>
84                 <li>Total bankable: [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %]</li>
85             </ul>
86
87             [% IF register.last_cashup %]
88             <h2>Transactions since [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]</h2>
89             [% ELSE %]
90             <h2>Transactions to date</h2>
91             [% END %]
92             <div class="page-section">
93                 <table id="sales" class="table_sales">
94                     <thead>
95                         <tr>
96                             <th>ID</th>
97                             <th>DATA</th>
98                             <th>Transaction</th>
99                             <th>Description</th>
100                             <th>Price</th>
101                             <th>Total</th>
102                             <th class="noExport">Actions</th>
103                         </tr>
104                     </thead>
105                     <tbody>
106                         [% FOREACH accountline IN accountlines %]
107                             [% IF accountline.is_credit %]
108                             [% IF accountline.credit_offsets.count == 1 %]
109                                 <tr class="credit dtrg-group dtrg-start dtrg-level-0">
110                                     <td></td>
111                                     <td>{}</td>
112                                     <td>[% accountline.timestamp | $KohaDates with_hours => 1 %] ([% IF accountline.credit_number %][%- accountline.credit_number | html -%][% ELSE %][% accountline.accountlines_id | html %][% END %])</td>
113                                     <td>[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])</td>
114                                     <td></td>
115                                     <td>[% accountline.amount * -1 | $Price %]</td>
116                                     <td><button class="printReceipt btn btn-default btn-xs" data-accountline="[% accountline.accountlines_id | uri %]"><i class="fa fa-print"></i> Print receipt</button></td>
117                                 </tr>
118                                 [% ELSE %]
119                                 [% FOREACH credit IN accountline.credit_offsets %]
120                                 [% IF credit.debit %]
121                                 <tr>
122                                     <td>[% accountline.accountlines_id | html %]</td>
123                                     <td>{ "type": "credit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
124                                     <td></td>
125                                     <td>
126                                         [%- PROCESS account_type_description account=credit.debit -%]
127                                         [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
128                                         [%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&amp;itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%]
129                                     </td>
130                                     <td>[% credit.debit.amount | $Price %]</td>
131                                     <td></td>
132                                     <td>
133                                         [% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED') && !(credit.debit.debit_type_code == 'PAYOUT') %]
134                                         <button type="button" class="btn btn-default btn-xs pos_refund" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa fa-money"></i> Issue refund</button>
135                                         [% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber && !(credit.debit.debit_type_code == 'PAYOUT') %]
136                                         <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa fa-money"></i> Issue refund</button>
137                                         [% END %]
138                                     </td>
139                                 </tr>
140                                 [% END %]
141                                 [% END %]
142                                 [% END %]
143                             [% ELSE %]
144                                 [% FOREACH debit IN accountline.debit_offsets %]
145                                 [% IF debit.credit %]
146                                 <tr>
147                                     <td>[% accountline.accountlines_id | html %]</td>
148                                     <td>{ "type": "debit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
149                                     <td></td>
150                                     <td>
151                                         [%- PROCESS account_type_description account=debit.credit -%]
152                                         [%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%]
153                                         [%- IF ( debit.credit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&amp;itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>)[%- END -%]
154                                     </td>
155                                     <td>[% debit.credit.amount | $Price %]</td>
156                                     <td></td>
157                                     <td>
158                                         [%- IF debit.credit.credit_type_code == 'REFUND' -%]<a href="/cgi-bin/koha/members/accountline-details.pl?accountlines_id=[% debit.credit.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>[%- END -%]
159                                     </td>
160                                 </tr>
161                                 [% END %]
162                                 [% END %]
163                             [% END %]
164                         [% END %]
165                     </tbody>
166                     <tfoot>
167                         <tr>
168                             <td colspan="5">Total income: </td>
169                             <td>[% accountlines.total * -1 | $Price %]</td>
170                             <td></td>
171                         </tr>
172                     </tfoot>
173                 </table>
174             </div>
175             [% END %]
176
177             [% IF register.cashups %]
178             <h2>Older transactions</h2>
179             <form method="GET" action="/cgi-bin/koha/pos/register.pl">
180                 <fieldset class="rows">
181                     Please select a date range to display transactions for:
182                     <ol>
183                         <li>
184                             <label for="trange_f">From: </label>
185                             <input type="text" size="10" id="from" class="flatpickr" data-date_to="to" name="trange_f" value="[% trange_f | html %]"/>
186                             <label class="inline" for="trange_t">To: </label>
187                             <input type="text" size="10" id="to" class="flatpickr" name="trange_t" value="[% trange_t | html %]" />
188                             <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
189                         </li>
190                     </ol>
191                 </fieldset>
192
193                 <div class="action">
194                     <input type="hidden" name="registerid" value="[% register.id | html %]">
195                     <input type="submit" class="btn btn-primary" value="Display" />
196                 </div>
197             </form>
198
199             [% IF trange_f %]
200                 <div class="page-section">
201                     <table id="past_sales" class="past_sales_table">
202                         <thead>
203                             <th>ID</th>
204                             <th>DATA</th>
205                             <th>Transaction</th>
206                             <th>Description</th>
207                             <th>Price</th>
208                             <th>Total</th>
209                             <th class="noExport">Actions</th>
210                         </thead>
211                         <tbody>
212                             [% FOREACH accountline IN past_accountlines %]
213                                 [% IF accountline.is_credit %]
214                                     [% FOREACH credit IN accountline.credit_offsets %]
215                                     [% IF credit.debit %]
216                                     <tr>
217                                         <td>[% accountline.accountlines_id | html %]</td>
218                                         <td>{ "type": "credit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
219                                         <td></td>
220                                         <td>
221                                             [%- PROCESS account_type_description account=credit.debit -%]
222                                             [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
223                                             [%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&amp;itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%]
224                                         </td>
225                                         <td>[% credit.debit.amount | $Price %]</td>
226                                         <td></td>
227                                         <td>
228                                             [% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED') && !(credit.debit.debit_type_code == 'PAYOUT') %]
229                                             <button type="button" class="btn btn-default btn-xs pos_refund" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa fa-money"></i> Issue refund</button>
230                                             [% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber && !(credit.debit.debit_type_code == 'PAYOUT') %]
231                                             <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" data-member="[% credit.debit.borrowernumber | html %]"><i class="fa fa-money"></i> Issue refund</button>
232                                             [% END %]
233                                         </td>
234                                     </tr>
235                                     [% END %]
236                                     [% END %]
237                                 [% ELSE %]
238                                     [% FOREACH debit IN accountline.debit_offsets %]
239                                     [% IF debit.credit %]
240                                     <tr>
241                                         <td>[% accountline.accountlines_id | html %]</td>
242                                         <td>{ "type": "debit", "identifier": "[%- accountline.credit_number | html -%]", "description": "[%- PROCESS account_type_description account=accountline -%] ([% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %])", "amount": "[% accountline.amount * -1 | $Price %]", "timestamp": "[% accountline.timestamp | $KohaDates with_hours => 1 %]" }</td>
243                                         <td></td>
244                                         <td>
245                                             [%- PROCESS account_type_description account=debit.credit -%]
246                                             [%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%]
247                                             [%- IF ( debit.credit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&amp;itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>)[%- END -%]
248                                         </td>
249                                         <td>[% debit.credit.amount | $Price %]</td>
250                                         <td></td>
251                                         <td>
252                                             [%- IF debit.credit.credit_type_code == 'REFUND' -%]<a href="/cgi-bin/koha/members/accountline-details.pl?accountlines_id=[% debit.credit.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>[%- END -%]
253                                         </td>
254                                     </tr>
255                                     [% END %]
256                                     [% END %]
257                                 [% END %]
258                             [% END %]
259                         </tbody>
260                         <tfoot>
261                             <tr>
262                                 <td colspan="5">Total income: </td>
263                                 <td>[% past_accountlines.total * -1 | $Price %]</td>
264                                 <td></td>
265                             </tr>
266                         </tfoot>
267                     </table>
268                 </div> <!-- /.page-section -->
269             [% END %]
270
271             <hr/>
272             <h2>Cashup history</h2>
273             <div class="page-section">
274                 <table id="table_cashups">
275                     <thead>
276                         <tr>
277                             <th>Date</th>
278                             <th>Cashier</th>
279                             <th>Amount</th>
280                             <th data-class-name="actions">Actions</th>
281                         </tr>
282                     </thead>
283                 </table>
284             </div>
285             [% END %]
286         </div>
287
288         <div class="col-sm-2 col-sm-pull-10">
289             <aside>
290                 [% INCLUDE 'pos-menu.inc' %]
291             </aside>
292         </div>
293     </div><!-- /.row -->
294
295     <!-- Confirm cashup modal -->
296     <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
297         <div class="modal-dialog" role="document">
298             <div class="modal-content">
299                 <div class="modal-header">
300                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
301                     <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em>[% register.description | html %]</em></h4>
302                 </div>
303                 <div class="modal-body">
304                     Please confirm that you have removed [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %] from the cash register and left a float of [% register.starting_float | $Price %].
305                 </div> <!-- /.modal-body -->
306                 <div class="modal-footer">
307                     <a href="/cgi-bin/koha/pos/register.pl?op=cashup" class="btn btn-default" id="pos_cashup_confirm">Confirm</a>
308                     <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
309                 </div> <!-- /.modal-footer -->
310             </div> <!-- /.modal-content -->
311         </div> <!-- /.modal-dialog -->
312     </div> <!-- /#confirmCashupModal -->
313
314     <!-- Issue refund modal -->
315     <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
316         <form id="refund_form" method="post" enctype="multipart/form-data" class="validated">
317             <input type="hidden" name="accountline" value="" id="refundline">
318             <div class="modal-dialog" role="document">
319                 <div class="modal-content">
320                     <div class="modal-header">
321                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
322                         <h4 class="modal-title" id="issueRefundLabel">Issue refund from <em>[% register.description | html %]</em></h4>
323                     </div>
324                     <div class="modal-body">
325                         <fieldset class="rows">
326                             <ol>
327                                 <li>
328                                     <span id="item" class="label">Item: </span><span></span>
329                                 </li>
330                                 <li>
331                                     <span id="paid" class="label">Amount paid: </span><span></span>
332                                 </li>
333                                 <li>
334                                     <label class="required" for="amount">Returned to patron: </label>
335                                     <input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" id="returned" name="amount" required="required">
336                                     <span class="required">Required</span>
337                                 </li>
338                                 [% INCLUDE 'transaction_types.inc' type="refund" %]
339                             </ol>
340                         </fieldset> <!-- /.rows -->
341                     </div> <!-- /.modal-body -->
342                     <div class="modal-footer">
343                         <input type="hidden" name="registerid" value="[% register.id | html %]">
344                         <input type="hidden" name="op" value="refund">
345                         <button type="submit" class="btn btn-default" id="pos_refund_confirm">Confirm</button>
346                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
347                     </div> <!-- /.modal-footer -->
348                 </div> <!-- /.modal-content -->
349             </div> <!-- /.modal-dialog -->
350         </form> <!-- /#refund_form -->
351     </div> <!-- /#issueRefundModal -->
352
353     [% INCLUDE 'modals/cashup_summary.inc' %]
354
355     [% MACRO jsinclude BLOCK %]
356     [% INCLUDE 'datatables.inc' %]
357     [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
358     [% INCLUDE 'format_price.inc' %]
359     [% INCLUDE 'js-date-format.inc' %]
360     [% Asset.js("js/cashup_modal.js") | $raw %]
361     [% INCLUDE 'calendar.inc' %]
362     <script>
363         var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
364             orderFixed: [ 0, 'asc'],
365             columnDefs: [ {
366                 targets: [ 0, 1 ],
367                 visible: false
368             }],
369             rowGroup: {
370                 dataSrc: 0,
371                 startRender: function ( rows, group ) {
372                     if ( group ) {
373                     var details = JSON.parse(rows.data().pluck(1).pop());
374                     var identifier = details.identifier || group;
375                     return $('<tr class="'+details.type+'"/>')
376                         .append( '<td>'+details.timestamp+' ('+identifier+')</td>' )
377                         .append( '<td colspan="2">'+details.description+'</td>' )
378                         .append( '<td>'+details.amount+'</td>' )
379                         .append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> ' + _("Print receipt") + '</button></td>');
380                     }
381                 },
382                 endRender: null,
383             },
384             initComplete: function() {
385                 $("#sales").show();
386             }
387         }));
388
389         var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, {
390             orderFixed: [ 0, 'asc'],
391             columnDefs: [ {
392                 targets: [ 0, 1 ],
393                 visible: false
394             }],
395             rowGroup: {
396                 dataSrc: 0,
397                 startRender: function ( rows, group ) {
398                     var details = JSON.parse(rows.data().pluck(1).pop());
399                     var identifier = details.identifier || group;
400                     return $('<tr class="'+details.type+'"/>')
401                         .append( '<td>'+details.timestamp+' ('+identifier+')</td>' )
402                         .append( '<td colspan="2">'+details.description+'</td>' )
403                         .append( '<td>'+details.amount+'</td>' )
404                         .append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> Print receipt</button></td>');
405                 },
406                 endRender: null,
407             }
408         }));
409
410         $("#issueRefundModal").on("shown.bs.modal", function(e){
411            var button = $(e.relatedTarget);
412            var item = button.data('item');
413            $("#item + span").replaceWith(item);
414            var accountline = button.data('accountline');
415            $('#refundline').val(accountline);
416            var amount = button.data('amount');
417            var amountoutstanding = button.data('amountoutstanding') || 0;
418            var paid = amount - amountoutstanding;
419            $("#paid + span").replaceWith(paid);
420            $("#returned").attr({ "value": paid, "max": paid });
421            var member = button.data('member');
422            if ( member === '' ) {
423                $("#refund_type option[value='AC']").remove();
424            } else if ( $("#refund_type option[value='AC']").length == 0 ) {
425                $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>');
426            }
427            $("#returned, #refund_type").focus();
428         });
429
430         $("body").on('click', ".printReceipt", function() {
431             var accountlines_id = $(this).data('accountline');
432             var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank');
433             win.focus();
434         });
435
436         var cashups_table_url = "/api/v1/cash_registers/[% register.id | html %]/cashups?";
437         var cashups_table = $("#table_cashups").kohaTable({
438             "ajax": {
439                 "url": cashups_table_url
440             },
441             "embed": [
442                "manager"
443             ],
444             "order": [[ 0, "desc" ]],
445             "columns": [
446                 {
447                     "data": "timestamp",
448                     "searchable": true,
449                     "orderable": true,
450                     "render": function(data, type, row, meta) {
451                         return $datetime(row.timestamp);
452                     }
453                 },
454                 {
455                     "data": "manager.firstname:manager.surname",
456                     "searchable": true,
457                     "orderable": true,
458                     "render": function(data, type, row, meta) {
459                         var fullname;
460                         if ( row.manager.firstname == null ) {
461                             fullname = row.manager.surname;
462                         }
463                         else {
464                             fullname = row.manager.firstname + " " + row.manager.surname;
465                         }
466                         return escape_str(fullname);
467                     }
468                 },
469                 {
470                     "data": "amount",
471                     "searchable": true,
472                     "orderable": true,
473                     "render": function(data, type, row, meta) {
474                         var amt = row.amount * -1;
475                         return escape_price(amt);
476                     }
477                 },
478                 {
479                     "data": function( row, type, val, meta ) {
480                         var result = '<a class="btn btn-default btn-xs" role="button" data-toggle="modal" data-cashup="'+encodeURIComponent(row.cashup_id)+'" data-register="[% register.description | html %]" href="#cashupSummaryModal"><i class="fa fa-pencil" aria-hidden="true"></i> '+_("Summary")+'</a>\n';
481                         return result;
482                     },
483                     "searchable": false,
484                     "orderable": false
485                 }
486             ]
487         }, null, 1);
488     </script>
489 [% END %]
490
491 [% INCLUDE 'intranet-bottom.inc' %]