From 1ceab52d0d234dda0d1dcb68ed60cc5554733a10 Mon Sep 17 00:00:00 2001 From: Bernat Exposito Date: Tue, 20 Mar 2018 15:01:49 +0100 Subject: [PATCH] update fixtures for bi.rotacion and add mobel annualAverageInvoiced --- services/db/04-fixtures.sql | 9 ++++++- .../1.0.2/06-annualAverageInvoiced.sql | 10 ++++++++ .../common/models/annualAverageInvoiced.json | 24 +++++++++++++++++++ services/ticket/server/model-config.json | 3 +++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 services/db/changes/1.0.2/06-annualAverageInvoiced.sql create mode 100644 services/ticket/common/models/annualAverageInvoiced.json diff --git a/services/db/04-fixtures.sql b/services/db/04-fixtures.sql index 6ce558cc5..5796bd823 100644 --- a/services/db/04-fixtures.sql +++ b/services/db/04-fixtures.sql @@ -509,4 +509,11 @@ INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, ` ( 1, 101, CURDATE(), date_add(CURDATE(),INTERVAL 1 MONTH), 50, 7), ( 2, 102, CURDATE(), date_add(CURDATE(),INTERVAL 3 MONTH), 100, 1), ( 3, 102, CURDATE(), date_add(CURDATE(),INTERVAL 1 MONTH), 50, 7), - ( 4, 103, CURDATE(), NULL, 50, 7); \ No newline at end of file + ( 4, 103, CURDATE(), NULL, 50, 7); + +INSERT INTO `bi`.`rotacion`(`Id_Article`, `warehouse_id`, `total`, `rotacion`, `cm3`, `almacenaje`, `manipulacion`, `auxiliar`, `mermas`) + VALUES + ( 1, 1, 0, 0.0000, 1500, 0.0015, 0.0250, 0.0085, 0.0000), + ( 1, 2, 0, 0.0000, 100, 0.0060, 0.0200, 0.0080, 0.0000), + ( 2, 1, 10, 3.5000, 0, 0.0000, 0.0000, 0.0080, 0.0000), + ( 3, 1, 50, 5.5000, 100, 0.0000, 0.0000, 0.0080, 0.0000); \ No newline at end of file diff --git a/services/db/changes/1.0.2/06-annualAverageInvoiced.sql b/services/db/changes/1.0.2/06-annualAverageInvoiced.sql new file mode 100644 index 000000000..df0cd4dc8 --- /dev/null +++ b/services/db/changes/1.0.2/06-annualAverageInvoiced.sql @@ -0,0 +1,10 @@ +USE `vn`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`annualAverageInvoiced` AS + SELECT + `e`.`Id_Cliente` AS `clientFk`, `e`.`Consumo` AS `invoiced` + FROM + `bi`.`facturacion_media_anual` `e`; diff --git a/services/ticket/common/models/annualAverageInvoiced.json b/services/ticket/common/models/annualAverageInvoiced.json new file mode 100644 index 000000000..d1f582011 --- /dev/null +++ b/services/ticket/common/models/annualAverageInvoiced.json @@ -0,0 +1,24 @@ +{ + "name": "AnnualAverageInvoiced", + "base": "VnModel", + "options": { + "mysql": { + "table": "annualAverageInvoiced" + } + }, + "properties": { + "invoiced": { + "type": "Number" + }, + "clientFk": { + "id": true + } + }, + "relations": { + "client": { + "type": "belongsTo", + "model": "client", + "foreignKey": "clientFk" + } + } +} \ No newline at end of file diff --git a/services/ticket/server/model-config.json b/services/ticket/server/model-config.json index 2bcc701ef..7d2bf6776 100644 --- a/services/ticket/server/model-config.json +++ b/services/ticket/server/model-config.json @@ -28,6 +28,9 @@ }, "Expedition": { "dataSource": "vn" + }, + "AnnualAverageInvoiced": { + "dataSource": "vn" } }