6 [% PROCESS 'i18n.inc' %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>[% FILTER collapse %]
10 [% tx("Cash summary for {library}", { library = library.branchname }) | html %] ›
11 [% t("Koha") | html %]
13 [% INCLUDE 'doc-head-close.inc' %]
16 <body id="cashup" class="pos">
17 [% WRAPPER 'header.inc' %]
18 [% INCLUDE 'circ-search.inc' %]
21 [% WRAPPER 'sub-header.inc' %]
22 [% WRAPPER breadcrumbs %]
23 [% WRAPPER breadcrumb_item bc_active= 1 %]
24 <span>Cash summary for [% library.branchname | html %]</span>
26 [% END #/ WRAPPER breadcrumbs %]
27 [% END #/ WRAPPER sub-header.inc %]
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
33 [% IF ( error_registers ) %]
34 <div id="error_message" class="dialog message">
36 You must have at least one cash register associated with the library before you can record payments.
38 [% IF ( CAN_user_parameters_manage_cash_registers ) %]
39 <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
40 <input type="hidden" name="op" value="add_form" />
41 <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
47 [% IF ( error_cashup_permission ) %]
48 <div id="error_message" class="dialog alert">
49 You do not have permission to perform cashup actions.
53 [% IF CAN_user_cash_management_cashup %]
54 <div id="toolbar" class="btn-toolbar">
55 <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa-solid fa-money-bill-1"></i> Cashup all</button>
59 <h1>Cash summary for [% library.branchname | html %]</h1>
63 <li>Total income (cash): <span id="income"></span></li>
64 <li>Total outgoing (cash): <span id="outgoing"></span></li>
65 <li>Total bankable: <span id="bankable"></span></li>
68 <div class="page-section">
69 <table id="registers" class="table_registers">
72 <th>Register name</th>
73 <th>Register description</th>
77 <th>Income (cash)</th>
78 <th>Outgoing (cash)</th>
79 [% IF CAN_user_cash_management_cashup %]
80 <th class="noExport">Actions</th>
85 [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
86 [% FOREACH register IN registers %]
88 <td><a href="/cgi-bin/koha/pos/register.pl?registerid=[% register.id | uri %]">[% register.name | html %]</a></td>
89 <td>[% register.description | html %]</td>
91 [%- IF register.last_cashup -%]
92 [% 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>)
97 <td>[% register.starting_float | $Price %]</td>
99 [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %]
100 [% SET bankable = bankable + rbankable %]
101 [% rbankable | $Price %]
104 [% SET rctotal = ( register.outstanding_accountlines.credits_total * -1 ) %]
105 [% SET rcctotal = ( register.outstanding_accountlines.credits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %]
106 [% rctotal | $Price %] ([% rcctotal | $Price %])
107 [% SET ctotal = ctotal + rctotal %]
108 [% SET cctotal = cctotal + rcctotal %]
111 [% SET rdtotal = ( register.outstanding_accountlines.debits_total * -1 ) %]
112 [% SET rcdtotal = ( register.outstanding_accountlines.debits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %]
113 [% rdtotal | $Price %] ([% rcdtotal | $Price %])
114 [% SET dtotal = dtotal + rdtotal %]
115 [% SET cdtotal = cdtotal + rcdtotal %]
117 [% IF CAN_user_cash_management_cashup %]
119 <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-solid fa-money-bill-1"></i> Record cashup</button>
127 <td colspan="4" align="right">Totals:</td>
128 <td>[% bankable | $Price %]</td>
129 <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
130 <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
131 [% IF CAN_user_cash_management_cashup %]
133 <button type="button" class="cashup_all btn btn-xs btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa-solid fa-money-bill-1"></i> Cashup all</button>
139 </div> <!-- /.page-section -->
144 <div class="col-sm-2 col-sm-pull-10">
146 [% INCLUDE 'pos-menu.inc' %]
153 <!-- Confirm cashup modal -->
154 <div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
155 <div class="modal-dialog" role="document">
156 <div class="modal-content">
157 <div class="modal-header">
158 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
159 <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4>
161 <div class="modal-body">
162 Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>.
163 </div> <!-- /.modal-body -->
164 <div class="modal-footer">
165 <a id="cashup_confirm" href="" class="btn btn-default">Confirm</a>
166 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
167 </div> <!-- /.modal-footer -->
168 </div> <!-- /.modal-content -->
169 </div> <!-- /.modal-dialog -->
170 </div> <!-- /#confirmCashupModal -->
172 <!-- Confirm cashupall modal -->
173 <div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel">
174 <div class="modal-dialog" role="document">
175 <div class="modal-content">
176 <div class="modal-header">
177 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
178 <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4>
180 <div class="modal-body">
181 <p>Please confirm that you have received [% bankable | $Price %] to cashup.</p>
183 <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
184 <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
186 </div> <!-- /.modal-body -->
187 <div class="modal-footer">
188 <a id="cashup_all_confirm" href="/cgi-bin/koha/pos/registers.pl?op=cashup" class="btn btn-default">Confirm</a>
189 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
190 </div> <!-- /.modal-footer -->
191 </div> <!-- /.modal-content -->
192 </div> <!-- /.modal-dialog -->
193 </div> <!-- /#confirmCashupAllModal -->
195 [% INCLUDE 'modals/cashup_summary.inc' %]
197 [% MACRO jsinclude BLOCK %]
198 [% INCLUDE 'datatables.inc' %]
199 [% INCLUDE 'format_price.inc' %]
200 [% INCLUDE 'js-date-format.inc' %]
201 [% Asset.js("js/cashup_modal.js") | $raw %]
203 $(document).ready(function () {
205 [%# js used here as we don't have access to these template variables where we need them #%]
206 $("#bankable").text('[% bankable | $Price %]');
207 $("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])');
208 $("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])');
210 var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
212 "paginationType": "full"
215 $("#confirmCashupModal").on("shown.bs.modal", function(e){
216 var button = $(e.relatedTarget);
217 var register = button.data('register');
218 $("#registerc").text(register);
219 var bankable = button.data('bankable');
220 $("#cashc").text(bankable);
221 var rfloat = button.data('float');
222 $('#floatc').text(rfloat);
223 var rid = button.data('registerid');
224 $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup®isterid='+rid);
229 [% INCLUDE 'intranet-bottom.inc' %]