From 7f8e86afb8878e0a1d23f151a6fa8ebf4b6d41c7 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 10 Dec 2025 18:31:32 +0000 Subject: [PATCH] Bug 40445: (follow-up) Improve cashup summary display for negative amounts When refunds exceed collections during a cashup session, the summary modal now clearly explains the negative amounts. Adds an informational notice and adjusts labels to indicate cash needs to be added to the register rather than collected. Sponsored-by: OpenFifth --- .../intranet-tmpl/prog/js/cashup_modal.js | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js index 11d00e034ca..ba236ee67c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js @@ -104,10 +104,34 @@ $(document).ready(function () { var tfoot = summary_modal.find("tfoot"); tfoot.empty(); + // Determine if this is a negative cashup (float deficit scenario) + var isNegativeCashup = data.summary.total < 0; + + // Add informational notice for negative cashups + if (isNegativeCashup) { + var noticeText = __( + "This cashup shows a negative amount because refunds exceeded collections during this session. " + + "The register float was topped up to restore the expected balance." + ); + tbody.prepend( + "" + + " " + + "" + + __("Float deficit:") + + " " + + noticeText + + "" + ); + } + // 1. Total (sum of all transactions) + var totalLabel = isNegativeCashup + ? __("Total float deficit") + : __("Total"); + tfoot.append( "" + - __("Total") + + totalLabel + "" + data.summary.total.format_price() + "" @@ -130,9 +154,14 @@ $(document).ready(function () { } } if (cashCollected !== null) { + var cashLabel = + cashCollected < 0 + ? __("Cash added to register") + : __("Cash collected"); + tfoot.append( "" + - __("Cash collected") + + cashLabel + "" + cashCollected.format_price() + "" @@ -146,11 +175,22 @@ $(document).ready(function () { type.payment_type !== "Cash" && type.payment_type !== "CASH" ) { + var paymentTypeLabel = + type.total < 0 + ? __x("{payment_type} to add", { + payment_type: escape_str( + type.payment_type + ), + }) + : __x("{payment_type} collected", { + payment_type: escape_str( + type.payment_type + ), + }); + tfoot.append( "" + - __x("{payment_type} collected", { - payment_type: escape_str(type.payment_type), - }) + + paymentTypeLabel + "" + type.total.format_price() + "" -- 2.52.0