Koha/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt
Tomas Cohen Arazi 15655f0dbc
Bug 24082: (QA follow-up): Template fixes
This patch introduces missing TT filters and also replaces tabs for
spaces to fix indentation problems.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-03-04 16:14:47 +00:00

368 lines
21 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE Price %]
[% SET footerjs = 1 %]
[% PROCESS 'accounts.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Cashup</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %]
</head>
<body id="register" class="pos">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/pos/pay.pl">Point of sale</a> &rsaquo; Register details</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
[% IF ( error_registers ) %]
<div id="error_message" class="dialog alert">
You must have at least one cash register associated with this branch before you can record payments.
</div>
[% ELSE %]
[% IF ( CAN_user_cash_management_cashup ) %]
<div id="toolbar" class="btn-toolbar">
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" ><i class="fa fa-money"></i> Record cashup</button>
</div>
[% END %]
<h1>Register transaction details for [% register.name | html %]</h1>
<h2>Summary</h2>
<ul>
[% IF register.last_cashup %]
<li>Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]</li>
[% END %]
<li>Float: [% register.starting_float | $Price %]</li>
<li>Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => 'CASH') * -1 | $Price %])</li>
<li>Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => 'CASH') * -1 | $Price %])</li>
<li>Total bankable: [% accountlines.total( payment_type => 'CASH') * -1 | $Price %]</li>
</ul>
[% IF register.last_cashup %]
<h2>Transactions since [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]</h2>
[% ELSE %]
<h2>Transactions to date</h2>
[% END %]
<table id="sales" class="table_sales">
<thead>
<th>ID</th>
<th>DATA</th>
<th>Transaction</th>
<th>Description</th>
<th>Price</th>
<th>Total</th>
<th>Actions</th>
</thead>
<tbody>
[% FOREACH accountline IN accountlines %]
[% IF accountline.is_credit %]
[% FOREACH credit IN accountline.credit_offsets %]
[% IF credit.debit %]
<tr>
<td>[% accountline.accountlines_id | html %]</td>
<td>{ "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td>
<td></td>
<td>
[%- PROCESS account_type_description account=credit.debit -%]
[%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
[%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&amp;itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%]
</td>
<td>[% credit.debit.amount | $Price %]</td>
<td></td>
<td>
[% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED' ) %]
<button type="button" class="btn btn-default btn-xs" 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-money"></i> Issue refund</button>
[% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber %]
<button type="button" class="btn btn-default btn-xs" 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-money"></i> Issue refund</button>
[% END %]
</td>
</tr>
[% END %]
[% END %]
[% ELSE %]
[% FOREACH debit IN accountline.debit_offsets %]
[% IF debit.credit %]
<tr>
<td>[% accountline.accountlines_id | html %]</td>
<td>{ "type": "debit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td>
<td></td>
<td>[%- PROCESS account_type_description account=debit.credit -%]</td>
<td>
[%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%]
[%- IF ( debit.credit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&amp;itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>)[%- END -%]
</td>
<td>[% debit.credit.amount | $Price %]</td>
<td></td>
</tr>
[% END %]
[% END %]
[% END %]
[% END %]
</tbody>
<tfoot>
<tr>
<td colspan="5">Total income: </td>
<td>[% accountlines.total * -1 | $Price %]</td>
<td></td>
</tr>
</tfoot>
</table>
[% END %]
[% IF register.cashups %]
<h2>Older transactions</h2>
<form method="GET" action="/cgi-bin/koha/pos/register.pl">
<fieldset class="rows">
Please select a date range to display transactions for:
<ol>
<li>
<label for="trange_f">From: </label>
<input type="text" size="10" id="from" name="trange_f" value="[% trange_f | html %]"/>
<label class="inline" for="trange_t">To: </label>
<input size="10" id="to" name="trange_t" value="[% trange_t | $KohaDates with_hours => 0%]" type="text"/>
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</li>
</ol>
</fieldset>
<div class="action">
<input type="hidden" name="registerid" value="[% register.id | html %]">
<input type="submit" value="Display" />
</div>
</form>
[% IF trange_f %]
<table id="past_sales" class="past_sales_table">
<thead>
<th>ID</th>
<th>DATA</th>
<th>Transaction</th>
<th>Description</th>
<th>Price</th>
<th>Total</th>
<th>Actions</th>
</thead>
<tbody>
[% FOREACH accountline IN past_accountlines %]
[% IF accountline.is_credit %]
[% FOREACH credit IN accountline.credit_offsets %]
[% IF credit.debit %]
<tr>
<td>[% accountline.accountlines_id | html %]</td>
<td>{ "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td>
<td></td>
<td>
[%- PROCESS account_type_description account=credit.debit -%]
[%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%]
[%- IF ( credit.debit.itemnumber ) -%] (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% credit.debit.item.biblionumber | uri %]&amp;itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%]
</td>
<td>[% credit.debit.amount | $Price %]</td>
<td></td>
<td>
[% IF CAN_user_cash_management_refund_cash_registers && !(credit.debit.status == 'REFUNDED' ) %]
<button type="button" class="btn btn-default btn-xs" 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-money"></i> Issue refund</button>
[% END %]
</td>
</tr>
[% END %]
[% END %]
[% ELSE %]
[% FOREACH debit IN accountline.debit_offsets %]
[% IF debit.credit %]
<tr>
<td>[% accountline.accountlines_id | html %]</td>
<td>{ "type": "debit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" }</td>
<td></td>
<td>[%- PROCESS account_type_description account=debit.credit -%]</td>
<td>[%- IF debit.credit.description %][% debit.credit.description | html %][% END %]
&nbsp;[% IF ( debit.credit.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% debit.credit.item.biblionumber | uri %]&amp;itemnumber=[% debit.credit.itemnumber | uri %]">[% debit.credit.item.biblio.title | html %]</a>[% END %]</td>
<td>[% debit.credit.amount | $Price %]</td>
<td></td>
</tr>
[% END %]
[% END %]
[% END %]
[% END %]
</tbody>
<tfoot>
<tr>
<td colspan="5">Total income: </td>
<td>[% past_accountlines.total * -1 | $Price %]</td>
<td></td>
</tr>
</tfoot>
</table>
[% END %]
[% END %]
</div>
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'pos-menu.inc' %]
</aside>
</div>
</div><!-- /.row -->
<!-- Confirm cashup modal -->
<div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em>[% register.description | html %]</em></h4>
</div>
<div class="modal-body">
Please confirm that you have removed [% accountlines.total( payment_type => 'CASH') * -1 | $Price %] from the cash register and left a float of [% register.starting_float | $Price %].
</div> <!-- /.modal-body -->
<div class="modal-footer">
<a href="/cgi-bin/koha/pos/register.pl?op=cashup" class="btn btn-default">Confirm</a>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div> <!-- /.modal-footer -->
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /#confirmCashupModal -->
<!-- Issue refund modal -->
<div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
<form id="refund_form" method="post" enctype="multipart/form-data" class="validated">
<input type="hidden" name="accountline" value="" id="refundline">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="issueRefundLabel">Issue refund from <em>[% register.description | html %]</em></h4>
</div>
<div class="modal-body">
<fieldset class="rows">
<ol>
<li>
<span id="item" class="label">Item: </span><span></span>
</li>
<li>
<span id="paid" class="label">Amount paid: </span><span></span>
</li>
<li>
<label class="required" for="amount">Returned to patron: </label>
<input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
<span class="required">Required</span>
</li>
[% SET payment_types = [] %]
[% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
[% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %]
[% payment_types.push(pt) %]
[% END %]
<li>
<label for="transaction_type">Transaction type: </label>
<select name="transaction_type" id="transaction_type">
[% FOREACH pt IN payment_types %]
<option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
[% END %]
</select>
</li>
</ol>
</fieldset> <!-- /.rows -->
</div> <!-- /.modal-body -->
<div class="modal-footer">
<input type="hidden" name="registerid" value="[% register.id | html %]">
<input type="hidden" name="op" value="refund">
<button type="submit" class="btn btn-default">Confirm</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div> <!-- /.modal-footer -->
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</form> <!-- /#refund_form -->
</div> <!-- /#issueRefundModal -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
<script>
var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
orderFixed: [ 0, 'asc'],
columnDefs: [ {
targets: [ 0, 1 ],
visible: false
}],
rowGroup: {
dataSrc: 0,
startRender: function ( rows, group ) {
var details = JSON.parse(rows.data().pluck(1).pop());
return $('<tr class="'+details.type+'"/>')
.append( '<td>'+group+'</td>' )
.append( '<td colspan="2">'+details.description+'</td>' )
.append( '<td>'+details.amount+'</td>' )
.append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> ' + _("Print receipt") + '</button></td>');
},
endRender: null,
}
}));
var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, {
orderFixed: [ 0, 'asc'],
columnDefs: [ {
targets: [ 0, 1 ],
visible: false
}],
rowGroup: {
dataSrc: 0,
startRender: function ( rows, group ) {
var details = JSON.parse(rows.data().pluck(1).pop());
return $('<tr class="'+details.type+'"/>')
.append( '<td>'+group+'</td>' )
.append( '<td colspan="2">'+details.description+'</td>' )
.append( '<td>'+details.amount+'</td>' )
.append( '<td><button class="printReceipt btn btn-default btn-xs" data-accountline="'+group+'"><i class="fa fa-print"></i> Print receipt</button></td>');
},
endRender: null,
}
}));
$("#issueRefundModal").on("shown.bs.modal", function(e){
var button = $(e.relatedTarget);
var item = button.data('item');
$("#item + span").replaceWith(item);
var accountline = button.data('accountline');
$('#refundline').val(accountline);
var amount = button.data('amount');
$("#paid + span").replaceWith(amount);
$("#returned").attr({ "value": amount, "max": amount });
$("#returned, #transaction_type").focus();
});
$(".printReceipt").click(function() {
var accountlines_id = $(this).data('accountline');
var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank');
win.focus();
});
$(document).ready(function() {
// http://jqueryui.com/demos/datepicker/#date-range
var dates = $( "#from, #to" ).datepicker({
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" );
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]