Barcode Operations

This commit is contained in:
Thanakorn S
2026-05-06 15:27:52 +07:00
parent d8131a01b7
commit ada701bd53
22 changed files with 2449 additions and 35 deletions
+6 -3
View File
@@ -317,7 +317,8 @@ class ProductManager {
$sth = $this->pdo->prepare(
"SELECT * FROM md_product
WHERE company_id = :company_id
AND sku LIKE :keyword
AND (sku LIKE :keyword OR barcode LIKE :keyword)
AND status > 0
LIMIT 50"
);
$sth->execute([
@@ -358,6 +359,7 @@ class ProductManager {
':company_id' => $this->company_id,
':product_name' => $data['product_name'],
':sku' => $data['sku'],
':barcode' => trim($data['barcode'] ?? '') ?: null,
':uom' => $data['uom'] ?? 'pcs',
':price' => $data['price'],
':cost_price' => (float)($data['cost_price'] ?? 0),
@@ -376,6 +378,7 @@ class ProductManager {
"UPDATE md_product SET
product_name = :product_name,
sku = :sku,
barcode = :barcode,
uom = :uom,
price = :price,
cost_price = :cost_price,
@@ -391,10 +394,10 @@ class ProductManager {
} else {
$this->pdo->prepare(
"INSERT INTO md_product
(company_id, product_name, sku, uom, price, cost_price, min_stock, reorder_point,
(company_id, product_name, sku, barcode, uom, price, cost_price, min_stock, reorder_point,
category, product_image, `description`, `status`, `log`)
VALUES
(:company_id, :product_name, :sku, :uom, :price, :cost_price, :min_stock, :reorder_point,
(:company_id, :product_name, :sku, :barcode, :uom, :price, :cost_price, :min_stock, :reorder_point,
:category, :product_image, :description, :status, :log)"
)->execute($params);
}