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