Bug 40445: (follow-up) Clarify cashup summary cash row wording and sign

A cashup is the process of removing cash from the till to send it
to the bank, so labelling the headline cash line "Cash added to
register" was confusing. Re-word it to "Cash removed from register"
in the typical case and "Cash added to register" in the edge case
where the cashier has had to top up the till to cover refunds.

While doing this, align the sign convention of total_grouped with
that of the overall total field on the summary: positive means cash
collected (i.e. removed from the register at cashup time), negative
means cash had to be added back into the register. Previously
total_grouped used the raw accounting sign (credits negative, debits
positive), so a typical $2 cash session would display "Total: 2.00"
and "Cash added to register: -2.00", which was internally
inconsistent. The conditions on the cash and other-payment-type rows
in cashup_modal.js are swapped to match the new convention.

Test plan:
1. Apply the patch and rebuild JS (yarn js:build) inside KTD.
2. As a staff user with permission to manage cash registers, take
   payments via several payment types (some cash, some not).
3. Trigger a cashup and view the cashup summary modal.
4. Confirm the "Total" line and the per-payment-type lines all
   display as positive amounts in the typical "money was collected"
   scenario, with the cash row labelled "Cash removed from
   register".
5. Issue some refunds large enough to exceed cash collected, then
   cash up again.
6. Confirm the cash row is labelled "Cash added to register" with a
   negative amount and the per-non-cash-type rows are labelled
   "{type} to add" where applicable.
7. Run prove t/db_dependent/Koha/Cash/Register/Cashup.t and prove
   t/db_dependent/Koha/Cash/Register.t inside KTD; both should
   pass.

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Jackie Usher <jackie.usher@westsussex.gov.uk>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-04-29 18:28:43 +01:00 committed by Pedro Amorim
parent 463b92df52
commit 86d034e628
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 12 additions and 8 deletions

View File

@ -184,7 +184,11 @@ sub summary {
my $typed_income = $income_transactions->total( { payment_type => $type->authorised_value } );
my $typed_payout = $payout_transactions->total( { payment_type => $type->authorised_value } );
my $typed_total = ( $typed_income + $typed_payout );
push @total_grouped, { payment_type => $type->lib, total => $typed_total };
# Flip sign to match the convention used for `total` above:
# positive = net amount collected (i.e. removed from register at cashup),
# negative = net amount paid out (i.e. needed to be added to register).
push @total_grouped, { payment_type => $type->lib, total => $typed_total * -1 };
}
# Check for reconciliation lines separately (for footer display only)

View File

@ -142,7 +142,7 @@ $(document).ready(function () {
"<tr class='reconciliation-separator'><td colspan='2'><hr></td></tr>"
);
// 2. Cash collected (amount recorded as removed from register)
// 2. Cash removed from register (positive = collected and removed at cashup)
var cashCollected = null;
for (type of data.summary.total_grouped) {
if (
@ -155,9 +155,9 @@ $(document).ready(function () {
}
if (cashCollected !== null) {
var cashLabel =
cashCollected < 0
? __("Cash added to register")
: __("Cash collected");
cashCollected >= 0
? __("Cash removed from register")
: __("Cash added to register");
tfoot.append(
"<tr><td><strong>" +
@ -176,13 +176,13 @@ $(document).ready(function () {
type.payment_type !== "CASH"
) {
var paymentTypeLabel =
type.total < 0
? __x("{payment_type} to add", {
type.total >= 0
? __x("{payment_type} collected", {
payment_type: escape_str(
type.payment_type
),
})
: __x("{payment_type} collected", {
: __x("{payment_type} to add", {
payment_type: escape_str(
type.payment_type
),