From b8b055b86c8ed7c2b950cfbefbbabb8b6750d224 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 2 May 2024 08:00:44 +0200 Subject: [PATCH] hotFix(getBalance): date setHours to 0 --- modules/item/back/methods/item/getBalance.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item/getBalance.js b/modules/item/back/methods/item/getBalance.js index d4e2d0f74..20df8eeec 100644 --- a/modules/item/back/methods/item/getBalance.js +++ b/modules/item/back/methods/item/getBalance.js @@ -27,8 +27,12 @@ module.exports = Self => { const where = filter.where; const query = 'CALL vn.item_getBalance(?, ?, ?)'; - const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, where.date], myOptions); - + let date; + if (where.date) { + date = new Date(where.date); + date.setHours(0, 0, 0, 0); + } + const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, date], myOptions); for (const entry of diary) if (entry.clientType === 'loses') entry.highlighted = true;