Bugzilla – Attachment 136491 Details for
Bug 27779
Cashup summary 'refunds' should denote what the refund was actioned against
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27779: Group payouts by type of debit they're applied against
Bug-27779-Group-payouts-by-type-of-debit-theyre-ap.patch (text/plain), 5.34 KB, created by
Martin Renvoize (ashimema)
on 2022-06-24 13:32:21 UTC
(
hide
)
Description:
Bug 27779: Group payouts by type of debit they're applied against
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-06-24 13:32:21 UTC
Size:
5.34 KB
patch
obsolete
>From db3a1d46076d23d7ebd148b922b46d02d4d8044d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 20 May 2021 08:38:11 +0100 >Subject: [PATCH] Bug 27779: Group payouts by type of debit they're applied > against > >This patch adds additional grouping to the cashup summary output such >that payouts are additionally grouped by the types of debit they're >applied against. The cashup sumary modal is adapted to expose the >descriptions at the grouping level too. > >Test plan >1/ Add a various transactions using a cash register (Using Point of >Sale, Patron Accounts with payments etc). >2/ Refund some of the debts and pick the 'cash' option for payout. >(ensure you pick a variety of debit types) >3/ Add some credit to a patron account, (either refund a debt as >'credit' or add a 'manual credit') >4/ Payout the credit as 'cash' on the patron account >5/ Cashup the register >6/ Inspect the cashup summary for your cashup. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Cash/Register/Cashup.pm | 45 +++++++++++++++---- > .../intranet-tmpl/prog/js/cashup_modal.js | 6 ++- > 2 files changed, 41 insertions(+), 10 deletions(-) > >diff --git a/Koha/Cash/Register/Cashup.pm b/Koha/Cash/Register/Cashup.pm >index 480bbf0e48..18d6d0c536 100644 >--- a/Koha/Cash/Register/Cashup.pm >+++ b/Koha/Cash/Register/Cashup.pm >@@ -108,7 +108,7 @@ sub summary { > { sum => 'me.amount' }, 'debit.debit_type_code', > 'debit_type_code.description' > ], >- 'as' => [ 'total', 'debit_type_code', 'debit_description' ], >+ 'as' => [ 'total', 'debit_type_code', 'debit_description' ], > order_by => { '-asc' => 'debit_type_code.description' }, > } > ); >@@ -119,18 +119,40 @@ sub summary { > '-in' => $payout_transactions->_resultset->get_column( > 'accountlines_id')->as_query > }, >- 'me.credit_id' => { '!=' => undef } >+ 'me.credit_id' => { '!=' => undef }, >+ 'account_offsets_credits.debit_id' => { >+ '-not_in' => $payout_transactions->_resultset->get_column( >+ 'accountlines_id')->as_query >+ } > }, > { >- join => { 'credit' => 'credit_type_code' }, >- group_by => >- [ 'credit.credit_type_code', 'credit_type_code.description' ], >+ join => { >+ 'credit' => [ >+ 'credit_type_code', >+ { >+ 'account_offsets_credits' => >+ { 'debit' => 'debit_type_code' } >+ } >+ ] >+ }, >+ group_by => [ >+ 'credit.credit_type_code', 'credit_type_code.description', >+ 'debit.debit_type_code', 'debit_type_code.description' >+ ], > 'select' => [ > { sum => 'me.amount' }, 'credit.credit_type_code', >- 'credit_type_code.description' >+ 'credit_type_code.description', 'debit.debit_type_code', >+ 'debit_type_code.description' >+ ], >+ 'as' => [ >+ 'total', 'credit_type_code', >+ 'credit_description', 'debit_type_code', >+ 'debit_description' > ], >- 'as' => [ 'total', 'credit_type_code', 'credit_description' ], >- order_by => { '-asc' => 'credit_type_code.description' }, >+ order_by => { >+ '-asc' => >+ [ 'credit_type_code.description', 'debit_type_code.description' ] >+ }, > } > ); > >@@ -146,7 +168,12 @@ sub summary { > total => $_->get_column('total') * -1, > credit_type_code => $_->get_column('credit_type_code'), > credit_type => >- { description => $_->get_column('credit_description') } >+ { description => $_->get_column('credit_description') }, >+ related_debit => { >+ debit_type_code => $_->get_column('debit_type_code'), >+ debit_type => >+ { description => $_->get_column('debit_description') } >+ } > } > } $payout_summary->as_list; > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >index 01e8849e23..5e1aed3706 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js >@@ -16,7 +16,11 @@ $('#cashupSummaryModal').on('show.bs.modal', function(e) { > var tbody = summary_modal.find('tbody') > tbody.empty(); > for (out of data.summary.payout_grouped) { >- tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>'); >+ if ( out.credit_type_code == 'REFUND' ) { >+ tbody.append('<tr><td>' + out.credit_type.description + ' against ' + out.related_debit.debit_type.description + '</td><td>- ' + out.total + '</td></tr>'); >+ } else { >+ tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>'); >+ } > } > > for (income of data.summary.income_grouped) { >-- >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 27779
:
121218
|
121219
|
121224
|
121225
|
127552
|
127553
|
127554
|
130024
|
136491
|
136492
|
136493
|
136494
|
136495
|
137386
|
137387
|
137388
|
137389
|
137390
|
138809
|
138810
|
138811
|
138812
|
138813
|
138849
|
138883
|
138884