diff --git a/modules/item/back/methods/item/getWasteDetail.js b/modules/item/back/methods/item/getWasteDetail.js index edaebf2f2..906269044 100644 --- a/modules/item/back/methods/item/getWasteDetail.js +++ b/modules/item/back/methods/item/getWasteDetail.js @@ -14,18 +14,7 @@ module.exports = Self => { }); Self.getWasteDetail = async() => { - const wastes = await Self.rawSql(` - SELECT *, 100 * dwindle / total AS percentage - FROM ( - SELECT buyer, - ws.family, - sum(ws.saleTotal) AS total, - sum(ws.saleWaste) AS dwindle - FROM bs.waste ws - WHERE year = YEAR(CURDATE()) AND week = WEEK(CURDATE(), 1) - GROUP BY buyer, family - ) sub - ORDER BY percentage DESC;`); + const [wastes] = await Self.rawSql(`CALL bs.weekWaste_getDetail()`); const details = []; diff --git a/modules/item/front/waste/index.html b/modules/item/front/waste/index.html index 059f82db8..d363f0ce0 100644 --- a/modules/item/front/waste/index.html +++ b/modules/item/front/waste/index.html @@ -12,16 +12,16 @@ - Family - Percentage + Family + Percentage Dwindle Total - {{::waste.family}} - {{::(waste.percentage / 100) | percentage: 2}} + {{::waste.family}} + {{::(waste.percentage / 100) | percentage: 2}} {{::waste.dwindle | currency: 'EUR'}} {{::waste.total | currency: 'EUR'}} diff --git a/modules/item/front/waste/style.scss b/modules/item/front/waste/style.scss index ed8d10369..59e9a3b68 100644 --- a/modules/item/front/waste/style.scss +++ b/modules/item/front/waste/style.scss @@ -16,4 +16,10 @@ vn-item-waste { overflow: hidden; text-overflow: ellipsis; } + + vn-table vn-th.waste-family, + vn-table vn-td.waste-family { + max-width: 4em; + width: 4em + } } \ No newline at end of file