diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index 63d2c05d9..318945c08 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -66,14 +66,7 @@ BEGIN ELSE 1 END AS minQuantity, iss.visible located, - b.price, - b.price1, - b.price2, - b.price3, - a.price, - a.price1, - a.price2, - a.price3, + b.price2 FROM vn.item i JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalcFk @@ -87,6 +80,7 @@ BEGIN LEFT JOIN vn.buy b ON b.id = lb.buy_id LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id AND iss.warehouseFk = vWarehouseFk + LEFT JOIN vn.ink ink ON ink.id = i.tag5 JOIN itemTags its WHERE a.available > 0 AND (i.typeFk = its.typeFk OR NOT vShowType) @@ -95,6 +89,7 @@ BEGIN (t.name = its.name) DESC, (it.value = its.value) DESC, (i.tag5 = its.tag5) DESC, + (ink.`showOrder`) DESC, match5 DESC, (i.tag6 = its.tag6) DESC, match6 DESC, diff --git a/modules/item/back/methods/item/getSimilar.js b/modules/item/back/methods/item/getSimilar.js index f8115fb5e..1fc39cb1c 100644 --- a/modules/item/back/methods/item/getSimilar.js +++ b/modules/item/back/methods/item/getSimilar.js @@ -26,7 +26,11 @@ module.exports = Self => { Object.assign(myOptions, options); const where = filter.where; - const query = [where.itemFk, where.warehouseFk, where.date ?? Date.now(), where.showType ?? true]; + const today = + new Date().toLocaleDateString('es-ES', {year: 'numeric', + month: '2-digit', + day: '2-digit'}); + const query = [where.itemFk, where.warehouseFk, where.date ?? today, where.showType ?? true]; const [results] = await Self.rawSql('CALL vn.item_getSimilar(?, ?, ?, ?)', query, myOptions); return [