Lager-Tab mit Produkt- und Artikel-Tabellen erweitern
This commit is contained in:
1 parent
8ed5dba3d8
commit
3334913915
5 files changed
+146
-2
No files matched your search
@@ -50,6 +50,38 @@ function get_otc_order_form_products(PDO $pdo): array
|
||||
return $products;
|
||||
}
|
||||
|
||||
function get_lager_product_overview(PDO $pdo): array
|
||||
{
|
||||
$stmt = $pdo->query(
|
||||
"SELECT
|
||||
p.id,
|
||||
p.name,
|
||||
p.sku,
|
||||
p.uom,
|
||||
COALESCE(SUM(v.qty_net), 0) AS available_qty
|
||||
FROM product p
|
||||
LEFT JOIN stock_lot sl
|
||||
ON sl.product_id = p.id
|
||||
AND sl.status = 'current'
|
||||
LEFT JOIN v_stock_lot_balance v
|
||||
ON v.stock_lot_id = sl.id
|
||||
WHERE p.status = 'active'
|
||||
GROUP BY p.id, p.name, p.sku, p.uom
|
||||
ORDER BY p.name ASC, p.id ASC"
|
||||
);
|
||||
|
||||
return array_map(
|
||||
static fn (array $row): array => [
|
||||
'id' => (int) $row['id'],
|
||||
'name' => (string) $row['name'],
|
||||
'sku' => (string) $row['sku'],
|
||||
'uom' => (string) $row['uom'],
|
||||
'available_qty' => (float) $row['available_qty'],
|
||||
],
|
||||
$stmt->fetchAll()
|
||||
);
|
||||
}
|
||||
|
||||
function get_current_lot_balance_for_update(PDO $pdo, int $productId): array
|
||||
{
|
||||
$stmt = $pdo->prepare(
|
||||
|
||||
Reference in new issue
Block a user