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
|
||||
id,
|
||||
manifestarticle_id,
|
||||
warehouse_id,
|
||||
transaction_type,
|
||||
amount,
|
||||
transaction_text,
|
||||
@@ -49,6 +56,7 @@ LIMIT 1;
|
||||
export const INSERT_ROW = `
|
||||
INSERT INTO ledger (
|
||||
manifestarticle_id,
|
||||
warehouse_id,
|
||||
transaction_type,
|
||||
amount,
|
||||
transaction_text,
|
||||
@@ -57,6 +65,7 @@ INSERT INTO ledger (
|
||||
)
|
||||
VALUES (
|
||||
@manifestarticleId,
|
||||
@warehouseId,
|
||||
@transactionType,
|
||||
@amount,
|
||||
@transactionText,
|
||||
@@ -66,6 +75,7 @@ VALUES (
|
||||
RETURNING
|
||||
id,
|
||||
manifestarticle_id,
|
||||
warehouse_id,
|
||||
transaction_type,
|
||||
amount,
|
||||
transaction_text,
|
||||
@@ -78,6 +88,7 @@ export const LIST_BY_MANIFESTARTICLE = `
|
||||
SELECT
|
||||
l.id,
|
||||
l.manifestarticle_id,
|
||||
l.warehouse_id,
|
||||
ma.sku,
|
||||
l.transaction_type,
|
||||
l.amount,
|
||||
@@ -91,6 +102,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;
|
||||
`;
|
||||
|
||||
@@ -98,6 +110,7 @@ export const LIST_BY_SKU = `
|
||||
SELECT
|
||||
l.id,
|
||||
l.manifestarticle_id,
|
||||
l.warehouse_id,
|
||||
ma.sku,
|
||||
l.transaction_type,
|
||||
l.amount,
|
||||
@@ -111,5 +124,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