This commit is contained in:
seb
2026-09-27 21:01:30 +02:00
parent f9c570a036
commit 0cafa11a32
34 changed files with 2010 additions and 1534 deletions

View File

@@ -31,6 +31,7 @@ export const ARTICLE_LIST_COLUMNS = `
at.slug,
pr.net,
t.rate AS taxRate,
a.track_stock,
CASE
WHEN a.optionslist_id IS NOT NULL THEN (
SELECT COUNT(*)
@@ -133,6 +134,12 @@ SET weight = @weight
WHERE id = @articleId
`;
export const UPDATE_TRACK_STOCK = `
UPDATE article
SET track_stock = @trackStock
WHERE id = @articleId
`;
export const UPDATE_BRAND = `
UPDATE article
SET brand_id = @brandId
@@ -158,9 +165,9 @@ WHERE id = @articleId
`;
export const CREATE = `
INSERT INTO article (company_id, sku, unit_id, unitamount, weight)
INSERT INTO article (company_id, sku, unit_id, unitamount, weight, track_stock)
OUTPUT INSERTED.id
VALUES (@companyId, @sku, @unitId, @unitamount, @weight)
VALUES (@companyId, @sku, @unitId, @unitamount, @weight, @trackStock)
`;
export const DELETE_EANS_BY_ARTICLE = `
@@ -287,6 +294,7 @@ SELECT
u.si AS unitSi,
ut.symbol AS unitSymbol,
a.unitamount,
a.track_stock,
b.name AS brandName,
b.name AS brandName,
pr.net AS net,
@@ -371,6 +379,7 @@ SELECT
at.slug,
a.unitamount,
a.weight,
a.track_stock,
u.si AS unitSi,
u.basesi AS unitBasesi,
u.basesifactor AS unitBasesifactor,
@@ -467,6 +476,7 @@ SELECT
SELECT
w.id,
w.name,
w.sort,
COALESCE(stock_calc.stock, 0) AS stock
FROM warehouse w
LEFT JOIN (
@@ -482,7 +492,7 @@ SELECT
GROUP BY l.warehouse_id
) stock_calc ON stock_calc.warehouse_id = w.id
WHERE w.company_id = a.company_id
ORDER BY w.name ASC
ORDER BY w.sort ASC, w.name ASC
FOR JSON PATH
) AS warehousesJson
FROM article a