This commit is contained in:
Joan Sanchez 2020-01-21 09:23:58 +01:00
commit 1d6edabb10
3 changed files with 11 additions and 16 deletions

View File

@ -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 = [];

View File

@ -12,16 +12,16 @@
<vn-table>
<vn-thead>
<vn-tr>
<vn-th>Family</vn-th>
<vn-th shrink>Percentage</vn-th>
<vn-th class="waste-family">Family</vn-th>
<vn-th number>Percentage</vn-th>
<vn-th number>Dwindle</vn-th>
<vn-th number>Total</vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="waste in detail.lines">
<vn-td>{{::waste.family}}</vn-td>
<vn-td shrink>{{::(waste.percentage / 100) | percentage: 2}}</vn-td>
<vn-td class="waste-family">{{::waste.family}}</vn-td>
<vn-td number>{{::(waste.percentage / 100) | percentage: 2}}</vn-td>
<vn-td number>{{::waste.dwindle | currency: 'EUR'}}</vn-td>
<vn-td number>{{::waste.total | currency: 'EUR'}}</vn-td>
</vn-tr>

View File

@ -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
}
}