diff --git a/db/changes/10390-constitution/00-defaultViewConfig.sql b/db/changes/10390-constitution/00-defaultViewConfig.sql new file mode 100644 index 000000000..75788f581 --- /dev/null +++ b/db/changes/10390-constitution/00-defaultViewConfig.sql @@ -0,0 +1,7 @@ +UPDATE `salix`.`defaultViewConfig` + SET `columns` = '{"intrastat":false,"description":false,"density":false,"isActive":false, + "freightValue":false,"packageValue":false,"isIgnored":false,"price2":false,"minPrice":true, + "ektFk":false,"weight":false,"id":true,"packing":true,"grouping":true,"quantity":true, + "size":false,"name":true,"code":true,"origin":true,"family":true,"entryFk":true,"buyingValue":true, + "comissionValue":false,"price3":true,"packageFk":true,"packingOut":true,"landing":false}' + WHERE tableCode = 'latestBuys' \ No newline at end of file diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 8bae27ab2..04570533c 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -73,6 +73,16 @@ module.exports = Self => { arg: 'packingOut', type: 'integer', description: 'the packingOut', + }, + { + arg: 'from', + type: 'date', + description: `The from date filter` + }, + { + arg: 'to', + type: 'date', + description: `The to date filter` } ], returns: { @@ -117,6 +127,10 @@ module.exports = Self => { return {'i.isActive': value}; case 'floramondo': return {'i.isFloramondo': value}; + case 'from': + return {'lb.landing': {gte: value}}; + case 'to': + return {'lb.landing': {lte: value}}; case 'visible': if (value) return {'v.visible': {gt: 0}}; @@ -176,7 +190,8 @@ module.exports = Self => { b.price3, b.ektFk, b.weight, - b.packageFk + b.packageFk, + lb.landing FROM cache.last_buy lb LEFT JOIN cache.visible v ON v.item_id = lb.item_id AND v.calc_id = @calc_id diff --git a/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js b/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js index f4a404fa4..2a9e86060 100644 --- a/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js +++ b/modules/entry/back/methods/entry/specs/latestBuysFilter.spec.js @@ -172,5 +172,24 @@ describe('Buy latests buys filter()', () => { expect(results.length).toBe(2); }); + + it('should return results matching "from" and "to"', async() => { + const from = new Date(); + from.setHours(0, 0, 0, 0); + + const to = new Date(); + to.setHours(23, 59, 59, 999); + + let ctx = { + args: { + from: from, + to: to, + } + }; + + let results = await app.models.Buy.latestBuysFilter(ctx); + + expect(results.length).toBe(2); + }); }); diff --git a/modules/entry/front/latest-buys-search-panel/index.html b/modules/entry/front/latest-buys-search-panel/index.html index c829a25ba..3ef688f58 100644 --- a/modules/entry/front/latest-buys-search-panel/index.html +++ b/modules/entry/front/latest-buys-search-panel/index.html @@ -58,6 +58,18 @@ {{name}}: {{nickname}} + + + + + + Package out + + Landing + @@ -207,6 +210,7 @@ {{::buy.weight}} {{::buy.packageFk}} {{::buy.packingOut}} + {{::buy.landing | date: 'dd/MM/yyyy'}} diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index e899c50fa..ed6629262 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -76,7 +76,8 @@ export default class Controller extends Section { {field: 'description', displayName: this.$t('Description')}, {field: 'size', displayName: this.$t('Size')}, {field: 'density', displayName: this.$t('Density')}, - {field: 'packingOut', displayName: this.$t('PackingOut')} + {field: 'packingOut', displayName: this.$t('PackingOut')}, + {field: 'landing', displayName: this.$t('Landing')} ]; return this._columns; @@ -112,6 +113,8 @@ export default class Controller extends Section { return {'intr.description': value}; case 'origin': return {'ori.code': value}; + case 'landing': + return {[`lb.${param}`]: value}; case 'packing': case 'grouping': case 'quantity':