From 52c65a0fbbef46d05c079fb9e084032356102223 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 15 Nov 2018 08:44:56 +0100 Subject: [PATCH 1/2] Bug #799 : No aparece informacion del mana --- .../client/common/methods/receipt/filter.js | 4 +- .../changes/1.2-CHECK/14.clientGetMana.sql | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 services/db/install/changes/1.2-CHECK/14.clientGetMana.sql diff --git a/services/client/common/methods/receipt/filter.js b/services/client/common/methods/receipt/filter.js index d6b03001b..501e155aa 100644 --- a/services/client/common/methods/receipt/filter.js +++ b/services/client/common/methods/receipt/filter.js @@ -37,7 +37,7 @@ module.exports = Self => { c.code AS company, r.created, '' description, - 0 AS debit, + NULL AS debit, r.amountPaid AS credit, r.bankFk, firstName, @@ -56,7 +56,7 @@ module.exports = Self => { i.created, CONCAT(' N/FRA ', i.ref), i.amount, - 0 credit, + NULL credit, NULL, NULL, NULL, diff --git a/services/db/install/changes/1.2-CHECK/14.clientGetMana.sql b/services/db/install/changes/1.2-CHECK/14.clientGetMana.sql new file mode 100644 index 000000000..0356f5e11 --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/14.clientGetMana.sql @@ -0,0 +1,68 @@ +USE `vn`; +DROP function IF EXISTS `clientGetMana`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` FUNCTION `clientGetMana`(vClient INT) RETURNS decimal(10,2) +BEGIN +/** + * Devuelve el maná del cliente. + * + * @param vClient Id del cliente + * @return Maná del cliente + */ + + +DECLARE vMana DECIMAL(10,2); +DECLARE vFromDated DATE; + +SELECT max(dated) INTO vFromDated +FROM vn.clientManaCache; + +SELECT sum(mana) INTO vMana + FROM + ( + SELECT mana + FROM vn.clientManaCache + WHERE clientFk = vClient + AND dated = vFromDated + + UNION ALL + + SELECT s.quantity * Valor + FROM vn.ticket t + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.sale s on s.ticketFk = t.id + JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = s.id + WHERE Id_Componente IN (37, 39) + AND t.shipped > vFromDated + AND t.shipped < TIMESTAMPADD(DAY,1,CURDATE()) + AND a.clientFk = vClient + + UNION ALL + + SELECT - Entregado + FROM vn2008.Recibos r + JOIN vn2008.Clientes c using(Id_Cliente) + WHERE r.Id_Banco = 66 + AND r.Fechacobro > vFromDated + AND r.Fechacobro <= CURDATE() + AND c.Id_Cliente = vClient + + UNION ALL + + SELECT g.Importe + FROM vn2008.Greuges g + JOIN vn2008.Clientes c using(Id_Cliente) + WHERE g.Greuges_type_id = 3 -- Maná + AND g.Fecha > vFromDated + AND g.Fecha <= CURDATE() + AND c.Id_Cliente = vClient + + ) sub; + +RETURN IFNULL(vMana,0); + +END$$ + +DELIMITER ; From f84c5812590bc2bc1363284e7a4dad544c3bc8a4 Mon Sep 17 00:00:00 2001 From: Joan Date: Thu, 15 Nov 2018 08:55:24 +0100 Subject: [PATCH 2/2] refresh filters on tag remove #818 --- client/order/src/filter/index.js | 37 +++++++------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/client/order/src/filter/index.js b/client/order/src/filter/index.js index 0fd3c5f50..724f8ebb3 100644 --- a/client/order/src/filter/index.js +++ b/client/order/src/filter/index.js @@ -11,19 +11,6 @@ class Controller { this.$transitions = $transitions; this.itemTypes = []; this.tags = []; - - /* $transitions.onSuccess({}, transition => { - let params = {}; - if (this.category) - params.category = this.category; - - if (this.type) - params.type = this.type; - - $window.history.replaceState(params); - - this.applyFilters(); - }); */ } get order() { @@ -42,15 +29,12 @@ class Controller { if (this.$stateParams.category) category = JSON.parse(this.$stateParams.category); - if (this.$stateParams.type) type = JSON.parse(this.$stateParams.type); - if (category && category.id) this.category = category; - if (type && type.id) this.type = type; }); @@ -87,16 +71,15 @@ class Controller { set type(value) { if (value && this.type && this.type.id == value.id) return; - if (!value || !value.id) { - this._type = null; - this.updateStateParams(); - - return; - } - this._type = value; + + if (!value || !value.id) + this._type = null; + this.updateStateParams(); - this.applyFilters(); + + if ((value && value.id) || this.tags.length > 0) + this.applyFilters(); } onSearch(event) { @@ -111,7 +94,7 @@ class Controller { remove(index) { this.tags.splice(index, 1); - if (this.tags.length > 0) + if (this.tags.length == 0 && this.category && this.type) this.applyFilters(); } @@ -123,11 +106,9 @@ class Controller { if (this.category) newFilter.categoryFk = this.category.id; - if (this.type) newFilter.typeFk = this.type.id; - newParams = { orderFk: this.order.id, orderBy: this.catalog.getOrderBy(), @@ -169,13 +150,11 @@ class Controller { if (this.category) params.category = JSON.stringify(this.category); - if (this.type) params.type = JSON.stringify(this.type); else params.type = undefined; - this.$state.go(this.$state.current.name, params); } }