Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / reserves_stats.tt
1 [% USE Branches %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Reports &rsaquo; Holds statistics [% IF ( do_it ) %]&rsaquo; Results[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <style type="text/css">
7         .sql {display:none;}
8 </style>
9 </head>
10
11 <body id="rep_reserve_stats" class="rep">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
14
15 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> [% IF ( do_it ) %]&rsaquo; <a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds statistics</a> &rsaquo; Results [% ELSE %]&rsaquo; Holds statistics[% END %]</div>
16
17 <div id="doc3" class="yui-t2">
18
19    <div id="bd">
20         <div id="yui-main">
21         <div class="yui-b">
22
23 [% IF ( do_it ) %]
24     [% IF ( mainloop ) %]
25         <h1>Holds statistics</h1>
26         [% IF ( loopfilter ) %]
27             <p>Filtered on:</p>
28             <ul>
29             [% FOREACH loopfilte IN loopfilter %]
30                 [% IF ( loopfilte.err ) %]<li class="error">Error:
31                                 [% ELSIF ( loopfilte.sql ) %]<li class="sql">
32                                 [% ELSE %]<li>
33                                 [% END %]
34                                         [% loopfilte.crit | html %] [% loopfilte.filter | html %]
35                                 </li>
36             [% END %]
37             </ul>
38         [% END %]
39                 
40     [% FOREACH mainloo IN mainloop %]
41         
42         <table> 
43             <tr>
44                 <th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
45                 [% FOREACH loopco IN mainloo.loopcol %]
46                     <th>[% loopco.coltitle_display | html %]</th>
47                 [% END %]
48                 <th>TOTAL</th>
49                 </tr>
50                 [% FOREACH loopro IN mainloo.looprow %]
51                     <tr>
52                         <td>[% loopro.rowtitle_display or "UNKNOWN VALUE" | html %]</td>
53                     [% FOREACH loopcel IN loopro.loopcell %]
54                                                 <td align="center">
55                                                 [% IF ( loopcel.url_complement ) %]<a href="reserves_stats.pl?output=[% loopcel.output | html %]&amp;[% loopcel.url_complement | html %]">[% loopcel.value | html %]</a>[% ELSE %][% loopcel.value | html %][% END %]
56                                                 </td>
57                     [% END %]
58                                                 <td align="center">[% loopro.totalrow | html %]</td>
59                     </tr>
60                 [% END %]
61             <tr>
62                 <th>TOTAL</th>
63                 [% FOREACH loopfoote IN mainloo.loopfooter %]
64                 <th>[% loopfoote.totalcol | html %]</th>
65                 [% END %]
66                 <th>[% mainloo.total | html %]</th>
67             </tr>
68         </table>
69     [% END %]
70     [% END %]
71 [% ELSE %]
72
73     <form method="post" action="/cgi-bin/koha/reports/reserves_stats.pl">
74     <fieldset class="rows">
75         <legend>Holds statistics</legend><table>
76         <thead>
77             <tr>
78                 <th>Title</th>
79                 <th>Row</th>
80                 <th>Column</th>
81                 <th>Filter</th>
82             </tr>
83         </thead>
84         <tbody>
85                 <tr >
86                 <td>Hold status </td>
87                 <td><input type="radio" name="Line" value="reservestatus" /></td>
88                 <td><input type="radio" name="Column" value="reservestatus" checked="checked" /></td>
89                 <td>
90                                 <input type="checkbox" name="filter_reservestatus_or_1" value="1" /> Asked
91                                 <input type="checkbox" name="filter_reservestatus_or_2" value="2" /> Processing
92                                 <input type="checkbox" name="filter_reservestatus_or_3" value="3" /> Waiting
93                                 <input type="checkbox" name="filter_reservestatus_or_4" value="4" /> Satisfied
94                                 <input type="checkbox" name="filter_reservestatus_or_5" value="5" /> Cancelled
95                                 </td>
96              </tr>
97              <tr>
98                 <td>Hold date</td>
99                 <td><input type="radio" name="Line" value="reservedate" /></td>
100                 <td><input type="radio" name="Column" value="reservedate" /></td>
101                 <td><label for="filter_reservedate_begin">From</label> <input type="text"  size="10" id="filter_reservedate_begin" name="filter_reservedate_begin" />
102                     <label for="filter_reservedate_end">To</label> <input size="10" id="filter_reservedate_end" name="filter_reservedate_end" value="" type="text" />
103                     </td>
104                 </tr>
105             <tr>
106                 <td>Notification date</td>
107                 <td><input type="radio" name="Line" value="notificationdate" /></td>
108                 <td><input type="radio" name="Column" value="notificationdate" /></td>
109                 <td><label for="filter_notificationdate_begin">From</label> <input type="text"  size="10" id="filter_notificationdate_begin" name="filter_notificationdate_begin" />
110                     <label for="filter_notificationdate_end">To</label> <input  size="10" id="filter_notificationdate_end" name="filter_notificationdate_end" value="" type="text" />
111                     </td>
112              </tr>
113             <tr>
114                 <td>Reminder date</td>
115                 <td><input type="radio" name="Line" value="reminderdate" /></td>
116                 <td><input type="radio" name="Column" value="reminderdate" /></td>
117                 <td><label for="filter_reminderdate_begin">From</label> <input type="text"  size="10" id="filter_reminderdate_begin" name="Filter" />
118                     <label for="filter_reminderdate_end">To</label> <input size="10" id="filter_reminderdate_end" name="filter_reminderdate_end" value="" type="text" />
119                     </td>
120              </tr>
121             <tr>
122                 <td>Waiting date</td>
123                 <td><input type="radio" name="Line" value="waitingdate" /></td>
124                 <td><input type="radio" name="Column" value="waitingdate" /></td>
125                 <td><label for="filter_waitingdate_begin">From</label> <input type="text"  size="10" id="filter_waitingdate_begin" name="filter_waitingdate_begin" />
126                     <label for="filter_waitingdate_end">To</label> <input  size="10" id="filter_waitingdate_end" name="filter_waitingdate_end" value="" type="text" />
127                     </td>
128              </tr>
129                          <tr>
130                 <td>Cancellation date</td>
131                 <td><input type="radio" name="Line" value="cancellationdate" /></td>
132                 <td><input type="radio" name="Column" value="cancellationdate" /></td>
133                 <td><label for="filter_cancellationdate_begin">From</label> <input type="text"  size="10" id="filter_cancellationdate_begin" name="filter_cancellationdate_begin" />
134                     <label for="filter_cancellationdate_end">To</label> <input  size="10" id="filter_cancellationdate_end" name="filter_cancellationdate_end" value="" type="text" />
135                     </td>
136              </tr>
137         <tr>
138             <td>Patron category</td>
139             <td><input type="radio" name="Line" value="borrowers.categorycode" /></td>
140             <td><input type="radio" name="Column" value="borrowers.categorycode" /></td>
141            <td><select name="filter_categorycode" id="borcat">
142                <option value=""> </option>
143                [% FOREACH categoryloo IN categoryloop %]
144                  <option value="[% categoryloo.categorycode | html %]">[% categoryloo.description | html %]</option>
145                [% END %]
146                </select>
147              </td> 
148         </tr>
149         <tr>
150             <td>Item type</td>
151             <td><input type="radio" name="Line" value="items.itype" /></td>
152             <td><input type="radio" name="Column" value="items.itype" /></td>
153            <td><select name="filter_items.itype" id="itype">
154                <option value=""> </option>
155                [% FOREACH itemtype IN itemtypes %]
156                  <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
157                [% END %]
158                </select>
159              </td> 
160         </tr>
161         <tr>
162             <td>Pickup library</td>
163             <td><input type="radio" name="Line" value="reserves.branchcode" checked="checked" /></td>
164             <td><input type="radio" name="Column" value="reserves.branchcode" /></td>
165             <td><select name="filter_reserves.branchcode" id="resbranchcode">
166                <option value=""> </option>
167                 [% PROCESS options_for_libraries libraries => Branches.all() %]
168                </select>
169              </td> 
170         </tr>
171         <tr>
172             <td>Holding library</td>
173             <td><input type="radio" name="Line" value="items.holdingbranch" /></td>
174             <td><input type="radio" name="Column" value="items.holdingbranch" /></td>
175             <td><select name="filter_items.holdingbranch" id="holdingbranch">
176                <option value=""> </option>
177                 [% PROCESS options_for_libraries libraries => Branches.all() %]
178                </select>
179              </td> 
180         </tr>
181         <tr>
182             <td>Home library</td>
183             <td><input type="radio" name="Line" value="items.homebranch" /></td>
184             <td><input type="radio" name="Column" value="items.homebranch" /></td>
185             <td><select name="filter_items.homebranch" id="homebranch">
186                 <option value=""> </option>
187                 [% PROCESS options_for_libraries libraries => Branches.all() %]
188                </select>
189              </td> 
190         </tr>
191         <tr>
192             <td>Collection</td>
193             <td><input type="radio" name="Line"   value="items.ccode" /></td>
194             <td><input type="radio" name="Column" value="items.ccode" /></td>
195             <td><select name="filter_items.ccode" id="ccode">
196                 <option value=""> </option>
197                 [% FOREACH ccodeloo IN ccodeloop %]
198                                         [% IF ( ccodeloo.selected ) %] <option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>[% ELSE %]<option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>[% END %]
199                 [% END %]
200                 </select>
201             </td>
202         </tr>
203         <tr>
204             <td>Shelving location</td>
205             <td><input type="radio" name="Line" value="items.location" /></td>
206             <td><input type="radio" name="Column" value="items.location" /></td>
207             <td><select name="filter_items.location" id="location">
208                 <option value=""> </option>
209                 [% FOREACH locationloo IN locationloop %]
210                                         [% IF ( locationloo.selected ) %]<option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>[% ELSE %]<option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>[% END %]
211                                 [% END %]
212                </select>
213             </td> 
214         </tr>
215         <tr>
216             <td>Item call number</td>
217             <td></td>
218             <td></td>
219             <td>From <input type="text" name="filter_items.itemcallnumber_begin" size="10" /> (inclusive) to <input type="text" name="filter_items.itemcallnumber_endex" size="10" /> (exclusive) </td>
220         </tr>
221         [% IF ( hassort1 ) %]
222         <tr><td>Patron sort 1</td>
223                         <td><input type="radio" name="Line" value="borrowers.sort1" /></td>
224                         <td><input type="radio" name="Column" value="borrowers.sort1" /></td>
225                         <td><select name="filter_borrowers.sort1" id="sort1">
226                <option value=""> </option>
227                [% FOREACH Bsort IN Bsort1 %]
228                            [% IF ( Bsort.selected ) %]<option value="[% Bsort.authorised_value | html %]" selected="selected">[% Bsort.lib | html %]</option>[% ELSE %]<option value="[% Bsort.authorised_value | html %]" >[% Bsort.lib | html %]</option>[% END %]
229                [% END %]
230                </select>
231             </td> 
232         </tr>
233         [% END %]
234         [% IF ( hassort2 ) %]
235         <tr><td>Patron sort 2</td>
236             <td><input type="radio" name="Line" value="borrowers.sort2" /></td>
237             <td><input type="radio" name="Column" value="borrowers.sort2" /></td>
238                 <td><select name="filter_borrowers.sort2" id="sort2">
239                <option value=""> </option>
240                [% FOREACH Bsort IN Bsort2 %]
241                            [% IF ( Bsort.selected ) %]<option value="[% Bsort.authorised_value | html %]" selected="selected">[% Bsort.lib | html %]</option>[% ELSE %]<option value="[% Bsort.authorised_value | html %]" >[% Bsort.lib | html %]</option>[% END %]
242                [% END %]
243                </select>
244             </td> 
245         </tr>
246         [% END %]
247         </tbody>
248     </table><br /></fieldset>
249
250 <fieldset class="rows"><legend>Cell value </legend><ol><li><label for="cellvalue1">Count holds:</label> <input type="radio" name="Cellvalue" value="1" id="cellvalue1" checked="checked" /> </li>
251             <li><label for="cellvalue2">Count unique borrowers:</label> <input type="radio" name="Cellvalue" value="2" id="cellvalue2" /> </li><li><label for="cellvalue3">Count unique items:</label> <input type="radio" name="Cellvalue" id="cellvalue3" value="3" /> </li><li><label for="cellvalue4">Count unique biblios:</label> <input type="radio" name="Cellvalue" id="cellvalue4" value="4" /> </li></ol></fieldset>
252                         
253         <fieldset class="rows">
254         <legend>Output</legend>
255     <ol>
256         <li>
257             <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
258         </li>
259         <li>
260             <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
261             <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
262             <label class="inline" for="MIME">Into an application:</label>
263             <select name="MIME" id="MIME" size="1">
264             [% FOREACH value IN CGIextChoice %]
265                 <option value="[% value | html %]">[% value | html %]</option>
266             [% END %]
267             </select>
268             <select name="sep" id="sep" size="1">
269             [% FOREACH value IN CGIsepChoice.values.sort() %]
270               [% IF ( value == CGIsepChoice.default ) %]
271                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
272               [% ELSE %]
273                 <option value="[% value | html %]">[% value | html %]</option>
274               [% END %]
275             [% END %]
276             </select>
277         </li>
278     </ol>
279         </fieldset>
280
281         <fieldset class="action">
282         <input type="submit" value="Submit" />
283         <input type="hidden" name="report_name" value="[% report_name | html %]" />
284         <input type="hidden" name="do_it" value="1" />
285         </fieldset>
286         </form>
287 [% END %]
288
289 </div>
290 </div>
291 <div class="yui-b">
292 [% INCLUDE 'reports-menu.inc' %]
293 </div>
294 </div>
295
296 [% MACRO jsinclude BLOCK %]
297     [% INCLUDE 'calendar.inc' %]
298     <script type="text/javascript">
299         $(document).ready(function() {
300             // http://jqueryui.com/demos/datepicker/#date-range
301             var dates = $( "#filter_reservedate_begin, #filter_reservedate_end" ).datepicker({
302                 changeMonth: true,
303                 numberOfMonths: 1,
304                 onSelect: function( selectedDate ) {
305                     var option = this.id == "filter_reservedate_begin" ? "minDate" : "maxDate",
306                         instance = $( this ).data( "datepicker" );
307                         date = $.datepicker.parseDate(
308                             instance.settings.dateFormat ||
309                             $.datepicker._defaults.dateFormat,
310                             selectedDate, instance.settings );
311                     dates.not( this ).datepicker( "option", option, date );
312                 }
313             });
314             var datesND = $( "#filter_notificationdate_begin, #filter_notificationdate_end" ).datepicker({
315                 changeMonth: true,
316                 numberOfMonths: 1,
317                 onSelect: function( selectedDate ) {
318                     var option = this.id == "filter_notificationdate_begin" ? "minDate" : "maxDate",
319                         instance = $( this ).data( "datepicker" );
320                         date = $.datepicker.parseDate(
321                             instance.settings.dateFormat ||
322                             $.datepicker._defaults.dateFormat,
323                             selectedDate, instance.settings );
324                     datesND.not( this ).datepicker( "option", option, date );
325                 }
326             });
327             var datesRD = $( "#filter_reminderdate_begin, #filter_reminderdate_end" ).datepicker({
328                 changeMonth: true,
329                 numberOfMonths: 1,
330                 onSelect: function( selectedDate ) {
331                     var option = this.id == "filter_reminderdate_begin" ? "minDate" : "maxDate",
332                         instance = $( this ).data( "datepicker" );
333                         date = $.datepicker.parseDate(
334                             instance.settings.dateFormat ||
335                             $.datepicker._defaults.dateFormat,
336                             selectedDate, instance.settings );
337                     datesRD.not( this ).datepicker( "option", option, date );
338                 }
339             });
340             var datesWD = $( "#filter_waitingdate_begin, #filter_waitingdate_end" ).datepicker({
341                 changeMonth: true,
342                 numberOfMonths: 1,
343                 onSelect: function( selectedDate ) {
344                     var option = this.id == "filter_waitingdate_begin" ? "minDate" : "maxDate",
345                         instance = $( this ).data( "datepicker" );
346                         date = $.datepicker.parseDate(
347                             instance.settings.dateFormat ||
348                             $.datepicker._defaults.dateFormat,
349                             selectedDate, instance.settings );
350                     datesWD.not( this ).datepicker( "option", option, date );
351                 }
352             });
353             var datesCD = $( "#filter_cancellationdate_begin, #filter_cancellationdate_end" ).datepicker({
354                 changeMonth: true,
355                 numberOfMonths: 1,
356                 onSelect: function( selectedDate ) {
357                     var option = this.id == "filter_cancellationdate_begin" ? "minDate" : "maxDate",
358                         instance = $( this ).data( "datepicker" );
359                         date = $.datepicker.parseDate(
360                             instance.settings.dateFormat ||
361                             $.datepicker._defaults.dateFormat,
362                             selectedDate, instance.settings );
363                     datesCD.not( this ).datepicker( "option", option, date );
364                 }
365             });
366         });
367     </script>
368 [% END %]
369
370 [% INCLUDE 'intranet-bottom.inc' %]