Bugzilla – Attachment 100189 Details for
Bug 24492
Add a 'library cashup' workflow to the point of sale system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24492: Add branch details page
Bug-24492-Add-branch-details-page.patch (text/plain), 15.03 KB, created by
Martin Renvoize (ashimema)
on 2020-03-05 12:55:55 UTC
(
hide
)
Description:
Bug 24492: Add branch details page
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-03-05 12:55:55 UTC
Size:
15.03 KB
patch
obsolete
>From 34b3ef8fba76ab549c3747cd3bc14ec3300c1219 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 9 Jan 2020 13:53:09 +0000 >Subject: [PATCH] Bug 24492: Add branch details page > >This patch adds a new 'branch details' page to the POS system which >displays a summary of the cash register transactions for a branch >since each register was last cashed up. It also allows for cashing >up individual registers or cashing up all registers at a given branch >in one transaction. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/includes/pos-menu.inc | 1 + > .../prog/en/modules/pos/registers.tt | 184 ++++++++++++++++++ > .../prog/en/modules/tools/tools-home.tt | 8 + > pos/registers.pl | 69 +++++++ > 4 files changed, 262 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt > create mode 100755 pos/registers.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 7a0fbaabda..d4a1628a3b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/pos-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/pos-menu.inc >@@ -4,6 +4,7 @@ > <h5>Point of sale</h5> > <ul> > <li><a href="/cgi-bin/koha/pos/register.pl">Register details</a></li> >+ <li><a href="/cgi-bin/koha/pos/registers.pl">Branch details</a></li> > </ul> > [% END %] > [% IF ( CAN_user_parameters_manage_cash_registers || CAN_user_parameters_manage_accounts) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt >new file mode 100644 >index 0000000000..f742601d11 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt >@@ -0,0 +1,184 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE Price %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Cashup</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="cashup" class="pos"> >+ [% INCLUDE 'header.inc' %] >+ [% INCLUDE 'circ-search.inc' %] >+ >+ <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Point of sale</div> >+ >+ <div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 col-sm-push-2"> >+ <main> >+ [% 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"> >+ <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button> >+ </div> >+ >+ <h1>Branch transaction details for [% library.branchname | html %]</h1> >+ >+ <h2>Summary</h2> >+ <ul> >+ <li>Total income (cash): <span id="income"></span></li> >+ <li>Total outgoing (cash): <span id="outgoing"></span></li> >+ <li>Total bankable: <span id="bankable"></span></li> >+ </ul> >+ >+ <table id="registers" class="table_registers"> >+ <thead> >+ <th>Register name</th> >+ <th>Register description</th> >+ <th>Last cashup</th> >+ <th>Float</th> >+ <th>Bankable</th> >+ <th>Income (cash)</th> >+ <th>Outgoing (cash)</th> >+ <th>Actions</th> >+ </thead> >+ <tbody> >+ [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %] >+ [% FOREACH register IN registers %] >+ <tr> >+ <td><a href="/cgi-bin/koha/pos/register.pl?registerid=[% register.id | uri %]">[% register.name | html %]</a></td> >+ <td>[% register.description | html %]</td> >+ <td> >+ [%- IF register.last_cashup -%] >+ [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] ([% register.last_cashup.amount | $Price %]) >+ [%- ELSE -%] >+ No last cashup >+ [%- END -%] >+ </td> >+ <td>[% register.starting_float | $Price %]</td> >+ <td> >+ [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => 'CASH') * -1 ) %] >+ [% SET bankable = bankable + rbankable %] >+ [% rbankable | $Price %] >+ </td> >+ <td> >+ [% SET rctotal = ( register.outstanding_accountlines.credits_total * -1 ) %] >+ [% SET rcctotal = ( register.outstanding_accountlines.credits_total( payment_type => 'CASH') * -1 ) %] >+ [% rctotal | $Price %] ([% rcctotal | $Price %]) >+ [% SET ctotal = ctotal + rctotal %] >+ [% SET cctotal = cctotal + rcctotal %] >+ </td> >+ <td> >+ [% SET rdtotal = ( register.outstanding_accountlines.debits_total * -1 ) %] >+ [% SET rcdtotal = ( register.outstanding_accountlines.debits_total( payment_type => 'CASH') * -1 ) %] >+ [% rdtotal | $Price %] ([% rcdtotal | $Price %]) >+ [% SET dtotal = dtotal + rdtotal %] >+ [% SET cdtotal = cdtotal + rcdtotal %] >+ <td> >+ <button type="button" class="cashup_individual btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" data-register="[% register.description | html %]" data-bankable="[% rbankable | $Price %]" data-float="[% register.starting_float | $Price %]" data-registerid="[% register.id | html %]"><i class="fa fa-money"></i> Record cashup</button> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ <tfoot> >+ <tr> >+ <td colspan="4" align="right">Totals:</td> >+ <td>[% bankable | $Price %]</td> >+ <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td> >+ <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td> >+ <td><button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button></td> >+ </tr> >+ </tfoot> >+ </table> >+ [% END %] >+ </main> >+ </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">×</span></button> >+ <h4 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em><span id="registerc"></span></em></h4> >+ </div> >+ <div class="modal-body"> >+ Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>. >+ </div> <!-- /.modal-body --> >+ <div class="modal-footer"> >+ <a id="cashup_confirm" href="" 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 --> >+ >+ <!-- Confirm cashupall modal --> >+ <div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel"> >+ <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">×</span></button> >+ <h4 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h4> >+ </div> >+ <div class="modal-body"> >+ <p>Please confirm that you have recieved [% bankable | $Price %] to cashup.</p> >+ <ul> >+ <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li> >+ <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li> >+ </ul> >+ </div> <!-- /.modal-body --> >+ <div class="modal-footer"> >+ <a href="/cgi-bin/koha/pos/registers.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> <!-- /#confirmCashupAllModal --> >+ >+ [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script> >+ $(document).ready(function () { >+ >+ [%# js used here as we don't have access to these template variables where we need them #%] >+ $("#bankable").text('[% bankable | $Price %]'); >+ $("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])'); >+ $("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])'); >+ >+ var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "bFilter": false, >+ "paginationType": "full" >+ })); >+ >+ $("#confirmCashupModal").on("shown.bs.modal", function(e){ >+ var button = $(e.relatedTarget); >+ var register = button.data('register'); >+ $("#registerc").text(register); >+ var bankable = button.data('bankable'); >+ $("#cashc").text(bankable); >+ var rfloat = button.data('float'); >+ $('#floatc').text(rfloat); >+ var rid = button.data('registerid'); >+ $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/register.pl?op=cashup®isterid='+rid); >+ }); >+ }); >+ </script> >+ [% END %] >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 732563ce0a..9b2e257326 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -129,6 +129,14 @@ > <dd>Access files stored on the server, like log files or reports</dd> > [% END %] > >+ [% IF ( Koha.Preference('UseCashRegisters') && CAN_user_cash_management_manage_cash_registers ) %] >+ [% IF ( CAN_user_cash_management_manage_cash_registers ) %] >+ <dt><a href="/cgi-bin/koha/pos/registers.pl">Cashup registers</a></dt> >+ <dd>Perfrom cashup actions on cash registers</dd> >+ [% END %] >+ [% END %] >+ >+ > </dl> > </div> > >diff --git a/pos/registers.pl b/pos/registers.pl >new file mode 100755 >index 0000000000..a6b9dc2ccb >--- /dev/null >+++ b/pos/registers.pl >@@ -0,0 +1,69 @@ >+#!/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/registers.tt', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ } >+); >+my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in"; >+ >+my $library = Koha::Libraries->find( C4::Context->userenv->{'branch'} ); >+$template->param( library => $library ); >+ >+my $registers = Koha::Cash::Registers->search( >+ { branch => $library->id, archived => 0 }, >+ { order_by => { '-asc' => 'name' } } >+); >+ >+if ( !$registers->count ) { >+ $template->param( error_registers => 1 ); >+} >+else { >+ $template->param( registers => $registers ); >+} >+ >+my $op = $input->param('op') // ''; >+if ( $op eq 'cashup' ) { >+ for my $register ( $registers->as_list ) { >+ $register->add_cashup( >+ { >+ user_id => $logged_in_user->id, >+ amount => $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 24492
:
97824
|
98019
|
98020
|
100153
|
100154
| 100189 |
100190
|
100196
|
102433