7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Cashup › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="cashup" class="pos">
13 [% WRAPPER 'header.inc' %]
14 [% INCLUDE 'circ-search.inc' %]
17 [% WRAPPER 'sub-header.inc' %]
18 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
21 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
24 <a href="/cgi-bin/koha/pos/pay.pl">Cash management</a>
27 <a href="#" aria-current="page">
28 Cash summary for [% library.branchname | html %]
35 <div class="main container-fluid">
37 <div class="col-sm-10 col-sm-push-2">
39 [% IF ( error_registers ) %]
40 <div id="error_message" class="dialog message">
42 You must have at least one cash register associated with the library before you can record payments.
44 [% IF ( CAN_user_parameters_manage_cash_registers ) %]
45 <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
46 <input type="hidden" name="op" value="add_form" />
47 <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
53 [% IF ( error_cashup_permission ) %]
54 <div id="error_message" class="dialog alert">
55 You do not have permission to perform cashup actions.
59 [% IF CAN_user_cash_management_cashup %]
60 <div id="toolbar" class="btn-toolbar">
61 <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
65 <h1>Cash summary for [% library.branchname | html %]</h1>
69 <li>Total income (cash): <span id="income"></span></li>
70 <li>Total outgoing (cash): <span id="outgoing"></span></li>
71 <li>Total bankable: <span id="bankable"></span></li>
74 <table id="registers" class="table_registers">
76 <th>Register name</th>
77 <th>Register description</th>
81 <th>Income (cash)</th>
82 <th>Outgoing (cash)</th>
83 [% IF CAN_user_cash_management_cashup %]
84 <th class="noExport">Actions</th>
88 [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
89 [% FOREACH register IN registers %]
91 <td><a href="/cgi-bin/koha/pos/register.pl?registerid=[% register.id | uri %]">[% register.name | html %]</a></td>
92 <td>[% register.description | html %]</td>
94 [%- IF register.last_cashup -%]
95 [% 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>)
100 <td>[% register.starting_float | $Price %]</td>
102 [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %]
103 [% SET bankable = bankable + rbankable %]
104 [% rbankable | $Price %]
107 [% SET rctotal = ( register.outstanding_accountlines.credits_total * -1 ) %]
108 [% SET rcctotal = ( register.outstanding_accountlines.credits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %]
109 [% rctotal | $Price %] ([% rcctotal | $Price %])
110 [% SET ctotal = ctotal + rctotal %]
111 [% SET cctotal = cctotal + rcctotal %]
114 [% SET rdtotal = ( register.outstanding_accountlines.debits_total * -1 ) %]
115 [% SET rcdtotal = ( register.outstanding_accountlines.debits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %]
116 [% rdtotal | $Price %] ([% rcdtotal | $Price %])
117 [% SET dtotal = dtotal + rdtotal %]
118 [% SET cdtotal = cdtotal + rcdtotal %]
120 [% IF CAN_user_cash_management_cashup %]
122 <button type="button" class="cashup_individual btn btn-xs 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>
130 <td colspan="4" align="right">Totals:</td>
131 <td>[% bankable | $Price %]</td>
132 <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
133 <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
134 [% IF CAN_user_cash_management_cashup %]
136 <button type="button" class="cashup_all btn btn-xs btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
146 <div class="col-sm-2 col-sm-pull-10">
148 [% INCLUDE 'pos-menu.inc' %]
155 <!-- Confirm cashup modal -->
156 <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
157 <div class="modal-dialog" role="document">
158 <div class="modal-content">
159 <div class="modal-header">
160 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
161 <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4>
163 <div class="modal-body">
164 Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>.
165 </div> <!-- /.modal-body -->
166 <div class="modal-footer">
167 <a id="cashup_confirm" href="" class="btn btn-default">Confirm</a>
168 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
169 </div> <!-- /.modal-footer -->
170 </div> <!-- /.modal-content -->
171 </div> <!-- /.modal-dialog -->
172 </div> <!-- /#confirmCashupModal -->
174 <!-- Confirm cashupall modal -->
175 <div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel">
176 <div class="modal-dialog" role="document">
177 <div class="modal-content">
178 <div class="modal-header">
179 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
180 <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4>
182 <div class="modal-body">
183 <p>Please confirm that you have received [% bankable | $Price %] to cashup.</p>
185 <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
186 <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
188 </div> <!-- /.modal-body -->
189 <div class="modal-footer">
190 <a id="cashup_all_confirm" href="/cgi-bin/koha/pos/registers.pl?op=cashup" class="btn btn-default">Confirm</a>
191 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
192 </div> <!-- /.modal-footer -->
193 </div> <!-- /.modal-content -->
194 </div> <!-- /.modal-dialog -->
195 </div> <!-- /#confirmCashupAllModal -->
197 [% INCLUDE 'modals/cashup_summary.inc' %]
199 [% MACRO jsinclude BLOCK %]
200 [% INCLUDE 'datatables.inc' %]
201 [% INCLUDE 'format_price.inc' %]
202 [% INCLUDE 'js-date-format.inc' %]
203 [% Asset.js("js/cashup_modal.js") | $raw %]
205 $(document).ready(function () {
207 [%# js used here as we don't have access to these template variables where we need them #%]
208 $("#bankable").text('[% bankable | $Price %]');
209 $("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])');
210 $("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])');
212 var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
214 "paginationType": "full"
217 $("#confirmCashupModal").on("shown.bs.modal", function(e){
218 var button = $(e.relatedTarget);
219 var register = button.data('register');
220 $("#registerc").text(register);
221 var bankable = button.data('bankable');
222 $("#cashc").text(bankable);
223 var rfloat = button.data('float');
224 $('#floatc').text(rfloat);
225 var rid = button.data('registerid');
226 $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup®isterid='+rid);
231 [% INCLUDE 'intranet-bottom.inc' %]