diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index f392dba87..eba0b0f91 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -44,6 +44,10 @@ module.exports = Self => { arg: 'description', type: 'String', description: 'The item description', + }, { + arg: 'stemMultiplier', + type: 'Integer', + description: 'The item multiplier', } ], returns: { @@ -80,16 +84,22 @@ module.exports = Self => { : {or: [{'i.name': {like: `%${value}%`}}, codeWhere]}; case 'id': return {'i.id': value}; - case 'description': - return {'i.description': {like: `%${value}%`}}; - case 'categoryFk': - return {'ic.id': value}; - case 'salesPersonFk': - return {'t.workerFk': value}; - case 'typeFk': - return {'i.typeFk': value}; case 'isActive': return {'i.isActive': value}; + case 'multiplier': + return {'i.stemMultiplier': value}; + case 'typeFk': + return {'i.typeFk': value}; + case 'category': + return {'ic.name': value}; + case 'salesPersonFk': + return {'it.workerFk': value}; + case 'origin': + return {'ori.code': value}; + case 'niche': + return {'ip.code': value}; + case 'intrastat': + return {'intr.description': value}; } }); filter = mergeFilters(filter, {where}); @@ -98,7 +108,8 @@ module.exports = Self => { let stmt; stmt = new ParameterizedSQL( - `SELECT i.id, + `SELECT + i.id, i.image, i.name, i.description, @@ -111,29 +122,30 @@ module.exports = Self => { i.tag10, i.value10, i.subName, i.isActive, - t.name type, - t.workerFk buyerFk, - u.name userName, - intr.description AS intrastat, i.stems, - ori.code AS origin, - ic.name AS category, i.density, i.stemMultiplier, + i.typeFk, + it.name AS typeName, + it.workerFk AS buyerFk, + u.name AS userName, + ori.code AS origin, + ic.name AS category, + intr.description AS intrastat, b.grouping, b.packing, - itn.code AS niche, @visibleCalc + ip.code AS niche, @visibleCalc FROM item i - LEFT JOIN itemType t ON t.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = t.categoryFk - LEFT JOIN worker w ON w.id = t.workerFk + LEFT JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN worker w ON w.id = it.workerFk LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN intrastat intr ON intr.id = i.intrastatFk LEFT JOIN producer pr ON pr.id = i.producerFk LEFT JOIN origin ori ON ori.id = i.originFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = it.warehouseFk LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN itemPlacement itn ON itn.itemFk = i.id AND itn.warehouseFk = t.warehouseFk` + LEFT JOIN itemPlacement ip ON ip.itemFk = i.id AND ip.warehouseFk = it.warehouseFk` ); if (ctx.args.tags) { diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 3f049675c..cec7a063f 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -113,6 +113,12 @@ ng-model="$ctrl.item.stems" rule> + + - - - - - Id - Grouping - Packing - Description - Stems - Size - Niche - Type - Category - Intrastat - Origin - Buyer - Density - Multiplier - Active - - - - - - - - - - - {{::item.id}} - - - {{::item.grouping | dashIfEmpty}} - {{::item.packing | dashIfEmpty}} - - {{::item.name}} - -

{{::item.subName}}

-
- - -
- {{::item.stems}} - {{::item.size}} - {{::item.niche}} - - {{::item.type}} - - - {{::item.category}} - - - {{::item.intrastat}} - - {{::item.origin}} - - - {{::item.userName}} - - - {{::item.density}} - {{::item.stemMultiplier}} - - - - - - - - - - - - -
-
-
+ + + + + Id + Grouping + Packing + Description + Stems + Size + Niche + Type + Category + Intrastat + Origin + Buyer + Density + Multiplier + Active + + + + + + + + + + + {{::item.id}} + + + {{::item.grouping | dashIfEmpty}} + {{::item.packing | dashIfEmpty}} + + {{::item.name}} + +

{{::item.subName}}

+
+ + +
+ {{::item.stems}} + {{::item.size}} + {{::item.niche}} + + {{::item.typeName}} + + + {{::item.category}} + + + {{::item.intrastat}} + + {{::item.origin}} + + + {{::item.userName}} + + + {{::item.density}} + {{::item.stemMultiplier}} + + + + + + + + + + + + +
+
+
@@ -127,4 +127,31 @@ - \ No newline at end of file + + + + + Filter by selection + + + Exclude selection + + + Remove filter + + + Remove all filters + + + \ No newline at end of file diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index cafa3e475..175beb88a 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -11,6 +11,36 @@ class Controller extends Section { }; } + exprBuilder(param, value) { + switch (param) { + case 'category': + return {'ic.name': value}; + case 'salesPersonFk': + return {'it.workerFk': value}; + case 'grouping': + return {'b.grouping': value}; + case 'packing': + return {'b.packing': value}; + case 'origin': + return {'ori.code': value}; + case 'niche': + return {'ip.code': value}; + case 'typeFk': + return {'i.typeFk': value}; + case 'intrastat': + return {'intr.description': value}; + case 'id': + case 'size': + case 'name': + case 'subname': + case 'isActive': + case 'density': + case 'stemMultiplier': + case 'stems': + return {[`i.${param}`]: value}; + } + } + onCloneAccept(itemFk) { return this.$http.post(`Items/${itemFk}/clone`) .then(res => { diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index 59ceaebbe..67d3bf3c6 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -55,6 +55,9 @@ + +