Add customer-specific pricing to POS (close #6)
This commit is contained in:
parent
bdc32dfd50
commit
96046aadbf
10
action.php
10
action.php
@ -253,6 +253,16 @@ END;
|
|||||||
'cost',
|
'cost',
|
||||||
'price'
|
'price'
|
||||||
], $where);
|
], $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);
|
$items = (count($items) > 0 ? $items : false);
|
||||||
exit(json_encode(["status" => "OK", "items" => $items]));
|
exit(json_encode(["status" => "OK", "items" => $items]));
|
||||||
case "customersearch":
|
case "customersearch":
|
||||||
|
@ -71,5 +71,6 @@ define("STRINGS", [
|
|||||||
"add customer price" => "Add Customer Price",
|
"add customer price" => "Add Customer Price",
|
||||||
"delete" => "Delete",
|
"delete" => "Delete",
|
||||||
"cancel" => "Cancel",
|
"cancel" => "Cancel",
|
||||||
"price" => "Price"
|
"price" => "Price",
|
||||||
|
"finish" => "Finish"
|
||||||
]);
|
]);
|
@ -74,7 +74,8 @@ function findItem(q) {
|
|||||||
}
|
}
|
||||||
$.get("action.php", {
|
$.get("action.php", {
|
||||||
action: "itemsearch",
|
action: "itemsearch",
|
||||||
q: q
|
q: q,
|
||||||
|
customer: customerid
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data['items'].length == 1) {
|
if (data['items'].length == 1) {
|
||||||
decodeThenAddItem(data['items'][0]);
|
decodeThenAddItem(data['items'][0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user