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

(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (-2 / +2 lines)
Lines 1865-1871 tables: Link Here
1865
            - "  </tr>"
1865
            - "  </tr>"
1866
            - "  <tr>"
1866
            - "  <tr>"
1867
            - "    <td>Tendered: </td>"
1867
            - "    <td>Tendered: </td>"
1868
            - "    <td>[% collected | $Price %]</td>"
1868
            - "    <td>[% tendered | $Price %]</td>"
1869
            - "  </tr>"
1869
            - "  </tr>"
1870
            - "  <tr>"
1870
            - "  <tr>"
1871
            - "    <td>Change: </td>"
1871
            - "    <td>Change: </td>"
Lines 1941-1947 tables: Link Here
1941
            - "    </tr>"
1941
            - "    </tr>"
1942
            - "    <tr>"
1942
            - "    <tr>"
1943
            - "      <td>Tendered: </td>"
1943
            - "      <td>Tendered: </td>"
1944
            - "      <td>[% collected | $Price %]</td>"
1944
            - "      <td>[% tendered | $Price %]</td>"
1945
            - "    </tr>"
1945
            - "    </tr>"
1946
            - "    <tr>"
1946
            - "    <tr>"
1947
            - "      <td>Change given:</td>"
1947
            - "      <td>Change given:</td>"
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-8 / +8 lines)
Lines 183-190 Link Here
183
                                        <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]" />
183
                                        <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]" />
184
                                    </li>
184
                                    </li>
185
                                    <li>
185
                                    <li>
186
                                        <label for="collected">Amount tendered: </label>
186
                                        <label for="tendered">Amount tendered: </label>
187
                                        <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]" />
187
                                        <input name="tendered" id="tendered" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]" />
188
                                    </li>
188
                                    </li>
189
                                    <li>
189
                                    <li>
190
                                        <label>Change to give: </label>
190
                                        <label>Change to give: </label>
Lines 364-371 Link Here
364
                                    </li>
364
                                    </li>
365
                                    [% IF type != 'WRITEOFF' %]
365
                                    [% IF type != 'WRITEOFF' %]
366
                                        <li>
366
                                        <li>
367
                                            <label for="collected">Amount tendered: </label>
367
                                            <label for="tendered">Amount tendered: </label>
368
                                            <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]" />
368
                                            <input name="tendered" id="tendered" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]" />
369
                                        </li>
369
                                        </li>
370
                                        <li>
370
                                        <li>
371
                                            <label>Change to give: </label>
371
                                            <label>Change to give: </label>
Lines 453-459 Link Here
453
            var change = $('#change')[0];
453
            var change = $('#change')[0];
454
454
455
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
455
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
456
            $("#paid, #collected").on("change",function() {
456
            $("#paid, #tendered").on("change",function() {
457
                moneyFormat( this );
457
                moneyFormat( this );
458
                if (change != undefined) {
458
                if (change != undefined) {
459
                    updateChangeValues();
459
                    updateChangeValues();
Lines 483-489 Link Here
483
            $( "#payindivfine, #payfine" ).validate({
483
            $( "#payindivfine, #payfine" ).validate({
484
                rules: {
484
                rules: {
485
                    paid: { required: true },
485
                    paid: { required: true },
486
                    collected: {
486
                    tendered: {
487
                        required: true
487
                        required: true
488
                    },
488
                    },
489
                    [% IF Koha.Preference('UseCashRegisters') %]
489
                    [% IF Koha.Preference('UseCashRegisters') %]
Lines 577-587 Link Here
577
577
578
        function updateChangeValues() {
578
        function updateChangeValues() {
579
            var change = $('#change')[0];
579
            var change = $('#change')[0];
580
            change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
580
            change.innerHTML = Math.round(($('#tendered')[0].value - $('#paid')[0].value) * 100) / 100;
581
            if (change.innerHTML <= 0) {
581
            if (change.innerHTML <= 0) {
582
                var paid = $('#paid')[0];
582
                var paid = $('#paid')[0];
583
                moneyFormat(paid);
583
                moneyFormat(paid);
584
                $('#collected').rules( "add", { min: Number(paid.value) });
584
                $('#tendered').rules( "add", { min: Number(paid.value) });
585
                $( "#payindivfine, #payfine" ).valid();
585
                $( "#payindivfine, #payfine" ).valid();
586
                change.innerHTML = "0.00";
586
                change.innerHTML = "0.00";
587
                $('input[name="change_given"]').val('0.00');
587
                $('input[name="change_given"]').val('0.00');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt (-9 / +9 lines)
Lines 51-57 Link Here
51
            <div class="alert alert-info audio-alert-action">
51
            <div class="alert alert-info audio-alert-action">
52
                <p>Payment received</p>
52
                <p>Payment received</p>
53
                <p>
53
                <p>
54
                    <a target="_blank" href="/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&collected=[% collected | uri %]&change=[% change | uri %]" class="btn btn-default"
54
                    <a target="_blank" href="/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&tendered=[% tendered | uri %]&change=[% change | uri %]" class="btn btn-default"
55
                        ><i class="fa fa-print"></i> Print receipt</a
55
                        ><i class="fa fa-print"></i> Print receipt</a
56
                    >
56
                    >
57
                    <a href="#" data-bs-toggle="modal" data-bs-target="#emailReceiptModal" class="btn btn-default"><i class="fa-solid fa-envelope"></i> Email receipt</a>
57
                    <a href="#" data-bs-toggle="modal" data-bs-target="#emailReceiptModal" class="btn btn-default"><i class="fa-solid fa-envelope"></i> Email receipt</a>
Lines 138-145 Link Here
138
                                <input type="text" inputmode="none" pattern="[0-9]*" name="paid" id="paid" value="" readonly />
138
                                <input type="text" inputmode="none" pattern="[0-9]*" name="paid" id="paid" value="" readonly />
139
                            </li>
139
                            </li>
140
                            <li>
140
                            <li>
141
                                <label for="collected" class="required">Amount tendered: </label>
141
                                <label for="tendered" class="required">Amount tendered: </label>
142
                                <input type="text" inputmode="numeric" pattern="[0-9]*" name="collected" id="collected" value="" class="required" required="required" />
142
                                <input type="text" inputmode="numeric" pattern="[0-9]*" name="tendered" id="tendered" value="" class="required" required="required" />
143
                                <span class="required">Required</span>
143
                                <span class="required">Required</span>
144
                            </li>
144
                            </li>
145
                            <li>
145
                            <li>
Lines 181-187 Link Here
181
    <form id="email_form" action="/cgi-bin/koha/pos/pay.pl" method="post" enctype="multipart/form-data" class="validated">
181
    <form id="email_form" action="/cgi-bin/koha/pos/pay.pl" method="post" enctype="multipart/form-data" class="validated">
182
        [% INCLUDE 'csrf-token.inc' %]
182
        [% INCLUDE 'csrf-token.inc' %]
183
        <input type="hidden" name="payment_id" value="[% payment_id | uri %]" />
183
        <input type="hidden" name="payment_id" value="[% payment_id | uri %]" />
184
        <input type="hidden" name="collected" value="[% collected | uri %]" />
184
        <input type="hidden" name="tendered" value="[% tendered | uri %]" />
185
        <input type="hidden" name="change" value="[% change | uri %]" />"
185
        <input type="hidden" name="change" value="[% change | uri %]" />"
186
        <div class="modal-dialog">
186
        <div class="modal-dialog">
187
            <div class="modal-content">
187
            <div class="modal-content">
Lines 316-326 Link Here
316
        function updateChangeValues() {
316
        function updateChangeValues() {
317
            var change = $('#change')[0];
317
            var change = $('#change')[0];
318
            var zero_formatted = "[% 0 | $Price %]";
318
            var zero_formatted = "[% 0 | $Price %]";
319
            change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
319
            change.innerHTML = Math.round(($('#tendered')[0].value - $('#paid')[0].value) * 100) / 100;
320
            if (change.innerHTML <= 0) {
320
            if (change.innerHTML <= 0) {
321
                var paid = $('#paid')[0];
321
                var paid = $('#paid')[0];
322
                moneyFormat(paid);
322
                moneyFormat(paid);
323
                $('#collected').rules( "add", { min: Number(paid.value) });
323
                $('#tendered').rules( "add", { min: Number(paid.value) });
324
                change.innerHTML = zero_formatted;
324
                change.innerHTML = zero_formatted;
325
                $(':input[name="change"]').val(zero_formatted);
325
                $(':input[name="change"]').val(zero_formatted);
326
            } else {
326
            } else {
Lines 456-462 Link Here
456
456
457
            // Change calculation and modal
457
            // Change calculation and modal
458
            var change = $('#change')[0];
458
            var change = $('#change')[0];
459
            $("#paid, #collected").on("change",function() {
459
            $("#paid, #tendered").on("change",function() {
460
                moneyFormat( this );
460
                moneyFormat( this );
461
                if (change != undefined) {
461
                if (change != undefined) {
462
                    updateChangeValues();
462
                    updateChangeValues();
Lines 474-480 Link Here
474
                    paid: {
474
                    paid: {
475
                        required: true
475
                        required: true
476
                    },
476
                    },
477
                    collected: {
477
                    tendered: {
478
                        required: true
478
                        required: true
479
                    },
479
                    },
480
                    payment_type: {
480
                    payment_type: {
Lines 518-524 Link Here
518
518
519
            [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
519
            [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
520
                $("#printReceipt").click(function() {
520
                $("#printReceipt").click(function() {
521
                    var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&collected=[% collected | uri %]&change=[% change | uri %]', '_blank');
521
                    var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&tendered=[% tendered | uri %]&change=[% change | uri %]', '_blank');
522
                    win.focus();
522
                    win.focus();
523
                });
523
                });
524
                $("#printReceipt").click();
524
                $("#printReceipt").click();
(-)a/members/paycollect.pl (-3 / +6 lines)
Lines 72-79 my $user = $input->remote_user; Link Here
72
my $library_id = C4::Context->userenv->{'branch'};
72
my $library_id = C4::Context->userenv->{'branch'};
73
my $total_due  = $account->outstanding_debits->total_outstanding;
73
my $total_due  = $account->outstanding_debits->total_outstanding;
74
74
75
my $total_paid      = $input->param('paid');
75
my $total_paid     = $input->param('paid');
76
my $total_collected = $input->param('collected');
76
my $total_tendered = $input->param('tendered');
77
77
78
my $selected_lines = $input->param('selected');                           # comes from pay.pl
78
my $selected_lines = $input->param('selected');                           # comes from pay.pl
79
my $pay_individual = $input->param('pay_individual');
79
my $pay_individual = $input->param('pay_individual');
Lines 151-157 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
151
            error_over => 1,
151
            error_over => 1,
152
            total_due  => $total_due
152
            total_due  => $total_due
153
        );
153
        );
154
    } elsif ( $total_collected < $total_paid && !( $op eq 'cud-writeoff_individual' || $type eq 'WRITEOFF' ) ) {
154
    } elsif ( defined $total_tendered
155
        && $total_tendered < $total_paid
156
        && !( $op eq 'cud-writeoff_individual' || $type eq 'WRITEOFF' ) )
157
    {
155
        $template->param(
158
        $template->param(
156
            error_under => 1,
159
            error_under => 1,
157
            total_paid  => $total_paid
160
            total_paid  => $total_paid
(-)a/pos/pay.pl (-5 / +5 lines)
Lines 80-86 if ( $op eq 'cud-pay' ) { Link Here
80
80
81
        $template->param(
81
        $template->param(
82
            payment_id => $payment->accountlines_id,
82
            payment_id => $payment->accountlines_id,
83
            collected  => scalar $input->param('collected'),
83
            tendered   => scalar $input->param('tendered'),
84
            change     => scalar $input->param('change')
84
            change     => scalar $input->param('change')
85
        );
85
        );
86
    }
86
    }
Lines 89-95 if ( $op eq 'cud-pay' ) { Link Here
89
if ( $op eq 'cud-send' ) {
89
if ( $op eq 'cud-send' ) {
90
    my $payment_id = $input->param('payment_id');
90
    my $payment_id = $input->param('payment_id');
91
    my $change     = $input->param('change');
91
    my $change     = $input->param('change');
92
    my $collected  = $input->param('collected');
92
    my $tendered   = $input->param('tendered');
93
    my $toaddr     = $input->param('toaddr');
93
    my $toaddr     = $input->param('toaddr');
94
94
95
    # Create our letter from the template
95
    # Create our letter from the template
Lines 102-109 if ( $op eq 'cud-send' ) { Link Here
102
            credits => $payment_id,
102
            credits => $payment_id,
103
        },
103
        },
104
        substitute => {
104
        substitute => {
105
            collected => $collected,
105
            tendered => $tendered,
106
            change    => $change
106
            change   => $change
107
        }
107
        }
108
    );
108
    );
109
109
Lines 123-129 if ( $op eq 'cud-send' ) { Link Here
123
    # Set variables for template to allow printing still
123
    # Set variables for template to allow printing still
124
    $template->param(
124
    $template->param(
125
        payment_id => $payment_id,
125
        payment_id => $payment_id,
126
        collected  => $collected,
126
        tendered   => $tendered,
127
        change     => $change
127
        change     => $change
128
    );
128
    );
129
}
129
}
(-)a/pos/printreceipt.pl (-3 / +2 lines)
Lines 62-69 my $letter = C4::Letters::GetPreparedLetter( Link Here
62
        borrowers => $patron ? $patron->borrowernumber : undef
62
        borrowers => $patron ? $patron->borrowernumber : undef
63
    },
63
    },
64
    substitute => {
64
    substitute => {
65
        collected => scalar $input->param('collected'),
65
        tendered => scalar $input->param('tendered'),
66
        change    => scalar $input->param('change')
66
        change   => scalar $input->param('change')
67
    }
67
    }
68
);
68
);
69
69
70
- 

Return to bug 40305