diff --git a/action.php b/action.php index 82605bf..8f67de9 100644 --- a/action.php +++ b/action.php @@ -253,6 +253,16 @@ END; 'cost', 'price' ], $where); + + if (!empty($VARS['customer']) && $database->has('customers', ['customerid' => $VARS['customer']])) { + for ($n = 0; $n < count($items); $n++) { + $i = $items[$n]; + if ($database->has('customer_pricing', ['AND' => ['itemid' => $i['id'], 'customerid' => $VARS['customer']]])) { + $items[$n]['price'] = $database->get('customer_pricing', 'price', ['AND' => ['itemid' => $i['id'], 'customerid' => $VARS['customer']]]); + } + } + } + $items = (count($items) > 0 ? $items : false); exit(json_encode(["status" => "OK", "items" => $items])); case "customersearch": diff --git a/lang/en_us.php b/lang/en_us.php index 30c782f..969ce5a 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -71,5 +71,6 @@ define("STRINGS", [ "add customer price" => "Add Customer Price", "delete" => "Delete", "cancel" => "Cancel", - "price" => "Price" + "price" => "Price", + "finish" => "Finish" ]); \ No newline at end of file diff --git a/static/js/pos_items.js b/static/js/pos_items.js index b7ffed5..8ee1975 100644 --- a/static/js/pos_items.js +++ b/static/js/pos_items.js @@ -74,7 +74,8 @@ function findItem(q) { } $.get("action.php", { action: "itemsearch", - q: q + q: q, + customer: customerid }, function (data) { if (data['items'].length == 1) { decodeThenAddItem(data['items'][0]);