|
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")); |
| 14 |
} else { |
| 15 |
summary_modal |
| 16 |
.find("#cashupSummaryLabel") |
| 17 |
.text(__("Cashup summary")); |
| 18 |
} |
| 19 |
|
| 7 |
summary_modal.find("#register_description").text(description); |
20 |
summary_modal.find("#register_description").text(description); |
| 8 |
$.ajax({ |
21 |
$.ajax({ |
| 9 |
url: "/api/v1/cashups/" + cashup, |
22 |
url: "/api/v1/cashups/" + cashup, |
|
Lines 17-22
$(document).ready(function () {
Link Here
|
| 17 |
let to_date = $datetime(data.summary.to_date); |
30 |
let to_date = $datetime(data.summary.to_date); |
| 18 |
summary_modal.find("#to_date").text(to_date); |
31 |
summary_modal.find("#to_date").text(to_date); |
| 19 |
|
32 |
|
|
|
33 |
// Add preview notice if this is an in-progress cashup |
| 34 |
if (inProgress) { |
| 35 |
var previewNotice = summary_modal.find(".preview-notice"); |
| 36 |
if (previewNotice.length === 0) { |
| 37 |
summary_modal |
| 38 |
.find(".modal-body > ul") |
| 39 |
.before( |
| 40 |
'<div class="alert alert-info preview-notice">' + |
| 41 |
'<i class="fa-solid fa-info-circle"></i> ' + |
| 42 |
"<strong>" + |
| 43 |
__("Preview:") + |
| 44 |
"</strong> " + |
| 45 |
__( |
| 46 |
"This summary shows the expected cashup amounts. A reconciliation record may be added when you complete the cashup." |
| 47 |
) + |
| 48 |
"</div>" |
| 49 |
); |
| 50 |
} |
| 51 |
} else { |
| 52 |
summary_modal.find(".preview-notice").remove(); |
| 53 |
} |
| 54 |
|
| 20 |
// Check for reconciliation (surplus or deficit) from dedicated fields |
55 |
// Check for reconciliation (surplus or deficit) from dedicated fields |
| 21 |
var surplus = data.summary.surplus_total; |
56 |
var surplus = data.summary.surplus_total; |
| 22 |
var deficit = data.summary.deficit_total; |
57 |
var deficit = data.summary.deficit_total; |
|
Lines 71-77
$(document).ready(function () {
Link Here
|
| 71 |
|
106 |
|
| 72 |
// 1. Total (sum of all transactions) |
107 |
// 1. Total (sum of all transactions) |
| 73 |
tfoot.append( |
108 |
tfoot.append( |
| 74 |
"<tr class='total-row'><td><strong>Total</strong></td><td><strong>" + |
109 |
"<tr class='total-row'><td><strong>" + |
|
|
110 |
__("Total") + |
| 111 |
"</strong></td><td><strong>" + |
| 75 |
data.summary.total.format_price() + |
112 |
data.summary.total.format_price() + |
| 76 |
"</strong></td></tr>" |
113 |
"</strong></td></tr>" |
| 77 |
); |
114 |
); |
|
Lines 94-100
$(document).ready(function () {
Link Here
|
| 94 |
} |
131 |
} |
| 95 |
if (cashCollected !== null) { |
132 |
if (cashCollected !== null) { |
| 96 |
tfoot.append( |
133 |
tfoot.append( |
| 97 |
"<tr><td><strong>Cash collected</strong></td><td><strong>" + |
134 |
"<tr><td><strong>" + |
|
|
135 |
__("Cash collected") + |
| 136 |
"</strong></td><td><strong>" + |
| 98 |
cashCollected.format_price() + |
137 |
cashCollected.format_price() + |
| 99 |
"</strong></td></tr>" |
138 |
"</strong></td></tr>" |
| 100 |
); |
139 |
); |
|
Lines 109-116
$(document).ready(function () {
Link Here
|
| 109 |
) { |
148 |
) { |
| 110 |
tfoot.append( |
149 |
tfoot.append( |
| 111 |
"<tr><td><strong>" + |
150 |
"<tr><td><strong>" + |
| 112 |
escape_str(type.payment_type) + |
151 |
__x("{payment_type} collected", { |
| 113 |
" collected" + |
152 |
payment_type: escape_str(type.payment_type), |
|
|
153 |
}) + |
| 114 |
"</strong></td><td><strong>" + |
154 |
"</strong></td><td><strong>" + |
| 115 |
type.total.format_price() + |
155 |
type.total.format_price() + |
| 116 |
"</strong></td></tr>" |
156 |
"</strong></td></tr>" |
|
Lines 133-146
$(document).ready(function () {
Link Here
|
| 133 |
if (surplus) { |
173 |
if (surplus) { |
| 134 |
reconciliationClass = |
174 |
reconciliationClass = |
| 135 |
"reconciliation-result text-warning"; |
175 |
"reconciliation-result text-warning"; |
| 136 |
reconciliationLabel = "Cashup surplus"; |
176 |
reconciliationLabel = __("Cashup surplus"); |
| 137 |
reconciliationAmount = |
177 |
reconciliationAmount = |
| 138 |
"+" + Math.abs(surplus).format_price(); |
178 |
"+" + Math.abs(surplus).format_price(); |
| 139 |
reconciliationNote = data.summary.surplus_note; |
179 |
reconciliationNote = data.summary.surplus_note; |
| 140 |
} else if (deficit) { |
180 |
} else if (deficit) { |
| 141 |
reconciliationClass = |
181 |
reconciliationClass = |
| 142 |
"reconciliation-result text-danger"; |
182 |
"reconciliation-result text-danger"; |
| 143 |
reconciliationLabel = "Cashup deficit"; |
183 |
reconciliationLabel = __("Cashup deficit"); |
| 144 |
reconciliationAmount = |
184 |
reconciliationAmount = |
| 145 |
"-" + Math.abs(deficit).format_price(); |
185 |
"-" + Math.abs(deficit).format_price(); |
| 146 |
reconciliationNote = data.summary.deficit_note; |
186 |
reconciliationNote = data.summary.deficit_note; |
| 147 |
- |
|
|