|
Lines 123-128
Link Here
|
| 123 |
</tfoot> |
123 |
</tfoot> |
| 124 |
</table> |
124 |
</table> |
| 125 |
[% END %] |
125 |
[% END %] |
|
|
126 |
|
| 127 |
[% IF trange_f %] |
| 128 |
<h2>Older transactions</h2> |
| 129 |
<table id="past_sales" class="past_sales_table"> |
| 130 |
<thead> |
| 131 |
<th> |
| 132 |
Receipt ID |
| 133 |
</th> |
| 134 |
<th> |
| 135 |
Transaction |
| 136 |
</th> |
| 137 |
<th> |
| 138 |
Account type |
| 139 |
</th> |
| 140 |
<th> |
| 141 |
Description of charges |
| 142 |
</th> |
| 143 |
<th> |
| 144 |
Item |
| 145 |
</th> |
| 146 |
<th> |
| 147 |
Transaction |
| 148 |
</th> |
| 149 |
<th> |
| 150 |
Actions |
| 151 |
</th> |
| 152 |
</thead> |
| 153 |
<tbody> |
| 154 |
[% FOREACH accountline IN past_accountlines %] |
| 155 |
[% IF accountline.is_credit %] |
| 156 |
[% FOREACH credit IN accountline.credit_offsets %] |
| 157 |
[% IF credit.debit %] |
| 158 |
<tr> |
| 159 |
<td>[% accountline.accountlines_id %]</td> |
| 160 |
<td>{ "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td> |
| 161 |
<td>[%- PROCESS account_type_description account=credit.debit -%]</td> |
| 162 |
<td>[%- IF credit.debit.description %][% credit.debit.description | html %][% END %] |
| 163 |
[% IF ( credit.debit.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>[%- END -%]</td> |
| 164 |
<td>[% credit.debit.amount | $Price %]</td> |
| 165 |
<td></td> |
| 166 |
<td> |
| 167 |
[% IF ( CAN_user_cash_management_refund_cash_registers ) %] |
| 168 |
<button type="button" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-quantity="[% credit.debit.note | html %]"><i class="fa fa-plus"></i> Issue refund</button> |
| 169 |
[% END %] |
| 170 |
</td> |
| 171 |
</tr> |
| 172 |
[% END %] |
| 173 |
[% END %] |
| 174 |
[% ELSE %] |
| 175 |
[% FOREACH debit IN accountline.debit_offsets %] |
| 176 |
[% IF debit.credit %] |
| 177 |
<tr> |
| 178 |
<td>[% accountline.accountlines_id %]</td> |
| 179 |
<td>{ "type": "debit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td> |
| 180 |
<td>[%- PROCESS account_type_description account=debit.credit -%]</td> |
| 181 |
<td>[%- IF debit.credit.description %][% debit.credit.description | html %][% END %] |
| 182 |
[% IF ( debit.credit.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>[% END %]</td> |
| 183 |
<td>[% debit.credit.amount | $Price %]</td> |
| 184 |
<td></td> |
| 185 |
<td></td> |
| 186 |
</tr> |
| 187 |
[% END %] |
| 188 |
[% END %] |
| 189 |
[% END %] |
| 190 |
[% END %] |
| 191 |
</tbody> |
| 192 |
<tfoot> |
| 193 |
<tr> |
| 194 |
<td colspan="5">Total income: </td> |
| 195 |
<td>[% past_accountlines.total * -1 | $Price %]</td> |
| 196 |
<td></td> |
| 197 |
</tr> |
| 198 |
</tfoot> |
| 199 |
</table> |
| 200 |
|
| 201 |
<table> |
| 202 |
<thead> |
| 203 |
<th>Cashup date</th> |
| 204 |
<th>Banked</th> |
| 205 |
<th>Actions</th> |
| 206 |
</thead> |
| 207 |
<tbody> |
| 208 |
[% FOREACH cashup IN register.cashups %] |
| 209 |
<tr> |
| 210 |
<td>[% cashup.timestamp | $KohaDates with_hours => 1 %]</td> |
| 211 |
<td>[% cashup.amount | $Price %]</td> |
| 212 |
<td>View transactions</td> |
| 213 |
</tr> |
| 214 |
[% END %] |
| 215 |
</tbody> |
| 216 |
</table> |
| 217 |
[% ELSE %] |
| 218 |
[% IF register.cashups %] |
| 219 |
<h2>Older transactions</h2> |
| 220 |
<form method="GET" action="/cgi-bin/koha/pos/register.pl"> |
| 221 |
<fieldset class="rows"> |
| 222 |
Please select a date range to display transactions for: |
| 223 |
<ol> |
| 224 |
<li> |
| 225 |
<label for="trange_f">From: </label> |
| 226 |
<input type="text" size="10" id="from" name="trange_f" /> |
| 227 |
<label class="inline" for="trange_t">To: </label> |
| 228 |
<input size="10" id="to" name="trange_t" value="[% trange_t | html %]" type="text" /> |
| 229 |
<span class="hint">[% INCLUDE 'date-format.inc' %]</span> |
| 230 |
</li> |
| 231 |
</ol> |
| 232 |
</fieldset> |
| 233 |
<input type="submit" value="Display" /> |
| 234 |
</form> |
| 235 |
[% END %] |
| 236 |
[% END %] |
| 126 |
</div> |
237 |
</div> |
| 127 |
|
238 |
|
| 128 |
<div class="col-sm-2 col-sm-pull-10"> |
239 |
<div class="col-sm-2 col-sm-pull-10"> |
|
Lines 186-191
Link Here
|
| 186 |
[% MACRO jsinclude BLOCK %] |
297 |
[% MACRO jsinclude BLOCK %] |
| 187 |
[% INCLUDE 'datatables.inc' %] |
298 |
[% INCLUDE 'datatables.inc' %] |
| 188 |
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] |
299 |
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] |
|
|
300 |
[% INCLUDE 'calendar.inc' %] |
| 189 |
<script> |
301 |
<script> |
| 190 |
var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, { |
302 |
var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 191 |
orderFixed: [ 0, 'asc'], |
303 |
orderFixed: [ 0, 'asc'], |
|
Lines 206-211
Link Here
|
| 206 |
} |
318 |
} |
| 207 |
})); |
319 |
})); |
| 208 |
|
320 |
|
|
|
321 |
var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 322 |
orderFixed: [ 0, 'asc'], |
| 323 |
columnDefs: [ { |
| 324 |
targets: [ 0, 1 ], |
| 325 |
visible: false |
| 326 |
}], |
| 327 |
rowGroup: { |
| 328 |
dataSrc: 0, |
| 329 |
startRender: function ( rows, group ) { |
| 330 |
var details = JSON.parse(rows.data().pluck(1).pop()); |
| 331 |
return $('<tr class="'+details.type+'"/>') |
| 332 |
.append( '<td colspan="3">'+group+' '+details.description+'</td>' ) |
| 333 |
.append( '<td>'+details.amount+'</td>' ) |
| 334 |
.append( '<td><button class="printReceipt" data-accountline="'+group+'"><i class="fa fa-print"></i> Print receipt</button></td>'); |
| 335 |
}, |
| 336 |
endRender: null, |
| 337 |
} |
| 338 |
})); |
| 339 |
|
| 209 |
$("#issueRefundModal").on("shown.bs.modal", function(e){ |
340 |
$("#issueRefundModal").on("shown.bs.modal", function(e){ |
| 210 |
var button = $(e.relatedTarget); |
341 |
var button = $(e.relatedTarget); |
| 211 |
var item = button.data('item'); |
342 |
var item = button.data('item'); |
|
Lines 224-229
Link Here
|
| 224 |
var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank'); |
355 |
var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank'); |
| 225 |
win.focus(); |
356 |
win.focus(); |
| 226 |
}); |
357 |
}); |
|
|
358 |
|
| 359 |
$(document).ready(function() { |
| 360 |
// http://jqueryui.com/demos/datepicker/#date-range |
| 361 |
var dates = $( "#from, #to" ).datepicker({ |
| 362 |
changeMonth: true, |
| 363 |
numberOfMonths: 1, |
| 364 |
onSelect: function( selectedDate ) { |
| 365 |
var option = this.id == "from" ? "minDate" : "maxDate", |
| 366 |
instance = $( this ).data( "datepicker" ); |
| 367 |
date = $.datepicker.parseDate( |
| 368 |
instance.settings.dateFormat || |
| 369 |
$.datepicker._defaults.dateFormat, |
| 370 |
selectedDate, instance.settings ); |
| 371 |
dates.not( this ).datepicker( "option", option, date ); |
| 372 |
} |
| 373 |
}); |
| 374 |
}); |
| 227 |
</script> |
375 |
</script> |
| 228 |
[% END %] |
376 |
[% END %] |
| 229 |
|
377 |
|