Open cash drawer when needed, close #20
This commit is contained in:
parent
ce10e4af95
commit
3569446f54
@ -136,4 +136,5 @@ define("STRINGS", [
|
||||
"card saved" => "Gift card updated.",
|
||||
"card x added" => "Gift card #{arg} added.",
|
||||
"card x saved" => "Gift card #{arg} updated.",
|
||||
"open drawer" => "Open Drawer",
|
||||
]);
|
||||
|
@ -112,7 +112,10 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$registeropen) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<button type="button" class="btn btn-primary" id="xprintbtn"><i class="fas fa-print"></i> <?php lang("print"); ?></button>
|
||||
<div class="d-flex justify-content-between flex-wrap">
|
||||
<button type="button" class="btn btn-default" id="opendrawerbtn"><i class="fas fa-lock-open"></i> <?php lang("open drawer"); ?></button>
|
||||
<button type="button" class="btn btn-primary ml-auto" id="xprintbtn"><i class="fas fa-print"></i> <?php lang("print"); ?></button>
|
||||
</div>
|
||||
<iframe class="w-100 shadow-lg" id="xframe" src="action.php?action=xreport&format=html®ister=<?php echo $register['id']; ?>"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -124,6 +124,29 @@ function showReceipt(txid) {
|
||||
|
||||
function finishTransaction() {
|
||||
sendTransactionToServer(function (data) {
|
||||
if (nickelbridge) {
|
||||
var opendrawer = false;
|
||||
if ($("#change-amount").text() * 1.0 != 0) {
|
||||
opendrawer = true;
|
||||
}
|
||||
$("#payment-lines .list-group-item").each(function () {
|
||||
var type = $(".payment-entry", this).data("type");
|
||||
if (type == 'cash' || type == 'check') {
|
||||
opendrawer = true;
|
||||
}
|
||||
});
|
||||
if (opendrawer) {
|
||||
$.ajax("http://127.0.0.1:64269/opendrawer", {
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
success: function (resp) {
|
||||
|
||||
}
|
||||
}).fail(function (resp) {
|
||||
alert("Error: " + JSON.stringify(resp));
|
||||
});
|
||||
}
|
||||
}
|
||||
showReceipt(data.txid);
|
||||
});
|
||||
}
|
||||
@ -138,6 +161,26 @@ $("#finishbtn").click(function () {
|
||||
bsalert("Incomplete Transaction", "The customer would need to pay you $" + ($("#change-amount").text() * 1.0).toFixed(2) + " for the refund. Adjust payments until the change is zero.");
|
||||
} else {
|
||||
sendReturnToServer(function (data) {
|
||||
if (nickelbridge) {
|
||||
var opendrawer = false;
|
||||
$("#payment-lines .list-group-item").each(function () {
|
||||
var type = $(".payment-entry", this).data("type");
|
||||
if (type == 'cash' || type == 'check') {
|
||||
opendrawer = true;
|
||||
}
|
||||
});
|
||||
if (opendrawer) {
|
||||
$.ajax("http://127.0.0.1:64269/opendrawer", {
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
success: function (resp) {
|
||||
|
||||
}
|
||||
}).fail(function (resp) {
|
||||
alert("Error: " + JSON.stringify(resp));
|
||||
});
|
||||
}
|
||||
}
|
||||
showReceipt(data.txid);
|
||||
});
|
||||
}
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
|
||||
$("#openmanagement").click(function () {
|
||||
$("#opendrawerbtn").removeClass('d-none');
|
||||
if (!nickelbridge) {
|
||||
$("#opendrawerbtn").addClass('d-none');
|
||||
}
|
||||
document.getElementById("xframe").contentDocument.location.reload(true);
|
||||
$("#managermodal").modal();
|
||||
});
|
||||
@ -96,6 +100,18 @@ $("#managermodal").on("click", ".printreceiptbtn", function () {
|
||||
$("#receiptmodal").modal();
|
||||
});
|
||||
|
||||
$("#opendrawerbtn").click(function () {
|
||||
$.ajax("http://127.0.0.1:64269/opendrawer", {
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
success: function (resp) {
|
||||
|
||||
}
|
||||
}).fail(function (resp) {
|
||||
alert("Error: " + JSON.stringify(resp));
|
||||
});
|
||||
});
|
||||
|
||||
$("#managermodal .open-number-pad-btn").click(function () {
|
||||
var inputbox = $("#transactionsearch");
|
||||
var value = inputbox.val();
|
||||
|
Loading…
x
Reference in New Issue
Block a user