|
|
|
@ -5,6 +5,9 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var nickelbridge = false;
|
|
|
|
|
var receiptwidth = 48;
|
|
|
|
|
|
|
|
|
|
$('#name').on('input propertychange paste', function () {
|
|
|
|
|
$('#name_title').text($('#name').val());
|
|
|
|
|
});
|
|
|
|
@ -14,6 +17,7 @@ $("#zreport").on('change', function () {
|
|
|
|
|
if (cashid == "") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$("#zframe").data('cash', cashid);
|
|
|
|
|
$("#zframe").attr("src", "action.php?action=zreport&cash=" + cashid);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -22,5 +26,32 @@ $("#printzreportbtn").click(function () {
|
|
|
|
|
if (cashid == "") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (nickelbridge) {
|
|
|
|
|
$.get('action.php', {
|
|
|
|
|
action: 'zreport',
|
|
|
|
|
format: 'json',
|
|
|
|
|
width: receiptwidth,
|
|
|
|
|
cash: $("#zframe").data('cash')
|
|
|
|
|
}, function (receipt) {
|
|
|
|
|
$.ajax("http://127.0.0.1:64269/print", {
|
|
|
|
|
data: JSON.stringify(receipt),
|
|
|
|
|
contentType: 'application/json',
|
|
|
|
|
type: 'POST',
|
|
|
|
|
success: function (resp) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).fail(function (resp) {
|
|
|
|
|
alert("Error: " + JSON.stringify(resp));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById("zframe").contentWindow.print();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.get('http://127.0.0.1:64269/status', {}, function (resp) {
|
|
|
|
|
if (resp.status == "OK") {
|
|
|
|
|
nickelbridge = true;
|
|
|
|
|
receiptwidth = resp.width;
|
|
|
|
|
}
|
|
|
|
|
});
|