An easy point of sale system with automatic inventory tracking. https://netsyms.biz/apps/nickelbox/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

account.php 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /*
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. */
  7. if (!defined('NICKELBOX')) {
  8. die("Direct access denied.");
  9. }
  10. if ($loggedin !== true || is_null($account)) {
  11. header('Location: ./?page=login');
  12. die("Please log in.");
  13. }
  14. ?>
  15. <div class="container mt-4">
  16. <h1 class="display-4">Account</h1>
  17. <div class="row">
  18. <div class="col-md-8">
  19. <h3>Recent Orders</h3>
  20. <div class="list-group">
  21. <?php
  22. $orders = $database->select('transactions', ['txid', 'txdate', 'type'], ['customerid' => $account['id'], 'ORDER' => ['txdate' => 'DESC'], 'LIMIT' => 50]);
  23. foreach ($orders as $o) {
  24. $lines = $database->select('lines', ['lineid', 'amount', 'qty', 'name'], ['txid' => $o['txid']]);
  25. $itemcount = 0;
  26. $total = 0.0;
  27. foreach ($lines as $l) {
  28. $itemcount += $l['qty'];
  29. $total += $l['amount'] * $l['qty'];
  30. }
  31. ?>
  32. <div class="list-group-item">
  33. Date: <?php echo date($SETTINGS['datetime_format'], strtotime($o['txdate'])); ?><br />
  34. Type: <?php
  35. switch ($o['type']) {
  36. case 1:
  37. echo "In-store";
  38. break;
  39. case 2:
  40. echo "Return";
  41. break;
  42. case 3:
  43. echo "Online";
  44. break;
  45. default:
  46. echo "Other";
  47. break;
  48. }
  49. ?><br />
  50. Total: $<?php echo number_format($total, 2); ?><br />
  51. <div class="list-group list-group-flush">
  52. <?php
  53. foreach ($lines as $l) {
  54. ?>
  55. <div class="list-group-item d-flex justify-content-between">
  56. <div><?php echo $l['name']; ?></div>
  57. <div><?php echo $l['qty'] * 1.0; ?>@<?php echo number_format($l['amount'], 2); ?></div>
  58. <div>$<?php echo number_format($l['amount'] * $l['qty'], 2); ?></div>
  59. </div>
  60. <?php
  61. }
  62. ?>
  63. </div>
  64. </div>
  65. <?php
  66. }
  67. ?>
  68. </div>
  69. </div>
  70. </div>
  71. </div>