Bug 29271: (QA follow-up) Fetch and send descriptions to template
[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="flatpickr" data-date_to="to" />
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="flatpickr" />
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>[% loopresul.type_description | html %]</td>
182                 <td>[% loopresul.note | html %]</td>
183                 <td style="text-align:right;">[% loopresul.amount | $Price %]</td>
184                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber | uri %]">[% loopresul.title | html %]</a></td>
185                 <td>[% loopresul.barcode | html %]</td>
186                 <td>[% ItemTypes.GetDescription(loopresul.itype) | html %]</td>
187             </tr>
188         [% END %]
189         <tfoot>
190         <tr>
191             [% IF transaction_type == "ACT" %]
192             <th colspan="8" style="text-align:right;">TOTAL</th>
193             <th style="text-align:right;">[% total  | $Price %]</th>
194             <th colspan="3">&nbsp;</th>
195             [% END %]
196         </tr>
197         </tfoot>
198     </table>
199
200     [% END %] [%# do_it %]
201
202             </main>
203         </div> <!-- /.col-sm-10.col-sm-push-2 -->
204
205         <div class="col-sm-2 col-sm-pull-10">
206             <aside>
207                 [% INCLUDE 'reports-menu.inc' %]
208             </aside>
209         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
210      </div> <!-- /.row -->
211
212 [% MACRO jsinclude BLOCK %]
213     [% Asset.js("js/register_selection.js") | $raw %]
214     [% INCLUDE 'datatables.inc' %]
215     <script id="js">
216         $(document).ready(function() {
217             $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
218                 "iDisplayLength": 50,
219                 "sPaginationType": "full_numbers"
220             }));
221         });
222     </script>
223     [% INCLUDE 'calendar.inc' %]
224     <script>
225         actTotal = "";
226
227         $(document).ready(function() {
228
229             $('#frmCashRegister').submit(function() {
230                 var isFormValid = true;
231                 var alertString= _("Form not submitted because of the following problem(s)")+"\n";
232
233                 alertString +="-------------------------------------------------------------------\n\n";
234
235                 if ( !$('#from').val() || !$('#to').val()){
236                     isFormValid = false;
237                     alertString += "\n- " + _("Dates cannot be empty");
238                 }
239
240                 if (!isFormValid) {
241                    alert(alertString);
242                    return false;
243                 }
244             });
245         });
246     </script>
247 [% END %]
248
249 [% INCLUDE 'intranet-bottom.inc' %]