This commit is contained in:
seb
2026-10-08 21:50:38 +02:00
parent d36c2827cc
commit 760f074b4e
5 changed files with 177 additions and 14 deletions

View File

@@ -3,7 +3,40 @@ import { translateQueries } from './translate.js';
const queries = translateQueries(source, 'manifestDoc');
export const {
CHECK_ARTICLE_IS_PARENT, CREATE_LINE, CREATE_MANIFEST, DELETE_LINES_BY_MANIFEST,
CHECK_ARTICLE_IS_PARENT, COUNT_MANIFESTS, CREATE_LINE, CREATE_MANIFEST, DELETE_LINES_BY_MANIFEST,
DELETE_MANIFEST, GET_MANIFEST_HEADER, GET_MANIFEST_LINES, LIST_MANIFESTS,
ORDER_TYPE, QUOTE_TYPE, UPDATE_MANIFEST,
} = queries;
} = queries;
export const LIST_MANIFESTS_PAGED = `
SELECT
m.id,
m."number",
m."type",
m.entity_id AS entityId,
m.external_number AS externalNumber,
m."date",
m.created_at AS createdAt
FROM manifest m
WHERE m.company_id = @companyId
AND m."type" = @type
ORDER BY m."date" DESC, m.id DESC
LIMIT @limit OFFSET @offset
`;
export const GET_MANIFEST_LINES_BY_MANIFEST_IDS = `
SELECT
ma.id,
ma.manifest_id AS manifestId,
ma.sku,
ma.name,
ma.pu,
ma.amount,
ma.net,
ma.rebate,
ma.taxrate,
ma.comment
FROM manifestarticle ma
WHERE ma.manifest_id IN (SELECT value FROM json_each(@manifestIdsJson))
ORDER BY ma.id
`;