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