Bugzilla – Attachment 98841 Details for
Bug 23355
Add a 'cashup' process to accounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23355: Add register details page
Bug-23355-Add-register-details-page.patch (text/plain), 13.47 KB, created by
Martin Renvoize (ashimema)
on 2020-02-13 14:37:44 UTC
(
hide
)
Description:
Bug 23355: Add register details page
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-02-13 14:37:44 UTC
Size:
13.47 KB
patch
obsolete
>From ff9109d087a4daf9b7610f8a25e5035e5e2e942a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 23 Jan 2020 13:40:33 +0000 >Subject: [PATCH] Bug 23355: Add register details page > >This patch adds a new page which can be accessed via the menu to the >left of the point of sale page. This new page displays a list of >transactions since the last 'cashup' action, a summary of transaction >amounts and a button to allow the recording of a new 'cashup action. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/includes/pos-menu.inc | 6 + > .../intranet-tmpl/prog/en/modules/pos/pay.tt | 1 - > .../prog/en/modules/pos/register.tt | 180 ++++++++++++++++++ > pos/register.pl | 84 ++++++++ > 4 files changed, 270 insertions(+), 1 deletion(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt > create mode 100755 pos/register.pl > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/pos-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/pos-menu.inc >index fc8e502f5c..85fd3b0634 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/pos-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/pos-menu.inc >@@ -1,5 +1,11 @@ > <div id="navmenu"> > <div id="navmenulist"> >+ [% IF ( CAN_user_cash_management_cashup_cash_registers ) %] >+ <h5>Point of sale</h5> >+ <ul> >+ <li><a href="/cgi-bin/koha/pos/register.pl">Register details</a></li> >+ </ul> >+ [% END %] > [% IF ( CAN_user_parameters_manage_cash_registers || CAN_user_parameters_manage_accounts) %] > <h5>Administration</h5> > <ul> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >index e0a68b1436..cb55711d91 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt >@@ -173,7 +173,6 @@ > [% END %] > > [% MACRO jsinclude BLOCK %] >- [% Asset.js("js/admin-menu.js") | $raw %] > [% INCLUDE 'format_price.inc' %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/jquery.jeditable.mini.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >new file mode 100644 >index 0000000000..8a4b09f4e0 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -0,0 +1,180 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE Price %] >+[% SET footerjs = 1 %] >+[% PROCESS 'accounts.inc' %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › 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> › <a href="/cgi-bin/koha/pos/pay.pl">Point of sale</a> › 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 %] >+ >+ <div id="toolbar" class="btn-toolbar"> >+ <a id="cashup" href="/cgi-bin/koha/pos/register.pl?op=cashup" class="btn btn-default"><i class="fa fa-money"></i> Record cashup</a> >+ </div> >+ >+ <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 %] >+ </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 %]&itemnumber=[% credit.debit.itemnumber | uri %]">[% credit.debit.item.biblio.title | html %]</a>)[%- END -%] >+ </td> >+ <td> >+ [% credit.debit.amount | $Price %] >+ </td> >+ <td></td> >+ <td></td> >+ </tr> >+ [% END %] >+ [% END %] >+ [% ELSE %] >+ [% FOREACH debit IN accountline.debit_offsets %] >+ [% IF debit.credit %] >+ <tr> >+ <td> >+ [% accountline.accountlines_id %] >+ </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 %]&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 %] >+ </div> >+ >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ [% INCLUDE 'pos-menu.inc' %] >+ </aside> >+ </div> >+ </div><!-- /.row --> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] >+ <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, >+ } >+ })); >+ >+ $(".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(); >+ }); >+ </script> >+[% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/pos/register.pl b/pos/register.pl >new file mode 100755 >index 0000000000..8ad143a5b7 >--- /dev/null >+++ b/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 ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23355
:
92941
|
92942
|
92943
|
92944
|
92945
|
92946
|
92947
|
92948
|
92949
|
92950
|
92951
|
92952
|
92953
|
97031
|
97032
|
97033
|
97034
|
97035
|
97036
|
97037
|
97038
|
97039
|
97040
|
97041
|
97043
|
97044
|
97045
|
97046
|
97047
|
97048
|
97049
|
97050
|
97051
|
97052
|
97053
|
97054
|
97077
|
97078
|
97079
|
97080
|
97081
|
97082
|
97083
|
97084
|
97085
|
97086
|
97087
|
97088
|
97089
|
97706
|
97707
|
97708
|
97709
|
97710
|
97711
|
97712
|
97713
|
97714
|
97715
|
97716
|
97784
|
97785
|
97786
|
97787
|
97788
|
97789
|
97790
|
97791
|
97792
|
97793
|
97794
|
97816
|
97817
|
97818
|
97819
|
97820
|
97821
|
97822
|
97823
|
98026
|
98027
|
98028
|
98835
|
98836
|
98837
|
98838
|
98839
|
98840
|
98841
|
98842
|
100009
|
100010
|
100011
|
100012
|
100013
|
100014
|
100015
|
100016
|
100017
|
100018
|
100019
|
100020
|
100021
|
100030
|
100090
|
101685