This commit is contained in:
seb
2026-07-14 23:30:16 +02:00
parent 245fb047d7
commit 262fa63f1b
109 changed files with 21566 additions and 367 deletions

View File

@@ -0,0 +1,23 @@
import sql from 'mssql';
import { getPool } from '../db.js';
import { getActiveShopSubshopId } from '../shop.js';
const MAX_ORDER_ID_SQL = `
SELECT ISNULL(MAX(kPosAuftrag), 0) AS MaxOrderId
FROM Pos.tAuftragMapping
WHERE kShopSubShop = @kShopSubShop;
`;
export async function getMaxOrderIdCount() {
const kShopSubShop = getActiveShopSubshopId();
if (!kShopSubShop) {
return 0;
}
const result = await getPool()
.request()
.input('kShopSubShop', sql.Int, kShopSubShop)
.query(MAX_ORDER_ID_SQL);
return result.recordset[0]?.MaxOrderId ?? 0;
}