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

(-)a/Koha/REST/V1/CashRegisters/Cashups.pm (+16 lines)
Lines 63-70 sub get { Link Here
63
    my $c = shift->openapi->valid_input or return;
63
    my $c = shift->openapi->valid_input or return;
64
64
65
    return try {
65
    return try {
66
67
        # Try to find as a completed cashup first
66
        my $cashup = Koha::Cash::Register::Cashups->find( $c->param('cashup_id') );
68
        my $cashup = Koha::Cash::Register::Cashups->find( $c->param('cashup_id') );
67
69
70
        # If not found, try as a CASHUP_START action (for preview)
71
        unless ($cashup) {
72
            require Koha::Cash::Register::Actions;
73
            my $action = Koha::Cash::Register::Actions->find( $c->param('cashup_id') );
74
75
            # Only allow CASHUP_START actions for preview
76
            if ( $action && $action->code eq 'CASHUP_START' ) {
77
78
                # Wrap as Cashup object for summary generation
79
                require Koha::Cash::Register::Cashup;
80
                $cashup = Koha::Cash::Register::Cashup->_new_from_dbic( $action->_result );
81
            }
82
        }
83
68
        return $c->render_resource_not_found("Cashup")
84
        return $c->render_resource_not_found("Cashup")
69
            unless $cashup;
85
            unless $cashup;
70
86
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-1 / +9 lines)
Lines 96-102 Link Here
96
        [% IF cashup_in_progress %]
96
        [% IF cashup_in_progress %]
97
            <div class="alert alert-warning">
97
            <div class="alert alert-warning">
98
                <i class="fa-solid fa-info-circle"></i>
98
                <i class="fa-solid fa-info-circle"></i>
99
                Cashup in progress - started [% cashup_in_progress.timestamp | $KohaDates with_hours => 1 %]. You can continue to make transactions while counting cash.
99
                Cashup in progress - started [% cashup_in_progress.timestamp | $KohaDates with_hours => 1 %]. You can continue to make transactions while counting cash. (<a
100
                    data-bs-toggle="modal"
101
                    data-cashup="[% cashup_in_progress.id | html %]"
102
                    data-register="[% register.description | html %]"
103
                    data-in-progress="true"
104
                    href="#cashupSummaryModal"
105
                    class="button"
106
                    >Preview expected summary</a
107
                >)
100
            </div>
108
            </div>
101
        [% END %]
109
        [% END %]
102
110
(-)a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js (-1 / +29 lines)
Lines 3-9 $(document).ready(function () { Link Here
3
        var button = $(e.relatedTarget);
3
        var button = $(e.relatedTarget);
4
        var cashup = button.data("cashup");
4
        var cashup = button.data("cashup");
5
        var description = button.data("register");
5
        var description = button.data("register");
6
        var inProgress = button.data("in-progress") || false;
6
        var summary_modal = $(this);
7
        var summary_modal = $(this);
8
9
        // Update title based on whether this is a preview
10
        if (inProgress) {
11
            summary_modal
12
                .find("#cashupSummaryLabel")
13
                .text("Cashup summary preview (in progress)");
14
        } else {
15
            summary_modal.find("#cashupSummaryLabel").text("Cashup summary");
16
        }
17
7
        summary_modal.find("#register_description").text(description);
18
        summary_modal.find("#register_description").text(description);
8
        $.ajax({
19
        $.ajax({
9
            url: "/api/v1/cashups/" + cashup,
20
            url: "/api/v1/cashups/" + cashup,
Lines 17-22 $(document).ready(function () { Link Here
17
                let to_date = $datetime(data.summary.to_date);
28
                let to_date = $datetime(data.summary.to_date);
18
                summary_modal.find("#to_date").text(to_date);
29
                summary_modal.find("#to_date").text(to_date);
19
30
31
                // Add preview notice if this is an in-progress cashup
32
                if (inProgress) {
33
                    var previewNotice = summary_modal.find(".preview-notice");
34
                    if (previewNotice.length === 0) {
35
                        summary_modal
36
                            .find(".modal-body > ul")
37
                            .after(
38
                                '<div class="alert alert-info preview-notice">' +
39
                                    '<i class="fa-solid fa-info-circle"></i> ' +
40
                                    "<strong>Preview:</strong> This summary shows the current expected cashup amounts. " +
41
                                    "New transactions will update these values until you complete the cashup." +
42
                                    "</div>"
43
                            );
44
                    }
45
                } else {
46
                    summary_modal.find(".preview-notice").remove();
47
                }
48
20
                // Check for reconciliation (surplus or deficit) from dedicated fields
49
                // Check for reconciliation (surplus or deficit) from dedicated fields
21
                var surplus = data.summary.surplus_total;
50
                var surplus = data.summary.surplus_total;
22
                var deficit = data.summary.deficit_total;
51
                var deficit = data.summary.deficit_total;
23
- 

Return to bug 40445