7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Cashup</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="cashup" class="pos">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'circ-search.inc' %]
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Point of sale</div>
18 <div class="main container-fluid">
20 <div class="col-sm-10 col-sm-push-2">
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
29 [% IF ( error_cashup_permission ) %]
30 <div id="error_message" class="dialog alert">
31 You do not have permission to perform cashup actions.
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>
41 <h1>Library transaction details for [% library.branchname | html %]</h1>
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>
50 <table id="registers" class="table_registers">
52 <th>Register name</th>
53 <th>Register description</th>
57 <th>Income (cash)</th>
58 <th>Outgoing (cash)</th>
59 [% IF CAN_user_cash_management_cashup %]
64 [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
65 [% FOREACH register IN registers %]
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>
70 [%- IF register.last_cashup -%]
71 [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] ([% register.last_cashup.amount | $Price %])
76 <td>[% register.starting_float | $Price %]</td>
78 [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => 'CASH') * -1 ) %]
79 [% SET bankable = bankable + rbankable %]
80 [% rbankable | $Price %]
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 %]
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 %]
96 [% IF CAN_user_cash_management_cashup %]
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>
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 %]
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>
122 <div class="col-sm-2 col-sm-pull-10">
124 [% INCLUDE 'pos-menu.inc' %]
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">×</span></button>
137 <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4>
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 -->
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">×</span></button>
156 <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4>
158 <div class="modal-body">
159 <p>Please confirm that you have recieved [% bankable | $Price %] to cashup.</p>
161 <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
162 <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
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 -->
173 [% MACRO jsinclude BLOCK %]
174 [% INCLUDE 'datatables.inc' %]
176 $(document).ready(function () {
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 %])');
183 var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
185 "paginationType": "full"
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®isterid='+rid);
202 [% INCLUDE 'intranet-bottom.inc' %]