Bug 24082: Add `anonymous_refund` permission to `cash_management`
[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 Price %]
6 [% SET footerjs = 1 %]
7 [% PROCESS 'accounts.inc' %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha &rsaquo; Cashup</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 [% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %]
12 </head>
13
14 <body id="register" class="pos">
15 [% INCLUDE 'header.inc' %]
16 [% INCLUDE 'circ-search.inc' %]
17
18 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/pos/pay.pl">Point of sale</a> &rsaquo; Register details</div>
19
20 <div class="main container-fluid">
21     <div class="row">
22         <div class="col-sm-10 col-sm-push-2">
23
24             [% IF ( error_registers ) %]
25             <div id="error_message" class="dialog alert">
26                 You must have at least one cash register associated with this branch before you can record payments.
27             </div>
28             [% ELSE %]
29
30             [% IF ( CAN_user_cash_management_cashup ) %]
31             <div id="toolbar" class="btn-toolbar">
32                 <button type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" ><i class="fa fa-money"></i> Record cashup</button>
33             </div>
34             [% END %]
35
36             <h1>Register transaction details for [% register.name | html %]</h1>
37
38             <h2>Summary</h2>
39             <ul>
40                 [% IF register.last_cashup %]
41                 <li>Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]</li>
42                 [% END %]
43                 <li>Float: [% register.starting_float | $Price %]</li>
44                 <li>Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => 'CASH') * -1 | $Price %])</li>
45                 <li>Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => 'CASH') * -1 | $Price %])</li>
46                 <li>Total bankable: [% accountlines.total( payment_type => 'CASH') * -1 | $Price %]</li>
47             </ul>
48
49             [% IF register.last_cashup %]
50             <h2>Transactions since [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]</h2>
51             [% ELSE %]
52             <h2>Transactions to date</h2>
53             [% END %]
54             <table id="sales" class="table_sales">
55                 <thead>
56                     <th>ID</th>
57                     <th>DATA</th>
58                     <th>Transaction</th>
59                     <th>Description</th>
60                     <th>Price</th>
61                     <th>Total</th>
62                     <th>Actions</th>
63                 </thead>
64                 <tbody>
65                     [% FOREACH accountline IN accountlines %]
66                         [% IF accountline.is_credit %]
67                             [% FOREACH credit IN accountline.credit_offsets %]
68                             [% IF credit.debit %]
69                             <tr>
70                                 <td>[% accountline.accountlines_id | html %]</td>
71                                 <td>{ "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td>
72                                 <td></td>
73                                 <td>
74                                     [%- PROCESS account_type_description account=credit.debit -%]
75                                     [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
76                                     [%- 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 -%]
77                                 </td>
78                                 <td>[% credit.debit.amount | $Price %]</td>
79                                 <td></td>
80                                 <td></td>
81                             </tr>
82                             [% END %]
83                             [% END %]
84                         [% ELSE %]
85                             [% FOREACH debit IN accountline.debit_offsets %]
86                             [% IF debit.credit %]
87                             <tr>
88                                 <td>[% accountline.accountlines_id | html %]</td>
89                                 <td>{ "type": "debit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td>
90                                 <td></td>
91                                 <td>[%- PROCESS account_type_description account=debit.credit -%]</td>
92                                 <td>
93                                     [%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%]
94                                     [%- 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 -%]
95                                 </td>
96                                 <td>[% debit.credit.amount | $Price %]</td>
97                                 <td></td>
98                             </tr>
99                             [% END %]
100                             [% END %]
101                         [% END %]
102                     [% END %]
103                 </tbody>
104                 <tfoot>
105                     <tr>
106                         <td colspan="5">Total income: </td>
107                         <td>[% accountlines.total * -1 | $Price %]</td>
108                         <td></td>
109                     </tr>
110                 </tfoot>
111             </table>
112             [% END %]
113         </div>
114
115         <div class="col-sm-2 col-sm-pull-10">
116             <aside>
117                 [% INCLUDE 'pos-menu.inc' %]
118             </aside>
119         </div>
120     </div><!-- /.row -->
121
122     <!-- Confirm cashup modal -->
123     <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
124         <div class="modal-dialog" role="document">
125             <div class="modal-content">
126                 <div class="modal-header">
127                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
128                     <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em>[% register.description | html %]</em></h4>
129                 </div>
130                 <div class="modal-body">
131                     Please confirm that you have removed [% accountlines.total( payment_type => 'CASH') * -1 | $Price %] from the cash register and left a float of [% register.starting_float | $Price %].
132                 </div> <!-- /.modal-body -->
133                 <div class="modal-footer">
134                     <a href="/cgi-bin/koha/pos/register.pl?op=cashup" class="btn btn-default">Confirm</a>
135                     <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
136                 </div> <!-- /.modal-footer -->
137             </div> <!-- /.modal-content -->
138         </div> <!-- /.modal-dialog -->
139     </div> <!-- /#confirmCashupModal -->
140
141 [% MACRO jsinclude BLOCK %]
142     [% INCLUDE 'datatables.inc' %]
143     [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
144     <script>
145         var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
146             orderFixed: [ 0, 'asc'],
147             columnDefs: [ {
148                 targets: [ 0, 1 ],
149                 visible: false
150             }],
151             rowGroup: {
152                 dataSrc: 0,
153                 startRender: function ( rows, group ) {
154                     var details = JSON.parse(rows.data().pluck(1).pop());
155                     return $('<tr class="'+details.type+'"/>')
156                         .append( '<td>'+group+'</td>' )
157                         .append( '<td colspan="2">'+details.description+'</td>' )
158                         .append( '<td>'+details.amount+'</td>' )
159                         .append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> ' + _("Print receipt") + '</button></td>');
160                 },
161                 endRender: null,
162             }
163         }));
164
165         $(".printReceipt").click(function() {
166             var accountlines_id = $(this).data('accountline');
167             var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank');
168             win.focus();
169         });
170     </script>
171 [% END %]
172
173 [% INCLUDE 'intranet-bottom.inc' %]