From 5db1262e082d52d2f5333f7c452aa30a5d69d723 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 27 Nov 2024 10:24:13 +0100 Subject: [PATCH] feat: refs #7936 add company filter --- .../invoiceIn/back/methods/invoice-in/filter.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/invoiceIn/back/methods/invoice-in/filter.js b/modules/invoiceIn/back/methods/invoice-in/filter.js index 936f7bb6c..c549769ab 100644 --- a/modules/invoiceIn/back/methods/invoice-in/filter.js +++ b/modules/invoiceIn/back/methods/invoice-in/filter.js @@ -91,6 +91,10 @@ module.exports = Self => { { arg: 'supplierActivityFk', type: 'string', + }, + { + arg: 'companyFk', + type: 'number', } ], returns: { @@ -161,8 +165,8 @@ module.exports = Self => { : {'ii.id': {nin: correcteds.map(x => x.correctingFk)}}; case 'correctedFk': return {'ii.id': {inq: correctings.map(x => x.correctingFk)}}; - case 'supplierActivityFk': - return {'s.supplierActivityFk': value}; + case 'companyFk': + return {'ii.companyFk': value}; } }); @@ -184,7 +188,8 @@ module.exports = Self => { s.name supplierName, s.account, SUM(iid.amount) amount, - sub.code awbCode + sub.code awbCode, + c.code FROM invoiceIn ii JOIN supplier s ON s.id = ii.supplierFk LEFT JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id @@ -199,7 +204,8 @@ module.exports = Self => { GROUP BY de.duaFk ) sub ON sub.duaFk = d.id LEFT JOIN company co ON co.id = ii.companyFk - LEFT JOIN dms dm ON dm.id = ii.docFk` + LEFT JOIN dms dm ON dm.id = ii.docFk + JOIN company c ON c.id = ii.companyFk`, ); const sqlWhere = conn.makeWhere(filter.where);