Browse Source

Add X report (closes #2)

Skylar Ittner 6 months ago
parent
commit
2dd2374b12
10 changed files with 298 additions and 103 deletions
  1. 24
    96
      action.php
  2. 5
    1
      lang/en_us.php
  3. 192
    0
      lib/generatereceipt.php
  4. 14
    0
      lib/receipts.php
  5. 11
    0
      nbproject/customs.json
  6. 1
    0
      pages.php
  7. 29
    4
      pages/pos.php
  8. 6
    1
      static/css/pos.css
  9. 1
    1
      static/js/pos_finish.js
  10. 15
    0
      static/js/pos_management.js

+ 24
- 96
action.php View File

@@ -144,114 +144,23 @@ switch ($VARS['action']) {
144 144
 
145 145
         break;
146 146
     case "getreceipt":
147
-        require_once __DIR__ . "/lib/receipts.php";
147
+        require_once __DIR__ . "/lib/generatereceipt.php";
148 148
         $format = "html";
149 149
         $width = 64;
150 150
         if (isset($VARS['width']) && preg_match("/[0-9]+/", $VARS['width']) && (int) $VARS['width'] > 0) {
151 151
             $width = (int) $VARS['width'];
152 152
         }
153 153
         if (isset($VARS['format'])) {
154
-            switch ($VARS['format']) {
155
-                case "text":
156
-                    $format = "text";
157
-                    header("Content-Type: text/plain");
158
-                    break;
159
-                case "json":
160
-                    $format = "json";
161
-                    header("Content-Type: application/json");
162
-                    break;
163
-                default:
164
-                    $format = "html";
165
-                    header("Content-Type: text/html");
166
-            }
154
+            $format = $VARS['format'];
167 155
         }
168 156
         if (!$database->has('transactions', ['txid' => $VARS['txid']])) {
169 157
             header("Content-Type: application/json");
170 158
             exit(json_encode(["status" => "ERROR", "txid" => null]));
171 159
         }
172
-        $receipt = new Receipt();
173
-        $tx = $database->get('transactions', ['txid', 'txdate', 'customerid', 'type', 'cashier', 'discountpercent'], ['txid' => $VARS['txid']]);
174
-        // Info
175
-        $txid = $tx['txid'];
176
-        $datetime = date(DATETIME_FORMAT, strtotime($tx['txdate']));
177
-        $type = $tx['type'];
178
-        $cashier = getUserByID($tx['cashier'])['name'];
179
-        $customerid = $tx['customerid'];
180
-
181
-        // Items
182
-        $itemlines = [];
183
-        $items = $database->select('lines', ['amount', 'name', 'itemid', 'qty'], ['txid' => $txid]);
184
-        $subtotal = 0.0;
185
-        $paid = 0.0;
186
-        foreach ($items as $i) {
187
-            $itemlines[] = new ReceiptLine(
188
-                    $i['name'], (float) $i['qty'] . '@' . number_format($i['amount'], 2), '$' . number_format($i['qty'] * $i['amount'] * 1.0, 2)
189
-            );
190
-            $subtotal += $i['qty'] * $i['amount'] * 1.0;
191
-        }
192 160
 
193
-        // Payments
194
-        $total = $subtotal * (1.0 - ((float) $tx['discountpercent'] / 100));
195
-        $paymentlines = [];
196
-        $payments = $database->select('payments', [
197
-            '[>]payment_types' => ['type' => 'typeid']
198
-                ], [
199
-            'amount', 'type', 'typename', 'text'
200
-                ], [
201
-            'txid' => $txid
202
-        ]);
203
-        foreach ($payments as $p) {
204
-            if ($p['amount'] < 0) {
205
-                continue;
206
-            }
207
-            $paymentlines[] = new ReceiptLine(lang($p['text'], false), "", '$' . number_format($p['amount'] * 1.0, 2));
208
-            $paid += $p['amount'] * 1.0;
209
-        }
210
-        $change = $paid - $total;
211
-        if ($change <= 0) {
212
-            $change = 0.0;
213
-        }
214
-
215
-        // Totals
216
-        $subtotalline = new ReceiptLine("Subtotal:", "", '$' . number_format($subtotal, 2));
217
-        $paidline = new ReceiptLine("Paid:", "", '$' . number_format($paid, 2), ReceiptLine::LINEFORMAT_BOLD);
218
-        $changeline = new ReceiptLine("Change:", "", '$' . number_format($change, 2), ReceiptLine::LINEFORMAT_BOLD);
219
-        $totalline = new ReceiptLine("Total:", "", '$' . number_format($subtotal, 2), ReceiptLine::LINEFORMAT_BOLD);
220
-
221
-        $receipt->appendLine(new ReceiptLine("Date: $datetime"));
222
-        $receipt->appendLine(new ReceiptLine("Tx. ID: $txid"));
223
-        $receipt->appendLine(new ReceiptLine("Cashier: $cashier"));
224
-        if (!is_null($customerid) && !empty($customerid)) {
225
-            $customer = $database->get('customers', 'name', ['customerid' => $customerid]);
226
-            $receipt->appendLine(new ReceiptLine("Customer: $customer"));
227
-        }
228
-        $receipt->appendBreak();
229
-        $receipt->appendLines($itemlines);
230
-        $receipt->appendBreak();
231
-        $receipt->appendLine($subtotalline);
232
-        if ($tx['discountpercent'] > 0) {
233
-            $receipt->appendLine(new ReceiptLine("Discount:", "", (float) $tx['discountpercent'] . '% off'));
234
-            $totalline = new ReceiptLine("Total:", "", '$' . number_format($total, 2), ReceiptLine::LINEFORMAT_BOLD);
235
-        }
236
-        $receipt->appendLine($totalline);
237
-        $receipt->appendBreak();
238
-        $receipt->appendLines($paymentlines);
239
-        $receipt->appendBreak();
240
-        $receipt->appendLine($paidline);
241
-        $receipt->appendLine($changeline);
242
-
243
-        $output = "";
244
-        switch ($format) {
245
-            case "text":
246
-                $output = $receipt->getPlainText($width);
247
-                break;
248
-            case "json":
249
-                $output = $receipt->getJson($width);
250
-                break;
251
-            default:
252
-                $output = $receipt->getHtml("Tx. #$txid");
253
-        }
254
-        exit($output);
161
+        $receipt = GenerateReceipt::getReceipt(GenerateReceipt::RECEIPT_TYPE_TRANSACTION, $VARS['txid']);
162
+
163
+        exit(GenerateReceipt::outputReceipt($receipt, $format, $width, "Tx. #" . $VARS['txid']));
255 164
         break;
256 165
     case "itemsearch":
257 166
         header("Content-Type: application/json");
@@ -509,6 +418,25 @@ switch ($VARS['action']) {
509 418
         }
510 419
 
511 420
         returnToSender("register_saved");
421
+    case "xreport":
422
+        require_once __DIR__ . "/lib/generatereceipt.php";
423
+        $format = "html";
424
+        $width = 64;
425
+        if (isset($VARS['width']) && preg_match("/[0-9]+/", $VARS['width']) && (int) $VARS['width'] > 0) {
426
+            $width = (int) $VARS['width'];
427
+        }
428
+        if (isset($VARS['format'])) {
429
+            $format = $VARS['format'];
430
+        }
431
+        if (!$database->has('cash_drawer', ['AND' => ['registerid' => $VARS['register'], 'open[!]' => null, 'close' => null]])) {
432
+            header("Content-Type: application/json");
433
+            exit(json_encode(["status" => "ERROR"]));
434
+        }
435
+
436
+        $receipt = GenerateReceipt::getReceipt(GenerateReceipt::RECEIPT_TYPE_X, null, $VARS['register']);
437
+
438
+        exit(GenerateReceipt::outputReceipt($receipt, $format, $width, "X Report"));
439
+        break;
512 440
     case "session_keepalive":
513 441
         header("Content-Type: application/json");
514 442
         exit(json_encode(["status" => "OK"]));

+ 5
- 1
lang/en_us.php View File

@@ -111,5 +111,9 @@ define("STRINGS", [
111 111
     "adding register" => "Adding register",
112 112
     "register saved" => "Register saved.",
113 113
     "register name taken" => "Register name already taken.  Use a different name.",
114
-    "no open registers" => "No open cash registers.  Go to the Registers page to open one."
114
+    "no open registers" => "No open cash registers.  Go to the Registers page to open one.",
115
+    "register management" => "Register Management",
116
+    "manage register" => "Manage register",
117
+    "manage" => "Manage",
118
+    "x report" => "X Report",
115 119
 ]);

+ 192
- 0
lib/generatereceipt.php View File

@@ -0,0 +1,192 @@
1
+<?php
2
+
3
+/*
4
+ * This Source Code Form is subject to the terms of the Mozilla Public
5
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
+ */
8
+
9
+require_once __DIR__ . "/receipts.php";
10
+
11
+class GenerateReceipt {
12
+
13
+    const RECEIPT_TYPE_TRANSACTION = 1;
14
+    const RECEIPT_TYPE_X = 2;
15
+    const RECEIPT_TYPE_Y = 3;
16
+
17
+    static function transactionReceipt($transaction) {
18
+        global $database;
19
+        $receipt = new Receipt();
20
+        $tx = $database->get('transactions', ['txid', 'txdate', 'customerid', 'type', 'cashier', 'discountpercent'], ['txid' => $transaction]);
21
+        // Info
22
+        $txid = $tx['txid'];
23
+        $datetime = date(DATETIME_FORMAT, strtotime($tx['txdate']));
24
+        $type = $tx['type'];
25
+        $cashier = getUserByID($tx['cashier'])['name'];
26
+        $customerid = $tx['customerid'];
27
+
28
+        // Items
29
+        $itemlines = [];
30
+        $items = $database->select('lines', ['amount', 'name', 'itemid', 'qty'], ['txid' => $txid]);
31
+        $subtotal = 0.0;
32
+        $paid = 0.0;
33
+        foreach ($items as $i) {
34
+            $itemlines[] = new ReceiptLine(
35
+                    $i['name'], (float) $i['qty'] . '@' . number_format($i['amount'], 2), '$' . number_format($i['qty'] * $i['amount'] * 1.0, 2)
36
+            );
37
+            $subtotal += $i['qty'] * $i['amount'] * 1.0;
38
+        }
39
+
40
+        // Payments
41
+        $total = $subtotal * (1.0 - ((float) $tx['discountpercent'] / 100));
42
+        $paymentlines = [];
43
+        $payments = $database->select('payments', [
44
+            '[>]payment_types' => ['type' => 'typeid']
45
+                ], [
46
+            'amount', 'type', 'typename', 'text'
47
+                ], [
48
+            'txid' => $txid
49
+        ]);
50
+        foreach ($payments as $p) {
51
+            if ($p['amount'] < 0) {
52
+                continue;
53
+            }
54
+            $paymentlines[] = new ReceiptLine(lang($p['text'], false), "", '$' . number_format($p['amount'] * 1.0, 2));
55
+            $paid += $p['amount'] * 1.0;
56
+        }
57
+        $change = $paid - $total;
58
+        if ($change <= 0) {
59
+            $change = 0.0;
60
+        }
61
+
62
+        // Totals
63
+        $subtotalline = new ReceiptLine("Subtotal:", "", '$' . number_format($subtotal, 2));
64
+        $paidline = new ReceiptLine("Paid:", "", '$' . number_format($paid, 2), ReceiptLine::LINEFORMAT_BOLD);
65
+        $changeline = new ReceiptLine("Change:", "", '$' . number_format($change, 2), ReceiptLine::LINEFORMAT_BOLD);
66
+        $totalline = new ReceiptLine("Total:", "", '$' . number_format($subtotal, 2), ReceiptLine::LINEFORMAT_BOLD);
67
+
68
+        $receipt->appendLine(new ReceiptLine("Date: $datetime"));
69
+        $receipt->appendLine(new ReceiptLine("Tx. ID: $txid"));
70
+        $receipt->appendLine(new ReceiptLine("Cashier: $cashier"));
71
+        if (!is_null($customerid) && !empty($customerid)) {
72
+            $customer = $database->get('customers', 'name', ['customerid' => $customerid]);
73
+            $receipt->appendLine(new ReceiptLine("Customer: $customer"));
74
+        }
75
+        $receipt->appendBreak();
76
+        $receipt->appendLines($itemlines);
77
+        $receipt->appendBreak();
78
+        $receipt->appendLine($subtotalline);
79
+        if ($tx['discountpercent'] > 0) {
80
+            $receipt->appendLine(new ReceiptLine("Discount:", "", (float) $tx['discountpercent'] . '% off'));
81
+            $totalline = new ReceiptLine("Total:", "", '$' . number_format($total, 2), ReceiptLine::LINEFORMAT_BOLD);
82
+        }
83
+        $receipt->appendLine($totalline);
84
+        $receipt->appendBreak();
85
+        $receipt->appendLines($paymentlines);
86
+        $receipt->appendBreak();
87
+        $receipt->appendLine($paidline);
88
+        $receipt->appendLine($changeline);
89
+
90
+        return $receipt;
91
+    }
92
+
93
+    static function xReceipt($registerid) {
94
+        global $database;
95
+        $receipt = new Receipt();
96
+
97
+        $registername = $database->get('registers', 'registername', ['registerid' => $registerid]);
98
+        $cash = $database->get('cash_drawer', ['open', 'start_amount', 'cashid'], ['AND' => ['open[!]' => null, 'close' => null, 'registerid' => $registerid]]);
99
+
100
+        $balance = [];
101
+        $paymenttypes = $database->select('payment_types', ['typename (type)', 'text']);
102
+        $payments = $database->select("payments", [
103
+            "[>]transactions" => ['txid' => 'txid'],
104
+            "[>]payment_types" => ['type' => 'typeid']
105
+                ], ['amount', 'typename (type)'], [
106
+            'AND' => [
107
+                'transactions.cashid' => $cash['cashid'],
108
+            ]
109
+        ]);
110
+        foreach ($paymenttypes as $t) {
111
+            $balance[$t['type']] = 0.0;
112
+        }
113
+        foreach ($payments as $p) {
114
+            $balance[$p['type']] += $p['amount'];
115
+        }
116
+
117
+        $receipt->appendHeader(new ReceiptLine(lang("x report", false), "", "", ReceiptLine::LINEFORMAT_BOLD | ReceiptLine::LINEFORMAT_CENTER));
118
+
119
+        $receipt->appendLine(new ReceiptLine("Date:", "", date(DATETIME_FORMAT)));
120
+        $receipt->appendLine(new ReceiptLine("Register:", "", $registername));
121
+
122
+        $receipt->appendBlank();
123
+        $receipt->appendBreak();
124
+        $receipt->appendLine(new ReceiptLine("Opening", "", "", ReceiptLine::LINEFORMAT_CENTER));
125
+        $receipt->appendBreak();
126
+        $receipt->appendLine(new ReceiptLine("Date:", "", date(DATETIME_FORMAT, strtotime($cash['open']))));
127
+        $receipt->appendLine(new ReceiptLine("Cash:", "", '$' . number_format($cash['start_amount'], 2)));
128
+
129
+        $receipt->appendBlank();
130
+        $receipt->appendBreak();
131
+        $receipt->appendLine(new ReceiptLine("Sales", "", "", ReceiptLine::LINEFORMAT_CENTER));
132
+        $receipt->appendBreak();
133
+        foreach ($paymenttypes as $t) {
134
+            $receipt->appendLine(new ReceiptLine(lang($t['text'], false) . ":", "", '$' . number_format($balance[$t['type']], 2)));
135
+        }
136
+
137
+        $receipt->appendBlank();
138
+        $receipt->appendBreak();
139
+        $receipt->appendLine(new ReceiptLine("Balance", "", "", ReceiptLine::LINEFORMAT_CENTER));
140
+        $receipt->appendBreak();
141
+        $receipt->appendLine(new ReceiptLine("Cash:", "", '$' . number_format($balance['cash'] + $cash['start_amount'], 2)));
142
+
143
+        return $receipt;
144
+    }
145
+
146
+    static function getReceipt($type, $transaction = null, $register = null, $cashid = null) {
147
+        switch ($type) {
148
+            case GenerateReceipt::RECEIPT_TYPE_X:
149
+                return GenerateReceipt::xReceipt($register);
150
+                break;
151
+            case GenerateReceipt::RECEIPT_TYPE_Y:
152
+                return GenerateReceipt::Receipt($register, $cashid);
153
+                break;
154
+            case GenerateReceipt::RECEIPT_TYPE_TRANSACTION:
155
+                return GenerateReceipt::transactionReceipt($transaction);
156
+                break;
157
+            default:
158
+                return new Receipt();
159
+                break;
160
+        }
161
+    }
162
+
163
+    static function outputReceipt(Receipt $receipt, $format = "html", $width = 64, $title = "") {
164
+        switch ($format) {
165
+            case "text":
166
+                $format = "text";
167
+                header("Content-Type: text/plain");
168
+                break;
169
+            case "json":
170
+                $format = "json";
171
+                header("Content-Type: application/json");
172
+                break;
173
+            default:
174
+                $format = "html";
175
+                header("Content-Type: text/html");
176
+        }
177
+
178
+        $output = "";
179
+        switch ($format) {
180
+            case "text":
181
+                $output = $receipt->getPlainText($width);
182
+                break;
183
+            case "json":
184
+                $output = $receipt->getJson($width);
185
+                break;
186
+            default:
187
+                $output = $receipt->getHtml($title);
188
+        }
189
+        return $output;
190
+    }
191
+
192
+}

+ 14
- 0
lib/receipts.php View File

@@ -15,6 +15,7 @@ class ReceiptLine {
15 15
     const LINEFORMAT_BOLD = 2;
16 16
     const LINEFORMAT_HR = 4;
17 17
     const LINEFORMAT_CENTER = 8;
18
+    const LINEFORMAT_BLANK = 16;
18 19
 
19 20
     private $left = "";
20 21
     private $middle = "";
@@ -48,6 +49,9 @@ class ReceiptLine {
48 49
         if ($this->hasFormat($this::LINEFORMAT_HR)) {
49 50
             return "<hr />";
50 51
         }
52
+        if ($this->hasFormat($this::LINEFORMAT_BLANK)) {
53
+            return "<br />";
54
+        }
51 55
         $html = "";
52 56
         if (!empty($this->left)) {
53 57
             $html .= '<span>' . htmlspecialchars($this->left) . '&nbsp;</span>';
@@ -73,6 +77,9 @@ class ReceiptLine {
73 77
         if ($this->hasFormat($this::LINEFORMAT_HR)) {
74 78
             return str_repeat("-", $width);
75 79
         }
80
+        if ($this->hasFormat($this::LINEFORMAT_BLANK)) {
81
+            return str_repeat(" ", $width);
82
+        }
76 83
         $left = $this->left;
77 84
         $middle = $this->middle;
78 85
         $right = $this->right;
@@ -121,6 +128,9 @@ class ReceiptLine {
121 128
         if ($this->hasFormat($this::LINEFORMAT_CENTER)) {
122 129
             $data['format'][] = "center";
123 130
         }
131
+        if ($this->hasFormat($this::LINEFORMAT_BLANK)) {
132
+            $data['format'][] = "blank";
133
+        }
124 134
         return $data;
125 135
     }
126 136
 
@@ -158,6 +168,10 @@ class Receipt {
158 168
         $this->lines[] = new ReceiptLine("", "", "", ReceiptLine::LINEFORMAT_HR);
159 169
     }
160 170
 
171
+    function appendBlank() {
172
+        $this->lines[] = new ReceiptLine("", "", "", ReceiptLine::LINEFORMAT_BLANK);
173
+    }
174
+
161 175
     function getHtml($title = "") {
162 176
         global $SECURE_NONCE;
163 177
         $html = <<<END

+ 11
- 0
nbproject/customs.json View File

@@ -0,0 +1,11 @@
1
+{
2
+    "elements": {},
3
+    "attributes": {
4
+        "role": {
5
+            "context": "div"
6
+        },
7
+        "data-dismiss": {
8
+            "context": "button"
9
+        }
10
+    }
11
+}

+ 1
- 0
pages.php View File

@@ -26,6 +26,7 @@ define("PAGES", [
26 26
             "static/js/pos_gridview.js",
27 27
             "static/js/pos_payment.js",
28 28
             "static/js/pos_finish.js",
29
+            "static/js/pos_management.js",
29 30
             "static/js/pos.js",
30 31
         ]
31 32
     ],

+ 29
- 4
pages/pos.php View File

@@ -8,8 +8,8 @@ $register = [
8 8
     "name" => lang("no cash", false),
9 9
     "id" => ""
10 10
 ];
11
-
12
-if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has("registers", ['[>]cash_drawer' => ['registerid' => 'registerid']], ['AND' => ['open[!]' => null, 'close' => null, 'registerid' => $_SESSION['register']]])) {
11
+$registeropen = $database->has("registers", ['[>]cash_drawer' => ['registerid' => 'registerid']], ['AND' => ['open[!]' => null, 'close' => null, 'registers.registerid' => $_SESSION['register']]]);
12
+if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$registeropen) {
13 13
     require_once __DIR__ . "/../lib/chooseregister.php";
14 14
 } else {
15 15
     $register = $database->get('registers', ['registerid (id)', 'registername (name)'], ['registerid' => $_SESSION['register']]);
@@ -26,7 +26,7 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has("
26 26
                 </div>
27 27
                 <div class="modal-body">
28 28
                     <div class="display-4 text-center"><?php lang("change"); ?>: $<span id="receiptchange">0.00</span></div>
29
-                    <iframe class="w-100" id="receiptframe"></iframe>
29
+                    <iframe class="w-100 shadow-lg" id="receiptframe"></iframe>
30 30
                 </div>
31 31
                 <div class="modal-footer">
32 32
                     <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php lang("new sale"); ?></button>
@@ -62,6 +62,30 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has("
62 62
         </div>
63 63
     </div>
64 64
 
65
+    <div class="modal fade" tabindex="-1" role="dialog" id="managermodal">
66
+        <div class="modal-dialog modal-lg" role="document">
67
+            <div class="modal-content">
68
+                <div class="modal-header">
69
+                    <h5 class="modal-title"><i class="fas fa-cog"></i> <?php lang("register management"); ?></h5>
70
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
71
+                        <span aria-hidden="true">&times;</span>
72
+                    </button>
73
+                </div>
74
+                <div class="modal-body">
75
+                    <div class="row">
76
+                        <div class="col-12 col-md-6">
77
+                            <button type="button" class="btn btn-primary" id="xprintbtn"><i class="fas fa-print"></i> <?php lang("print"); ?></button>
78
+                            <iframe class="w-100 shadow-lg" id="xframe" src="action.php?action=xreport&format=html&register=<?php echo $register['id']; ?>"></iframe>
79
+                        </div>
80
+                    </div>
81
+                </div>
82
+                <div class="modal-footer">
83
+                    <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php lang("close"); ?></button>
84
+                </div>
85
+            </div>
86
+        </div>
87
+    </div>
88
+
65 89
     <div class="row">
66 90
         <div class="col-12 col-md-6 order-1 order-md-0">
67 91
             <div class="card d-flex">
@@ -98,7 +122,8 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$database->has("
98 122
 
99 123
         <div class="col-12 col-md-6 order-0 order-md-1">
100 124
             <div class="card mb-3 mb-md-0">
101
-                <div class="w-100 position-absolute d-flex align-items-start pr-3 pt-2">
125
+                <div class="w-100 position-absolute d-flex align-items-start px-3 pt-2">
126
+                    <a href="#" class="mr-auto text-body" id="openmanagement" data-toggle="tooltip" title="<?php lang("manage register") ?>"><i class="fas fa-cog"></i> <?php lang("manage"); ?></a>
102 127
                     <a href="app.php?page=pos&switch" class="ml-auto text-body" id="register" data-id="<?php echo $register['id']; ?>" data-toggle="tooltip" title="<?php lang("change register") ?>"><i class="fas fa-exchange-alt"></i> <?php echo $register['name']; ?></a>
103 128
                 </div>
104 129
                 <div class="display-4 p-1 p-md-3 text-center">$<span id="grand-total">0.00</span></div>

+ 6
- 1
static/css/pos.css View File

@@ -27,6 +27,11 @@ input[type="number"] {
27 27
 }
28 28
 
29 29
 #receiptframe {
30
-    height: 50vh;
30
+    height: 60vh;
31
+    border: 0;
32
+}
33
+
34
+#xframe {
35
+    height: 60vh;
31 36
     border: 0;
32 37
 }

+ 1
- 1
static/js/pos_finish.js View File

@@ -80,7 +80,7 @@ $("#finishbtn").click(function () {
80 80
 
81 81
 $("#receiptprintbtn").click(function () {
82 82
     document.getElementById("receiptframe").contentWindow.print();
83
-})
83
+});
84 84
 
85 85
 $("#receiptmodal").on("hide.bs.modal", function () {
86 86
     window.location.reload();

+ 15
- 0
static/js/pos_management.js View File

@@ -0,0 +1,15 @@
1
+/*
2
+ * This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
+ */
6
+
7
+
8
+$("#openmanagement").click(function () {
9
+    document.getElementById("xframe").contentDocument.location.reload(true);
10
+    $("#managermodal").modal();
11
+});
12
+
13
+$("#xprintbtn").click(function () {
14
+    document.getElementById("xframe").contentWindow.print();
15
+});