Bug 27835: Add new syspref ChargeFinesOnCloseDay
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / pos / registers.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Price %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha &rsaquo; Cashup</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11
12 <body id="cashup" class="pos">
13     [% INCLUDE 'header.inc' %]
14     [% INCLUDE 'circ-search.inc' %]
15
16     <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Point of sale</div>
17
18     <div class="main container-fluid">
19         <div class="row">
20             <div class="col-sm-10 col-sm-push-2">
21                 <main>
22                     [% IF ( error_registers ) %]
23                     <div id="error_message" class="dialog alert">
24                         You must have at least one cash register associated with this library before you
25                         can record payments.
26                     </div>
27                     [% ELSE %]
28
29                     [% IF ( error_cashup_permission ) %]
30                     <div id="error_message" class="dialog alert">
31                         You do not have permission to perform cashup actions.
32                     </div>
33                     [% END %]
34
35                     [% IF CAN_user_cash_management_cashup %]
36                     <div id="toolbar" class="btn-toolbar">
37                         <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
38                     </div>
39                     [% END %]
40
41                     <h1>Library transaction details for [% library.branchname | html %]</h1>
42
43                     <h2>Summary</h2>
44                     <ul>
45                         <li>Total income (cash): <span id="income"></span></li>
46                         <li>Total outgoing (cash): <span id="outgoing"></span></li>
47                         <li>Total bankable: <span id="bankable"></span></li>
48                     </ul>
49
50                     <table id="registers" class="table_registers">
51                         <thead>
52                             <th>Register name</th>
53                             <th>Register description</th>
54                             <th>Last cashup</th>
55                             <th>Float</th>
56                             <th>Bankable</th>
57                             <th>Income (cash)</th>
58                             <th>Outgoing (cash)</th>
59                             [% IF CAN_user_cash_management_cashup %]
60                             <th class="noExport">Actions</th>
61                             [% END %]
62                         </thead>
63                         <tbody>
64                             [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
65                             [% FOREACH register IN registers %]
66                             <tr>
67                                 <td><a href="/cgi-bin/koha/pos/register.pl?registerid=[% register.id | uri %]">[% register.name | html %]</a></td>
68                                 <td>[% register.description | html %]</td>
69                                 <td>
70                                     [%- IF register.last_cashup -%]
71                                     [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] ([% register.last_cashup.amount | $Price %])
72                                     [%- ELSE -%]
73                                     No last cashup
74                                     [%- END -%]
75                                 </td>
76                                 <td>[% register.starting_float | $Price %]</td>
77                                 <td>
78                                     [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => 'CASH') * -1 ) %]
79                                     [% SET bankable = bankable + rbankable %]
80                                     [% rbankable | $Price %]
81                                 </td>
82                                 <td>
83                                     [% SET rctotal = ( register.outstanding_accountlines.credits_total * -1 ) %]
84                                     [% SET rcctotal = ( register.outstanding_accountlines.credits_total( payment_type => 'CASH') * -1 ) %]
85                                     [% rctotal | $Price %] ([% rcctotal | $Price %])
86                                     [% SET ctotal = ctotal + rctotal %]
87                                     [% SET cctotal = cctotal + rcctotal %]
88                                 </td>
89                                 <td>
90                                     [% SET rdtotal = ( register.outstanding_accountlines.debits_total * -1 ) %]
91                                     [% SET rcdtotal = ( register.outstanding_accountlines.debits_total( payment_type => 'CASH') * -1 ) %]
92                                     [% rdtotal | $Price %] ([% rcdtotal | $Price %])
93                                     [% SET dtotal = dtotal + rdtotal %]
94                                     [% SET cdtotal = cdtotal + rcdtotal %]
95                                 </td>
96                                 [% IF CAN_user_cash_management_cashup %]
97                                 <td>
98                                     <button type="button" class="cashup_individual btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" data-register="[% register.description | html %]" data-bankable="[% rbankable | $Price %]" data-float="[% register.starting_float | $Price %]" data-registerid="[% register.id | html %]"><i class="fa fa-money"></i> Record cashup</button>
99                                 </td>
100                                 [% END %]
101                             </tr>
102                             [% END %]
103                         </tbody>
104                         <tfoot>
105                             <tr>
106                                 <td colspan="4" align="right">Totals:</td>
107                                 <td>[% bankable | $Price %]</td>
108                                 <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
109                                 <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
110                                 [% IF CAN_user_cash_management_cashup %]
111                                 <td>
112                                     <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
113                                 </td>
114                                 [% END %]
115                             </tr>
116                         </tfoot>
117                     </table>
118                     [% END %]
119                 </main>
120             </div>
121
122             <div class="col-sm-2 col-sm-pull-10">
123                 <aside>
124                     [% INCLUDE 'pos-menu.inc' %]
125                 </aside>
126             </div>
127
128         </div>
129         <!-- /.row -->
130
131         <!-- Confirm cashup modal -->
132         <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
133             <div class="modal-dialog" role="document">
134                 <div class="modal-content">
135                     <div class="modal-header">
136                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
137                         <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4>
138                     </div>
139                     <div class="modal-body">
140                         Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>.
141                     </div> <!-- /.modal-body -->
142                     <div class="modal-footer">
143                         <a id="cashup_confirm" href="" class="btn btn-default">Confirm</a>
144                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
145                     </div> <!-- /.modal-footer -->
146                 </div> <!-- /.modal-content -->
147             </div> <!-- /.modal-dialog -->
148         </div> <!-- /#confirmCashupModal -->
149
150         <!-- Confirm cashupall modal -->
151         <div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel">
152             <div class="modal-dialog" role="document">
153                 <div class="modal-content">
154                     <div class="modal-header">
155                         <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
156                         <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4>
157                     </div>
158                     <div class="modal-body">
159                         <p>Please confirm that you have recieved [% bankable | $Price %] to cashup.</p>
160                         <ul>
161                             <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
162                             <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
163                         </ul>
164                     </div> <!-- /.modal-body -->
165                     <div class="modal-footer">
166                         <a id="cashup_all_confirm" href="/cgi-bin/koha/pos/registers.pl?op=cashup" class="btn btn-default">Confirm</a>
167                         <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
168                     </div> <!-- /.modal-footer -->
169                 </div> <!-- /.modal-content -->
170             </div> <!-- /.modal-dialog -->
171         </div> <!-- /#confirmCashupAllModal -->
172
173         [% MACRO jsinclude BLOCK %]
174         [% INCLUDE 'datatables.inc' %]
175         <script>
176             $(document).ready(function () {
177
178                 [%# js used here as we don't have access to these template variables where we need them #%]
179                 $("#bankable").text('[% bankable | $Price %]');
180                 $("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])');
181                 $("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])');
182
183                 var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
184                     "bFilter": false,
185                     "paginationType": "full"
186                 }));
187
188                 $("#confirmCashupModal").on("shown.bs.modal", function(e){
189                    var button = $(e.relatedTarget);
190                    var register = button.data('register');
191                    $("#registerc").text(register);
192                    var bankable = button.data('bankable');
193                    $("#cashc").text(bankable);
194                    var rfloat = button.data('float');
195                    $('#floatc').text(rfloat);
196                    var rid = button.data('registerid');
197                    $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup&registerid='+rid);
198                 });
199             });
200         </script>
201         [% END %]
202 [% INCLUDE 'intranet-bottom.inc' %]