Add customer-specific pricing to POS (close #6)

master
Skylar Ittner 6 years ago
parent bdc32dfd50
commit 96046aadbf

@ -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":

@ -71,5 +71,6 @@ define("STRINGS", [
"add customer price" => "Add Customer Price",
"delete" => "Delete",
"cancel" => "Cancel",
"price" => "Price"
"price" => "Price",
"finish" => "Finish"
]);

@ -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]);

Loading…
Cancel
Save