Bug 34913: DataTables upgrade: Update CSS and option names
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / cash_register_stats.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% USE Price %]
7 [% USE ItemTypes %]
8 [% USE Registers %]
9 [% PROCESS 'i18n.inc' %]
10 [% SET footerjs = 1 %]
11 [% PROCESS 'accounts.inc' %]
12 [% INCLUDE 'doc-head-open.inc' %]
13 <title>[% FILTER collapse %]
14     [% IF( do_it ) %]
15         [% t("Results") | html %] &rsaquo;
16     [% END %]
17     [% t("Cash register statistics") | html %] &rsaquo;
18     [% t("Reports") | html %] &rsaquo;
19     [% t("Koha") | html %]
20 [% END %]</title>
21 [% INCLUDE 'doc-head-close.inc' %]
22 </head>
23
24 <body id="cash_register_stats" class="rep">
25 [% WRAPPER 'header.inc' %]
26     [% INCLUDE 'cat-search.inc' %]
27 [% END %]
28
29 [% WRAPPER 'sub-header.inc' %]
30 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
31     <ol>
32         <li>
33             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
34         </li>
35         <li>
36             <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
37         </li>
38
39         [% IF ( do_it ) %]
40             <li>
41                 <a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash register statistics</a>
42             </li>
43             <li>
44                 <a href="#" aria-current="page">
45                     Results
46                 </a>
47             </li>
48         [% ELSE %]
49             <li>
50                 <a href="#" aria-current="page">
51                     Cash register statistics
52                 </a>
53             </li>
54         [% END %]
55     </ol>
56 </nav>
57 [% END %]
58
59 <div class="main container-fluid">
60     <div class="row">
61         <div class="col-sm-10 col-sm-push-2">
62             <main>
63
64     <h1>Cash register statistics</h1>
65     <form method="post" action="/cgi-bin/koha/reports/cash_register_stats.pl" id="frmCashRegister">
66         <fieldset class="rows">
67             <legend>Cash register statistics [% beginDate | $KohaDates %] to [% endDate | $KohaDates %]</legend>
68             <ol>
69                 <br>
70                 <li>
71                     <label for="from">From: </label>
72                     <input type="text" size="10" id="from" name="from" value="[% beginDate | html %]" class="flatpickr" data-date_to="to" />
73                     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
74                 </li>
75                 <li>
76                     <label for="to">To: </label>
77                     <input type="text" size="10" id="to" name="to" value="[% endDate | html %]" class="flatpickr" />
78                     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
79                 </li>
80
81                 <li>
82                     <label for="">Transaction type:</label>
83                     <select name="transaction_type" id="transaction_type">
84                         [% IF transaction_type == "ALL" %]
85                         <option value="ALL" selected="selected">All transactions</option>
86                         [% ELSE %]
87                         <option value="ALL">All transactions</option>
88                         [% END %]
89
90                         [% IF transaction_type == "ACT" %]
91                         <option value="ACT" selected="selected">All payments to the library</option>
92                         [% ELSE %]
93                         <option value="ACT">All payments to the library</option>
94                         [% END %]
95
96                         [% IF transaction_type == "FORW" %]
97                         <option value="FORW" selected="selected">Write off</option>
98                         [% ELSE %]
99                         <option value="FORW">Write off</option>
100                         [% END %]
101
102                         [% FOREACH debit_type IN debit_types %]
103                             [% IF transaction_type == debit_type.code %]
104                             <option value="[% debit_type.code | html %]" selected="selected">[% debit_type.description | html %]</option>
105                             [% ELSE %]
106                             <option value="[% debit_type.code | html %]">[% debit_type.description | html %]</option>
107                             [% END %]
108                         [% END %]
109                         
110                         [% FOREACH credit_type IN credit_types %]
111                             [% IF transaction_type == credit_type.code %]
112                             <option value="[% credit_type.code | html %]" selected="selected">[% credit_type.description | html %]</option>
113                             [% ELSE %]
114                             <option value="[% credit_type.code | html %]">[% credit_type.description | html %]</option>
115                             [% END %]
116                         [% END %]
117                     </select>
118                 </li>
119                 <li>
120                     <label>Transaction library</label>
121                     <select name="branch" id="branch">
122                         <option value="ALL">All</option>
123                         [% FOREACH branchloo IN branchloop %]
124                             [% IF ( branchloo.selected ) %]
125                             <option value="[% branchloo.branchcode | html %]" selected="selected">[% branchloo.branchname | html %]</option>
126                             [% ELSE %]
127                             <option value="[% branchloo.branchcode | html %]">[% branchloo.branchname | html %]</option>
128                             [% END %]
129                         [% END %]
130                     </select>
131                 </li>
132                 [% IF Koha.Preference('UseCashRegisters') %]
133                 <li>
134                     <label for="registerid">Cash register: </label>
135                     <select name="registerid" id="registerid">
136                         <option id="noregister" selected="selected" value="">-- All --</option>
137                         [% PROCESS options_for_registers registers => Registers.all( selected => registerid ) %]
138                     </select>
139                 </li>
140                 [% END %]
141             </ol>
142         </fieldset>
143
144         <fieldset class="rows">
145             <legend>Output</legend>
146             <ol>
147                 <li>
148                     <label for="outputscreen">To screen into the browser: </label>
149                     <input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
150                 </li>
151                 <li>
152                     <label for="outputfile">To a file:</label>
153                     <input type="radio" name="output" value="file" id="outputfile" />
154                     <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
155
156                 </li>
157             </ol>
158         </fieldset>
159
160         <fieldset class="action">
161         <input type="submit" value="Submit" class="btn btn-default" name="do_it" />
162         </fieldset>
163     </form>
164
165     [% IF ( do_it ) %]
166     <div>&nbsp;</div>
167     <table id="tbl_cash_register_stats">
168         <thead>
169         <tr>
170             <th>Manager name</th>
171             <th>Patron card number</th>
172             <th>Patron name</th>
173             <th>Transaction library</th>
174             <th>Transaction date</th>
175             <th>Updated</th>
176             <th>Transaction type</th>
177             <th>Notes</th>
178             <th>Amount</th>
179             <th>Bibliographic record title</th>
180             <th>Barcode</th>
181             <th>Item type</th>
182         </tr>
183         </thead>
184         [% FOREACH loopresul IN loopresult %]
185             <tr>
186                 <td>[% loopresul.mfirstname | html %] [% loopresul.msurname | html %]</td>
187                 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopresul.borrowernumber | uri %]">[% loopresul.cardnumber | html %]</a></td>
188                 <td>[% loopresul.bfirstname | html %] [% loopresul.bsurname | html %]</td>
189                 <td>[% loopresul.branchname | html %]</td>
190                 <td>[% loopresul.date | $KohaDates %]</td>
191                 <td>[% loopresul.timestamp | $KohaDates with_hours = 1 %]</td>
192                 <td>[% loopresul.type_description | html %]</td>
193                 <td>[% loopresul.note | html %]</td>
194                 <td style="text-align:right;">[% loopresul.amount | $Price %]</td>
195                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber | uri %]">[% loopresul.title | html %]</a></td>
196                 <td>[% loopresul.barcode | html %]</td>
197                 <td>[% ItemTypes.GetDescription(loopresul.itype) | html %]</td>
198             </tr>
199         [% END %]
200         <tfoot>
201         <tr>
202             [% IF transaction_type == "ACT" %]
203             <th colspan="8" style="text-align:right;">TOTAL</th>
204             <th style="text-align:right;">[% total  | $Price %]</th>
205             <th colspan="3">&nbsp;</th>
206             [% END %]
207         </tr>
208         </tfoot>
209     </table>
210
211     [% END %] [%# do_it %]
212
213             </main>
214         </div> <!-- /.col-sm-10.col-sm-push-2 -->
215
216         <div class="col-sm-2 col-sm-pull-10">
217             <aside>
218                 [% INCLUDE 'reports-menu.inc' %]
219             </aside>
220         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
221      </div> <!-- /.row -->
222
223 [% MACRO jsinclude BLOCK %]
224     [% Asset.js("js/register_selection.js") | $raw %]
225     [% INCLUDE 'datatables.inc' %]
226     <script id="js">
227         $(document).ready(function() {
228             $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
229                 "pageLength": 50,
230                 "pagingType": "full_numbers"
231             }));
232         });
233     </script>
234     [% INCLUDE 'calendar.inc' %]
235     <script>
236         actTotal = "";
237
238         $(document).ready(function() {
239
240             $('#frmCashRegister').submit(function() {
241                 var isFormValid = true;
242                 var alertString= _("Form not submitted because of the following problem(s)")+"\n";
243
244                 alertString +="-------------------------------------------------------------------\n\n";
245
246                 if ( !$('#from').val() || !$('#to').val()){
247                     isFormValid = false;
248                     alertString += "\n- " + _("Dates cannot be empty");
249                 }
250
251                 if (!isFormValid) {
252                    alert(alertString);
253                    return false;
254                 }
255             });
256         });
257     </script>
258 [% END %]
259
260 [% INCLUDE 'intranet-bottom.inc' %]