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