fda28c2250486adcbca2d65cab2cfc549482fed5
[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 class="main container-fluid">
28     <div class="row">
29         <div class="col-sm-10 col-sm-push-2">
30             <main>
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 | html %]" selected="selected">[% manualinv.authorised_value | html %]</option>
128                             [% ELSE %]
129                             <option value="[% value_manualinv | html %]">[% manualinv.authorised_value | html %]</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 | html %]" selected="selected">[% branchloo.branchname | html %]</option>
141                             [% ELSE %]
142                             <option value="[% branchloo.branchcode | html %]">[% branchloo.branchname | html %]</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>Bibliographic record 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 | html %] [% loopresul.msurname | html %]</td>
194                 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopresul.borrowernumber | uri %]">[% loopresul.cardnumber | html %]</a></td>
195                 <td>[% loopresul.bfirstname | html %] [% loopresul.bsurname | html %]</td>
196                 <td>[% loopresul.branchname | html %]</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 | html %]</span>
224                             [% LAST %]
225                             [% END %]
226                         [% END %]
227                     [% END %]
228                 </td>
229                 <td>[% loopresul.note | html %]</td>
230                 <td style="text-align:right;">[% loopresul.amount | $Price %]</td>
231                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber | uri %]">[% loopresul.title | html %]</a></td>
232                 <td>[% loopresul.barcode | html %]</td>
233                 <td>[% ItemTypes.GetDescription(loopresul.itype) | html %]</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
249             </main>
250         </div> <!-- /.col-sm-10.col-sm-push-2 -->
251
252         <div class="col-sm-2 col-sm-pull-10">
253             <aside>
254                 [% INCLUDE 'reports-menu.inc' %]
255             </aside>
256         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
257      </div> <!-- /.row -->
258
259 [% MACRO jsinclude BLOCK %]
260     [% INCLUDE 'datatables.inc' %]
261     <script id="js">
262         $(document).ready(function() {
263             $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
264                 "iDisplayLength": 50,
265                 "sPaginationType": "full_numbers"
266             }));
267         });
268     </script>
269     [% INCLUDE 'calendar.inc' %]
270     <script>
271         actTotal = "";
272
273         $(document).ready(function() {
274             // http://jqueryui.com/demos/datepicker/#date-range
275             var dates = $( "#filter_date_begin, #filter_date_end" ).datepicker({
276                 changeMonth: true,
277                 numberOfMonths: 1,
278                 onSelect: function( selectedDate ) {
279                     var option = this.id == "filter_date_begin" ? "minDate" : "maxDate",
280                         instance = $( this ).data( "datepicker" );
281                         date = $.datepicker.parseDate(
282                             instance.settings.dateFormat ||
283                             $.datepicker._defaults.dateFormat,
284                             selectedDate, instance.settings );
285                     dates.not( this ).datepicker( "option", option, date );
286                 }
287             });
288
289             $('#frmCashRegister').submit(function() {
290                 var isFormValid = true;
291                 var alertString= _("Form not submitted because of the following problem(s)")+"\n";
292
293                 alertString +="-------------------------------------------------------------------\n\n";
294
295                 if ( !$('#from').val() || !$('#to').val()){
296                     isFormValid = false;
297                     alertString += "\n- " + _("Dates cannot be empty");
298                 }
299
300                 if (!isFormValid) {
301                    alert(alertString);
302                    return false;
303                 }
304             });
305         });
306     </script>
307 [% END %]
308
309 [% INCLUDE 'intranet-bottom.inc' %]