u
This commit is contained in:
@@ -17,6 +17,12 @@ LEFT JOIN entity e ON e.id = m.entity_id
|
||||
WHERE ma.id = @manifestarticleId AND m.company_id = @companyId;
|
||||
`;
|
||||
|
||||
export const CHECK_WAREHOUSE_ACCESS = `
|
||||
SELECT id, name
|
||||
FROM warehouse
|
||||
WHERE id = @warehouseId AND company_id = @companyId;
|
||||
`;
|
||||
|
||||
export const FIND_ARTICLES_FOR_HISTORY = `
|
||||
SELECT DISTINCT asup.article_id AS articleId
|
||||
FROM articlesupplier asup
|
||||
@@ -35,6 +41,7 @@ export const GET_LATEST_ROW = `
|
||||
SELECT TOP 1
|
||||
id,
|
||||
manifestarticle_id,
|
||||
warehouse_id,
|
||||
transaction_type,
|
||||
amount,
|
||||
transaction_text,
|
||||
@@ -48,6 +55,7 @@ ORDER BY id DESC;
|
||||
export const INSERT_ROW = `
|
||||
INSERT INTO ledger (
|
||||
manifestarticle_id,
|
||||
warehouse_id,
|
||||
transaction_type,
|
||||
amount,
|
||||
transaction_text,
|
||||
@@ -57,6 +65,7 @@ INSERT INTO ledger (
|
||||
OUTPUT
|
||||
INSERTED.id,
|
||||
INSERTED.manifestarticle_id,
|
||||
INSERTED.warehouse_id,
|
||||
INSERTED.transaction_type,
|
||||
INSERTED.amount,
|
||||
INSERTED.transaction_text,
|
||||
@@ -65,6 +74,7 @@ OUTPUT
|
||||
INSERTED.created_at
|
||||
VALUES (
|
||||
@manifestarticleId,
|
||||
@warehouseId,
|
||||
@transactionType,
|
||||
@amount,
|
||||
@transactionText,
|
||||
@@ -77,6 +87,7 @@ export const LIST_BY_MANIFESTARTICLE = `
|
||||
SELECT
|
||||
l.id,
|
||||
l.manifestarticle_id,
|
||||
l.warehouse_id,
|
||||
ma.sku,
|
||||
l.transaction_type,
|
||||
l.amount,
|
||||
@@ -90,6 +101,7 @@ INNER JOIN manifest m ON ma.manifest_id = m.id
|
||||
WHERE l.manifestarticle_id = @manifestarticleId
|
||||
AND m.company_id = @companyId
|
||||
AND (@transactionType IS NULL OR l.transaction_type = @transactionType)
|
||||
AND (@warehouseId IS NULL OR l.warehouse_id = @warehouseId)
|
||||
ORDER BY l.id ASC;
|
||||
`;
|
||||
|
||||
@@ -97,6 +109,7 @@ export const LIST_BY_SKU = `
|
||||
SELECT
|
||||
l.id,
|
||||
l.manifestarticle_id,
|
||||
l.warehouse_id,
|
||||
ma.sku,
|
||||
l.transaction_type,
|
||||
l.amount,
|
||||
@@ -110,5 +123,6 @@ INNER JOIN manifest m ON ma.manifest_id = m.id
|
||||
WHERE ma.sku = @sku
|
||||
AND m.company_id = @companyId
|
||||
AND (@transactionType IS NULL OR l.transaction_type = @transactionType)
|
||||
AND (@warehouseId IS NULL OR l.warehouse_id = @warehouseId)
|
||||
ORDER BY l.id ASC;
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user