Bug 23805: Update references to accounttype to credit_type_code
[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 [% PROCESS 'accounts.inc' %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Cash register statistics &rsaquo; Results[% ELSE %]&rsaquo; Cash register statistics[% END %]</title>
10 [% INCLUDE 'doc-head-close.inc' %]
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 == "PAY" %]
83                         <option value="PAY" selected="selected">Payment</option>
84                         [% ELSE %]
85                         <option value="PAY">Payment</option>
86                         [% END %]
87
88                         [% FOREACH debit_type IN debit_types %]
89                             [% IF transaction_type == debit_type.code %]
90                             <option value="[% debit_type.code | html %]" selected="selected">[% debit_type.description | html %]</option>
91                             [% ELSE %]
92                             <option value="[% debit_type.code | html %]">[% debit_type.description | html %]</option>
93                             [% END %]
94                         [% END %]
95                     </select>
96                 </li>
97                 <li>
98                     <label>Transaction library</label>
99                     <select name="branch" id="branch">
100                         <option value="ALL">All</option>
101                         [% FOREACH branchloo IN branchloop %]
102                             [% IF ( branchloo.selected ) %]
103                             <option value="[% branchloo.branchcode | html %]" selected="selected">[% branchloo.branchname | html %]</option>
104                             [% ELSE %]
105                             <option value="[% branchloo.branchcode | html %]">[% branchloo.branchname | html %]</option>
106                             [% END %]
107                         [% END %]
108                     </select>
109              </td>
110         </tr>
111                 </li>
112             </ol>
113         </fieldset>
114
115         <fieldset class="rows">
116             <legend>Output</legend>
117             <ol>
118                 <li>
119                     <label for="outputscreen">To screen into the browser: </label>
120                     <input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
121                 </li>
122                 <li>
123                     <label for="outputfile">To a file:</label>
124                     <input type="radio" name="output" value="file" id="outputfile" />
125                     <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
126
127                 </li>
128             </ol>
129         </fieldset>
130
131         <fieldset class="action">
132         <input type="submit" value="Submit" name="do_it" />
133         </fieldset>
134     </form>
135
136     [% IF ( do_it ) %]
137     <div>&nbsp;</div>
138     <table id="tbl_cash_register_stats">
139         <thead>
140         <tr>
141             <th>Manager name</th>
142             <th>Patron card number</th>
143             <th>Patron name</th>
144             <th>Transaction library</th>
145             <th>Transaction date</th>
146             <th>Transaction type</th>
147             <th>Notes</th>
148             <th>Amount</th>
149             <th>Bibliographic record title</th>
150             <th>Barcode</th>
151             <th>Item type</th>
152         </tr>
153         </thead>
154         [% FOREACH loopresul IN loopresult %]
155             <tr>
156                 <td>[% loopresul.mfirstname | html %] [% loopresul.msurname | html %]</td>
157                 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopresul.borrowernumber | uri %]">[% loopresul.cardnumber | html %]</a></td>
158                 <td>[% loopresul.bfirstname | html %] [% loopresul.bsurname | html %]</td>
159                 <td>[% loopresul.branchname | html %]</td>
160                 <td>[% loopresul.date | $KohaDates %]</td>
161                 <td>
162                     [% IF loopresul.credit_type == "ACT" %]
163                         <span>All payments to the library</span>
164                     [% ELSE %]
165                         [%- PROCESS account_type_description account=loopresul -%]
166                     [% END %]
167                 </td>
168                 <td>[% loopresul.note | html %]</td>
169                 <td style="text-align:right;">[% loopresul.amount | $Price %]</td>
170                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopresul.biblionumber | uri %]">[% loopresul.title | html %]</a></td>
171                 <td>[% loopresul.barcode | html %]</td>
172                 <td>[% ItemTypes.GetDescription(loopresul.itype) | html %]</td>
173             </tr>
174         [% END %]
175         <tfoot>
176         <tr>
177             [% IF transaction_type == "ACT" %]
178             <th colspan="7" style="text-align:right;">TOTAL</th>
179             <th style="text-align:right;">[% total  | $Price %]</th>
180             <th colspan="3">&nbsp;</th>
181             [% END %]
182         </tr>
183         </tfoot>
184     </table>
185
186     [% END %] [%# do_it %]
187
188             </main>
189         </div> <!-- /.col-sm-10.col-sm-push-2 -->
190
191         <div class="col-sm-2 col-sm-pull-10">
192             <aside>
193                 [% INCLUDE 'reports-menu.inc' %]
194             </aside>
195         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
196      </div> <!-- /.row -->
197
198 [% MACRO jsinclude BLOCK %]
199     [% INCLUDE 'datatables.inc' %]
200     <script id="js">
201         $(document).ready(function() {
202             $("#tbl_cash_register_stats").dataTable($.extend(true, {}, dataTablesDefaults, {
203                 "iDisplayLength": 50,
204                 "sPaginationType": "full_numbers"
205             }));
206         });
207     </script>
208     [% INCLUDE 'calendar.inc' %]
209     <script>
210         actTotal = "";
211
212         $(document).ready(function() {
213             // http://jqueryui.com/demos/datepicker/#date-range
214             var dates = $( "#filter_date_begin, #filter_date_end" ).datepicker({
215                 changeMonth: true,
216                 numberOfMonths: 1,
217                 onSelect: function( selectedDate ) {
218                     var option = this.id == "filter_date_begin" ? "minDate" : "maxDate",
219                         instance = $( this ).data( "datepicker" );
220                         date = $.datepicker.parseDate(
221                             instance.settings.dateFormat ||
222                             $.datepicker._defaults.dateFormat,
223                             selectedDate, instance.settings );
224                     dates.not( this ).datepicker( "option", option, date );
225                 }
226             });
227
228             $('#frmCashRegister').submit(function() {
229                 var isFormValid = true;
230                 var alertString= _("Form not submitted because of the following problem(s)")+"\n";
231
232                 alertString +="-------------------------------------------------------------------\n\n";
233
234                 if ( !$('#from').val() || !$('#to').val()){
235                     isFormValid = false;
236                     alertString += "\n- " + _("Dates cannot be empty");
237                 }
238
239                 if (!isFormValid) {
240                    alert(alertString);
241                    return false;
242                 }
243             });
244         });
245     </script>
246 [% END %]
247
248 [% INCLUDE 'intranet-bottom.inc' %]