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