Removed filter import
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-04-01 13:55:01 +02:00
parent 389f10bda0
commit 91c26ee5a5
1 changed files with 3 additions and 8 deletions

View File

@ -148,24 +148,19 @@ module.exports = Self => {
s.name AS supplierName, s.name AS supplierName,
s.nickname AS supplierAlias, s.nickname AS supplierAlias,
co.code AS companyCode, co.code AS companyCode,
cu.code AS currencyCode, cu.code AS currencyCode
IF(b.buyingValue, SUM(b.quantity * b.buyingValue), 0) AS totalEntry
FROM vn.entry e FROM vn.entry e
JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.travel t ON t.id = e.travelFk JOIN vn.travel t ON t.id = e.travelFk
JOIN vn.company co ON co.id = e.companyFk JOIN vn.company co ON co.id = e.companyFk
JOIN vn.currency cu ON cu.id = e.currencyFk JOIN vn.currency cu ON cu.id = e.currencyFk`
LEFT JOIN vn.buy b ON b.entryFk = e.id`
); );
stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('b.entryFk'));
stmt.merge(conn.makeLimit(filter));
stmt.merge(conn.makeSuffix(filter));
let itemsIndex = stmts.push(stmt) - 1; let itemsIndex = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';'); let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql); let result = await conn.executeStmt(sql);
return itemsIndex === 0 ? result : result[itemsIndex]; return itemsIndex === 0 ? result : result[itemsIndex];
}; };
}; };