This commit is contained in:
seb
2026-09-26 23:05:48 +02:00
parent 454c5ab6bf
commit 3ab9d904e6
12 changed files with 1505 additions and 65 deletions

View File

@@ -116,6 +116,7 @@ export async function fetchDeliveryLedgerSummary(deliveryId, { deliveryApi = def
* @param {Object} params
* @param {Object} params.delivery - The delivery object (used for transaction memo and fallback)
* @param {Array<{ manifestarticleId?: number, id?: number, amount: number, sku?: string }>} params.linesToBook
* @param {number|string} params.warehouseId - Mandatory warehouse ID
* @param {Object} [params.ledgerApi]
* @param {string} [params.transactionText]
* @returns {Promise<Array<Object>>}
@@ -123,9 +124,15 @@ export async function fetchDeliveryLedgerSummary(deliveryId, { deliveryApi = def
export async function bookDeliveryLines({
delivery,
linesToBook,
warehouseId,
ledgerApi = defaultLedgerApi,
transactionText,
}) {
const numericWarehouseId = Number(warehouseId);
if (!numericWarehouseId || numericWarehouseId <= 0) {
throw new Error('Bitte wählen Sie ein Lager aus.');
}
if (!Array.isArray(linesToBook) || linesToBook.length === 0) {
return [];
}
@@ -147,6 +154,7 @@ export async function bookDeliveryLines({
const res = await ledgerApi.add({
manifestarticle_id: manifestarticleId,
warehouse_id: numericWarehouseId,
transaction_type: 'DELIVERY',
amount,
transaction_text: memo,