Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1772-campaign_metrics
This commit is contained in:
commit
ee92ec42f7
|
@ -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;
|
UPDATE vn.department SET lft = NULL, rgt = NULL;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
USE `vn`;
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`ticketRequest`
|
ALTER TABLE `vn`.`ticketRequest`
|
||||||
DROP FOREIGN KEY `fgnAtender`;
|
DROP FOREIGN KEY `fgnAtender`;
|
||||||
|
@ -10,44 +9,12 @@ ADD CONSTRAINT `fgnAtender`
|
||||||
REFERENCES `vn`.`worker` (`id`)
|
REFERENCES `vn`.`worker` (`id`)
|
||||||
ON UPDATE CASCADE;
|
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`;
|
DROP TRIGGER IF EXISTS `vn`.`ticketRequest_beforeInsert`;
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketRequest_beforeInsert` BEFORE INSERT ON `ticketRequest` FOR EACH ROW
|
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketRequest_beforeInsert` BEFORE INSERT ON `ticketRequest` FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
IF NEW.ticketFk IS NULL THEN
|
IF NEW.ticketFk IS NULL THEN
|
||||||
|
@ -68,7 +35,6 @@ DELIMITER ;
|
||||||
DROP TRIGGER IF EXISTS `vn`.`ticketRequest_beforeUpdate`;
|
DROP TRIGGER IF EXISTS `vn`.`ticketRequest_beforeUpdate`;
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketRequest_beforeUpdate` BEFORE UPDATE ON `ticketRequest` FOR EACH ROW
|
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketRequest_beforeUpdate` BEFORE UPDATE ON `ticketRequest` FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
IF NEW.saleFk <> OLD.saleFk THEN
|
IF NEW.saleFk <> OLD.saleFk THEN
|
||||||
|
@ -85,24 +51,4 @@ BEGIN
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
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`;
|
|
||||||
|
|
|
@ -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`;
|
|
@ -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 ;
|
||||||
|
|
|
@ -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 ;
|
|
@ -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 ;
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
DROP TRIGGER IF EXISTS `bs`.`mana_spellers_AFTER_INSERT`;
|
|
@ -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 ;
|
|
@ -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 ;
|
|
@ -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<v_date18;
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
DROP procedure IF EXISTS `vn`.`clean`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clean`()
|
||||||
|
BEGIN
|
||||||
|
DECLARE vDateShort DATETIME;
|
||||||
|
DECLARE vOneYearAgo DATE;
|
||||||
|
DECLARE vFourYearsAgo DATE;
|
||||||
|
DECLARE v18Month DATE;
|
||||||
|
DECLARE v26Month DATE;
|
||||||
|
DECLARE v3Month DATE;
|
||||||
|
|
||||||
|
SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE());
|
||||||
|
SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE());
|
||||||
|
SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE());
|
||||||
|
SET v18Month = TIMESTAMPADD(MONTH, -18,CURDATE());
|
||||||
|
SET v26Month = TIMESTAMPADD(MONTH, -26,CURDATE());
|
||||||
|
SET v3Month = TIMESTAMPADD(MONTH, -3, CURDATE());
|
||||||
|
|
||||||
|
DELETE FROM `message` WHERE sendDate < vDateShort;
|
||||||
|
DELETE FROM messageInbox WHERE sendDate < vDateShort;
|
||||||
|
DELETE FROM messageInbox WHERE sendDate < vDateShort;
|
||||||
|
DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo;
|
||||||
|
DELETE FROM itemShelving WHERE created < CURDATE() AND visible = 0;
|
||||||
|
DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE());
|
||||||
|
DELETE FROM entryLog WHERE creationDate < vDateShort;
|
||||||
|
DELETE FROM expedition WHERE created < v26Month;
|
||||||
|
DELETE FROM sms WHERE created < v18Month;
|
||||||
|
DELETE FROM saleTracking WHERE created < vDateShort;
|
||||||
|
DELETE tobs FROM ticketObservation tobs
|
||||||
|
JOIN ticket t ON tobs.shipped = t.id WHERE t.shipped < vDateShort;
|
||||||
|
DELETE FROM sharingCart where ended < vDateShort;
|
||||||
|
DELETE FROM sharingClient where ended < vDateShort;
|
||||||
|
DELETE tw.* FROM ticketWeekly tw
|
||||||
|
LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL;
|
||||||
|
DELETE FROM claim WHERE ticketCreated < v18Month;
|
||||||
|
DELETE FROM message WHERE sendDate < vDateShort;
|
||||||
|
DELETE sc FROM saleChecked sc
|
||||||
|
JOIN sale s ON mc.Id_Movimiento = s.id WHERE s.created < vDateShort;
|
||||||
|
DELETE bm
|
||||||
|
FROM buyMark bm
|
||||||
|
JOIN buy b ON b.id = bm.id
|
||||||
|
JOIN entry e ON e.id = b.entryFk
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
WHERE t.landed <= vDateShort;
|
||||||
|
DELETE FROM stowaway WHERE created < v3Month;
|
||||||
|
CALL shelving_clean;
|
||||||
|
|
||||||
|
CALL ticketPackagingRecovery;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
DROP function IF EXISTS `vn`.`buy_hasNotifyPassport`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE DEFINER=`root`@`%` FUNCTION `vn`.`buy_hasNotifyPassport`(vBuyFk INT, vItemFk INT) RETURNS tinyint(1)
|
||||||
|
READS SQL DATA
|
||||||
|
BEGIN
|
||||||
|
DECLARE vHasPassport BOOL;
|
||||||
|
DECLARE vIsAlreadySent BOOL;
|
||||||
|
DECLARE vItemCategoryFk INT;
|
||||||
|
SELECT id INTO vItemCategoryFk FROM itemCategory WHERE code = 'plant';
|
||||||
|
|
||||||
|
SELECT COUNT(*) INTO vHasPassport
|
||||||
|
FROM botanicExport be
|
||||||
|
JOIN itemBotanical ib
|
||||||
|
ON be.ediGenusFk = ib.genusFk
|
||||||
|
AND IFNULL(be.ediSpecieFk, ib.specieFk) = ib.specieFk
|
||||||
|
AND be.restriction = 'pasaporte fitosanitario'
|
||||||
|
JOIN item i ON i.id = ib.itemFk
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
WHERE ib.itemFk = vItemFk
|
||||||
|
AND it.categoryFk = vItemCategoryFk;
|
||||||
|
|
||||||
|
IF vHasPassport THEN
|
||||||
|
SELECT COUNT(*) INTO vIsAlreadySent
|
||||||
|
FROM mail m
|
||||||
|
JOIN buy b ON b.id = vBuyFk
|
||||||
|
WHERE m.`body` LIKE CONCAT('%', b.ektFk, '%')
|
||||||
|
LIMIT 1;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN vHasPassport AND NOT vIsAlreadySent;
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
DROP function IF EXISTS `vn2008`.`botanic_export_is_updatable`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE DEFINER=`root`@`%` FUNCTION `vn2008`.`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
|
||||||
|
-- DEPRECATED: use vn.botanicExport_isUpdatable
|
||||||
|
RETURN botanicExport_isUpdatable (v_edi_genus_id, v_edi_specie_id, v_id_Paises, v_restriction);
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
|
|
@ -34,6 +34,7 @@ BEGIN
|
||||||
JOIN itemType it ON it.categoryFk = k.id
|
JOIN itemType it ON it.categoryFk = k.id
|
||||||
JOIN item i ON i.typeFk = it.id
|
JOIN item i ON i.typeFk = it.id
|
||||||
WHERE i.id = vItemFk;
|
WHERE i.id = vItemFk;
|
||||||
|
|
||||||
IF vIsMerchandise THEN
|
IF vIsMerchandise THEN
|
||||||
REPLACE bi.rotacion SET
|
REPLACE bi.rotacion SET
|
||||||
Id_Article = vItemFk,
|
Id_Article = vItemFk,
|
||||||
|
@ -44,14 +45,14 @@ BEGIN
|
||||||
SELECT isFeedStock INTO vIsFeedStock
|
SELECT isFeedStock INTO vIsFeedStock
|
||||||
FROM warehouse WHERE id = vWarehouseOut AND id <> 13;
|
FROM warehouse WHERE id = vWarehouseOut AND id <> 13;
|
||||||
|
|
||||||
IF vIsFeedStock AND vn2008.has_notify_passport(vItemFk, vSelf) THEN
|
IF vIsFeedStock AND buy_hasNotifyPassport(vSelf, vItemFk) THEN
|
||||||
CALL vn.buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking);
|
CALL buy_notifyPassport(vSelf, vItemFk, vStickers, vPacking);
|
||||||
INSERT IGNORE INTO producer(`name`)
|
INSERT IGNORE INTO producer(`name`)
|
||||||
SELECT es.company_name
|
SELECT es.company_name
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN edi.ekt be ON be.id = b.ektFk
|
JOIN edi.ekt be ON be.id = b.ektFk
|
||||||
JOIN edi.supplier es ON es.supplier_id = be.pro
|
JOIN edi.supplier es ON es.supplier_id = be.pro
|
||||||
WHERE b.id = 1;
|
WHERE b.id = vSelf;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -36,7 +36,7 @@ UNLOCK TABLES;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `account`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- 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 */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `salix`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- 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 */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `vn`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- 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');
|
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 */;
|
/*!40000 ALTER TABLE `sample` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
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`
|
-- Dumping data for table `department`
|
||||||
|
@ -355,19 +307,9 @@ UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `department` WRITE;
|
LOCK TABLES `department` WRITE;
|
||||||
/*!40000 ALTER TABLE `department` DISABLE KEYS */;
|
/*!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 */;
|
/*!40000 ALTER TABLE `department` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
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 */;
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
@ -378,7 +320,7 @@ UNLOCK TABLES;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `bi`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- 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 */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `cache`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- 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 */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `hedera`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- 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 */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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`;
|
USE `postgresql`;
|
||||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||||
--
|
--
|
||||||
|
@ -577,7 +519,7 @@ UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `professional_category` WRITE;
|
LOCK TABLES `professional_category` WRITE;
|
||||||
/*!40000 ALTER TABLE `professional_category` DISABLE KEYS */;
|
/*!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 */;
|
/*!40000 ALTER TABLE `professional_category` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
@ -610,4 +552,4 @@ UNLOCK TABLES;
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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
|
||||||
|
|
|
@ -601,16 +601,16 @@ INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `ma
|
||||||
VALUES
|
VALUES
|
||||||
(1, 102, 442, '1-1', CURDATE(), 2);
|
(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
|
VALUES
|
||||||
(1, 'Plant', 1, 'B92A26', 'icon-plant'),
|
(1, 'Plant', 1, 'B92A26', 'icon-plant', 'plant'),
|
||||||
(2, 'Flower', 2, 'dcf711', 'icon-flower'),
|
(2, 'Flower', 2, 'dcf711', 'icon-flower', 'flower'),
|
||||||
(3, 'Logistic', 0, 'b9f711', NULL),
|
(3, 'Logistic', 0, 'b9f711', NULL, 'logistical'),
|
||||||
(4, 'Handmade', 1, NULL, 'icon-handmade'),
|
(4, 'Handmade', 1, NULL, 'icon-handmade', 'handmade'),
|
||||||
(5, 'Artificial', 1, NULL, 'icon-artificial'),
|
(5, 'Artificial', 1, NULL, 'icon-artificial', 'artificial'),
|
||||||
(6, 'Green', 1, NULL, 'icon-greenery'),
|
(6, 'Green', 1, NULL, 'icon-greenery', 'greenery'),
|
||||||
(7, 'Accessories', 1, NULL, 'icon-accessory'),
|
(7, 'Accessories', 1, NULL, 'icon-accessory', 'accessory'),
|
||||||
(8, 'Fruit', 1, NULL, 'icon-fruit');
|
(8, 'Fruit', 1, NULL, 'icon-fruit', 'fruit');
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`)
|
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`, `isPackaging`)
|
||||||
VALUES
|
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
|
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(19);
|
||||||
call vn.manaSpellersRequery(18);
|
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`)
|
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 43200, 129600, 734400, 43200, 50400);
|
(1, 43200, 129600, 734400, 43200, 50400);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
USE `vn2008`;
|
|
||||||
|
|
||||||
-- Import compiled functions
|
-- Import compiled functions
|
||||||
CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so';
|
CREATE AGGREGATE FUNCTION minacum RETURNS INT SONAME 'minacum.so';
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@ INI_FILE="config.production.ini"
|
||||||
dump_tables() {
|
dump_tables() {
|
||||||
SCHEMA=$1
|
SCHEMA=$1
|
||||||
echo "USE \`$SCHEMA\`;" >> "$DUMPED_FILE"
|
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"
|
echo "" > "$DUMPED_FILE"
|
||||||
|
@ -48,21 +48,11 @@ TABLES=(
|
||||||
ticketUpdateAction
|
ticketUpdateAction
|
||||||
state
|
state
|
||||||
sample
|
sample
|
||||||
|
department
|
||||||
)
|
)
|
||||||
dump_tables ${TABLES[@]}
|
dump_tables ${TABLES[@]}
|
||||||
|
|
||||||
TABLES=(
|
|
||||||
vn2008
|
|
||||||
accion_dits
|
|
||||||
businessReasonEnd
|
|
||||||
container
|
|
||||||
department
|
|
||||||
Grupos
|
|
||||||
iva_group_codigo
|
|
||||||
tarifa_componentes
|
|
||||||
tarifa_componentes_series
|
|
||||||
)
|
|
||||||
dump_tables ${TABLES[@]}
|
|
||||||
|
|
||||||
TABLES=(
|
TABLES=(
|
||||||
bi
|
bi
|
||||||
|
|
Loading…
Reference in New Issue