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);