+
+
+[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'datatables.inc' %]
+ [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
+
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' %]
--- a/pos/register.pl
+++ a/pos/register.pl
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+#
+# c 2020 PTFS-Europe Ltd
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+#
+
+use Modern::Perl;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Context;
+
+use Koha::Cash::Registers;
+use Koha::Database;
+
+my $input = CGI->new();
+
+my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user(
+ {
+ template_name => 'pos/register.tt',
+ query => $input,
+ type => 'intranet',
+ authnotrequired => 0,
+ flagsrequired => { cash_management => 'cashup' },
+ }
+);
+my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in";
+
+my $library_id = C4::Context->userenv->{'branch'};
+my $registerid = $input->param('registerid');
+my $registers = Koha::Cash::Registers->search(
+ { branch => $library_id, archived => 0 },
+ { order_by => { '-asc' => 'name' } }
+);
+
+if ( !$registers->count ) {
+ $template->param( error_registers => 1 );
+}
+else {
+ if ( !$registerid ) {
+ my $default_register = Koha::Cash::Registers->find(
+ { branch => $library_id, branch_default => 1 } );
+ $registerid = $default_register->id if $default_register;
+ }
+ $registerid = $registers->next->id if !$registerid;
+
+ $template->param(
+ registerid => $registerid,
+ registers => $registers,
+ );
+
+ my $cash_register = Koha::Cash::Registers->find( { id => $registerid } );
+ my $accountlines = $cash_register->outstanding_accountlines();
+ $template->param(
+ register => $cash_register,
+ accountlines => $accountlines
+ );
+
+ my $op = $input->param('op') // '';
+ if ( $op eq 'cashup' ) {
+ $cash_register->add_cashup(
+ {
+ staff_id => $logged_in_user->id,
+ amount => $cash_register->outstanding_accountlines->total
+ }
+ );
+ }
+}
+
+output_html_with_http_headers( $input, $cookie, $template->output );
--
+
+ [% IF ( error_registers ) %]
+
+
+
+ [% END %]
+
+
+
+ You must have at least one cash register associated with this branch before you can record payments.
+
+ [% ELSE %]
+
+
+
+ Register transaction details for [% register.name | html %]
+ +Summary
+-
+ [% IF register.last_cashup %]
+
- Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] + [% END %] +
- Float: [% register.starting_float | $Price %] +
- Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => 'CASH') * -1 | $Price %]) +
- Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => 'CASH') * -1 | $Price %]) +
- Total bankable: [% accountlines.total( payment_type => 'CASH') * -1 | $Price %] +
Transactions since [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %]
+ [% ELSE %] +Transactions to date
+ [% END %] ++ ID + | ++ DATA + | ++ Transaction + | ++ Description + | ++ Price + | ++ Total + | ++ Actions + | + + + [% FOREACH accountline IN accountlines %] + [% IF accountline.is_credit %] + [% FOREACH credit IN accountline.credit_offsets %] + [% IF credit.debit %] +
---|---|---|---|---|---|---|
+ [% accountline.accountlines_id %] + | ++ { "type": "credit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" } + | ++ | + [%- PROCESS account_type_description account=credit.debit -%] + [%- IF credit.debit.description -%] ([% credit.debit.description | html %])[%- END -%] + [%- IF ( credit.debit.itemnumber ) -%] ([% credit.debit.item.biblio.title | html %])[%- END -%] + | ++ [% credit.debit.amount | $Price %] + | ++ | + |
+ [% accountline.accountlines_id %] + | ++ { "type": "debit", "description": "[%- PROCESS account_type_description account=accountline -%] ([% accountline.payment_type | html %])", "amount": "[% accountline.amount * -1 | $Price %]" } + | ++ | + [%- PROCESS account_type_description account=debit.credit -%] + | ++ [%- IF debit.credit.description %][% debit.credit.description | html %][%- END -%] + [%- IF ( debit.credit.itemnumber ) -%] ([% debit.credit.item.biblio.title | html %])[%- END -%] + | ++ [% debit.credit.amount | $Price %] + | ++ |
Total income: | +[% accountlines.total * -1 | $Price %] | ++ |
+
+
+