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