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 message">
25 You must have at least one cash register associated with the library before you can record payments.
27 [% IF ( CAN_user_parameters_manage_cash_registers ) %]
28 <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
29 <input type="hidden" name="op" value="add_form" />
30 <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
36 [% IF ( error_cashup_permission ) %]
37 <div id="error_message" class="dialog alert">
38 You do not have permission to perform cashup actions.
42 [% IF CAN_user_cash_management_cashup %]
43 <div id="toolbar" class="btn-toolbar">
44 <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
48 <h1>Library transaction details for [% library.branchname | html %]</h1>
52 <li>Total income (cash): <span id="income"></span></li>
53 <li>Total outgoing (cash): <span id="outgoing"></span></li>
54 <li>Total bankable: <span id="bankable"></span></li>
57 <table id="registers" class="table_registers">
59 <th>Register name</th>
60 <th>Register description</th>
64 <th>Income (cash)</th>
65 <th>Outgoing (cash)</th>
66 [% IF CAN_user_cash_management_cashup %]
71 [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
72 [% FOREACH register IN registers %]
74 <td><a href="/cgi-bin/koha/pos/register.pl?registerid=[% register.id | uri %]">[% register.name | html %]</a></td>
75 <td>[% register.description | html %]</td>
77 [%- IF register.last_cashup -%]
78 [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] ([% register.last_cashup.amount | $Price %])
83 <td>[% register.starting_float | $Price %]</td>
85 [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => 'CASH') * -1 ) %]
86 [% SET bankable = bankable + rbankable %]
87 [% rbankable | $Price %]
90 [% SET rctotal = ( register.outstanding_accountlines.credits_total * -1 ) %]
91 [% SET rcctotal = ( register.outstanding_accountlines.credits_total( payment_type => 'CASH') * -1 ) %]
92 [% rctotal | $Price %] ([% rcctotal | $Price %])
93 [% SET ctotal = ctotal + rctotal %]
94 [% SET cctotal = cctotal + rcctotal %]
97 [% SET rdtotal = ( register.outstanding_accountlines.debits_total * -1 ) %]
98 [% SET rcdtotal = ( register.outstanding_accountlines.debits_total( payment_type => 'CASH') * -1 ) %]
99 [% rdtotal | $Price %] ([% rcdtotal | $Price %])
100 [% SET dtotal = dtotal + rdtotal %]
101 [% SET cdtotal = cdtotal + rcdtotal %]
103 [% IF CAN_user_cash_management_cashup %]
105 <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>
113 <td colspan="4" align="right">Totals:</td>
114 <td>[% bankable | $Price %]</td>
115 <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
116 <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
117 [% IF CAN_user_cash_management_cashup %]
119 <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
129 <div class="col-sm-2 col-sm-pull-10">
131 [% INCLUDE 'pos-menu.inc' %]
138 <!-- Confirm cashup modal -->
139 <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
140 <div class="modal-dialog" role="document">
141 <div class="modal-content">
142 <div class="modal-header">
143 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
144 <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4>
146 <div class="modal-body">
147 Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>.
148 </div> <!-- /.modal-body -->
149 <div class="modal-footer">
150 <a id="cashup_confirm" href="" class="btn btn-default">Confirm</a>
151 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
152 </div> <!-- /.modal-footer -->
153 </div> <!-- /.modal-content -->
154 </div> <!-- /.modal-dialog -->
155 </div> <!-- /#confirmCashupModal -->
157 <!-- Confirm cashupall modal -->
158 <div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel">
159 <div class="modal-dialog" role="document">
160 <div class="modal-content">
161 <div class="modal-header">
162 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
163 <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4>
165 <div class="modal-body">
166 <p>Please confirm that you have recieved [% bankable | $Price %] to cashup.</p>
168 <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
169 <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
171 </div> <!-- /.modal-body -->
172 <div class="modal-footer">
173 <a id="cashup_all_confirm" href="/cgi-bin/koha/pos/registers.pl?op=cashup" class="btn btn-default">Confirm</a>
174 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
175 </div> <!-- /.modal-footer -->
176 </div> <!-- /.modal-content -->
177 </div> <!-- /.modal-dialog -->
178 </div> <!-- /#confirmCashupAllModal -->
180 [% MACRO jsinclude BLOCK %]
181 [% INCLUDE 'datatables.inc' %]
183 $(document).ready(function () {
185 [%# js used here as we don't have access to these template variables where we need them #%]
186 $("#bankable").text('[% bankable | $Price %]');
187 $("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])');
188 $("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])');
190 var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
192 "paginationType": "full"
195 $("#confirmCashupModal").on("shown.bs.modal", function(e){
196 var button = $(e.relatedTarget);
197 var register = button.data('register');
198 $("#registerc").text(register);
199 var bankable = button.data('bankable');
200 $("#cashc").text(bankable);
201 var rfloat = button.data('float');
202 $('#floatc').text(rfloat);
203 var rid = button.data('registerid');
204 $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup®isterid='+rid);
209 [% INCLUDE 'intranet-bottom.inc' %]