From 5abe575fbe1001a3953f91998dfc888f804bc460 Mon Sep 17 00:00:00 2001 From: Bernat Date: Thu, 17 Jan 2019 11:15:23 +0100 Subject: [PATCH 01/16] update fixture and export structure #9462 #9437 --- e2e/paths/ticket-module/07_edit_sale.spec.js | 2 +- services/db/export-data.cmd | 18 - services/db/export-structure.cmd | 2 - services/db/export-structure.sh | 2 +- .../changes/1.0-OnlyLocal/06-entity.sql | 61 - services/db/install/dump/fixtures.sql | 29 +- services/db/install/dump/structure.sql | 4395 +++++++++++++++-- 7 files changed, 3944 insertions(+), 565 deletions(-) delete mode 100755 services/db/export-data.cmd delete mode 100755 services/db/export-structure.cmd delete mode 100644 services/db/install/changes/1.0-OnlyLocal/06-entity.sql diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 7419056cc..239c0e83e 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -214,7 +214,7 @@ describe('Ticket Edit sale path', () => { .wait(selectors.claimBasicData.claimStateAutocomplete) .parsedUrl(); - expect(url.hash).toEqual('#!/claim/6/basic-data'); + expect(url.hash).toEqual('#!/claim/5/basic-data'); }); it('should click on the Claims button of the top bar menu', async() => { diff --git a/services/db/export-data.cmd b/services/db/export-data.cmd deleted file mode 100755 index 4536649d8..000000000 --- a/services/db/export-data.cmd +++ /dev/null @@ -1,18 +0,0 @@ -::IMPORTANT Any changes in this file are to applyed to mirror file export-data.sh -echo USE `account`; > install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql -echo USE `salix`; >> install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info salix ACL fieldAcl>> install/dump/dumpedFixtures.sql -echo USE `vn`; >> install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/dumpedFixtures.sql -echo USE `vn2008`; >> install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql -echo USE `bi`; >> install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql -echo USE `cache`; >> install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql -echo USE `hedera`; >> install/dump/dumpedFixtures.sql -mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql - - - diff --git a/services/db/export-structure.cmd b/services/db/export-structure.cmd deleted file mode 100755 index 59e924034..000000000 --- a/services/db/export-structure.cmd +++ /dev/null @@ -1,2 +0,0 @@ -::IMPORTANT Any changes in this file are to applyed to mirror file export-structure.sh -mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql diff --git a/services/db/export-structure.sh b/services/db/export-structure.sh index 2c88932b4..89940683b 100755 --- a/services/db/export-structure.sh +++ b/services/db/export-structure.sh @@ -1,3 +1,3 @@ #!/bin/bash #IMPORTANT Any changes in this file are to applyed to mirror file export-structure.cmd -mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql +mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock postgresql> install/dump/structure.sql diff --git a/services/db/install/changes/1.0-OnlyLocal/06-entity.sql b/services/db/install/changes/1.0-OnlyLocal/06-entity.sql deleted file mode 100644 index 6f8369743..000000000 --- a/services/db/install/changes/1.0-OnlyLocal/06-entity.sql +++ /dev/null @@ -1,61 +0,0 @@ -/** -* Cambios para evitar fallos en local. -* Ya está en producción -**/ - -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `client` AS - SELECT - `c`.`id_cliente` AS `id`, - `c`.`cliente` AS `name`, - `c`.`if` AS `fi`, - `c`.`razonSocial` AS `socialName`, - `c`.`contacto` AS `contact`, - `c`.`domicilio` AS `street`, - `c`.`poblacion` AS `city`, - `c`.`codPostal` AS `postcode`, - `c`.`telefono` AS `phone`, - `c`.`movil` AS `mobile`, - `c`.`fax` AS `fax`, - `c`.`real` AS `isRelevant`, - `c`.`e-mail` AS `email`, - `c`.`iban` AS `iban`, - `c`.`vencimiento` AS `dueDay`, - `c`.`Cuenta` AS `accountingAccount`, - `c`.`RE` AS `isEqualizated`, - `c`.`province_id` AS `provinceFk`, - `c`.`invoice` AS `hasToInvoice`, - `c`.`credito` AS `credit`, - `c`.`Id_Pais` AS `countryFk`, - `c`.`activo` AS `isActive`, - `c`.`gestdoc_id` AS `gestdocFk`, - `c`.`calidad` AS `quality`, - `c`.`pay_met_id` AS `payMethodFk`, - `c`.`created` AS `created`, - `c`.`mail` AS `isToBeMailed`, - `c`.`chanel_id` AS `contactChannelFk`, - `c`.`sepaVnl` AS `hasSepaVnl`, - `c`.`coreVnl` AS `hasCoreVnl`, - `c`.`coreVnh` AS `hasCoreVnh`, - `c`.`hasLcr` AS `hasLcr`, - `c`.`default_address` AS `defaultAddressFk`, - `c`.`risk_calculated` AS `riskCalculated`, - `c`.`clientes_tipo_id` AS `clientTypeFk`, - `c`.`mail_address` AS `mailAddress`, - `c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`, - `c`.`invoiceByAddress` AS `hasToInvoiceByAddress`, - `c`.`contabilizado` AS `isTaxDataChecked`, - `c`.`congelado` AS `isFreezed`, - `c`.`creditInsurance` AS `creditInsurance`, - `c`.`isCreatedAsServed` AS `isCreatedAsServed`, - `c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`, - `c`.`Id_Trabajador` AS `salesPersonFk`, - `c`.`vies` AS `isVies`, - `c`.`EYPBC` AS `eypbc`, - bankEntityFk - FROM - `vn2008`.`Clientes` `c`; diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 68b5f484a..4b92486b0 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -550,8 +550,9 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric (11, 1, 16, 'Object1 Gem1 5', 2, 9.10, 0, 0, 0, CURDATE()), (12, 4, 16, 'Object4 Armor2 2', 20, 3.06, 0, 0, 0, CURDATE()), (13, 2, 8, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()), - (14, 1, 19, 'Object1 Gem1 5', 10, 1.50, 0, 0, 0, CURDATE()), - (15, 2, 20, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()); + (14, 1, 8, 'Object1 Gem1 5', 10, 2.30, 0, 0, 0, CURDATE()), + (15, 1, 19, 'Object1 Gem1 5', 10, 1.50, 0, 0, 0, CURDATE()), + (16, 2, 20, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()); INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) VALUES @@ -627,11 +628,16 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (14, 28, 20.72), (14, 29, -18.72), (14, 39, 0.02), - (15, 15, 0.058), - (15, 21, 0.002), - (15, 28, 5.6), - (15, 29, -4.6), - (15, 39, 0.01); + (15, 15, 0.58), + (15, 23, 6.5), + (15, 28, 20.72), + (15, 29, -18.72), + (15, 39, 0.02), + (16, 15, 0.058), + (16, 21, 0.002), + (16, 28, 5.6), + (16, 29, -4.6), + (16, 39, 0.01); INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`) VALUES @@ -966,8 +972,7 @@ INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, ` ( 1, CURDATE(), 1, 'observation one', 101, 18, 1, 0, CURDATE()), ( 2, CURDATE(), 2, 'observation two', 101, 18, 2, 0, CURDATE()), ( 3, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 3, 'observation three', 101, 18, 3, 0, CURDATE()), - ( 4, CURDATE(), 3, 'observation four', 104, 18, 1, 0, CURDATE()), - ( 5, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 3, 'observation five', 104, 18, 3, 0, CURDATE()); + ( 4, CURDATE(), 3, 'observation four', 104, 18, 1, 0, CURDATE()); INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) VALUES @@ -975,8 +980,7 @@ INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`) ( 2, 1, 8, 4), ( 3, 2, 10, 10), ( 4, 3, 6, 5), - ( 5, 4, 13, 5), - ( 6, 5, 13, 3); + ( 5, 4, 13, 5); INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`) VALUES @@ -992,8 +996,7 @@ INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `work ( 2, 1, 1, 21, 7 , 2, 2, 5), ( 3, 2, 7, 21, 9 , 3, 2, 5), ( 4, 3, 7, 21, 15, 8, 2, 5), - ( 5, 4, 7, 21, 7, 8, 2, 5), - ( 6, 5, 7, 21, 15, 8, 2, 5); + ( 5, 4, 7, 21, 7, 8, 2, 5); INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `secretKey`) VALUES diff --git a/services/db/install/dump/structure.sql b/services/db/install/dump/structure.sql index dbf6444d3..b05ec09c9 100644 --- a/services/db/install/dump/structure.sql +++ b/services/db/install/dump/structure.sql @@ -363,7 +363,7 @@ CREATE TABLE `user` ( KEY `nickname` (`nickname`), KEY `lang` (`lang`), CONSTRAINT `user_ibfk_2` FOREIGN KEY (`role`) REFERENCES `role` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14963 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDB AUTO_INCREMENT=15021 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2440,7 +2440,7 @@ CREATE TABLE `Agencias` ( PRIMARY KEY (`Id_Agencia`), KEY `Agencias` (`Agencia`), KEY `Vista` (`Vista`) -) ENGINE=InnoDB AUTO_INCREMENT=1217 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1219 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2459,7 +2459,7 @@ CREATE TABLE `Agencias_dits` ( `value_old` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `value_new` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`idAgencia_dits`) -) ENGINE=InnoDB AUTO_INCREMENT=32282 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=32644 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2577,7 +2577,7 @@ CREATE TABLE `Articles` ( CONSTRAINT `Articles_ibfk_5` FOREIGN KEY (`tipo_id`) REFERENCES `Tipos` (`tipo_id`) ON UPDATE CASCADE, CONSTRAINT `expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `Gastos` (`Id_Gasto`) ON UPDATE CASCADE, CONSTRAINT `producer_id` FOREIGN KEY (`producer_id`) REFERENCES `producer` (`producer_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=333187 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=334626 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -2759,7 +2759,7 @@ CREATE TABLE `Articles_dits` ( KEY `fgkey1_idx` (`idaccion_dits`), KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`) -) ENGINE=InnoDB AUTO_INCREMENT=20958 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=21067 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2782,7 +2782,7 @@ CREATE TABLE `Articles_nicho` ( KEY `Articles_nicho_wh_fk` (`warehouse_id`), CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=641350 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=651203 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -2908,7 +2908,7 @@ CREATE TABLE `Cajas` ( KEY `warehouse_id` (`warehouse_id`), KEY `fk_Cajas_Proveedores_account1_idx` (`Proveedores_account_Id`), CONSTRAINT `Cajas_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=649466 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=652925 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3036,8 +3036,8 @@ CREATE TABLE `Clientes` ( `hasInvoiceSimplified` tinyint(1) NOT NULL DEFAULT '0', `iban` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `hasLcr` tinyint(1) NOT NULL DEFAULT '0', - `bankEntityFk` int(10) unsigned DEFAULT NULL, - `clientTypeFk` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT 'normal', + `bankEntityFk` int(10) DEFAULT NULL, + `typeFk` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT 'normal', PRIMARY KEY (`id_cliente`), UNIQUE KEY `IF` (`if`), KEY `Id_Trabajador` (`Id_Trabajador`), @@ -3052,17 +3052,16 @@ CREATE TABLE `Clientes` ( KEY `tipos_de_cliente_idx` (`clientes_tipo_id`), KEY `codpos` (`codpos`,`codPostal`), KEY `fk_Clientes_entity_idx` (`bankEntityFk`), - KEY `clientTypeCode` (`clientTypeFk`), + KEY `typeFk` (`typeFk`), CONSTRAINT `Clientes_ibfk_1` FOREIGN KEY (`Id_Pais`) REFERENCES `Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_2` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_4` FOREIGN KEY (`default_address`) REFERENCES `Consignatarios` (`id_consigna`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `Clientes_ibfk_5` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, CONSTRAINT `canal_nuevo_cliente` FOREIGN KEY (`chanel_id`) REFERENCES `chanel` (`chanel_id`) ON UPDATE CASCADE, - CONSTRAINT `clientTypeCode` FOREIGN KEY (`clientTypeFk`) REFERENCES `clientes_tipo` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_Clientes_entity` FOREIGN KEY (`bankEntityFk`) REFERENCES `entity` (`entity_id`) ON UPDATE CASCADE, - CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientes_tipo_id`) REFERENCES `clientes_tipo` (`clientes_tipo_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14963 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientes_tipo_id`) REFERENCES `clientes_tipo` (`clientes_tipo_id`) ON UPDATE CASCADE, + CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientes_tipo` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=15021 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3345,7 +3344,7 @@ CREATE TABLE `Colas` ( CONSTRAINT `Colas_ibfk_3` FOREIGN KEY (`Id_Prioridad`) REFERENCES `Prioridades` (`Id_Prioridad`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_4` FOREIGN KEY (`Id_Impresora`) REFERENCES `Impresoras` (`Id_Impresora`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_5` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=51833 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=72847 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3427,7 +3426,7 @@ CREATE TABLE `Compres` ( CONSTRAINT `Compres_ibfk_2` FOREIGN KEY (`Id_Cubo`) REFERENCES `Cubos` (`Id_Cubo`) ON UPDATE CASCADE, CONSTRAINT `Compres_ibfk_3` FOREIGN KEY (`container_id`) REFERENCES `container` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=284330364 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=287542114 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3547,7 +3546,7 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `CompresBeforeUpdate` - BEFORE UPDATE ON `Compres` FOR EACH ROW + BEFORE UPDATE ON `Compres` FOR EACH ROW BEGIN IF NEW.grouping = 0 AND OLD.grouping <> 0 THEN SIGNAL SQLSTATE '45000' @@ -3672,7 +3671,7 @@ CREATE TABLE `Compres_ok` ( KEY `Id_Movimiento` (`Id_Compra`), KEY `Id_Accion` (`Id_Accion`), CONSTRAINT `Compres_ok_ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26748 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26996 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -3716,7 +3715,7 @@ CREATE TABLE `Consignatarios` ( CONSTRAINT `Consignatarios_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE, CONSTRAINT `Consignatarios_ibfk_4` FOREIGN KEY (`Id_Agencia`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `address_customer_id` FOREIGN KEY (`Id_cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26463 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26552 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3900,7 +3899,7 @@ CREATE TABLE `Contactos` ( PRIMARY KEY (`Id_Contacto`), KEY `Telefono` (`Telefono`), KEY `Movil` (`Movil`) -) ENGINE=InnoDB AUTO_INCREMENT=2678 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2679 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4097,7 +4096,7 @@ CREATE TABLE `Entradas` ( CONSTRAINT `Entradas_ibfk_1` FOREIGN KEY (`Id_Proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_6` FOREIGN KEY (`travel_id`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, CONSTRAINT `Entradas_ibfk_7` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=157676 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDB AUTO_INCREMENT=158678 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4258,7 +4257,7 @@ CREATE TABLE `Entradas_dits` ( CONSTRAINT `Entradas_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey_entradas_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey_entradas_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3251456 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3277788 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4276,7 +4275,7 @@ CREATE TABLE `Entradas_kop` ( PRIMARY KEY (`Id_Entradas_kop`), KEY `entradas_entradas_kop_idx` (`Id_Entrada`), CONSTRAINT `entradas_entradas_kop` FOREIGN KEY (`Id_Entrada`) REFERENCES `Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=565 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB AUTO_INCREMENT=670 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4364,7 +4363,7 @@ CREATE TABLE `Equipos` ( PRIMARY KEY (`id`), KEY `trabajador_id` (`trabajador_id`), CONSTRAINT `Equipos_ibfk_1` FOREIGN KEY (`trabajador_id`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=175 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=178 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -4520,7 +4519,7 @@ CREATE TABLE `Facturas` ( CONSTRAINT `Facturas_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `vn`.`cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_bank_id` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=482576 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=482849 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4699,7 +4698,7 @@ CREATE TABLE `Greuges` ( KEY `Id_Ticket_Greuge_Ticket_idx` (`Id_Ticket`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`Greuges_type_id`) REFERENCES `Greuges_type` (`Greuges_type_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2715124 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; +) ENGINE=InnoDB AUTO_INCREMENT=2743975 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=FIXED; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -4900,7 +4899,7 @@ CREATE TABLE `Movimientos` ( KEY `itemFk_ticketFk` (`Id_Article`,`Id_Ticket`), CONSTRAINT `Movimientos_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `movement_ticket_id` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23184769 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23419259 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5058,7 +5057,7 @@ CREATE TABLE `Movimientos_mark` ( KEY `Id_Movimiento` (`Id_Movimiento`), KEY `fgnStateFk_idx` (`stateFk`), CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13829125 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14027765 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5132,7 +5131,7 @@ CREATE TABLE `Ordenes` ( `datORDEN` datetime DEFAULT NULL, `datTICKET` datetime DEFAULT NULL, `CodVENDEDOR` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `CodCOMPRADOR` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT 'NOE', + `CodCOMPRADOR` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'NOE', `CANTIDAD` int(11) DEFAULT NULL, `PRECIOMAX` double DEFAULT NULL, `PREU` double DEFAULT NULL, @@ -5145,7 +5144,7 @@ CREATE TABLE `Ordenes` ( `KO` tinyint(1) NOT NULL DEFAULT '0', `Id_Movimiento` int(11) DEFAULT NULL, `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `isOk` tinyint(1) DEFAULT NULL, + `isOk` tinyint(1) DEFAULT '0', `requesterFk` int(11) DEFAULT NULL, `atenderFk` int(11) DEFAULT NULL, `ticketFk` int(11) DEFAULT NULL, @@ -5163,8 +5162,70 @@ CREATE TABLE `Ordenes` ( CONSTRAINT `fgnAtender` FOREIGN KEY (`atenderFk`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `Tickets` (`Id_Ticket`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=38217 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38426 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Ordenes_BEFORE_INSERT` BEFORE INSERT ON `Ordenes` FOR EACH ROW +BEGIN + IF NEW.ticketFk IS NULL THEN + SET NEW.ticketFk = (SELECT m.Id_Ticket FROM Movimientos m WHERE m.Id_Movimiento = NEW.Id_Movimiento); + END IF; + + IF NEW.requesterFk IS NULL THEN + SET NEW.requesterFk = (SELECT t.Id_Trabajador FROM Trabajadores t WHERE t.CodigoTrabajador = NEW.CodVENDEDOR); + END IF; + + IF NEW.atenderFk IS NULL THEN + SET NEW.atenderFk = (SELECT t.Id_Trabajador FROM Trabajadores t WHERE t.CodigoTrabajador = NEW.CodCOMPRADOR); + END IF; + + SET NEW.isOk = NEW.OK; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn2008`.`Ordenes_BEFORE_UPDATE` BEFORE UPDATE ON `Ordenes` FOR EACH ROW +BEGIN + IF NEW.Id_Movimiento <> OLD.Id_Movimiento THEN + SET NEW.ticketFk = (SELECT m.Id_Ticket FROM Movimientos m WHERE m.Id_Movimiento = NEW.Id_Movimiento); + END IF; + + IF NEW.CodVENDEDOR <> OLD.CodVENDEDOR THEN + SET NEW.requesterFk = (SELECT t.Id_Trabajador FROM Trabajadores t WHERE t.CodigoTrabajador = NEW.CodVENDEDOR); + END IF; + + IF NEW.CodCOMPRADOR <> OLD.CodCOMPRADOR THEN + SET NEW.atenderFk = (SELECT t.Id_Trabajador FROM Trabajadores t WHERE t.CodigoTrabajador = NEW.CodCOMPRADOR); + END IF; + + IF NEW.OK <> OLD.OK THEN + SET NEW.isOk = NEW.OK; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; -- -- Table structure for table `Origen` @@ -5209,7 +5270,7 @@ CREATE TABLE `Pagares` ( KEY `empresa_id` (`kk_empresa_id`), KEY `pago_id` (`pago_id`), CONSTRAINT `Pagares_ibfk_2` FOREIGN KEY (`pago_id`) REFERENCES `pago` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2854 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2857 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5335,7 +5396,7 @@ CREATE TABLE `Proveedores` ( CONSTRAINT `pay_dem_id` FOREIGN KEY (`pay_dem_id`) REFERENCES `pay_dem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `province_id` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2678 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2683 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5361,7 +5422,7 @@ CREATE TABLE `Proveedores_account` ( KEY `fk_Proveedores_account_entity1_idx` (`entity_id`), KEY `fk_banco_prov_account_idx` (`Id_Banco`), CONSTRAINT `fk_banco_prov_account` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=706 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=709 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5452,7 +5513,7 @@ CREATE TABLE `Recibos` ( CONSTRAINT `Recibos_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Recibos_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=512100 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=515775 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5543,7 +5604,7 @@ CREATE TABLE `Relaciones` ( KEY `Id_Contacto` (`Id_Contacto`), KEY `Id_Proveedor` (`Id_Proveedor`), KEY `Id_Cliente` (`Id_Cliente`) -) ENGINE=InnoDB AUTO_INCREMENT=2677 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2678 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5563,7 +5624,7 @@ CREATE TABLE `Remesas` ( KEY `empresa_id` (`empresa_id`), CONSTRAINT `Remesas_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `Remesas_ibfk_2` FOREIGN KEY (`Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1186 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1199 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5588,7 +5649,7 @@ CREATE TABLE `Reservas` ( PRIMARY KEY (`Id_Reserva`), KEY `Id_1` (`Id_Ticket`), KEY `Id_Article` (`Id_Article`) -) ENGINE=InnoDB AUTO_INCREMENT=353 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=516 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5619,7 +5680,7 @@ CREATE TABLE `Rutas` ( KEY `Fecha` (`Fecha`), KEY `gestdoc_id` (`gestdoc_id`), CONSTRAINT `Rutas_ibfk_1` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=46384 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=46793 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -5681,7 +5742,7 @@ CREATE TABLE `Rutas_Master` ( PRIMARY KEY (`id`), KEY `fk_rutas_warehouse_id_idx` (`warehouse_id`), CONSTRAINT `fk_rutas_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5772,7 +5833,7 @@ CREATE TABLE `Saldos_Prevision` ( KEY `empresa_prevision_idx` (`empresa_id`), CONSTRAINT `banco_prevision` FOREIGN KEY (`Id_Banco`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `empresa_prevision` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=148 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; +) ENGINE=InnoDB AUTO_INCREMENT=153 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5807,7 +5868,7 @@ CREATE TABLE `Split_lines` ( KEY `Id_Compra` (`Id_Compra`), CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `Compres` (`Id_Compra`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Split_lines_ibfk_1` FOREIGN KEY (`Id_Split`) REFERENCES `Splits` (`Id_Split`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=344622 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=344830 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5825,7 +5886,7 @@ CREATE TABLE `Splits` ( `Notas` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`Id_Split`), KEY `Id_Entrada` (`Id_Entrada`) -) ENGINE=InnoDB AUTO_INCREMENT=36497 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=36506 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5853,7 +5914,7 @@ CREATE TABLE `Stockcontrol` ( CONSTRAINT `Stockcontrol_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_2` FOREIGN KEY (`Id_Remitente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Stockcontrol_ibfk_3` FOREIGN KEY (`Id_Solver`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=23927 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23954 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5911,7 +5972,7 @@ CREATE TABLE `Tickets` ( CONSTRAINT `Tickets_ibfk_9` FOREIGN KEY (`Id_Ruta`) REFERENCES `Rutas` (`Id_Ruta`) ON UPDATE CASCADE, CONSTRAINT `ticket_customer_id` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `tickets_fk10` FOREIGN KEY (`Factura`) REFERENCES `Facturas` (`Id_Factura`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2105259 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2116993 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6017,7 +6078,7 @@ BEGIN -- Comprobación de VIES - IF NEW.empresa_id <> OLD.empresa_id THEN + IF NEW.empresa_id <> OLD.empresa_id AND vn.getUser() != 2 THEN SELECT CEE INTO vIsCee FROM Proveedores AS pr @@ -6107,7 +6168,7 @@ CREATE TABLE `Tickets_dits` ( CONSTRAINT `Tickets_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fgkey1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fgkey3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=64266018 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=64293654 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6188,7 +6249,7 @@ CREATE TABLE `Tickets_turno` ( `weekDay` tinyint(1) DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', PRIMARY KEY (`Id_Ticket`), CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2091044 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2115119 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6257,7 +6318,7 @@ CREATE TABLE `Tipos` ( CONSTRAINT `Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `tipos_fk4` FOREIGN KEY (`roleCodeFk`) REFERENCES `account`.`role` (`name`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=230 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; +) ENGINE=InnoDB AUTO_INCREMENT=232 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Protege la tabla tipos de updates para los 4 parámetros de los compradores, en funcion del valor del campo CodigoRojo de tblContadores.'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6345,7 +6406,7 @@ CREATE TABLE `Trabajadores` ( KEY `sub` (`sub`), CONSTRAINT `Clientes` FOREIGN KEY (`Id_Cliente_Interno`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `Trabajadores_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1223 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1229 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6498,7 +6559,7 @@ CREATE TABLE `Vehiculos_consumo` ( PRIMARY KEY (`Vehiculos_consumo_id`,`Id_Vehiculo`), KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`Id_Vehiculo`), CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `Vehiculos` (`Id_Vehiculo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10025 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; +) ENGINE=InnoDB AUTO_INCREMENT=10187 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -6612,7 +6673,7 @@ CREATE TABLE `XDiario` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3617668 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3626773 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6720,7 +6781,7 @@ CREATE TABLE `account_conciliacion` ( KEY `fg_accconciliacion_key1_idx` (`Id_Proveedores_account`), KEY `index_id_calculated` (`id_calculated`), CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `Proveedores_account` (`Id_Proveedores_account`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16681 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=17533 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -6887,7 +6948,7 @@ CREATE TABLE `agency_hour` ( CONSTRAINT `agency_hour_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `agency` (`agency_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agency_hour_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5124 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5131 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -7053,7 +7114,7 @@ CREATE TABLE `albaran` ( CONSTRAINT `fk_albaran_empresa1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2896 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2924 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7130,7 +7191,7 @@ CREATE TABLE `awb` ( CONSTRAINT `awbInvoiceIn` FOREIGN KEY (`invoiceInFk`) REFERENCES `recibida` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `awbTransitoryFk` FOREIGN KEY (`transitario_id`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2925 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2945 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -7307,7 +7368,7 @@ CREATE TABLE `awb_component_template` ( CONSTRAINT `Id_Moneda` FOREIGN KEY (`Id_Moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE, CONSTRAINT `role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=705 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=715 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7388,7 +7449,7 @@ CREATE TABLE `awb_gestdoc` ( KEY `awb_gestdoc_gestdoc_fk` (`gestdoc_id`), CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awb_id`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`gestdoc_id`) REFERENCES `gestdoc` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2567 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2587 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7487,7 +7548,7 @@ CREATE TABLE `balance_nest_tree` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Id_Gasto` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=391 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=392 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7506,7 +7567,7 @@ CREATE TABLE `barcodes` ( UNIQUE KEY `Id_Article_2` (`Id_Article`,`code`), KEY `Id_Article` (`Id_Article`), CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`Id_Article`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=37923 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38119 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7537,11 +7598,11 @@ CREATE TABLE `botanic_export` ( `Id_Paises` mediumint(8) unsigned DEFAULT NULL, `restriction` enum('Sin restriccion','Importacion Prohibida','pasaporte fitosanitario','pasaporte individual','declaracion origen') CHARACTER SET utf8 NOT NULL, `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `IsProctedZone` tinyint(1) NOT NULL DEFAULT '0', + `isProtectedZone` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`botanic_export_id`), KEY `Id_Paises` (`Id_Paises`), CONSTRAINT `botanic_export_ibfk_1` FOREIGN KEY (`Id_Paises`) REFERENCES `Paises` (`Id`) -) ENGINE=InnoDB AUTO_INCREMENT=274 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; +) ENGINE=InnoDB AUTO_INCREMENT=340 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Especifica los generos y especies prohibidos en paises'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -7648,7 +7709,7 @@ CREATE TABLE `buy_edi` ( KEY `kop` (`kop`), KEY `barcode` (`barcode`), KEY `fec` (`fec`) -) ENGINE=InnoDB AUTO_INCREMENT=817852 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=825366 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7881,7 +7942,7 @@ CREATE TABLE `cl_act` ( CONSTRAINT `cl_act_ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `cl_act_ibfk_4` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=98097 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=98773 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7915,7 +7976,7 @@ CREATE TABLE `cl_cau` ( CONSTRAINT `cl_cau_ibfk_7` FOREIGN KEY (`cl_mot_id`) REFERENCES `cl_mot` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_8` FOREIGN KEY (`cl_con_id`) REFERENCES `cl_con` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_cau_ibfk_9` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=51204 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=51499 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -7965,7 +8026,7 @@ CREATE TABLE `cl_det` ( KEY `cl_main_id` (`cl_main_id`), CONSTRAINT `cl_det_ibfk_7` FOREIGN KEY (`Id_Movimiento`) REFERENCES `Movimientos` (`Id_Movimiento`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_det_ibfk_8` FOREIGN KEY (`cl_main_id`) REFERENCES `cl_main` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=133030 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=134021 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8053,7 +8114,7 @@ CREATE TABLE `cl_main` ( CONSTRAINT `cl_main_ibfk_4` FOREIGN KEY (`cl_dep_id`) REFERENCES `cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `cl_main_ibfk_5` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `cl_main_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `Tickets` (`Id_Ticket`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=57774 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDB AUTO_INCREMENT=58142 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8169,7 +8230,7 @@ CREATE TABLE `client_observation` ( KEY `Id_Cliente` (`Id_Cliente`), CONSTRAINT `client_observation_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `client_observation_ibfk_2` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=70038 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=70718 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8236,6 +8297,7 @@ CREATE TABLE `clientes_tipo` ( `clientes_tipo_id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(20) CHARACTER SET utf8 NOT NULL, `tipo` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `isCreatedAsServed` tinyint(1) DEFAULT '0', PRIMARY KEY (`clientes_tipo_id`), UNIQUE KEY `code_UNIQUE` (`code`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; @@ -8336,7 +8398,7 @@ CREATE TABLE `consignatarios_observation` ( `text` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`consignatarios_observation_id`), UNIQUE KEY `Id_Consigna` (`Id_Consigna`,`observation_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=3549 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDB AUTO_INCREMENT=3558 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8418,7 +8480,7 @@ CREATE TABLE `credit` ( KEY `credit_ClienteFk` (`Id_Cliente`), CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=70960 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=71382 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8933,7 +8995,7 @@ CREATE TABLE `escritos_det` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `escritos_det_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16671 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16750 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8962,7 +9024,7 @@ CREATE TABLE `expeditions` ( KEY `index4` (`ticket_id`), CONSTRAINT `Id_Agencia` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `ticket_id` FOREIGN KEY (`ticket_id`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2794542 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2811942 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -8978,6 +9040,7 @@ BEFORE INSERT ON `expeditions` FOR EACH ROW -- Edit trigger body code below this line. Do not edit lines above this one BEGIN DECLARE intcounter INT; + DECLARE vShipFk INT; IF NEW.EsBulto > 0 THEN @@ -8990,6 +9053,12 @@ BEGIN SET NEW.`counter` = intcounter; END IF; SET NEW.workerFk=get_Trabajador(); + + -- JGF 14/01/19 si existe un polizon queda anulado + SELECT shipFk INTO vShipFk FROM vn.stowaway WHERE id = NEW.ticket_id; + IF vShipFk THEN + CALL vn.stowawayUnBoarding(vShipFk, NEW.ticket_id); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -9105,7 +9174,7 @@ CREATE TABLE `filtros` ( `sql` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `Estanteria` tinyint(1) DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=139 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9201,7 +9270,7 @@ CREATE TABLE `gestdoc` ( UNIQUE KEY `emp_id` (`emp_id`,`orden`,`warehouse_id`), KEY `trabajador_id` (`trabajador_id`), KEY `warehouse_id` (`warehouse_id`) -) ENGINE=InnoDB AUTO_INCREMENT=1143217 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDB AUTO_INCREMENT=1150561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -9400,7 +9469,7 @@ CREATE TABLE `intrastat_data` ( KEY `recibida` (`recibida_id`), CONSTRAINT `intrastat_data_ibfk_1` FOREIGN KEY (`intrastat_id`) REFERENCES `Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `intrastat_data_ibfk_2` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=71902 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=72317 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9584,7 +9653,7 @@ CREATE TABLE `iva_codigo` ( KEY `codigo` (`codigo`), KEY `tipo_index` (`tipo`), CONSTRAINT `iva_codigo_ibfk_1` FOREIGN KEY (`iva_tipo_id`) REFERENCES `iva_tipo` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=123 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9739,7 +9808,7 @@ CREATE TABLE `mail` ( `recipientFk` int(11) DEFAULT NULL, `plainTextBody` text COLLATE utf8_unicode_ci, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=1562868 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=1575250 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9797,7 +9866,7 @@ CREATE TABLE `mandato` ( CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`empresa_id`) REFERENCES `empresa` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`idmandato_tipo`) REFERENCES `mandato_tipo` (`idmandato_tipo`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=15957 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=15999 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10006,7 +10075,7 @@ CREATE TABLE `pago` ( CONSTRAINT `pago_moneda` FOREIGN KEY (`id_moneda`) REFERENCES `Monedas` (`Id_Moneda`) ON UPDATE CASCADE, CONSTRAINT `pago_pay_met` FOREIGN KEY (`pay_met_id`) REFERENCES `pay_met` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`id_proveedor`) REFERENCES `Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=45901 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=46276 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10502,7 +10571,7 @@ CREATE TABLE `price_fixed` ( KEY `date_end` (`date_end`), KEY `warehouse_id` (`warehouse_id`), CONSTRAINT `price_fixed_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=59054 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=59510 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -10564,7 +10633,7 @@ CREATE TABLE `producer` ( `visible` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`producer_id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=5834 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=6123 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10733,7 +10802,7 @@ CREATE TABLE `recibida` ( CONSTRAINT `recibida_ibfk_5` FOREIGN KEY (`cplusInvoiceType472Fk`) REFERENCES `vn`.`cplusInvoiceType472` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_6` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibida_ibfk_7` FOREIGN KEY (`cplusTrascendency472Fk`) REFERENCES `vn`.`cplusTrascendency472` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=75889 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=76439 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11322,7 +11391,7 @@ CREATE TABLE `recibida_iva` ( CONSTRAINT `recibida_iva_ibfk_2` FOREIGN KEY (`iva_id`) REFERENCES `iva_codigo` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_5` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `recibida_iva_ibfk_6` FOREIGN KEY (`gastos_id`) REFERENCES `Gastos` (`Id_Gasto`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=114636 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=115975 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11345,7 +11414,7 @@ CREATE TABLE `recibida_vencimiento` ( KEY `banco_id` (`banco_id`), CONSTRAINT `recibida_vencimiento_ibfk_6` FOREIGN KEY (`banco_id`) REFERENCES `Bancos` (`Id_Banco`) ON UPDATE CASCADE, CONSTRAINT `recibida_vencimiento_ibfk_7` FOREIGN KEY (`recibida_id`) REFERENCES `recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=111910 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=113283 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -11388,7 +11457,7 @@ CREATE TABLE `recovery` ( KEY `cliente_idx` (`Id_Cliente`), CONSTRAINT `cliente333` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE, CONSTRAINT `cliente_cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `Clientes` (`id_cliente`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=280 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; +) ENGINE=InnoDB AUTO_INCREMENT=282 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='En esta tabla apuntaremos los acuerdos de recobro semanal a '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11569,7 +11638,7 @@ CREATE TABLE `scan` ( `name` varchar(45) CHARACTER SET utf8 DEFAULT NULL, `odbc_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=78696 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +) ENGINE=InnoDB AUTO_INCREMENT=79758 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11609,7 +11678,7 @@ CREATE TABLE `scan_line` ( PRIMARY KEY (`scan_line_id`), KEY `id_scan_id_idx` (`scan_id`), CONSTRAINT `id_scan_id` FOREIGN KEY (`scan_id`) REFERENCES `scan` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=978678 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=990753 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11631,7 +11700,7 @@ CREATE TABLE `sharingcart` ( KEY `Suplent` (`Id_Suplente`), CONSTRAINT `Suplent_key` FOREIGN KEY (`Id_Suplente`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1971 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1973 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12087,7 +12156,7 @@ CREATE TABLE `ticket_observation` ( KEY `observation_type_id` (`observation_type_id`), CONSTRAINT `ticket_observation_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticket_observation_ibfk_2` FOREIGN KEY (`observation_type_id`) REFERENCES `observation_type` (`observation_type_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1244552 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=1253898 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12211,7 +12280,7 @@ CREATE TABLE `travel` ( CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouse_id_out`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `Agencias` (`Id_Agencia`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `Proveedores_cargueras` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=120531 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=121979 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -12348,7 +12417,7 @@ CREATE TABLE `travel_dits` ( KEY `fgkey2_idx` (`Id_Ticket`), KEY `fgkey3_idx` (`Id_Trabajador`), CONSTRAINT `travel_dits_ibfk_1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=199947 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=201969 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -13708,7 +13777,7 @@ CREATE TABLE `workerTeam` ( PRIMARY KEY (`id`), KEY `user_team_idx` (`user`), CONSTRAINT `user_team` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=196 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=198 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17620,22 +17689,7 @@ CREATE TEMPORARY TABLE tmp.balance_desglose WHERE IFNULL(r.bookEntried,IFNULL(r.dateBooking, r.Fecha)) >= vStartingDate AND r.contabilizada GROUP BY Id_Gasto, year, month, emisora_id, receptora_id; -/* -DROP TEMPORARY TABLE IF EXISTS tmp.balance_desglose; -CREATE TEMPORARY TABLE tmp.balance_desglose - SELECT er.empresa_id as receptora_id - , ee.empresa_id as emisora_id - , year(IFNULL(r.dateBooking, r.Fecha)) as `year` - , month(IFNULL(r.dateBooking, r.Fecha)) as `month` - , gastos_id as Id_Gasto - , sum(bi) as importe - FROM recibida r - JOIN recibida_iva ri on ri.recibida_id = r.id - JOIN tmp.empresas_receptoras er on er.empresa_id = r.empresa_id - JOIN tmp.empresas_emisoras ee ON ee.empresa_id = r.proveedor_id - WHERE IFNULL(r.dateBooking, r.Fecha) between vStartingDate and CURDATE() - GROUP BY Id_Gasto, year, month, emisora_id, receptora_id; -*/ + INSERT INTO tmp.balance_desglose(receptora_id , emisora_id , year @@ -17774,11 +17828,11 @@ CREATE TEMPORARY TABLE tmp.balance_aux SELECT * FROM tmp.balance; UPDATE tmp.balance b JOIN ( -select b1.id, b1.name, sum(b2.`2016`) as `2016`, sum(b2.`2017`) as `2017`, sum(b2.`2018`) as `2018` +select b1.id, b1.name, sum(b2.`2017`) as `2017`, sum(b2.`2018`) as `2018`, sum(b2.`2019`) as `2019` from tmp.nest b1 join tmp.balance_aux b2 on b2.lft between b1.lft and b1.rgt group by b1.id) sub on sub.id = b.id -SET b.`2016` = sub.`2016`, b.`2017` = sub.`2017`, b.`2018` = sub.`2018` +SET b.`2017` = sub.`2017`, b.`2018` = sub.`2018`, b.`2019` = sub.`2019` ; @@ -21583,7 +21637,6 @@ proc: BEGIN JOIN Tipos tp ON tp.tipo_id = a.tipo_id WHERE c.Id_Compra = v_buy; - IF v_wh != v_holland_wh THEN LEAVE proc; END IF; @@ -21591,7 +21644,7 @@ proc: BEGIN -- Calcula a que almacén de Silla debe transladar la mercancía SET v_entry = IF(v_fv, v_fv_entry, v_pca_entry); - SET v_entry = IFNULL(v_entry, IFNULL(v_pca_entry, v_fv_entry)); + SET v_entry = COALESCE(v_entry, v_pca_entry, v_fv_entry); IF v_entry IS NULL THEN LEAVE proc; @@ -21667,6 +21720,132 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `buy_transferTest` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `buy_transferTest`(v_buy INT, v_fv_entry INT, v_pca_entry INT) +proc: BEGIN +/** + * Traslada la cantidad restante de una compra de Holanda + * al almacén de Silla. + **/ + DECLARE v_wh INT; + DECLARE v_entry INT; + DECLARE v_fv INT; + DECLARE v_amount INT; + DECLARE v_item INT; + DECLARE v_holland_wh INT DEFAULT 7; + DECLARE vIsIgnored BOOL DEFAULT FALSE; + DECLARE vDestinationWarehouse INT; + + -- Comprueba que es mercancía que llega al almacén de Holanda + + SELECT t.warehouse_id, IF(tp.warehouseFk=1,1,0), tp.warehouseFk INTO v_wh, v_fv, vDestinationWarehouse + FROM Compres c + JOIN Entradas e ON c.Id_Entrada = e.Id_Entrada + JOIN travel t ON t.id = e.travel_id + JOIN Articles a ON a.Id_Article = c.Id_Article + JOIN Tipos tp ON tp.tipo_id = a.tipo_id + WHERE c.Id_Compra = v_buy; + + IF v_wh != v_holland_wh THEN + LEAVE proc; + END IF; + + -- Calcula a que almacén de Silla debe transladar la mercancía + + SET v_entry = IF(v_fv, v_fv_entry, v_pca_entry); + SET v_entry = COALESCE(v_entry, v_pca_entry, v_fv_entry); + + IF v_entry IS NULL THEN + LEAVE proc; + END IF; + + -- Calcula la cantidad a trasladar + + SELECT Id_Article, Novincular INTO v_item, vIsIgnored + FROM Compres WHERE Id_Compra = v_buy; + + SELECT IFNULL(SUM(amount), 0) INTO v_amount + FROM ( + SELECT SUM(c.Cantidad) amount + FROM Compres c + JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada + JOIN travel t ON t.id = e.travel_id + WHERE c.Id_Article = v_item + AND t.landing = CURDATE() + AND t.warehouse_id = v_holland_wh + UNION ALL + SELECT -SUM(c.Cantidad) + FROM Compres c + JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada + JOIN travel t ON t.id = e.travel_id + WHERE c.Id_Article = v_item + AND t.shipment = CURDATE() + AND t.warehouse_id_out = v_holland_wh + UNION ALL + SELECT -SUM(Cantidad) + FROM Movimientos m + JOIN Tickets t ON t.Id_Ticket = m.Id_Ticket + WHERE m.Id_Article = v_item + AND t.Fecha = CURDATE() + AND t.warehouse_id = v_holland_wh + ) t; + + IF v_amount <= 0 THEN + LEAVE proc; + END IF; + + -- Si la linea tiene no vincular hay que buscar la anterior válida + IF vIsIgnored THEN + CALL buyUltimate(vDestinationWarehouse, CURDATE()); + SELECT buyFk INTO v_buy + FROM tmp.buyUltimate + LIMIT 1; + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; + END IF; + + -- Crea la nueva línea de compra con el translado + + INSERT INTO Compres ( + Id_Article, Etiquetas, Cantidad, Id_Entrada, + Id_Cubo, Packing, grouping, caja, Costefijo, Portefijo, + Embalajefijo, Comisionfija, novincular, buy_edi_id) + SELECT c.Id_Article, + v_amount DIV c.Packing, + v_amount, + v_entry, + c.Id_Cubo, + c.Packing, + c.grouping, + c.caja, + @cost := IFNULL(c.Costefijo, 0) + IFNULL(c.Comisionfija, 0) + IFNULL(c.Portefijo, 0), + @porte := ROUND((@cm3:= cm3_2(c.Id_Cubo, c.Id_Article)) * a.m3 / 1000000 / c.Packing, 3), + c.EmbalajeFijo, + @comision := ROUND(c.Costefijo * e.comision / 100, 3), + c.novincular, + c.buy_edi_id + FROM Compres c + JOIN Cubos cu ON cu.Id_Cubo = c.Id_Cubo + JOIN Entradas e ON e.Id_Entrada = v_entry + JOIN travel t ON t.id = e.travel_id + JOIN Agencias a ON t.agency_id = a.Id_Agencia + WHERE c.Id_Compra = v_buy; + + CALL buy_tarifas (LAST_INSERT_ID()); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `cacheReset` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -22090,7 +22269,6 @@ BEGIN WHERE ODBC_DATE < v_date; DELETE FROM Tickets_dits WHERE idTickets_dits <= @id; - -- DELETE FROM Tickets_dits WHERE ODBC_DATE < v_date; DELETE FROM expeditions WHERE odbc_date < v_date18; DELETE FROM expeditions_deleted WHERE odbc_date < v_date18; DELETE FROM Entradas_dits WHERE ODBC_DATE < v_date18; @@ -22146,10 +22324,12 @@ BEGIN IF v_full THEN - DELETE FROM Tickets - WHERE Fecha NOT IN ('2000-01-01','2000-01-02') - AND YEAR(Fecha) = 2000 - AND ABS(DATEDIFF(Fecha,vDate2000)) > vRangeDeleteTicket; + DELETE t FROM Tickets t + LEFT JOIN Tickets_turno tt ON tt.Id_Ticket = t.Id_Ticket + WHERE Fecha NOT IN ('2000-01-01','2000-01-02') + AND YEAR(Fecha) = 2000 + AND ABS(DATEDIFF(Fecha,vDate2000)) > vRangeDeleteTicket + AND tt.Id_Ticket IS NULL; DELETE e.* FROM Entradas e LEFT JOIN recibida_entrada re ON e.Id_Entrada = re.Id_Entrada @@ -25447,6 +25627,7 @@ END as*/R.orden, , p.`name` producer, T.warehouse_id, ST.id as idStowaway, + STP.shipFk as isStowaway, CS.POBLACION -- JGF 2016-02-16 FROM @@ -25498,6 +25679,7 @@ FROM ) Gro ON Gro.Id_Article = M.Id_Article LEFT JOIN Movimientos_mark mm ON mm.Id_Movimiento = M.Id_Movimiento LEFT JOIN vn.stowaway ST ON ST.shipFk = idT + LEFT JOIN vn.stowaway STP on STP.id = idT WHERE T.Id_Ticket = idT group by M.Id_Movimiento; @@ -28332,11 +28514,12 @@ BEGIN ELSE - SELECT w.name as Almacen, r.reino as Reino, cast(total as decimal) as Euros + SELECT w.name as Almacen, r.reino as Reino, cast(total as decimal) as Euros, tr.CodigoTrabajador as Comprador FROM inv JOIN warehouse w ON w.id = w_id JOIN Articles A USING(Id_Article) JOIN Tipos t USING(tipo_id) + LEFT JOIN Trabajadores tr ON tr.Id_Trabajador = t.Id_Trabajador JOIN reinos r ON r.id = t.reino_id where w.valuatedInventory; @@ -31028,8 +31211,7 @@ BEGIN FROM Tickets t LEFT JOIN vn.ticketState ts ON ts.ticket = t.Id_Ticket JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente - JOIN clientes_tipo ct ON ct.clientes_tipo_id = c.clientes_tipo_id - WHERE ct.code IN ('normal','handMaking') + WHERE c.typeFk IN ('normal','handMaking') AND ( Fecha BETWEEN util.today() AND vEndingDate OR ( @@ -32187,6 +32369,178 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `proveedores_saldos`() +BEGIN + + + DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(MONTH,-3,CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS saldos_iniciales; + + CREATE TEMPORARY TABLE saldos_iniciales + + + (proveedor_id INT NOT NULL + , empresa_id INT NOT NULL + , saldo_inicial double NOT NULL + , saldo_final DOUBLE NOT NULL + , moneda_id INT NOT NULL + , PRIMARY KEY(proveedor_id, empresa_id, moneda_id)) + ENGINE = MEMORY; + + -- Calcula el saldo inicial y final de cada proveedor + INSERT INTO saldos_iniciales + SELECT id_proveedor, empresa_id, sum(importe * isBeforeStarting) as saldo_inicial,sum(importe) saldo_final, moneda_id + FROM ( + SELECT + p.id_proveedor, + p.empresa_id, + if(p.id_moneda = 1, p.importe, p.divisa) as importe, + if( p.fecha < startingDate,1,0) isBeforeStarting, + p.id_moneda moneda_id + FROM pago p + WHERE p.fecha > '2014-12-31' + AND p.empresa_id = 442 + AND p.id_proveedor <> 567 + + UNION ALL + + SELECT + r.proveedor_id, + r.empresa_id, + - if(r.moneda_id = 1, rv.cantidad, rv.divisa) AS Total, + if(rv.fecha < startingDate,1,0) isBeforeStarting, + r.moneda_id + FROM + recibida r + INNER JOIN recibida_vencimiento rv ON r.id = rv.recibida_id + WHERE r.fecha > '2014-12-31' + AND r.contabilizada AND r.empresa_id = 442 + AND r.proveedor_id <> 567 + ) sub + GROUP BY empresa_id, id_proveedor, moneda_id; + + DROP TEMPORARY TABLE IF EXISTS vencimientos_pendientes; + + CREATE TEMPORARY TABLE vencimientos_pendientes + (vencimiento_id INT, id INT auto_increment + ,fecha DATE + ,proveedor_id INT NOT NULL + ,empresa_id INT NOT NULL + ,importe DECIMAL(10,2) NOT NULL + ,moneda_id INT NOT NULL + ,pendiente DECIMAL(10,2) DEFAULT 0 + ,saldo DECIMAL(10,2) DEFAULT 0 + ,saldoFinal DECIMAL(10,2) DEFAULT 0 + ,isPago BOOLEAN + ,conciliado BOOLEAN + ,PRIMARY KEY(id), + INDEX(proveedor_id,empresa_id,moneda_id)) + ENGINE = MEMORY; + + INSERT INTO vencimientos_pendientes(vencimiento_id + , fecha + , proveedor_id + , empresa_id + , importe + , moneda_id + , isPago + , conciliado) + SELECT p.id, + p.fecha, + p.id_proveedor, + p.empresa_id, + if(p.id_moneda = 1, p.importe, p.divisa) as importe, + p.id_moneda, + TRUE isPago, + p.conciliado + FROM pago p + WHERE p.fecha >= startingDate AND p.empresa_id = 442 + AND p.id_proveedor <> 567 + UNION ALL + SELECT r.id + , rv.fecha + , r.proveedor_id + , r.empresa_id + , -if(r.moneda_id = 1, rv.cantidad, rv.divisa) as importe + , r.moneda_id + , FALSE + , TRUE + FROM recibida r + LEFT JOIN saldos_iniciales si ON r.empresa_id = si.empresa_id AND r.proveedor_id = si.proveedor_id AND r.moneda_id = si.moneda_id + INNER JOIN recibida_vencimiento rv ON r.id = rv.recibida_id + WHERE rv.fecha >= startingDate AND IFNULL(saldo_final,TRUE) <> 0 + and r.contabilizada AND r.empresa_id = 442 + AND r.proveedor_id <> 567 + ORDER BY id_proveedor, empresa_id, id_moneda, fecha, isPago DESC,id; + + -- Ahora, calculamos el importe pendiente para cada recibo en orden descendente + SET @saldo:= 0.0; + SET @prov := 0.0; + SET @emp := 0.0; + set @moneda := 0.0; + SET @pendiente := 0.0; + SET @day := CURDATE(); + + UPDATE vencimientos_pendientes vp LEFT JOIN saldos_iniciales si ON + vp.empresa_id = si.empresa_id AND vp.proveedor_id = si.proveedor_id AND vp.moneda_id = si.moneda_id + SET vp.saldo = @saldo:= (IF(@emp <> vp.empresa_id OR @prov <> vp.proveedor_id OR @moneda <> vp.moneda_id, IFNULL(si.saldo_inicial,0),@saldo) + vp.importe) -- si hay cambio de empresa o proveedor o moneda, el saldo se reinicia + , vp.pendiente = @pendiente:= IF(@emp <> vp.empresa_id OR @prov <> vp.proveedor_id OR @moneda <> vp.moneda_id OR @day <> vp.fecha, vp.importe * (NOT isPago) , @pendiente + vp.importe) + , vp.empresa_id = @emp:= vp.empresa_id + , vp.proveedor_id = @prov:= vp.proveedor_id + , vp.moneda_id = @moneda:= vp.moneda_id + , vp.fecha = @day:= vp.fecha + , vp.saldo = @saldo + , vp.pendiente = @pendiente; + + CREATE TEMPORARY TABLE rowsToDelete + ENGINE = MEMORY + SELECT vencimiento_id, fecha,proveedor_id,empresa_id,moneda_id,saldo + FROM vencimientos_pendientes + -- GROUP BY fecha,proveedor_id,empresa_id,moneda_id + WHERE saldo < 0.5 AND saldo > -0.5; + + DELETE vp.* FROM vencimientos_pendientes vp JOIN rowsToDelete rd + ON (vp.fecha < rd.fecha OR (vp.fecha = rd.fecha AND vp.vencimiento_id <= rd.vencimiento_id)) + AND vp.proveedor_id = rd.proveedor_id AND vp.empresa_id = rd.empresa_id AND vp.moneda_id = rd.moneda_id + + WHERE isPago = FALSE; + + SELECT vp.vencimiento_id + , vp.fecha + , vp.proveedor_id + , vp.empresa_id + , vp.moneda_id + , vp.importe + , vp.pendiente + , vp.saldo + , p.pay_met_id + , vp.isPago + , vp.conciliado + , vp.saldoFinal + FROM vencimientos_pendientes vp + LEFT JOIN Proveedores p ON p.Id_Proveedor = vp.proveedor_id; + + DROP TEMPORARY TABLE vencimientos_pendientes; + DROP TEMPORARY TABLE saldos_iniciales; + DROP TEMPORARY TABLE rowsToDelete; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `proveedores_saldosKk` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `proveedores_saldosKk`() BEGIN DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(MONTH,-3,CURDATE()); @@ -32337,6 +32691,215 @@ BEGIN DROP TEMPORARY TABLE saldos_iniciales; DROP TEMPORARY TABLE rowsToDelete; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `proveedores_saldosTest` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `proveedores_saldosTest`() +BEGIN + + + DECLARE startingDate DATETIME DEFAULT TIMESTAMPADD(MONTH,-3,CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS saldos_iniciales; + + CREATE TEMPORARY TABLE saldos_iniciales + + + (proveedor_id INT NOT NULL + , empresa_id INT NOT NULL + , saldo_inicial double NOT NULL + , saldo_final DOUBLE NOT NULL + , moneda_id INT NOT NULL + , PRIMARY KEY(proveedor_id, empresa_id, moneda_id)) + ENGINE = MEMORY; + + -- Calcula el saldo inicial y final de cada proveedor + INSERT INTO saldos_iniciales + SELECT id_proveedor, empresa_id, sum(importe * isBeforeStarting) as saldo_inicial,sum(importe) saldo_final, moneda_id + FROM ( + SELECT + p.id_proveedor, + p.empresa_id, + if(p.id_moneda = 1, p.importe, p.divisa) as importe, + if( p.fecha < startingDate,1,0) isBeforeStarting, + p.id_moneda moneda_id + FROM pago p + WHERE p.fecha > '2014-12-31' + AND p.empresa_id = 442 + AND p.id_proveedor <> 567 + + UNION ALL + + SELECT + r.proveedor_id, + r.empresa_id, + - if(r.moneda_id = 1, rv.cantidad, rv.divisa) AS Total, + if(rv.fecha < startingDate,1,0) isBeforeStarting, + r.moneda_id + FROM + recibida r + INNER JOIN recibida_vencimiento rv ON r.id = rv.recibida_id + WHERE r.fecha > '2014-12-31' + AND r.contabilizada AND r.empresa_id = 442 + AND r.proveedor_id <> 567 + ) sub + GROUP BY empresa_id, id_proveedor, moneda_id; + + DROP TEMPORARY TABLE IF EXISTS vencimientos_pendientes; + + CREATE TEMPORARY TABLE vencimientos_pendientes + (vencimiento_id INT, id INT auto_increment + ,fecha DATE + ,proveedor_id INT NOT NULL + ,empresa_id INT NOT NULL + ,importe DECIMAL(10,2) NOT NULL + ,moneda_id INT NOT NULL + ,pendiente DECIMAL(10,2) DEFAULT 0 + ,saldo DECIMAL(10,2) DEFAULT 0 + ,saldoFinal DECIMAL(10,2) DEFAULT 0 + ,isPago BOOLEAN + ,conciliado BOOLEAN + ,PRIMARY KEY(id), + INDEX(proveedor_id,empresa_id,moneda_id)) + ENGINE = MEMORY; + + INSERT INTO vencimientos_pendientes(vencimiento_id + , fecha + , proveedor_id + , empresa_id + , importe + , moneda_id + , isPago + , conciliado) + SELECT p.id, + p.fecha, + p.id_proveedor, + p.empresa_id, + if(p.id_moneda = 1, p.importe, p.divisa) as importe, + p.id_moneda, + TRUE isPago, + p.conciliado + FROM pago p + WHERE p.fecha >= startingDate AND p.empresa_id = 442 + AND p.id_proveedor <> 567 + UNION ALL + SELECT r.id + , rv.fecha + , r.proveedor_id + , r.empresa_id + , -if(r.moneda_id = 1, rv.cantidad, rv.divisa) as importe + , r.moneda_id + , FALSE + , TRUE + FROM recibida r + LEFT JOIN saldos_iniciales si ON r.empresa_id = si.empresa_id AND r.proveedor_id = si.proveedor_id AND r.moneda_id = si.moneda_id + INNER JOIN recibida_vencimiento rv ON r.id = rv.recibida_id + WHERE rv.fecha >= startingDate AND IFNULL(saldo_final,TRUE) <> 0 + and r.contabilizada AND r.empresa_id = 442 + AND r.proveedor_id <> 567 + ORDER BY id_proveedor, empresa_id, id_moneda, fecha, isPago DESC,id; + + +SELECT p.id, + p.fecha, + p.id_proveedor, + p.empresa_id, + if(p.id_moneda = 1, p.importe, p.divisa) as importe, + p.id_moneda, + TRUE isPago, + p.conciliado + FROM pago p + WHERE p.fecha >= startingDate AND p.empresa_id = 442 + AND p.id_proveedor <> 567 + UNION ALL + SELECT r.id + , rv.fecha + , r.proveedor_id + , r.empresa_id + , -if(r.moneda_id = 1, rv.cantidad, rv.divisa) as importe + , r.moneda_id + , FALSE + , TRUE + FROM recibida r + LEFT JOIN saldos_iniciales si ON r.empresa_id = si.empresa_id AND r.proveedor_id = si.proveedor_id AND r.moneda_id = si.moneda_id + INNER JOIN recibida_vencimiento rv ON r.id = rv.recibida_id + WHERE rv.fecha >= startingDate + and r.contabilizada AND r.empresa_id = 442 + AND r.proveedor_id <> 567 + ORDER BY id_proveedor, empresa_id, id_moneda, fecha, isPago DESC,id; + + + -- Ahora, calculamos el importe pendiente para cada recibo en orden descendente + SET @saldo:= 0.0; + SET @prov := 0.0; + SET @emp := 0.0; + set @moneda := 0.0; + SET @pendiente := 0.0; + SET @day := CURDATE(); + + UPDATE vencimientos_pendientes vp LEFT JOIN saldos_iniciales si ON + vp.empresa_id = si.empresa_id AND vp.proveedor_id = si.proveedor_id AND vp.moneda_id = si.moneda_id + SET vp.saldo = @saldo:= (IF(@emp <> vp.empresa_id OR @prov <> vp.proveedor_id OR @moneda <> vp.moneda_id, IFNULL(si.saldo_inicial,0),@saldo) + vp.importe) -- si hay cambio de empresa o proveedor o moneda, el saldo se reinicia + , vp.pendiente = @pendiente:= IF(@emp <> vp.empresa_id OR @prov <> vp.proveedor_id OR @moneda <> vp.moneda_id OR @day <> vp.fecha, vp.importe * (NOT isPago) , @pendiente + vp.importe) + , vp.empresa_id = @emp:= vp.empresa_id + , vp.proveedor_id = @prov:= vp.proveedor_id + , vp.moneda_id = @moneda:= vp.moneda_id + , vp.fecha = @day:= vp.fecha + , vp.saldo = @saldo + , vp.pendiente = @pendiente; + select * FROM vencimientos_pendientes; + + + CREATE TEMPORARY TABLE rowsToDelete + ENGINE = MEMORY + SELECT vencimiento_id, fecha,proveedor_id,empresa_id,moneda_id,saldo + FROM vencimientos_pendientes + -- GROUP BY fecha,proveedor_id,empresa_id,moneda_id + WHERE saldo < 0.5 AND saldo > -0.5; + + + select *,'delete' from rowsToDelete; + + + DELETE vp.* FROM vencimientos_pendientes vp JOIN rowsToDelete rd + ON (vp.fecha < rd.fecha OR (vp.fecha = rd.fecha AND vp.vencimiento_id <= rd.vencimiento_id)) + AND vp.proveedor_id = rd.proveedor_id AND vp.empresa_id = rd.empresa_id AND vp.moneda_id = rd.moneda_id + + WHERE isPago = FALSE; + + + SELECT vp.vencimiento_id + , vp.fecha + , vp.proveedor_id + , vp.empresa_id + , vp.moneda_id + , vp.importe + , vp.pendiente + , vp.saldo + , p.pay_met_id + , vp.isPago + , vp.conciliado + , vp.saldoFinal + FROM vencimientos_pendientes vp + LEFT JOIN Proveedores p ON p.Id_Proveedor = vp.proveedor_id; + + DROP TEMPORARY TABLE vencimientos_pendientes; + DROP TEMPORARY TABLE saldos_iniciales; + DROP TEMPORARY TABLE rowsToDelete; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -36918,6 +37481,423 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `traslado`(IN i_entrada INTEGER) +BEGIN +-- Lo esta probando JFP 2018-12-13 + DECLARE dateShipment DATE; + DECLARE dateLanding DATE; + DECLARE warehouseShipment INTEGER; + DECLARE warehouseLanding INTEGER; + DECLARE v_calc_visible INTEGER; + DECLARE vInventoryDate DATE; + + SET vInventoryDate := date_inv(); + SELECT shipment, landing, warehouse_id_out, warehouse_id + INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding + FROM travel t JOIN Entradas e ON t.id = e.travel_id + WHERE Id_Entrada = i_entrada; + + CALL buy_tarifas_table(i_entrada); + + -- Traslado en almacen origen + + DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; + CREATE TEMPORARY TABLE buy_edi_temp + (KEY (Id_Article), INDEX(Id_Compra)) ENGINE = MEMORY + SELECT * + FROM (SELECT c.Id_Article, c.Id_Compra + FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) + INNER JOIN travel t ON t.id = e.travel_id + WHERE t.landing BETWEEN vInventoryDate AND dateShipment + AND c.Novincular = FALSE + AND c.Tarifa2 >= 0 + ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC) t + GROUP BY Id_Article; + + CALL vn.buyUltimateFromInterval(warehouseLanding,vInventoryDate,dateLanding); + + IF dateShipment >= CURDATE() THEN + + CALL availableTraslate(warehouseShipment, dateShipment,NULL); + CALL `cache`.visible_refresh(v_calc_visible,TRUE,warehouseShipment); + + DROP TEMPORARY TABLE IF EXISTS tmp_item; + CREATE TEMPORARY TABLE tmp_item (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY + SELECT item_id, visible,0 available FROM `cache`.visible WHERE calc_id = v_calc_visible; + INSERT INTO tmp_item(item_id, available) + SELECT a.item_id, a.available FROM availableTraslate a + ON DUPLICATE KEY UPDATE available = a.available; + ELSE + CALL item_stock(warehouseShipment, dateShipment,NULL); + END IF; + + DROP TEMPORARY TABLE IF EXISTS Traslados; + CREATE TEMPORARY TABLE Traslados ENGINE MEMORY + SELECT tp.Id_Tipo AS Tipo, + + tp.reino_id, + + ar.tipo_id, + + ar.Id_Article AS article_id, + + ar.Article, + + ar.Medida, + + ar.Categoria, + + ar.Color, + + Origen.abreviatura as Origen, + + CE.Cantidad, + + ar.Tallos, + + CAST(AIM.visible AS DECIMAL(10,0)) as vis1, + + CAST(AIM.available AS DECIMAL(10,0)) as dis1, + + 0 as vis2, + + 0 as dis2, + + COALESCE(/*cl.grouping, */CE.grouping, C.grouping) as grouping, + + COALESCE(/*cl.Packing, */CE.Packing, C.Packing) as Packing, + + COALESCE(cl.caja, CE.caja, C.caja) as caja, + + IFNULL(C.Productor, P2.Alias) AS Productor, + + C.Id_Cubo, + + 1 Tinta, + + CE.Id_Compra, + + CE.Etiquetas, + + C.buy_edi_id, + + tp.Id_Trabajador, + + CB.Volumen, + + CB.x, CB.y, CB.z, + + IFNULL(C.Costefijo,0) Costefijo, + + IFNULL(C.Comisionfija,0) Comisionfija, + + IFNULL(C.Portefijo,0) Portefijo, + + A.m3, + + E.comision, + + CB.Retornable, + + IFNULL(CEB.Valor,CB.Valor) Valor, + + t3, t2, tp.promo, + + C.grouping groupingOrigin, + + C.Packing PackingOrigin, + + C.Id_Compra CompraOrigin, + + CB.costeRetorno + + FROM Articles ar + LEFT JOIN tmp_item AIM ON AIM.item_id = ar.Id_Article + LEFT JOIN Tipos tp ON tp.tipo_id = ar.tipo_id + LEFT JOIN Origen ON Origen.id = ar.id_origen + LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article + LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra + LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo + LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada + LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor + LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada + LEFT JOIN travel TR ON TR.id = E.travel_id + LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id + LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada + LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo + LEFT JOIN tblTARIFAS ON TRUE + LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = ar.Id_Article + LEFT JOIN Compres cl ON cl.Id_Compra = bufi.buyFk + WHERE tp.reino_id <> 6 AND tp.reino_id <> 8 + AND E.Redada = FALSE; + + CREATE INDEX tindex USING HASH ON Traslados (article_id); + +-- Inventario en el warehouse destino + IF dateShipment >= CURDATE() THEN + + CALL cache.visible_refresh(v_calc_visible, TRUE, warehouseLanding); + CALL availableTraslate(warehouseLanding, dateLanding,warehouseShipment); + + UPDATE Traslados t + LEFT JOIN availableTraslate a ON t.article_id = a.item_id + LEFT JOIN `cache`.visible v ON v.calc_id = v_calc_visible AND t.article_id = v.item_id + SET vis2 = v.visible, dis2 = a.available; + + END IF; +-- --------------------------------------------- + + SELECT t.*, + + Cantidad - MOD(Cantidad , grouping) as Subcantidad, + + MOD(Cantidad , grouping) as Soll, + + ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing,0) as cm3, + + Costefijo + Comisionfija + Portefijo AS Cost, + + @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte, + + @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, + + ROUND(@embalaje := (costeRetorno + IF(Retornable != 0, 0, Valor)) / packing ,3) AS Embalaje, + + @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste, + + @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3, + + ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2, + + 0 selected + + FROM Traslados t + WHERE vis1 <> 0 OR dis1 <> 0 OR vis2 <> 0 OR dis2 <> 0 + ORDER BY tipo_id, Article, Medida, Categoria, Origen; + + DROP TEMPORARY TABLE IF EXISTS Traslados; + DROP TEMPORARY TABLE IF EXISTS tmp_item; + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `trasladoBetaKk` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `trasladoBetaKk`(IN i_entrada INTEGER) +BEGIN + DECLARE dateShipment DATE; + DECLARE dateLanding DATE; + DECLARE warehouseShipment INTEGER; + DECLARE warehouseLanding INTEGER; + DECLARE v_calc_available INTEGER; + DECLARE v_calc_visible INTEGER; + + SELECT shipment, landing, warehouse_id_out, warehouse_id + INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding + FROM travel t JOIN Entradas e ON t.id = e.travel_id + WHERE Id_Entrada = i_entrada; + + CALL buy_tarifas_table(i_entrada); + + -- Traslado en almacen origen + + DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; + + CREATE TEMPORARY TABLE buy_edi_temp + (KEY (Id_Article)) ENGINE = MEMORY + + SELECT * FROM (SELECT c.Id_Article, c.Id_Compra + FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) + INNER JOIN travel t ON t.id = e.travel_id + WHERE t.landing BETWEEN date_inv() AND dateShipment + AND c.Novincular = FALSE + AND c.Tarifa2 >= 0 + ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC) t + GROUP BY Id_Article; + + IF dateShipment >= CURDATE() THEN + + -- CALL `cache`.available_refresh(v_calc_available, TRUE, warehouseShipment, dateShipment); + CALL availableTraslate(warehouseShipment, dateShipment,NULL); + CALL `cache`.visible_refresh(v_calc_visible,TRUE,warehouseShipment); + DROP TEMPORARY TABLE IF EXISTS tmp_item; + CREATE TEMPORARY TABLE tmp_item (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY + SELECT item_id, visible,0 available FROM `cache`.visible WHERE calc_id = v_calc_visible; + INSERT INTO tmp_item(item_id, available) + SELECT a.item_id, a.available FROM availableTraslate a + ON DUPLICATE KEY UPDATE available = a.available; + ELSE + CALL item_stock(warehouseShipment, dateShipment,NULL); + END IF; + + DROP TEMPORARY TABLE IF EXISTS Traslados; + CREATE TEMPORARY TABLE Traslados ENGINE MEMORY + SELECT TP.Id_Tipo AS Tipo, + + TP.reino_id, + + ar.tipo_id, + + ar.Id_Article AS article_id, + + ar.Article, + + ar.Medida, + + ar.Categoria, + + ar.Color, + + Origen.abreviatura as Origen, + + CE.Cantidad, + + ar.Tallos, + + CAST(AIM.visible AS DECIMAL(10,0)) as vis1, + + CAST(AIM.available AS DECIMAL(10,0)) as dis1, + + 0 as vis2, + + 0 as dis2, + + IFNULL(CE.grouping,C.grouping) as grouping, + + IFNULL(CE.Packing,C.Packing) as Packing, + + IFNULL(CE.caja,C.caja) as caja, + + IFNULL(C.Productor, P2.Alias) AS Productor, + + C.Id_Cubo, + + 1 Tinta, + + CE.Id_Compra, + + CE.Etiquetas, + + C.buy_edi_id, + + TP.Id_Trabajador, + + CB.Volumen, + + CB.x, CB.y, CB.z, + + IFNULL(C.Costefijo,0) Costefijo, + + IFNULL(C.Comisionfija,0) Comisionfija, + + IFNULL(C.Portefijo,0) Portefijo, + + A.m3, + + E.comision, + + CB.Retornable, + + IFNULL(CEB.Valor,CB.Valor) Valor, + + t3, t2, TP.promo + + FROM Articles ar + LEFT JOIN tmp_item AIM ON AIM.item_id = ar.Id_Article + LEFT JOIN Tipos TP USING(tipo_id) + LEFT JOIN Origen ON Origen.id = ar.id_origen + LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article + LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra + LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo + LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada + LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor + LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada + LEFT JOIN travel TR ON TR.id = E.travel_id + LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id + LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada + LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo + LEFT JOIN tblTARIFAS ON TRUE + WHERE TP.reino_id <> 6 AND TP.reino_id <> 8 + AND E.Redada = FALSE; + + + CREATE INDEX tindex USING HASH ON Traslados (article_id); + +-- Inventario en el warehouse destino + IF dateShipment >= CURDATE() THEN + + CALL cache.visible_refresh(v_calc_visible, TRUE, warehouseLanding); + SELECT warehouseLanding, dateLanding,warehouseShipment; + CALL availableTraslateTesting(warehouseLanding, dateLanding,warehouseShipment); + + SELECT * FROM availableTraslate; + + UPDATE Traslados t + LEFT JOIN availableTraslate a ON t.article_id = a.item_id + LEFT JOIN `cache`.visible v ON v.calc_id = v_calc_visible AND t.article_id = v.item_id + SET vis2 = v.visible, dis2 = a.available; + + END IF; +-- --------------------------------------------- + + SELECT t.*, + + Cantidad - MOD(Cantidad , grouping) as Subcantidad, + + MOD(Cantidad , grouping) as Soll, + + (IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing as cm3, + + Costefijo + Comisionfija + Portefijo AS Cost, + + @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte, + + @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, + + @embalaje := IF(Retornable != 0, 0,ROUND(Valor / Packing,3)) AS Embalaje, + + @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste, + + @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3, + + ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2, + + 0 selected + + FROM Traslados t + WHERE vis1 <> 0 OR dis1 <> 0 OR vis2 <> 0 OR dis2 <> 0 + ORDER BY tipo_id, Article, Medida, Categoria, Origen; + + DROP TEMPORARY TABLE IF EXISTS Traslados; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `trasladoKk` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `trasladoKk`(IN i_entrada INTEGER) BEGIN DECLARE dateShipment DATE; DECLARE dateLanding DATE; @@ -37109,209 +38089,6 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS Traslados; DROP TEMPORARY TABLE IF EXISTS tmp_item; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `trasladoBeta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_set_results = utf8 */ ; -/*!50003 SET collation_connection = utf8_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `trasladoBeta`(IN i_entrada INTEGER) -BEGIN - DECLARE dateShipment DATE; - DECLARE dateLanding DATE; - DECLARE warehouseShipment INTEGER; - DECLARE warehouseLanding INTEGER; - DECLARE v_calc_available INTEGER; - DECLARE v_calc_visible INTEGER; - - SELECT shipment, landing, warehouse_id_out, warehouse_id - INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding - FROM travel t JOIN Entradas e ON t.id = e.travel_id - WHERE Id_Entrada = i_entrada; - - CALL buy_tarifas_table(i_entrada); - - -- Traslado en almacen origen - - DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; - - CREATE TEMPORARY TABLE buy_edi_temp - (KEY (Id_Article)) ENGINE = MEMORY - - SELECT * FROM (SELECT c.Id_Article, c.Id_Compra - FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) - INNER JOIN travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN date_inv() AND dateShipment - AND c.Novincular = FALSE - AND c.Tarifa2 >= 0 - ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC) t - GROUP BY Id_Article; - - IF dateShipment >= CURDATE() THEN - - -- CALL `cache`.available_refresh(v_calc_available, TRUE, warehouseShipment, dateShipment); - CALL availableTraslate(warehouseShipment, dateShipment,NULL); - CALL `cache`.visible_refresh(v_calc_visible,TRUE,warehouseShipment); - DROP TEMPORARY TABLE IF EXISTS tmp_item; - CREATE TEMPORARY TABLE tmp_item (UNIQUE INDEX i USING HASH (item_id)) ENGINE = MEMORY - SELECT item_id, visible,0 available FROM `cache`.visible WHERE calc_id = v_calc_visible; - INSERT INTO tmp_item(item_id, available) - SELECT a.item_id, a.available FROM availableTraslate a - ON DUPLICATE KEY UPDATE available = a.available; - ELSE - CALL item_stock(warehouseShipment, dateShipment,NULL); - END IF; - - DROP TEMPORARY TABLE IF EXISTS Traslados; - CREATE TEMPORARY TABLE Traslados ENGINE MEMORY - SELECT TP.Id_Tipo AS Tipo, - - TP.reino_id, - - ar.tipo_id, - - ar.Id_Article AS article_id, - - ar.Article, - - ar.Medida, - - ar.Categoria, - - ar.Color, - - Origen.abreviatura as Origen, - - CE.Cantidad, - - ar.Tallos, - - CAST(AIM.visible AS DECIMAL(10,0)) as vis1, - - CAST(AIM.available AS DECIMAL(10,0)) as dis1, - - 0 as vis2, - - 0 as dis2, - - IFNULL(CE.grouping,C.grouping) as grouping, - - IFNULL(CE.Packing,C.Packing) as Packing, - - IFNULL(CE.caja,C.caja) as caja, - - IFNULL(C.Productor, P2.Alias) AS Productor, - - C.Id_Cubo, - - 1 Tinta, - - CE.Id_Compra, - - CE.Etiquetas, - - C.buy_edi_id, - - TP.Id_Trabajador, - - CB.Volumen, - - CB.x, CB.y, CB.z, - - IFNULL(C.Costefijo,0) Costefijo, - - IFNULL(C.Comisionfija,0) Comisionfija, - - IFNULL(C.Portefijo,0) Portefijo, - - A.m3, - - E.comision, - - CB.Retornable, - - IFNULL(CEB.Valor,CB.Valor) Valor, - - t3, t2, TP.promo - - FROM Articles ar - LEFT JOIN tmp_item AIM ON AIM.item_id = ar.Id_Article - LEFT JOIN Tipos TP USING(tipo_id) - LEFT JOIN Origen ON Origen.id = ar.id_origen - LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article - LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra - LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo - LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada - LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor - LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada - LEFT JOIN travel TR ON TR.id = E.travel_id - LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id - LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada - LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo - LEFT JOIN tblTARIFAS ON TRUE - WHERE TP.reino_id <> 6 AND TP.reino_id <> 8 - AND E.Redada = FALSE; - - - CREATE INDEX tindex USING HASH ON Traslados (article_id); - --- Inventario en el warehouse destino - IF dateShipment >= CURDATE() THEN - - CALL cache.visible_refresh(v_calc_visible, TRUE, warehouseLanding); - SELECT warehouseLanding, dateLanding,warehouseShipment; - CALL availableTraslateTesting(warehouseLanding, dateLanding,warehouseShipment); - - SELECT * FROM availableTraslate; - - UPDATE Traslados t - LEFT JOIN availableTraslate a ON t.article_id = a.item_id - LEFT JOIN `cache`.visible v ON v.calc_id = v_calc_visible AND t.article_id = v.item_id - SET vis2 = v.visible, dis2 = a.available; - - END IF; --- --------------------------------------------- - - SELECT t.*, - - Cantidad - MOD(Cantidad , grouping) as Subcantidad, - - MOD(Cantidad , grouping) as Soll, - - (IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing as cm3, - - Costefijo + Comisionfija + Portefijo AS Cost, - - @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte, - - @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, - - @embalaje := IF(Retornable != 0, 0,ROUND(Valor / Packing,3)) AS Embalaje, - - @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste, - - @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3, - - ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2, - - 0 selected - - FROM Traslados t - WHERE vis1 <> 0 OR dis1 <> 0 OR vis2 <> 0 OR dis2 <> 0 - ORDER BY tipo_id, Article, Medida, Categoria, Origen; - - DROP TEMPORARY TABLE IF EXISTS Traslados; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -37532,7 +38309,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `trasladoTesting` */; +/*!50003 DROP PROCEDURE IF EXISTS `trasladoTestingKk` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -37542,7 +38319,7 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `trasladoTesting`(IN i_entrada INTEGER) +CREATE DEFINER=`root`@`%` PROCEDURE `trasladoTestingKk`(IN i_entrada INTEGER) BEGIN DECLARE dateShipment DATE; DECLARE dateLanding DATE; @@ -40220,7 +40997,7 @@ CREATE TABLE `autoRadioLogCall` ( PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=113 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40733,7 +41510,7 @@ CREATE TABLE `clientContact` ( `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4102 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4103 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40807,7 +41584,7 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=184562 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=186901 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -40901,7 +41678,8 @@ SET character_set_client = utf8; /*!50001 CREATE VIEW `clientType` AS SELECT 1 AS `id`, 1 AS `code`, - 1 AS `type`*/; + 1 AS `type`, + 1 AS `isCreatedAsServed`*/; SET character_set_client = @saved_cs_client; -- @@ -41245,7 +42023,7 @@ CREATE TABLE `creditClassification` ( KEY `creditClassifClientFk_idx` (`client`), KEY `creditClassifdateEnd_idx` (`dateEnd`), CONSTRAINT `creditClassifClientFk` FOREIGN KEY (`client`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2995 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2998 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -41290,7 +42068,7 @@ CREATE TABLE `creditInsurance` ( PRIMARY KEY (`id`), KEY `CreditInsurance_Fk1_idx` (`creditClassification`), CONSTRAINT `CreditInsurance_Fk1` FOREIGN KEY (`creditClassification`) REFERENCES `creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2401 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; +) ENGINE=InnoDB AUTO_INCREMENT=2411 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalla los clientes que tienen seguro de credito'; /*!40101 SET character_set_client = @saved_cs_client */; ALTER DATABASE `vn` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -41499,7 +42277,7 @@ CREATE TABLE `dua` ( CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `vn2008`.`gestdoc` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `dua_fk2` FOREIGN KEY (`awbFk`) REFERENCES `vn2008`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `dua_fk4` FOREIGN KEY (`companyFk`) REFERENCES `vn2008`.`empresa` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3571 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3591 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41540,7 +42318,7 @@ CREATE TABLE `duaIntrastat` ( KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `vn2008`.`Intrastat` (`Codintrastat`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5312 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=5364 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41560,7 +42338,7 @@ CREATE TABLE `duaInvoiceIn` ( KEY `duaInvoiceIn_fk2_idx` (`invoiceInFk`), CONSTRAINT `duaInvoiceIn_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaInvoiceIn_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `vn2008`.`recibida` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4470 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; +) ENGINE=InnoDB AUTO_INCREMENT=4489 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Facturas asociadas a la declaración aduanera, básicamente la del agente transitario'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41585,7 +42363,7 @@ CREATE TABLE `duaTax` ( CONSTRAINT `duaTax_fk1` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `duaTax_fk2` FOREIGN KEY (`supplierFk`) REFERENCES `vn2008`.`Proveedores` (`Id_Proveedor`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3374 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3533 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -41681,7 +42459,58 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Entradas` (`Id_Entrada`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=103524 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=106043 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `envialiaAgency` +-- + +DROP TABLE IF EXISTS `envialiaAgency`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `envialiaAgency` ( + `id` varchar(6) COLLATE utf8_unicode_ci NOT NULL, + `route` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `id_UNIQUE` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `envialiaCity` +-- + +DROP TABLE IF EXISTS `envialiaCity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `envialiaCity` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `city` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `postalCode` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `agencyFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `agencyFk` (`agencyFk`), + KEY `postalCode` (`postalCode`) +) ENGINE=InnoDB AUTO_INCREMENT=527660 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `envialiaConfig` +-- + +DROP TABLE IF EXISTS `envialiaConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `envialiaConfig` ( + `serviceType` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `numBox` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `startRange` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `endRange` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `cargoAgency` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + `ActualNumber` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`serviceType`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42055,7 +42884,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3247 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4032 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42069,7 +42898,7 @@ CREATE TABLE `inventoryFailureCause` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42326,7 +43155,7 @@ CREATE TABLE `invoiceOutExpence` ( KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_FK_2` FOREIGN KEY (`expenceFk`) REFERENCES `vn2008`.`Gastos` (`Id_Gasto`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=93937 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; +) ENGINE=InnoDB AUTO_INCREMENT=94260 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Desglosa la base imponible de una factura en funcion del tipo de gasto/venta'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42369,7 +43198,7 @@ CREATE TABLE `invoiceOutTax` ( KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `vn2008`.`Facturas` (`factura_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1023291 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1023718 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42607,7 +43436,7 @@ CREATE TABLE `itemPlacementSupply` ( CONSTRAINT `itemPlacementSupply_fk1` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacementSupply_fk3` FOREIGN KEY (`repoUserFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42678,7 +43507,7 @@ CREATE TABLE `itemShelving` ( CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk2` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelving_fk3` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=40674 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; +) ENGINE=InnoDB AUTO_INCREMENT=44245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla utilizada para localizar los artículos dentro de los carros. Usado para la gestión del almacén en el altillo '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -42834,7 +43663,7 @@ CREATE TABLE `itemTag` ( KEY `priorityItem` (`priority`,`itemFk`), KEY `value` (`value`), CONSTRAINT `itemFK` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=989360 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1005662 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -42962,7 +43791,7 @@ CREATE TABLE `itemTaxCountry` ( CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `vn2008`.`Paises` (`Id`) ON UPDATE CASCADE, CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=587675 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDB AUTO_INCREMENT=598346 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43071,6 +43900,48 @@ CREATE TABLE `itemVerdecora` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona nuestros articulos con los de Verdecora'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `labourHoliday` +-- + +DROP TABLE IF EXISTS `labourHoliday`; +/*!50001 DROP VIEW IF EXISTS `labourHoliday`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `labourHoliday` AS SELECT + 1 AS `legendFk`, + 1 AS `typeFk`, + 1 AS `workcenterFk`, + 1 AS `date`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `labourHolidayLegend` +-- + +DROP TABLE IF EXISTS `labourHolidayLegend`; +/*!50001 DROP VIEW IF EXISTS `labourHolidayLegend`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `labourHolidayLegend` AS SELECT + 1 AS `id`, + 1 AS `description`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `labourHolidayType` +-- + +DROP TABLE IF EXISTS `labourHolidayType`; +/*!50001 DROP VIEW IF EXISTS `labourHolidayType`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `labourHolidayType` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `rgb`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `mail` -- @@ -43212,7 +44083,7 @@ CREATE TABLE `medicalReview` ( KEY `frgnkWorker_idx` (`workerFk`), CONSTRAINT `frgcenter` FOREIGN KEY (`centerFk`) REFERENCES `medicalCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnkWorker` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=125 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43233,7 +44104,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB AUTO_INCREMENT=1718069 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1727393 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43255,7 +44126,7 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB AUTO_INCREMENT=1880372 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1890074 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43489,7 +44360,7 @@ CREATE TABLE `parking` ( UNIQUE KEY `code_UNIQUE` (`code`), KEY `parking_fk1_idx` (`sectorFk`), CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=24377 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; +) ENGINE=InnoDB AUTO_INCREMENT=24496 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -44042,7 +44913,7 @@ DROP TABLE IF EXISTS `receipt`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `receipt` AS SELECT - 1 AS `Id`, + 1 AS `id`, 1 AS `invoiceFk`, 1 AS `amountPaid`, 1 AS `amountUnpaid`, @@ -44140,6 +45011,42 @@ SET character_set_client = utf8; 1 AS `description`*/; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `routeAction` +-- + +DROP TABLE IF EXISTS `routeAction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeAction` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeComplement` +-- + +DROP TABLE IF EXISTS `routeComplement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeComplement` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `workerFk` int(11) NOT NULL, + `price` decimal(10,2) NOT NULL, + `routeActionFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `fgn_workerFk_idx` (`workerFk`), + KEY `fgn_routeActionFk_idx` (`routeActionFk`), + CONSTRAINT `fgn_routeActionFk` FOREIGN KEY (`routeActionFk`) REFERENCES `routeAction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fgn_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `routeGate` -- @@ -44231,7 +45138,26 @@ CREATE TABLE `routeLog` ( `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `description` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=727800 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=739513 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeParams` +-- + +DROP TABLE IF EXISTS `routeParams`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeParams` ( + `kmRate` decimal(10,2) DEFAULT NULL, + `m3Distributed` decimal(10,2) DEFAULT NULL, + `load1m3` decimal(10,2) DEFAULT NULL, + `load2m3` decimal(10,2) DEFAULT NULL, + `load3m3` decimal(10,2) DEFAULT NULL, + `load4m3` decimal(10,2) DEFAULT NULL, + `load5m3` decimal(10,2) DEFAULT NULL, + `load6m3` decimal(10,2) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44317,7 +45243,7 @@ CREATE TABLE `saleItemShelving` ( `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDB AUTO_INCREMENT=20985 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=21520 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44450,7 +45376,7 @@ CREATE TABLE `sms` ( `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=118372 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=119316 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44615,7 +45541,7 @@ CREATE TABLE `stockBuyed` ( UNIQUE KEY `date_UNIQUE` (`date`,`user`), KEY `stockBuyed_user_idx` (`user`), CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=490624 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=508653 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44626,8 +45552,8 @@ DROP TABLE IF EXISTS `stowaway`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `stowaway` ( - `id` int(11) NOT NULL, - `shipFk` int(11) NOT NULL, + `id` int(11) NOT NULL COMMENT 'ticket pequeño', + `shipFk` int(11) NOT NULL COMMENT 'ticket grande', `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tickets polizones y sus naves de embarque'; @@ -44903,7 +45829,7 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4084507 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4205012 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44972,7 +45898,7 @@ CREATE TABLE `ticketPackaging` ( KEY `ticketPackaging_fk2_idx` (`packagingFk`), CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `vn2008`.`Cubos` (`Id_Cubo`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=49663 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=50799 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -44988,6 +45914,7 @@ CREATE TABLE `ticketPackagingStartingStock` ( `itemFk` int(11) NOT NULL, `sent` int(11) DEFAULT NULL, `returned` int(11) DEFAULT NULL, + `isForgetable` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`clientFk`,`packagingFk`), KEY `ticketPackagingStartingStock_fk2_idx` (`packagingFk`), KEY `ticketPackagingStartingStock_fk3_idx` (`itemFk`), @@ -45031,10 +45958,13 @@ CREATE TABLE `ticketService` ( `quantity` int(11) NOT NULL DEFAULT '0', `price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00', `taxClassFk` tinyint(3) unsigned DEFAULT NULL, + `ticketFk` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `ticketServiceIvaGroup_idx` (`taxClassFk`), + KEY `fgn_ticketFk_idx` (`ticketFk`), + CONSTRAINT `fgn_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketServiceIvaGroup` FOREIGN KEY (`taxClassFk`) REFERENCES `vn2008`.`iva_group` (`iva_group_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45244,7 +46174,7 @@ CREATE TABLE `trainingCourse` ( CONSTRAINT `frgnCenter` FOREIGN KEY (`centerFk`) REFERENCES `trainingCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnTrainingCourseType` FOREIGN KEY (`trainingCourseTypeFk`) REFERENCES `trainingCourseType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `frgnWorker` FOREIGN KEY (`workerFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=232 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +) ENGINE=InnoDB AUTO_INCREMENT=235 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45476,6 +46406,20 @@ CREATE TABLE `workCenter` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `workcenter` +-- + +DROP TABLE IF EXISTS `workcenter`; +/*!50001 DROP VIEW IF EXISTS `workcenter`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `workcenter` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `warehouseFk`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `worker` -- @@ -45553,7 +46497,7 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_2` (`document`), CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `vn2008`.`Trabajadores` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `vn2008`.`gestdoc` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8693 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8915 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45603,7 +46547,7 @@ CREATE TABLE `workerJourney` ( UNIQUE KEY `userFk_UNIQUE` (`userFk`,`dated`), KEY `fk_workerJourney_user_idx` (`userFk`), CONSTRAINT `fk_workerJourney_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13809758 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16061314 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45625,7 +46569,7 @@ CREATE TABLE `workerLog` ( KEY `userFk_idx` (`userFk`), CONSTRAINT `userFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `workerFk` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=7467 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7717 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45675,7 +46619,7 @@ CREATE TABLE `workerTimeControl` ( KEY `warehouseFkfk1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1628086 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +) ENGINE=InnoDB AUTO_INCREMENT=1782674 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45808,7 +46752,7 @@ CREATE TABLE `zone` ( KEY `fk_zone2_idx` (`agencyModeFk`), CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -45820,7 +46764,7 @@ DROP TABLE IF EXISTS `zoneCalendar`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneCalendar` ( `zoneFk` int(11) NOT NULL, - `delivered` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `delivered` date NOT NULL, PRIMARY KEY (`zoneFk`,`delivered`), CONSTRAINT `zoneFk` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -45839,7 +46783,7 @@ CREATE TABLE `zoneGeo` ( `lft` int(11) DEFAULT NULL, `rgt` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=23039 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=23093 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -46218,8 +47162,7 @@ BEGIN SELECT COUNT(*) INTO vHasDebt FROM `client` c - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE c.id = vClient AND ct.code = 'normal'; + WHERE c.id = vClient AND c.typeFk = 'normal'; IF NOT vHasDebt THEN RETURN 0; @@ -46299,8 +47242,7 @@ BEGIN SELECT COUNT(*) INTO vHasMana FROM `client` c - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE c.id = vClient AND ct.code = 'normal'; + WHERE c.id = vClient AND c.typeFk = 'normal'; IF NOT vHasMana THEN RETURN 0; @@ -48475,6 +49417,72 @@ BEGIN AND b.price2 > 0 AND NOT b.isIgnored GROUP BY itemFk, warehouseInFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `carrosOficialesANoOficiales` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-developer`@`%` PROCEDURE `carrosOficialesANoOficiales`() +BEGIN + +DECLARE done BOOL DEFAULT FALSE; +DECLARE vClientFk INT; +DECLARE vQuantity INT; +DECLARE vTicketFk INT; +DECLARE vAgencyTypeFk INT DEFAULT 628; + + +DECLARE rs CURSOR FOR + SELECT clientFk, sum(quantity) as carros + FROM `ticketPackaging` tp + JOIN ticket t ON t.id = tp.ticketFk + WHERE packagingFk = 'cc' + and t.shipped between '2017-10-30' AND '2019-01-06 23:59:59' + group by clientFk + having carros != 0; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN rs; + +FETCH rs INTO vClientFk, vQuantity; + +-- WHILE NOT done DO + + CALL vn.ticketCreate(vClientFk, '2019-01-06', 13, 442, NULL, vAgencyTypeFk, NULL, '2019-01-01', vTicketFk); + + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + VALUES (vTicketFk, 'cc', - VQuantity); + + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + VALUES (vTicketFk, 'dc', VQuantity); + + INSERT INTO vn.sale(ticketFk, itemFk, concept) + VALUES (vTicketFk, 90, 'Regularización CCs 2019'); + + CALL vn.`ticketStateUpdate`(vTicketFk, 'DELIVERED'); -- entregado + +-- FETCH rs INTO vClientFk, vQuantity; + +-- END WHILE; + + +CLOSE rs; + +SELECT vTicketFk; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48648,11 +49656,10 @@ BEGIN IF day(CURDATE()) IN (10,20,30) THEN UPDATE vn.client c - JOIN vn.clientType ct ON ct.id = c.clientTypeFk JOIN bi.defaulters d ON d.client = c.id AND d.date = CURDATE() JOIN vn.config ON TRUE SET c.isFreezed = TRUE - WHERE d.amount > config.defaultersMaxAmount AND ct.code = 'normal'; + WHERE d.amount > config.defaultersMaxAmount AND c.typeFk = 'normal'; END IF; @@ -48948,6 +49955,7 @@ BEGIN FROM vn.ticketPackagingStartingStock tps LEFT JOIN vn.packageEquivalentItem pe ON pe.itemFk = tps.itemFk WHERE tps.clientFk = vClientFk + AND tps.isForgetable = FALSE UNION ALL @@ -53241,7 +54249,7 @@ BEGIN -- Al insertar el tag medida se modifica también en la tabla item SELECT it.`value` INTO vSize FROM itemTag it - WHERE vItem = it.itemFk AND it.tagFk = 4; + WHERE vItem = it.itemFk AND it.tagFk IN (4, 8); IF vSize > '' THEN UPDATE item SET size = vSize WHERE id = vItem; @@ -54299,20 +55307,26 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + SET @isTriggerDisabled = TRUE; + DROP TEMPORARY TABLE IF EXISTS upda; - create temporary table upda - SELECT i.id, - left(it.value,LENGTH(it.value) - INSTR(REVERSE(it.value),' ')) variedad - FROM vn.item i - JOIN vn.itemType ity ON ity.id = i.typeFk - JOIN vn.itemTag it ON it.itemFk = i.id - WHERE ity.workerFk = 63 AND it.value REGEXP ' X[[:digit:]]' and it.priority = 2; - - UPDATE itemTag it - JOIN upda u ON it.itemFk = u.id - SET it.value = u.variedad - WHERE it.priority = 2; - + CREATE TEMPORARY TABLE upda + SELECT i.id, itg.value,right(itg.value,INSTR(REVERSE(itg.value),' ')-2) escribe, + right(itg.value,INSTR(REVERSE(itg.value),' ')) elimina + FROM item i + JOIN itemType it ON it.id = i.typeFk + JOIN vn.itemTag itg ON itg.itemFk = i.id AND priority = 2 + WHERE it.workerFk = 63 AND itg.value REGEXP 'D[[:digit:]]+CM'; + + + INSERT IGNORE INTO itemTag (itemFk, tagFk, value, priority) + SELECT id, 5, escribe, 9 + FROM upda; + + UPDATE upda u + JOIN itemTag it ON it.itemFk = u.id AND it.priority = 2 + SET it.value = REPLACE(it.value,u.elimina,''); + OPEN cur; proc: LOOP SET vDone = FALSE; @@ -54324,6 +55338,7 @@ BEGIN END LOOP; CLOSE cur; + SET @isTriggerDisabled = FALSE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54815,37 +55830,27 @@ CREATE DEFINER=`root`@`%` PROCEDURE `nestTree`( vDestinationSchema VARCHAR(45), vDestinationTable VARCHAR(45)) BEGIN - DECLARE vSql TEXT; - + CALL util.exec(CONCAT( + 'DROP TABLE IF EXISTS ', vDestinationSchema, '.', vDestinationTable)); - SET vSql = sql_printf('DROP TABLE IF EXISTS %t.%t', vDestinationSchema, vDestinationTable); - SET @qrySql := vSql; - - PREPARE stmt FROM @qrySql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - SET vSql = sql_printf(' - CREATE TABLE %t.%t - SELECT + CALL util.exec(CONCAT( + 'CREATE TABLE ', vDestinationSchema, '.', vDestinationTable, + ' SELECT node.id, node.name, node.lft, node.rgt, COUNT(parent.id) - 1 depth, CAST((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons - FROM - %t.%t AS node, - %t.%t AS parent - WHERE node.lft BETWEEN parent.lft AND parent.rgt + FROM ', + vSourceSchema, '.', vSourceTable, ' AS node,', + vSourceSchema, '.', vSourceTable, ' AS parent ', + 'WHERE node.lft + BETWEEN parent.lft AND parent.rgt GROUP BY node.id - ORDER BY node.lft', - vDestinationSchema, vDestinationTable, vSourceSchema, vSourceTable, vSourceSchema, vSourceTable); - SET @qrySql := vSql; - - PREPARE stmt FROM @qrySql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; + ORDER BY node.lft')); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56442,7 +57447,7 @@ BEGIN -- Polizón FIXME mostrar en encajado y movil a tiempo real - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + /* INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) SELECT vStowawayFk, id, 'POLIZÓN!' FROM observationType ot WHERE ot.description IN ('Sacador', 'Encajador') @@ -56453,7 +57458,7 @@ BEGIN FROM observationType WHERE description IN ('Sacador','Repartidor') ON DUPLICATE KEY UPDATE description = CONCAT('POLIZÓN! ',ticketObservation.description); - +*/ INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) SELECT id, vShipFk, getWorker(),20 FROM state @@ -56480,6 +57485,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `stowawayUnBoarding`(vShipFk INT, vStowawayFk INT) BEGIN + + DECLARE vWorker VARCHAR(255); + DELETE FROM stowaway WHERE shipFk = vShipFk AND id = vStowawayFk; @@ -56489,6 +57497,12 @@ BEGIN DELETE FROM sale WHERE ticketFk = vShipFk AND itemFk = 98 AND concept = CONCAT('POLIZÓN! ',vStowawayFk); + + SELECT u.`name` INTO vWorker + FROM account.user u JOIN vn.worker w ON w.userFk = u.id + WHERE w.id = vn2008.Averiguar_ComercialCliente_IdTicket_Id(vStowawayFk); + + SELECT messageSend(vWorker,CONCAT('El ticket: ', vStowawayFk, ' ha dejado de ser un polizón')) INTO @a; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56842,11 +57856,11 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicket BIGINT) +CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT) BEGIN - /* - * + * @vTicketNew id del nuevo ticket clonado + * @vTicketOld id ticket original, a partir del qual se clonara el nuevo * Este procedimiento "rebioniza" una linea, eliminando los componentes existentes e insertandolos de nuevo */ DECLARE vShipped DATE; @@ -56857,13 +57871,16 @@ BEGIN DECLARE vLanded DATE; DECLARE vAgency INT; - REPLACE orderTicket(orderFk,ticketFk) VALUES(48, vTicket); + REPLACE INTO orderTicket(orderFk,ticketFk) + SELECT orderFk, vTicketNew + FROM orderTicket + WHERE ticketFk = vTicketOld; SELECT t.clientFk , t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency FROM vn.agencyMode a JOIN vn.ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicket; + WHERE t.id = vTicketNew; DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped; CREATE TEMPORARY TABLE tmp.agencyHourGetShipped ENGINE = MEMORY @@ -56876,7 +57893,7 @@ BEGIN SELECT vWarehouse warehouseFk,NULL available,s.itemFk, bu.buyFk FROM sale s LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicket GROUP BY s.itemFk; + WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk; CALL ticketComponentCalculate(vAddress,vAgencyMode); @@ -56886,7 +57903,7 @@ BEGIN (PRIMARY KEY (saleFk)) ENGINE = MEMORY SELECT s.id saleFk, vWarehouse warehouseFk FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicket AND s.price = 0; + JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0; CALL ticketComponentUpdateSale(1); @@ -56896,7 +57913,8 @@ BEGIN (PRIMARY KEY (saleFk)) ENGINE = MEMORY SELECT s.id saleFk, vWarehouse warehouseFk FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicket AND s.price > 0; + JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew + AND s.price > 0; CALL ticketComponentUpdateSale(6); @@ -56906,14 +57924,17 @@ BEGIN UPDATE ticket t JOIN tmp.agencyHourGetLanded ah ON t.warehouseFk = ah.warehouseFk SET t.landed = ah.landed - WHERE t.id = vTicket; + WHERE t.id = vTicketNew; END IF; -- Log - CALL `logAdd`(vTicket, 'update', ' ticket' , 'Bioniza Ticket'); + CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket'); -- Limpieza - DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58874,6 +59895,10 @@ BEGIN JOIN ticket t ON t.id = tt.ticketFk JOIN client c ON c.id = t.ClientFk; + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60188,7 +61213,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `zoneNestCountry` */; +/*!50003 DROP PROCEDURE IF EXISTS `xdiarioNextId` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -60198,30 +61223,59 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `zoneNestCountry`() +CREATE DEFINER=`root`@`%` PROCEDURE `xdiarioNextId`() +BEGIN + DECLARE vXdiarioNextId INT; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + SELECT nasiento + 1 INTO vXdiarioNextId FROM vn2008.tblContadores FOR UPDATE; + IF (SELECT MAX(ASIEN) >= vXdiarioNextId FROM XDiario) THEN + CALL util.throw('CANNOT GET NEW BOOK ENTRY ID'); + END IF; + UPDATE vn2008.tblContadores SET nasiento = vXdiarioNextId; + -- CALL util.debugAdd('nasiento', '2'); + + COMMIT; + + SELECT vXdiarioNextId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `zoneNestCountry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` PROCEDURE `zoneNestCountry`(countryFk INT) BEGIN DECLARE vDone BOOL; DECLARE vParent INT DEFAULT 1; DECLARE vGeoFk INT; DECLARE vChildFk INT; - DECLARE vChildName VARCHAR(45); + DECLARE vChildName VARCHAR(100); DECLARE countryCur CURSOR FOR SELECT 1, c.id, c.`country` FROM vn.country c + WHERE c.id = countryFk ORDER BY c.`country`; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - -- Reset geoFk from country table - UPDATE vn.country SET geoFk = 0; - - DELETE FROM `vn`.`zoneNest`; - - ALTER TABLE `vn`.`zoneNest` - AUTO_INCREMENT = 1 ; - -- > Country cursor start OPEN countryCur; @@ -60235,7 +61289,7 @@ BEGIN LEAVE countryLoop; END IF; - CALL nestAdd('vn', 'zoneNest', vParent, vChildName); + CALL nestAdd('vn', 'zoneGeo', vParent, vChildName); -- Update country geoFk SET vGeoFk = LAST_INSERT_ID(); @@ -60313,28 +61367,26 @@ DELIMITER ; /*!50003 SET character_set_results = utf8 */ ; /*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `zoneNestProvince`() +CREATE DEFINER=`root`@`%` PROCEDURE `zoneNestProvince`(countryFk INT) BEGIN DECLARE vDone BOOL; DECLARE vParent INT DEFAULT 1; DECLARE vGeoFk INT; DECLARE vChildFk INT; - DECLARE vChildName VARCHAR(45); + DECLARE vChildName VARCHAR(100); DECLARE provinceCur CURSOR FOR SELECT c.geoFk, p.id, p.`name` FROM province p JOIN country c ON c.id = p.countryFk + WHERE c.id = countryFk ORDER BY p.`name`; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - -- Reset geoFk from province table - UPDATE vn.province SET geoFk = 0; - -- > Province cursor start OPEN provinceCur; @@ -60347,7 +61399,7 @@ BEGIN LEAVE provinceLoop; END IF; - CALL nestAdd('vn', 'zoneNest', vParent, vChildName); + CALL nestAdd('vn', 'zoneGeo', vParent, vChildName); -- Update province geoFk SET vGeoFk = LAST_INSERT_ID(); @@ -60453,6 +61505,20 @@ CREATE TABLE `PriceDetails` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `VMPSettings` +-- + +DROP TABLE IF EXISTS `VMPSettings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `VMPSettings` ( + `VMPID` int(11) NOT NULL, + `MessageID` int(11) NOT NULL, + PRIMARY KEY (`VMPID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `batch` -- @@ -60471,7 +61537,7 @@ CREATE TABLE `batch` ( KEY `buy_edi_id` (`buy_edi_id`), CONSTRAINT `batch_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `batch_ibfk_2` FOREIGN KEY (`buy_edi_id`) REFERENCES `vn2008`.`buy_edi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=410058 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=415381 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -60858,7 +61924,7 @@ CREATE TABLE `message` ( UNIQUE KEY `mail_id` (`mail_id`), KEY `sender_id` (`sender_id`), CONSTRAINT `message_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=432286 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=437695 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -60911,7 +61977,7 @@ CREATE TABLE `putOrder` ( `deliveryInformationID` int(11) DEFAULT NULL, `supplyResponseID` int(11) DEFAULT NULL, `orderTradelineItemID` int(11) DEFAULT NULL COMMENT 'ticketFk or EntryFk?', - `OrderTradeLineDateTime` datetime DEFAULT NULL, + `OrderTradeLineDateTime` datetime DEFAULT NULL COMMENT 'fecha de creacion en la tabla', `quantity` int(11) DEFAULT NULL, `EndUserPartyID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `EndUserPartyGLN` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -60919,7 +61985,7 @@ CREATE TABLE `putOrder` ( `isOrderProcessed` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `orderTradelineItemID_UNIQUE` (`orderTradelineItemID`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61982,7 +63048,7 @@ CREATE TABLE `productivity` ( `numPaletizadores` int(11) NOT NULL DEFAULT '0', `costPaletizado` double NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8156082 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10980942 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -67510,7 +68576,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=MyISAM AUTO_INCREMENT=241754 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=MyISAM AUTO_INCREMENT=244378 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -68305,7 +69371,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB AUTO_INCREMENT=244118 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=253638 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -70197,7 +71263,7 @@ CREATE TABLE `inter` ( CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn2008`.`state` (`id`) ON UPDATE CASCADE, CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=14559348 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14751892 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71018,7 +72084,7 @@ CREATE TABLE `news` ( KEY `tag` (`tag`), CONSTRAINT `news_ibfk_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`account` (`id`) ON UPDATE CASCADE, CONSTRAINT `news_ibfk_2` FOREIGN KEY (`tag`) REFERENCES `newsTag` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13041 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13048 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71069,7 +72135,7 @@ CREATE TABLE `order` ( CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn2008`.`Consignatarios` (`id_consigna`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn2008`.`Vistas` (`vista_id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn2008`.`Agencias` (`Id_Agencia`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1709809 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1724007 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71171,7 +72237,7 @@ CREATE TABLE `orderRow` ( KEY `warehouse_shipment` (`warehouseFk`,`shipment`), CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn2008`.`Articles` (`Id_Article`) ON UPDATE CASCADE, CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10383573 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10472858 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -71531,7 +72597,7 @@ CREATE TABLE `tpvTransaction` ( CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn2008`.`Recibos` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn2008`.`Clientes` (`id_cliente`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_2` FOREIGN KEY (`merchantFk`) REFERENCES `tpvMerchant` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=274823 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDB AUTO_INCREMENT=277375 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71566,7 +72632,7 @@ CREATE TABLE `visit` ( PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgent`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgent`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1526574 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1552207 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71586,7 +72652,7 @@ CREATE TABLE `visitAccess` ( KEY `visit_access_idx_agent` (`agent`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agent`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3374666 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3420597 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71611,7 +72677,7 @@ CREATE TABLE `visitAgent` ( KEY `firstAccess` (`firstAccess`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visit`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccess`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2101837 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2128780 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71631,7 +72697,7 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`user`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`access`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3106605 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3133091 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -72680,11 +73746,11 @@ BEGIN /*JGF 2018-12-20 Temporal quitar despues de las pruebas */ IF (SELECT NOW() mod 2) THEN SELECT ot.ticketFk INTO vTicketFk FROM vn.orderTicket ot - JOIN vn.ticketState ts ON ts.ticketFk = ot.ticketfk - WHERE orderFk = vOrderFk AND ts.alertLevel < 3; + LEFT JOIN vn.ticketState ts ON ts.ticketFk = ot.ticketfk + WHERE orderFk = vOrderFk AND (ts.alertLevel < 3 OR ts.alertLevel IS NULL); INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vTicketFk, getWorker() + SELECT id, vTicketFk, vn.getWorker() FROM vn.state WHERE `code` = 'DELIVERED'; END IF; @@ -72962,6 +74028,40 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `myTicketSetDelivered` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`z-developer`@`%` PROCEDURE `myTicketSetDelivered`(vTicketFk INT) +BEGIN + + UPDATE `vn2008`.`agency_hour` SET `subtract_day` = '0' WHERE (`agency_hour_id` = '1061'); + UPDATE `vn2008`.`agency_hour` SET `subtract_day` = '0' WHERE (`agency_hour_id` = '1121'); + UPDATE `vn2008`.`agency_hour` SET `subtract_day` = '0' WHERE (`agency_hour_id` = '1134'); + UPDATE `vn2008`.`agency_hour` SET `subtract_day` = '0' WHERE (`agency_hour_id` = '1148'); + UPDATE `vn2008`.`agency_hour` SET `subtract_day` = '0' WHERE (`agency_hour_id` = '1920'); + + IF vTicketFk is null THEN + call util.throw ('AGENCIA ACTUALIZADA'); + END IF; + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s.id, vTicketFk, vn.getWorker() + FROM vn.state s + JOIN myTicket m ON m.id = vTicketFk + WHERE `code` = 'DELIVERED' AND m.id = vTicketFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `orderAddItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -74949,6 +76049,2285 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Current Database: `postgresql` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `postgresql` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */; + +USE `postgresql`; + +-- +-- Table structure for table `address` +-- + +DROP TABLE IF EXISTS `address`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `address` ( + `address_id` int(11) NOT NULL AUTO_INCREMENT, + `town_id` int(11) NOT NULL, + `address_type_id` int(11) NOT NULL, + `name` varchar(40) DEFAULT NULL, + `address1` varchar(255) DEFAULT NULL, + `number` int(11) DEFAULT NULL, + `address2` varchar(30) DEFAULT NULL, + PRIMARY KEY (`address_id`), + KEY `address_address_type_id_idx` (`address_type_id`), + KEY `address_town_id_idx` (`town_id`), + CONSTRAINT `address_ibfk_1` FOREIGN KEY (`address_type_id`) REFERENCES `address_type` (`address_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `address_ibfk_2` FOREIGN KEY (`town_id`) REFERENCES `town` (`town_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=752 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `address_default` +-- + +DROP TABLE IF EXISTS `address_default`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `address_default` ( + `address_default_id` int(11) NOT NULL AUTO_INCREMENT, + `profile_business_id` int(11) NOT NULL, + `address_id` int(11) NOT NULL, + PRIMARY KEY (`address_default_id`), + KEY `address_default_address_id_idx` (`address_id`), + CONSTRAINT `fk_media_default_copy1_address1` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `address_type` +-- + +DROP TABLE IF EXISTS `address_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `address_type` ( + `address_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL, + PRIMARY KEY (`address_type_id`) +) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bank_account` +-- + +DROP TABLE IF EXISTS `bank_account`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bank_account` ( + `bank_account_id` int(11) NOT NULL AUTO_INCREMENT, + `client_id` int(11) DEFAULT NULL, + `account` char(50) DEFAULT NULL, + `bic` char(20) DEFAULT NULL, + `bank_account_type_id` int(11) DEFAULT NULL, + `nation_id` int(11) DEFAULT NULL, + `sortcode` char(50) DEFAULT NULL, + `bank_name` char(30) DEFAULT NULL, + `bank_adress` char(125) DEFAULT NULL, + `bank_city` char(50) DEFAULT NULL, + `bank_account_link_id` int(11) DEFAULT NULL, + PRIMARY KEY (`bank_account_id`), + KEY `fki_bank_account_client_pk` (`client_id`), + KEY `fki_bank_profile` (`client_id`), + KEY `fki_business_account_fk` (`client_id`), + KEY `fki_person_account_fk` (`client_id`), + KEY `bank_account_bank_account_type_id_fkey` (`bank_account_type_id`), + KEY `bank_account_nation_id_fkey` (`nation_id`), + CONSTRAINT `bank_account_bank_account_type_id_fkey` FOREIGN KEY (`bank_account_type_id`) REFERENCES `bank_account_type` (`bank_account_type_id`) ON UPDATE CASCADE, + CONSTRAINT `bank_account_nation_id_fkey` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON UPDATE CASCADE, + CONSTRAINT `bank_profile` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=732 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bank_account_type` +-- + +DROP TABLE IF EXISTS `bank_account_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bank_account_type` ( + `bank_account_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(15) DEFAULT NULL, + PRIMARY KEY (`bank_account_type_id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bank_bic` +-- + +DROP TABLE IF EXISTS `bank_bic`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bank_bic` ( + `nrbe` int(11) NOT NULL, + `denominacion` varchar(255) DEFAULT NULL, + `bic` char(11) DEFAULT NULL, + `referenciaFTH` varchar(35) DEFAULT NULL, + `referenciaVNL` varchar(35) DEFAULT NULL, + PRIMARY KEY (`nrbe`), + KEY `bankbic_ikey1` (`bic`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `barcodeKk` +-- + +DROP TABLE IF EXISTS `barcodeKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `barcodeKk` ( + `item_id` int(11) NOT NULL, + `barcode` varchar(50) DEFAULT NULL, + PRIMARY KEY (`item_id`), + KEY `barcode_item_id_idx` (`item_id`), + CONSTRAINT `fk_barcode_item1` FOREIGN KEY (`item_id`) REFERENCES `itemKk` (`item_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bucketKk` +-- + +DROP TABLE IF EXISTS `bucketKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bucketKk` ( + `pack_type_id` int(11) NOT NULL, + `name` varchar(15) DEFAULT NULL, + `x` int(11) NOT NULL DEFAULT '1', + `y` int(11) NOT NULL DEFAULT '1', + `z` int(11) NOT NULL DEFAULT '1', + `returning` smallint(6) NOT NULL, + PRIMARY KEY (`pack_type_id`), + KEY `bucket_pack_type_id_idx` (`pack_type_id`), + CONSTRAINT `fk_bucket_pack_type1` FOREIGN KEY (`pack_type_id`) REFERENCES `pack_typeKk` (`pack_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bucket_returnKk` +-- + +DROP TABLE IF EXISTS `bucket_returnKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bucket_returnKk` ( + `pack_type_id` int(11) NOT NULL, + `empty` double NOT NULL, + `complete` double NOT NULL, + PRIMARY KEY (`pack_type_id`), + KEY `bucket_return_pack_type_id_idx` (`pack_type_id`), + CONSTRAINT `fk_bucket_return_bucket1` FOREIGN KEY (`pack_type_id`) REFERENCES `bucketKk` (`pack_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bundleKk` +-- + +DROP TABLE IF EXISTS `bundleKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bundleKk` ( + `bundle_id` int(11) NOT NULL AUTO_INCREMENT, + `delivery_id` int(11) NOT NULL, + `bundle_type_id` int(11) NOT NULL, + `amount` int(11) NOT NULL DEFAULT '1', + `value` double NOT NULL, + PRIMARY KEY (`bundle_id`,`delivery_id`), + KEY `bundle_bundle_type_id_idx` (`bundle_type_id`), + KEY `bundle_delivery_id_idx` (`delivery_id`), + CONSTRAINT `bundleKk_ibfk_1` FOREIGN KEY (`bundle_type_id`) REFERENCES `bundle_typeKk` (`bundle_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `bundleKk_ibfk_2` FOREIGN KEY (`delivery_id`) REFERENCES `delivery` (`delivery_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `bundle_typeKk` +-- + +DROP TABLE IF EXISTS `bundle_typeKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bundle_typeKk` ( + `bundle_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL, + PRIMARY KEY (`bundle_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business` +-- + +DROP TABLE IF EXISTS `business`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business` ( + `business_id` int(11) NOT NULL AUTO_INCREMENT, + `client_id` int(11) DEFAULT NULL, + `provider_id` int(11) DEFAULT NULL, + `date_start` date DEFAULT NULL, + `date_end` date DEFAULT NULL, + `workerBusiness` longtext, + `reasonEndFk` int(11) DEFAULT NULL, + PRIMARY KEY (`business_id`), + KEY `business_client` (`client_id`), + KEY `bussiness_provider` (`provider_id`), + CONSTRAINT `business_client` FOREIGN KEY (`client_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `bussiness_provider` FOREIGN KEY (`provider_id`) REFERENCES `profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2231 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_agricultural` +-- + +DROP TABLE IF EXISTS `business_agricultural`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_agricultural` ( + `business_id` int(11) NOT NULL, + PRIMARY KEY (`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_common` +-- + +DROP TABLE IF EXISTS `business_common`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_common` ( + `business_id` int(11) NOT NULL, + `rate` int(11) DEFAULT NULL, + `credit` int(11) DEFAULT NULL, + PRIMARY KEY (`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_labour` +-- + +DROP TABLE IF EXISTS `business_labour`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_labour` ( + `business_id` int(11) NOT NULL, + `notes` longtext, + `department_id` int(11) DEFAULT '2', + `professional_category_id` int(11) DEFAULT '0', + `incentivo` double DEFAULT '0', + `calendar_labour_type_id` int(11) DEFAULT '1', + `porhoras` smallint(6) NOT NULL DEFAULT '0', + `labour_agreement_id` int(11) DEFAULT NULL, + `workcenter_id` int(11) DEFAULT NULL, + PRIMARY KEY (`business_id`), + KEY `fki_business_labour_agreement` (`labour_agreement_id`), + KEY `fki_workcenter_labour` (`workcenter_id`), + KEY `horario_tipo` (`calendar_labour_type_id`), + KEY `business_labour_department` (`department_id`), + CONSTRAINT `bus_restriction` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `business_labour_agreement` FOREIGN KEY (`labour_agreement_id`) REFERENCES `labour_agreement` (`labour_agreement_id`) ON UPDATE CASCADE, + CONSTRAINT `business_labour_department` FOREIGN KEY (`department_id`) REFERENCES `department` (`department_id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `horario_tipo` FOREIGN KEY (`calendar_labour_type_id`) REFERENCES `calendar_labour_type` (`calendar_labour_type_id`) ON UPDATE CASCADE, + CONSTRAINT `workcenter_labour` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_labour_calendar_employee` +-- + +DROP TABLE IF EXISTS `business_labour_calendar_employee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_labour_calendar_employee` ( + `business_labour_calendar_employee_id` int(11) NOT NULL, + `business_id` int(11) NOT NULL, + `calendar_labour_type_id` int(11) NOT NULL, + `date_start` date NOT NULL, + PRIMARY KEY (`business_id`,`date_start`), + KEY `hour_labour_id` (`calendar_labour_type_id`), + CONSTRAINT `business_id` FOREIGN KEY (`business_id`) REFERENCES `business_labour` (`business_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `hour_labour_id` FOREIGN KEY (`calendar_labour_type_id`) REFERENCES `calendar_labour_type` (`calendar_labour_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_labour_ccc` +-- + +DROP TABLE IF EXISTS `business_labour_ccc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_labour_ccc` ( + `business_id` int(11) NOT NULL, + `ccc` varchar(30) NOT NULL, + `date_start` datetime DEFAULT NULL, + `date_end` datetime DEFAULT NULL, + PRIMARY KEY (`business_id`,`ccc`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_labour_payment` +-- + +DROP TABLE IF EXISTS `business_labour_payment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_labour_payment` ( + `business_id` int(11) DEFAULT NULL, + `amount` double DEFAULT NULL, + `date` date DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_labour_payroll` +-- + +DROP TABLE IF EXISTS `business_labour_payroll`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_labour_payroll` ( + `business_id` int(11) NOT NULL, + `cod_tarifa` int(11) DEFAULT NULL, + `cod_categoria` int(11) DEFAULT NULL, + `cod_contrato` int(11) DEFAULT NULL, + `importepactado` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`business_id`), + CONSTRAINT `business_labour_payroll_fk1` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_link` +-- + +DROP TABLE IF EXISTS `business_link`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_link` ( + `business_id` int(11) NOT NULL, + `copy_business_id` int(11) NOT NULL, + PRIMARY KEY (`business_id`), + KEY `business_link_copy_business_id_idx` (`copy_business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_professional` +-- + +DROP TABLE IF EXISTS `business_professional`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_professional` ( + `business_id` int(11) NOT NULL, + PRIMARY KEY (`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_service` +-- + +DROP TABLE IF EXISTS `business_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_service` ( + `business_id` int(11) NOT NULL, + PRIMARY KEY (`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `business_transport` +-- + +DROP TABLE IF EXISTS `business_transport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `business_transport` ( + `business_id` int(11) NOT NULL, + `m3` int(11) DEFAULT NULL, + PRIMARY KEY (`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendar_employee` +-- + +DROP TABLE IF EXISTS `calendar_employee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendar_employee` ( + `business_id` int(11) NOT NULL, + `calendar_state_id` int(11) NOT NULL, + `date` date NOT NULL, + PRIMARY KEY (`business_id`,`date`), + KEY `calendar_employee_business_labour_id_idx` (`business_id`), + KEY `calendar_employee_calendar_state_calendar_state_id_idx` (`calendar_state_id`), + CONSTRAINT `calendar_employee_state_id` FOREIGN KEY (`calendar_state_id`) REFERENCES `calendar_state` (`calendar_state_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendar_free` +-- + +DROP TABLE IF EXISTS `calendar_free`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendar_free` ( + `calendar_free_id` int(11) NOT NULL AUTO_INCREMENT, + `type` varchar(20) NOT NULL, + `rgb` varchar(7) DEFAULT NULL, + PRIMARY KEY (`calendar_free_id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendar_labour` +-- + +DROP TABLE IF EXISTS `calendar_labour`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendar_labour` ( + `calendar_free_id` int(11) NOT NULL, + `person_id` int(11) NOT NULL, + `day` date NOT NULL, + `calendar_labour_legend_id` int(11) DEFAULT NULL, + `workcenter_id` int(11) NOT NULL, + `calendar_id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`calendar_id`), + UNIQUE KEY `person_id_UNIQUE` (`person_id`,`day`,`workcenter_id`), + KEY `calendar_labour_calendar_free_id_idx` (`calendar_free_id`), + KEY `fki_calendar_labour_legend_id` (`calendar_labour_legend_id`), + KEY `fki_calendar_labour_person_day` (`person_id`,`day`), + KEY `fki_workcenter_calendar` (`workcenter_id`), + CONSTRAINT `fk_calendar_labour_calendar_free1` FOREIGN KEY (`calendar_free_id`) REFERENCES `calendar_free` (`calendar_free_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_calendar_labour_legend_id` FOREIGN KEY (`calendar_labour_legend_id`) REFERENCES `calendar_labour_legend` (`calendar_labour_legend_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `workcenter_calendar` FOREIGN KEY (`workcenter_id`) REFERENCES `workcenter` (`workcenter_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=522 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendar_labour_legend` +-- + +DROP TABLE IF EXISTS `calendar_labour_legend`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendar_labour_legend` ( + `calendar_labour_legend_id` int(11) NOT NULL AUTO_INCREMENT, + `descripcion` longtext, + PRIMARY KEY (`calendar_labour_legend_id`), + UNIQUE KEY `calendar_labour_legend_calendar_labour_legend_id_key` (`calendar_labour_legend_id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendar_labour_type` +-- + +DROP TABLE IF EXISTS `calendar_labour_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendar_labour_type` ( + `calendar_labour_type_id` int(11) NOT NULL AUTO_INCREMENT, + `descripcion` varchar(50) DEFAULT NULL, + `pausa_remunerada` time DEFAULT NULL, + `hours_week` smallint(6) DEFAULT NULL, + PRIMARY KEY (`calendar_labour_type_id`), + UNIQUE KEY `hours_labour_hours_labour_id_key` (`calendar_labour_type_id`) +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `calendar_state` +-- + +DROP TABLE IF EXISTS `calendar_state`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `calendar_state` ( + `calendar_state_id` int(11) NOT NULL AUTO_INCREMENT, + `type` varchar(30) NOT NULL, + `rgb` varchar(7) NOT NULL, + `color` bigint(20) DEFAULT '0', + PRIMARY KEY (`calendar_state_id`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `clado` +-- + +DROP TABLE IF EXISTS `clado`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clado` ( + `n` int(11) NOT NULL, + `col` int(11) DEFAULT NULL, + `fid` int(11) DEFAULT NULL, + `lin` int(11) DEFAULT NULL, + PRIMARY KEY (`n`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `class` +-- + +DROP TABLE IF EXISTS `class`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `class` ( + `class_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(10) DEFAULT NULL, + PRIMARY KEY (`class_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `colorKk` +-- + +DROP TABLE IF EXISTS `colorKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `colorKk` ( + `color_id` int(11) NOT NULL AUTO_INCREMENT, + `image` longblob NOT NULL, + `sort` smallint(6) NOT NULL, + `name` char(3) DEFAULT NULL, + PRIMARY KEY (`color_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `convenio_time` +-- + +DROP TABLE IF EXISTS `convenio_time`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `convenio_time` ( + `pausa_remunerada` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `currency` +-- + +DROP TABLE IF EXISTS `currency`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `currency` ( + `currency_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) NOT NULL, + PRIMARY KEY (`currency_id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `dbljornada` +-- + +DROP TABLE IF EXISTS `dbljornada`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `dbljornada` ( + `?column?` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `delivery` +-- + +DROP TABLE IF EXISTS `delivery`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `delivery` ( + `delivery_id` int(11) NOT NULL AUTO_INCREMENT, + `state_id` int(11) NOT NULL DEFAULT '1', + `business_id` int(11) NOT NULL, + `travel_id` int(11) NOT NULL, + `ref` varchar(15) DEFAULT NULL, + `notes` varchar(50) DEFAULT NULL, + `tax` double DEFAULT NULL, + `invoice_id` int(11) DEFAULT NULL, + PRIMARY KEY (`delivery_id`), + KEY `delivery_invoice_id_idx` (`invoice_id`), + KEY `delivery_state_id_idx` (`state_id`), + KEY `delivery_travel_id_idx` (`travel_id`), + CONSTRAINT `delivery_ibfk_1` FOREIGN KEY (`travel_id`) REFERENCES `travel` (`travel_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `delivery_ibfk_2` FOREIGN KEY (`state_id`) REFERENCES `state_deliveryKk` (`state_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_delivery_invoice1` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `delivery_expedition` +-- + +DROP TABLE IF EXISTS `delivery_expedition`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `delivery_expedition` ( + `delivery_id` int(11) NOT NULL, + `expedition` int(11) DEFAULT NULL, + PRIMARY KEY (`delivery_id`), + CONSTRAINT `fk_delivery_expedition_delivery1` FOREIGN KEY (`delivery_id`) REFERENCES `delivery` (`delivery_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `department` +-- + +DROP TABLE IF EXISTS `department`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `department` ( + `department_id` int(11) NOT NULL AUTO_INCREMENT, + `company_id` int(11) NOT NULL, + `father_id` int(11) DEFAULT NULL, + `boss_id` int(11) NOT NULL, + `name` varchar(40) NOT NULL, + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL, + `production` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`department_id`), + KEY `department_boss_id_idx` (`boss_id`), + KEY `department_company_id_idx` (`company_id`), + KEY `department_father_id_idx` (`father_id`), + CONSTRAINT `dep_org_ibfk_3` FOREIGN KEY (`company_id`) REFERENCES `person` (`person_id`) ON UPDATE CASCADE, + CONSTRAINT `fk_department_department1` FOREIGN KEY (`father_id`) REFERENCES `department` (`department_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `discount_type` +-- + +DROP TABLE IF EXISTS `discount_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `discount_type` ( + `discount_type_id` int(11) NOT NULL AUTO_INCREMENT, + `amount` double NOT NULL, + `description` varchar(1) NOT NULL, + `combine` smallint(6) DEFAULT NULL, + PRIMARY KEY (`discount_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `doc` +-- + +DROP TABLE IF EXISTS `doc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `doc` ( + `doc_id` int(11) NOT NULL AUTO_INCREMENT, + `worker_id` int(11) NOT NULL, + `person_id` int(11) NOT NULL, + `doc_type_id` int(11) NOT NULL, + `sref` varchar(15) NOT NULL, + `brief` varchar(200) DEFAULT NULL, + `sort` int(11) DEFAULT NULL, + `filename` varchar(30) NOT NULL, + `original` smallint(6) NOT NULL, + PRIMARY KEY (`doc_id`), + KEY `doc_doc_type_id_idx` (`doc_type_id`), + KEY `doc_person_id_idx` (`person_id`), + KEY `doc_worker_id_idx` (`worker_id`), + CONSTRAINT `doc_ibfk_1` FOREIGN KEY (`doc_type_id`) REFERENCES `doc_type` (`doc_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `doc_ibfk_2` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `doc_ibfk_3` FOREIGN KEY (`worker_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `doc_type` +-- + +DROP TABLE IF EXISTS `doc_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `doc_type` ( + `doc_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL, + `path` varchar(30) NOT NULL, + PRIMARY KEY (`doc_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `familyKk` +-- + +DROP TABLE IF EXISTS `familyKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `familyKk` ( + `family_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) NOT NULL, + `sort` smallint(6) NOT NULL, + `father_id` int(11) DEFAULT NULL, + `temperature` longtext, + PRIMARY KEY (`family_id`), + KEY `family_father_id_idx` (`father_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `family_classKk` +-- + +DROP TABLE IF EXISTS `family_classKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `family_classKk` ( + `family_id` int(11) NOT NULL, + `sort` smallint(6) NOT NULL, + `variety_id` int(11) NOT NULL, + PRIMARY KEY (`family_id`), + KEY `family_class_variety_id_idx` (`variety_id`), + CONSTRAINT `family_classKk_ibfk_1` FOREIGN KEY (`family_id`) REFERENCES `familyKk` (`family_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_family_class_variety1` FOREIGN KEY (`variety_id`) REFERENCES `varietyKk` (`variety_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `goodbusiness_id` +-- + +DROP TABLE IF EXISTS `goodbusiness_id`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `goodbusiness_id` ( + `business_id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `holding` +-- + +DROP TABLE IF EXISTS `holding`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `holding` ( + `holding_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(20) DEFAULT NULL, + PRIMARY KEY (`holding_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `holding_person` +-- + +DROP TABLE IF EXISTS `holding_person`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `holding_person` ( + `holding_person_id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL, + `holding_id` int(11) NOT NULL, + PRIMARY KEY (`holding_person_id`), + KEY `holding_person_holding_id_idx` (`holding_id`), + KEY `holding_person_person_id_idx` (`person_id`), + CONSTRAINT `holding_person_ibfk_1` FOREIGN KEY (`holding_id`) REFERENCES `holding` (`holding_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `holding_person_ibfk_2` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `income_employee` +-- + +DROP TABLE IF EXISTS `income_employee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `income_employee` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `debe` decimal(10,2) DEFAULT NULL, + `haber` decimal(10,2) DEFAULT '0.00', + `id_incomeType` int(11) DEFAULT NULL, + `odbc_date` date DEFAULT NULL, + `person_id` int(11) DEFAULT NULL, + `concepto` longtext, + PRIMARY KEY (`id`), + KEY `fincometype_id` (`id_incomeType`), + KEY `fperson_id` (`person_id`), + CONSTRAINT `fincometype_id` FOREIGN KEY (`id_incomeType`) REFERENCES `incometype_employee` (`id_incometype`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fperson_id` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=58818 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `incometype_employee` +-- + +DROP TABLE IF EXISTS `incometype_employee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `incometype_employee` ( + `id_incometype` int(11) NOT NULL, + `descripcion` varchar(255) DEFAULT NULL, + `nomina` smallint(6) DEFAULT '0', + PRIMARY KEY (`id_incometype`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `intbus_id` +-- + +DROP TABLE IF EXISTS `intbus_id`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `intbus_id` ( + `business_id` int(11) DEFAULT NULL, + `person_id` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `intrastatKk` +-- + +DROP TABLE IF EXISTS `intrastatKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `intrastatKk` ( + `intrastat_id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `intrastat_code_id` int(11) NOT NULL, + `amount` double DEFAULT NULL, + PRIMARY KEY (`intrastat_id`), + UNIQUE KEY `intrastat_invoice_id_key` (`invoice_id`,`intrastat_code_id`), + KEY `intrastat_intrastat_code_id_idx` (`intrastat_code_id`), + KEY `intrastat_invoice_id_idx` (`invoice_id`), + CONSTRAINT `intrastatKk_ibfk_1` FOREIGN KEY (`intrastat_code_id`) REFERENCES `intrastat_codeKk` (`intrastat_code_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `intrastatKk_ibfk_2` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `intrastat_codeKk` +-- + +DROP TABLE IF EXISTS `intrastat_codeKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `intrastat_codeKk` ( + `intrastat_code_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `sort` smallint(6) NOT NULL, + PRIMARY KEY (`intrastat_code_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoiceKk` +-- + +DROP TABLE IF EXISTS `invoiceKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoiceKk` ( + `invoice_id` int(11) NOT NULL AUTO_INCREMENT, + `currency_id` int(11) NOT NULL DEFAULT '1', + `business_id` int(11) NOT NULL, + `doc_id` int(11) DEFAULT NULL, + `date` date NOT NULL, + `serie` char(2) DEFAULT NULL, + `ref` bigint(20) NOT NULL, + `amount` double DEFAULT NULL, + PRIMARY KEY (`invoice_id`), + KEY `invoice_business_id_idx` (`business_id`), + KEY `invoice_currency_id_idx` (`currency_id`), + KEY `invoice_doc_id_idx` (`doc_id`), + CONSTRAINT `invoiceKk_ibfk_2` FOREIGN KEY (`doc_id`) REFERENCES `doc` (`doc_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `invoiceKk_ibfk_3` FOREIGN KEY (`currency_id`) REFERENCES `currency` (`currency_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoice_discountKk` +-- + +DROP TABLE IF EXISTS `invoice_discountKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_discountKk` ( + `invoice_discount_id` int(11) NOT NULL AUTO_INCREMENT, + `discount_type_id` int(11) NOT NULL, + `invoice_id` int(11) NOT NULL, + `amount` double DEFAULT NULL, + PRIMARY KEY (`invoice_discount_id`), + KEY `invoice_discount_discount_type_id_idx` (`discount_type_id`), + KEY `invoice_discount_invoice_id_idx` (`invoice_id`), + CONSTRAINT `fk_invoice_discount_discount_type1` FOREIGN KEY (`discount_type_id`) REFERENCES `discount_type` (`discount_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_invoice_discount_invoice1` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoice_intrastatKk` +-- + +DROP TABLE IF EXISTS `invoice_intrastatKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_intrastatKk` ( + `invoice_intrastat_id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `unit` int(11) NOT NULL DEFAULT '0', + `weight` int(11) DEFAULT NULL, + `price` double DEFAULT NULL, + `intrastat_id` int(11) NOT NULL, + PRIMARY KEY (`invoice_intrastat_id`), + KEY `invoice_intrastat_intrastat_id_idx` (`intrastat_id`), + KEY `invoice_intrastat_invoice_id_idx` (`invoice_id`), + CONSTRAINT `fk_invoice_intrastat_intrastat1` FOREIGN KEY (`intrastat_id`) REFERENCES `intrastatKk` (`intrastat_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `invoice_ret_ibfk_100` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoice_recKk` +-- + +DROP TABLE IF EXISTS `invoice_recKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_recKk` ( + `invoice_rec_id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_tax_id` int(11) NOT NULL, + `amount` double NOT NULL, + PRIMARY KEY (`invoice_rec_id`), + KEY `invoice_rec_invoice_tax_id_idx` (`invoice_tax_id`), + CONSTRAINT `invoice_recKk_ibfk_1` FOREIGN KEY (`invoice_tax_id`) REFERENCES `invoice_taxKk` (`invoice_tax_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoice_retKk` +-- + +DROP TABLE IF EXISTS `invoice_retKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_retKk` ( + `invoice_ret_id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `amount` double NOT NULL, + PRIMARY KEY (`invoice_ret_id`), + KEY `invoice_ret_invoice_id_idx` (`invoice_id`), + CONSTRAINT `invoice_retKk_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoice_supKk` +-- + +DROP TABLE IF EXISTS `invoice_supKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_supKk` ( + `invoice_sup_id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `amount` double NOT NULL, + `description` varchar(45) DEFAULT NULL, + PRIMARY KEY (`invoice_sup_id`), + KEY `invoice_sup_invoice_id_idx` (`invoice_id`), + CONSTRAINT `invoice_ret_ibfk_10` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `invoice_taxKk` +-- + +DROP TABLE IF EXISTS `invoice_taxKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_taxKk` ( + `invoice_tax_id` int(11) NOT NULL AUTO_INCREMENT, + `tax_id` int(11) NOT NULL, + `invoice_id` int(11) NOT NULL, + `base` double NOT NULL, + `quota` double DEFAULT NULL, + PRIMARY KEY (`invoice_tax_id`), + UNIQUE KEY `invoice_tax_invoice_id_key` (`tax_id`,`invoice_id`), + KEY `invoice_tax_invoice_id_idx` (`invoice_id`), + KEY `invoice_tax_tax_id_idx` (`tax_id`), + CONSTRAINT `invoice_taxKk_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoiceKk` (`invoice_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `invoice_taxKk_ibfk_2` FOREIGN KEY (`tax_id`) REFERENCES `taxKk` (`tax_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `itemKk` +-- + +DROP TABLE IF EXISTS `itemKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemKk` ( + `item_id` int(11) NOT NULL AUTO_INCREMENT, + `variety_id` int(11) NOT NULL, + PRIMARY KEY (`item_id`), + KEY `item_variety_id_idx` (`variety_id`), + CONSTRAINT `fk_item_variety1` FOREIGN KEY (`variety_id`) REFERENCES `varietyKk` (`variety_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `jornadaKk` +-- + +DROP TABLE IF EXISTS `jornadaKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `jornadaKk` ( + `?column?` time DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `journey` +-- + +DROP TABLE IF EXISTS `journey`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `journey` ( + `journey_id` int(11) NOT NULL AUTO_INCREMENT, + `day_id` smallint(6) NOT NULL DEFAULT '1', + `start` time DEFAULT NULL, + `end` time DEFAULT NULL, + `business_id` int(11) NOT NULL, + PRIMARY KEY (`journey_id`), + KEY `fki_business_journey` (`business_id`), + CONSTRAINT `business_journey` FOREIGN KEY (`business_id`) REFERENCES `business_labour` (`business_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1364 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `labour_agreement` +-- + +DROP TABLE IF EXISTS `labour_agreement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `labour_agreement` ( + `labour_agreement_id` int(11) NOT NULL AUTO_INCREMENT, + `month_hollidays` double DEFAULT NULL, + `year_hours` int(11) DEFAULT NULL, + `name` char(50) DEFAULT NULL, + `date_START` date DEFAULT NULL, + `date_END` date DEFAULT NULL, + PRIMARY KEY (`labour_agreement_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `license` +-- + +DROP TABLE IF EXISTS `license`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `license` ( + `profile_id` int(11) DEFAULT NULL, + `license_group_id` int(11) DEFAULT NULL, + UNIQUE KEY `license_profile_id_key` (`profile_id`,`license_group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `license_group` +-- + +DROP TABLE IF EXISTS `license_group`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `license_group` ( + `license_group_id` int(11) NOT NULL AUTO_INCREMENT, + `tipopermiso` char(1) DEFAULT NULL, + `menu_id` int(11) DEFAULT NULL, + PRIMARY KEY (`license_group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `license_menu` +-- + +DROP TABLE IF EXISTS `license_menu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `license_menu` ( + `menu_id` int(11) DEFAULT NULL, + `nommenu` longtext +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lot` +-- + +DROP TABLE IF EXISTS `lot`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lot` ( + `lot_id` int(11) NOT NULL, + `opinion_id` int(11) DEFAULT NULL, + `quality_id` int(11) DEFAULT NULL, + `amount` smallint(6) NOT NULL, + `expire` smallint(6) NOT NULL, + `address_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL, + `labour_profile_id` int(11) NOT NULL, + `price_unit_id` int(11) NOT NULL, + `sales_unit_id` int(11) NOT NULL, + PRIMARY KEY (`lot_id`), + KEY `lot_address_id_idx` (`address_id`), + KEY `lot_item_id_idx` (`item_id`), + KEY `lot_opinion_id_idx` (`opinion_id`), + KEY `lot_price_unit_id_idx` (`price_unit_id`), + KEY `lot_quality_id_idx` (`quality_id`), + KEY `lot_sales_unit_id_idx` (`sales_unit_id`), + CONSTRAINT `fk_lot_item1` FOREIGN KEY (`item_id`) REFERENCES `itemKk` (`item_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_lot_pack_type1` FOREIGN KEY (`sales_unit_id`) REFERENCES `pack_typeKk` (`pack_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_lot_pack_type2` FOREIGN KEY (`price_unit_id`) REFERENCES `pack_typeKk` (`pack_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `lot_ibfk_12` FOREIGN KEY (`address_id`) REFERENCES `originKk` (`address_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `lot_ibfk_3` FOREIGN KEY (`quality_id`) REFERENCES `qualityKk` (`quality_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `lot_ibfk_8` FOREIGN KEY (`opinion_id`) REFERENCES `opinionKk` (`opinion_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lot_packing` +-- + +DROP TABLE IF EXISTS `lot_packing`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lot_packing` ( + `lot_packing_id` int(11) NOT NULL AUTO_INCREMENT, + `packing_id` int(11) NOT NULL, + `lot_id` int(11) NOT NULL, + PRIMARY KEY (`lot_packing_id`), + KEY `lot_packing_lot_id_idx` (`lot_id`), + KEY `lot_packing_packing_id_idx` (`packing_id`), + CONSTRAINT `fk_lot_packing_lot1` FOREIGN KEY (`lot_id`) REFERENCES `lot` (`lot_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_lot_packing_packing1` FOREIGN KEY (`packing_id`) REFERENCES `packingKk` (`packing_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lot_property` +-- + +DROP TABLE IF EXISTS `lot_property`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lot_property` ( + `lot_property_id` int(11) NOT NULL AUTO_INCREMENT, + `property_id` int(11) NOT NULL, + `lot_id` int(11) NOT NULL, + PRIMARY KEY (`lot_property_id`), + KEY `lot_property_lot_id_idx` (`lot_id`), + KEY `lot_property_property_id_idx` (`property_id`), + CONSTRAINT `fk_lot_property_lot1` FOREIGN KEY (`lot_id`) REFERENCES `lot` (`lot_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_lot_property_property1` FOREIGN KEY (`property_id`) REFERENCES `propertyKk` (`property_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `maintenance_pcs` +-- + +DROP TABLE IF EXISTS `maintenance_pcs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `maintenance_pcs` ( + `pc_nombre` char(6) NOT NULL, + `os` varchar(20) DEFAULT NULL, + `servicepack` varchar(20) DEFAULT NULL, + `nmonitores` int(11) DEFAULT NULL, + `micro` varchar(20) DEFAULT NULL, + `antivirus` varchar(20) DEFAULT NULL, + `ram` varchar(20) DEFAULT NULL, + `user_name` varchar(40) DEFAULT NULL, + `business_id` int(11) DEFAULT NULL, + `ip` varchar(15) DEFAULT NULL, + `auric` varchar(20) DEFAULT NULL, + `pgsql` char(2) DEFAULT NULL, + PRIMARY KEY (`pc_nombre`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `media` +-- + +DROP TABLE IF EXISTS `media`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `media` ( + `media_id` int(11) NOT NULL AUTO_INCREMENT, + `media_type_id` int(11) NOT NULL, + `value` varchar(55) NOT NULL, + `sort` int(11) DEFAULT NULL, + PRIMARY KEY (`media_id`), + KEY `media_media_type_id_idx` (`media_type_id`), + CONSTRAINT `media_ibfk_1` FOREIGN KEY (`media_type_id`) REFERENCES `media_type` (`media_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=844 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `media_default` +-- + +DROP TABLE IF EXISTS `media_default`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `media_default` ( + `media_default_id` int(11) NOT NULL AUTO_INCREMENT, + `media_media_id` int(11) NOT NULL, + `business_profile_business_id` int(11) NOT NULL, + PRIMARY KEY (`media_default_id`), + KEY `media_default_media_media_id_idx` (`media_media_id`), + CONSTRAINT `fk_media_default_media1` FOREIGN KEY (`media_media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `media_type` +-- + +DROP TABLE IF EXISTS `media_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `media_type` ( + `media_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) NOT NULL, + PRIMARY KEY (`media_type_id`), + UNIQUE KEY `media_type_name_key` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `menus_perm` +-- + +DROP TABLE IF EXISTS `menus_perm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `menus_perm` ( + `idmenus_perm` int(11) NOT NULL AUTO_INCREMENT, + `menu` varchar(45) DEFAULT NULL, + `father_id` int(11) DEFAULT NULL, + `icono` longblob, + `idorden` smallint(6) DEFAULT NULL, + PRIMARY KEY (`idmenus_perm`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `moveKk` +-- + +DROP TABLE IF EXISTS `moveKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `moveKk` ( + `move_id` int(11) NOT NULL AUTO_INCREMENT, + `lot_id` int(11) NOT NULL, + `cprice` double NOT NULL, + `cport` double NOT NULL, + `cpack` double NOT NULL, + `ctax` double NOT NULL, + `amount` int(11) NOT NULL DEFAULT '0', + `ok` smallint(6) NOT NULL, + `order_id` int(11) NOT NULL, + PRIMARY KEY (`move_id`), + KEY `move_lot_id_idx` (`lot_id`), + KEY `move_order_id_idx` (`order_id`), + CONSTRAINT `fk_move_order1` FOREIGN KEY (`order_id`) REFERENCES `orderKk` (`order_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `moveKk_ibfk_1` FOREIGN KEY (`lot_id`) REFERENCES `lot` (`lot_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mutua` +-- + +DROP TABLE IF EXISTS `mutua`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mutua` ( + `mutua_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) DEFAULT NULL, + PRIMARY KEY (`mutua_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mutua_employee` +-- + +DROP TABLE IF EXISTS `mutua_employee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mutua_employee` ( + `business_id` int(11) DEFAULT NULL, + `capable` tinyint(4) DEFAULT NULL, + `notes` longtext, + `mutura_revisiones_id` int(11) NOT NULL, + PRIMARY KEY (`mutura_revisiones_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mutua_revisiones` +-- + +DROP TABLE IF EXISTS `mutua_revisiones`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mutua_revisiones` ( + `mutua_id` int(11) NOT NULL, + `date` datetime DEFAULT NULL, + `mutua_revisiones_id` int(11) NOT NULL, + PRIMARY KEY (`mutua_revisiones_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `nation` +-- + +DROP TABLE IF EXISTS `nation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nation` ( + `nation_id` int(11) NOT NULL AUTO_INCREMENT, + `currency_id` int(11) NOT NULL DEFAULT '1', + `name` varchar(20) NOT NULL, + `brief` char(3) NOT NULL, + `flag` longblob, + PRIMARY KEY (`nation_id`), + UNIQUE KEY `nation_name_key` (`name`), + KEY `nation_currency_id_idx` (`currency_id`), + CONSTRAINT `nation_ibfk_1` FOREIGN KEY (`currency_id`) REFERENCES `currency` (`currency_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `nicheKk` +-- + +DROP TABLE IF EXISTS `nicheKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nicheKk` ( + `niche_id` int(11) NOT NULL AUTO_INCREMENT, + `address_id` int(11) NOT NULL, + `lot_id` int(11) NOT NULL, + `name` char(5) NOT NULL, + PRIMARY KEY (`niche_id`), + KEY `niche_address_id_idx` (`address_id`), + KEY `niche_lot_id_idx` (`lot_id`), + CONSTRAINT `nicheKk_ibfk_1` FOREIGN KEY (`lot_id`) REFERENCES `lot` (`lot_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `nicheKk_ibfk_2` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `nominas_gestoria` +-- + +DROP TABLE IF EXISTS `nominas_gestoria`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nominas_gestoria` ( + `numgestoria` int(11) NOT NULL, + `empresa_id` int(11) NOT NULL, + `person_id` int(11) DEFAULT NULL, + `numcontaplus` int(11) DEFAULT NULL, + PRIMARY KEY (`numgestoria`,`empresa_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `numdaysKk` +-- + +DROP TABLE IF EXISTS `numdaysKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `numdaysKk` ( + `coalesce` decimal(10,0) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `opinionKk` +-- + +DROP TABLE IF EXISTS `opinionKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `opinionKk` ( + `opinion_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) DEFAULT NULL, + PRIMARY KEY (`opinion_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orderKk` +-- + +DROP TABLE IF EXISTS `orderKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orderKk` ( + `order_id` int(11) NOT NULL AUTO_INCREMENT, + `delivery_id` int(11) NOT NULL, + `description` varchar(45) DEFAULT NULL, + `amount` int(11) NOT NULL, + `price` double DEFAULT NULL, + `discount` int(11) DEFAULT NULL, + `all_equal` smallint(6) DEFAULT NULL, + PRIMARY KEY (`order_id`), + KEY `order_delivery_id_idx` (`delivery_id`), + CONSTRAINT `fk_order_delivery1` FOREIGN KEY (`delivery_id`) REFERENCES `delivery` (`delivery_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `originKk` +-- + +DROP TABLE IF EXISTS `originKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `originKk` ( + `nick` char(3) NOT NULL, + `name` varchar(15) NOT NULL, + `flag` longblob, + `address_id` int(11) NOT NULL, + `font` smallint(6) DEFAULT NULL, + PRIMARY KEY (`address_id`), + CONSTRAINT `origin_adress_id` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pack_typeKk` +-- + +DROP TABLE IF EXISTS `pack_typeKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pack_typeKk` ( + `pack_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) DEFAULT 'A1', + `brief` varchar(3) DEFAULT NULL, + PRIMARY KEY (`pack_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packingKk` +-- + +DROP TABLE IF EXISTS `packingKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingKk` ( + `packing_id` int(11) NOT NULL AUTO_INCREMENT, + `amount` int(11) DEFAULT NULL, + `pack_type_id` int(11) NOT NULL, + PRIMARY KEY (`packing_id`), + KEY `packing_pack_type_id_idx` (`pack_type_id`), + CONSTRAINT `fk_packing_pack_type1` FOREIGN KEY (`pack_type_id`) REFERENCES `pack_typeKk` (`pack_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pagosemanal` +-- + +DROP TABLE IF EXISTS `pagosemanal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pagosemanal` ( + `periodo` int(11) NOT NULL, + `business_id` int(11) NOT NULL, + `id_trabajador` int(11) DEFAULT NULL, + `importe` double DEFAULT NULL, + `horasemanales` time DEFAULT NULL, + `contrato` time DEFAULT NULL, + `impar` tinyint(4) DEFAULT '0', + PRIMARY KEY (`periodo`,`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pagosemanal_new` +-- + +DROP TABLE IF EXISTS `pagosemanal_new`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pagosemanal_new` ( + `periodo` int(11) NOT NULL, + `business_id` int(11) NOT NULL, + `id_trabajador` int(11) DEFAULT NULL, + `importe` double DEFAULT NULL, + `horasemanales` time DEFAULT NULL, + `contrato` time DEFAULT NULL, + `impar` tinyint(4) DEFAULT '0', + `person_id` int(11) DEFAULT NULL, + PRIMARY KEY (`periodo`,`business_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `periodos` +-- + +DROP TABLE IF EXISTS `periodos`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `periodos` ( + `fecha` date NOT NULL, + `periodo` int(11) DEFAULT NULL, + PRIMARY KEY (`fecha`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `person` +-- + +DROP TABLE IF EXISTS `person`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `person` ( + `person_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(60) NOT NULL, + `nickname` varchar(15) DEFAULT NULL, + `nif` varchar(15) DEFAULT NULL, + `birth` date DEFAULT NULL, + `firstname` varchar(20) DEFAULT NULL, + `p2` longtext, + `nis` int(11) DEFAULT NULL, + `id_trabajador` int(11) DEFAULT NULL, + `isDisable` smallint(6) NOT NULL DEFAULT '0', + `isFreelance` smallint(6) NOT NULL DEFAULT '0' COMMENT 'M Male\nF Female', + `isSsDiscounted` smallint(6) NOT NULL DEFAULT '0', + `sex` enum('M','F') NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', + PRIMARY KEY (`person_id`), + UNIQUE KEY `person_nis` (`person_id`), + UNIQUE KEY `Index_unique_nif` (`nif`), + UNIQUE KEY `person_nif_key` (`nif`), + KEY `index1` (`person_id`,`name`,`nickname`,`firstname`), + KEY `person_worker` (`id_trabajador`) +) ENGINE=InnoDB AUTO_INCREMENT=977 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `professional_category` +-- + +DROP TABLE IF EXISTS `professional_category`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `professional_category` ( + `professional_category_id` int(11) NOT NULL AUTO_INCREMENT, + `category_name` varchar(50) NOT NULL, + `professional_levels_id` int(11) DEFAULT NULL, + `fichajes` tinyint(4) NOT NULL DEFAULT '1', + `holiday_days` decimal(3,1) DEFAULT NULL, + PRIMARY KEY (`professional_category_id`), + UNIQUE KEY `professional_category_name_category_key` (`category_name`) +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `professional_levels` +-- + +DROP TABLE IF EXISTS `professional_levels`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `professional_levels` ( + `professional_levels_id` int(11) NOT NULL AUTO_INCREMENT, + `level_name` varchar(5) DEFAULT NULL, + `price_overtime` double DEFAULT NULL, + PRIMARY KEY (`professional_levels_id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `profile` +-- + +DROP TABLE IF EXISTS `profile`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `profile` ( + `profile_id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL, + `profile_type_id` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`profile_id`), + KEY `profile_person_id_idx` (`person_id`), + KEY `profile_profile_type_id_idx` (`profile_type_id`), + CONSTRAINT `person_fk` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=855 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `profile_address` +-- + +DROP TABLE IF EXISTS `profile_address`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `profile_address` ( + `profile_address_id` int(11) NOT NULL AUTO_INCREMENT, + `profile_id` int(11) NOT NULL, + `address_id` int(11) NOT NULL, + PRIMARY KEY (`profile_address_id`), + KEY `profile_address_address_id_idx` (`address_id`), + KEY `profile_address_profile_id_idx` (`profile_id`) +) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `profile_media` +-- + +DROP TABLE IF EXISTS `profile_media`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `profile_media` ( + `profile_media_id` int(11) NOT NULL AUTO_INCREMENT, + `profile_id` int(11) NOT NULL, + `media_id` int(11) NOT NULL, + PRIMARY KEY (`profile_media_id`), + KEY `profile_media_media_id_idx` (`media_id`), + KEY `profile_media_profile_id_idx` (`profile_id`), + CONSTRAINT `fk_profile_media_media1` FOREIGN KEY (`media_id`) REFERENCES `media` (`media_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `media_ibfk_20` FOREIGN KEY (`profile_id`) REFERENCES `profile` (`profile_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=992 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `profile_type` +-- + +DROP TABLE IF EXISTS `profile_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `profile_type` ( + `profile_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) NOT NULL, + PRIMARY KEY (`profile_type_id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `propertyKk` +-- + +DROP TABLE IF EXISTS `propertyKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `propertyKk` ( + `property_id` int(11) NOT NULL AUTO_INCREMENT, + `value` smallint(6) NOT NULL, + `class_id` int(11) NOT NULL, + PRIMARY KEY (`property_id`), + KEY `property_class_id_idx` (`class_id`), + CONSTRAINT `fk_property_class1` FOREIGN KEY (`class_id`) REFERENCES `class` (`class_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `province` +-- + +DROP TABLE IF EXISTS `province`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `province` ( + `province_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) NOT NULL, + `nation_id` int(11) NOT NULL, + PRIMARY KEY (`province_id`), + UNIQUE KEY `province_name_key` (`name`), + KEY `province_nation_id_idx` (`nation_id`), + CONSTRAINT `fk_province_nation1` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=162 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pruebaimagenKk` +-- + +DROP TABLE IF EXISTS `pruebaimagenKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pruebaimagenKk` ( + `p2` varchar(255) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `qualityKk` +-- + +DROP TABLE IF EXISTS `qualityKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `qualityKk` ( + `quality_id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(3) DEFAULT 'A1', + PRIMARY KEY (`quality_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `stateKk` +-- + +DROP TABLE IF EXISTS `stateKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `stateKk` ( + `state_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) DEFAULT NULL, + PRIMARY KEY (`state_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `state_deliveryKk` +-- + +DROP TABLE IF EXISTS `state_deliveryKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `state_deliveryKk` ( + `state_id` int(11) NOT NULL, + `sort` int(11) NOT NULL, + PRIMARY KEY (`state_id`), + UNIQUE KEY `state_delivery_sort_key` (`sort`), + KEY `state_delivery_state_id_idx` (`state_id`), + CONSTRAINT `state_ordre_ibfk_1` FOREIGN KEY (`state_id`) REFERENCES `stateKk` (`state_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `state_travelKk` +-- + +DROP TABLE IF EXISTS `state_travelKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `state_travelKk` ( + `state_id` int(11) NOT NULL, + `sort` int(11) DEFAULT NULL, + PRIMARY KEY (`state_id`), + UNIQUE KEY `state_travel_sort_key` (`sort`), + KEY `state_travel_state_id_idx` (`state_id`), + CONSTRAINT `state_travelKk_ibfk_1` FOREIGN KEY (`state_id`) REFERENCES `stateKk` (`state_id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `taxKk` +-- + +DROP TABLE IF EXISTS `taxKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `taxKk` ( + `tax_id` int(11) NOT NULL AUTO_INCREMENT, + `nation_id` int(11) NOT NULL, + `tax_type_id` int(11) NOT NULL, + `value` double NOT NULL, + `rec` double NOT NULL, + `date` date NOT NULL, + PRIMARY KEY (`tax_id`), + KEY `tax_nation_id_idx` (`nation_id`), + KEY `tax_tax_type_id_idx` (`tax_type_id`), + CONSTRAINT `fk_tax_nation1` FOREIGN KEY (`nation_id`) REFERENCES `nation` (`nation_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `taxKk_ibfk_1` FOREIGN KEY (`tax_type_id`) REFERENCES `tax_typeKk` (`tax_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tax_typeKk` +-- + +DROP TABLE IF EXISTS `tax_typeKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tax_typeKk` ( + `tax_type_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(15) NOT NULL, + `brief` varchar(1) NOT NULL, + PRIMARY KEY (`tax_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tipo_perm` +-- + +DROP TABLE IF EXISTS `tipo_perm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tipo_perm` ( + `idtipo_perm` int(11) NOT NULL AUTO_INCREMENT, + `tipopermiso` varchar(45) DEFAULT NULL, + PRIMARY KEY (`idtipo_perm`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `totalms` +-- + +DROP TABLE IF EXISTS `totalms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `totalms` ( + `date_part` double DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `town` +-- + +DROP TABLE IF EXISTS `town`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `town` ( + `town_id` int(11) NOT NULL AUTO_INCREMENT, + `province_id` int(11) NOT NULL, + `name` varchar(30) NOT NULL, + `postal_code` varchar(8) NOT NULL, + PRIMARY KEY (`town_id`), + KEY `town_province_id_idx` (`province_id`), + CONSTRAINT `town_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=3673 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_horasfichajes` +-- + +DROP TABLE IF EXISTS `transfer_reader_horasfichajes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_horasfichajes` ( + `transfer_reader_horasfichajes_id` int(11) NOT NULL AUTO_INCREMENT, + `hora` time DEFAULT NULL, + PRIMARY KEY (`transfer_reader_horasfichajes_id`), + UNIQUE KEY `punique_trhf` (`hora`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_incidencias` +-- + +DROP TABLE IF EXISTS `transfer_reader_incidencias`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_incidencias` ( + `transfer_reader_id` int(11) NOT NULL, + `transfer_reader_incidencias_type_id` int(11) NOT NULL, + PRIMARY KEY (`transfer_reader_id`), + KEY `fki_fkey` (`transfer_reader_id`), + KEY `fki_fkey1` (`transfer_reader_id`), + KEY `fki_fkey2` (`transfer_reader_incidencias_type_id`), + CONSTRAINT `fkey` FOREIGN KEY (`transfer_reader_id`) REFERENCES `transfer_reader_kk` (`transfer_reader_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fkey2` FOREIGN KEY (`transfer_reader_incidencias_type_id`) REFERENCES `transfer_reader_incidencias_type` (`transfer_reader_incidencias_type_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_incidencias_type` +-- + +DROP TABLE IF EXISTS `transfer_reader_incidencias_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_incidencias_type` ( + `transfer_reader_incidencias_type_id` int(11) NOT NULL AUTO_INCREMENT, + `descripcion` longtext NOT NULL, + PRIMARY KEY (`transfer_reader_incidencias_type_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_kk` +-- + +DROP TABLE IF EXISTS `transfer_reader_kk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_kk` ( + `transfer_reader_id` int(11) NOT NULL AUTO_INCREMENT, + `business_id` int(11) DEFAULT NULL, + `idorden` int(11) DEFAULT NULL, + `date` datetime DEFAULT NULL, + `manual` tinyint(4) DEFAULT '0', + `person_id` int(11) DEFAULT NULL, + `workcenter_id` int(11) DEFAULT NULL, + PRIMARY KEY (`transfer_reader_id`), + UNIQUE KEY `wc_date_person_UNIQUE` (`workcenter_id`,`date`,`person_id`), + KEY `fki_person_transfer` (`person_id`), + KEY `fk_id` (`business_id`), + CONSTRAINT `fk_id` FOREIGN KEY (`business_id`) REFERENCES `business_labour` (`business_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `person_transfer` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1090649 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_relationship` +-- + +DROP TABLE IF EXISTS `transfer_reader_relationship`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_relationship` ( + `id` int(11) NOT NULL, + `nis` bigint(20) NOT NULL, + `id_trabajador` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `fichador` (`nis`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_relationship_nuevolector` +-- + +DROP TABLE IF EXISTS `transfer_reader_relationship_nuevolector`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_relationship_nuevolector` ( + `nis` bigint(20) DEFAULT NULL, + `id_trabajador` int(11) DEFAULT NULL, + `id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `pkeyniss` (`nis`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `transfer_reader_tmp` +-- + +DROP TABLE IF EXISTS `transfer_reader_tmp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transfer_reader_tmp` ( + `nis` int(11) NOT NULL, + `date` datetime NOT NULL, + `transfer_reader_id` int(11) NOT NULL, + `warehouseFk` smallint(6) unsigned DEFAULT NULL, + PRIMARY KEY (`nis`,`date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `travel` +-- + +DROP TABLE IF EXISTS `travel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travel` ( + `travel_id` int(11) NOT NULL AUTO_INCREMENT, + `state_id` int(11) NOT NULL DEFAULT '1', + `shipment` date NOT NULL, + `landing` date NOT NULL, + `name` varchar(15) DEFAULT NULL, + `address_out_id` int(11) NOT NULL, + `address_in_id` int(11) NOT NULL, + `agency_id` int(11) NOT NULL, + PRIMARY KEY (`travel_id`), + KEY `travel_address_in_id_idx` (`address_in_id`), + KEY `travel_address_out_id_idx` (`address_out_id`), + KEY `travel_agency_id_idx` (`agency_id`), + KEY `travel_state_id_idx` (`state_id`), + CONSTRAINT `fk_travel_address1` FOREIGN KEY (`address_out_id`) REFERENCES `address` (`address_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_travel_address2` FOREIGN KEY (`address_in_id`) REFERENCES `address` (`address_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_travel_business_transport1` FOREIGN KEY (`agency_id`) REFERENCES `business_transport` (`business_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`state_id`) REFERENCES `state_travelKk` (`state_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `uniform` +-- + +DROP TABLE IF EXISTS `uniform`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `uniform` ( + `uniform_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + `uniform_size_id` int(11) DEFAULT NULL, + `uniform_colour_id` int(11) DEFAULT NULL, + `uniform_season_id` int(11) DEFAULT NULL, + PRIMARY KEY (`uniform_id`), + UNIQUE KEY `uniforms_index02` (`name`), + KEY `uniforms_index01` (`uniform_size_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `uniform_colour` +-- + +DROP TABLE IF EXISTS `uniform_colour`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `uniform_colour` ( + `uniform_colour_id` int(11) NOT NULL AUTO_INCREMENT, + `colour` varchar(30) DEFAULT NULL, + PRIMARY KEY (`uniform_colour_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `uniform_employee` +-- + +DROP TABLE IF EXISTS `uniform_employee`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `uniform_employee` ( + `business_id` int(11) NOT NULL, + `uniform_id` int(11) NOT NULL, + PRIMARY KEY (`business_id`), + KEY `uniform_employee_index01` (`uniform_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `uniform_season` +-- + +DROP TABLE IF EXISTS `uniform_season`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `uniform_season` ( + `uniform_season_id` int(11) NOT NULL AUTO_INCREMENT, + `season` varchar(100) NOT NULL, + PRIMARY KEY (`uniform_season_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `uniform_size` +-- + +DROP TABLE IF EXISTS `uniform_size`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `uniform_size` ( + `uniform_size_id` int(11) NOT NULL AUTO_INCREMENT, + `size` varchar(30) NOT NULL, + PRIMARY KEY (`uniform_size_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `varietyKk` +-- + +DROP TABLE IF EXISTS `varietyKk`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `varietyKk` ( + `variety_id` int(11) NOT NULL AUTO_INCREMENT, + `intrastat_code_id` int(11) NOT NULL, + `color_id` int(11) NOT NULL, + `family_id` int(11) NOT NULL, + `name` varchar(40) NOT NULL, + `picture` varchar(20) DEFAULT NULL, + `botanic` varchar(35) DEFAULT NULL, + PRIMARY KEY (`variety_id`), + KEY `variety_color_id_idx` (`color_id`), + KEY `variety_family_id_idx` (`family_id`), + KEY `variety_intrastat_code_id_idx` (`intrastat_code_id`), + CONSTRAINT `varietyKk_ibfk_1` FOREIGN KEY (`family_id`) REFERENCES `familyKk` (`family_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `varietyKk_ibfk_2` FOREIGN KEY (`color_id`) REFERENCES `colorKk` (`color_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `varietyKk_ibfk_3` FOREIGN KEY (`intrastat_code_id`) REFERENCES `intrastat_codeKk` (`intrastat_code_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workcenter` +-- + +DROP TABLE IF EXISTS `workcenter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workcenter` ( + `workcenter_id` int(11) NOT NULL AUTO_INCREMENT, + `name` longtext, + `center_id` int(11) DEFAULT NULL, + `counter` bigint(20) DEFAULT NULL, + `warehouseFk` smallint(6) DEFAULT NULL, + PRIMARY KEY (`workcenter_id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerTimeControlConfig` +-- + +DROP TABLE IF EXISTS `workerTimeControlConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlConfig` ( + `id` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `warehouseFk_1_idx` (`warehouseFk`), + CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `vn2008`.`warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zone` +-- + +DROP TABLE IF EXISTS `zone`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zone` ( + `zone_id` int(11) NOT NULL AUTO_INCREMENT, + `province_id` int(11) NOT NULL, + `agency_id` int(11) NOT NULL, + `name` varchar(3) NOT NULL, + PRIMARY KEY (`zone_id`), + KEY `zone_agency_id_idx` (`agency_id`), + KEY `zone_province_id_idx` (`province_id`), + CONSTRAINT `fk_zone_business_transport1` FOREIGN KEY (`agency_id`) REFERENCES `business_transport` (`business_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `zone_ibfk_2` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zone_exception` +-- + +DROP TABLE IF EXISTS `zone_exception`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zone_exception` ( + `zone_exception_id` int(11) NOT NULL AUTO_INCREMENT, + `town_id` int(11) NOT NULL, + `daily` smallint(6) NOT NULL, + `tc` smallint(6) NOT NULL, + `zone_id` int(11) NOT NULL, + `priority` smallint(6) DEFAULT NULL, + PRIMARY KEY (`zone_exception_id`), + KEY `zone_exception_town_id_idx` (`town_id`), + KEY `zone_exception_zone_id_idx` (`zone_id`), + CONSTRAINT `fk_zone_exception_zone1` FOREIGN KEY (`zone_id`) REFERENCES `zone` (`zone_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `zone_exception_ibfk_4` FOREIGN KEY (`town_id`) REFERENCES `town` (`town_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zone_price` +-- + +DROP TABLE IF EXISTS `zone_price`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zone_price` ( + `zone_price_id` int(11) NOT NULL AUTO_INCREMENT, + `zone_id` int(11) NOT NULL, + `kg` int(11) NOT NULL DEFAULT '20', + `price` double NOT NULL, + PRIMARY KEY (`zone_price_id`), + KEY `zone_price_zone_id_idx` (`zone_id`), + CONSTRAINT `zone_price_ibfk_1` FOREIGN KEY (`zone_id`) REFERENCES `zone` (`zone_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zone_province` +-- + +DROP TABLE IF EXISTS `zone_province`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zone_province` ( + `zone_province_id` int(11) NOT NULL AUTO_INCREMENT, + `province_id` int(11) NOT NULL, + `zone_id` int(11) NOT NULL, + `daily` smallint(6) NOT NULL, + `tc` double DEFAULT NULL, + PRIMARY KEY (`zone_province_id`), + KEY `zone_province_province_id_idx` (`province_id`), + KEY `zone_province_zone_id_idx` (`zone_id`), + CONSTRAINT `zone_province_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `province` (`province_id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `zone_province_ibfk_2` FOREIGN KEY (`zone_id`) REFERENCES `zone` (`zone_id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'postgresql' +-- + +-- +-- Dumping routines for database 'postgresql' +-- + -- -- Current Database: `account` -- @@ -77039,7 +80418,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`real` AS `isRelevant`,`c`.`e-mail` AS `email`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`Cuenta` AS `accountingAccount`,`c`.`RE` AS `isEqualizated`,`c`.`province_id` AS `provinceFk`,`c`.`invoice` AS `hasToInvoice`,`c`.`credito` AS `credit`,`c`.`Id_Pais` AS `countryFk`,`c`.`activo` AS `isActive`,`c`.`gestdoc_id` AS `gestdocFk`,`c`.`calidad` AS `quality`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`created` AS `created`,`c`.`mail` AS `isToBeMailed`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `hasSepaVnl`,`c`.`coreVnl` AS `hasCoreVnl`,`c`.`coreVnh` AS `hasCoreVnh`,`c`.`hasLcr` AS `hasLcr`,`c`.`default_address` AS `defaultAddressFk`,`c`.`risk_calculated` AS `riskCalculated`,`c`.`clientes_tipo_id` AS `clientTypeFk`,`c`.`mail_address` AS `mailAddress`,`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress`,`c`.`contabilizado` AS `isTaxDataChecked`,`c`.`congelado` AS `isFreezed`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`isCreatedAsServed` AS `isCreatedAsServed`,`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`vies` AS `isVies`,`c`.`EYPBC` AS `eypbc`,`c`.`bankEntityFk` AS `bankEntityFk`,`c`.`clientTypeFk` AS `typeFk` from `vn2008`.`Clientes` `c` */; +/*!50001 VIEW `client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`real` AS `isRelevant`,`c`.`e-mail` AS `email`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`Cuenta` AS `accountingAccount`,`c`.`RE` AS `isEqualizated`,`c`.`province_id` AS `provinceFk`,`c`.`invoice` AS `hasToInvoice`,`c`.`credito` AS `credit`,`c`.`Id_Pais` AS `countryFk`,`c`.`activo` AS `isActive`,`c`.`gestdoc_id` AS `gestdocFk`,`c`.`calidad` AS `quality`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`created` AS `created`,`c`.`mail` AS `isToBeMailed`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `hasSepaVnl`,`c`.`coreVnl` AS `hasCoreVnl`,`c`.`coreVnh` AS `hasCoreVnh`,`c`.`hasLcr` AS `hasLcr`,`c`.`default_address` AS `defaultAddressFk`,`c`.`risk_calculated` AS `riskCalculated`,`c`.`clientes_tipo_id` AS `clientTypeFk`,`c`.`mail_address` AS `mailAddress`,`c`.`cplusTerIdNifFk` AS `cplusTerIdNifFk`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress`,`c`.`contabilizado` AS `isTaxDataChecked`,`c`.`congelado` AS `isFreezed`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`isCreatedAsServed` AS `isCreatedAsServed`,`c`.`hasInvoiceSimplified` AS `hasInvoiceSimplified`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`vies` AS `isVies`,`c`.`EYPBC` AS `eypbc`,`c`.`bankEntityFk` AS `bankEntityFk`,`c`.`typeFk` AS `typeFk` from `vn2008`.`Clientes` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -77165,7 +80544,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type` from `vn2008`.`clientes_tipo` `ct` */; +/*!50001 VIEW `clientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type`,`ct`.`isCreatedAsServed` AS `isCreatedAsServed` from `vn2008`.`clientes_tipo` `ct` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -78340,6 +81719,60 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `labourHoliday` +-- + +/*!50001 DROP VIEW IF EXISTS `labourHoliday`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `labourHoliday` AS select `cl`.`calendar_labour_legend_id` AS `legendFk`,`cl`.`calendar_free_id` AS `typeFk`,`cl`.`workcenter_id` AS `workcenterFk`,`cl`.`day` AS `date` from `postgresql`.`calendar_labour` `cl` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `labourHolidayLegend` +-- + +/*!50001 DROP VIEW IF EXISTS `labourHolidayLegend`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `labourHolidayLegend` AS select `cll`.`calendar_labour_legend_id` AS `id`,`cll`.`descripcion` AS `description` from `postgresql`.`calendar_labour_legend` `cll` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `labourHolidayType` +-- + +/*!50001 DROP VIEW IF EXISTS `labourHolidayType`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `labourHolidayType` AS select `cf`.`calendar_free_id` AS `id`,`cf`.`type` AS `name`,`cf`.`rgb` AS `rgb` from `postgresql`.`calendar_free` `cf` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `mail` -- @@ -78852,12 +82285,12 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `receipt` AS select `t`.`Id` AS `Id`,`t`.`Id_Factura` AS `invoiceFk`,`t`.`Entregado` AS `amountPaid`,`t`.`Pendiente` AS `amountUnpaid`,`t`.`Fechacobro` AS `payed`,`t`.`Id_Trabajador` AS `workerFk`,`t`.`Id_Banco` AS `bankFk`,`t`.`Id_Cliente` AS `clientFk`,`t`.`odbc_date` AS `created`,`t`.`empresa_id` AS `companyFk`,`t`.`conciliado` AS `isConciliate` from `vn2008`.`Recibos` `t` */; +/*!50001 VIEW `receipt` AS select `t`.`Id` AS `id`,`t`.`Id_Factura` AS `invoiceFk`,`t`.`Entregado` AS `amountPaid`,`t`.`Pendiente` AS `amountUnpaid`,`t`.`Fechacobro` AS `payed`,`t`.`Id_Trabajador` AS `workerFk`,`t`.`Id_Banco` AS `bankFk`,`t`.`Id_Cliente` AS `clientFk`,`t`.`odbc_date` AS `created`,`t`.`empresa_id` AS `companyFk`,`t`.`conciliado` AS `isConciliate` from `vn2008`.`Recibos` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -79289,7 +82722,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketRequest` AS select `t`.`Id_ORDEN` AS `id`,`t`.`ORDEN` AS `description`,`t`.`requesterFk` AS `requesterFk`,`t`.`CodCOMPRADOR` AS `atenderFk`,`t`.`CANTIDAD` AS `quantity`,`t`.`PRECIOMAX` AS `price`,`t`.`isOk` AS `isOk`,`t`.`Id_Movimiento` AS `saleFk`,`t`.`ticketFk` AS `ticketFk`,`t`.`odbc_date` AS `created` from `vn2008`.`Ordenes` `t` */; +/*!50001 VIEW `ticketRequest` AS select `t`.`Id_ORDEN` AS `id`,`t`.`ORDEN` AS `description`,`t`.`requesterFk` AS `requesterFk`,`t`.`atenderFk` AS `atenderFk`,`t`.`CANTIDAD` AS `quantity`,`t`.`PRECIOMAX` AS `price`,`t`.`isOk` AS `isOk`,`t`.`Id_Movimiento` AS `saleFk`,`t`.`ticketFk` AS `ticketFk`,`t`.`odbc_date` AS `created` from `vn2008`.`Ordenes` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -79600,6 +83033,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `workcenter` +-- + +/*!50001 DROP VIEW IF EXISTS `workcenter`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`z-developer`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workcenter` AS select `w`.`workcenter_id` AS `id`,`w`.`name` AS `name`,`w`.`warehouseFk` AS `warehouseFk` from `postgresql`.`workcenter` `w` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `worker` -- @@ -79937,7 +83388,7 @@ USE `bi`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `customerRiskOverdue` AS select `cr`.`customer_id` AS `customer_id`,`cr`.`amount` AS `amount`,`cr`.`company_id` AS `company_id` from (((`bi`.`customer_risk` `cr` join `vn2008`.`empresa` `e` on((`e`.`id` = `cr`.`company_id`))) join `vn2008`.`Clientes` `c` on((`cr`.`customer_id` = `c`.`id_cliente`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where (`cr`.`amount` and `e`.`morosidad` and `pm`.`deudaviva` and (`c`.`clientes_tipo_id` = 1)) union all select `f`.`Id_Cliente` AS `Id_Cliente`,-(round(`f`.`Importe`,2)) AS `importe`,`f`.`empresa_id` AS `empresa_id` from (((`vn2008`.`Facturas` `f` join `vn2008`.`Clientes` `c` on((`f`.`Id_Cliente` = `c`.`id_cliente`))) join `vn2008`.`empresa` `e` on((`e`.`id` = `f`.`empresa_id`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where ((`f`.`Fecha` > (curdate() + interval -(101) day)) and ((`f`.`Vencimiento` + interval `pm`.`graceDays` day) > curdate()) and (`f`.`Importe` > 0) and `e`.`morosidad` and `pm`.`deudaviva` and (`c`.`clientes_tipo_id` = 1)) */; +/*!50001 VIEW `customerRiskOverdue` AS select `cr`.`customer_id` AS `customer_id`,`cr`.`amount` AS `amount`,`cr`.`company_id` AS `company_id` from (((`bi`.`customer_risk` `cr` join `vn`.`company` `co` on((`co`.`id` = `cr`.`company_id`))) join `vn`.`client` `c` on((`cr`.`customer_id` = `c`.`id`))) join `vn`.`payMethod` `pm` on((`pm`.`id` = `c`.`payMethodFk`))) where (`cr`.`amount` and `co`.`isDefaulter` and `pm`.`outstandingDebt` and (`c`.`typeFk` = 'normal')) union all select `i`.`clientFk` AS `Id_Cliente`,-(round(`i`.`amount`,2)) AS `importe`,`i`.`companyFk` AS `empresa_id` from (((`vn`.`invoiceOut` `i` join `vn`.`client` `c` on((`i`.`clientFk` = `c`.`id`))) join `vn`.`company` `co` on((`co`.`id` = `i`.`companyFk`))) join `vn`.`payMethod` `pm` on((`pm`.`id` = `c`.`payMethodFk`))) where ((`i`.`issued` > (curdate() + interval -(101) day)) and ((`i`.`dued` + interval `pm`.`graceDays` day) > curdate()) and (`i`.`amount` > 0) and `co`.`isDefaulter` and `pm`.`outstandingDebt` and (`c`.`typeFk` = 'normal')) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -80523,6 +83974,12 @@ USE `hedera`; -- USE `stock`; + +-- +-- Current Database: `postgresql` +-- + +USE `postgresql`; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -80533,4 +83990,4 @@ USE `stock`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-01-02 13:36:18 +-- Dump completed on 2019-01-17 7:56:18 From 9e3788b37b74e0a9b3b0292948334d9537df3b58 Mon Sep 17 00:00:00 2001 From: Bernat Date: Thu, 17 Jan 2019 12:12:26 +0100 Subject: [PATCH 02/16] create new views #9440 --- .../db/install/changes/1.2-CHECK/04-labourHolidayType.sql | 6 ++++++ .../install/changes/1.2-CHECK/05-labourHolidayLegend.sql | 5 +++++ .../db/install/changes/1.2-CHECK/06-labourHoliday.sql | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 services/db/install/changes/1.2-CHECK/04-labourHolidayType.sql create mode 100644 services/db/install/changes/1.2-CHECK/05-labourHolidayLegend.sql create mode 100644 services/db/install/changes/1.2-CHECK/06-labourHoliday.sql diff --git a/services/db/install/changes/1.2-CHECK/04-labourHolidayType.sql b/services/db/install/changes/1.2-CHECK/04-labourHolidayType.sql new file mode 100644 index 000000000..782566bfa --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/04-labourHolidayType.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE VIEW vn.labourHolidayType + AS SELECT + `cf`.`calendar_free_id` AS `id`, + `cf`.`type` AS `name`, + `cf`.`rgb` AS `rgb` + FROM `postgresql`.`calendar_free` `cf`; \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/05-labourHolidayLegend.sql b/services/db/install/changes/1.2-CHECK/05-labourHolidayLegend.sql new file mode 100644 index 000000000..f550f17fa --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/05-labourHolidayLegend.sql @@ -0,0 +1,5 @@ +CREATE OR REPLACE VIEW vn.labourHolidayLegend + AS SELECT + `cll`.`calendar_labour_legend_id` AS `id`, + `cll`.`descripcion` AS `description` + FROM `postgresql`.`calendar_labour_legend` `cll`; \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/06-labourHoliday.sql b/services/db/install/changes/1.2-CHECK/06-labourHoliday.sql new file mode 100644 index 000000000..5593466ce --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/06-labourHoliday.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE VIEW vn.labourHoliday + AS SELECT + `cl`.`calendar_labour_legend_id` AS `labourHolidayLegendFk`, + `cl`.`calendar_free_id` AS `labourHolidayTypeFk`, + `cl`.`workcenter_id` AS `workCenterFk`, + `cl`.`day` AS `dated` + FROM + `postgresql`.`calendar_labour` `cl`; \ No newline at end of file From fc7b4e4eda20eac3e8b7f18557f617d434b61aff Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 18 Jan 2019 10:59:33 +0100 Subject: [PATCH 03/16] changed item diary colors #990 --- modules/item/front/diary/style.scss | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/item/front/diary/style.scss b/modules/item/front/diary/style.scss index 25f69d5f8..26fa78034 100644 --- a/modules/item/front/diary/style.scss +++ b/modules/item/front/diary/style.scss @@ -11,13 +11,11 @@ vn-item-diary { width: 400px; } .balanceNegative .balance { - background-color: $main-01; - color: white; + color: $alert-01; font-weight: bold; } .isIn .in { - background-color: $main-02; - color: white; + color: $main-02; font-weight: bold; } .isToday .date{ From e9bc3f00a16ec554d35b7b6847173442d1ca2090 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 18 Jan 2019 13:34:50 +0100 Subject: [PATCH 04/16] =?UTF-8?q?#954=20ticket.descriptor=20a=C3=B1adir=20?= =?UTF-8?q?link=20a=20polizon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ticket/back/models/stowaway.json | 36 ++++++++++++++++++++++++ modules/ticket/back/models/ticket.json | 10 +++++++ modules/ticket/front/card/index.js | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 modules/ticket/back/models/stowaway.json diff --git a/modules/ticket/back/models/stowaway.json b/modules/ticket/back/models/stowaway.json new file mode 100644 index 000000000..5a925cd20 --- /dev/null +++ b/modules/ticket/back/models/stowaway.json @@ -0,0 +1,36 @@ +{ + "name": "Stowaway", + "base": "VnModel", + "options": { + "mysql": { + "table": "stowaway" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "shipFk": { + "type": "Number", + "required": false + }, + "created":{ + "type": "Date", + "required": false + } + }, + "relations": { + "ship": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "shipFk" + }, + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "id" + } + } +} diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 3fb866cc0..bd8917f8d 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -44,6 +44,16 @@ "model": "Client", "foreignKey": "clientFk" }, + "ship": { + "type": "hasMany", + "model": "Stowaway", + "foreignKey": "shipFk" + }, + "stowaway": { + "type": "hasOne", + "model": "Stowaway", + "foreignKey": "id" + }, "warehouse": { "type": "belongsTo", "model": "Warehouse", diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index bbef4730c..cfd60800d 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -7,7 +7,9 @@ class Controller { this.filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, + {relation: 'ship'}, {relation: 'agencyMode', scope: {fields: ['name']}}, + {relation: 'stowaway'}, { relation: 'client', scope: { From 345acc1353257934b45c6e47c7515a943fcf85f6 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 18 Jan 2019 13:36:13 +0100 Subject: [PATCH 05/16] =?UTF-8?q?#951=20ticket.descriptor=20a=C3=B1adir=20?= =?UTF-8?q?polizon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/item/front/index.js | 2 + .../front/ticket-descriptor/addStowaway.html | 35 ++++++++++++ .../front/ticket-descriptor/addStowaway.js | 46 +++++++++++++++ .../item/front/ticket-descriptor/index.html | 15 ++++- modules/item/front/ticket-descriptor/index.js | 57 +++++++++++++++++-- .../methods/ticket/getPossibleStowaways.js | 57 +++++++++++++++++++ modules/ticket/back/model-config.json | 3 + modules/ticket/back/models/ticket.js | 1 + 8 files changed, 210 insertions(+), 6 deletions(-) create mode 100644 modules/item/front/ticket-descriptor/addStowaway.html create mode 100644 modules/item/front/ticket-descriptor/addStowaway.js create mode 100644 modules/ticket/back/methods/ticket/getPossibleStowaways.js diff --git a/modules/item/front/index.js b/modules/item/front/index.js index f853efa7c..c2f9a66f6 100644 --- a/modules/item/front/index.js +++ b/modules/item/front/index.js @@ -8,6 +8,8 @@ import './card'; import './descriptor'; import './descriptor-popover'; import './ticket-descriptor'; +import './ticket-descriptor/addStowaway'; +import './ticket-descriptor/removeStowaway'; import './ticket-descriptor-popover'; import './data'; import './tags'; diff --git a/modules/item/front/ticket-descriptor/addStowaway.html b/modules/item/front/ticket-descriptor/addStowaway.html new file mode 100644 index 000000000..93a09b713 --- /dev/null +++ b/modules/item/front/ticket-descriptor/addStowaway.html @@ -0,0 +1,35 @@ + + + +
Stowaways to add
+
+ + + + + Ticket id + Shipped + Agency + Warehouse + State + + + + + {{ticket.id}} + {{ticket.landed | dateTime: 'dd/MM/yyyy'}} + {{ticket.agencyMode.name}} + {{ticket.warehouse.name}} + {{ticket.state.state.name}} + + + + No results + + + +
+
\ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/addStowaway.js b/modules/item/front/ticket-descriptor/addStowaway.js new file mode 100644 index 000000000..d61d88a66 --- /dev/null +++ b/modules/item/front/ticket-descriptor/addStowaway.js @@ -0,0 +1,46 @@ +import ngModule from '../module'; + +class Controller { + constructor($state, $scope, $http) { + this.$scope = $scope; + this.$state = $state; + this.$http = $http; + } + + getPossibleStowaways() { + this.$http.get(`/api/Tickets/${this.ticket.id}/getPossibleStowaways`) + .then(res => { + console.log(res); + this.possibleStowaways = res.data; + }); + } + + addStowaway(index) { + let params = {id: this.possibleStowaways[index].id, shipFk: this.ticket.id}; + this.$http.post(`/api/Stowaways/`, params) + .then(() => { + this.card.reload(); + }); + } + + show() { + this.$scope.dialog.show(); + } + + hide() { + this.$scope.dialog.hide(); + } +} + +Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate']; + +ngModule.component('vnAddStowaway', { + template: require('./addStowaway.html'), + controller: Controller, + bindings: { + ticket: '<' + }, + require: { + card: '^vnTicketCard' + } +}); diff --git a/modules/item/front/ticket-descriptor/index.html b/modules/item/front/ticket-descriptor/index.html index 2d9e6d29a..e2bfc9677 100644 --- a/modules/item/front/ticket-descriptor/index.html +++ b/modules/item/front/ticket-descriptor/index.html @@ -91,6 +91,17 @@ icon="{{::$ctrl.quicklinks.btnThree.icon}}"> + + - \ No newline at end of file + + + \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 8511f93db..b0d5c54fa 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -1,4 +1,5 @@ import ngModule from '../module'; +import './style.scss'; class Controller { constructor($state, $scope, $http, vnApp, $translate) { @@ -8,15 +9,34 @@ class Controller { this.vnApp = vnApp; this.$translate = $translate; this.moreOptions = [ - {callback: this.showAddTurnDialog, name: 'Add turn'}, - {callback: this.showDeleteTicketDialog, name: 'Delete ticket'} + {callback: this.showAddTurnDialog, name: 'Add turn', show: true}, + {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, + {callback: this.showAddStowaway, name: 'Add stowaway', show: true}, + {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()} ]; } + shouldShowRemoveStowaway() { + if (!this._ticket) + return false; + return (this._ticket.stowaway || this._ticket.ship.length > 1); + } + onMoreChange(callback) { callback.call(this); } + goToTicket(ticketID) { + this.$state.go('ticket.card.sale', {id: ticketID}); + } + + onMoreOpen() { + let options = this.moreOptions.filter(o => { + return o.show === true || typeof o.show === 'function' && o.show(); + }); + this.$scope.moreButton.data = options; + } + get isEditable() { try { return !this.ticket.tracking.state.alertLevel; @@ -58,6 +78,15 @@ class Controller { } } + showAddStowaway() { + this.$scope.addStowaway.show(); + console.log(this.$state.getCurrentPath()); + } + + showRemoveStowaway() { + this.$scope.removeStowaway.show(); + } + get ticket() { return this._ticket; } @@ -67,13 +96,31 @@ class Controller { if (!value) return; - this._quicklinks = { + let links = { btnOne: { icon: 'person', state: `client.card.summary({id: ${value.clientFk}})`, tooltip: 'Client card' - } - }; + }}; + if (value.stowaway) { + links.btnTwo = { + icon: 'icon-polizon', + state: `ticket.card.summary({id: ${value.stowaway.shipFk}})`, + tooltip: 'Ship' + }; + } + console.log(value.ship); + + if (value.ship.length == 1) { + links.btnThree = { + icon: 'icon-polizon', + state: `ticket.card.summary({id: ${value.ship[0].id}})`, + tooltip: 'Stowaway' + }; + } else if (value.ship.length > 1) + this.shipStowaways = value.ship; + + this._quicklinks = links; } set quicklinks(value = {}) { diff --git a/modules/ticket/back/methods/ticket/getPossibleStowaways.js b/modules/ticket/back/methods/ticket/getPossibleStowaways.js new file mode 100644 index 000000000..045e0595c --- /dev/null +++ b/modules/ticket/back/methods/ticket/getPossibleStowaways.js @@ -0,0 +1,57 @@ +module.exports = Self => { + Self.remoteMethod('getPossibleStowaways', { + description: 'Returns mana of a salesperson of a ticket', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'ticket id', + http: {source: 'path'} + }], + returns: { + root: true + }, + http: { + path: `/:id/getPossibleStowaways`, + verb: 'GET' + } + }); + + Self.getPossibleStowaways = async ticketFk => { + let ship = await Self.app.models.Ticket.findById(ticketFk); + let lowestDate = new Date(ship.shipped.getTime()); + lowestDate.setHours(0, 0, -1, 0); + + let highestDate = new Date(ship.shipped.getTime()); + highestDate.setHours(23, 59, 59); + + + let possibleStowaways = await Self.app.models.Ticket.find({ + where: { + clientFk: ship.clientFk, + addressFk: ship.addressFk, + agencyModeFk: ship.agencyModeFk, + warehouse: {neq: ship.warehouseFk}, + shipped: { + between: [lowestDate.toJSON(), highestDate.toJSON()] + } + }, + include: [ + {relation: 'agencyMode'}, + {relation: 'warehouse'}, + {relation: 'state', + scope: { + fields: ['stateFk'], + include: { + relation: 'state', + fields: ['id', 'name'], + } + }, + }, + ] + }); + + return possibleStowaways; + }; +}; diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index e4921393d..22c750a4f 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -32,6 +32,9 @@ "State":{ "dataSource": "vn" }, + "Stowaway": { + "dataSource": "vn" + }, "Ticket": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/ticket.js b/modules/ticket/back/models/ticket.js index 1426bad80..52144ca4c 100644 --- a/modules/ticket/back/models/ticket.js +++ b/modules/ticket/back/models/ticket.js @@ -16,4 +16,5 @@ module.exports = Self => { require('../methods/ticket/getShipped')(Self); require('../methods/ticket/getLanded')(Self); require('../methods/ticket/filter')(Self); + require('../methods/ticket/getPossibleStowaways')(Self); }; From 97b2c23179c06c5fd74fbc2860b4014a13fe0688 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 18 Jan 2019 13:37:26 +0100 Subject: [PATCH 06/16] #952 Ticket.descriptor eliminar polizon --- .../front/ticket-descriptor/locale/es.yml | 9 +++ .../ticket-descriptor/removeStowaway.html | 41 ++++++++++ .../front/ticket-descriptor/removeStowaway.js | 78 +++++++++++++++++++ .../item/front/ticket-descriptor/style.scss | 36 +++++++++ 4 files changed, 164 insertions(+) create mode 100644 modules/item/front/ticket-descriptor/locale/es.yml create mode 100644 modules/item/front/ticket-descriptor/removeStowaway.html create mode 100644 modules/item/front/ticket-descriptor/removeStowaway.js create mode 100644 modules/item/front/ticket-descriptor/style.scss diff --git a/modules/item/front/ticket-descriptor/locale/es.yml b/modules/item/front/ticket-descriptor/locale/es.yml new file mode 100644 index 000000000..7a76abe55 --- /dev/null +++ b/modules/item/front/ticket-descriptor/locale/es.yml @@ -0,0 +1,9 @@ +Ship: Barco +Stowaway: Polizón +Cliente: Client +Ship stowaways: Polizones del barco +Stowaways to add: Polizones a añadir +Stowaways of the ticket: Polizones del ticket +Add stowaway: Añadir polizón +Remove stowaway: Borrar polizón +Are you sure you want to delete this stowaway?: ¿Estas seguro de que quieres borrar este polizón? \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/removeStowaway.html b/modules/item/front/ticket-descriptor/removeStowaway.html new file mode 100644 index 000000000..481bde195 --- /dev/null +++ b/modules/item/front/ticket-descriptor/removeStowaway.html @@ -0,0 +1,41 @@ + + + +
Stowaways of the ticket {{$ctrl.ticket.id}}
+
+ + + + + Ticket id + Shipped + Agency + Warehouse + State + + + + + {{stowaway.id}} + {{stowaway.ticket.landed | dateTime: 'dd/MM/yyyy'}} + {{stowaway.ticket.agencyMode.name}} + {{stowaway.ticket.warehouse.name}} + {{stowaway.ticket.state.state.name}} + + + + No results + + + +
+
+ + + \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/removeStowaway.js b/modules/item/front/ticket-descriptor/removeStowaway.js new file mode 100644 index 000000000..60b40d91c --- /dev/null +++ b/modules/item/front/ticket-descriptor/removeStowaway.js @@ -0,0 +1,78 @@ +import ngModule from '../module'; + +class Controller { + constructor($state, $scope, $http) { + this.$scope = $scope; + this.$state = $state; + this.$http = $http; + } + + getTicketStowaways() { + if (this.ticket.stowaway) { + this.ticketStowaways = [this.ticket.stowaway]; + this.showDeleteConfirm(0); + } else if (this.ticket.ship.length > 1) { + let filter = { + where: {shipFk: this.ticket.id}, + include: { + relation: 'ticket', + scope: { + include: [ + {relation: 'agencyMode'}, + {relation: 'warehouse'}, + {relation: 'state', + scope: { + fields: ['stateFk'], + include: { + relation: 'state' + } + }, + }, + ] + } + } + }; + + let json = encodeURIComponent(JSON.stringify(filter)); + this.$http.get(`/api/Stowaways?filter=${json}`).then(res => { + console.log(res.data); + this.ticketStowaways = res.data; + this.$scope.dialog.show(); + }); + } + } + + deleteStowaway(response) { + if (response === 'ACCEPT') { + this.$http.delete(`/api/Stowaways/${this.stowawayToDelete.id}`).then(res => { + this.card.reload(); + }); + } + } + + showDeleteConfirm(index) { + this.stowawayToDelete = this.ticketStowaways[index]; + this.$scope.confirmationDialog.show(); + } + + show() { + this.getTicketStowaways(); + } + + hide() { + this.$scope.dialog.hide(); + } +} + +Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate']; + +ngModule.component('vnRemoveStowaway', { + template: require('./removeStowaway.html'), + controller: Controller, + bindings: { + ticket: '<' + }, + require: { + card: '^vnTicketCard' + } +}); diff --git a/modules/item/front/ticket-descriptor/style.scss b/modules/item/front/ticket-descriptor/style.scss new file mode 100644 index 000000000..3d6ca7aed --- /dev/null +++ b/modules/item/front/ticket-descriptor/style.scss @@ -0,0 +1,36 @@ +@import 'colors'; + +vn-dialog.modalForm { + vn-horizontal.header{ + background-color: $main-01; + h5{ + color: white; + margin: 0 auto; + } + } + tpl-body { + width: 100%; + } + table { + width: 100% + } + &>div{ + padding: 0!important; + } + vn-textfield { + width: 100%; + } + .buttons{ + margin-top: 0!important; + } + + p{ + display: none; + } + button.close > vn-icon{ + color: white!important; + } + vn-ticket-sale-edit-discount > div { + padding-bottom: 0!important; + } +} \ No newline at end of file From 32743cb1d280c06f222ceebd776cddd451d37c51 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 18 Jan 2019 13:37:48 +0100 Subject: [PATCH 07/16] updated description --- modules/order/back/methods/order/confirm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/order/back/methods/order/confirm.js b/modules/order/back/methods/order/confirm.js index b1046ebf3..788486060 100644 --- a/modules/order/back/methods/order/confirm.js +++ b/modules/order/back/methods/order/confirm.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('confirm', { - description: 'Gets the taxes of a given order', + description: 'Confirms an order', accessType: 'WRITE', accepts: [{ arg: 'id', @@ -20,7 +20,7 @@ module.exports = Self => { }); Self.confirm = async orderFk => { - let query = `CALL hedera.orderConfirm(?);`; + let query = `CALL hedera.orderConfirm(?)`; return await Self.rawSql(query, [orderFk]); }; }; From cb650bbdbc46c95072e9677a802da61cb9d2d816 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 18 Jan 2019 13:38:18 +0100 Subject: [PATCH 08/16] added missing locale --- modules/item/front/card/index.js | 1 - modules/order/front/line/locale/es.yml | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/item/front/card/index.js b/modules/item/front/card/index.js index d3ce4a208..9e11a7045 100644 --- a/modules/item/front/card/index.js +++ b/modules/item/front/card/index.js @@ -20,7 +20,6 @@ class Controller { reload() { this.getCard(); } - } Controller.$inject = ['$http', '$stateParams']; diff --git a/modules/order/front/line/locale/es.yml b/modules/order/front/line/locale/es.yml index 2e4bcfcb2..ba3a3fee6 100644 --- a/modules/order/front/line/locale/es.yml +++ b/modules/order/front/line/locale/es.yml @@ -1 +1,2 @@ -Remove item: Eliminar articulo \ No newline at end of file +Remove item: Eliminar articulo +Order confirmed: Pedido confirmado \ No newline at end of file From 9cb298fb08d819cc46b8086f30a3aea4ce43c72d Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 18 Jan 2019 14:04:12 +0100 Subject: [PATCH 09/16] modules summary were not updating view data #978 --- modules/claim/front/summary/index.html | 42 ++++++++++++------------- modules/order/front/index/index.js | 1 - modules/order/front/index/style.scss | 7 ----- modules/order/front/summary/index.html | 24 +++++++------- modules/order/front/summary/style.scss | 6 ++++ modules/ticket/front/summary/index.html | 30 +++++++++--------- 6 files changed, 54 insertions(+), 56 deletions(-) delete mode 100644 modules/order/front/index/style.scss diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index b9e9f0744..6a505426d 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -10,7 +10,7 @@ value="{{$ctrl.summary.claim.created | dateTime: 'dd/MM/yyyy'}}"> + value="{{$ctrl.summary.claim.claimState.description}}"> @@ -65,14 +65,14 @@ {{("000000"+saleClaimed.sale.itemFk).slice(-6)}} - {{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} - {{saleClaimed.sale.quantity}} - {{saleClaimed.quantity}} - {{saleClaimed.sale.concept}} - {{saleClaimed.sale.price | currency:'€':2}} - {{saleClaimed.sale.discount}} % + {{::saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} + {{::saleClaimed.sale.quantity}} + {{::saleClaimed.quantity}} + {{::saleClaimed.sale.concept}} + {{::saleClaimed.sale.price | currency:'€':2}} + {{::saleClaimed.sale.discount}} % - {{(saleClaimed.sale.quantity * saleClaimed.sale.price) - + {{::(saleClaimed.sale.quantity * saleClaimed.sale.price) - ((saleClaimed.sale.discount * (saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency:'€':2 }} @@ -100,11 +100,11 @@ - {{development.claimReason.description}} - {{development.claimResult.description}} - {{development.claimResponsible.description}} - {{development.worker.firstName}} - {{development.claimRedelivery.description}} + {{::development.claimReason.description}} + {{::development.claimResult.description}} + {{::development.claimResponsible.description}} + {{::development.worker.firstName}} + {{::development.claimRedelivery.description}} @@ -138,15 +138,15 @@ {{("000000"+action.sale.itemFk).slice(-6)}} - {{action.sale.id}} - {{action.claimBeggining.description}} - {{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} - {{action.sale.quantity}} - {{action.sale.concept}} - {{action.sale.price}} - {{action.sale.discount}} % + {{::action.sale.id}} + {{::action.claimBeggining.description}} + {{::action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} + {{::action.sale.quantity}} + {{::action.sale.concept}} + {{::action.sale.price}} + {{::action.sale.discount}} % - {{(action.sale.quantity * action.sale.price) - + {{::(action.sale.quantity * action.sale.price) - ((action.sale.discount * (action.sale.quantity * action.sale.price))/100) | currency:'€':2 }} diff --git a/modules/order/front/index/index.js b/modules/order/front/index/index.js index c3ac7a736..3a49a5197 100644 --- a/modules/order/front/index/index.js +++ b/modules/order/front/index/index.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './style.scss'; export default class Controller { constructor($scope) { diff --git a/modules/order/front/index/style.scss b/modules/order/front/index/style.scss deleted file mode 100644 index f83e955ed..000000000 --- a/modules/order/front/index/style.scss +++ /dev/null @@ -1,7 +0,0 @@ -vn-order-index { - vn-dialog.summary { - div { - min-width: 900px; - } - } -} \ No newline at end of file diff --git a/modules/order/front/summary/index.html b/modules/order/front/summary/index.html index a48bd6934..45009c009 100644 --- a/modules/order/front/summary/index.html +++ b/modules/order/front/summary/index.html @@ -6,43 +6,43 @@ + value="{{$ctrl.summary.id}}"> + value="{{$ctrl.summary.address.nickname}}"> + value="{{$ctrl.summary.isConfirmed}}"> + value="{{$ctrl.summary.sourceApp}}"> + value="{{$ctrl.summary.created | date: 'dd/MM/yyyy HH:mm'}}"> + value="{{$ctrl.summary.confirmed | date: 'dd/MM/yyyy'}}"> + value="{{$ctrl.formattedAddress}}"> + value="{{$ctrl.summary.address.phone}}"> + value="{{$ctrl.summary.note}}">
-

Subtotal {{::$ctrl.summary.subTotal | currency:' €':2}}

-

VAT {{::$ctrl.summary.VAT | currency:' €':2}}

-

Total {{::$ctrl.summary.total | currency:' €':2}}

+

Subtotal {{$ctrl.summary.subTotal | currency:' €':2}}

+

VAT {{$ctrl.summary.VAT | currency:' €':2}}

+

Total {{$ctrl.summary.total | currency:' €':2}}

diff --git a/modules/order/front/summary/style.scss b/modules/order/front/summary/style.scss index ca61ee97c..eed3d5370 100644 --- a/modules/order/front/summary/style.scss +++ b/modules/order/front/summary/style.scss @@ -1,3 +1,9 @@ +vn-dialog { + vn-order-summary vn-one { + min-width: 10em; + } +} + .ticketSummary { .ticketSummary__data { vn-one { diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 9631af22e..46b5858b1 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -6,48 +6,48 @@ + value="{{$ctrl.summary.state.state.name}}"> + value="{{$ctrl.summary.client.salesPerson.firstName}} {{$ctrl.summary.client.salesPerson.name}}"> + value="{{$ctrl.summary.agencyMode.name}}"> + value="{{$ctrl.summary.warehouse.name}}"> + value="{{$ctrl.summary.packages}}"> + value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy HH:mm'}}"> + value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}"> + value="{{$ctrl.summary.routeFk}}"> + value="{{$ctrl.formattedAddress}}"> + value="{{$ctrl.summary.address.phone}}"> - +
-

Subtotal {{::$ctrl.summary.subTotal | currency:' €':2}}

-

VAT {{::$ctrl.summary.VAT | currency:' €':2}}

-

Total {{::$ctrl.summary.total | currency:' €':2}}

+

Subtotal {{$ctrl.summary.subTotal | currency:' €':2}}

+

VAT {{$ctrl.summary.VAT | currency:' €':2}}

+

Total {{$ctrl.summary.total | currency:' €':2}}

From 2df9579f2caea773968a026db96503ba1729136a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sun, 20 Jan 2019 16:47:04 +0100 Subject: [PATCH 10/16] Summary style fixes --- e2e/helpers/selectors.js | 22 +- e2e/paths/item-module/01_item_summary.spec.js | 44 +- front/core/components/dialog/style.scss | 49 +-- front/core/components/fetched-tags/index.html | 3 +- front/core/components/fetched-tags/style.scss | 64 +-- .../components/label-value/label-value.js | 2 +- front/core/components/label-value/style.scss | 4 + front/salix/components/home/home.html | 12 +- front/salix/components/home/home.js | 32 +- front/salix/components/home/style.scss | 26 +- .../salix/components/main-menu/main-menu.html | 2 +- front/salix/modules-factory.js | 5 +- front/salix/styles/summary.scss | 130 ++++-- loopback/locale/en.json | 3 +- modules/claim/front/summary/index.html | 327 +++++++------- modules/client/front/locale/es.yml | 2 +- modules/client/front/summary/index.html | 401 +++++++++--------- modules/client/front/summary/locale/es.yml | 1 + modules/client/front/summary/style.scss | 6 - modules/item/front/descriptor/index.html | 20 +- modules/item/front/summary/index.html | 231 +++++----- modules/item/front/summary/style.scss | 2 +- modules/item/front/ticket-descriptor/index.js | 10 +- modules/order/front/index/index.html | 14 +- modules/order/front/summary/index.html | 97 ++--- modules/order/front/summary/style.scss | 35 +- modules/ticket/front/card/index.js | 4 +- modules/ticket/front/summary/index.html | 147 ++++--- modules/ticket/front/summary/style.scss | 29 +- modules/travel/front/routes.json | 1 - 30 files changed, 832 insertions(+), 893 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f4d0a8fda..d1ecae5a4 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -261,12 +261,12 @@ export default { submitBotanicalButton: `${components.vnSubmit}` }, itemSummary: { - basicData: `vn-item-summary vn-vertical[name="basicData"]`, - vat: `vn-item-summary vn-vertical[name="tax"]`, - tags: `vn-item-summary vn-vertical[name="tags"]`, - niche: `vn-item-summary vn-vertical[name="niche"]`, - botanical: `vn-item-summary vn-vertical[name="botanical"]`, - barcode: `vn-item-summary vn-vertical[name="barcode"]` + basicData: `vn-item-summary [name="basicData"]`, + vat: `vn-item-summary [name="tax"]`, + tags: `vn-item-summary [name="tags"]`, + niche: `vn-item-summary [name="niche"]`, + botanical: `vn-item-summary [name="botanical"]`, + barcode: `vn-item-summary [name="barcode"]` }, itemDiary: { thirdTicketId: 'vn-item-diary > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(2) > span', @@ -275,11 +275,11 @@ export default { warehouseAutocomplete: 'vn-item-diary vn-autocomplete[field="$ctrl.warehouseFk"]', }, ticketSummary: { - sale: 'vn-ticket-summary > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > table > tbody > tr', - firstSaleItemId: 'vn-ticket-summary > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > table > tbody > tr > td:nth-child(2) > span', - popoverDiaryButton: 'vn-ticket-summary > vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]', - firstSaleQuantity: 'vn-ticket-summary > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > table > tbody > tr > td:nth-child(4)', - firstSaleDiscount: 'vn-ticket-summary > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > table > tbody > tr > td:nth-child(6)' + sale: 'vn-ticket-summary [name="sales"] table > tbody > tr', + firstSaleItemId: 'vn-ticket-summary [name="sales"] table > tbody > tr > td:nth-child(2) > span', + popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]', + firstSaleQuantity: 'vn-ticket-summary [name="sales"] table > tbody > tr > td:nth-child(4)', + firstSaleDiscount: 'vn-ticket-summary [name="sales"] table > tbody > tr > td:nth-child(6)' }, ticketsIndex: { newTicketButton: 'body > vn-app > vn-vertical > vn-vertical > ui-view > vn-ticket-index > a', diff --git a/e2e/paths/item-module/01_item_summary.spec.js b/e2e/paths/item-module/01_item_summary.spec.js index 13f72d98d..d454ddf81 100644 --- a/e2e/paths/item-module/01_item_summary.spec.js +++ b/e2e/paths/item-module/01_item_summary.spec.js @@ -35,34 +35,34 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from basic data`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Object1 Gem1 5') + .waitForTextInElement(selectors.itemSummary.basicData, 'Object1 Gem1 5') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Name: Object1 Gem1 5'); + expect(result).toContain('Object1 Gem1 5'); }); it(`should check the item summary preview shows fields from tags`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') + .waitForTextInElement(selectors.itemSummary.tags, 'Yellow') .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); - expect(result).toContain('Color: Yellow'); + expect(result).toContain('Yellow'); }); it(`should check the item summary preview shows fields from niche`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') + .waitForTextInElement(selectors.itemSummary.niche, 'A1') .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); - expect(result).toContain('Warehouse One: A1'); + expect(result).toContain('A1'); }); it(`should check the item summary preview shows fields from botanical`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') + .waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix') .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); - expect(result).toContain('Botanical: Hedera helix'); + expect(result).toContain('Hedera helix'); }); it(`should check the item summary preview shows fields from barcode`, async() => { @@ -83,7 +83,7 @@ describe('Item summary path', () => { it('should search for other item', async() => { const result = await nightmare - .clearInput('body > vn-app > vn-vertical > vn-vertical > ui-view > vn-item-index > div > div > vn-card:nth-child(1) > div > vn-searchbar > form > vn-horizontal > vn-textfield > div > div > div.infix > input') + .clearInput('vn-item-index vn-searchbar input') .click(selectors.itemsIndex.searchButton) .type(selectors.itemsIndex.searchItemInput, 'Object2 Gem2 3') .click(selectors.itemsIndex.searchButton) @@ -109,34 +109,34 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from basic data`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Object2 Gem2 3') + .waitForTextInElement(selectors.itemSummary.basicData, 'Object2 Gem2 3') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Name: Object2 Gem2 3'); + expect(result).toContain('Object2 Gem2 3'); }); it(`should now check the item summary preview shows fields from tags`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.tags, 'Color: Red') + .waitForTextInElement(selectors.itemSummary.tags, 'Red') .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); - expect(result).toContain('Color: Red'); + expect(result).toContain('Red'); }); it(`should now check the item summary preview shows fields from niche`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4') + .waitForTextInElement(selectors.itemSummary.niche, 'A4') .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); - expect(result).toContain('Warehouse One: A4'); + expect(result).toContain('A4'); }); it(`should now check the item summary preview shows fields from botanical`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -') + .waitForTextInElement(selectors.itemSummary.botanical, '-') .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); - expect(result).toContain('Botanical: -'); + expect(result).toContain('-'); }); it(`should now check the item summary preview shows fields from barcode`, async() => { @@ -166,31 +166,31 @@ describe('Item summary path', () => { it(`should check the item summary shows fields from basic data section`, async() => { const result = await nightmare - .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Object2 Gem2 3') + .waitForTextInElement(selectors.itemSummary.basicData, 'Object2 Gem2 3') .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); - expect(result).toContain('Name: Object2 Gem2 3'); + expect(result).toContain('Object2 Gem2 3'); }); it(`should check the item summary shows fields from tags section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); - expect(result).toContain('Color: Red'); + expect(result).toContain('Red'); }); it(`should check the item summary shows fields from niches section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); - expect(result).toContain('Warehouse One: A4'); + expect(result).toContain('One A4'); }); it(`should check the item summary shows fields from botanical section`, async() => { const result = await nightmare .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); - expect(result).toContain('Botanical: -'); + expect(result).toContain('-'); }); it(`should check the item summary shows fields from barcodes section`, async() => { diff --git a/front/core/components/dialog/style.scss b/front/core/components/dialog/style.scss index a9b1ceb95..a2f11b25d 100644 --- a/front/core/components/dialog/style.scss +++ b/front/core/components/dialog/style.scss @@ -13,6 +13,8 @@ background-color: rgba(0, 0, 0, .6); opacity: 0; transition: opacity 300ms ease-in-out; + padding: 3em; + box-sizing: border-box; &.shown { opacity: 1; @@ -25,6 +27,7 @@ overflow: auto; padding: 2em; box-sizing: border-box; + max-height: 100%; tpl-body { display: block; @@ -67,50 +70,4 @@ } } } - - &.dialog-summary { - - vn-card { - border: none; - box-shadow: none; - padding: 0; - - & > div > vn-vertical { - padding: 0; - margin: 0 - } - } - - & > div > button.close > vn-icon { - color: $main-01; - } - - & > div { - padding: 0 - } - - tpl-body { - width:auto; - background-color: transparent; - padding: 0 2em - } - - .body { - overflow: auto; - margin-top: 2em; - max-height: 700px; - } - - form { - min-width: 680px; - } - - .buttons { - margin-top: 2em - } - - vn-check label span { - font-size: .9em - } - } } diff --git a/front/core/components/fetched-tags/index.html b/front/core/components/fetched-tags/index.html index 84b3a2130..49232862a 100644 --- a/front/core/components/fetched-tags/index.html +++ b/front/core/components/fetched-tags/index.html @@ -2,7 +2,8 @@ {{::$ctrl.item.name}}
{{::fetchedTag.value}} diff --git a/front/core/components/fetched-tags/style.scss b/front/core/components/fetched-tags/style.scss index ec96d1efa..776d2522d 100644 --- a/front/core/components/fetched-tags/style.scss +++ b/front/core/components/fetched-tags/style.scss @@ -4,59 +4,35 @@ vn-fetched-tags { &.noTitle vn-one { display: none !important; } + & > vn-horizontal { + align-items: center; - @media screen and (max-width: 1600px){ - & vn-horizontal { + @media screen and (max-width: 1600px) { flex-direction: column; text-align: center; & > vn-one { - padding: 0 0 0.2em 0; - } - - & > vn-two { - text-align: center; - margin: 0 auto - } - - .inline-tag { - font-size: 0.7em; - padding: 0.3em + padding-bottom: .2em; } } - } + & > vn-one { + min-width: 12em; + } + & > vn-auto > .inline-tag { + display: inline-block; + color: $secondary-font-color; + margin-right: .4em; + text-align: center; + font-size: .8em; + height: 1.25em; + padding: .1em; + border-radius: .1em; + width: 4em; + border: 1px solid $secondary-font-color; - @media screen and (max-width: 1200px){ - & vn-horizontal { - .inline-tag { - font-size: 0.6em; - padding: 0.2em + &.empty { + border: 1px solid $main-bg; } } } - - & vn-one { - padding-top: 0.2em - } - - & vn-two { - white-space: nowrap - } - - & .inline-tag { - background-color: $color-white; - display: inline-block; - color: $secondary-font-color; - margin-right: 0.4em; - text-align: center; - font-size: 0.8em; - height: 1.25em; - padding: 0.3em; - width: 5em; - border: 1px solid $secondary-font-color; - } - - & .inline-tag.empty { - border: 1px solid $main-bg - } } \ No newline at end of file diff --git a/front/core/components/label-value/label-value.js b/front/core/components/label-value/label-value.js index 73a241b4e..88edb5381 100644 --- a/front/core/components/label-value/label-value.js +++ b/front/core/components/label-value/label-value.js @@ -8,7 +8,7 @@ export default class Controller { } set label(value) { let label = this.element.querySelector('vn-label'); - label.textContent = this._.instant(value) + ':'; + label.textContent = this._.instant(value); this._label = value; } get label() { diff --git a/front/core/components/label-value/style.scss b/front/core/components/label-value/style.scss index 19b551af0..e4360cec4 100644 --- a/front/core/components/label-value/style.scss +++ b/front/core/components/label-value/style.scss @@ -3,6 +3,10 @@ vn-label-value > section { & > vn-label { color: $secondary-font-color; + + &::after { + content: ':'; + } } & > span { color: $main-font-color; diff --git a/front/salix/components/home/home.html b/front/salix/components/home/home.html index 16d5eebf9..48546f4cd 100644 --- a/front/salix/components/home/home.html +++ b/front/salix/components/home/home.html @@ -1,18 +1,22 @@ -
+ diff --git a/front/salix/components/home/home.js b/front/salix/components/home/home.js index 4891f29ef..dd8765286 100644 --- a/front/salix/components/home/home.js +++ b/front/salix/components/home/home.js @@ -3,26 +3,42 @@ import './style.scss'; import keybindings from '../../global-keybindings.yml'; export default class Controller { - constructor(modulesFactory, $state, $translate, $scope) { + constructor(modulesFactory, $state, $translate, $sce) { this.modules = modulesFactory.getModules(); - this.state = $state; - this.$translate = $translate; - this.$scope = $scope; + this.$state = $state; + this._ = $translate; + this.$sce = $sce; this.keybindings = keybindings; } $onInit() { - this.modules.map(module => { + this.modules.map(mod => { let keyBind = this.keybindings.find(keyBind => { - return keyBind.sref == module.route.state; + return keyBind.sref == mod.route.state; }); if (keyBind) - module.keyBind = keyBind.key.toUpperCase(); + mod.keyBind = keyBind.key.toUpperCase(); }); } + getModuleName(mod) { + let getName = mod => { + let name = this._.instant(mod.name); + let lower = name.toUpperCase(); + if (!mod.keyBind) return name; + let index = lower.indexOf(mod.keyBind); + if (index === -1) return name; + + let newName = name.substr(0, index); + newName += `${name.substr(index, 1)}`; + newName += name.substr(index + 1); + return newName; + }; + + return this.$sce.trustAsHtml(getName(mod)); + } } -Controller.$inject = ['modulesFactory', '$state', '$translate', '$scope']; +Controller.$inject = ['modulesFactory', '$state', '$translate', '$sce']; ngModule.component('vnHome', { template: require('./home.html'), diff --git a/front/salix/components/home/style.scss b/front/salix/components/home/style.scss index b33949240..f9ba0732b 100644 --- a/front/salix/components/home/style.scss +++ b/front/salix/components/home/style.scss @@ -15,6 +15,8 @@ vn-home { flex-direction: row; justify-content: center; flex-wrap: wrap; + max-width: 40em; + margin: 0 auto; & > a { @extend %clickable-light; @@ -30,18 +32,17 @@ vn-home { padding: 1em; justify-content: center; - & > vn-icon { - font-size: 4em; - } + & > div { + height: 70px; + display: flex; + align-items: center; + justify-content: center; - & > vn-icon i[class="material-icons"] { - line-height: 75px; + & > vn-icon { + display: block; + font-size: 3.5em; + } } - - & > vn-icon, & > vn-icon i, & > vn-icon i::before { - max-height: 75px; - } - & > span { font-size: 0.9em; text-align: center; @@ -53,6 +54,11 @@ vn-home { white-space: nowrap; overflow: hidden; color: white; + margin: 0; + + & > .bind-letter { + color: #FD0; + } } } } diff --git a/front/salix/components/main-menu/main-menu.html b/front/salix/components/main-menu/main-menu.html index ba6cd6688..5f771d363 100644 --- a/front/salix/components/main-menu/main-menu.html +++ b/front/salix/components/main-menu/main-menu.html @@ -22,7 +22,7 @@
  • - + {{::mod.name}}
diff --git a/front/salix/modules-factory.js b/front/salix/modules-factory.js index 02c3e845c..1c199c4c4 100644 --- a/front/salix/modules-factory.js +++ b/front/salix/modules-factory.js @@ -4,9 +4,8 @@ function modulesFactory(aclService) { function getMainRoute(routeCollection) { let cant = routeCollection.length; for (let i = 0; i < cant; i++) { - if (!routeCollection[i].abstract) { + if (!routeCollection[i].abstract) return routeCollection[i]; - } } return null; } @@ -16,7 +15,7 @@ function modulesFactory(aclService) { for (let file in window.routes) { let card = { name: routes[file].name || routes[file].module, - icon: routes[file].icon || '' + icon: routes[file].icon || null }; let mainRoute = getMainRoute(window.routes[file].routes); if (mainRoute && aclService.routeHasPermission(mainRoute)) { diff --git a/front/salix/styles/summary.scss b/front/salix/styles/summary.scss index 4efda84e0..d636f4c29 100644 --- a/front/salix/styles/summary.scss +++ b/front/salix/styles/summary.scss @@ -1,18 +1,64 @@ @import "./colors"; +@import "./margin"; +@import "./padding"; -.summary{ - h5:not(.title) { - padding: 7px; - background-color: $main-01-03; - border-bottom: 2px solid $main-01; - font-family: unset !important; - text-transform: uppercase; - } - .title, p.title { - border: none; - background: $main-01; - color: $color-white; - margin: 0!important; +.summary { + margin: 0 auto; + max-width: 950px; + + & > div { + & > h5 { + @extend .pad-small; + border: none; + background: $main-01; + color: $color-white; + margin: 0; + text-align: center; + line-height: 1.3em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + & > vn-horizontal { + flex-wrap: wrap; + @extend .pad-medium; + + h4 { + @extend .margin-medium-bottom; + text-transform: uppercase; + font-size: 15pt; + line-height: 1; + padding: 7px; + padding-bottom: 4px; /* Bottom line-height fix */ + font-family: unset; + background-color: $main-01-03; + border-bottom: .1em solid $main-01; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + & > * { + @extend .margin-small; + min-width: 14em; + overflow: hidden; + padding: 0; + } + & > vn-auto { + width: 100%; + } + vn-label-value > section { + margin-bottom: .3em; + + & > vn-label { + display: block; + font-size: .9em; + + &::after { + content: initial; + } + } + } + } } p:after { content: ' '; @@ -20,42 +66,50 @@ display: block; clear: both } +} - vn-label-value > section { - margin-bottom: .3em +.vn-dialog.dialog-summary { + vn-card { + border: none; + box-shadow: none; + } + & > div > button.close { + display: none; + } + & > div { + padding: 0 + } + tpl-body { + width: auto; + } + .buttons { + display: none; + } + vn-check label span { + font-size: .9em } } .state { - @extend .summary; padding: 5px; background-color: $main-01; - vn-one:nth-child(1){ - border-right: 1px solid white; - } + color: white; + p { - font-size: 12px; - line-height: 15px!important; - padding: 0 0 2px 0; - } - h5 { - line-height: 10px!important; + font-size: 13px; + line-height: 15px; + text-align: center; + margin: .1em 0; + + &:nth-child(1) { + text-transform: uppercase; + } } vn-one { padding: 0; - } - vn-one > h5{ - padding-bottom: 7px; - } -} - -vn-item-descriptor .state{ - @extend .state; - vn-one > p{ - padding-top: 5px; - } - vn-one > h5{ - padding-bottom: 12px; + &:nth-child(1) { + border-right: .1em solid white; + } } } \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 8c9f4779f..9e24f2b04 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -26,5 +26,6 @@ "Warehouse cannot be blank": "Warehouse cannot be blank", "Agency cannot be blank": "Agency cannot be blank", "The IBAN does not have the correct format": "The IBAN does not have the correct format", - "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows" + "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows", + "You can't create a ticket for a inactive client": "You can't create a ticket for a inactive client" } \ No newline at end of file diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 6a505426d..243d98f25 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -1,167 +1,162 @@ - - - - -
{{$ctrl.summary.claim.id}} - {{$ctrl.summary.claim.client.name}}
-
- - - - - - - - - - - - - - - - - - - - - - -
Detail
- - - - Id - Landed - Quantity - Claimed - Description - Price - Disc. - Total - - - - - - - {{("000000"+saleClaimed.sale.itemFk).slice(-6)}} - - - {{::saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} - {{::saleClaimed.sale.quantity}} - {{::saleClaimed.quantity}} - {{::saleClaimed.sale.concept}} - {{::saleClaimed.sale.price | currency:'€':2}} - {{::saleClaimed.sale.discount}} % - - {{::(saleClaimed.sale.quantity * saleClaimed.sale.price) - - ((saleClaimed.sale.discount * - (saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency:'€':2 - }} - - - - - No results - - -
-
- - -
Development
- - - - Reason - Result - Responsible - Worker - Redelivery - - - - - {{::development.claimReason.description}} - {{::development.claimResult.description}} - {{::development.claimResponsible.description}} - {{::development.worker.firstName}} - {{::development.claimRedelivery.description}} - - - - No results - - -
-
- - -
Action
- - - - Id - Destination - Landed - Quantity - Description - Price - Disc. - Total - - - - - - - {{("000000"+action.sale.itemFk).slice(-6)}} - - - {{::action.sale.id}} - {{::action.claimBeggining.description}} - {{::action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} - {{::action.sale.quantity}} - {{::action.sale.concept}} - {{::action.sale.price}} - {{::action.sale.discount}} % - - {{::(action.sale.quantity * action.sale.price) - - ((action.sale.discount * - (action.sale.quantity * action.sale.price))/100) | currency:'€':2 - }} - - - - - No results - - -
-
-
-
-
- + +
{{$ctrl.summary.claim.id}} - {{$ctrl.summary.claim.client.name}}
+ + + + + + + + + + + + + + + + + + + + +

Detail

+
+ + + + Id + Landed + Quantity + Claimed + Description + Price + Disc. + Total + + + + + + + {{("000000"+saleClaimed.sale.itemFk).slice(-6)}} + + + {{saleClaimed.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} + {{saleClaimed.sale.quantity}} + {{saleClaimed.quantity}} + {{saleClaimed.sale.concept}} + {{saleClaimed.sale.price | currency:'€':2}} + {{saleClaimed.sale.discount}} % + + {{(saleClaimed.sale.quantity * saleClaimed.sale.price) - + ((saleClaimed.sale.discount * + (saleClaimed.sale.quantity * saleClaimed.sale.price))/100) | currency:'€':2 + }} + + + + + No results + + +
+
+ +

Development

+
+ + + + Reason + Result + Responsible + Worker + Redelivery + + + + + {{development.claimReason.description}} + {{development.claimResult.description}} + {{development.claimResponsible.description}} + {{development.worker.firstName}} + {{development.claimRedelivery.description}} + + + + No results + + +
+
+ +

Action

+
+ + + + Id + Destination + Landed + Quantity + Description + Price + Disc. + Total + + + + + + + {{("000000"+action.sale.itemFk).slice(-6)}} + + + {{action.sale.id}} + {{action.claimBeggining.description}} + {{action.sale.ticket.landed | dateTime: 'dd/MM/yyyy'}} + {{action.sale.quantity}} + {{action.sale.concept}} + {{action.sale.price}} + {{action.sale.discount}} % + + {{(action.sale.quantity * action.sale.price) - + ((action.sale.discount * + (action.sale.quantity * action.sale.price))/100) | currency:'€':2 + }} + + + + + No results + + +
+
+
+
+ \ No newline at end of file diff --git a/modules/client/front/locale/es.yml b/modules/client/front/locale/es.yml index 917e440a9..64614337e 100644 --- a/modules/client/front/locale/es.yml +++ b/modules/client/front/locale/es.yml @@ -33,7 +33,7 @@ List: Listado New client: Nuevo cliente Summary: Vista previa Basic data: Datos básicos -Fiscal data: Datos Fiscales +Fiscal data: Datos fiscales Pay method: Forma de pago Addresses: Consignatarios New address: Nuevo consignatario diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index 7ea875094..311da805a 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -1,208 +1,195 @@ - - - - -
{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.firstName}} {{$ctrl.summary.salesPerson.name}}
-
- - -
Basic data
- - - - - - - - - - - - - - - - -
- -
Fiscal data
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Pay method
- - - - - - - - - - - - - - - - -
-
- - -
Default address
- - - - - - -
- -
Web access
- - - - - - -
- -
Business data
- - - - - - - - - - -
- -
Financial information
- - - - - - - - - - - - - - -
-
+ +
{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.firstName}} {{$ctrl.summary.salesPerson.name}}
+ + +

Basic data

+ + + + + + + + + + + + + + + + +
+ +

Fiscal address

+ + + + + + + + + + + + + + +
+ +

Fiscal data

+ + + + + + + + + + + + + + + + +
+ +

Pay method

+ + + + + + + + + + + + + + +
+ +

Default address

+ + + + + + +
+ +

Web access

+ + + + + + +
+ +

Business data

+ + + + + + + + + + +
+ +

Financial information

+ + + + + + + + + + + + + -
-
\ No newline at end of file + + +
\ No newline at end of file diff --git a/modules/client/front/summary/locale/es.yml b/modules/client/front/summary/locale/es.yml index 36faf51d6..8377e8bc5 100644 --- a/modules/client/front/summary/locale/es.yml +++ b/modules/client/front/summary/locale/es.yml @@ -11,3 +11,4 @@ Balance due: Saldo vencido Rate: Tarifa Business data: Datos comerciales Recovery since: Recobro desde +Fiscal address: Dirección fiscal diff --git a/modules/client/front/summary/style.scss b/modules/client/front/summary/style.scss index a8a0be75b..7918cdffd 100644 --- a/modules/client/front/summary/style.scss +++ b/modules/client/front/summary/style.scss @@ -1,9 +1,3 @@ -vn-dialog { - vn-client-summary vn-one { - min-width: 10em; - } -} - vn-client-summary { .bold { font-family: vn-font-bold; diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index f44f13f37..2742b5f26 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -31,16 +31,16 @@ - - -

Visible

-
{{$ctrl.item.visible}}
-
- -

Available

-
{{$ctrl.item.available}}
-
-
+ + +

Visible

+

{{$ctrl.item.visible}}

+
+ +

Available

+

{{$ctrl.item.available}}

+
+
{{$ctrl.item.id}}
- - - - - -
{{$ctrl.item.id}}
-
- - - - - -

Visible

-
{{$ctrl.summary.visible}}
-
- -

Available

-
{{$ctrl.summary.available}}
-
-
-
-
- - -
Basic data
- - - - - - - - - - - - - - -
+
{{$ctrl.item.id}} - {{$ctrl.summary.item.name}}
+ + + + - - -
Other data
- - - - - - - - - - - - - - -
- - -
Tags
- - -
-
-
- - - -
Tax
- - -
-
- - -
Niche
- - -
-
- - -
Botanical
- - - - - - -
-
- - -
Barcode
-

- {{barcode.code}} -

-
-
-
-
+ + +

Visible

+

{{$ctrl.summary.visible}}

+
+ +

Available

+

{{$ctrl.summary.available}}

+
+
+ + +

Basic data

+ + + + + + + + + + + + + + +
+ +

Other data

+ + + + + + + + + + + + + + +
+ +

Tags

+ + +
+ +

Tax

+ + +
+ +

Niche

+ + +
+ +

Botanical

+ + + + + + +
+ +

Barcode

+

+ {{barcode.code}} +

+
+ \ No newline at end of file diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index fd2af274a..40f3c2f9e 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -1,5 +1,5 @@ vn-item-summary { - p{ + p { margin: 0; } } \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index b0d5c54fa..dc8432be8 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -10,9 +10,10 @@ class Controller { this.$translate = $translate; this.moreOptions = [ {callback: this.showAddTurnDialog, name: 'Add turn', show: true}, - {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, + {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}/* , {callback: this.showAddStowaway, name: 'Add stowaway', show: true}, - {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()} + {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: false} + */ ]; } @@ -109,8 +110,7 @@ class Controller { tooltip: 'Ship' }; } - console.log(value.ship); - + /* if (value.ship.length == 1) { links.btnThree = { icon: 'icon-polizon', @@ -119,7 +119,7 @@ class Controller { }; } else if (value.ship.length > 1) this.shipStowaways = value.ship; - +*/ this._quicklinks = links; } diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 6c05f0d05..4528cfe45 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -70,18 +70,14 @@
- + - - - - - - + + + class="dialog-summary"> diff --git a/modules/order/front/summary/index.html b/modules/order/front/summary/index.html index 45009c009..1b4fc97fc 100644 --- a/modules/order/front/summary/index.html +++ b/modules/order/front/summary/index.html @@ -1,52 +1,45 @@ - - + +
{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} - {{$ctrl.summary.client.salesPerson.id}}
+ + + + + + + + + + + + + + + + + + + + + + + + + +

Subtotal {{$ctrl.summary.subTotal | currency:' €':2}}

+

VAT {{$ctrl.summary.VAT | currency:' €':2}}

+

Total {{$ctrl.summary.total | currency:' €':2}}

+
-
{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} - {{$ctrl.summary.client.salesPerson.id}}
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Subtotal {{$ctrl.summary.subTotal | currency:' €':2}}

-

VAT {{$ctrl.summary.VAT | currency:' €':2}}

-

Total {{$ctrl.summary.total | currency:' €':2}}

-
-
-
- +
@@ -86,9 +79,11 @@
- - +
+ +
- diff --git a/modules/order/front/summary/style.scss b/modules/order/front/summary/style.scss index eed3d5370..283214a2d 100644 --- a/modules/order/front/summary/style.scss +++ b/modules/order/front/summary/style.scss @@ -1,31 +1,14 @@ -vn-dialog { - vn-order-summary vn-one { - min-width: 10em; - } -} +vn-order-summary .summary > div > vn-horizontal > vn-one { + min-width: 10em !important; -.ticketSummary { - .ticketSummary__data { - vn-one { - padding-right: 20px - } + &.taxes { + border: .1em solid #CCC; + text-align: right; + padding: .5em !important; - vn-one:last-child { - padding-right: 0 - } - } - - .ticketSummary__notes { - max-width: 18em - } - - .ticketSummary__taxes { - max-width: 15em; - - & section { - border: 1px solid #CCC; - text-align: right; - padding: 10px + & > p { + font-size: 1.2em; + margin: .2em; } } } \ No newline at end of file diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index cfd60800d..94a35f02a 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -7,9 +7,9 @@ class Controller { this.filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, - {relation: 'ship'}, + // {relation: 'ship'}, {relation: 'agencyMode', scope: {fields: ['name']}}, - {relation: 'stowaway'}, + // {relation: 'stowaway'}, { relation: 'client', scope: { diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 46b5858b1..f2d0a9b4f 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -1,59 +1,55 @@ - - - -
{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} - {{$ctrl.summary.nickname}}
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Subtotal {{$ctrl.summary.subTotal | currency:' €':2}}

-

VAT {{$ctrl.summary.VAT | currency:' €':2}}

-

Total {{$ctrl.summary.total | currency:' €':2}}

-
-
-
- - -
Sale
+ +
{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}} - {{$ctrl.summary.nickname}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Subtotal {{$ctrl.summary.subTotal | currency:' €':2}}

+

VAT {{$ctrl.summary.VAT | currency:' €':2}}

+

Total {{$ctrl.summary.total | currency:' €':2}}

+
+ +

Sale

+
@@ -89,7 +85,7 @@ - {{("000000"+sale.itemFk).slice(-6)}} + {{sale.itemFk | zeroFill:6}} @@ -103,11 +99,11 @@
- - - - -
Packages
+
+
+ +

Packages

+
@@ -127,9 +123,11 @@ No results - - -
Service
+
+
+ +

Service

+
@@ -153,11 +151,11 @@ No results - - - - -
Purchase request
+
+
+ +

Purchase request

+
@@ -199,10 +197,11 @@ No results - - - +
+
+
- diff --git a/modules/ticket/front/summary/style.scss b/modules/ticket/front/summary/style.scss index ca61ee97c..571402188 100644 --- a/modules/ticket/front/summary/style.scss +++ b/modules/ticket/front/summary/style.scss @@ -1,25 +1,14 @@ -.ticketSummary { - .ticketSummary__data { - vn-one { - padding-right: 20px - } +vn-ticket-summary .summary > div > vn-horizontal > vn-one { + min-width: 10em !important; - vn-one:last-child { - padding-right: 0 - } - } + &.taxes { + border: .1em solid #CCC; + text-align: right; + padding: .5em !important; - .ticketSummary__notes { - max-width: 18em - } - - .ticketSummary__taxes { - max-width: 15em; - - & section { - border: 1px solid #CCC; - text-align: right; - padding: 10px + & > p { + font-size: 1.2em; + margin: .2em; } } } \ No newline at end of file diff --git a/modules/travel/front/routes.json b/modules/travel/front/routes.json index 44f70e821..174cf4ac3 100644 --- a/modules/travel/front/routes.json +++ b/modules/travel/front/routes.json @@ -1,7 +1,6 @@ { "module": "travel", "name": "Travels", - "icon": "icon-travels", "validations": true, "routes": [ { From 6e43b11e1662d83901d7a6efb41ee67470161f43 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sun, 20 Jan 2019 18:48:03 +0100 Subject: [PATCH 11/16] Left menu fixed --- e2e/helpers/extensions.js | 2 +- e2e/helpers/selectors.js | 4 +- front/core/components/log/index.html | 5 +-- .../core/components/pagination/pagination.js | 21 +++++++-- front/salix/components/app/app.html | 24 +++++------ front/salix/components/app/style.scss | 21 +++++---- .../salix/components/left-menu/left-menu.html | 43 ++++++++----------- front/salix/styles/misc.scss | 18 +++++--- modules/agency/front/card/index.html | 2 +- modules/agency/front/descriptor/index.html | 2 +- modules/agency/front/index/index.html | 5 +-- modules/claim/front/descriptor/index.html | 2 +- modules/claim/front/index/index.html | 5 +-- modules/client/front/address/index/index.html | 6 +-- .../front/credit-insurance/index/index.html | 6 +-- .../insurance/index/index.html | 5 +-- modules/client/front/credit/index/index.html | 5 +-- modules/client/front/descriptor/index.html | 2 +- modules/client/front/greuge/index/index.html | 5 +-- modules/client/front/index/index.html | 6 +-- modules/client/front/mandate/index.html | 5 +-- .../client/front/recovery/index/index.html | 5 +-- modules/client/front/risk/index/index.html | 5 +-- modules/client/front/sample/index/index.html | 5 +-- modules/client/front/web-payment/index.html | 5 +-- modules/item/front/card/index.html | 5 +-- modules/item/front/history/index.html | 5 +-- modules/item/front/index/index.html | 5 +-- modules/item/front/last-entries/index.html | 5 +-- .../item/front/ticket-descriptor/index.html | 2 +- modules/order/front/catalog/index.html | 5 +-- modules/order/front/descriptor/index.html | 2 +- modules/order/front/index/index.html | 5 +-- modules/order/front/volume/index.html | 5 +-- modules/ticket/front/data/index.html | 24 ++++++----- modules/ticket/front/expedition/index.html | 5 +-- modules/ticket/front/index/index.html | 5 +-- modules/ticket/front/picture/index.html | 5 +-- modules/ticket/front/sale-checked/index.html | 5 +-- modules/ticket/front/sale-tracking/index.html | 5 +-- .../ticket/front/tracking/index/index.html | 5 +-- modules/ticket/front/volume/index.html | 5 +-- modules/ticket/front/weekly/index.html | 5 +-- modules/travel/front/index/index.html | 5 +-- 44 files changed, 128 insertions(+), 194 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 26d95998f..be9914ef6 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -64,7 +64,7 @@ let actions = { }, selectModule: function(moduleName, done) { - this.waitToClick(`body > vn-app > vn-vertical > vn-vertical > vn-home > div > div > a[ui-sref="${moduleName}.index"]`) + this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`) .waitForURL(moduleName) .then(done) .catch(done); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d1ecae5a4..d7cb35447 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -104,7 +104,7 @@ export default { phoneInput: `${components.vnTextfield}[name="phone"]`, mobileInput: `${components.vnTextfield}[name="mobile"]`, defaultAddress: 'vn-client-address-index vn-horizontal:nth-child(2) div[name="street"]', - secondMakeDefaultStar: 'vn-client-address-index > vn-vertical > vn-card > div > vn-horizontal:nth-child(3) vn-icon-button[icon="star_border"]', + secondMakeDefaultStar: 'vn-client-address-index vn-card vn-horizontal:nth-child(3) vn-icon-button[icon="star_border"]', firstEditButton: `vn-client-address-index vn-icon-button[icon='edit']`, secondEditButton: `vn-client-address-index vn-horizontal:nth-child(3) vn-icon-button[icon='edit']`, activeCheckbox: `vn-check[label='Enabled'] > label > input`, @@ -282,7 +282,7 @@ export default { firstSaleDiscount: 'vn-ticket-summary [name="sales"] table > tbody > tr > td:nth-child(6)' }, ticketsIndex: { - newTicketButton: 'body > vn-app > vn-vertical > vn-vertical > ui-view > vn-ticket-index > a', + newTicketButton: 'vn-ticket-index > a', searchResult: `vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr`, searchResultDate: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)`, searchResultAddress: `vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)`, diff --git a/front/core/components/log/index.html b/front/core/components/log/index.html index b88504d60..eb065c6cb 100644 --- a/front/core/components/log/index.html +++ b/front/core/components/log/index.html @@ -82,9 +82,6 @@
- - +
diff --git a/front/core/components/pagination/pagination.js b/front/core/components/pagination/pagination.js index 336b00141..f1393aee8 100644 --- a/front/core/components/pagination/pagination.js +++ b/front/core/components/pagination/pagination.js @@ -23,7 +23,7 @@ class Pagination extends Component { $onInit() { if (!this._scrollElement) - this.scrollElement = document.body; + this.scrollElement = window; } set scrollSelector(value) { @@ -50,9 +50,24 @@ class Pagination extends Component { } onScroll() { + let scrollInfo; let scrollElement = this.scrollElement; - let shouldLoad = - scrollElement.scrollTop + scrollElement.clientHeight >= (scrollElement.scrollHeight - this.scrollOffset) + + if (scrollElement == window) { + scrollInfo = { + top: window.pageYOffset, + height: window.innerHeight, + position: window.document.body.scrollHeight + }; + } else { + scrollInfo = { + top: scrollElement.scrollTop, + height: scrollElement.clientHeight, + position: scrollElement.scrollHeight + }; + } + + let shouldLoad = scrollInfo.top + scrollInfo.height >= (scrollInfo.position - this.scrollOffset) && !this.model.isLoading && (this.maxLoads <= 0 || this.nLoads < this.maxLoads); diff --git a/front/salix/components/app/app.html b/front/salix/components/app/app.html index b021b4987..35546d113 100644 --- a/front/salix/components/app/app.html +++ b/front/salix/components/app/app.html @@ -1,13 +1,11 @@ - - - - - - - - - - - - - \ No newline at end of file + + + + + + + +
+ +
+ \ No newline at end of file diff --git a/front/salix/components/app/style.scss b/front/salix/components/app/style.scss index 6c0600691..0ae9895bf 100644 --- a/front/salix/components/app/style.scss +++ b/front/salix/components/app/style.scss @@ -1,12 +1,20 @@ -body { - height: 100%; -} +@import "background"; +body { + @extend .bg-content; + overflow: auto; +} vn-app { display: block; - height: 100%; vn-topbar { + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 1; + box-shadow: 0 .1em .2em rgba(1, 1, 1, .2); + .logo { float: left; height: 1.8em; @@ -18,9 +26,6 @@ vn-app { } } .main-view { - & > * { - height: 100%; - overflow: auto; - } + padding-top: 4em; } } diff --git a/front/salix/components/left-menu/left-menu.html b/front/salix/components/left-menu/left-menu.html index 13be520ab..be5b7cd68 100644 --- a/front/salix/components/left-menu/left-menu.html +++ b/front/salix/components/left-menu/left-menu.html @@ -1,25 +1,18 @@ - - - - - - - + diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index a2428d619..edca86f95 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -162,18 +162,24 @@ vn-tool-bar { } vn-main-block { - display:block; - max-width: 1920px; - width:100%; + display: block; margin: 0 auto; .left-block { + position: fixed; + z-index: 1; + top: 4em; + left: 0; + bottom: 0; width: 16em; min-width: 16em; - padding-left: 1em; - padding-bottom: 1em; + background-color: white; + box-shadow: 0 .1em .2em rgba(1, 1, 1, .2); + overflow: auto; + } + & > vn-horizontal > vn-one > [ui-view] { + padding-left: 16em; } - .right-block { width: 16em; min-width: 16em; diff --git a/modules/agency/front/card/index.html b/modules/agency/front/card/index.html index 3b38cfc55..a049230de 100644 --- a/modules/agency/front/card/index.html +++ b/modules/agency/front/card/index.html @@ -1,6 +1,6 @@ - + diff --git a/modules/agency/front/descriptor/index.html b/modules/agency/front/descriptor/index.html index 011e3c2d9..6a225d8c6 100644 --- a/modules/agency/front/descriptor/index.html +++ b/modules/agency/front/descriptor/index.html @@ -1,4 +1,4 @@ - + diff --git a/modules/agency/front/index/index.html b/modules/agency/front/index/index.html index a6b0e74e0..d12b03628 100644 --- a/modules/agency/front/index/index.html +++ b/modules/agency/front/index/index.html @@ -52,10 +52,7 @@ - - + diff --git a/modules/claim/front/descriptor/index.html b/modules/claim/front/descriptor/index.html index c623c078b..60e9d5ab9 100644 --- a/modules/claim/front/descriptor/index.html +++ b/modules/claim/front/descriptor/index.html @@ -1,4 +1,4 @@ - + diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index b4c9f132b..a6ed8c4e0 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -61,10 +61,7 @@ - - + - - +
+ Addresses - +
diff --git a/modules/client/front/credit-insurance/index/index.html b/modules/client/front/credit-insurance/index/index.html index cb752088a..75ceffeea 100644 --- a/modules/client/front/credit-insurance/index/index.html +++ b/modules/client/front/credit-insurance/index/index.html @@ -1,5 +1,5 @@ - - +
+ Contract credit insurance @@ -55,7 +55,7 @@ vn-bind="+" label="Add"> - +
- - +