Bug 6934: Fix code in CashRegisterStats (dataTables pagination, more accurate descrip...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / cash_register_stats.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Cash register statistics &rsaquo; Results[% ELSE %]&rsaquo; Cash register statistics[% END %]</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 [% INCLUDE 'datatables-strings.inc' %]
8 <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9 <script type="text/javascript" id="js">
10  $(document).ready(function() {
11     $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
12         "iDisplayLength": 50,
13         "sPaginationType": "full_numbers"
14     }));
15  });
16 </script>
17 [% INCLUDE 'calendar.inc' %]
18 <script type="text/javascript">
19 //<![CDATA[
20 actTotal = "";
21
22 function isNull(f,noalert) {
23     if (f.value.length > 0) {
24         return false;
25     }
26     return true;
27 }
28
29 $(document).ready(function() {
30     // http://jqueryui.com/demos/datepicker/#date-range
31     var dates = $( "#filter_date_begin, #filter_date_end" ).datepicker({
32         changeMonth: true,
33         numberOfMonths: 1,
34         onSelect: function( selectedDate ) {
35             var option = this.id == "filter_date_begin" ? "minDate" : "maxDate",
36                 instance = $( this ).data( "datepicker" );
37                 date = $.datepicker.parseDate(
38                     instance.settings.dateFormat ||
39                     $.datepicker._defaults.dateFormat,
40                     selectedDate, instance.settings );
41             dates.not( this ).datepicker( "option", option, date );
42         }
43     });
44
45     $('#frmCashRegister').submit(function() {
46         var isFormValid = true;
47         var alertString= _("Form not submitted because of the following problem(s)")+"\n";
48
49         alertString +="-------------------------------------------------------------------\n\n";
50
51         if ( !$('#filter_date_begin').val() || !$('#filter_date_end').val()){
52             isFormValid = false;
53             alertString += "\n- " + _("Dates cannot be empty");
54         }
55
56         if (!isFormValid) {
57            alert(alertString);
58            return false;
59         }
60     });
61 });
62
63 //]]>
64 </script>
65
66 </head>
67 <body>
68 [% INCLUDE 'header.inc' %]
69 [% INCLUDE 'cat-search.inc' %]
70
71 <div id="breadcrumbs">
72     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
73     &rsaquo;
74     [% IF ( do_it ) %]
75         <a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash register statistics</a> &rsaquo; Results
76     [% ELSE %]
77         Cash register statistics
78     [% END %]
79 </div>
80
81 <div id="doc3" class="yui-t2">
82
83    <div id="bd">
84     <div id="yui-main">
85     <div class="yui-b">
86
87     <h1>Cash register statistics</h1>
88     <form method="post" action="/cgi-bin/koha/reports/cash_register_stats.pl" id="frmCashRegister">
89         <fieldset class="rows">
90         <legend>Cash register statistics [% beginDate | $KohaDates %] to [% endDate | $KohaDates %]</legend>
91         <table>
92             <thead>
93                 <tr>
94                     <th>Interval</th>
95                 </tr>
96             </thead>
97             <tbody>
98                 <tr>
99                     <td>
100                         <label for="filter_date_begin">From</label>
101                         <input type="text" size="10" id="filter_date_begin" name="filter_date_begin" value="[% beginDate | $KohaDates %]" />
102                         <label for="filter_date_end">To</label>
103                         <input type="text" size="10" id="filter_date_end" name="filter_date_end" value="[% endDate | $KohaDates %]" />
104                     </td>
105                 </tr>
106             </tbody>
107         </table><br />
108         </fieldset>
109
110         <fieldset class="rows">
111             <ol>
112                 <li>
113                     <label for="">Transaction type:</label>
114                     <select name="transaction_type" id="transaction_type">
115                         [% IF transaction_type == "ALL" %]
116                         <option value="ALL" selected="selected">All transactions</option>
117                         [% ELSE %]
118                         <option value="ALL">All transactions</option>
119                         [% END %]
120
121                         [% IF transaction_type == "ACT" %]
122                         <option value="ACT" selected="selected">Active transactions</option>
123                         [% ELSE %]
124                         <option value="ACT">Active transactions</option>
125                         [% END %]
126
127                         [% IF transaction_type == "C" %]
128                         <option value="C" selected="selected">Credit</option>
129                         [% ELSE %]
130                         <option value="C">Credit</option>
131                         [% END %]
132
133                         [% IF transaction_type == "FORW" %]
134                         <option value="FORW" selected="selected">Write off</option>
135                         [% ELSE %]
136                         <option value="FORW">Write off</option>
137                         [% END %]
138
139                         [% IF transaction_type == "F" %]
140                         <option value="F" selected="selected">Fine</option>
141                         [% ELSE %]
142                         <option value="F">Fine</option>
143                         [% END %]
144
145                         [% IF transaction_type == "FU" %]
146                         <option value="FU" selected="selected">Accruing fine</option>
147                         [% ELSE %]
148                         <option value="FU">Accruing fine</option>
149                         [% END %]
150
151                         [% IF transaction_type == "PAY" %]
152                         <option value="PAY" selected="selected">Payment</option>
153                         [% ELSE %]
154                         <option value="PAY">Payment</option>
155                         [% END %]
156
157                         [% IF transaction_type == "A" %]
158                         <option value="A" selected="selected">Account management fee</option>
159                         [% ELSE %]
160                         <option value="A">Account Management Fee</option>
161                         [% END %]
162
163                         [% IF transaction_type == "M" %]
164                         <option value="M" selected="selected">Sundry</option>
165                         [% ELSE %]
166                         <option value="M">Sundry</option>
167                         [% END %]
168
169                         [% IF transaction_type == "L" %]
170                         <option value="L" selected="selected">Lost item</option>
171                         [% ELSE %]
172                         <option value="L">Lost item</option>
173                         [% END %]
174
175                         [% IF transaction_type == "N" %]
176                         <option value="N" selected="selected">New card</option>
177                         [% ELSE %]
178                         <option value="N">New card</option>
179                         [% END %]
180
181                         [% FOREACH manualinv IN manualinv_types %]
182                             [% value_manualinv = manualinv.authorised_value|truncate(5, '') %]
183                             [% IF transaction_type == value_manualinv %]
184                             <option value="[% value_manualinv %]" selected="selected">[% manualinv.authorised_value %]</option>
185                             [% ELSE %]
186                             <option value="[% value_manualinv %]">[% manualinv.authorised_value %]</option>
187                             [% END %]
188                         [% END %]
189                     </select>
190                 </li>
191                 <li>
192                     <label>Library</label>
193                     <select name="branch" id="branch">
194                         <option value="ALL">All</option>
195                         [% FOREACH branchloo IN branchloop %]
196                             [% IF ( branchloo.selected ) %]
197                             <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
198                             [% ELSE %]
199                             <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
200                             [% END %]
201                         [% END %]
202                     </select>
203              </td>
204         </tr>
205                 </li>
206             </ol>
207         </fieldset>
208
209         <fieldset class="rows">
210             <legend>Output</legend>
211             <ol>
212                 <li>
213                     <label for="outputscreen">To screen into the browser: </label>
214                     <input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
215                 </li>
216                 <li>
217                     <label for="outputfile">To a file:</label>
218                     <input type="radio" name="output" value="file" id="outputfile" />
219                     <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
220                     <label class="inline" for="sep">Delimiter: </label>
221                     <select name="sep" id="sep" size="1">
222                         [% FOREACH value IN CGIsepChoice.values.sort() %]
223                            [% IF ( value == CGIsepChoice.default ) %]
224                                <option value="[% value %]" selected="selected">[% value %]</option>
225                            [% ELSE %]
226                               <option value="[% value %]">[% value %]</option>
227                            [% END %]
228                         [% END %]
229                     </select>
230
231                 </li>
232             </ol>
233         </fieldset>
234
235         <fieldset class="action">
236         <input type="submit" value="Submit" name="do_it" />
237         </fieldset>
238     </form>
239
240     [% IF ( do_it ) %]
241     <div>&nbsp;</div>
242     <table id="tbl_cash_register_stats">
243         <thead>
244         <tr>
245             <th>Manager name</th>
246             <th>Patron cardnumber</th>
247             <th>Patron name</th>
248             <th>Library</th>
249             <th>Transaction date</th>
250             <th>Transaction type</th>
251             <th>Amount</th>
252             <th>Biblio title</th>
253             <th>Barcode</th>
254             <th>Item type</th>
255         </tr>
256         </thead>
257         [% FOREACH loopresul IN loopresult %]
258             <tr>
259                 <td>[% loopresul.mfirstname %] [% loopresul.msurname %]</td>
260                 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopresul.borrowernumber %]">[% loopresul.cardnumber %]</a></td>
261                 <td>[% loopresul.bfirstname %] [% loopresul.bsurname %]</td>
262                 <td>[% loopresul.branchname %]</td>
263                 <td>[% loopresul.date | $KohaDates %]</td>
264                 <td>
265                     [% IF loopresul.accounttype == "ACT" %]
266                         <span>Active transactions</span>
267                     [% ELSIF loopresul.accounttype == "C" || loopresul.accounttype == "CR" %]
268                         <span>Credit</span>
269                     [% ELSIF loopresul.accounttype == "FORW" || loopresul.accounttype == "W" %]
270                         <span>Write off</span>
271                     [% ELSIF loopresul.accounttype == "F" %]
272                         <span>Fine</span>
273                     [% ELSIF loopresul.accounttype == "FU" %]
274                         <span>Accruing fine</span>
275                     [% ELSIF loopresul.accounttype == "Pay" %]
276                         <span>Payment</span>
277                     [% ELSIF loopresul.accounttype == "A" %]
278                         <span>Account management fee</span>
279                     [% ELSIF loopresul.accounttype == "M" %]
280                         <span>Sundry</span>
281                     [% ELSIF loopresul.accounttype == "L" || loopresul.accounttype == "LR" %]
282                         <span>Lost item</span>
283                     [% ELSIF loopresul.accounttype == "N" %]
284                         <span>New card</span>
285                     [% ELSE %]
286                         [% FOREACH manualinv IN manualinv_types %]
287                             [% value_manualinv = manualinv.authorised_value|truncate(5, '') %]
288                             [% IF loopresul.accounttype == value_manualinv %]
289                             <span>[% manualinv.authorised_value %]</span>
290                             [% LAST %]
291                             [% END %]
292                         [% END %]
293                     [% END %]
294                 </td>
295                 <td style="text-align:right;">[% loopresul.amount %]</td>
296                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber %]">[% loopresul.title %]</a></td>
297                 <td>[% loopresul.barcode %]</td>
298                 <td>[% loopresul.itype %]</td>
299             </tr>
300         [% END %]
301         <tfoot>
302         <tr>
303             <th colspan="6" style="text-align:right;">TOTAL</th>
304             <th style="text-align:right;">[% total %]</th>
305             <th colspan="3">&nbsp;</th>
306         </tr>
307         </tfoot>
308     </table>
309
310     [% END %] [%# do_it %]
311 </div>
312 </div>
313 <div class="yui-b">
314 [% INCLUDE 'reports-menu.inc' %]
315 </div>
316 </div>
317 [% INCLUDE 'intranet-bottom.inc' %]