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