Lines 1-52
Link Here
|
1 |
$('#cashupSummaryModal').on('show.bs.modal', function(e) { |
1 |
$(document).ready(function(){ |
2 |
var button = $(e.relatedTarget); |
2 |
$('#cashupSummaryModal').on('show.bs.modal', function(e) { |
3 |
var cashup = button.data('cashup'); |
3 |
var button = $(e.relatedTarget); |
4 |
var description = button.data('register'); |
4 |
var cashup = button.data('cashup'); |
5 |
var summary_modal = $(this); |
5 |
var description = button.data('register'); |
6 |
summary_modal.find('#register_description').text(description); |
6 |
var summary_modal = $(this); |
7 |
$.ajax({ |
7 |
summary_modal.find('#register_description').text(description); |
8 |
url: '/api/v1/cashups/' + cashup, |
8 |
$.ajax({ |
9 |
headers: { |
9 |
url: '/api/v1/cashups/' + cashup, |
10 |
'x-koha-embed': 'summary' |
10 |
headers: { |
11 |
}, |
11 |
'x-koha-embed': 'summary' |
12 |
async: false, |
12 |
}, |
13 |
success: function(data) { |
13 |
async: false, |
14 |
summary_modal.find('#from_date').text(data.summary.from_date); |
14 |
success: function(data) { |
15 |
summary_modal.find('#to_date').text(data.summary.to_date); |
15 |
summary_modal.find('#from_date').text(data.summary.from_date); |
16 |
var tbody = summary_modal.find('tbody') |
16 |
summary_modal.find('#to_date').text(data.summary.to_date); |
17 |
tbody.empty(); |
17 |
var tbody = summary_modal.find('tbody') |
18 |
for (out of data.summary.payout_grouped) { |
18 |
tbody.empty(); |
19 |
tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>'); |
19 |
for (out of data.summary.payout_grouped) { |
20 |
} |
20 |
tbody.append('<tr><td>' + out.credit_type.description + '</td><td>- ' + out.total + '</td></tr>'); |
|
|
21 |
} |
21 |
|
22 |
|
22 |
for (income of data.summary.income_grouped) { |
23 |
for (income of data.summary.income_grouped) { |
23 |
tbody.append('<tr><td>' + income.debit_type.description + '</td><td>' + income.total + '</td></tr>'); |
24 |
tbody.append('<tr><td>' + income.debit_type.description + '</td><td>' + income.total + '</td></tr>'); |
24 |
} |
25 |
} |
25 |
|
26 |
|
26 |
var tfoot = summary_modal.find('tfoot'); |
27 |
var tfoot = summary_modal.find('tfoot'); |
27 |
tfoot.empty(); |
28 |
tfoot.empty(); |
28 |
tfoot.append('<tr><td>Total</td><td>' + data.summary.total + '</td></tr>'); |
29 |
tfoot.append('<tr><td>Total</td><td>' + data.summary.total + '</td></tr>'); |
29 |
for (type of data.summary.total_grouped) { |
30 |
for (type of data.summary.total_grouped) { |
30 |
if (type.total !== 0) { |
31 |
if (type.total !== 0) { |
31 |
tfoot.append('<tr><td>' + type.payment_type + '</td><td>' + type.total + '</td></tr>'); |
32 |
tfoot.append('<tr><td>' + type.payment_type + '</td><td>' + type.total + '</td></tr>'); |
|
|
33 |
} |
32 |
} |
34 |
} |
33 |
} |
35 |
} |
34 |
} |
36 |
}); |
35 |
}); |
37 |
}); |
36 |
}); |
|
|
37 |
|
38 |
|
38 |
$('.modal.printable').on('shown.bs.modal', function() { |
39 |
$('.modal.printable').on('shown.bs.modal', function() { |
39 |
$('.modal-dialog', this).addClass('focused'); |
40 |
$('.modal-dialog', this).addClass('focused'); |
40 |
$('body').addClass('modalprinter'); |
41 |
$('body').addClass('modalprinter'); |
41 |
|
42 |
|
42 |
if ($(this).hasClass('autoprint')) { |
43 |
if ($(this).hasClass('autoprint')) { |
43 |
window.print(); |
44 |
window.print(); |
44 |
} |
45 |
} |
45 |
}).on('hidden.bs.modal', function() { |
46 |
}).on('hidden.bs.modal', function() { |
46 |
$('.modal-dialog', this).removeClass('focused'); |
47 |
$('.modal-dialog', this).removeClass('focused'); |
47 |
$('body').removeClass('modalprinter'); |
48 |
$('body').removeClass('modalprinter'); |
48 |
}); |
49 |
}); |
49 |
|
50 |
|
50 |
$('.printModal').click(function() { |
51 |
$('.printModal').click(function() { |
51 |
window.print(); |
52 |
window.print(); |
|
|
53 |
}); |
52 |
}); |
54 |
}); |
53 |
- |
|
|