diff --git a/db/changes/10091-iberflora/00-department.sql b/db/changes/10091-iberflora/00-department.sql index 5c2889985..415879485 100644 --- a/db/changes/10091-iberflora/00-department.sql +++ b/db/changes/10091-iberflora/00-department.sql @@ -1,83 +1,2 @@ -ALTER TABLE `vn2008`.`department` -ADD COLUMN `parentFk` INT UNSIGNED NULL AFTER `sons`, -ADD COLUMN `path` VARCHAR(255) NULL AFTER `parentFk`, -CHANGE COLUMN `sons` `sons` DECIMAL(10,0) NOT NULL DEFAULT '0' ; - -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `department` AS - SELECT - `b`.`department_id` AS `id`, - `b`.`name` AS `name`, - `b`.`production` AS `isProduction`, - `b`.`parentFk` AS `parentFk`, - `b`.`path` AS `path`, - `b`.`lft` AS `lft`, - `b`.`rgt` AS `rgt`, - `b`.`isSelected` AS `isSelected`, - `b`.`depth` AS `depth`, - `b`.`sons` AS `sons` - FROM - `vn2008`.`department` `b`; - -DROP TRIGGER IF EXISTS `vn2008`.`department_AFTER_DELETE`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER = CURRENT_USER TRIGGER `vn2008`.`department_AFTER_DELETE` - AFTER DELETE ON `department` FOR EACH ROW -BEGIN - UPDATE vn.department_recalc SET isChanged = TRUE; -END$$ -DELIMITER ; - -DROP TRIGGER IF EXISTS `vn2008`.`department_BEFORE_INSERT`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER = CURRENT_USER TRIGGER `vn2008`.`department_BEFORE_INSERT` - BEFORE INSERT ON `department` FOR EACH ROW -BEGIN - UPDATE vn.department_recalc SET isChanged = TRUE; -END$$ -DELIMITER ; - -DROP TRIGGER IF EXISTS `vn2008`.`department_AFTER_UPDATE`; - -DELIMITER $$ -USE `vn2008`$$ -CREATE DEFINER = CURRENT_USER TRIGGER `vn2008`.`department_AFTER_UPDATE` - AFTER UPDATE ON `department` FOR EACH ROW -BEGIN - IF !(OLD.parentFk <=> NEW.parentFk) THEN - UPDATE vn.department_recalc SET isChanged = TRUE; - END IF; -END$$ -DELIMITER ; - -CREATE TABLE `vn`.`department_recalc` ( - `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `isChanged` TINYINT(4) NOT NULL, - PRIMARY KEY (`id`)); - -INSERT INTO `vn`.`department_recalc` (`id`, `isChanged`) VALUES ('1', '0'); - - -ALTER TABLE `vn2008`.`department` -CHANGE COLUMN `lft` `lft` INT(11) NULL , -CHANGE COLUMN `rgt` `rgt` INT(11) NULL ; - -ALTER TABLE `vn2008`.`department` -DROP INDEX `rgt_UNIQUE` , -DROP INDEX `lft_UNIQUE` ; -; - -ALTER TABLE `vn2008`.`department` -ADD INDEX `lft_rgt_depth_idx` (`lft` ASC, `rgt` ASC, `depth` ASC); -; - UPDATE vn.department SET lft = NULL, rgt = NULL; diff --git a/db/changes/10110-postCampaign/00-ticketRequest.sql b/db/changes/10110-postCampaign/00-ticketRequest.sql index 0b8a5d22d..cae9e09ce 100644 --- a/db/changes/10110-postCampaign/00-ticketRequest.sql +++ b/db/changes/10110-postCampaign/00-ticketRequest.sql @@ -1,4 +1,3 @@ -USE `vn`; ALTER TABLE `vn`.`ticketRequest` DROP FOREIGN KEY `fgnAtender`; @@ -10,44 +9,12 @@ ADD CONSTRAINT `fgnAtender` REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE; -USE `vn2008`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `vn2008`.`Ordenes` AS - SELECT - `tr`.`id` AS `Id_ORDEN`, - `tr`.`description` AS `ORDEN`, - `tr`.`requesterFk` AS `requesterFk`, - `tr`.`attenderFk` AS `attenderFk`, - `tr`.`quantity` AS `CANTIDAD`, - `tr`.`itemFk` AS `Id_ARTICLE`, - `tr`.`price` AS `PRECIOMAX`, - `tr`.`isOk` AS `isOk`, - `tr`.`saleFk` AS `Id_Movimiento`, - `tr`.`ticketFk` AS `ticketFk`, - `tr`.`response` AS `COMENTARIO`, - `tr`.`created` AS `odbc_date`, - `tr`.`ordered` AS `datORDEN`, - `tr`.`shipped` AS `datTICKET`, - `tr`.`salesPersonCode` AS `CodVENDEDOR`, - `tr`.`buyerCode` AS `CodCOMPRADOR`, - `tr`.`price__` AS `PREU`, - `tr`.`clientFk` AS `Id_CLIENTE`, - `tr`.`ok__` AS `OK`, - `tr`.`total` AS `TOTAL`, - `tr`.`buyed` AS `datCOMPRA`, - `tr`.`ko__` AS `KO` - FROM - `vn`.`ticketRequest` `tr`; -USE `vn`; + DROP TRIGGER IF EXISTS `vn`.`ticketRequest_beforeInsert`; DELIMITER $$ -USE `vn`$$ CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketRequest_beforeInsert` BEFORE INSERT ON `ticketRequest` FOR EACH ROW BEGIN IF NEW.ticketFk IS NULL THEN @@ -68,7 +35,6 @@ DELIMITER ; DROP TRIGGER IF EXISTS `vn`.`ticketRequest_beforeUpdate`; DELIMITER $$ -USE `vn`$$ CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketRequest_beforeUpdate` BEFORE UPDATE ON `ticketRequest` FOR EACH ROW BEGIN IF NEW.saleFk <> OLD.saleFk THEN @@ -85,24 +51,4 @@ BEGIN END$$ DELIMITER ; -USE `vn`; -CREATE - OR REPLACE ALGORITHM = UNDEFINED - DEFINER = `root`@`%` - SQL SECURITY DEFINER -VIEW `vn`.`ticketRequest__` AS - SELECT - `t`.`Id_ORDEN` AS `id`, - `t`.`ORDEN` AS `description`, - `t`.`requesterFk` AS `requesterFk`, - `t`.`attenderFk` AS `attenderFk`, - `t`.`CANTIDAD` AS `quantity`, - `t`.`Id_ARTICLE` AS `itemFk`, - `t`.`PRECIOMAX` AS `price`, - `t`.`isOk` AS `isOk`, - `t`.`Id_Movimiento` AS `saleFk`, - `t`.`ticketFk` AS `ticketFk`, - `t`.`COMENTARIO` AS `response`, - `t`.`odbc_date` AS `created` - FROM - `vn2008`.`Ordenes` `t`; + diff --git a/db/changes/10110-postCampaign/01-Ordenes.sql b/db/changes/10110-postCampaign/01-Ordenes.sql new file mode 100644 index 000000000..b2b2f7d35 --- /dev/null +++ b/db/changes/10110-postCampaign/01-Ordenes.sql @@ -0,0 +1,53 @@ + +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn2008`.`Ordenes` AS + SELECT + `tr`.`id` AS `Id_ORDEN`, + `tr`.`description` AS `ORDEN`, + `tr`.`requesterFk` AS `requesterFk`, + `tr`.`attenderFk` AS `attenderFk`, + `tr`.`quantity` AS `CANTIDAD`, + `tr`.`itemFk` AS `Id_ARTICLE`, + `tr`.`price` AS `PRECIOMAX`, + `tr`.`isOk` AS `isOk`, + `tr`.`saleFk` AS `Id_Movimiento`, + `tr`.`ticketFk` AS `ticketFk`, + `tr`.`response` AS `COMENTARIO`, + `tr`.`created` AS `odbc_date`, + `tr`.`ordered` AS `datORDEN`, + `tr`.`shipped` AS `datTICKET`, + `tr`.`salesPersonCode` AS `CodVENDEDOR`, + `tr`.`buyerCode` AS `CodCOMPRADOR`, + `tr`.`price__` AS `PREU`, + `tr`.`clientFk` AS `Id_CLIENTE`, + `tr`.`ok__` AS `OK`, + `tr`.`total` AS `TOTAL`, + `tr`.`buyed` AS `datCOMPRA`, + `tr`.`ko__` AS `KO` + FROM + `vn`.`ticketRequest` `tr`; + + +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`ticketRequest__` AS + SELECT + `t`.`Id_ORDEN` AS `id`, + `t`.`ORDEN` AS `description`, + `t`.`requesterFk` AS `requesterFk`, + `t`.`attenderFk` AS `attenderFk`, + `t`.`CANTIDAD` AS `quantity`, + `t`.`Id_ARTICLE` AS `itemFk`, + `t`.`PRECIOMAX` AS `price`, + `t`.`isOk` AS `isOk`, + `t`.`Id_Movimiento` AS `saleFk`, + `t`.`ticketFk` AS `ticketFk`, + `t`.`COMENTARIO` AS `response`, + `t`.`odbc_date` AS `created` + FROM + `vn2008`.`Ordenes` `t`; \ No newline at end of file diff --git a/db/changes/10120-december/00-botanicExportIsUpdatable.sql b/db/changes/10120-december/00-botanicExportIsUpdatable.sql new file mode 100644 index 000000000..eadb70cd3 --- /dev/null +++ b/db/changes/10120-december/00-botanicExportIsUpdatable.sql @@ -0,0 +1,20 @@ + +DROP function IF EXISTS `vn`.`botanicExport_isUpdatable`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` FUNCTION `vn`.`botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,vEdiSpecieFk MEDIUMINT, + vCountryFk MEDIUMINT,vRestriction MEDIUMINT) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vIsUpdatable INTEGER; + SELECT COUNT(*) INTO vIsUpdatable + FROM botanicExport + WHERE ediGenusFk = vEdiGenusFk + AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL) + AND (vCountryFk = countryFk OR IFNULL(vCountryFk,countryFk) IS NULL) + AND vRestriction = restriction; +RETURN vIsUpdatable; +END$$ + +DELIMITER ; + diff --git a/db/changes/10120-december/00-entryBeforeUpdate.sql b/db/changes/10120-december/00-entryBeforeUpdate.sql new file mode 100644 index 000000000..088ea9328 --- /dev/null +++ b/db/changes/10120-december/00-entryBeforeUpdate.sql @@ -0,0 +1,58 @@ +DROP TRIGGER IF EXISTS `vn`.`entry_beforeUpdate`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`entry_beforeUpdate` + BEFORE UPDATE ON `entry` + FOR EACH ROW +BEGIN + DECLARE vIsVirtual BOOL; + DECLARE vPrintedCount INT; + DECLARE vHasDistinctWarehouses BOOL; + + IF !(NEW.travelFk <=> OLD.travelFk) THEN + SELECT COUNT(*) > 0 INTO vIsVirtual + FROM entryVirtual WHERE entryFk = NEW.id; + + SELECT !(o.warehouseInFk <=> n.warehouseInFk) + OR !(o.warehouseOutFk <=> n.warehouseOutFk) + INTO vHasDistinctWarehouses + FROM travel o, travel n + WHERE o.id = OLD.travelFk + AND n.id = NEW.travelFk; + + IF vIsVirtual AND vHasDistinctWarehouses THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses'; + END IF; + + IF NEW.travelFk IS NULL THEN + SELECT COUNT(*) INTO vPrintedCount + FROM buy + WHERE entryFk = OLD.id + AND printedStickers > 0; + + IF vPrintedCount > 0 THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'An entry that contains lines with printed labels cannot be deleted'; + END IF; + END IF; + END IF; + + IF !(NEW.supplierFk <=> OLD.supplierFk) THEN + SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); + END IF; + + IF !(NEW.travelFk <=> OLD.travelFk) + OR !(NEW.currencyFk <=> OLD.currencyFk) THEN + SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); + END IF; + + IF !(ABS(NEW.isBooked) <=> ABS(OLD.isBooked)) THEN + INSERT INTO entryLog SET + action = 'update', + description = 'Cambia a Contabilizada', + userFk = myWorker_getId(), + originFk = NEW.id; + END IF; +END$$ +DELIMITER ; diff --git a/db/changes/10120-december/00-entryGetComission.sql b/db/changes/10120-december/00-entryGetComission.sql new file mode 100644 index 000000000..198500f52 --- /dev/null +++ b/db/changes/10120-december/00-entryGetComission.sql @@ -0,0 +1,37 @@ +DROP function IF EXISTS `vn`.`entry_getCommission`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` FUNCTION `vn`.`entry_getCommission`( + vTravelFk INT, + vCurrencyFk INT, + vSupplierFk INT +) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vCommission INT; + DECLARE vCurrentCommission INT; + DECLARE vIsCurrencyUsd INT; + + SELECT count(*) INTO vIsCurrencyUsd + FROM currency c + WHERE c.code = 'USD' AND id = vCurrencyFk; + + IF NOT vIsCurrencyUsd THEN + SELECT commission INTO vCurrentCommission + FROM supplier s + WHERE s.id = vSupplierFk; + RETURN vCurrentCommission; + END IF; + + SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission + FROM travel t + LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped + WHERE t.id = vTravelFk + ORDER BY r.`dated` DESC + LIMIT 1; + + RETURN IFNULL(vCommission, 0); +END$$ + +DELIMITER ; + diff --git a/db/changes/10120-december/00-invoiceOutBokking.sql b/db/changes/10120-december/00-invoiceOutBokking.sql new file mode 100644 index 000000000..55254937e --- /dev/null +++ b/db/changes/10120-december/00-invoiceOutBokking.sql @@ -0,0 +1,206 @@ + +DROP procedure IF EXISTS `vn`.`invoiceOutBooking`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`invoiceOutBooking`(IN vInvoice INT) +BEGIN +/* Asienta la factura emitida +* +* param vInvoice factura_id +*/ + DECLARE vBookNumber INT; + DECLARE vExpenceConcept VARCHAR(50); + DECLARE vIsUeeMember BOOL DEFAULT TRUE; + DECLARE vSpainCountryFk INT; + DECLARE vOldBookNumber INT; + + SELECT id INTO vSpainCountryFk FROM country WHERE code = 'ES'; + + SELECT ASIEN + INTO vOldBookNumber + FROM XDiario x + JOIN invoiceOut io ON io.id = vInvoice + WHERE x.SERIE = io.serial + AND x.FACTURA = RIGHT(io.ref, LENGTH(io.ref) - 1) + LIMIT 1; + + DELETE + FROM XDiario + WHERE ASIEN = vOldBookNumber; + + DROP TEMPORARY TABLE IF EXISTS rs; + CREATE TEMPORARY TABLE rs + SELECT + c.accountingAccount AS clientBookingAccount, + io.amount as totalAmount, + CONCAT('n/fra ', io.ref) as simpleConcept, + CONCAT('n/fra ', io.ref, ' ', c.name) as Concept, + io.serial AS SERIE, + io.issued AS FECHA_EX, + opDate.FECHA_OP, + io.issued AS FECHA, + 1 AS NFACTICK, + IF(ic.correctingFk,'D','') AS TIPOOPE, + io.cplusTrascendency477Fk AS TIPOCLAVE, + io.cplusTaxBreakFk AS TIPOEXENCI, + io.cplusSubjectOpFk AS TIPONOSUJE, + io.cplusInvoiceType477Fk AS TIPOFACT, + ic.cplusRectificationTypeFk AS TIPORECTIF, + io.companyFk, + RIGHT(io.ref, LENGTH(io.ref) - 1) AS invoiceNum, + IF(ct.politicalCountryFk = vSpainCountryFk, vSpainCountryFk, IF(ct.isUeeMember = vIsUeeMember,2,4)) AS TERIDNIF, + CONCAT(IF(ct.isUeeMember = vIsUeeMember,ct.code,''),c.fi) AS TERNIF, + c.socialName AS TERNOM, + ior.serial AS SERIE_RT, + RIGHT(ior.ref, LENGTH(ior.ref) - 1) AS FACTU_RT, + ior.issued AS FECHA_RT, + IF(ior.id,TRUE,FALSE) AS RECTIFICA + FROM invoiceOut io + JOIN ( + SELECT GREATEST(MAX(shipped), TIMESTAMPADD(DAY,-15,io.issued)) as FECHA_OP + FROM ticket t + JOIN invoiceOut io ON io.ref = t.refFk + WHERE io.id = vInvoice ) opDate + JOIN invoiceOutSerial ios ON ios.code = io.serial + JOIN client c ON c.id = io.clientFk + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN invoiceCorrection ic ON ic.correctingFk = io.id + LEFT JOIN invoiceOut ior ON ior.id = ic.correctedFk + WHERE io.id = vInvoice; + + SELECT MAX(ASIEN) + 1 + INTO vBookNumber + FROM XDiario; + + -- Linea del cliente + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + EURODEBE, + CONCEPTO, + FECHA_EX, + FECHA_OP, + empresa_id + ) + SELECT + vBookNumber AS ASIEN, + rs.FECHA, + rs.clientBookingAccount AS SUBCTA, + rs.totalAmount AS EURODEBE, + rs.simpleConcept AS CONCEPTO, + rs.FECHA_EX, + rs.FECHA_OP, + rs.companyFk AS empresa_id + FROM rs; + + -- Lineas de gasto + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EUROHABER, + CONCEPTO, + FECHA_EX, + FECHA_OP, + empresa_id + ) + SELECT + vBookNumber AS ASIEN, + rs.FECHA, + ioe.expenceFk AS SUBCTA, + rs.clientBookingAccount AS CONTRA, + ioe.amount AS EUROHABER, + rs.Concept AS CONCEPTO, + rs.FECHA_EX, + rs.FECHA_OP, + rs.companyFk AS empresa_id + FROM rs + JOIN invoiceOutExpence ioe + WHERE ioe.invoiceOutFk = vInvoice; + + SELECT GROUP_CONCAT(`name` SEPARATOR ',') + INTO vExpenceConcept + FROM expence e + JOIN invoiceOutExpence ioe ON ioe.expenceFk = e.id + WHERE ioe.invoiceOutFk = vInvoice; + + -- Lineas de IVA + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + CONTRA, + EUROHABER, + BASEEURO, + CONCEPTO, + FACTURA, + IVA, + RECEQUIV, + AUXILIAR, + SERIE, + SERIE_RT, + FACTU_RT, + RECTIFICA, + FECHA_RT, + FECHA_OP, + FECHA_EX, + TIPOOPE, + NFACTICK, + TERIDNIF, + TERNIF, + TERNOM, + L340, + TIPOCLAVE, + TIPOEXENCI, + TIPONOSUJE, + TIPOFACT, + TIPORECTIF, + empresa_id + ) + SELECT + vBookNumber AS ASIEN, + rs.FECHA, + iot.pgcFk AS SUBCTA, + rs.clientBookingAccount AS CONTRA, + iot.vat AS EUROHABER, + iot.taxableBase AS BASEEURO, + CONCAT(vExpenceConcept,' : ',rs.Concept) AS CONCEPTO, + rs.invoiceNum AS FACTURA, + IF(pe2.equFk,0,pgc.rate) AS IVA, + IF(pe2.equFk,0,pgce.rate) AS RECEQUIV, + IF(pgc.mod347,'','*') AS AUXILIAR, + rs.SERIE, + rs.SERIE_RT, + rs.FACTU_RT, + rs.RECTIFICA, + rs.FECHA_RT, + rs.FECHA_OP, + rs.FECHA_EX, + rs.TIPOOPE, + rs.NFACTICK, + rs.TERIDNIF, + rs.TERNIF, + rs.TERNOM, + pgc.mod340 AS L340, + pgc.cplusTrascendency477Fk AS TIPOCLAVE, + pgc.cplusTaxBreakFk as TIPOEXENCI, + rs.TIPONOSUJE, + rs.TIPOFACT, + rs.TIPORECTIF, + rs.companyFk AS empresa_id + FROM rs + JOIN invoiceOutTax iot + JOIN pgc ON pgc.code = iot.pgcFk + LEFT JOIN pgcEqu pe ON pe.vatFk = iot.pgcFk -- --------------- Comprueba si la linea es de iva con rec.equiv. asociado + LEFT JOIN pgc pgce ON pgce.code = pe.equFk + LEFT JOIN pgcEqu pe2 ON pe2.equFk = iot.pgcFk -- --------------- Comprueba si la linea es de rec.equiv. + WHERE iot.invoiceOutFk = vInvoice; + + UPDATE invoiceOut + SET booked = CURDATE() + WHERE id = vInvoice; +END$$ +DELIMITER ; + diff --git a/db/changes/10120-december/00-manaSpellers.sql b/db/changes/10120-december/00-manaSpellers.sql new file mode 100644 index 000000000..860d2b582 --- /dev/null +++ b/db/changes/10120-december/00-manaSpellers.sql @@ -0,0 +1,2 @@ + +DROP TRIGGER IF EXISTS `bs`.`mana_spellers_AFTER_INSERT`; diff --git a/db/changes/10120-december/00-triggerVnControl.sql b/db/changes/10120-december/00-triggerVnControl.sql new file mode 100644 index 000000000..5cb148e26 --- /dev/null +++ b/db/changes/10120-december/00-triggerVnControl.sql @@ -0,0 +1,81 @@ +DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_afterInsert`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vncontrol`.`ticketTracking_afterInsert` + AFTER INSERT ON `inter` + FOR EACH ROW +BEGIN + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.Id_Ticket, NEW.inter_id, `name` + FROM vn.state + WHERE id = NEW.state_id; +END$$ +DELIMITER ; + + +DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_afterUpdate`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vncontrol`.`ticketTracking_afterUpdate` + AFTER UPDATE ON `inter` + FOR EACH ROW +BEGIN + DECLARE vTicketFk INT; + DECLARE vTicketTrackingFk INT; + DECLARE vStateName VARCHAR(15); + + IF NEW.state_id <> OLD.state_id THEN + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.Id_Ticket, NEW.inter_id, `name` + FROM vn.state + WHERE id = NEW.state_id; + END IF; + + IF NEW.Id_Ticket <> OLD.Id_Ticket THEN + SELECT i.Id_Ticket, i.inter_id, s.`name` + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = NEW.Id_Ticket + ORDER BY odbc_date DESC + LIMIT 1; + + IF vTicketFk > 0 THEN + REPLACE INTO vn.ticketLastState(ticketFk, ticketTrackingFk,name) + VALUES(vTicketFk, vTicketTrackingFk, vStateName); + END IF; + END IF; +END$$ +DELIMITER ; + +DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_afterDelete`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `vncontrol`.`ticketTracking_afterDelete` + AFTER DELETE ON `inter` + FOR EACH ROW +BEGIN + DECLARE vTicketFk INT; + DECLARE vTicketTrackingFk INT; + DECLARE vStateName VARCHAR(15); + + DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' + BEGIN + DELETE FROM vn.ticketLastState + WHERE ticketFk = OLD.Id_Ticket; + END; + + SELECT i.Id_Ticket, i.inter_id, s.`name` + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = OLD.Id_Ticket + ORDER BY odbc_date DESC + LIMIT 1; + + IF vTicketFk > 0 THEN + REPLACE INTO vn.ticketLastState(ticketFk, ticketTrackingFk,name) + VALUES(vTicketFk, vTicketTrackingFk, vStateName); + END IF; +END$$ +DELIMITER ; diff --git a/db/changes/10120-december/00-userAfterUpdate.sql b/db/changes/10120-december/00-userAfterUpdate.sql new file mode 100644 index 000000000..bb3f6a2a1 --- /dev/null +++ b/db/changes/10120-december/00-userAfterUpdate.sql @@ -0,0 +1,18 @@ +DROP TRIGGER IF EXISTS `account`.`user_afterUpdate`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` TRIGGER `account`.`user_afterUpdate` + AFTER UPDATE ON `user` + FOR EACH ROW +BEGIN + IF !(NEW.`role` <=> OLD.`role`) + THEN + INSERT INTO vn.mail SET + `sender` = 'jgallego@verdnatura.es', + `replyTo` = 'jgallego@verdnatura.es', + `subject` = 'Rol modificado', + `body` = CONCAT(myUserGetName(), ' ha modificado el rol del usuario ', + NEW.`name`, ' de ', OLD.role, ' a ', NEW.role); + END IF; +END$$ +DELIMITER ; diff --git a/db/changes/10120-december/00-vn2008Clean.sql b/db/changes/10120-december/00-vn2008Clean.sql new file mode 100644 index 000000000..b2fe13d4e --- /dev/null +++ b/db/changes/10120-december/00-vn2008Clean.sql @@ -0,0 +1,123 @@ + +DROP procedure IF EXISTS `vn2008`.`clean`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn2008`.`clean`(IN `v_full` TINYINT(1)) +proc: BEGIN + DECLARE v_date DATETIME; + DECLARE v_date18 DATETIME; + DECLARE v_date26 DATETIME; + DECLARE v_date8 DATE; + DECLARE v_date6 DATE; + DECLARE v_date3Month DATE; + DECLARE vDate2000 DATE; + DECLARE vRangeDeleteTicket INT; + DECLARE strtable varchar(15) DEFAULT NULL; + DECLARE done BIT DEFAULT 0; + + SET v_date = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET v_date18 = TIMESTAMPADD(MONTH, -18,CURDATE()); + SET v_date26 = TIMESTAMPADD(MONTH, -26,CURDATE()); + SET v_date3Month = TIMESTAMPADD(MONTH, -3, CURDATE()); + SET v_date8 = TIMESTAMPADD(DAY, -8,CURDATE()); + SET v_date6 = TIMESTAMPADD(DAY, -6,CURDATE()); + SET vRangeDeleteTicket = 60; + + DELETE FROM cdr WHERE calldate < v_date; + DELETE FROM Monitoring WHERE ODBC_TIME < v_date; + DELETE FROM Conteo WHERE Fecha < v_date; + DELETE FROM XDiario WHERE FECHA < v_date3Month OR FECHA IS NULL; + DELETE FROM mail WHERE DATE_ODBC < v_date; + + -- DELETE FROM Cajas WHERE CajaFecha < v_date18; + + DELETE rr FROM Recibos_recorded rr JOIN Recibos r ON rr.Id_Recibos = r.Id WHERE r.Fechacobro < v_date; + + SELECT MAX(idTickets_dits) + INTO @id + FROM Tickets_dits + WHERE ODBC_DATE < v_date; + DELETE FROM Tickets_dits WHERE idTickets_dits <= @id; + + DELETE FROM expeditions_deleted WHERE odbc_date < v_date26; + DELETE FROM Entradas_dits WHERE ODBC_DATE < v_date18; + DELETE FROM log_articles WHERE ODBC_DATE < v_date; + DELETE FROM Splits WHERE Fecha < v_date18; + DELETE ts FROM Tickets_stack ts JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket WHERE t.Fecha < v_date; + DELETE tobs FROM movement_label tobs JOIN Movimientos m ON tobs.Id_Movimiento = m.Id_Movimiento + JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < v_date; + DELETE FROM chat WHERE odbc_date < v_date; + DELETE FROM Extractos WHERE Fecha < v_date; + DELETE FROM Remesas WHERE `Fecha Remesa` < v_date18; + DELETE FROM Stockcontrol WHERE Datestart < v_date18; + -- DELETE FROM reference_rate WHERE date < v_date18; + DELETE FROM hedera.`order` WHERE date_send < v_date18; + -- DELETE FROM Ordenes WHERE odbc_date < v_date18; JGF 2018-12-21 Si estan en un turno no hay que borrarlas. + + SELECT MAX(inter_id) + INTO @id + FROM vncontrol.inter + WHERE odbc_date < v_date18; + DELETE FROM vncontrol.inter WHERE inter_id <= @id; + + DELETE FROM Entradas_dits WHERE ODBC_DATE < v_date; + DELETE FROM cyc_declaration WHERE Fecha < v_date18; + DELETE FROM travel_reserve WHERE odbc_date < v_date; + -- DELETE FROM syslog.systemevents WHERE odbc_date < v_date8; + + DELETE FROM cache.departure_limit WHERE Fecha < TIMESTAMPADD(MONTH,-1,CURDATE()); + DELETE co + FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra + JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada + JOIN travel t ON t.id = e.travel_id + WHERE t.landing <= v_date; + + DELETE FROM vn2008.scan WHERE odbc_date < v_date6 AND id <> 1; + + SET vDate2000 = TIMESTAMPADD(YEAR, 2000 - YEAR(CURDATE()), CURDATE()); + + IF v_full + THEN + 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 + WHERE travel_id IS NULL + AND re.Id_Entrada IS NULL; + END IF; + + -- Tickets Nulos PAK 11/10/2016 + + UPDATE vn2008.Tickets + SET empresa_id = 965 + WHERE Id_Cliente = 31 + AND empresa_id != 965; + + -- Equipos duplicados + + DELETE w.* + FROM vn2008.workerTeam w + JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated + FROM vn.workerTeam + GROUP BY team,workerFk + HAVING duplicated + ) d ON d.team = w.team AND d.workerFk = w.user AND d.id != w.id; + + -- CAP 29/10/2018 Mantenimiento tabla Movimientos_componentes + + DELETE mc + FROM vn2008.Movimientos_componentes mc + JOIN vn2008.Movimientos mv + ON mv.Id_Movimiento=mc.Id_Movimiento + JOIN vn2008.Tickets t + ON t.Id_Ticket= mv.Id_Ticket + WHERE t.Fecha 13; - IF vIsFeedStock AND vn2008.has_notify_passport(vItemFk, vSelf) THEN - CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking); + IF vIsFeedStock AND buy_hasNotifyPassport(vSelf, vItemFk) THEN + CALL buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking); INSERT IGNORE INTO producer(`name`) SELECT es.company_name FROM buy b JOIN edi.ekt be ON be.id = b.ektFk JOIN edi.supplier es ON es.supplier_id = be.pro - WHERE b.id = 1; + WHERE b.id = vSelf; END IF; END$$ diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index e1ff5b543..203c76f2f 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -36,7 +36,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:56 USE `account`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -94,7 +94,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 USE `salix`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -142,7 +142,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 USE `vn`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -300,54 +300,6 @@ LOCK TABLES `sample` WRITE; INSERT INTO `sample` VALUES (1,'Carta_1','Aviso inicial por saldo deudor',0,'0'),(2,'Carta_2','Reiteracion de aviso por saldo deudor',0,'0'),(3,'Cred_Up','Notificación de aumento de crédito',0,'0'),(4,'Cred_down','Notificación de reducción de crédito',0,'0'),(5,'Pet_CC','Petición de datos bancarios B2B',0,'0'),(6,'SolCredito','Solicitud de crédito',0,'0'),(7,'LeyPago','Ley de pagos',0,'0'),(8,'Pet_CC_Core','Petición de datos bancarios CORE',0,'0'),(9,'nueva_alta','Documento de nueva alta de cliente',0,'0'),(10,'client_welcome','Email de bienvenida para nuevo cliente',0,'0'),(11,'setup_printer','Email de instalación de impresora',0,'0'),(12,'client-welcome','Email de bienvenida como nuevo cliente',1,'0'),(13,'printer-setup','Email de instalación y configuración de impresora de coronas',1,'0'),(14,'sepa-core','Email de solicitud de datos bancarios core',1,'1'),(15,'letter-debtor-st','Email de aviso inicial por saldo deudor',1,'1'),(16,'letter-debtor-nd','Email de aviso reiterado por saldo deudor',1,'1'),(17,'client-lcr','Email de solicitud de datos bancarios LCR',1,'1'); /*!40000 ALTER TABLE `sample` ENABLE KEYS */; UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2019-11-22 14:03:55 -USE `vn2008`; --- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) --- --- Host: db.verdnatura.es Database: vn2008 --- ------------------------------------------------------ --- Server version 5.6.25-4-log - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Dumping data for table `accion_dits` --- - -LOCK TABLES `accion_dits` WRITE; -/*!40000 ALTER TABLE `accion_dits` DISABLE KEYS */; -INSERT INTO `accion_dits` VALUES (0,'Abono del ticket'),(104,'Abre a pesar del aviso'),(81,'Abre Entrada'),(116,'Abre Margenes'),(31,'Abre ticket'),(149,'Abre traslado'),(148,'Abre travel'),(12,'Acepta envio'),(64,'Acepta envio a pesar del aviso'),(23,'Aglutinació'),(92,'Añade credito'),(112,'Añade linea'),(132,'Añade manualmente Preparacion'),(33,'Añade promoción'),(144,'Añade ticket'),(129,'Bioniza Linea'),(130,'Bioniza Lineas Ok'),(128,'Bioniza Ticket'),(133,'Borra expedition'),(63,'Borrar promoción'),(80,'Cambia'),(106,'Cambia Activo'),(119,'Cambia Agencia'),(60,'Cambia almacen'),(56,'Cambia Article'),(53,'Cambia cantidad'),(78,'Cambia Categoria'),(34,'Cambia Cliente'),(74,'Cambia Color'),(110,'Cambia Comercial'),(166,'Cambia concepto'),(137,'Cambia Conductor'),(82,'Cambia Consignatario'),(105,'Cambia Contabilizada'),(142,'Cambia Coste'),(114,'Cambia Costefijo'),(108,'Cambia crédito'),(97,'Cambia CyC'),(126,'Cambia de agencia sin eliminar la ruta'),(89,'Cambia delivered'),(98,'Cambia Descuento'),(163,'Cambia el turno'),(3,'Cambia Empresa'),(147,'Cambia etiquetas'),(107,'Cambia Factura mail'),(6,'Cambia Fecha'),(37,'Cambia forma de pago'),(122,'Cambia gestdoc_id'),(135,'Cambia grouping y lo falca'),(1,'Cambia hora'),(143,'Cambia hora fin'),(118,'Cambia Id_Agencia'),(140,'Cambia km_end'),(139,'Cambia km_start'),(90,'Cambia landing'),(79,'Cambia Medida'),(77,'Cambia Nicho'),(120,'Cambia No Vincular'),(14,'Cambia obs de:'),(141,'Cambia Ok'),(73,'Cambia Origen'),(150,'Cambia packing'),(117,'Cambia Precio'),(85,'Cambia Received'),(131,'Cambia Recibido Core VNH'),(72,'Cambia Recibido Sepa'),(161,'Cambia salario'),(86,'Cambia Shipment'),(11,'Cambia solucion'),(76,'Cambia Tallos'),(109,'Cambia Tarifa '),(13,'Cambia Tipo'),(121,'Cambia Todos a No Vincular'),(138,'Cambia Vehiculo'),(94,'Cambia Vencimiento'),(88,'Cambia Warehouse de entrada'),(87,'Cambia Warehouse de salida'),(115,'Cambiazo'),(61,'Cambio de fecha'),(93,'Cobro Web'),(32,'Crea Cliente'),(145,'Crea clon'),(83,'Crea Entrada'),(19,'Crea Promoción'),(136,'Crea Ruta'),(84,'Crea Ticket'),(51,'Crea Utilidades->Abono desde el Ticket'),(52,'CREDITO SUPERADO'),(30,'DESBLOQUEA A PESAR DEL AVISO'),(8,'Desbloquea en preparación'),(5,'Desbloquea servido'),(9,'Desmarca seguro'),(54,'Elimina'),(127,'Elimina desde traslado'),(156,'Elimina horario'),(125,'Elimina la ruta por cambio de agencia'),(167,'Elimina la ruta por cambio de consignatario'),(168,'Elimina la ruta por cambio de fecha'),(160,'Elimina precio'),(165,'Elimina ticket turno'),(153,'Elimina zona'),(22,'Eliminación ticket'),(57,'Envia por AZKAR 13 a pesar del aviso'),(68,'Envio a'),(28,'FACTURA MULTIPLE'),(29,'FACTURA RAPIDA'),(111,'Factura Serie'),(58,'FALCA PREU'),(113,'Fusion'),(36,'Genera un abono santos al ticket'),(66,'Genera una reserva santos al ticket'),(69,'Hace click en Pedido'),(20,'Hace click en Ver'),(18,'Imprime CTRL_F5'),(134,'Imprime Ctrl_F5 con credito superado'),(26,'Imprimir Albarán'),(96,'Inserta cantidad en negativo'),(155,'Inserta horario'),(158,'Inserta precio'),(164,'Inserta ticket turno'),(95,'Inserta travel'),(151,'Inserta zona'),(124,'Intenta recalcular tarifas'),(59,'LLIBERA PREU'),(4,'Marca como Servido'),(7,'Marca en preparación'),(10,'Marca seguro de verano'),(157,'Modifica horario'),(159,'Modifica precio'),(154,'Modifica zona'),(99,'No desbloquea los precios'),(103,'No especificado'),(71,'No respeta disponible'),(101,'No respeta grouping'),(100,'No respeta packing'),(123,'Recalcula tarifas'),(2,'Recalculació'),(16,'Reimprime F5'),(67,'Reimprime F5 a pesar del aviso'),(65,'Reserva santos del ticket'),(146,'Revisa Ticket desde Web'),(70,'Revisado PDA'),(50,'S\'ha utilitzat la funció Imprimir_Etiquetas del TPV'),(27,'Se envia a revision'),(91,'Se imprime split'),(15,'SMS'),(102,'Split a MERCAFLOR'),(21,'Ticket Split(Automático)'),(25,'TOUR desde ticket'),(24,'TOUR hacia ticket'),(162,'Validado'),(17,'Visualiza CTRL_F5'); -/*!40000 ALTER TABLE `accion_dits` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Dumping data for table `container` --- - -LOCK TABLES `container` WRITE; -/*!40000 ALTER TABLE `container` DISABLE KEYS */; -INSERT INTO `container` VALUES (1,'atado'),(2,'bandeja'),(3,'blister'),(4,'bola'),(5,'bolsa'),(6,'bote'),(7,'botella'),(8,'bulto'),(9,'caja'),(10,'capazo'),(11,'CC'),(13,'cubo'),(14,'ejemplar'),(15,'expositor'),(16,'fardo'),(17,'full'),(18,'garba'),(21,'maceta'),(22,'macetero'),(23,'metro'),(24,'pack'),(25,'paquete'),(26,'pieza'),(27,'rollo'),(28,'saco'),(29,'set'),(30,'sobre'),(31,'tabaco'),(32,'tallo'),(33,'tubo'),(34,'vaso'),(35,'x 2 media'),(36,NULL),(37,'pallet'); -/*!40000 ALTER TABLE `container` ENABLE KEYS */; -UNLOCK TABLES; -- -- Dumping data for table `department` @@ -355,19 +307,9 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,'VERDNATURA',1,78,763,0,NULL,NULL,NULL,0,0,0,0),(22,'COMPRAS',65,66,NULL,72,596,2,5,0,0,1,0),(23,'CAMARA',41,42,NULL,72,604,2,6,1,0,0,0),(31,'INFORMATICA',11,12,NULL,72,127,3,9,0,0,0,0),(34,'CONTABILIDAD',4,5,NULL,0,NULL,NULL,NULL,0,0,0,0),(35,'FINANZAS',6,7,NULL,0,NULL,NULL,NULL,0,0,0,0),(36,'LABORAL',8,9,NULL,0,NULL,NULL,NULL,0,0,0,0),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,0),(38,'SACADO',20,21,NULL,72,230,4,14,1,0,0,0),(39,'ENCAJADO',22,23,NULL,72,230,4,12,1,0,0,0),(41,'ADMINISTRACION',3,10,NULL,72,599,3,8,0,0,0,0),(43,'VENTAS',51,64,NULL,0,NULL,NULL,NULL,0,0,0,0),(44,'GERENCIA',2,25,NULL,72,300,2,7,0,0,0,0),(45,'LOGISTICA',26,37,NULL,72,596,3,19,0,0,0,0),(46,'REPARTO',38,39,NULL,72,659,3,10,0,0,0,0),(48,'ALMACENAJE',40,47,NULL,0,NULL,NULL,NULL,0,0,0,0),(49,'PROPIEDAD',48,75,NULL,72,1008,1,1,0,0,0,0),(52,'CARGA AEREA',27,28,NULL,72,163,4,28,0,0,0,0),(53,'MARKETING Y COMUNICACIÓN',60,61,NULL,72,1238,0,0,0,0,0,0),(54,'ORNAMENTALES',76,77,NULL,72,433,3,21,0,0,0,0),(55,'TALLER NATURAL',68,69,NULL,72,695,2,23,0,0,0,0),(56,'TALLER ARTIFICIAL',70,71,NULL,72,1780,2,24,0,0,0,0),(58,'CAMPOS',73,74,NULL,72,225,2,2,0,0,0,0),(59,'MANTENIMIENTO',49,50,NULL,72,1907,4,16,0,0,0,0),(60,'RECLAMACIONES',58,59,NULL,72,563,3,20,0,0,0,0),(61,'VNH',35,36,NULL,73,1297,3,17,0,0,0,0),(63,'VENTAS FRANCIA',62,63,NULL,72,277,2,27,0,0,0,0),(66,'VERDNAMADRID',31,32,NULL,72,163,3,18,0,0,0,0),(68,'COMPLEMENTOS',43,44,NULL,72,617,3,26,1,0,0,0),(69,'VERDNABARNA',33,34,NULL,74,432,3,22,0,0,0,0),(77,'PALETIZADO',18,19,NULL,72,230,4,15,1,0,0,0),(80,'EQUIPO J VALLES',56,57,NULL,72,693,3,4,0,0,0,0),(86,'LIMPIEZA',13,14,NULL,72,599,0,0,0,0,0,0),(89,'COORDINACION',16,17,NULL,0,NULL,NULL,NULL,1,0,0,0),(90,'TRAILER',29,30,NULL,0,NULL,NULL,NULL,0,0,0,0),(91,'ARTIFICIAL',45,46,NULL,0,NULL,NULL,NULL,1,0,0,0),(92,'EQUIPO SILVERIO',54,55,NULL,0,NULL,NULL,NULL,0,0,0,0),(93,'CONFECCION',67,72,NULL,0,NULL,NULL,NULL,0,0,0,0),(94,'EQUIPO J BROCAL',52,53,NULL,0,NULL,NULL,NULL,0,0,1,0); +INSERT INTO `department` VALUES (1,'VERDNATURA',1,78,763,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(22,'COMPRAS',65,66,NULL,72,596,2,5,0,0,1,0,NULL,NULL),(23,'CAMARA',41,42,NULL,72,604,2,6,1,0,0,0,NULL,NULL),(31,'INFORMATICA',11,12,NULL,72,127,3,9,0,0,0,0,NULL,NULL),(34,'CONTABILIDAD',4,5,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(35,'FINANZAS',6,7,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(36,'LABORAL',8,9,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,0,NULL,NULL),(38,'SACADO',20,21,NULL,72,230,4,14,1,0,0,0,NULL,NULL),(39,'ENCAJADO',22,23,NULL,72,230,4,12,1,0,0,0,NULL,NULL),(41,'ADMINISTRACION',3,10,NULL,72,599,3,8,0,0,0,0,NULL,NULL),(43,'VENTAS',51,64,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(44,'GERENCIA',2,25,NULL,72,300,2,7,0,0,0,0,NULL,NULL),(45,'LOGISTICA',26,37,NULL,72,596,3,19,0,0,0,0,NULL,NULL),(46,'REPARTO',38,39,NULL,72,659,3,10,0,0,0,0,NULL,NULL),(48,'ALMACENAJE',40,47,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(49,'PROPIEDAD',48,75,NULL,72,1008,1,1,0,0,0,0,NULL,NULL),(52,'CARGA AEREA',27,28,NULL,72,163,4,28,0,0,0,0,NULL,NULL),(53,'MARKETING Y COMUNICACIÓN',60,61,NULL,72,1238,0,0,0,0,0,0,NULL,NULL),(54,'ORNAMENTALES',76,77,NULL,72,433,3,21,0,0,0,0,NULL,NULL),(55,'TALLER NATURAL',68,69,NULL,72,695,2,23,0,0,0,0,NULL,NULL),(56,'TALLER ARTIFICIAL',70,71,NULL,72,1780,2,24,0,0,0,0,NULL,NULL),(58,'CAMPOS',73,74,NULL,72,225,2,2,0,0,0,0,NULL,NULL),(59,'MANTENIMIENTO',49,50,NULL,72,1907,4,16,0,0,0,0,NULL,NULL),(60,'RECLAMACIONES',58,59,NULL,72,563,3,20,0,0,0,0,NULL,NULL),(61,'VNH',35,36,NULL,73,1297,3,17,0,0,0,0,NULL,NULL),(63,'VENTAS FRANCIA',62,63,NULL,72,277,2,27,0,0,0,0,NULL,NULL),(66,'VERDNAMADRID',31,32,NULL,72,163,3,18,0,0,0,0,NULL,NULL),(68,'COMPLEMENTOS',43,44,NULL,72,617,3,26,1,0,0,0,NULL,NULL),(69,'VERDNABARNA',33,34,NULL,74,432,3,22,0,0,0,0,NULL,NULL),(77,'PALETIZADO',18,19,NULL,72,230,4,15,1,0,0,0,NULL,NULL),(80,'EQUIPO J VALLES',56,57,NULL,72,693,3,4,0,0,0,0,NULL,NULL),(86,'LIMPIEZA',13,14,NULL,72,599,0,0,0,0,0,0,NULL,NULL),(89,'COORDINACION',16,17,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,NULL),(90,'TRAILER',29,30,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(91,'ARTIFICIAL',45,46,NULL,0,NULL,NULL,NULL,1,0,0,0,NULL,NULL),(92,'EQUIPO SILVERIO',54,55,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(93,'CONFECCION',67,72,NULL,0,NULL,NULL,NULL,0,0,0,0,NULL,NULL),(94,'EQUIPO J BROCAL',52,53,NULL,0,NULL,NULL,NULL,0,0,1,0,NULL,NULL); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; - --- --- Dumping data for table `Grupos` --- - -LOCK TABLES `Grupos` WRITE; -/*!40000 ALTER TABLE `Grupos` DISABLE KEYS */; -INSERT INTO `Grupos` VALUES (1,'administrative','Contabilidad',5),(2,'administrator','Administradores',5),(3,'advancedUser','Usuarios avanzados',5),(4,'developer','Informaticos',4),(5,'clientManagement','Gestion Clientes',4),(6,'salesPerson','Comerciales',4),(7,'wages','Salarios',5),(8,'salesPersonDirector','Dir Comercial',4),(9,'advancedSalesPerson','Comercial avanzado',4),(10,'','Compradores',4),(11,'','Control descuentos',4),(12,'takeOrder','Sacador',1),(13,'packer','Encajador',2),(14,' deliveryMan','Repartidor',3),(15,'','No Recalcular',4),(17,'other','Otros',4),(18,'','Operaciones',4),(19,'','Visa',5),(20,'market','Mercado',4),(21,'','Gerencia',5),(22,'','ComercialExclusivo',4),(23,'','Responsables Entradas',5),(24,'teamBoss','Jefes de equipo',4),(25,'','Responsables Encajado',0),(26,'confection','Confeccion',0),(27,'claims','Reclamaciones',0),(28,'','Ranking Carteras Limpias',0),(29,'','No bionicos',0),(30,'','Tirar a Faltas',0),(31,'','Greuges',0),(32,'','Responsables Agencias',0),(33,'','Entradas EXPRESS',0),(34,'','Sustituciones',0),(35,'router','Enrutador',4); -/*!40000 ALTER TABLE `Grupos` ENABLE KEYS */; -UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -378,7 +320,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 USE `bi`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -426,7 +368,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 USE `cache`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -464,7 +406,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 USE `hedera`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -522,7 +464,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 USE `postgresql`; -- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64) -- @@ -577,7 +519,7 @@ UNLOCK TABLES; LOCK TABLES `professional_category` WRITE; /*!40000 ALTER TABLE `professional_category` DISABLE KEYS */; -INSERT INTO `professional_category` VALUES (1,'Mozos',5,1,27.5),(2,'Encargados',3,1,27.5),(4,'Comprador',3,1,27.5),(5,'Aux Administracion',NULL,1,27.5),(6,'Of Administracion',3,1,27.5),(7,'Jefe Administracion',2,1,27.5),(8,'Informatico',3,1,27.5),(9,'Directivo',1,0,27.5),(10,'Aux Ventas',4,1,27.5),(11,'Vendedor',4,1,27.5),(12,'Jefe de Ventas',4,0,27.5),(13,'Repartidor',5,1,27.5),(14,'Aprendices',6,1,27.5),(15,'Técnicos',2,1,27.5),(16,'Aux Florista',5,1,27.5),(17,'Florista',4,1,27.5),(18,'Jefe Floristas',2,1,27.5),(19,'Técnico marketing',3,1,27.5),(20,'Auxiliar marketing',4,1,27.5),(21,'Aux Informática',4,1,27.5),(22,'Peón agrícola',5,1,27.5),(23,'Oficial mantenimiento',4,1,27.5),(24,'Aux mantenimiento',5,1,27.5),(25,'Mozo Aeropuerto',5,1,27.5),(26,'Coordinador',2,1,27.5),(28,'Aux Logistica',4,1,27.5),(29,'Oficial Logistica',3,1,27.5),(30,'Subencargado',4,1,27.5); +INSERT INTO `professional_category` VALUES (1,'Mozos',5,1,27.5),(2,'Encargados',3,1,27.5),(4,'Comprador',3,1,27.5),(5,'Aux Administracion',NULL,1,27.5),(6,'Of Administracion',3,1,27.5),(7,'Jefe Administracion',2,1,27.5),(8,'Informatico',3,1,27.5),(9,'Directivo',1,0,27.5),(10,'Aux Ventas',4,1,27.5),(11,'Vendedor',4,1,27.5),(12,'Jefe de Ventas',4,0,27.5),(13,'Repartidor',5,1,27.5),(14,'Aprendices',NULL,1,27.5),(15,'Técnicos',2,1,27.5),(16,'Aux Florista',5,1,27.5),(17,'Florista',4,1,27.5),(18,'Jefe Floristas',2,1,27.5),(19,'Técnico marketing',3,1,27.5),(20,'Auxiliar marketing',4,1,27.5),(21,'Aux Informática',4,1,27.5),(22,'Peón agrícola',5,1,27.5),(23,'Oficial mantenimiento',4,1,27.5),(24,'Aux mantenimiento',5,1,27.5),(25,'Mozo Aeropuerto',5,1,27.5),(26,'Coordinador',2,1,27.5),(28,'Aux Logistica',4,1,27.5),(29,'Oficial Logistica',3,1,27.5),(30,'Subencargado',4,1,27.5); /*!40000 ALTER TABLE `professional_category` ENABLE KEYS */; UNLOCK TABLES; @@ -610,4 +552,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:03:55 +-- Dump completed on 2019-11-26 14:02:57 diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a7e64baa6..5593c92d0 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -601,16 +601,16 @@ INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `ma VALUES (1, 102, 442, '1-1', CURDATE(), 2); -INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`) +INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code`) VALUES - (1, 'Plant', 1, 'B92A26', 'icon-plant'), - (2, 'Flower', 2, 'dcf711', 'icon-flower'), - (3, 'Logistic', 0, 'b9f711', NULL), - (4, 'Handmade', 1, NULL, 'icon-handmade'), - (5, 'Artificial', 1, NULL, 'icon-artificial'), - (6, 'Green', 1, NULL, 'icon-greenery'), - (7, 'Accessories', 1, NULL, 'icon-accessory'), - (8, 'Fruit', 1, NULL, 'icon-fruit'); + (1, 'Plant', 1, 'B92A26', 'icon-plant', 'plant'), + (2, 'Flower', 2, 'dcf711', 'icon-flower', 'flower'), + (3, 'Logistic', 0, 'b9f711', NULL, 'logistical'), + (4, 'Handmade', 1, NULL, 'icon-handmade', 'handmade'), + (5, 'Artificial', 1, NULL, 'icon-artificial', 'artificial'), + (6, 'Green', 1, NULL, 'icon-greenery', 'greenery'), + (7, 'Accessories', 1, NULL, 'icon-accessory', 'accessory'), + (8, 'Fruit', 1, NULL, 'icon-fruit', 'fruit'); INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`) VALUES @@ -1356,6 +1356,7 @@ INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`) La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets */ + call vn.manaSpellersRequery(19); call vn.manaSpellersRequery(18); @@ -1960,4 +1961,5 @@ INSERT INTO `vn`.`userPhone`(`id`, `userFk`, `typeFk`, `phone`) INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`) VALUES - (1, 43200, 129600, 734400, 43200, 50400); \ No newline at end of file + (1, 43200, 129600, 734400, 43200, 50400); + diff --git a/db/dump/mysqlPlugins.sql b/db/dump/mysqlPlugins.sql index 248eccdac..861db4afe 100644 --- a/db/dump/mysqlPlugins.sql +++ b/db/dump/mysqlPlugins.sql @@ -1,4 +1,3 @@ -USE `vn2008`; -- Import compiled functions CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so'; diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 6cec559c8..9064f8be3 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -365,7 +365,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=16911 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Global users'; +) ENGINE=InnoDB AUTO_INCREMENT=16931 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 */ ; @@ -435,6 +435,7 @@ DELIMITER ;; AFTER UPDATE ON `user` FOR EACH ROW BEGIN +-- bernat: working in this file IF !(NEW.`role` <=> OLD.`role`) THEN INSERT INTO vn2008.mail SET @@ -1446,8 +1447,8 @@ proc: BEGIN t.`Table_name`, t.`Grantor`, MAX(t.`Timestamp`), - GROUP_CONCAT(CONCAT(t.`Table_priv`, ',')), - GROUP_CONCAT(CONCAT(t.`Column_priv`, ',')) + IFNULL(GROUP_CONCAT(NULLIF(t.`Table_priv`, '')), ''), + IFNULL(GROUP_CONCAT(NULLIF(t.`Column_priv`, '')), '') FROM tRoleInherit r JOIN mysql.tables_priv t ON t.`User` = r.inheritsFrom @@ -1472,7 +1473,7 @@ proc: BEGIN t.`Table_name`, t.`Column_name`, MAX(t.`Timestamp`), - GROUP_CONCAT(CONCAT(t.`Column_priv`, ',')) + IFNULL(GROUP_CONCAT(NULLIF(t.`Column_priv`, '')), '') FROM tRoleInherit r JOIN mysql.columns_priv t ON t.`User` = r.inheritsFrom @@ -1977,7 +1978,7 @@ CREATE TABLE `analisis_ventas` ( `Importe` double NOT NULL, PRIMARY KEY (`id`), KEY `Año` (`Año`,`Semana`) -) ENGINE=InnoDB AUTO_INCREMENT=114351518 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=116448638 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5195,7 +5196,7 @@ CREATE TABLE `m3` ( `dayName` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, `euros` decimal(10,2) DEFAULT '0.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=371933 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=376025 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5467,7 +5468,7 @@ CREATE TABLE `payMethodClient` ( KEY `FkDateClientPayMethod` (`dated`,`clientFk`), CONSTRAINT `FkClientPayMethod` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FkPayMethodClient` FOREIGN KEY (`payMethodFk`) REFERENCES `vn`.`payMethod` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=5878906 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=InnoDB AUTO_INCREMENT=5944438 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -5542,7 +5543,7 @@ CREATE TABLE `productivity` ( `m3PCA` double NOT NULL DEFAULT '0', `m3Artificial` decimal(10,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=61480490 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=61988146 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8507,7 +8508,7 @@ CREATE TABLE `cache_calc` ( KEY `cache_id` (`cache_id`), KEY `cacheName` (`cacheName`), KEY `expires` (`expires`) -) ENGINE=InnoDB AUTO_INCREMENT=437616 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=439055 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -8575,7 +8576,7 @@ CREATE TABLE `prod_graphic_source` ( `alert_level` int(11) NOT NULL DEFAULT '0', `Agencia` varchar(45) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2242053 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2254074 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9622,7 +9623,7 @@ CREATE TABLE `deliveryInformation` ( KEY `fgbSupplyResponse_idx2` (`FirstOrderDateTime`), KEY `fgbSupplyResponse_idx3` (`LatestOrderDateTime`), CONSTRAINT `fgbSupplyResponse` FOREIGN KEY (`supplyResponseID`) REFERENCES `supplyResponse` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=24468713 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=24600685 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9680,7 +9681,7 @@ CREATE TABLE `ekt` ( KEY `barcode` (`barcode`), KEY `fec` (`fec`), KEY `putOrderFk` (`putOrderFk`) -) ENGINE=InnoDB AUTO_INCREMENT=1114019 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1117117 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9701,7 +9702,7 @@ CREATE TABLE `exchange` ( KEY `buy_edi_id` (`ektFk`), CONSTRAINT `exchange_ibfk_1` FOREIGN KEY (`mailFk`) REFERENCES `mail` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `exchange_ibfk_2` FOREIGN KEY (`ektFk`) REFERENCES `ekt` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=654679 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=657737 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -9963,7 +9964,7 @@ CREATE TABLE `mail` ( UNIQUE KEY `mail_id` (`messageId`), KEY `sender_id` (`senderFk`), CONSTRAINT `mail_ibfk_2` FOREIGN KEY (`senderFk`) REFERENCES `mailSender` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=684631 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=687834 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10219,7 +10220,7 @@ CREATE TABLE `supplyResponse` ( PRIMARY KEY (`ID`), UNIQUE KEY `ID_UNIQUE` (`ID`), KEY `IX_TransNumber` (`TransactionNumber`) COMMENT 'Agregado por Ernesto 11.6.2019\nSe ejecutaba 1 consulta por segundo desde MAIL y consumia un 20% de CPU de todo el servidor !!!!!\nCPU usada es mas estable que Indice en SendererID, cpu vs espacio que ocupa?\n' -) ENGINE=InnoDB AUTO_INCREMENT=8978690 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=9031147 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -10916,7 +10917,7 @@ CREATE TABLE `image` ( PRIMARY KEY (`id`), UNIQUE KEY `collection` (`collectionFk`,`name`), CONSTRAINT `image_ibfk_1` FOREIGN KEY (`collectionFk`) REFERENCES `imageCollection` (`name`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=172140 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=172959 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -11480,7 +11481,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=13074 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13075 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 */ ; @@ -11597,7 +11598,7 @@ CREATE TABLE `order` ( CONSTRAINT `order_ibfk_5` FOREIGN KEY (`address_id`) REFERENCES `vn`.`address` (`id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_8` FOREIGN KEY (`delivery_method_id`) REFERENCES `vn`.`deliveryMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `order_ibfk_9` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2250839 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2256552 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 */ ; @@ -11716,7 +11717,7 @@ CREATE TABLE `orderRow` ( KEY `warehouse_shipment` (`warehouseFk`,`shipment`), CONSTRAINT `orderRow_ibfk_2` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderRow_ibfk_3` FOREIGN KEY (`orderFk`) REFERENCES `order` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=13486880 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=13524770 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 */ ; @@ -12140,7 +12141,7 @@ CREATE TABLE `tpvTransaction` ( CONSTRAINT `receipt_id` FOREIGN KEY (`receiptFk`) REFERENCES `vn`.`receipt` (`Id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `tpvTransaction_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) 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=373357 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; +) ENGINE=InnoDB AUTO_INCREMENT=374330 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Transactions realized through the virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12175,7 +12176,7 @@ CREATE TABLE `visit` ( PRIMARY KEY (`id`), KEY `firstAgent` (`firstAgentFk`), CONSTRAINT `visit_ibfk_1` FOREIGN KEY (`firstAgentFk`) REFERENCES `visitAgent` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2010274 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2014518 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12195,7 +12196,7 @@ CREATE TABLE `visitAccess` ( KEY `visit_access_idx_agent` (`agentFk`), KEY `stamp` (`stamp`), CONSTRAINT `visitAccess_ibfk_1` FOREIGN KEY (`agentFk`) REFERENCES `visitAgent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4490394 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4501890 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12220,7 +12221,7 @@ CREATE TABLE `visitAgent` ( KEY `firstAccess` (`firstAccessFk`), CONSTRAINT `visitAgent_ibfk_1` FOREIGN KEY (`visitFk`) REFERENCES `visit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `visitAgent_ibfk_2` FOREIGN KEY (`firstAccessFk`) REFERENCES `visitAccess` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2658124 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2663690 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -12240,7 +12241,7 @@ CREATE TABLE `visitUser` ( KEY `date_time` (`stamp`), KEY `user_id` (`userFk`), CONSTRAINT `visitUser_ibfk_1` FOREIGN KEY (`accessFk`) REFERENCES `visitAccess` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3932246 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3941512 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -15978,7 +15979,7 @@ CREATE TABLE `cdr` ( KEY `dstchannel` (`dst_channel`), KEY `disposition` (`disposition`), KEY `src` (`src`) -) ENGINE=InnoDB AUTO_INCREMENT=316511 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=317079 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16865,7 +16866,7 @@ CREATE TABLE `business` ( 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=3018 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=3023 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -16892,7 +16893,7 @@ CREATE TABLE `business_labour` ( KEY `business_labour_department_idx` (`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 `vn2008`.`department` (`department_id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `business_labour_department` FOREIGN KEY (`department_id`) REFERENCES `vn`.`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; @@ -17080,7 +17081,7 @@ CREATE TABLE `income_employee` ( 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=73709 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=74533 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17114,7 +17115,7 @@ CREATE TABLE `journey` ( 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=2630 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=2636 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17150,7 +17151,7 @@ CREATE TABLE `media` ( 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=1167 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=1168 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -17318,7 +17319,7 @@ CREATE TABLE `profile_media` ( 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=1328 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=1329 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -19770,7 +19771,7 @@ CREATE TABLE `XDiario` ( PRIMARY KEY (`id`), KEY `empresa_id` (`empresa_id`), CONSTRAINT `XDiario_ibfk_1` FOREIGN KEY (`empresa_id`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4056438 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4058247 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 */ ; @@ -20014,7 +20015,7 @@ CREATE TABLE `address` ( CONSTRAINT `address_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `address_ibfk_3` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, CONSTRAINT `address_ibfk_4` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=29637 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=29673 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 */ ; @@ -20134,7 +20135,7 @@ CREATE TABLE `addressObservation` ( KEY `addressObservationFgn_idx` (`observationTypeFk`), CONSTRAINT `addressFgn` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `addressObservationFgn` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4201 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; +) ENGINE=InnoDB AUTO_INCREMENT=4212 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de los consignatarios'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20154,15 +20155,18 @@ CREATE TABLE `agency` ( `isOwn` tinyint(1) NOT NULL DEFAULT '0', `labelZone` tinyint(4) NOT NULL DEFAULT '0', `workCenterFk` int(11) DEFAULT NULL, + `supplierFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `warehouse_id` (`warehouseFk`), KEY `Id_Banco` (`bankFk`), KEY `agencias_alias_idx` (`warehouseAliasFk`), KEY `agency_ibfk_3_idx` (`workCenterFk`), + KEY `agency_ibfk_4_idx` (`supplierFk`), CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, - CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=284 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE, + CONSTRAINT `agency_ibfk_4` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=285 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 */ ; @@ -20211,7 +20215,7 @@ CREATE TABLE `agencyMode` ( PRIMARY KEY (`id`), KEY `Agencias` (`name`), KEY `Vista` (`deliveryMethodFk`) -) ENGINE=InnoDB AUTO_INCREMENT=1238 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1239 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20342,7 +20346,7 @@ CREATE TABLE `autoRadioLogCall` ( PRIMARY KEY (`id`), KEY `ticket_idx` (`ticketFk`), CONSTRAINT `ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=1774 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1813 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20439,7 +20443,7 @@ CREATE TABLE `bankEntity` ( UNIQUE KEY `bic_UNIQUE` (`bic`), KEY `fg_entity1_idx` (`countryFk`), CONSTRAINT `fg_entity1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=30051 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; +) ENGINE=InnoDB AUTO_INCREMENT=30053 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Entidades bancarias '; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20487,14 +20491,55 @@ CREATE TABLE `bookingPlanner` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `botanicExport` +-- Table structure for table `botanicExport` -- DROP TABLE IF EXISTS `botanicExport`; -/*!50001 DROP VIEW IF EXISTS `botanicExport`*/; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `botanicExport` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ediGenusFk` mediumint(8) unsigned NOT NULL, + `ediSpecieFk` mediumint(8) unsigned DEFAULT NULL, + `countryFk` 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, + `isProtectedZone` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `Id_Paises` (`countryFk`), + CONSTRAINT `botanicExport_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) +) 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 */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`botanicExport_beforeInsert` BEFORE INSERT ON `botanicExport` FOR EACH ROW +BEGIN + IF (SELECT botanicExport_isUpdatable (NEW.ediGenusFk, NEW.ediSpecieFk, NEW.countryFk, NEW.restriction) ) > 0 THEN + CALL util.throw ('Datos duplicados'); + 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 */ ; + +-- +-- Temporary table structure for view `botanicExport__` +-- + +DROP TABLE IF EXISTS `botanicExport__`; +/*!50001 DROP VIEW IF EXISTS `botanicExport__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `botanicExport` AS SELECT +/*!50001 CREATE VIEW `botanicExport__` AS SELECT 1 AS `id`, 1 AS `ediGenusFk`, 1 AS `ediSpecieFk`, @@ -20538,7 +20583,7 @@ CREATE TABLE `buy` ( `packing` int(11) DEFAULT '0', `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', `groupingMode` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=sin obligar 1=groping 2=packing', - `containerFk` smallint(5) unsigned NOT NULL DEFAULT '36', + `containerFk` smallint(5) unsigned DEFAULT NULL, `comissionValue` decimal(10,3) DEFAULT '0.000', `packageValue` decimal(10,3) DEFAULT '0.000', `location` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -20565,10 +20610,9 @@ CREATE TABLE `buy` ( KEY `itemFk_entryFk` (`itemFk`,`entryFk`), CONSTRAINT `buy_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, CONSTRAINT `buy_ibfk_2` FOREIGN KEY (`packageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, - CONSTRAINT `buy_ibfk_3` FOREIGN KEY (`containerFk`) REFERENCES `vn2008`.`container` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_id` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `buy_itemfk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=352935419 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=353938422 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 */ ; @@ -20878,7 +20922,7 @@ CREATE TABLE `claim` ( CONSTRAINT `claim_ibfk_3` FOREIGN KEY (`claimStateFk`) REFERENCES `claimState` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_4` FOREIGN KEY (`claimDepartmentFk`) REFERENCES `vn2008`.`cl_dep` (`id`) ON UPDATE CASCADE, CONSTRAINT `claim_ibfk_5` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=71629 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; +) ENGINE=InnoDB AUTO_INCREMENT=71766 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Reclamaciones, tabla principal'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -20900,7 +20944,7 @@ CREATE TABLE `claimBeginning` ( KEY `cl_main_id` (`claimFk`), CONSTRAINT `claimBeginning_ibfk_7` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimBeginning_ibfk_8` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=157151 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=157378 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 */ ; @@ -20979,7 +21023,7 @@ CREATE TABLE `claimDevelopment` ( CONSTRAINT `claimDevelopment_ibfk_7` FOREIGN KEY (`claimReasonFk`) REFERENCES `claimReason` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimDevelopment_ibfk_8` FOREIGN KEY (`claimResultFk`) REFERENCES `claimResult` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimDevelopment_ibfk_9` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=61481 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=61558 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Causas de las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21021,7 +21065,7 @@ CREATE TABLE `claimEnd` ( CONSTRAINT `claimEnd_ibfk_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimEnd_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `claimEnd_ibfk_4` FOREIGN KEY (`claimFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=119913 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; +) ENGINE=InnoDB AUTO_INCREMENT=120088 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Acciones en respuesta a las reclamaciones'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21048,7 +21092,7 @@ CREATE TABLE `claimLog` ( KEY `userFk` (`userFk`), CONSTRAINT `claimOriginFk` FOREIGN KEY (`originFk`) REFERENCES `claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `claimUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=6759 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7015 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21237,7 +21281,7 @@ CREATE TABLE `client` ( CONSTRAINT `client_ibfk_5` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, CONSTRAINT `tipos_de_cliente` FOREIGN KEY (`clientTypeFk`) REFERENCES `clientType` (`id`) ON UPDATE CASCADE, CONSTRAINT `typeFk` FOREIGN KEY (`typeFk`) REFERENCES `clientType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=16911 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16931 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 */ ; @@ -21407,7 +21451,7 @@ CREATE TABLE `clientCredit` ( KEY `credit_ClienteFk` (`clientFk`), CONSTRAINT `credit_ClienteFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `workers_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=85211 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=85324 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21483,7 +21527,7 @@ CREATE TABLE `clientLog` ( KEY `userFk` (`userFk`), CONSTRAINT `clientLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) 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=240552 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=241048 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21518,7 +21562,7 @@ CREATE TABLE `clientObservation` ( KEY `Id_Cliente` (`clientFk`), CONSTRAINT `clientObservation_ibfk_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `clientObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=78820 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=78885 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -21613,7 +21657,7 @@ CREATE TABLE `clientSample` ( PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), CONSTRAINT `clientSample_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=18552 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=18566 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -21633,6 +21677,67 @@ CREATE TABLE `clientType` ( ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Establece categorias para poder agrupar las ventas'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `cmr` +-- + +DROP TABLE IF EXISTS `cmr`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cmr` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL, + `truckPlate` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `observations` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `senderInstruccions` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Flowers 4º C. Plants 14º C', + `paymentInstruccions` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Carriage paid', + `specialAgreements` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `cmr_fk1_idx` (`ticketFk`), + CONSTRAINT `cmr_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `cmr_list` +-- + +DROP TABLE IF EXISTS `cmr_list`; +/*!50001 DROP VIEW IF EXISTS `cmr_list`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `cmr_list` AS SELECT + 1 AS `cmrFk`, + 1 AS `ticketFk`, + 1 AS `truckPlate`, + 1 AS `observations`, + 1 AS `senderInstruccions`, + 1 AS `paymentInstruccions`, + 1 AS `specialAgreements`, + 1 AS `created`, + 1 AS `addressFk`, + 1 AS `shipped`, + 1 AS `clientName`, + 1 AS `clientPostalCode`, + 1 AS `clientStreet`, + 1 AS `clientCity`, + 1 AS `clientProvince`, + 1 AS `clientCountry`, + 1 AS `companyName`, + 1 AS `companyStreet`, + 1 AS `companyPostCode`, + 1 AS `companyCity`, + 1 AS `companyCountry`, + 1 AS `warehouseAddress`, + 1 AS `clientOficialName`, + 1 AS `carrierName`, + 1 AS `carrierStreet`, + 1 AS `carrierPostCode`, + 1 AS `carrierCity`, + 1 AS `carrierCountry`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `color` -- @@ -22334,23 +22439,95 @@ CREATE TABLE `delivery_zip` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `department` +-- Table structure for table `department` -- DROP TABLE IF EXISTS `department`; -/*!50001 DROP VIEW IF EXISTS `department`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `department` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `isProduction`, - 1 AS `lft`, - 1 AS `rgt`, - 1 AS `isSelected`, - 1 AS `depth`, - 1 AS `sons`*/; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `department` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `lft` int(11) DEFAULT NULL, + `rgt` int(11) DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL COMMENT 'Id_Trabajador es el jefe del departamento', + `companyFk` int(11) NOT NULL, + `bossFk` int(11) DEFAULT NULL, + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL, + `isProduction` tinyint(4) NOT NULL DEFAULT '0', + `isSelected` tinyint(1) NOT NULL DEFAULT '0', + `depth` int(11) NOT NULL DEFAULT '0', + `sons` decimal(10,0) NOT NULL DEFAULT '0', + `parentFk` int(10) unsigned DEFAULT NULL, + `path` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`), + KEY `fk_department_Trabajadores1_idx` (`workerFk`), + KEY `dep_org_ibfk_3_idx` (`companyFk`), + KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), + CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=95 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`department_beforeInsert` + BEFORE INSERT ON `department` FOR EACH ROW +BEGIN + UPDATE vn.department_recalc SET isChanged = TRUE; +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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`department_afterUpdate` + AFTER UPDATE ON `department` FOR EACH ROW +BEGIN + IF !(OLD.parentFk <=> NEW.parentFk) THEN + UPDATE vn.department_recalc SET isChanged = TRUE; + 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 */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vn`.`department_afterDelete` + AFTER DELETE ON `department` FOR EACH ROW +BEGIN + UPDATE vn.department_recalc SET isChanged = TRUE; +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 */ ; -- -- Temporary table structure for view `departmentTree` @@ -22365,6 +22542,39 @@ SET character_set_client = utf8; 1 AS `dep`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `department__` +-- + +DROP TABLE IF EXISTS `department__`; +/*!50001 DROP VIEW IF EXISTS `department__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `department__` AS SELECT + 1 AS `id`, + 1 AS `name`, + 1 AS `isProduction`, + 1 AS `lft`, + 1 AS `rgt`, + 1 AS `isSelected`, + 1 AS `depth`, + 1 AS `sons`*/; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `department_recalc` +-- + +DROP TABLE IF EXISTS `department_recalc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `department_recalc` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `isChanged` tinyint(4) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `device` -- @@ -22380,7 +22590,7 @@ CREATE TABLE `device` ( PRIMARY KEY (`id`), KEY `device_fk1_idx` (`userFk`), CONSTRAINT `device_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=368 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=369 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22403,7 +22613,7 @@ CREATE TABLE `deviceProduction` ( UNIQUE KEY `sn_UNIQUE` (`imei`), KEY `deviceProductionModelsFgn` (`modelFk`), KEY `departmentFgn` (`departmentFk`), - CONSTRAINT `departmentFgn` FOREIGN KEY (`departmentFk`) REFERENCES `vn2008`.`department` (`department_id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `departmentFgn` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `deviceProductionModelsFgn` FOREIGN KEY (`modelFk`) REFERENCES `deviceProductionModels` (`code`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=378 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -22462,7 +22672,7 @@ CREATE TABLE `dms` ( UNIQUE KEY `emp_id` (`companyFk`,`hardCopyNumber`,`warehouseFk`), KEY `trabajador_id` (`workerFk`), KEY `warehouse_id` (`warehouseFk`) -) ENGINE=InnoDB AUTO_INCREMENT=1390561 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='document managment system'; +) ENGINE=InnoDB AUTO_INCREMENT=1393431 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 */ ; @@ -22609,7 +22819,7 @@ CREATE TABLE `dua` ( CONSTRAINT `dua_fk1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`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 `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=4315 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=4316 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22650,7 +22860,7 @@ CREATE TABLE `duaIntrastat` ( KEY `duaIntrastat_fk2_idx` (`duaFk`), CONSTRAINT `duaIntrastat_fk1` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaIntrastat_fk2` FOREIGN KEY (`duaFk`) REFERENCES `dua` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=7197 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=7228 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22670,7 +22880,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=5275 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=5285 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 */; -- @@ -22695,7 +22905,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 `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `duaTax_fk3` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=10188 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=10413 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -22831,7 +23041,7 @@ CREATE TABLE `entry` ( CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE, CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=182273 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee'; +) ENGINE=InnoDB AUTO_INCREMENT=182508 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 */ ; @@ -22847,7 +23057,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); - SET NEW.commission = entry_calcCommission(NEW.commission, NEW.travelFk, NEW.currencyFk); + SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -22887,6 +23097,7 @@ DELIMITER ;; BEFORE UPDATE ON `entry` FOR EACH ROW BEGIN + -- Bernat: working in this file DECLARE vIsClone BOOL; DECLARE vPrintedCount INT; DECLARE vHasDistinctWarehouses BOOL; @@ -23032,7 +23243,7 @@ CREATE TABLE `entryLog` ( KEY `entryLog_ibfk_2` (`userFk`), CONSTRAINT `entryLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `entryLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=177841 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=178476 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23052,6 +23263,20 @@ CREATE TABLE `entrySplit` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `entryVirtual` +-- + +DROP TABLE IF EXISTS `entryVirtual`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `entryVirtual` ( + `entryFk` int(11) NOT NULL, + PRIMARY KEY (`entryFk`), + CONSTRAINT `entryVirtual_ibfk_1` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='entradas que se van moviendo automaticamente al futuro'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `envialiaAgency` -- @@ -23279,7 +23504,7 @@ CREATE TABLE `expedition` ( KEY `index4` (`ticketFk`), CONSTRAINT `Id_Agencia` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3427320 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3435040 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 */ ; @@ -23521,7 +23746,7 @@ CREATE TABLE `greuge` ( KEY `Greuges_cliente_idx` (`clientFk`), CONSTRAINT `Id_Ticket_Greuge_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `greuges_type_fk` FOREIGN KEY (`greugeTypeFk`) REFERENCES `greugeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3813072 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; +) ENGINE=InnoDB AUTO_INCREMENT=3818995 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -23710,7 +23935,7 @@ CREATE TABLE `inventoryFailure` ( CONSTRAINT `inventoryFailure_fk3` FOREIGN KEY (`guiltyFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk4` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inventoryFailure_fk5` FOREIGN KEY (`causeFk`) REFERENCES `inventoryFailureCause` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=27484 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=27737 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -23988,7 +24213,7 @@ CREATE TABLE `invoiceOut` ( CONSTRAINT `invoiceOut_ibfk_4` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_bank_id` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `invoice_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=521544 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=521586 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 */ ; @@ -24114,7 +24339,7 @@ CREATE TABLE `invoiceOutExpence` ( KEY `invoiceOutExpence_FK_2_idx` (`expenceFk`), CONSTRAINT `invoiceOutExpence_FK_1` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutExpence_FK_2` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=135713 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=135755 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 */; -- @@ -24157,7 +24382,7 @@ CREATE TABLE `invoiceOutTax` ( KEY `pgcFk` (`pgcFk`), CONSTRAINT `invoiceOutFk` FOREIGN KEY (`invoiceOutFk`) REFERENCES `invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `invoiceOutTax_ibfk_1` FOREIGN KEY (`pgcFk`) REFERENCES `pgc` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1177139 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1177193 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24236,7 +24461,7 @@ CREATE TABLE `item` ( CONSTRAINT `item_ibfk_5` FOREIGN KEY (`typeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_ibfk_6` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `producer_id` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=376655 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=377283 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 */ ; @@ -24363,7 +24588,7 @@ CREATE TABLE `itemBarcode` ( UNIQUE KEY `Id_Article_2` (`itemFk`,`code`), KEY `Id_Article` (`itemFk`), CONSTRAINT `itemBarcode_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=42941 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=42954 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24455,6 +24680,7 @@ CREATE TABLE `itemCategory` ( `shortLife` int(11) NOT NULL DEFAULT '0' COMMENT 'Sirve para filtrar aquellos reinos que tienen precios estables', `merchandise` tinyint(1) NOT NULL DEFAULT '1', `icon` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `reino_UNIQUE` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -24542,7 +24768,7 @@ CREATE TABLE `itemLog` ( KEY `itemLogUserFk_idx` (`userFk`), CONSTRAINT `itemLogItemFk` FOREIGN KEY (`originFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=100471 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=101201 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24569,7 +24795,7 @@ CREATE TABLE `itemPlacement` ( CONSTRAINT `Articles_nicho_wh_fk` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Articles_nichos_fk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemPlacement_fk3` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1161732 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1165960 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 */ ; @@ -24619,7 +24845,7 @@ CREATE TABLE `itemPlacementSupply` ( 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, CONSTRAINT `itemPlacementSupply_fk4` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=81151 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de nichos de picking que hay que reponer'; +) ENGINE=InnoDB AUTO_INCREMENT=82206 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 */; -- @@ -24720,7 +24946,7 @@ CREATE TABLE `itemShelving` ( CONSTRAINT `itemShelving_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) 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 `packaging` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=140021 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=142377 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 */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -24837,7 +25063,7 @@ CREATE TABLE `itemShelvingPlacementSupply` ( KEY `itemShelvingPlacementSupply_fk3_idx` (`userFk`), CONSTRAINT `itemShelvingPlacementSupply_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingPlacementSupply_fk2` FOREIGN KEY (`itemPlacementSupplyFk`) REFERENCES `itemPlacementSupply` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=75979 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; +) ENGINE=InnoDB AUTO_INCREMENT=76984 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle de los itemShelving afectados por las ordenes de reposicion de nicho'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -24909,7 +25135,7 @@ CREATE TABLE `itemShelvingSale` ( CONSTRAINT `itemShelvingSale_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingSale_fk2` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemShelvingSale_fk3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=42969 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; +) ENGINE=InnoDB AUTO_INCREMENT=44728 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -25036,7 +25262,7 @@ CREATE TABLE `itemTag` ( KEY `itemFk_2` (`itemFk`,`tagFk`,`intValue`), CONSTRAINT `itemTagItemFk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `itemTagTagFk` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1401486 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1406163 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 */ ; @@ -25180,7 +25406,7 @@ CREATE TABLE `itemTaxCountry` ( CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=889642 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la clase de iva por artículo y pais'; +) ENGINE=InnoDB AUTO_INCREMENT=893524 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 */; -- @@ -25372,27 +25598,30 @@ CREATE TABLE `labourTree` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `mail` +-- Table structure for table `mail` -- DROP TABLE IF EXISTS `mail`; -/*!50001 DROP VIEW IF EXISTS `mail`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `mail` AS SELECT - 1 AS `id`, - 1 AS `senderFk`, - 1 AS `recipientFk`, - 1 AS `sender`, - 1 AS `replyTo`, - 1 AS `subject`, - 1 AS `body`, - 1 AS `plainTextBody`, - 1 AS `attachment`, - 1 AS `creationDate`, - 1 AS `sent`, - 1 AS `status`*/; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mail` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `sender` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `replyTo` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `body` text COLLATE utf8_unicode_ci NOT NULL, + `sent` tinyint(2) NOT NULL DEFAULT '0', + `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `attachment` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'OK', + `senderFk` int(11) DEFAULT NULL, + `recipientFk` int(11) DEFAULT NULL, + `plainTextBody` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + KEY `sent_idx` (`sent`), + KEY `creation_idx` (`creationDate`) +) ENGINE=InnoDB AUTO_INCREMENT=1943960 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `mailTemplates` @@ -25409,6 +25638,29 @@ CREATE TABLE `mailTemplates` ( ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `mail__` +-- + +DROP TABLE IF EXISTS `mail__`; +/*!50001 DROP VIEW IF EXISTS `mail__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `mail__` AS SELECT + 1 AS `id`, + 1 AS `senderFk`, + 1 AS `recipientFk`, + 1 AS `sender`, + 1 AS `replyTo`, + 1 AS `subject`, + 1 AS `body`, + 1 AS `plainTextBody`, + 1 AS `attachment`, + 1 AS `creationDate`, + 1 AS `sent`, + 1 AS `status`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `manaSpellers` -- @@ -25450,7 +25702,7 @@ CREATE TABLE `mandate` ( CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`mandateTypeFk`) REFERENCES `mandateType` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=17284 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=17292 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 */ ; @@ -25565,7 +25817,7 @@ CREATE TABLE `message` ( KEY `sender` (`sender`), KEY `recipient` (`recipient`), KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDB AUTO_INCREMENT=2058232 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2060962 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25587,7 +25839,7 @@ CREATE TABLE `messageInbox` ( PRIMARY KEY (`id`), KEY `uuid` (`uuid`(8)), KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDB AUTO_INCREMENT=2234108 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2236964 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25776,7 +26028,7 @@ CREATE TABLE `packageChecked` ( PRIMARY KEY (`id`), UNIQUE KEY `entryFk_UNIQUE` (`itemFk`), KEY `fkItem_idx` (`itemFk`) -) ENGINE=InnoDB AUTO_INCREMENT=3245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3278 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -25858,7 +26110,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=27701 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; +) ENGINE=InnoDB AUTO_INCREMENT=27750 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 */ ; @@ -26432,7 +26684,7 @@ CREATE TABLE `producer` ( `isVisible` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB AUTO_INCREMENT=14598 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=14735 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -26721,7 +26973,7 @@ CREATE TABLE `receipt` ( CONSTRAINT `receipt_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `receipt_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `recibo_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=610161 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=610741 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 */ ; @@ -26797,18 +27049,35 @@ CREATE TABLE `recovery` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `referenceRate` +-- Table structure for table `referenceCurrent` +-- + +DROP TABLE IF EXISTS `referenceCurrent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `referenceCurrent` ( + `dated` date NOT NULL, + `value` decimal(10,4) NOT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`dated`,`currencyFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `referenceRate` -- DROP TABLE IF EXISTS `referenceRate`; -/*!50001 DROP VIEW IF EXISTS `referenceRate`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `referenceRate` AS SELECT - 1 AS `currencyFk`, - 1 AS `dated`, - 1 AS `value`*/; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `referenceRate` ( + `currencyFk` tinyint(3) unsigned NOT NULL, + `dated` date NOT NULL, + `value` float unsigned NOT NULL, + PRIMARY KEY (`currencyFk`,`dated`), + KEY `date` (`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `referenceRateConfig` @@ -26823,6 +27092,20 @@ CREATE TABLE `referenceRateConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Temporary table structure for view `referenceRate__` +-- + +DROP TABLE IF EXISTS `referenceRate__`; +/*!50001 DROP VIEW IF EXISTS `referenceRate__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `referenceRate__` AS SELECT + 1 AS `currencyFk`, + 1 AS `dated`, + 1 AS `value`*/; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `role` -- @@ -26868,7 +27151,7 @@ CREATE TABLE `route` ( KEY `route_ibfk_2_idx` (`workerFk`), CONSTRAINT `route_ibfk_1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `route_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=60184 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=60412 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 */ ; @@ -26959,7 +27242,7 @@ CREATE TABLE `routeComplement` ( 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 `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1065 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1079 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27062,7 +27345,7 @@ CREATE TABLE `routeLog` ( KEY `userFk` (`userFk`), CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=199066 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=204410 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27147,7 +27430,7 @@ CREATE TABLE `sale` ( KEY `itemFk_ticketFk` (`itemFk`,`ticketFk`), CONSTRAINT `movement_ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `sale_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=26428481 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=26463149 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 */ ; @@ -27360,7 +27643,7 @@ CREATE TABLE `saleTracking` ( KEY `fgnStateFk_idx` (`stateFk`), KEY `saleTracking_idx5` (`created`), CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=21058887 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=21145269 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 */ ; @@ -27494,7 +27777,7 @@ CREATE TABLE `sharingCart` ( KEY `Suplent` (`workerSubstitute`), CONSTRAINT `Suplent_key` FOREIGN KEY (`workerSubstitute`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `Trabajador_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2226 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2230 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 */ ; @@ -27670,7 +27953,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=155507 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=155825 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27840,7 +28123,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=850233 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=852209 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27903,7 +28186,7 @@ CREATE TABLE `supplier` ( CONSTRAINT `pay_dem_id` FOREIGN KEY (`payDemFk`) REFERENCES `payDem` (`id`) ON UPDATE CASCADE, CONSTRAINT `pay_met_id` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2961 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2964 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27928,7 +28211,38 @@ CREATE TABLE `supplierAccount` ( KEY `fk_proveedores_proveedores_account_idx` (`supplierFk`), KEY `fk_Proveedores_account_entity1_idx` (`bankEntityFk`), KEY `fk_banco_prov_account_idx` (`bankFk`) -) ENGINE=InnoDB AUTO_INCREMENT=880 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=883 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplierExpense` +-- + +DROP TABLE IF EXISTS `supplierExpense`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierExpense` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `supplierFk` int(11) NOT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '2', + `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `description` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `dmsFk` int(11) DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `empresa_id` (`companyFk`), + KEY `supplierExDated` (`dated`), + KEY `id_moneda` (`currencyFk`), + KEY `proveedor_pago` (`supplierFk`), + KEY `gestdoc_id` (`dmsFk`), + CONSTRAINT `gestdoc_fk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `proveedor_pago` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -27979,7 +28293,7 @@ CREATE TABLE `tabletDepartment` ( `departmentFk` int(11) NOT NULL, PRIMARY KEY (`tabletFk`,`departmentFk`), KEY `departmentFk_idx` (`departmentFk`), - CONSTRAINT `departmentFk` FOREIGN KEY (`departmentFk`) REFERENCES `vn2008`.`department` (`department_id`) ON DELETE NO ACTION ON UPDATE NO ACTION + CONSTRAINT `departmentFk` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28202,7 +28516,7 @@ CREATE TABLE `ticket` ( CONSTRAINT `ticket_ibfk_9` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON UPDATE CASCADE, CONSTRAINT `tickets_fk10` FOREIGN KEY (`refFk`) REFERENCES `invoiceOut` (`ref`) ON UPDATE CASCADE, CONSTRAINT `tickets_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2486860 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2491069 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 */ ; @@ -28440,6 +28754,24 @@ SET character_set_client = utf8; 1 AS `volume`*/; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `ticketLastState` +-- + +DROP TABLE IF EXISTS `ticketLastState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketLastState` ( + `ticketFk` int(11) NOT NULL DEFAULT '0', + `ticketTrackingFk` int(11) NOT NULL, + `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`ticketFk`), + KEY `double_foreign` (`ticketFk`,`ticketTrackingFk`), + CONSTRAINT `Id_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `double_foreign` FOREIGN KEY (`ticketFk`, `ticketTrackingFk`) REFERENCES `vncontrol`.`inter` (`Id_Ticket`, `inter_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 `ticketLog` -- @@ -28464,7 +28796,7 @@ CREATE TABLE `ticketLog` ( KEY `logTicketuserFk` (`userFk`), CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) 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=8133058 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=8169245 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28501,7 +28833,7 @@ CREATE TABLE `ticketObservation` ( KEY `observation_type_id` (`observationTypeFk`), CONSTRAINT `ticketObservation_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketObservation_ibfk_2` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=1511555 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; +) ENGINE=InnoDB AUTO_INCREMENT=1514145 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Todas las observaciones referentes a un ticket'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28556,7 +28888,7 @@ CREATE TABLE `ticketPackaging` ( CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticketPackaging_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=77465 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=77765 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 */ ; @@ -28619,7 +28951,7 @@ CREATE TABLE `ticketParking` ( KEY `ticketParking_fk1_idx` (`parkingFk`), CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE, CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12101 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; +) ENGINE=InnoDB AUTO_INCREMENT=13171 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -28685,7 +29017,7 @@ CREATE TABLE `ticketRequest` ( CONSTRAINT `fgnAtender` FOREIGN KEY (`atenderFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=52166 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=52240 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 */ ; @@ -29192,7 +29524,7 @@ CREATE TABLE `travel` ( CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `travel_ibfk_4` FOREIGN KEY (`cargoSupplierFk`) REFERENCES `vn2008`.`Proveedores_cargueras` (`Id_Proveedor`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=142170 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=142278 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 */ ; @@ -29254,7 +29586,7 @@ BEGIN IF !(NEW.shipped <=> OLD.shipped) THEN UPDATE entry - SET commission = entry_calcCommission(commission, travelFk, currencyFk) + SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; @@ -29530,14 +29862,28 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; -- --- Temporary table structure for view `warehouseAlias` +-- Table structure for table `warehouseAlias` -- DROP TABLE IF EXISTS `warehouseAlias`; -/*!50001 DROP VIEW IF EXISTS `warehouseAlias`*/; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `warehouseAlias` ( + `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `warehouseAlias__` +-- + +DROP TABLE IF EXISTS `warehouseAlias__`; +/*!50001 DROP VIEW IF EXISTS `warehouseAlias__`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouseAlias` AS SELECT +/*!50001 CREATE VIEW `warehouseAlias__` AS SELECT 1 AS `id`, 1 AS `name`*/; SET character_set_client = @saved_cs_client; @@ -29778,7 +30124,7 @@ CREATE TABLE `workerDocument` ( KEY `workerDocument_ibfk_2` (`document`), CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `worker` (`userFk`) ON UPDATE CASCADE, CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `dms` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=12909 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=12921 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29843,7 +30189,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=63451451 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=64109850 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29882,7 +30228,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 `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=16031 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=16074 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -29899,18 +30245,22 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `workerTeam` +-- Table structure for table `workerTeam` -- DROP TABLE IF EXISTS `workerTeam`; -/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerTeam` AS SELECT - 1 AS `team`, - 1 AS `id`, - 1 AS `workerFk`*/; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTeam` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `team` int(11) NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `user_idx` (`workerFk`), + KEY `team_idx` (`team`), + CONSTRAINT `user_team` FOREIGN KEY (`workerFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=256 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Temporary table structure for view `workerTeamCollegues` @@ -29925,6 +30275,20 @@ SET character_set_client = utf8; 1 AS `collegueFk`*/; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `workerTeam__` +-- + +DROP TABLE IF EXISTS `workerTeam__`; +/*!50001 DROP VIEW IF EXISTS `workerTeam__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `workerTeam__` AS SELECT + 1 AS `team`, + 1 AS `id`, + 1 AS `workerFk`*/; +SET character_set_client = @saved_cs_client; + -- -- Table structure for table `workerTimeControl` -- @@ -29945,7 +30309,7 @@ CREATE TABLE `workerTimeControl` ( KEY `warehouseFkfk1_idx` (`warehouseFk`), CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=8298717 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +) ENGINE=InnoDB AUTO_INCREMENT=8300950 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30285,7 +30649,7 @@ CREATE TABLE `zone` ( KEY `zone_name_idx` (`name`), CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=464 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=466 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -30792,6 +31156,34 @@ BEGIN RETURN vCost; +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 FUNCTION IF EXISTS `botanicExport_isUpdatable` */; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`%` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,vEdiSpecieFk MEDIUMINT, + vCountryFk MEDIUMINT,vRestriction MEDIUMINT) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vIsUpdatable INTEGER; + SELECT COUNT(*) INTO vIsUpdatable + FROM botanicExport + WHERE ediGenusFk = vEdiGenusFk + AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL) + AND (vCountryFk = countryFk OR IFNULL(vCountryFk,countryFk) IS NULL) + AND vRestriction = restriction; +RETURN vIsUpdatable; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -31555,7 +31947,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 FUNCTION IF EXISTS `entry_calcCommission` */; +/*!50003 DROP FUNCTION IF EXISTS `entry_calcCommission__` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -31565,13 +31957,14 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` FUNCTION `entry_calcCommission`( +CREATE DEFINER=`root`@`%` FUNCTION `entry_calcCommission__`( vCurrentCommission INT, vTravelFk INT, vCurrencyFk INT ) RETURNS int(11) READS SQL DATA BEGIN + -- DEPRECATED: use entry_getComission DECLARE vCommission INT; IF vCurrencyFk != 2 /* Dollar */ THEN @@ -31612,6 +32005,7 @@ CREATE DEFINER=`root`@`%` FUNCTION `entry_getCommission`( ) RETURNS int(11) READS SQL DATA BEGIN + -- bernat: working in this file DECLARE vCommission INT; DECLARE vCurrentCommission INT; DECLARE vIsCurrencyUsd INT; @@ -38563,15 +38957,15 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `invoiceOutBooking`(IN vInvoice INT) BEGIN - +-- bernat: working in this file /* Asienta la factura emitida * * param vInvoice factura_id @@ -45272,7 +45666,7 @@ proc: BEGIN (PRIMARY KEY (saleFk)) ENGINE = MEMORY SELECT vSale saleFk,vWarehouseFk warehouseFk; - CALL ticketComponentUpdateSale(6); + CALL ticketComponentUpdateSale(1); INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); @@ -52169,7 +52563,7 @@ CREATE TABLE `Cajas` ( KEY `fk_Cajas_Proveedores_account1_idx` (`Proveedores_account_Id`), CONSTRAINT `Cajas_ibfk_2` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`bank` (`id`) ON UPDATE CASCADE, CONSTRAINT `Cajas_ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=744021 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=745236 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 */ ; @@ -52422,7 +52816,7 @@ CREATE TABLE `Colas` ( KEY `Id_Trabajador` (`Id_Trabajador`), CONSTRAINT `Colas_ibfk_3` FOREIGN KEY (`Id_Prioridad`) REFERENCES `vn`.`queuePriority` (`id`) ON UPDATE CASCADE, CONSTRAINT `Colas_ibfk_4` FOREIGN KEY (`Id_Impresora`) REFERENCES `Impresoras` (`Id_Impresora`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=24898 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=31995 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -52619,7 +53013,7 @@ CREATE TABLE `Contactos` ( PRIMARY KEY (`Id_Contacto`), KEY `Telefono` (`Telefono`), KEY `Movil` (`Movil`) -) ENGINE=InnoDB AUTO_INCREMENT=2763 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2766 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 */ ; @@ -52808,18 +53202,16 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Entradas_Auto` +-- Temporary table structure for view `Entradas_Auto` -- DROP TABLE IF EXISTS `Entradas_Auto`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_Auto` ( - `Id_Entrada` int(11) NOT NULL, - PRIMARY KEY (`Id_Entrada`), - CONSTRAINT `Entradas_Auto_ibfk_1` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Entradas_Auto`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Entradas_Auto` AS SELECT + 1 AS `Id_Entrada`*/; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `Entradas_dits` @@ -52843,7 +53235,7 @@ CREATE TABLE `Entradas_dits` ( CONSTRAINT `Entradas_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`entry` (`id`) 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 `vn`.`worker` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3991901 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3997830 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -52861,7 +53253,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 `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=119 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB AUTO_INCREMENT=152 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -53743,7 +54135,7 @@ CREATE TABLE `Relaciones` ( KEY `Id_Contacto` (`Id_Contacto`), KEY `Id_Proveedor` (`Id_Proveedor`), KEY `Id_Cliente` (`Id_Cliente`) -) ENGINE=InnoDB AUTO_INCREMENT=2766 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=2769 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -53788,7 +54180,7 @@ CREATE TABLE `Reservas` ( PRIMARY KEY (`Id_Reserva`), KEY `Id_1` (`Id_Ticket`), KEY `Id_Article` (`Id_Article`) -) ENGINE=InnoDB AUTO_INCREMENT=289 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=396 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -53972,7 +54364,7 @@ CREATE TABLE `Split_lines` ( KEY `Id_Compra` (`Id_Compra`), CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) 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=370837 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=371035 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -53990,7 +54382,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=37022 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=37030 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -54084,7 +54476,7 @@ CREATE TABLE `Tickets_dits` ( CONSTRAINT `Tickets_dits_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) 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 `vn`.`worker` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=65258743 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=65269457 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 */ ; @@ -54136,22 +54528,18 @@ CREATE TABLE `Tickets_stack` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Tickets_state` +-- Temporary table structure for view `Tickets_state` -- DROP TABLE IF EXISTS `Tickets_state`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tickets_state` ( - `Id_Ticket` int(11) NOT NULL DEFAULT '0', - `inter_id` int(11) NOT NULL, - `state_name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`Id_Ticket`), - KEY `double_foreign` (`Id_Ticket`,`inter_id`), - CONSTRAINT `Id_Ticket` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `double_foreign` FOREIGN KEY (`Id_Ticket`, `inter_id`) REFERENCES `vncontrol`.`inter` (`Id_Ticket`, `inter_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Tickets_state`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Tickets_state` AS SELECT + 1 AS `Id_Ticket`, + 1 AS `inter_id`, + 1 AS `state_name`*/; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Tickets_turno` @@ -54362,7 +54750,7 @@ CREATE TABLE `Vehiculos_consumo` ( CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `vn`.`vehicle` (`id`) ON UPDATE CASCADE, CONSTRAINT `fuelTypeFk` FOREIGN KEY (`fuelTypeFk`) REFERENCES `vn`.`fuelType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `proveedoresFk` FOREIGN KEY (`proveedoresFk`) REFERENCES `vn`.`supplier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=12943 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=12961 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 */; -- @@ -54511,7 +54899,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 `vn`.`supplierAccount` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=38089 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=38244 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 */ ; @@ -54815,11 +55203,11 @@ CREATE TABLE `albaran` ( CONSTRAINT `fk_albaran_Trabajadores1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_Trabajadores2` FOREIGN KEY (`Id_Responsable`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_albaran_state1` FOREIGN KEY (`albaran_state_id`) REFERENCES `albaran_state` (`albaran_state_id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_department1` FOREIGN KEY (`department_id`) REFERENCES `department` (`department_id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_department1` FOREIGN KEY (`department_id`) REFERENCES `vn`.`department` (`id`) ON UPDATE CASCADE, CONSTRAINT `fk_albaran_empresa1` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`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 `vn`.`warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3750 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3751 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -54898,7 +55286,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 `vn`.`supplier` (`id`) ON UPDATE CASCADE, CONSTRAINT `awb_ibfk_1` FOREIGN KEY (`iva_id`) REFERENCES `vn`.`taxCode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3614 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3615 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 */ ; @@ -55064,7 +55452,7 @@ CREATE TABLE `awb_component` ( CONSTRAINT `awb_component_` FOREIGN KEY (`awb_component_type_id`) REFERENCES `awb_component_type` (`awb_component_type_id`) ON UPDATE CASCADE, CONSTRAINT `awb_role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE, CONSTRAINT `awb_unit_fk` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=33026 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=33063 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -55179,7 +55567,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 `vn`.`dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=3195 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=3196 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -55310,45 +55698,22 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `botanic_export` +-- Temporary table structure for view `botanic_export` -- DROP TABLE IF EXISTS `botanic_export`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `botanic_export` ( - `botanic_export_id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `edi_genus_id` mediumint(8) unsigned NOT NULL, - `edi_specie_id` mediumint(8) unsigned DEFAULT NULL, - `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, - `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 `vn`.`country` (`id`) -) 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 */ ; -/*!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`.`botanic_exportBeforeInsert` BEFORE INSERT ON `botanic_export` FOR EACH ROW -BEGIN - IF (SELECT botanic_export_is_updatable (NEW.edi_genus_id, NEW.edi_specie_id, NEW.id_Paises, NEW.restriction) ) > 0 THEN - CALL util.throw ('Datos duplicados'); - 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 */ ; +/*!50001 DROP VIEW IF EXISTS `botanic_export`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `botanic_export` AS SELECT + 1 AS `botanic_export_id`, + 1 AS `edi_genus_id`, + 1 AS `edi_specie_id`, + 1 AS `Id_Paises`, + 1 AS `restriction`, + 1 AS `description`, + 1 AS `isProtectedZone`*/; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `businessReasonEnd` @@ -56167,35 +56532,30 @@ CREATE TABLE `definitivo` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `department` +-- Temporary table structure for view `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, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `lft` int(11) NOT NULL, - `rgt` int(11) NOT NULL, - `Id_Trabajador` int(11) DEFAULT NULL COMMENT 'Id_Trabajador es el jefe del departamento', - `company_id` int(11) NOT NULL, - `boss_id` int(11) DEFAULT NULL, - `x` int(11) DEFAULT NULL, - `y` int(11) DEFAULT NULL, - `production` tinyint(4) NOT NULL DEFAULT '0', - `isSelected` tinyint(1) NOT NULL DEFAULT '0', - `depth` int(11) NOT NULL DEFAULT '0', - `sons` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`department_id`), - UNIQUE KEY `lft_UNIQUE` (`lft`), - UNIQUE KEY `rgt_UNIQUE` (`rgt`), - UNIQUE KEY `name_UNIQUE` (`name`), - KEY `fk_department_Trabajadores1_idx` (`Id_Trabajador`), - KEY `dep_org_ibfk_3_idx` (`company_id`), - CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `department`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `department` AS SELECT + 1 AS `department_id`, + 1 AS `name`, + 1 AS `production`, + 1 AS `lft`, + 1 AS `rgt`, + 1 AS `isSelected`, + 1 AS `depth`, + 1 AS `parentFk`, + 1 AS `path`, + 1 AS `sons`, + 1 AS `Id_Trabajador`, + 1 AS `company_id`, + 1 AS `x`, + 1 AS `y`, + 1 AS `boss_id`*/; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `device` @@ -56893,7 +57253,7 @@ CREATE TABLE `intrastat_data` ( KEY `recibida` (`recibida_id`), CONSTRAINT `intrastat_data_ibfk_1` FOREIGN KEY (`intrastat_id`) REFERENCES `vn`.`intrastat` (`id`) 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=84832 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=85257 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -57156,30 +57516,27 @@ CREATE TABLE `log_articles` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `mail` +-- Temporary table structure for view `mail` -- DROP TABLE IF EXISTS `mail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mail` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `to` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `reply_to` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `text` text COLLATE utf8_unicode_ci NOT NULL, - `sent` tinyint(2) NOT NULL DEFAULT '0', - `DATE_ODBC` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `path` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `error` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'OK', - `senderFk` int(11) DEFAULT NULL, - `recipientFk` int(11) DEFAULT NULL, - `plainTextBody` text COLLATE utf8_unicode_ci, - PRIMARY KEY (`id`), - KEY `sent_idx` (`sent`), - KEY `creation_idx` (`DATE_ODBC`) -) ENGINE=InnoDB AUTO_INCREMENT=1940082 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `mail`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `mail` AS SELECT + 1 AS `id`, + 1 AS `senderFk`, + 1 AS `recipientFk`, + 1 AS `to`, + 1 AS `reply_to`, + 1 AS `subject`, + 1 AS `text`, + 1 AS `plainTextBody`, + 1 AS `path`, + 1 AS `DATE_ODBC`, + 1 AS `sent`, + 1 AS `error`*/; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `mail_templates` @@ -57410,7 +57767,7 @@ CREATE TABLE `pago` ( CONSTRAINT `pago_moneda` FOREIGN KEY (`id_moneda`) REFERENCES `vn`.`currency` (`id`) ON UPDATE CASCADE, CONSTRAINT `pago_pay_met` FOREIGN KEY (`pay_met_id`) REFERENCES `vn`.`payMethod` (`id`) ON UPDATE CASCADE, CONSTRAINT `proveedor_pago` FOREIGN KEY (`id_proveedor`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=52702 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=53054 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 */ ; @@ -57906,7 +58263,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 `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=64898 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=64909 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 */ ; @@ -58086,7 +58443,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=89348 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=89448 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 */ ; @@ -58324,7 +58681,7 @@ CREATE TABLE `recibida_iva` ( CONSTRAINT `recibida_iva_ibfk_2` FOREIGN KEY (`iva_id`) REFERENCES `vn`.`taxCode` (`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 `vn`.`expence` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB AUTO_INCREMENT=167642 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=168655 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -58347,7 +58704,7 @@ CREATE TABLE `recibida_vencimiento` ( KEY `banco_id` (`banco_id`), CONSTRAINT `recibida_vencimiento_ibfk_6` FOREIGN KEY (`banco_id`) REFERENCES `vn`.`bank` (`id`) 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=165669 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=166622 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 */ ; @@ -58459,35 +58816,32 @@ CREATE TABLE `recovery_asset` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `reference_min` +-- Temporary table structure for view `reference_min` -- DROP TABLE IF EXISTS `reference_min`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `reference_min` ( - `date` date NOT NULL, - `rate` decimal(10,4) NOT NULL, - `moneda_id` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`date`,`moneda_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `reference_min`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `reference_min` AS SELECT + 1 AS `date`, + 1 AS `rate`, + 1 AS `moneda_id`*/; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `reference_rate` +-- Temporary table structure for view `reference_rate` -- DROP TABLE IF EXISTS `reference_rate`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `reference_rate` ( - `moneda_id` tinyint(3) unsigned NOT NULL, - `date` date NOT NULL, - `rate` float unsigned NOT NULL, - PRIMARY KEY (`moneda_id`,`date`), - KEY `date` (`date`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `reference_rate`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `reference_rate` AS SELECT + 1 AS `moneda_id`, + 1 AS `date`, + 1 AS `rate`*/; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `reinos` @@ -58617,7 +58971,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=113205 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se borra automaticamente 8 dias en el pasado desde vn2008.clean'; +) ENGINE=InnoDB AUTO_INCREMENT=113620 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 */; -- @@ -58659,7 +59013,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=1445208 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=1451587 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -59175,7 +59529,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 `vn`.`worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=246635 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=247059 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -60243,18 +60597,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `warehouse_alias` +-- Temporary table structure for view `warehouse_alias` -- DROP TABLE IF EXISTS `warehouse_alias`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `warehouse_alias` ( - `warehouse_alias_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `alias` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`warehouse_alias_id`) -) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `warehouse_alias` AS SELECT + 1 AS `warehouse_alias_id`, + 1 AS `alias`*/; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `warehouse_filtro` @@ -60285,7 +60638,7 @@ CREATE TABLE `warehouse_group` ( PRIMARY KEY (`warehouse_alias_id`,`warehouse_id`), KEY `warehosue_group_ware_idx` (`warehouse_id`), CONSTRAINT `warehosue_group_ware` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `warehouse_group_alias` FOREIGN KEY (`warehouse_alias_id`) REFERENCES `warehouse_alias` (`warehouse_alias_id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `warehouse_group_alias` FOREIGN KEY (`warehouse_alias_id`) REFERENCES `vn`.`warehouseAlias` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Agrupa warehouses '; /*!40101 SET character_set_client = @saved_cs_client */; @@ -60419,22 +60772,18 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `workerTeam` +-- Temporary table structure for view `workerTeam` -- DROP TABLE IF EXISTS `workerTeam`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTeam` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `team` int(11) NOT NULL, - `user` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `user_idx` (`user`), - KEY `team_idx` (`team`), - CONSTRAINT `user_team` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `workerTeam` AS SELECT + 1 AS `team`, + 1 AS `id`, + 1 AS `user`*/; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `workerTeamCollegues` @@ -60863,14 +61212,16 @@ DELIMITER ; /*!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 character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` FUNCTION `botanic_export_is_updatable`(v_edi_genus_id MEDIUMINT,v_edi_specie_id MEDIUMINT,v_id_Paises MEDIUMINT,v_restriction MEDIUMINT) RETURNS int(11) + DETERMINISTIC BEGIN +-- bernat working in this file DECLARE is_updatable INTEGER; SELECT COUNT(*) INTO is_updatable FROM botanic_export WHERE edi_genus_id = v_edi_genus_id @@ -62696,33 +63047,37 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`%` PROCEDURE `agencia_descuadre`(datSince DATE, datTo DATE, intAgency INT, intWarehouseAlias INT) +CREATE DEFINER=`root`@`%` PROCEDURE `agencia_descuadre`(vFrom DATE, vTo DATE, vAgencyModeFk INT, vWarehouseAlias INT) BEGIN - DECLARE isFile boolean; - DECLARE datTo2359 DATETIME; + DECLARE vToDayEnd DATETIME; - SET datTo2359 = util.dayEnd(datTo); + SET vToDayEnd = util.dayEnd(vTo); - SELECT t.Id_Ticket,0 AS Total_Agencia,t.Id_Consigna,t.empresa_id,t.warehouse_id, + SELECT t.id ticketFk,t.addressFk, v.suma_componente AS VN, v.suma_componente - shipping_charge AS Difer, - e.shipping_charge AS teorico,t.Id_Agencia, t.Bultos,t.Id_Cliente, ap.zona - - FROM Tickets t LEFT JOIN + e.shipping_charge AS teorico, t.packages, t.clientFk, t.zoneFk, a.provinceFk + + FROM vn.ticket t + LEFT JOIN (SELECT Id_Ticket, SUM(suma_componente) suma_componente,Fecha FROM v_descuadre_porte2 - WHERE Fecha BETWEEN datSince AND datTo2359 - GROUP BY Id_Ticket) v ON t.Id_Ticket = v.Id_Ticket - LEFT JOIN (SELECT Id_Ticket, SUM(shipping_charge) shipping_charge, Fecha - FROM v_expeditions_shipping_charge2 - WHERE Fecha BETWEEN datSince AND datTo2359 - GROUP BY Id_Ticket - ) e ON t.Id_Ticket = e.Id_Ticket - JOIN Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN Consignatarios c ON t.Id_Consigna = c.Id_Consigna - JOIN Agencias_province ap ON ap.agency_id = a.agency_id AND ap.warehouse_id = t.warehouse_id AND ap.province_id = c.province_id - JOIN warehouse_group wg ON wg.warehouse_id =t.warehouse_id - WHERE DATE(t.Fecha) BETWEEN datSince AND datTo2359 AND a.agency_id = intAgency and wg.warehouse_alias_id = intWarehouseAlias; + WHERE Fecha BETWEEN vFrom AND vToDayEnd + GROUP BY Id_Ticket) v ON t.id = v.Id_Ticket + LEFT JOIN (SELECT t.id, SUM(z.price * ebv.ratio) shipping_charge + FROM vn.ticket t + JOIN vn.zone z ON t.zoneFk = z.id + LEFT JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.isBox + WHERE t.shipped BETWEEN vFrom AND vToDayEnd + GROUP BY t.id + ) e ON t.id = e.id + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.address a ON a.id = t.addressFk + JOIN warehouse_group wg ON wg.warehouse_id = t.warehouseFk + WHERE DATE(t.shipped) BETWEEN vFrom AND vToDayEnd + AND am.agencyFk = vAgencyModeFk + AND wg.warehouse_alias_id = vWarehouseAlias; END ;; DELIMITER ; @@ -79361,45 +79716,47 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.supplierStatement; CREATE TEMPORARY TABLE tmp.supplierStatement ENGINE = MEMORY - SELECT - *, - @saldo_eur:= round(@saldo_eur + IFNULL(Pago_Euros, 0) - IFNULL(Fac_Euros, 0) ,2 ) AS saldo_eur, - @saldo_div:= round(@saldo_div + IFNULL(Pago_Divisas, 0) - IFNULL(Fac_Divisas, 0) ,2 ) AS saldo_div - FROM - (SELECT * FROM - (SELECT - NULL as banco_id, - r.empresa_id, - r.serie, - r.id, - CASE - WHEN vOrderBy = 'issued' THEN r.fecha - WHEN vOrderBy = 'bookEntried' THEN r.bookEntried - WHEN vOrderBy = 'booked' THEN r.dateBooking - WHEN vOrderBy = 'dueDate' THEN rv.fecha - END AS fecha, - CONCAT('S/Fra ', r.sref) sref, - if(r.moneda_id > 1,round(sum(divisa) / sum(cantidad),3),NULL) val_cambio, - CAST(sum(cantidad) as DECIMAL(10,2)) as Fac_Euros, - CAST(sum(divisa) as DECIMAL(10,2)) as Fac_Divisas, - NULL AS Pago_Euros, - NULL AS Pago_Divisas, - r.moneda_id, - r.contabilizada, - Moneda, - NULL as pago_sdc_id + SELECT + *, + @saldo_eur:= round(@saldo_eur + IFNULL(Pago_Euros, 0) - IFNULL(Fac_Euros, 0) ,2 ) AS saldo_eur, + @saldo_div:= round(@saldo_div + IFNULL(Pago_Divisas, 0) - IFNULL(Fac_Divisas, 0) ,2 ) AS saldo_div FROM - recibida r - JOIN recibida_vencimiento rv on rv.recibida_id = r.id - JOIN Monedas m on m.Id_Moneda = r.moneda_id - WHERE - r.fecha > '2014-12-31' - AND r.proveedor_id = vSupplierFk - AND vCurrencyFk IN (r.moneda_id, 0) - AND vCompanyFk IN (r.empresa_id,0) - GROUP BY rv.id + (SELECT * FROM + (SELECT + NULL as banco_id, + r.empresa_id, + r.serie, + r.id, + CASE + WHEN vOrderBy = 'issued' THEN r.fecha + WHEN vOrderBy = 'bookEntried' THEN r.bookEntried + WHEN vOrderBy = 'booked' THEN r.dateBooking + WHEN vOrderBy = 'dueDate' THEN rv.fecha + END AS fecha, + CONCAT('S/Fra ', r.sref) sref, + if(r.moneda_id > 1,round(sum(divisa) / sum(cantidad),3),NULL) val_cambio, + CAST(sum(cantidad) as DECIMAL(10,2)) as Fac_Euros, + CAST(sum(divisa) as DECIMAL(10,2)) as Fac_Divisas, + NULL AS Pago_Euros, + NULL AS Pago_Divisas, + r.moneda_id, + r.contabilizada, + Moneda, + NULL as pago_sdc_id, + 'invoiceIn' statementType + FROM + recibida r + JOIN recibida_vencimiento rv on rv.recibida_id = r.id + JOIN Monedas m on m.Id_Moneda = r.moneda_id + WHERE + r.fecha > '2014-12-31' + AND r.proveedor_id = vSupplierFk + AND vCurrencyFk IN (r.moneda_id, 0) + AND vCompanyFk IN (r.empresa_id,0) + GROUP BY rv.id - UNION ALL SELECT + UNION ALL + SELECT p.id_banco, p.empresa_id, NULL, @@ -79412,9 +79769,10 @@ BEGIN p.importe, p.divisa, p.id_moneda, - IFNULL(conciliado, 0), + conciliado, Moneda, - pago_sdc_id + pago_sdc_id, + 'payment' statementType FROM pago p LEFT JOIN Monedas ON Monedas.Id_Moneda = p.id_moneda @@ -79426,6 +79784,27 @@ BEGIN AND p.Id_Proveedor = vSupplierFk AND vCurrencyFk IN (p.id_moneda,0) AND vCompanyFk IN (p.empresa_id,0) + UNION ALL + SELECT + NULL, + companyFk, + NULL, + supplierFk, + dated, + '', + 1 tip_cambio, + NULL, + NULL, + amount, + NULL, + currencyFk, + isConciliated, + c.`code`, + NULL, + 'expense' statementType + FROM vn.supplierExpense se + JOIN vn.currency c on c.id= se.currencyFk + WHERE se.supplierFk = vSupplierFk ) AS SUB ORDER BY (fecha is null and NOT contabilizada),fecha, IF(vOrderBy = 'dueDate', id, NULL)) t; END ;; @@ -83137,7 +83516,7 @@ CREATE TABLE `inter` ( CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn`.`state` (`id`) ON UPDATE CASCADE, CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=21688077 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB AUTO_INCREMENT=21764489 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 */ ; @@ -83217,6 +83596,7 @@ DELIMITER ;; AFTER INSERT ON `inter` FOR EACH ROW BEGIN +-- bernat: working in this file REPLACE vn2008.Tickets_state(Id_Ticket, inter_id, state_name) SELECT NEW.Id_Ticket, NEW.inter_id, `name` FROM vn2008.state @@ -83240,6 +83620,7 @@ DELIMITER ;; AFTER UPDATE ON `inter` FOR EACH ROW BEGIN +-- bernat: working in this file DECLARE intIdTicket INT; DECLARE intInterId INT; DECLARE strName VARCHAR(15); @@ -83284,6 +83665,7 @@ DELIMITER ;; AFTER DELETE ON `inter` FOR EACH ROW BEGIN +-- bernat: working in this file DECLARE intIdTicket INT; DECLARE intInterId INT; DECLARE strName VARCHAR(15); @@ -84491,10 +84873,10 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `botanicExport` +-- Final view structure for view `botanicExport__` -- -/*!50001 DROP VIEW IF EXISTS `botanicExport`*/; +/*!50001 DROP VIEW IF EXISTS `botanicExport__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -84503,7 +84885,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `botanicExport` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description`,`be`.`isProtectedZone` AS `isProtectedZone` from `vn2008`.`botanic_export` `be` */; +/*!50001 VIEW `botanicExport__` AS select `be`.`botanic_export_id` AS `id`,`be`.`edi_genus_id` AS `ediGenusFk`,`be`.`edi_specie_id` AS `ediSpecieFk`,`be`.`Id_Paises` AS `countryFk`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description`,`be`.`isProtectedZone` AS `isProtectedZone` from `vn2008`.`botanic_export` `be` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -84580,6 +84962,24 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `cmr_list` +-- + +/*!50001 DROP VIEW IF EXISTS `cmr_list`*/; +/*!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=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `cmr_list` AS select `cmr`.`id` AS `cmrFk`,`cmr`.`ticketFk` AS `ticketFk`,`cmr`.`truckPlate` AS `truckPlate`,`cmr`.`observations` AS `observations`,`cmr`.`senderInstruccions` AS `senderInstruccions`,`cmr`.`paymentInstruccions` AS `paymentInstruccions`,`cmr`.`specialAgreements` AS `specialAgreements`,`cmr`.`created` AS `created`,`t`.`addressFk` AS `addressFk`,`t`.`shipped` AS `shipped`,`a`.`nickname` AS `clientName`,`a`.`postalCode` AS `clientPostalCode`,`a`.`street` AS `clientStreet`,`a`.`city` AS `clientCity`,`p`.`name` AS `clientProvince`,`co`.`country` AS `clientCountry`,`su`.`name` AS `companyName`,`su`.`street` AS `companyStreet`,`su`.`postCode` AS `companyPostCode`,`su`.`city` AS `companyCity`,`sc`.`country` AS `companyCountry`,`w`.`addressName` AS `warehouseAddress`,`c`.`name` AS `clientOficialName`,ifnull(`ags`.`name`,`agm`.`name`) AS `carrierName`,`ags`.`street` AS `carrierStreet`,`ags`.`postCode` AS `carrierPostCode`,`ags`.`city` AS `carrierCity`,`sco`.`country` AS `carrierCountry` from ((((((((((((`cmr` join `ticket` `t` on((`t`.`id` = `cmr`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `country` `co` on((`co`.`id` = `p`.`countryFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `supplier` `su` on((`su`.`id` = `t`.`companyFk`))) join `country` `sc` on((`sc`.`id` = `su`.`countryFk`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) join `agencyMode` `agm` on((`agm`.`id` = `t`.`agencyModeFk`))) join `agency` `ag` on((`ag`.`id` = `agm`.`agencyFk`))) left join `supplier` `ags` on((`ags`.`id` = `ag`.`supplierFk`))) left join `country` `sco` on((`sco`.`id` = `ags`.`countryFk`))) */; +/*!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 `color` -- @@ -84760,24 +85160,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `department` --- - -/*!50001 DROP VIEW IF EXISTS `department`*/; -/*!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=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `department` AS select `b`.`department_id` AS `id`,`b`.`name` AS `name`,`b`.`production` AS `isProduction`,`b`.`lft` AS `lft`,`b`.`rgt` AS `rgt`,`b`.`isSelected` AS `isSelected`,`b`.`depth` AS `depth`,`b`.`sons` AS `sons` from `vn2008`.`department` `b` */; -/*!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 `departmentTree` -- @@ -84791,7 +85173,25 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(repeat(repeat(' ',5),(count(`parent`.`id`) - 1)),`node`.`name`) AS `dep` from (`vn`.`department` `node` join `vn`.`department` `parent`) where (`node`.`lft` between `parent`.`lft` and `parent`.`rgt`) group by `node`.`id` order by `node`.`lft` */; +/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(repeat(repeat(' ',5),(count(`parent`.`id`) - 1)),`node`.`name`) AS `dep` from (`department` `node` join `department` `parent`) where (`node`.`lft` between `parent`.`lft` and `parent`.`rgt`) group by `node`.`id` order by `node`.`lft` */; +/*!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 `department__` +-- + +/*!50001 DROP VIEW IF EXISTS `department__`*/; +/*!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=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `department__` AS select `b`.`department_id` AS `id`,`b`.`name` AS `name`,`b`.`production` AS `isProduction`,`b`.`lft` AS `lft`,`b`.`rgt` AS `rgt`,`b`.`isSelected` AS `isSelected`,`b`.`depth` AS `depth`,`b`.`sons` AS `sons` from `vn2008`.`department` `b` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -85589,10 +85989,10 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `mail` +-- Final view structure for view `mail__` -- -/*!50001 DROP VIEW IF EXISTS `mail`*/; +/*!50001 DROP VIEW IF EXISTS `mail__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -85601,7 +86001,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `mail` AS select `m`.`id` AS `id`,`m`.`senderFk` AS `senderFk`,`m`.`recipientFk` AS `recipientFk`,`m`.`to` AS `sender`,`m`.`reply_to` AS `replyTo`,`m`.`subject` AS `subject`,`m`.`text` AS `body`,`m`.`plainTextBody` AS `plainTextBody`,`m`.`path` AS `attachment`,`m`.`DATE_ODBC` AS `creationDate`,`m`.`sent` AS `sent`,`m`.`error` AS `status` from `vn2008`.`mail` `m` */; +/*!50001 VIEW `mail__` AS select `m`.`id` AS `id`,`m`.`senderFk` AS `senderFk`,`m`.`recipientFk` AS `recipientFk`,`m`.`to` AS `sender`,`m`.`reply_to` AS `replyTo`,`m`.`subject` AS `subject`,`m`.`text` AS `body`,`m`.`plainTextBody` AS `plainTextBody`,`m`.`path` AS `attachment`,`m`.`DATE_ODBC` AS `creationDate`,`m`.`sent` AS `sent`,`m`.`error` AS `status` from `vn2008`.`mail` `m` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -85913,10 +86313,10 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `referenceRate` +-- Final view structure for view `referenceRate__` -- -/*!50001 DROP VIEW IF EXISTS `referenceRate`*/; +/*!50001 DROP VIEW IF EXISTS `referenceRate__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -85925,7 +86325,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `referenceRate` AS select `r`.`moneda_id` AS `currencyFk`,`r`.`date` AS `dated`,`r`.`rate` AS `value` from `vn2008`.`reference_rate` `r` */; +/*!50001 VIEW `referenceRate__` AS select `r`.`moneda_id` AS `currencyFk`,`r`.`date` AS `dated`,`r`.`rate` AS `value` from `vn2008`.`reference_rate` `r` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -86172,12 +86572,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_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`ts`.`Id_Ticket` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code`,`ts`.`Id_Ticket` AS `ticket`,`i`.`Id_Trabajador` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`vn2008`.`Tickets_state` `ts` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `ts`.`inter_id`))) join `vn2008`.`state` `s` on((`s`.`id` = `i`.`state_id`))) */; +/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`tls`.`ticketFk` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alertLevel` AS `alertLevel`,`s`.`code` AS `code`,`tls`.`ticketFk` AS `ticket`,`i`.`Id_Trabajador` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`vn`.`ticketLastState` `tls` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `tls`.`ticketTrackingFk`))) join `vn`.`state` `s` on((`s`.`id` = `i`.`state_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -86417,10 +86817,10 @@ USE `vn`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `warehouseAlias` +-- Final view structure for view `warehouseAlias__` -- -/*!50001 DROP VIEW IF EXISTS `warehouseAlias`*/; +/*!50001 DROP VIEW IF EXISTS `warehouseAlias__`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -86429,7 +86829,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouseAlias` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */; +/*!50001 VIEW `warehouseAlias__` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -86524,24 +86924,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `workerTeam` --- - -/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; -/*!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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeam` AS select `w`.`team` AS `team`,`w`.`id` AS `id`,`w`.`user` AS `workerFk` from `vn2008`.`workerTeam` `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 `workerTeamCollegues` -- @@ -86555,7 +86937,25 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`vn`.`workerTeam` `w` join `vn`.`workerTeam` `t` on((`w`.`team` = `t`.`team`))) */; +/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`workerTeam` `w` join `workerTeam` `t` on((`w`.`team` = `t`.`team`))) */; +/*!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 `workerTeam__` +-- + +/*!50001 DROP VIEW IF EXISTS `workerTeam__`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTeam__` AS select `w`.`team` AS `team`,`w`.`id` AS `id`,`w`.`user` AS `workerFk` from `vn2008`.`workerTeam` `w` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -86836,6 +87236,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Entradas_Auto` +-- + +/*!50001 DROP VIEW IF EXISTS `Entradas_Auto`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Entradas_Auto` AS select `ev`.`entryFk` AS `Id_Entrada` from `vn`.`entryVirtual` `ev` */; +/*!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 `Facturas` -- @@ -87178,6 +87596,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Tickets_state` +-- + +/*!50001 DROP VIEW IF EXISTS `Tickets_state`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `Tickets_state` AS select `t`.`ticketFk` AS `Id_Ticket`,`t`.`ticketTrackingFk` AS `inter_id`,`t`.`name` AS `state_name` from `vn`.`ticketLastState` `t` */; +/*!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 `Tickets_turno` -- @@ -87412,6 +87848,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `botanic_export` +-- + +/*!50001 DROP VIEW IF EXISTS `botanic_export`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `botanic_export` AS select `be`.`id` AS `botanic_export_id`,`be`.`ediGenusFk` AS `edi_genus_id`,`be`.`ediSpecieFk` AS `edi_specie_id`,`be`.`countryFk` AS `Id_Paises`,`be`.`restriction` AS `restriction`,`be`.`description` AS `description`,`be`.`isProtectedZone` AS `isProtectedZone` from `vn`.`botanicExport` `be` */; +/*!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 `businessReasonEnd` -- @@ -87772,6 +88226,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `department` +-- + +/*!50001 DROP VIEW IF EXISTS `department`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `department` AS select `d`.`id` AS `department_id`,`d`.`name` AS `name`,`d`.`isProduction` AS `production`,`d`.`lft` AS `lft`,`d`.`rgt` AS `rgt`,`d`.`isSelected` AS `isSelected`,`d`.`depth` AS `depth`,`d`.`parentFk` AS `parentFk`,`d`.`path` AS `path`,`d`.`sons` AS `sons`,`d`.`workerFk` AS `Id_Trabajador`,`d`.`companyFk` AS `company_id`,`d`.`x` AS `x`,`d`.`y` AS `y`,`d`.`bossFk` AS `boss_id` from `vn`.`department` `d` */; +/*!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 `device` -- @@ -88294,6 +88766,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `mail` +-- + +/*!50001 DROP VIEW IF EXISTS `mail`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `mail` AS select `m`.`id` AS `id`,`m`.`senderFk` AS `senderFk`,`m`.`recipientFk` AS `recipientFk`,`m`.`sender` AS `to`,`m`.`replyTo` AS `reply_to`,`m`.`subject` AS `subject`,`m`.`body` AS `text`,`m`.`plainTextBody` AS `plainTextBody`,`m`.`attachment` AS `path`,`m`.`creationDate` AS `DATE_ODBC`,`m`.`sent` AS `sent`,`m`.`status` AS `error` from `vn`.`mail` `m` */; +/*!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 `manaByTicket` -- @@ -88582,6 +89072,42 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `reference_min` +-- + +/*!50001 DROP VIEW IF EXISTS `reference_min`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `reference_min` AS select `rc`.`dated` AS `date`,`rc`.`value` AS `rate`,`rc`.`currencyFk` AS `moneda_id` from `vn`.`referenceCurrent` `rc` */; +/*!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 `reference_rate` +-- + +/*!50001 DROP VIEW IF EXISTS `reference_rate`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `reference_rate` AS select `rr`.`currencyFk` AS `moneda_id`,`rr`.`dated` AS `date`,`rr`.`value` AS `rate` from `vn`.`referenceRate` `rr` */; +/*!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 `reinos` -- @@ -89477,7 +90003,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `vn2008`.`warehouse` union all select (1000 + `vn2008`.`warehouse_alias`.`warehouse_alias_id`) AS `warehouse_alias_id`,concat(`vn2008`.`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `vn2008`.`warehouse_alias` */; +/*!50001 VIEW `v_warehouse` AS select `warehouse`.`id` AS `id`,`warehouse`.`name` AS `almacen` from `vn2008`.`warehouse` union all select (1000 + `warehouse_alias`.`warehouse_alias_id`) AS `warehouse_alias_id`,concat(`warehouse_alias`.`alias`,'(G)') AS `concat(alias, '(G)')` from `vn2008`.`warehouse_alias` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -89608,6 +90134,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `warehouse_alias` +-- + +/*!50001 DROP VIEW IF EXISTS `warehouse_alias`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `warehouse_alias` AS select `wa`.`id` AS `warehouse_alias_id`,`wa`.`name` AS `alias` from `vn`.`warehouseAlias` `wa` */; +/*!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 `workcenter_holiday` -- @@ -89644,6 +90188,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `workerTeam` +-- + +/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTeam` AS select `wt`.`team` AS `team`,`wt`.`id` AS `id`,`wt`.`workerFk` AS `user` from `vn`.`workerTeam` `wt` */; +/*!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 `workerTeamCollegues` -- @@ -89695,4 +90257,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2019-11-22 14:04:19 +-- Dump completed on 2019-11-26 14:03:23 diff --git a/db/export-data.sh b/db/export-data.sh index 7a9c6e7c7..fd690854a 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -6,7 +6,7 @@ INI_FILE="config.production.ini" dump_tables() { SCHEMA=$1 echo "USE \`$SCHEMA\`;" >> "$DUMPED_FILE" - mysqldump --defaults-file="$INI_FILE" --no-create-info $@ >> "$DUMPED_FILE" + mysqldump --defaults-file="$INI_FILE" --no-create-info --skip-triggers $@ >> "$DUMPED_FILE" } echo "" > "$DUMPED_FILE" @@ -48,21 +48,11 @@ TABLES=( ticketUpdateAction state sample + department ) dump_tables ${TABLES[@]} -TABLES=( - vn2008 - accion_dits - businessReasonEnd - container - department - Grupos - iva_group_codigo - tarifa_componentes - tarifa_componentes_series -) -dump_tables ${TABLES[@]} + TABLES=( bi