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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/cashup_summary.inc (+33 lines)
Line 0 Link Here
1
<!-- Cashup summary modal -->
2
<div class="modal printable" id="cashupSummaryModal" tabindex="-1" role="dialog" aria-labelledby="cashupSummaryLabel">
3
    <div class="modal-dialog" role="document">
4
        <div class="modal-content">
5
            <div class="modal-header">
6
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
7
                <h4 class="modal-title" id="cashupSummaryLabel">Cashup summary</h4>
8
            </div>
9
            <div class="modal-body">
10
                <ul>
11
                    <li>Cash register: <span id="register_description"></span></li>
12
                    <li>Period: <span id="from_date"></span> to <span id="to_date"></span></li>
13
                </ul>
14
                <table>
15
                    <thead>
16
                        <tr>
17
                            <th>Type</th>
18
                            <th>Total</th>
19
                        </tr>
20
                    </thead>
21
                    <tbody>
22
                    </tbody>
23
                    <tfoot>
24
                    </tfoot>
25
                </table>
26
            </div> <!-- /.modal-body -->
27
            <div class="modal-footer">
28
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
29
                <button type="button" class="printModal btn btn-primary"><i class="fa fa-print"></i> Print</button>
30
            </div> <!-- /.modal-footer -->
31
        </div> <!-- /.modal-content -->
32
    </div> <!-- /.modal-dialog -->
33
</div> <!-- /#cashupSummaryModal -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-61 / +4 lines)
Lines 59-66 Link Here
59
            <h2>Summary</h2>
59
            <h2>Summary</h2>
60
            <ul>
60
            <ul>
61
                [% IF register.last_cashup %]
61
                [% IF register.last_cashup %]
62
                <li>Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] (<a data-toggle="modal" href="#cashupSummaryModal" class="button">Summary</a>)</li>
62
                <li>Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] (<a data-toggle="modal" data-cashup="[% register.last_cashup.id | html %]" data-register="[% register.description | html %]" href="#cashupSummaryModal" class="button">Summary</a>)</li>
63
64
                [% END %]
63
                [% END %]
65
                <li>Float: [% register.starting_float | $Price %]</li>
64
                <li>Float: [% register.starting_float | $Price %]</li>
66
                <li>Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => 'CASH') * -1 | $Price %])</li>
65
                <li>Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => 'CASH') * -1 | $Price %])</li>
Lines 304-371 Link Here
304
        </form> <!-- /#refund_form -->
303
        </form> <!-- /#refund_form -->
305
    </div> <!-- /#issueRefundModal -->
304
    </div> <!-- /#issueRefundModal -->
306
305
307
    <!-- Cashup summary modal -->
306
    [% INCLUDE 'modals/cashup_summary.inc' %]
308
    [% IF register.last_cashup %]
309
    <div class="modal printable" id="cashupSummaryModal" tabindex="-1" role="dialog" aria-labelledby="cashupSummaryLabel">
310
        <div class="modal-dialog" role="document">
311
            <div class="modal-content">
312
                <div class="modal-header">
313
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
314
                    <h4 class="modal-title" id="cashupSummaryLabel">Cashup summary</h4>
315
                </div>
316
                <div class="modal-body">
317
                    <ul>
318
                        <li>Cash register: [% register.description | html %]</li>
319
                        <li>Period: [% register.last_cashup.cashup_summary.from_date | $KohaDates with_hours => 1 %] to [% register.last_cashup.cashup_summary.to_date | $KohaDates with_hours => 1 %]</li>
320
                    </ul>
321
                    <table>
322
                        <thead>
323
                            <tr>
324
                                <th>Type</th>
325
                                <th>Total</th>
326
                            </tr>
327
                        </thead>
328
                        <tbody>
329
                            [%- FOREACH out IN register.last_cashup.cashup_summary.outgoing -%]
330
                            <tr>
331
                                <td>[%- PROCESS account_type_description account=out -%]</td>
332
                                <td>[% out.total * -1 | $Price %]</td>
333
                            </tr>
334
                            [%- END -%]
335
                            [%- FOREACH in IN register.last_cashup.cashup_summary.income -%]
336
                            <tr>
337
                                <td>[%- PROCESS account_type_description account=in -%]</td>
338
                                <td>[% in.total * -1 | $Price %]</td>
339
                            </tr>
340
                            [%- END -%]
341
                        </tbody>
342
                        <tfoot>
343
                            <tr>
344
                                <td>Total</td>
345
                                <td>[% ( register.last_cashup.cashup_summary.outgoing_transactions.total + register.last_cashup.cashup_summary.income_transactions.total) * -1 | $Price %]</td>
346
                            </tr>
347
                            [% FOREACH pt IN payment_types %]
348
                            <tr>
349
                                <td>[% pt.lib | html %]</td>
350
                                <td>[% ( register.last_cashup.cashup_summary.outgoing_transactions.total( payment_type => pt.authorised_value ) + register.last_cashup.cashup_summary.income_transactions.total( payment_type => pt.authorised_value )) * -1 | $Price %]</td>
351
                            </tr>
352
                            [% END %]
353
354
                        </tfoot>
355
                    </table>
356
                </div> <!-- /.modal-body -->
357
                <div class="modal-footer">
358
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
359
                    <button type="button" class="printModal btn btn-primary"><i class="fa fa-print"></i> Print</button>
360
                </div> <!-- /.modal-footer -->
361
            </div> <!-- /.modal-content -->
362
        </div> <!-- /.modal-dialog -->
363
    </div> <!-- /#cashupSummaryModal -->
364
    [% END %]
365
307
366
[% MACRO jsinclude BLOCK %]
308
    [% MACRO jsinclude BLOCK %]
367
    [% INCLUDE 'datatables.inc' %]
309
    [% INCLUDE 'datatables.inc' %]
368
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
310
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
311
    [% Asset.js("js/cashup_modal.js") | $raw %]
369
    [% INCLUDE 'calendar.inc' %]
312
    [% INCLUDE 'calendar.inc' %]
370
    <script>
313
    <script>
371
        var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
314
        var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, {
(-)a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js (-1 / +52 lines)
Line 0 Link Here
0
- 
1
$('#cashupSummaryModal').on('show.bs.modal', function(e) {
2
    var button = $(e.relatedTarget);
3
    var cashup = button.data('cashup');
4
    var description = button.data('register');
5
    var summary_modal = $(this);
6
    summary_modal.find('#register_description').text(description);
7
    $.ajax({
8
        url: '/api/v1/cashups/' + cashup,
9
        headers: {
10
            'x-koha-embed': 'summary'
11
        },
12
        async: false,
13
        success: function(data) {
14
            summary_modal.find('#from_date').text(data.summary.from_date);
15
            summary_modal.find('#to_date').text(data.summary.to_date);
16
            var tbody = summary_modal.find('tbody')
17
            tbody.empty();
18
            for (out of data.summary.payout_grouped) {
19
                tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>');
20
            }
21
22
            for (income of data.summary.income_grouped) {
23
                tbody.append('<tr><td>' + income.debit_type.description + '</td><td>' + income.total + '</td></tr>');
24
            }
25
26
            var tfoot = summary_modal.find('tfoot');
27
            tfoot.empty();
28
            tfoot.append('<tr><td>Total</td><td>' + data.summary.total + '</td></tr>');
29
            for (type of data.summary.total_grouped) {
30
                if (type.total !== 0) {
31
                    tfoot.append('<tr><td>' + type.payment_type + '</td><td>' + type.total + '</td></tr>');
32
                }
33
            }
34
        }
35
    });
36
});
37
38
$('.modal.printable').on('shown.bs.modal', function() {
39
    $('.modal-dialog', this).addClass('focused');
40
    $('body').addClass('modalprinter');
41
42
    if ($(this).hasClass('autoprint')) {
43
        window.print();
44
    }
45
}).on('hidden.bs.modal', function() {
46
    $('.modal-dialog', this).removeClass('focused');
47
    $('body').removeClass('modalprinter');
48
});
49
50
$('.printModal').click(function() {
51
    window.print();
52
});

Return to bug 26274