View | Details | Raw Unified | Return to bug 40445
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/cashup_modals.js (-1 / +5 lines)
Lines 243-249 function initConfirmCashupModal(modalSelector, options) { Link Here
243
            modal.find(".register-id-field").val(rid);
243
            modal.find(".register-id-field").val(rid);
244
244
245
            // Parse expected amount to check if negative
245
            // Parse expected amount to check if negative
246
            var expectedAmount = expected.replace(/[^0-9.-]/g, "");
246
            // Convert to string first in case jQuery's .data() parsed it as a number
247
            var expectedAmount = String(expected || "").replace(
248
                /[^0-9.-]/g,
249
                ""
250
            );
247
            var isNegative = parseFloat(expectedAmount) < 0;
251
            var isNegative = parseFloat(expectedAmount) < 0;
248
252
249
            // Update labels based on sign
253
            // Update labels based on sign
(-)a/pos/registers.pl (-11 / +23 lines)
Lines 166-184 if ( $op eq 'cud-cashup_start' ) { Link Here
166
            next unless $register;
166
            next unless $register;
167
167
168
            eval {
168
            eval {
169
                # Quick cashup: calculate expected amount from outstanding accountlines
169
                # Get the amount from the request parameter
170
                my $expected_amount =
170
                # For quick cashup, this will be the expected amount set by JavaScript
171
                    $register->outstanding_accountlines->total( { payment_type => [ 'CASH', 'SIP00' ] } ) * -1;
171
                # For two-stage cashup completion, this will be the user-entered actual amount
172
                my $amount = $input->param('amount');
173
174
                # If no amount provided, calculate expected amount (backwards compatibility)
175
                unless ( defined $amount && $amount ne '' ) {
176
                    $amount =
177
                        $register->outstanding_accountlines->total( { payment_type => [ 'CASH', 'SIP00' ] } ) * -1;
178
                }
172
179
173
                # Quick cashup assumes actual amount equals expected (no reconciliation needed)
180
                # Get optional reconciliation note
174
                $register->add_cashup(
181
                my $reconciliation_note = $input->param('reconciliation_note');
175
                    {
176
                        manager_id => $logged_in_user->id,
177
                        amount     => $expected_amount,
178
182
179
                        # No reconciliation_note = quick cashup assumes correct amounts
183
                # Complete the cashup
180
                    }
184
                my %cashup_params = (
185
                    manager_id => $logged_in_user->id,
186
                    amount     => $amount,
181
                );
187
                );
188
189
                # Add reconciliation note if provided
190
                if ( defined $reconciliation_note && $reconciliation_note ne '' ) {
191
                    $cashup_params{reconciliation_note} = $reconciliation_note;
192
                }
193
194
                $register->add_cashup( \%cashup_params );
182
                $success_count++;
195
                $success_count++;
183
            };
196
            };
184
            if ($@) {
197
            if ($@) {
185
- 

Return to bug 40445