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