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