Add Z report viewer (closes #17)
This commit is contained in:
parent
217b7befd2
commit
7d688e071d
@ -117,4 +117,5 @@ define("STRINGS", [
|
||||
"manage" => "Manage",
|
||||
"x report" => "X Report",
|
||||
"z report" => "Z Report",
|
||||
"pick cash" => "Choose",
|
||||
]);
|
||||
|
@ -117,7 +117,7 @@ class GenerateReceipt {
|
||||
|
||||
$receipt->appendHeader(new ReceiptLine(lang("x report", false), "", "", ReceiptLine::LINEFORMAT_BOLD | ReceiptLine::LINEFORMAT_CENTER));
|
||||
|
||||
$receipt->appendLine(new ReceiptLine("Date:", "", date(DATETIME_FORMAT)));
|
||||
$receipt->appendLine(new ReceiptLine("Printed:", "", date(DATETIME_FORMAT)));
|
||||
$receipt->appendLine(new ReceiptLine("Register:", "", $registername));
|
||||
$receipt->appendLine(new ReceiptLine("Transactions:", "", $transactioncount));
|
||||
|
||||
@ -172,7 +172,7 @@ class GenerateReceipt {
|
||||
|
||||
$receipt->appendHeader(new ReceiptLine(lang("z report", false), "", "", ReceiptLine::LINEFORMAT_BOLD | ReceiptLine::LINEFORMAT_CENTER));
|
||||
|
||||
$receipt->appendLine(new ReceiptLine("Date:", "", date(DATETIME_FORMAT)));
|
||||
$receipt->appendLine(new ReceiptLine("Printed:", "", date(DATETIME_FORMAT)));
|
||||
$receipt->appendLine(new ReceiptLine("Register:", "", $registername));
|
||||
$receipt->appendLine(new ReceiptLine("Transactions:", "", $transactioncount));
|
||||
|
||||
|
@ -53,13 +53,13 @@ class ReceiptLine {
|
||||
return "<br />";
|
||||
}
|
||||
$html = "";
|
||||
if (!empty($this->left)) {
|
||||
if (!empty($this->left) || $this->left === 0 || $this->left === "0") {
|
||||
$html .= '<span>' . htmlspecialchars($this->left) . ' </span>';
|
||||
}
|
||||
if (!empty($this->middle)) {
|
||||
if (!empty($this->middle) || $this->middle === 0 || $this->middle === "0") {
|
||||
$html .= '<span>' . htmlspecialchars($this->middle) . ' </span>';
|
||||
}
|
||||
if (!empty($this->right)) {
|
||||
if (!empty($this->right) || $this->right === 0 || $this->right === "0") {
|
||||
$html .= '<span>' . htmlspecialchars($this->right) . '</span>';
|
||||
}
|
||||
$classes = ["flex"];
|
||||
|
@ -74,6 +74,9 @@ define("PAGES", [
|
||||
"editregister" => [
|
||||
"title" => "edit register",
|
||||
"navbar" => false,
|
||||
"styles" => [
|
||||
"static/css/editregister.css",
|
||||
],
|
||||
"scripts" => [
|
||||
"static/js/editregister.js"
|
||||
]
|
||||
|
@ -11,6 +11,7 @@ $regdata = [
|
||||
'id' => '',
|
||||
'name' => ''
|
||||
];
|
||||
$cash = [];
|
||||
|
||||
$editing = false;
|
||||
|
||||
@ -33,7 +34,7 @@ if (!empty($VARS['id'])) {
|
||||
}
|
||||
|
||||
if ($editing) {
|
||||
|
||||
$cash = $database->select('cash_drawer', ['cashid', 'open', 'close'], ['AND' => ['registerid' => $regdata['id'], 'open[!]' => null, 'close[!]' => null], 'ORDER' => 'cashid', 'LIMIT' => 30]);
|
||||
}
|
||||
?>
|
||||
|
||||
@ -59,6 +60,30 @@ if ($editing) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body row">
|
||||
<div class="form-group col-12 col-md-6">
|
||||
<label for="zreport"><i class="fas fa-receipt"></i> <?php lang("z report"); ?></label>
|
||||
<div class="input-group">
|
||||
<select id="zreport" class="form-control">
|
||||
<option value=""><?php lang("pick cash") ?></option>
|
||||
<?php
|
||||
for ($i = count($cash) - 1; $i >= 0; $i--) {
|
||||
$c = $cash[$i];
|
||||
echo "<option value=\"$c[cashid]\">"
|
||||
. date(DATETIME_FORMAT, strtotime($c['open']))
|
||||
. ' - '
|
||||
. date(DATETIME_FORMAT, strtotime($c['close']))
|
||||
. "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" id="printzreportbtn" class="btn btn-primary"><i class="fas fa-print"></i> <?php lang("print"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<iframe id="zframe" class="w-100 shadow-lg"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="<?php echo htmlspecialchars($regdata['id']); ?>" />
|
||||
<input type="hidden" name="action" value="editregister" />
|
||||
<input type="hidden" name="source" value="registers" />
|
||||
|
12
static/css/editregister.css
Normal file
12
static/css/editregister.css
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
#zframe {
|
||||
height: 50vh;
|
||||
min-height: 400px;
|
||||
border: 0;
|
||||
}
|
@ -8,3 +8,19 @@
|
||||
$('#name').on('input propertychange paste', function () {
|
||||
$('#name_title').text($('#name').val());
|
||||
});
|
||||
|
||||
$("#zreport").on('change', function () {
|
||||
var cashid = $(this).val();
|
||||
if (cashid == "") {
|
||||
return;
|
||||
}
|
||||
$("#zframe").attr("src", "action.php?action=zreport&cash=" + cashid);
|
||||
});
|
||||
|
||||
$("#printzreportbtn").click(function () {
|
||||
var cashid = $("#zreport").val();
|
||||
if (cashid == "") {
|
||||
return;
|
||||
}
|
||||
document.getElementById("zframe").contentWindow.print();
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user