Bug 26602: Don't export "actions" column
[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 message">
24                             <p>
25                                 You must have at least one cash register associated with the library before you can record payments.
26                             </p>
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>
31                                 </form>
32                             [% END %]
33                         </div>
34                     [% ELSE %]
35
36                     [% IF ( error_cashup_permission ) %]
37                     <div id="error_message" class="dialog alert">
38                         You do not have permission to perform cashup actions.
39                     </div>
40                     [% END %]
41
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>
45                     </div>
46                     [% END %]
47
48                     <h1>Library transaction details for [% library.branchname | html %]</h1>
49
50                     <h2>Summary</h2>
51                     <ul>
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>
55                     </ul>
56
57                     <table id="registers" class="table_registers">
58                         <thead>
59                             <th>Register name</th>
60                             <th>Register description</th>
61                             <th>Last cashup</th>
62                             <th>Float</th>
63                             <th>Bankable</th>
64                             <th>Income (cash)</th>
65                             <th>Outgoing (cash)</th>
66                             [% IF CAN_user_cash_management_cashup %]
67                             <th class="noExport">Actions</th>
68                             [% END %]
69                         </thead>
70                         <tbody>
71                             [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
72                             [% FOREACH register IN registers %]
73                             <tr>
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>
76                                 <td>
77                                     [%- IF register.last_cashup -%]
78                                     [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] ([% register.last_cashup.amount | $Price %])
79                                     [%- ELSE -%]
80                                     No last cashup
81                                     [%- END -%]
82                                 </td>
83                                 <td>[% register.starting_float | $Price %]</td>
84                                 <td>
85                                     [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => 'CASH') * -1 ) %]
86                                     [% SET bankable = bankable + rbankable %]
87                                     [% rbankable | $Price %]
88                                 </td>
89                                 <td>
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 %]
95                                 </td>
96                                 <td>
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 %]
102                                 </td>
103                                 [% IF CAN_user_cash_management_cashup %]
104                                 <td>
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>
106                                 </td>
107                                 [% END %]
108                             </tr>
109                             [% END %]
110                         </tbody>
111                         <tfoot>
112                             <tr>
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 %]
118                                 <td>
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>
120                                 </td>
121                                 [% END %]
122                             </tr>
123                         </tfoot>
124                     </table>
125                     [% END %]
126                 </main>
127             </div>
128
129             <div class="col-sm-2 col-sm-pull-10">
130                 <aside>
131                     [% INCLUDE 'pos-menu.inc' %]
132                 </aside>
133             </div>
134
135         </div>
136         <!-- /.row -->
137
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">&times;</span></button>
144                         <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4>
145                     </div>
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 -->
156
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">&times;</span></button>
163                         <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4>
164                     </div>
165                     <div class="modal-body">
166                         <p>Please confirm that you have recieved [% bankable | $Price %] to cashup.</p>
167                         <ul>
168                             <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
169                             <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
170                         </ul>
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 -->
179
180         [% MACRO jsinclude BLOCK %]
181         [% INCLUDE 'datatables.inc' %]
182         <script>
183             $(document).ready(function () {
184
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 %])');
189
190                 var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, {
191                     "bFilter": false,
192                     "paginationType": "full"
193                 }));
194
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&registerid='+rid);
205                 });
206             });
207         </script>
208         [% END %]
209 [% INCLUDE 'intranet-bottom.inc' %]