feat: refs #5483 update db files
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Juan Ferrer 2024-01-25 17:33:54 +01:00
parent a5cd4a671c
commit 1ad1e53970
602 changed files with 13072 additions and 10104 deletions

2
db/.gitignore vendored
View File

@ -7,3 +7,5 @@ dump/.changes
dump/fixtures.local.sql
.dBeaver
.idea
.project
.dbeaver/

View File

@ -1,8 +0,0 @@
-- Definición de la tabla mailAliasACL
CREATE OR REPLACE TABLE `account`.`mailAliasAcl` (
`mailAliasFk` int(10) unsigned NOT NULL,
`roleFk` int(10) unsigned NOT NULL,
FOREIGN KEY (`mailAliasFk`) REFERENCES `account`.`mailAlias` (`id`),
FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

View File

@ -1,7 +0,0 @@
ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `cplusInvoiceTyoeFk`;
ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `invoiceCorrectionType_Fk33`;
ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `invoiceCorrection_ibfk_1`;
ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `siiTypeInvoiceOut_FK` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `vn`.`siiTypeInvoiceOut`(id) ON UPDATE CASCADE;
ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `invoiceCorrectionType_FK` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `vn`.`invoiceCorrectionType`(id) ON UPDATE CASCADE;
ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `cplusRectificationType_FK` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType`(id) ON UPDATE CASCADE;

View File

@ -1,33 +0,0 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getTaxBases`()
BEGIN
/**
* Calcula y devuelve en número de bases imponibles postivas y negativas
* Requiere la tabla temporal tmp.ticketToInvoice(id)
*
* returns tmp.taxBases
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(KEY (ticketFk))
ENGINE = MEMORY
SELECT id ticketFk
FROM tmp.ticketToInvoice;
CALL ticket_getTax(NULL);
DROP TEMPORARY TABLE IF EXISTS tmp.taxBases;
CREATE TEMPORARY TABLE tmp.taxBases
ENGINE = MEMORY
SELECT
SUM(taxableBase > 0) as positive,
SUM(taxableBase < 0) as negative
FROM(
SELECT SUM(taxableBase) taxableBase
FROM tmp.ticketTax
GROUP BY pgcFk
) t;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
-- vn.docuwareTablet definition
CREATE TABLE `vn`.`docuwareTablet` (
`tablet` varchar(100) NOT NULL PRIMARY KEY,
`description` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
ALTER TABLE `vn`.`userConfig`
ADD COLUMN tabletFk varchar(100) DEFAULT NULL,
ADD FOREIGN KEY (tabletFk) REFERENCES `vn`.`docuwareTablet`(tablet);

View File

@ -1,17 +0,0 @@
DELETE FROM `salix`.`ACL`
WHERE model = 'VnUser'
AND property = 'renewToken';
INSERT INTO `account`.`role` (name, description)
VALUES ('timeControl','Tablet para fichar');
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
VALUES (127, 11);
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('WorkerTimeControl', 'login', 'READ', 'ALLOW', 'ROLE', 'timeControl'),
('WorkerTimeControl', 'getClockIn', 'READ', 'ALLOW', 'ROLE', 'timeControl'),
('WorkerTimeControl', 'clockIn', 'WRITE', 'ALLOW', 'ROLE', 'timeControl');
CALL `account`.`role_sync`();

View File

@ -1,2 +0,0 @@
DELETE FROM `account`.`signInLog` where owner <> FALSE;

View File

@ -1,81 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketPositionInPath`(vTicketId INT)
RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
DECLARE vRestTicketsMaxOrder INT;
DECLARE vRestTicketsMinOrder INT;
DECLARE vRestTicketsPacking INT;
DECLARE vMyProductionOrder INT;
DECLARE vPosition VARCHAR(10) DEFAULT 'MID';
DECLARE vMyPath INT;
DECLARE vMyWarehouse INT;
DECLARE PACKING_ORDER INT;
DECLARE vExpeditionsCount INT;
DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE;
SELECT `order`
INTO PACKING_ORDER
FROM state
WHERE code = 'PACKING';
SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0)
INTO vMyPath, vMyWarehouse, vMyProductionOrder
FROM ticket t
LEFT JOIN ticketState ts on ts.ticketFk = t.id
WHERE t.id = vTicketId;
SELECT (ag.`name` = 'VN_VALENCIA')
INTO vIsValenciaPath
FROM vn2008.Rutas r
JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia
JOIN vn2008.agency ag on ag.agency_id = a.agency_id
WHERE r.Id_Ruta = vMyPath;
IF vIsValenciaPath THEN -- Rutas Valencia
SELECT COUNT(*)
INTO vExpeditionsCount
FROM expedition e
JOIN ticket t ON t.id = e.ticketFk
WHERE t.routeFk = vMyPath;
SELECT MAX(ts.productionOrder), MIN(ts.productionOrder)
INTO vRestTicketsMaxOrder, vRestTicketsMinOrder
FROM ticket t
LEFT JOIN ticketState ts on t.id = ts.ticketFk
WHERE t.routeFk = vMyPath
AND t.warehouseFk = vMyWarehouse
AND t.id != vTicketid;
SELECT COUNT(*)
INTO vRestTicketsPacking
FROM ticket t
LEFT JOIN ticketState ts on t.id = ts.ticketFk
WHERE ts.productionOrder = PACKING_ORDER
AND t.routeFk = vMyPath
AND t.warehouseFk = vMyWarehouse
AND t.id != vTicketid;
IF vExpeditionsCount = 1 THEN
SET vPosition = 'FIRST';
ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN
SET vPosition = 'LAST';
ELSEIF vRestTicketsPacking THEN
SET vPosition = 'SHARED';
ELSE
SET vPosition = 'MID';
END IF;
ELSE
SET vPosition = 'MID';
END IF;
RETURN vPosition;
END$$
DELIMITER ;

View File

@ -1,30 +0,0 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyPositiveBase`() RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
* Calcula si existe alguna base imponible positiva
* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
*
* returns BOOLEAN
*/
DECLARE hasAnyPositiveBase BOOLEAN;
CALL getTaxBases();
SELECT positive INTO hasAnyPositiveBase
FROM tmp.taxBases
LIMIT 1;
DROP TEMPORARY TABLE
tmp.ticketTax,
tmp.ticket,
tmp.taxBases;
RETURN hasAnyPositiveBase;
END$$
DELIMITER ;

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +0,0 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`() RETURNS tinyint(1)
DETERMINISTIC
BEGIN
/**
* Calcula si existe alguna base imponible negativa
* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
*
* returns BOOLEAN
*/
DECLARE hasAnyNegativeBase BOOLEAN;
CALL getTaxBases();
SELECT negative INTO hasAnyNegativeBase
FROM tmp.taxBases
LIMIT 1;
DROP TEMPORARY TABLE
tmp.ticketTax,
tmp.ticket,
tmp.taxBases;
RETURN hasAnyNegativeBase;
END$$
DELIMITER ;

View File

@ -1,27 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInsert`
BEFORE INSERT ON `expedition`
FOR EACH ROW
BEGIN
DECLARE intcounter INT;
DECLARE vShipFk INT;
SET NEW.editorFk = account.myUser_getId();
IF NEW.freightItemFk IS NOT NULL THEN
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
FROM expedition e
INNER JOIN ticket t1 ON e.ticketFk = t1.id
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped)
AND t1.warehouseFk = t2.warehouseFk
WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
AND t1.agencyModeFk = t2.agencyModeFk;
SET NEW.`counter` = intcounter;
END IF;
END$$
DELIMITER ;

View File

@ -1,58 +0,0 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`expeditionRoute_freeTickets` AS
SELECT
`t`.`routeFk` AS `routeFk`,
`tss`.`ticketFk` AS `ticket`,
`s`.`name` AS `code`,
`w`.`name` AS `almacen`,
`tss`.`updated` AS `updated`,
`p`.`code` AS `parkingCode`
FROM `vn`.`ticketState` `tss`
JOIN `vn`.`ticket` `t` ON `t`.`id` = `tss`.`ticketFk`
JOIN `vn`.`warehouse` `w` ON `w`.`id` = `t`.`warehouseFk`
JOIN `vn`.`state` `s` ON `s`.`id` = `tss`.`state`
LEFT JOIN `vn`.`ticketParking` `tp` ON `tp`.`ticketFk` = `t`.`id`
LEFT JOIN `vn`.`parking` `p` ON `p`.`id` = `tp`.`parkingFk`
WHERE IFNULL(`t`.`packages`, 0) = 0;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketState`
AS SELECT `tt`.`created` AS `updated`,
`tt`.`stateFk` AS `stateFk`,
`tt`.`userFk` AS `userFk`,
`tls`.`ticketFk` AS `ticketFk`,
`s`.`id` AS `state`,
`s`.`order` AS `productionOrder`,
`s`.`alertLevel` AS `alertLevel`,
`s`.`code` AS `code`,
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
`s`.`isPicked` AS `isPicked`
FROM (
(
`vn`.`ticketLastState` `tls`
JOIN `vn`.`ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
)
JOIN `vn`.`state` `s` ON(`s`.`id` = `tt`.`stateFk`)
);
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`ticketStateToday`
AS
SELECT
`ts`.`ticketFk` AS `ticket`,
`ts`.`state` AS `state`,
`ts`.`productionOrder` AS `productionOrder`,
`ts`.`alertLevel` AS `alertLevel`,
`ts`.`userFk` AS `worker`,
`ts`.`code` AS `code`,
`ts`.`updated` AS `updated`,
`ts`.`isPicked` AS `isPicked`
FROM
`vn`.`ticketState` `ts`
JOIN `vn`.`ticket` `t` ON `t`.`id` = `ts`.`ticketFk`
WHERE
`t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`VN_CURDATE`() + INTERVAL 1 DAY;

View File

@ -1,14 +0,0 @@
DELETE FROM salix.ACL
WHERE model = 'WorkerTimeControl'
AND property IN ('*','addTime');
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('WorkerTimeControl', 'addTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'deleteTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'updateTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'sendMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'updateWorkerTimeControlMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'weeklyHourRecordEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'getMailStates', 'READ', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'resendWeeklyHourEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,2 +0,0 @@
ALTER TABLE `vn`.`viaexpressConfig` ADD agencyModeFk int DEFAULT NULL NULL COMMENT 'Indica el agencyMode que es interdia';
ALTER TABLE `vn`.`viaexpressConfig` ADD CONSTRAINT viaexpressConfig_agencyMode_Fk FOREIGN KEY (agencyModeFK) REFERENCES vn.agencyMode(id) ON DELETE RESTRICT ON UPDATE RESTRICT;

View File

@ -1 +0,0 @@
ALTER TABLE `vn`.`item` DROP COLUMN stars;

View File

@ -1,4 +0,0 @@
REVOKE UPDATE ON TABLE `vn`.`item` FROM `employee`;
GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE `vn`.`item` TO `employee`;

View File

@ -1,12 +0,0 @@
ALTER TABLE `vn`.`company` MODIFY COLUMN `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'Cuenta por defecto para ingresos desde este pais';
ALTER TABLE `vn`.`supplierAccount`
ADD COLUMN `countryFk` mediumint(8) unsigned DEFAULT NULL,
ADD CONSTRAINT `fk_supplierAccount_country`
FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE;
ALTER TABLE `vn`.`supplierAccount`
ADD UNIQUE KEY `uk_supplier_country` (`supplierFk`, `countryFk`);

View File

@ -1,9 +0,0 @@
ALTER TABLE `vn`.`clientSms` ADD `ticketFk` int(11) NULL;
ALTER TABLE `vn`.`clientSms` ADD CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `vn`.`ticket`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
INSERT INTO`vn`.`clientSms` (`clientFk`, `smsFk`, `ticketFk`)
SELECT `t`.`clientFk`, `s`.`smsFk`, `s`.`ticketFk`
FROM `vn`.`clientSms` `s`
JOIN `vn`.`ticket` `t` ON `t`.`id` = `s`.`ticketFk`;
RENAME TABLE `vn`.`ticketSms` TO `vn`.`ticketSms__`;

View File

@ -1,74 +0,0 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
*
* @param vOriginDated Fecha en cuestión
* @param vFutureDated Fecha en el futuro a sondear
* @param vWarehouseFk Identificador de vn.warehouse
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT sv.ticketFk id,
sub2.id futureId,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
CAST(sum(litros) AS DECIMAL(10,0)) liters,
CAST(count(*) AS DECIMAL(10,0)) `lines`,
st.name state,
sub2.iptd futureIpt,
sub2.state futureState,
t.clientFk,
t.warehouseFk,
ts.alertLevel,
t.shipped,
t.totalWithVat,
sub2.shipped futureShipped,
t.workerFk,
st.code stateCode,
sub2.code futureStateCode,
st.classColor,
sub2.classColor futureClassColor
FROM vn.saleVolume sv
JOIN vn.sale s ON s.id = sv.saleFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.ticket t ON t.id = sv.ticketFk
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.alertLevel al ON al.id = ts.alertLevel
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN (
SELECT *
FROM (
SELECT
t.addressFk,
t.id,
t.shipped,
st.name state,
st.code,
st.classColor,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
FROM vn.ticket t
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
WHERE t.shipped BETWEEN vFutureDated
AND util.dayend(vFutureDated)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) sub
GROUP BY sub.addressFk
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
AND t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND tp.ticketFk IS NULL
GROUP BY sv.ticketFk
HAVING futureId;
END$$
DELIMITER ;

View File

@ -1,6 +0,0 @@
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) VALUES
('VnRole','*','READ','ALLOW','ROLE','employee'),
('VnRole','*','WRITE','ALLOW','ROLE','it');
DELETE FROM`salix`.`ACL` WHERE model='Role';

View File

@ -1,2 +0,0 @@
ALTER TABLE `vn`.`productionConfig` ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa';
UPDATE IGNORE `vn`.`productionConfig` SET itemPreviousDefaultSize = 40 WHERE id = 1;

View File

@ -1,9 +0,0 @@
UPDATE `vn`.`supplierAccount` sa
JOIN `vn`.`country` c ON sa.countryFk = c.id AND c.code = 'FR'
SET countryFk = c.id
WHERE iban = 'FR7630003012690002801121597';
UPDATE `vn`.`supplierAccount` sa
JOIN `vn`.`country` c ON sa.countryFk = c.id AND c.code = 'PT'
SET countryFk = c.id
WHERE iban = 'PT50001000005813059150168';

View File

@ -1,59 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInsert`
BEFORE INSERT ON `invoiceOut`
FOR EACH ROW
BEGIN
/**
* Generates the next reference for the invoice serial. There cannot be gaps
* between identifiers of the same serial!
*
* Reference format:
* {0} Invoice serial
* {1} The company code
* {2-3} Last two digits of issue year
* {4-$} Autoincrement identifier
*/
DECLARE vRef INT DEFAULT 0;
DECLARE vRefLen INT;
DECLARE vRefPrefix VARCHAR(255);
DECLARE vLastRef VARCHAR(255);
DECLARE vCompanyCode INT;
DECLARE vYearLen INT DEFAULT 2;
DECLARE vPrefixLen INT;
SELECT companyCode INTO vCompanyCode
FROM company
WHERE id = NEW.companyFk;
IF vCompanyCode IS NULL THEN
CALL util.throw('companyCodeNotDefined');
END IF;
SELECT MAX(i.ref) INTO vLastRef
FROM invoiceOut i
WHERE i.serial = NEW.serial
AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.lastDayOfYear(NEW.issued)
AND i.companyFk = NEW.companyFk;
IF vLastRef IS NOT NULL THEN
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
SET vRefPrefix = LEFT(vLastRef, vPrefixLen);
SET vRef = RIGHT(vLastRef, vRefLen);
ELSE
SELECT refLen INTO vRefLen FROM invoiceOutConfig;
SET vRefPrefix = CONCAT(
NEW.serial,
vCompanyCode,
RIGHT(YEAR(NEW.issued), vYearLen)
);
END IF;
SET vRef = vRef + 1;
IF LENGTH(vRef) > vRefLen THEN
CALL util.throw('refIdLenExceeded');
END IF;
SET NEW.ref = CONCAT(vRefPrefix, LPAD(vRef, vRefLen, '0'));
END$$
DELIMITER ;

View File

@ -1,589 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_calculateComponent`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
* Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes
*
* @param vSelf Id de la venta
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
SELECT s.id
FROM sale s
WHERE s.id = vSelf;
CALL sale_recalcComponent(vOption);
DROP TEMPORARY TABLE tmp.recalculateSales;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME)
BEGIN
/**
* Comprueba que las ventas creadas entre un rango de fechas tienen componentes
*
* @param vCreatedFrom inicio del rango
* @param vCreatedTo fin del rango
*/
DECLARE v_done BOOL DEFAULT FALSE;
DECLARE vSaleFk INTEGER;
DECLARE vTicketFk INTEGER;
DECLARE vConcept VARCHAR(50);
DECLARE vCur CURSOR FOR
SELECT s.id
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN item i ON i.id = s.itemFk
JOIN itemType tp ON tp.id = i.typeFk
JOIN itemCategory ic ON ic.id = tp.categoryFk
LEFT JOIN tmp.coste c ON c.id = s.id
WHERE s.created >= vCreatedFrom AND s.created <= vCreatedTo
AND c.id IS NULL
AND t.agencyModeFk IS NOT NULL
AND t.isDeleted IS FALSE
AND t.warehouseFk = 60
AND ic.merchandise != FALSE
GROUP BY s.id;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET v_done = TRUE;
DROP TEMPORARY TABLE IF EXISTS tmp.coste;
DROP TEMPORARY TABLE IF EXISTS tmp.coste;
CREATE TEMPORARY TABLE tmp.coste
(PRIMARY KEY (id)) ENGINE = MEMORY
SELECT s.id
FROM sale s
JOIN item i ON i.id = s.itemFk
JOIN itemType tp ON tp.id = i.typeFk
JOIN itemCategory ic ON ic.id = tp.categoryFk
JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 6
WHERE s.created >= vCreatedFrom
AND ic.merchandise != FALSE;
OPEN vCur;
l: LOOP
SET v_done = FALSE;
FETCH vCur INTO vSaleFk;
IF v_done THEN
LEAVE l;
END IF;
SELECT ticketFk, concept
INTO vTicketFk, vConcept
FROM sale
WHERE id = vSaleFk;
CALL sale_calculateComponent(vSaleFk, 'renewPrices');
END LOOP;
CLOSE vCur;
DROP TEMPORARY TABLE tmp.coste;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_recalcComponent`(vOption VARCHAR(25))
proc: BEGIN
/**
* Este procedimiento recalcula los componentes de un conjunto de sales,
* eliminando los componentes existentes e insertandolos de nuevo
*
* @param vOption si no se quiere forzar llamar con NULL
* @table tmp.recalculateSales (id)
*/
DECLARE vShipped DATE;
DECLARE vWarehouseFk SMALLINT;
DECLARE vAgencyModeFk INT;
DECLARE vAddressFk INT;
DECLARE vTicketFk INT;
DECLARE vLanded DATE;
DECLARE vIsEditable BOOLEAN;
DECLARE vZoneFk INTEGER;
DECLARE vDone BOOL DEFAULT FALSE;
DECLARE vCur CURSOR FOR
SELECT DISTINCT s.ticketFk
FROM tmp.recalculateSales rs
JOIN vn.sale s ON s.id = rs.id;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
OPEN vCur;
l: LOOP
SET vDone = FALSE;
FETCH vCur INTO vTicketFk;
IF vDone THEN
LEAVE l;
END IF;
SELECT (hasToRecalcPrice OR ts.alertLevel IS NULL) AND t.refFk IS NULL,
t.zoneFk,
t.warehouseFk,
t.shipped,
t.addressFk,
t.agencyModeFk,
t.landed
INTO vIsEditable,
vZoneFk,
vWarehouseFk,
vShipped,
vAddressFk,
vAgencyModeFk,
vLanded
FROM ticket t
LEFT JOIN ticketState ts ON t.id = ts.ticketFk
LEFT JOIN alertLevel al ON al.id = ts.alertLevel
WHERE t.id = vTicketFk;
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
IF NOT EXISTS (SELECT TRUE FROM tmp.zoneGetLanded LIMIT 1) THEN
CALL util.throw(CONCAT('There is no zone for these parameters ', vTicketFk));
END IF;
IF vLanded IS NULL OR vZoneFk IS NULL THEN
UPDATE ticket t
SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
WHERE t.id = vTicketFk AND t.landed IS NULL;
IF vZoneFk IS NULL THEN
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
UPDATE ticket t
SET t.zoneFk = vZoneFk
WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
END IF;
END IF;
DROP TEMPORARY TABLE tmp.zoneGetLanded;
-- rellena la tabla buyUltimate con la ultima compra
CALL buyUltimate (vWarehouseFk, vShipped);
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
SELECT s.id saleFk, vWarehouseFk warehouseFk
FROM sale s
JOIN tmp.recalculateSales rs ON s.id = rs.id
WHERE s.ticketFk = vTicketFk;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketLot
SELECT vWarehouseFk warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
FROM sale s
JOIN tmp.recalculateSales rs ON s.id = rs.id
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
WHERE s.ticketFk = vTicketFk
GROUP BY s.itemFk;
CALL catalog_componentPrepare();
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
IF vOption IS NULL THEN
SET vOption = IF(vIsEditable, 'renewPrices', 'imbalance');
END IF;
CALL ticketComponentUpdateSale(vOption);
CALL catalog_componentPurge();
DROP TEMPORARY TABLE tmp.buyUltimate;
DROP TEMPORARY TABLE tmp.sale;
END LOOP;
CLOSE vCur;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
BEGIN
/*
* Recalcula los componentes un ticket clonado,
* las lineas a precio cero fuerza para que tengan precio, el resto lo respeta
* @param vTicketNew nuevo ticket clonado
* @param vTicketOld icket original, a partir del qual se clonara el nuevo
*/
REPLACE INTO orderTicket(orderFk,ticketFk)
SELECT orderFk, vTicketNew
FROM orderTicket
WHERE ticketFk = vTicketOld;
-- Bionizamos lineas con Preu = 0
CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
(PRIMARY KEY (id)) ENGINE = MEMORY
SELECT id
FROM sale
WHERE ticketFk = vTicketNew AND price = 0;
CALL sale_recalcComponent('renewPrices');
-- Bionizamos lineas con Preu > 0
CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
(PRIMARY KEY (id)) ENGINE = MEMORY
SELECT id
FROM sale
WHERE ticketFk = vTicketNew AND price > 0;
CALL sale_recalcComponent('imbalance');
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpdate`(
vTicketFk INT,
vClientFk INT,
vAgencyModeFk INT,
vAddressFk INT,
vWarehouseFk TINYINT,
vCompanyFk SMALLINT,
vShipped DATETIME,
vLanded DATE,
vIsDeleted BOOLEAN,
vHasToBeUnrouted BOOLEAN,
vOption VARCHAR(25))
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
START TRANSACTION;
IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
UPDATE ticket t
JOIN address a ON a.id = vAddressFk
SET t.nickname = a.nickname
WHERE t.id = vTicketFk;
END IF;
UPDATE ticket t
SET
t.clientFk = vClientFk,
t.agencyModeFk = vAgencyModeFk,
t.addressFk = vAddressFk,
t.warehouseFk = vWarehouseFk,
t.companyFk = vCompanyFk,
t.landed = vLanded,
t.shipped = vShipped,
t.isDeleted = vIsDeleted
WHERE
t.id = vTicketFk;
IF vHasToBeUnrouted THEN
UPDATE ticket t SET t.routeFk = NULL
WHERE t.id = vTicketFk;
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
CREATE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (saleFk))
ENGINE = MEMORY
SELECT id AS saleFk, vWarehouseFk warehouseFk
FROM sale s WHERE s.ticketFk = vTicketFk;
CALL ticketComponentUpdateSale (vOption);
DROP TEMPORARY TABLE tmp.sale;
COMMIT;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpdateSale`(vCode VARCHAR(25))
BEGIN
/**
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
* y modifica el campo Preu de la tabla Movimientos
*
* @param i_option integer tipo de actualizacion
* @param table tmp.sale tabla memory con el campo saleFk, warehouseFk
**/
DECLARE vComponentFk INT;
IF vCode <> 'renewPrices' THEN
SELECT id INTO vComponentFk FROM component WHERE `code` = vCode;
END IF;
DELETE sc.*
FROM tmp.sale tmps
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
JOIN `component` c ON c.id = sc.componentFk
WHERE c.isRenewable;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, tc.componentFk, tc.cost
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
AND sc.componentFk = tc.componentFk
LEFT JOIN `component` c ON c.id = tc.componentFk
WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
-- Añadir componente venta por paquete
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT t.id, t.componentFk, t.cost
FROM (
SELECT s.id, tc.componentFk, tc.cost, MOD(s.quantity, b.packing) as resto
FROM vn.sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND tmps.warehouseFk = lb.warehouse_id
JOIN vn.buy b ON b.id = buy_id
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
JOIN `component` c ON c.id = tc.componentFk AND c.code = 'salePerPackage'
LEFT JOIN (
SELECT s.id
FROM vn.sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk
JOIN `component` c ON c.id = sc.componentFk AND c.code = 'lastUnitsDiscount'
) tp ON tp.id = s.id
WHERE tp.id IS NULL
HAVING resto <> 0) t;
IF vCode <> 'renewPrices' THEN
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE sc.saleFk <> vComponentFk
GROUP BY s.id
HAVING dif <> 0;
ELSE
UPDATE sale s
JOIN item i on i.id = s.itemFk
JOIN itemType it on it.id = i.typeFk
JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
FROM saleComponent sc
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
SET s.price = sumValue / ((100 - s.discount) / 100)
WHERE it.code != 'PRT' ;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE sc.componentFk != 21
GROUP BY s.id
HAVING ROUND(saleValue, 4) <> 0;
END IF;
UPDATE sale s
JOIN (
SELECT SUM(sc.value) sumValue, sc.saleFk
FROM saleComponent sc
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
JOIN `component` c ON c.id = sc.componentFk
JOIN componentType ct on ct.id = c.typeFk AND ct.isBase
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
SET s.priceFixed = sumValue, s.isPriceFixed = 1;
DELETE sc.*
FROM saleComponent sc
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
JOIN sale s on s.id = sc.saleFk
JOIN item i ON i.id = s.itemFk
JOIN itemType it ON it.id = i.typeFk
WHERE it.code = 'PRT';
INSERT INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 15, s.price
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN item i ON i.id = s.itemFK
JOIN itemType it ON it.id = i.typeFk
WHERE it.code = 'PRT' AND s.price > 0;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
BEGIN
/**
* Comprueba que los tickets entre un rango de fechas tienen componentes
* y recalcula sus componentes
*
* @param vShippedFrom rango inicial de fecha
* @param vShippedTo rango final de fecha
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.coste
(primary key (id)) ENGINE = MEMORY
SELECT s.id
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN itemType tp ON tp.id = i.typeFk
JOIN itemCategory ic ON ic.id = tp.categoryFk
JOIN saleComponent sc ON sc.saleFk = s.id
JOIN component c ON c.id = sc.componentFk
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1
WHERE t.shipped BETWEEN vShippedFrom AND vShippedTo
AND ic.merchandise;
CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
(primary key (id)) ENGINE = MEMORY
SELECT DISTINCT s.id
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN itemType tp ON tp.id = i.typeFk
JOIN itemCategory ic ON ic.id = tp.categoryFk
LEFT JOIN tmp.coste c ON c.id = s.id
WHERE t.shipped >= vShippedFrom AND t.shipped <= vShippedTo
AND c.id IS NULL
AND ic.merchandise;
CALL sale_recalcComponent('renewPrices');
DROP TEMPORARY TABLE tmp.recalculateSales;
DROP TEMPORARY TABLE tmp.coste;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_componentMakeUpdate`(
vTicketFk INT,
vClientFk INT,
vNickname VARCHAR(50),
vAgencyModeFk INT,
vAddressFk INT,
vZoneFk INT,
vWarehouseFk INT,
vCompanyFk INT,
vShipped DATETIME,
vLanded DATE,
vIsDeleted BOOLEAN,
vHasToBeUnrouted BOOLEAN,
vOption VARCHAR(25))
BEGIN
/**
* Modifica en el ticket los campos que se le pasan por parámetro
* y cambia sus componentes
*
* @param vTicketFk Id del ticket a modificar
* @param vClientFk nuevo cliente
* @param vNickname nuevo alias
* @param vAgencyModeFk nueva agencia
* @param vAddressFk nuevo consignatario
* @param vZoneFk nueva zona
* @param vWarehouseFk nuevo almacen
* @param vCompanyFk nueva empresa
* @param vShipped nueva fecha del envio de mercancia
* @param vLanded nueva fecha de recepcion de mercancia
* @param vIsDeleted si se borra el ticket
* @param vHasToBeUnrouted si se le elimina la ruta al ticket
* @param vOption opcion para el case del proc ticketComponentUpdateSale
*/
DECLARE vPrice DECIMAL(10,2);
DECLARE vBonus DECIMAL(10,2);
CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
UPDATE ticket t
JOIN address a ON a.id = vAddressFk
SET t.nickname = a.nickname
WHERE t.id = vTicketFk;
END IF;
CALL zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, TRUE);
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
FROM tmp.zoneGetShipped
WHERE shipped BETWEEN DATE(vShipped) AND util.dayEnd(vShipped) AND warehouseFk = vWarehouseFk LIMIT 1;
UPDATE ticket t
SET
t.clientFk = vClientFk,
t.nickname = vNickname,
t.agencyModeFk = vAgencyModeFk,
t.addressFk = vAddressFk,
t.zoneFk = vZoneFk,
t.zonePrice = vPrice,
t.zoneBonus = vBonus,
t.warehouseFk = vWarehouseFk,
t.companyFk = vCompanyFk,
t.landed = vLanded,
t.shipped = vShipped,
t.isDeleted = vIsDeleted
WHERE
t.id = vTicketFk;
IF vHasToBeUnrouted THEN
UPDATE ticket t SET t.routeFk = NULL
WHERE t.id = vTicketFk;
END IF;
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
CREATE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (saleFk))
ENGINE = MEMORY
SELECT id AS saleFk, vWarehouseFk warehouseFk
FROM sale s WHERE s.ticketFk = vTicketFk;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
CREATE TEMPORARY TABLE tmp.ticketComponent
SELECT * FROM tmp.ticketComponentPreview;
CALL ticketComponentUpdateSale (vOption);
DROP TEMPORARY TABLE tmp.sale;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
* Crea tabla temporal para sale_recalcComponent() para recalcular los componentes
*
* @param vSelf Id del ticket
* @param vOption si no se quiere forzar llamar con NULL
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
SELECT s.id
FROM sale s
WHERE s.ticketFk = vSelf;
CALL sale_recalcComponent(vOption);
DROP TEMPORARY TABLE tmp.recalculateSales;
END$$
DELIMITER ;
TRUNCATE TABLE `vn`.`ticketUpdateAction`;
INSERT INTO `vn`.`ticketUpdateAction` (id, description, code) VALUES(1, 'Cambiar los precios en el ticket', 'renewPrices');
INSERT INTO `vn`.`ticketUpdateAction` (id, description, code) VALUES(2, 'Convertir en maná', 'mana');

View File

@ -4,52 +4,8 @@ USE `util`;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL);
INSERT INTO `version` VALUES ('vn-database','10806','f73a447391b7541f41e3be2ccc05327c1254578e','2024-01-04 08:36:01','10808');
INSERT INTO `version` VALUES ('vn-database','10818','c156178ea565d81485769882618e122d9cba5d4e','2024-01-25 10:00:48','10831');
INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10097','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10103','00-awbVolume.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10104','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:12:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10105','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10113','00-firstScript.sql','jenkins@10.0.2.69','2022-05-05 10:13:00',NULL,NULL);
@ -74,7 +30,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','10141','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10142','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10143','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:20:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10144','00-AfegirFKPArt1.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10144','00-firstScript.sql','jenkins@10.0.2.68','2022-05-13 09:44:25',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10147','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10149','00-firstScript.sql','jenkins@10.0.2.68','2022-05-20 09:22:33',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10150','00-firstScript.sql','jenkins@10.0.2.68','2022-05-17 09:57:16',NULL,NULL);
@ -131,7 +86,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','10207','00-Alter_table_entry.sql
INSERT INTO `versionLog` VALUES ('vn-database','10207','01-Update_invoiceAmount.sql','jenkins@10.0.2.69','2022-06-16 07:23:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10208','00-firstScript.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10209','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 08:47:40',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10210','00-firstScript.sql','jenkins@10.0.2.69','2022-06-16 17:39:17',1046,'Base de datos no seleccionada');
INSERT INTO `versionLog` VALUES ('vn-database','10211','01-firstScript.sql','jenkins@10.0.2.69','2022-06-17 07:11:27',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10215','00-renameIsInventory.sql','jenkins@10.0.2.69','2022-06-30 09:31:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10216','00-firstScript.sql','jenkins@10.0.2.69','2022-06-23 11:15:28',NULL,NULL);
@ -473,7 +427,6 @@ INSERT INTO `versionLog` VALUES ('vn-database','10633','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10634','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-06 12:15:55',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10637','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-15 12:30:19',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10640','00-companyFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10640','00-updateCompany.sql','jenkins@db-proxy1.static.verdnatura.es','2023-06-07 14:22:13',1205,'Tiempo de espera de bloqueo excedido; intente rearrancar la transacción');
INSERT INTO `versionLog` VALUES ('vn-database','10640','01-companyFkAi.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:43:23',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10640','02-companyFkCreate.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:47:04',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10640','04-supplierFkDrop.sql','jenkins@db-proxy2.static.verdnatura.es','2023-06-07 14:48:30',NULL,NULL);
@ -544,7 +497,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10718','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10719','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-01 12:53:30',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10720','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:22',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10721','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10722','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-09 13:00:29',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10724','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:28',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10725','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-09-12 14:15:14',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10726','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 15:32:20',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10727','00-addPrinterField.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-21 09:42:29',NULL,NULL);
@ -558,6 +511,9 @@ INSERT INTO `versionLog` VALUES ('vn-database','10727','07-AddFieldsToPackingSit
INSERT INTO `versionLog` VALUES ('vn-database','10730','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-15 11:42:48',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10733','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-05 09:54:00',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10736','00-workerBossNull.sql','jenkins@db-proxy1.static.verdnatura.es','2023-09-22 00:02:05',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10738','00-addFieldToTravel.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10738','01-copyDataToTravel.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:31',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10738','03-deprecateDuaAwbFk.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10739','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-10-10 10:19:07',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10740','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:26',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10741','01-refactorCplusTrascendency472.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-02 09:13:27',NULL,NULL);
@ -582,7 +538,9 @@ INSERT INTO `versionLog` VALUES ('vn-database','10756','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10757','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10758','00-sectorType.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10758','01-dipole.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:17:18',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10758','02-agencyMode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10761','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-16 09:30:58',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10764','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-04 12:07:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10768','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10771','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:37',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10773','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL);
@ -590,6 +548,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10775','00-firstScript.sql','jen
INSERT INTO `versionLog` VALUES ('vn-database','10778','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2023-11-30 13:11:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10782','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:18:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10783','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-11-24 14:49:17',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10784','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10785','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:33:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10785','02-invoiceIn.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:33:38',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10785','02-invoiceInTax.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-14 12:33:39',NULL,NULL);
@ -599,7 +558,23 @@ INSERT INTO `versionLog` VALUES ('vn-database','10792','00-buy.sql','jenkins@db-
INSERT INTO `versionLog` VALUES ('vn-database','10798','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:21:14',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10799','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2023-12-26 12:00:59',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10800','00-firstScript.sql','jenkins@db-proxy2.static.verdnatura.es','2024-01-03 10:21:16',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10801','00-firstScript.sql','jenkins@test-db-proxy1.servers.dc.verdnatura.es','2024-01-11 05:53:13',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10806','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2024-01-03 11:56:05',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10808','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10809','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:32',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10810','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2024-01-04 14:29:30',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10811','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10812','00-update.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10812','01-delete.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10812','02-rename.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10812','03-changePosition.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10812','04-unique.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10813','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10815','00-firstScript.sql','jenkins@db-proxy1.static.verdnatura.es','2024-01-09 18:11:57',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10816','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10817','00-invoiceOutConfig_refLen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-24 21:47:35',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10818','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-25 09:00:36',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10827','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-23 12:32:13',NULL,NULL);
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@ -693,6 +668,7 @@ INSERT INTO `role` VALUES (123,'deliveryAssistant','Jefe auxiliar repartos',1,'2
INSERT INTO `role` VALUES (124,'hrBuyer','Recursos Humanos con Buyer',1,'2023-10-23 13:50:43','2023-10-23 13:50:43',NULL);
INSERT INTO `role` VALUES (125,'claimViewer','Trabajadores que consulta las reclamaciones ',1,'2023-11-16 09:14:46','2023-11-16 09:14:46',10578);
INSERT INTO `role` VALUES (126,'greenhouseBoss','Jefe de invernadero',1,'2023-11-16 14:32:13','2023-11-16 14:32:13',NULL);
INSERT INTO `role` VALUES (127,'timeControl','Tablet para fichar',1,'2024-01-09 16:36:56','2024-01-09 16:36:56',NULL);
INSERT INTO `roleInherit` VALUES (1,1,2,NULL);
INSERT INTO `roleInherit` VALUES (2,1,3,NULL);
@ -729,7 +705,6 @@ INSERT INTO `roleInherit` VALUES (37,34,1,NULL);
INSERT INTO `roleInherit` VALUES (38,34,13,NULL);
INSERT INTO `roleInherit` VALUES (39,34,33,NULL);
INSERT INTO `roleInherit` VALUES (40,35,1,NULL);
INSERT INTO `roleInherit` VALUES (41,36,44,NULL);
INSERT INTO `roleInherit` VALUES (42,36,47,NULL);
INSERT INTO `roleInherit` VALUES (43,37,1,NULL);
INSERT INTO `roleInherit` VALUES (44,38,37,NULL);
@ -912,7 +887,6 @@ INSERT INTO `roleInherit` VALUES (281,5,18,NULL);
INSERT INTO `roleInherit` VALUES (282,50,60,NULL);
INSERT INTO `roleInherit` VALUES (283,5,21,NULL);
INSERT INTO `roleInherit` VALUES (285,58,76,NULL);
INSERT INTO `roleInherit` VALUES (287,69,58,NULL);
INSERT INTO `roleInherit` VALUES (288,115,66,NULL);
INSERT INTO `roleInherit` VALUES (290,104,115,NULL);
INSERT INTO `roleInherit` VALUES (291,115,103,NULL);
@ -954,6 +928,10 @@ INSERT INTO `roleInherit` VALUES (350,49,75,NULL);
INSERT INTO `roleInherit` VALUES (351,72,35,NULL);
INSERT INTO `roleInherit` VALUES (353,110,49,NULL);
INSERT INTO `roleInherit` VALUES (354,103,119,NULL);
INSERT INTO `roleInherit` VALUES (355,127,11,NULL);
INSERT INTO `roleInherit` VALUES (356,123,125,NULL);
INSERT INTO `roleInherit` VALUES (357,36,35,NULL);
INSERT INTO `roleInherit` VALUES (358,36,49,NULL);
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
@ -1098,13 +1076,11 @@ INSERT INTO `ACL` VALUES (165,'TicketDms','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative');
INSERT INTO `ACL` VALUES (172,'Sms','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (173,'Sms','send','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (176,'Device','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (177,'Device','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (179,'ItemLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (180,'RouteLog','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee');
@ -1521,13 +1497,10 @@ INSERT INTO `ACL` VALUES (657,'Supplier','getItemsPackaging','READ','ALLOW','ROL
INSERT INTO `ACL` VALUES (658,'Ticket','closeAll','WRITE','ALLOW','ROLE','system');
INSERT INTO `ACL` VALUES (659,'Account','*','*','ALLOW','ROLE','developerBoss');
INSERT INTO `ACL` VALUES (664,'MailForward','*','*','ALLOW','ROLE','itManagement');
INSERT INTO `ACL` VALUES (665,'Role','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (666,'Role','*','WRITE','ALLOW','ROLE','it');
INSERT INTO `ACL` VALUES (667,'VnUser','*','*','ALLOW','ROLE','itManagement');
INSERT INTO `ACL` VALUES (668,'VnUser','__get__preview','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (669,'VnUser','preview','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (670,'VnUser','create','*','ALLOW','ROLE','itManagement');
INSERT INTO `ACL` VALUES (671,'VnUser','renewToken','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (672,'PackingSiteAdvanced','*','*','ALLOW','ROLE','production');
INSERT INTO `ACL` VALUES (673,'InvoiceOut','makePdfAndNotify','WRITE','ALLOW','ROLE','invoicing');
INSERT INTO `ACL` VALUES (674,'InvoiceOutConfig','*','READ','ALLOW','ROLE','invoicing');
@ -1568,8 +1541,8 @@ INSERT INTO `ACL` VALUES (713,'Client','__get__addresses','READ','ALLOW','ROLE',
INSERT INTO `ACL` VALUES (714,'ExpeditionMistakeType','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (715,'WorkerMistakeType','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (716,'ExpeditionMistake','*','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (717,'WorkerMistake','*','WRITE','ALLOW','ROLE','coolerBoss');
INSERT INTO `ACL` VALUES (718,'MistakesTypes','*','WRITE','ALLOW','ROLE','coolerBoss');
INSERT INTO `ACL` VALUES (717,'WorkerMistake','*','WRITE','ALLOW','ROLE','coolerAssist');
INSERT INTO `ACL` VALUES (718,'MistakesTypes','*','WRITE','ALLOW','ROLE','coolerAssist');
INSERT INTO `ACL` VALUES (719,'MistakeType','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (720,'MachineWorker','*','READ','ALLOW','ROLE','coolerAssist');
INSERT INTO `ACL` VALUES (721,'Printer','*','READ','ALLOW','ROLE','employee');
@ -1608,7 +1581,7 @@ INSERT INTO `ACL` VALUES (754,'Route','find','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (755,'Route','findById','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (756,'Route','findOne','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (757,'Route','getRoutesByWorker','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (758,'Route','canViewAllRoute','READ','ALLOW','ROLE','deliveryBoss');
INSERT INTO `ACL` VALUES (758,'Route','canViewAllRoute','READ','ALLOW','ROLE','deliveryAssistant');
INSERT INTO `ACL` VALUES (759,'Route','cmr','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (760,'Route','downloadCmrsZip','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (761,'Route','downloadZip','READ','ALLOW','ROLE','employee');
@ -1622,6 +1595,21 @@ INSERT INTO `ACL` VALUES (768,'Route','guessPriority','WRITE','ALLOW','ROLE','em
INSERT INTO `ACL` VALUES (769,'Route','insertTicket','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (770,'Route','getDeliveryPoint','READ','ALLOW','ROLE','deliveryBoss');
INSERT INTO `ACL` VALUES (771,'Route','summary','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (772,'Route','getExpeditionSummary','READ','ALLOW','ROLE','delivery');
INSERT INTO `ACL` VALUES (773,'WorkerTimeControl','login','READ','ALLOW','ROLE','timeControl');
INSERT INTO `ACL` VALUES (774,'WorkerTimeControl','getClockIn','READ','ALLOW','ROLE','timeControl');
INSERT INTO `ACL` VALUES (775,'WorkerTimeControl','clockIn','WRITE','ALLOW','ROLE','timeControl');
INSERT INTO `ACL` VALUES (776,'WorkerTimeControl','addTimeEntry','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (777,'WorkerTimeControl','deleteTimeEntry','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (778,'WorkerTimeControl','updateTimeEntry','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (779,'WorkerTimeControl','sendMail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (780,'WorkerTimeControl','updateWorkerTimeControlMail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (781,'WorkerTimeControl','weeklyHourRecordEmail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (782,'WorkerTimeControl','getMailStates','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (783,'WorkerTimeControl','resendWeeklyHourEmail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (784,'VnRole','*','READ','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it');
INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery');
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
@ -1941,7 +1929,7 @@ INSERT INTO `continent` VALUES (3,'África','AF');
INSERT INTO `continent` VALUES (4,'Europa','EU');
INSERT INTO `continent` VALUES (5,'Oceanía','OC');
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,104,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,106,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL);
INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL);
@ -1952,28 +1940,28 @@ INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,33,NULL,72,1,1,1,10,1
INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',34,35,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',36,59,NULL,0,0,0,1,11,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',60,61,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',66,67,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (43,'VT','VENTAS',36,61,NULL,0,0,0,1,12,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (44,'management','GERENCIA',62,63,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',64,65,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (46,'delivery','REPARTO',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',68,69,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL);
INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',76,79,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (61,NULL,'VNH',84,87,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (58,'CMP','CAMPOS',78,81,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',84,85,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (61,NULL,'VNH',86,89,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',90,91,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',90,91,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',92,93,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',37,38,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',92,93,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',94,95,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (90,NULL,'TRAILER',85,86,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (89,NULL,'COORDINACION',96,97,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (90,NULL,'TRAILER',87,88,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',39,40,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',41,42,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
@ -1981,18 +1969,19 @@ INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',43,44,4667,0,0,0,2,
INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',45,46,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',47,48,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',49,50,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',96,97,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',51,52,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL);
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',77,78,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',79,80,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL);
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',53,54,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',55,56,1731,72,0,0,2,0,43,'/1/43/','fra_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (134,NULL,'EQUIPO RODRI',57,58,6264,0,0,0,2,0,43,'/1/43/','rhr_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',98,99,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (137,'sorter','SORTER',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',100,101,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',102,103,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (137,'sorter','SORTER',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL);
INSERT INTO `department` VALUES (139,NULL,'EQUIPO MIRIAM MAR 2',59,60,3803,0,0,0,2,0,43,'/1/43/','mir2_equipo',1,'gestioncomercial@verdnatura.es',1,0,0,0,NULL,NULL);
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
@ -2287,8 +2276,8 @@ INSERT INTO `state` VALUES (37,'Previa Revisado',3,0,'PREVIOUS_CONTROLLED',2,29,
INSERT INTO `state` VALUES (38,'Prep Cámara',6,1,'COOLER_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
INSERT INTO `state` VALUES (41,'Prep Parcial',6,1,'PARTIAL_PREPARATION',7,14,0,0,0,2,0,0,2,0,'warning');
INSERT INTO `ticketUpdateAction` VALUES (1,'Cambiar los precios en el ticket','changePrice');
INSERT INTO `ticketUpdateAction` VALUES (3,'Convertir en maná','turnInMana');
INSERT INTO `ticketUpdateAction` VALUES (1,'Cambiar los precios en el ticket','renewPrices');
INSERT INTO `ticketUpdateAction` VALUES (2,'Convertir en maná','mana');
INSERT INTO `volumeConfig` VALUES (2.67,1.60,0.8,150,0.30,120,57,2.0,50,200,10,167.0);
@ -2303,7 +2292,15 @@ INSERT INTO `workCenter` VALUES (8,'Silla-Agrario',26,NULL,NULL,NULL,NULL,NULL);
INSERT INTO `workCenter` VALUES (9,'Algemesi',20,1354,60,'Fenollars, 2',523549,NULL);
INSERT INTO `workCenter` VALUES (10,'Rubi',88,NULL,84,'Av. de la Llana, 131',549722,NULL);
INSERT INTO `workerBusinessAgreement` VALUES (1,'Flores y Plantas',2.5,1830,'2012-01-01',NULL);
INSERT INTO `workerTimeControlError` VALUES (1,'IS_NOT_ALLOWED_FUTURE','No se permite fichar a futuro');
INSERT INTO `workerTimeControlError` VALUES (2,'INACTIVE_BUSINESS','No hay un contrato en vigor');
INSERT INTO `workerTimeControlError` VALUES (3,'IS_NOT_ALLOWED_WORK','No está permitido trabajar');
INSERT INTO `workerTimeControlError` VALUES (4,'ODD_WORKERTIMECONTROL','Fichadas impares');
INSERT INTO `workerTimeControlError` VALUES (5,'DAY_MAX_TIME','Superado el tiempo máximo entre entrada y salida');
INSERT INTO `workerTimeControlError` VALUES (6,'BREAK_DAY','Descanso diario');
INSERT INTO `workerTimeControlError` VALUES (7,'BREAK_WEEK','Descanso semanal');
INSERT INTO `workerTimeControlError` VALUES (8,'WRONG_DIRECTION','Dirección incorrecta');
INSERT INTO `workerTimeControlError` VALUES (9,'UNDEFINED_ERROR','Error sin definir');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

View File

@ -676,7 +676,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','glsExpedition__','
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','postCode','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','pgcMaster','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','itemBarcode','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Facturas','guillermo@10.5.1.4','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -701,11 +700,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInTax
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceOut','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','invoiceOut','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceOutExpense','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','item','alexm@%','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','item','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceOutSerial','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceOutTax','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','item','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemBarcode','alexm@%','0000-00-00 00:00:00','Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','itemBarcode','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','itemBotanical','alexm@%','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBotanicalWithGenus','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemCategory','alexm@%','0000-00-00 00:00:00','Select','');
@ -774,7 +773,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','noticeSubscripti
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','noticeCategory','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','noticeCategory','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mrwServiceWeekday','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','mrw','alexm@%','0000-00-00 00:00:00','Select,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','mrw','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mrwService','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppePlan','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','accountingConfig','alexm@%','0000-00-00 00:00:00','Select','');
@ -911,8 +910,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','manager','supplier','alexm@%'
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierAccount','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierAgencyTerm','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','supplierAgencyTerm','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','supplierExpense','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','supplierExpense','alexm@%','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','supplierExpense','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','ticketService','alexm@%','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ticketService','jgallego@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','sendingServiceWeekday','jenkins@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1152,6 +1150,10 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketLastState','g
INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','myAddress','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','tag','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemTag','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','handmadeBoss','Tipos','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','saleBuy','carlosap@10.5.1.6','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','orderTicket','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','negativeOrigin','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','route','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemPackingType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','expedition','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
@ -1218,7 +1220,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','farmingInvoi
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','routesMonitor','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','','Update');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','routeCommission','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','expeditionState','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','warehouse','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','warehouse','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimBeginning','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','invoicing','vehiclePlateRegex','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','businessSchedule','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
@ -1337,6 +1339,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimState','juan@d
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','company','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','buffer','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','greuge','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','');
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','','Select,Update');
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
@ -1475,6 +1478,67 @@ INSERT IGNORE INTO `columns_priv` VALUES ('','vn','salesAssistant','sale','edit
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','deliveryAssistant','postCode','code','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','deliveryAssistant','postCode','townFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','deliveryAssistant','town','provinceFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','id','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','equivalent','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','stems','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','minPrice','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','isToPrint','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','family','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','box','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','category','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','doPhoto','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','image','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','inkFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','intrastatFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','hasMinPrice','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','created','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','comment','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','typeFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','generic','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','producerFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','description','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','density','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','relevancy','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','expenseFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','isActive','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','subName','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','tag5','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','value5','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','tag6','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','value6','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','tag7','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','value7','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','tag8','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','value8','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','tag9','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','value9','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','tag10','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','value10','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','minimum','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','upToDown','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','supplyResponseFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','hasKgPrice','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','isFloramondo','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','isFragile','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','numberOfItemsPerCask','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','embalageCode','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','quality','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','stemMultiplier','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','itemPackingTypeFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','packingOut','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','genericFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','packingShelve','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','isLaid','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','lastUsed','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','weightByPiece','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','editorFk','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','recycledPlastic','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','nonRecycledPlastic','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','employee','item','minQuantity','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','size','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','originFk','0000-00-00 00:00:00','Select,Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','longName','0000-00-00 00:00:00','Update');
INSERT IGNORE INTO `columns_priv` VALUES ('','vn','buyer','item','name','0000-00-00 00:00:00','Update');
/*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */;
/*!40000 ALTER TABLE `procs_priv` DISABLE KEYS */;
@ -1539,7 +1603,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','buffer_settypeby
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buyUltimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financialBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buyUltimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','employee','base_ticket','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','barcodeToItem','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','ticket_splititempackingtype','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_getCommission','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00');
@ -1596,7 +1659,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan'
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','f10_no_vincular','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buyultimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofyear','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -1765,7 +1827,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_TIMESTAMP','F
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_getsaledate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','ticket_setState','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','invoicing','invoiceout_new','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','palletizer','ticket_setState','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_next','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','workerjourney_replace','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','account','developerBoss','role_sync','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
@ -1878,6 +1940,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','delivery','itemShelving_getinf
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','collection_get','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','item_comparative','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_getBoxPickingList','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00');
INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_isInDepartment','FUNCTION','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00');
/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@ -1898,7 +1961,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','agency','{\"access\": 0, \"max_que
INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
@ -1910,7 +1973,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,
INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}');
INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}');
INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
@ -1940,7 +2003,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"versi
INSERT IGNORE INTO `global_priv` VALUES ('','palletizerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','preservedBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','production','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','productionAssi','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','productionAssi','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}');
INSERT IGNORE INTO `global_priv` VALUES ('','productionBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','productionPlus','{\"access\":0,\"version_id\":100707,\"is_role\":true}');
INSERT IGNORE INTO `global_priv` VALUES ('','root','{\"access\": 549755781119, \"version_id\": 100705, \"is_role\": true}');

10780
db/dump/.dump/triggers.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
FROM mariadb:10.7.7
FROM mariadb:10.11.6
ENV TZ Europe/Madrid

View File

@ -15,8 +15,8 @@ INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, max
-- XXX: eti
INSERT INTO vn.travel (id,shipped,landed,warehouseInFk,warehouseOutFk,agencyFk,`ref`,m3,kg,cargoSupplierFk)
VALUES (9,'2022-05-20','2022-05-20',13,4,1,'nine travel',69.0,600,1);
INSERT INTO vn.travel (id,shipped,landed,warehouseInFk,warehouseOutFk,`ref`,m3,kg,cargoSupplierFk)
VALUES (9,'2022-05-20','2022-05-20',13,4,'nine travel',69.0,600,1);
INSERT INTO vn.entry (id, supplierFk, dated, invoiceNumber, evaNotes, travelFk, companyFk)
VALUES
@ -25,9 +25,9 @@ INSERT INTO vn.entry (id, supplierFk, dated, invoiceNumber, evaNotes, travelFk,
INSERT INTO vn.buy (id,entryFk,itemFk,quantity,dispatched,buyingValue,freightValue,isIgnored,stickers,packing,`grouping`,groupingMode,comissionValue,packageValue,packagingFk,price1,price2,price3,minPrice,printedStickers,workerFk,isChecked,isPickedOff,created,`__cm2`,weight)
VALUES
(16,8,1,100,0,50.0,1.5,0,1,1,1,0,0.0,1.5,'4',0.0,99.6,99.4,0.0,0,0,1,0,'2022-06-20 00:00:00',0,1.0),
(17,9,2,450,0,5.0,1.0,0,1,10,10,0,0.0,1.0,'3',0.0,7.3,7.0,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
(18,9,15,500,0,55.0,1.0,0,1,1,1,0,0.0,1.0,'5',0.0,78.3,75.6,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
(16,10,1,100,0,50.0,1.5,0,1,1,1,0,0.0,1.5,'4',0.0,99.6,99.4,0.0,0,0,1,0,'2022-06-20 00:00:00',0,1.0),
(17,10,2,450,0,5.0,1.0,0,1,10,10,0,0.0,1.0,'3',0.0,7.3,7.0,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
(18,10,15,500,0,55.0,1.0,0,1,1,1,0,0.0,1.0,'5',0.0,78.3,75.6,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
(19,10,11,5000,0,50.0,1.0,0,1,1,1,1,0.0,1.0,'4',0.0,99.6,99.4,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5);
INSERT INTO vn2008.Splits (Id_Split,Id_Ticket,Id_Entrada,Fecha,Notas)

View File

@ -6,6 +6,10 @@
*/
SET foreign_key_checks = 0;
-- CREATE ROLE 'salix';
-- GRANT 'salix' TO 'root'@'%';
-- SET DEFAULT ROLE 'salix' FOR 'root'@'%';
CREATE SCHEMA IF NOT EXISTS `vn2008`;
CREATE SCHEMA IF NOT EXISTS `tmp`;
@ -91,18 +95,17 @@ INSERT INTO `vn`.`educationLevel` (`id`, `name`)
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
(2, 'ENSEÑANZAS DE BACHILLERATO');
INSERT INTO `vn`.`worker`
SET `id` = 9,
`code` = 009,
`firstName` = 'developer',
`lastName` = 'developer',
`bossFk` = 9;
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, NULL
FROM `account`.`user`
WHERE `id` = 9;
INSERT IGNORE INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, 9
FROM `account`.`user`;
FROM `account`.`user`
WHERE `id` <> 9;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
@ -175,51 +178,33 @@ INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
(1, 'Main Warehouse'),
(2, 'Gotham');
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`, isOrigin, isDestiny)
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `aliasFk`, `countryFk`, `hasProduction`)
VALUES
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1),
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 2, 13, 1, 1, 0),
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1, 1, 0),
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1, 0, 1),
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1, 0, 0),
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 2, 1, 0, 0, 0),
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0, 0, 0);
(1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 2, 1, 1),
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 2, 13, 1),
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 2, 1, 0),
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0);
INSERT INTO `vn`.`sectorType` (id,description)
VALUES (1,'First type');
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`)
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`, `typeFk`)
VALUES
(1, 'First sector', 1, 'FIRST'),
(2, 'Second sector', 2, 'SECOND');
(1, 'First sector', 1, 'FIRST', 1),
(2, 'Second sector', 2, 'SECOND',1);
INSERT INTO vn.printerModel (code)
VALUES ('pcode1'),
('pcode2');
INSERT INTO vn.screenModel (code)
VALUES ('scode1'),
('scode2');
INSERT INTO vn.screen (name,modelFk)
VALUES ('screen1','scode1'),
('screen1','scode2');
INSERT INTO vn.scannerModel (code)
VALUES ('sscode1'),
('sscode2');
INSERT INTO vn.scanner (name,modelFk)
VALUES ('scanner1','sscode1'),
('scanner2','sscode2');
INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `modelFk`, `isLabeler`, `sectorFk`, `ipAddress`)
INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAddress`)
VALUES
(1, 'printer1', 'path1','pcode1', 0, 1 , NULL),
(2, 'printer2', 'path2','pcode1', 1, 1 , NULL),
(4, 'printer4', 'path4','pcode2', 0, 1, '10.1.10.4');
(1, 'printer1', 'path1', 0, 1 , NULL),
(2, 'printer2', 'path2', 1, 1 , NULL),
(4, 'printer4', 'path4', 0, NULL, '10.1.10.4');
UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1;
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`,`bossFk`, `phone`)
VALUES
(1106, 'LGN', 'David Charles', 'Haller', 19, 432978106),
@ -390,20 +375,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
(4, 'GCN Channel'),
(5, 'The Newspaper');
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
VALUES
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'),
(1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'),
(1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'),
(1109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist'),
(1110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist'),
(1111, 'Missing', NULL, 'Missing man', 'Anton', 'The space, Universe far away', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others'),
(1112, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city, Underground', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others');
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
@ -437,7 +422,7 @@ INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `pr
(5, 'Max Eisenhardt', 'Unknown Whereabouts', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 1),
(6, 'DavidCharlesHaller', 'Evil hideout', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 1),
(7, 'Hank Pym', 'Anthill', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 1),
(8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1),
(8, 'Charles Xavier', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 1),
(9, 'Bruce Banner', 'Somewhere in New York', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1109, 2, NULL, NULL, 0, 1),
(10, 'Jessica Jones', 'NYCC 2015 Poster', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 1),
(11, 'Missing', 'The space', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1111, 10, NULL, NULL, 0, 1),
@ -469,7 +454,7 @@ INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `pr
(125, 'The plastic cell', 'address 25', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1105, 2, NULL, NULL, 0, 0),
(126, 'Many places', 'address 26', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1106, 2, NULL, NULL, 0, 0),
(127, 'Your pocket', 'address 27', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1107, 2, NULL, NULL, 0, 0),
(128, 'Cerebro', 'address 28', 'Gotham', 46460, 1, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0),
(128, 'Cerebro', 'address 28', 'Gotham', 46460, 5, 1111111111, 222222222, 1, 1108, 2, NULL, NULL, 0, 0),
(129, 'Luke Cages Bar', 'address 29', 'Gotham', 'EC170150', 1, 1111111111, 222222222, 1, 1110, 2, NULL, NULL, 0, 0),
(130, 'Non valid address', 'address 30', 'Gotham', 46460, 1, 1111111111, 222222222, 0, 1101, 2, NULL, NULL, 0, 0);
@ -502,7 +487,24 @@ CREATE TEMPORARY TABLE tmp.address
WHERE `defaultAddressFk` IS NULL;
DROP TEMPORARY TABLE tmp.address;
INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`)
INSERT INTO `vn`.`clientCredit`(`clientFk`, `workerFk`, `amount`, `created`)
VALUES
(1101, 5, 300, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 MONTH)),
(1101, 5, 900, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 MONTH)),
(1101, 5, 800, DATE_ADD(util.VN_CURDATE(), INTERVAL -9 MONTH)),
(1101, 5, 700, DATE_ADD(util.VN_CURDATE(), INTERVAL -8 MONTH)),
(1101, 5, 600, DATE_ADD(util.VN_CURDATE(), INTERVAL -7 MONTH)),
(1101, 5, 500, DATE_ADD(util.VN_CURDATE(), INTERVAL -6 MONTH)),
(1101, 5, 400, DATE_ADD(util.VN_CURDATE(), INTERVAL -5 MONTH)),
(1101, 9, 300, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)),
(1101, 9, 200, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)),
(1101, 9, 100, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
(1101, 9, 50 , DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(1102, 9, 800, util.VN_CURDATE()),
(1104, 9, 90 , util.VN_CURDATE()),
(1105, 9, 90 , util.VN_CURDATE());
INSERT INTO `vn`.`roleCreditLimit`(`id`, `maxAmount`, `roleFk`)
VALUES
(1, 9999999, 20),
(2, 10000, 21),
@ -609,20 +611,24 @@ INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`
('NATIONAL', 0, 1),
('WORLD', 2, 15);
INSERT INTO vn.invoiceOutConfig
SET parallelism = 8;
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
VALUES
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
VALUES
(1, 'T', 1014.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(1, 'T', 1026.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(4, 'T', 8.88, util.VN_CURDATE(), 1104, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
@ -631,30 +637,6 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T3333333' WHERE id = 3;
UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4;
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
INSERT INTO vn.siiTrascendencyInvoiceOut (id, description)
VALUES
(1, 'Operación de régimen general'),
(2, 'Exportación'),
(3, 'Operaciones a las que se aplique el régimen especial de bienes usados, objetos de arte, antigüedades y objetos de colección (135 - 139 de LIVA)'),
(4, 'Régimen especial oro de inversión'),
(5, 'Régimen especial agencias de viajes'),
(6, 'Régimen especial grupo de entidades en IVA (Nivel Avanzado)'),
(7, 'Régimen especial criterio de caja'),
(8, 'Operaciones sujetas al IPSI / IGIC'),
(9, 'Facturación de las prestaciones de servicios de agencias de viaje que actúan como mediadoras en nombre y por cuenta ajena (D.A.4ª RD 1619/2012)'),
(10, 'Cobros por cuenta de terceros de honorarios profesionales o de Dº derivados de la propiedad industrial, de autor u otros por cuenta de sus socios, asociados,colegiados efectuados por sociedades, asociaciones, colegios profesionales u otras entidades '),
(11, 'Operaciones de arrendamiento de local de negocio sujetas a retención'),
(12, 'Operaciones de arrendamiento de local de negocio no sujetos a retención'),
(13, 'Operaciones de arrendamiento de local de negocio sujetas y no sujetas a retención'),
(14, 'Factura con IVA pendiente de devengo (certificaciones de obra cuyo destinatario sea una Administración Pública)'),
(15, 'Factura con IVA pendiente de devengo - operaciones de tracto sucesivo'),
(16, 'Primer semestre 2017');
INSERT INTO vn.invoiceOutConfig
SET parallelism = 8;
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
VALUES
(1, 895.76, 89.58, 4722000010),
@ -688,19 +670,20 @@ INSERT INTO `vn`.`invoiceOutExpense`(`id`, `invoiceOutFk`, `amount`, `expenseFk`
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`)
VALUES
(1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
(2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
(1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 1, 0, 100),
(2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 1, 0, 100),
(3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100),
(4, 'Zone 247 B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100),
(5, 'Zone expensive A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100),
(6, 'Zone expensive B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100),
(7, 'Zone refund', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 23, 0, 0, 0, 100),
(8, 'Zone others', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 10, 0, 0, 0, 100),
(9, 'Zone superMan', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 2, 0, 0, 0, 100),
(10, 'Zone teleportation', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 3, 0, 0, 0, 100),
(11, 'Zone pickup C', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
(12, 'Zone entanglement', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 4, 0, 0, 0, 100),
(13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100);
(7, 'Zone refund', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 23, 0, 1, 0, 100),
(8, 'Zone others', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 10, 0, 1, 0, 100),
(9, 'Zone superMan', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 2, 0, 1, 0, 100),
(10, 'Zone teleportation', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 3, 0, 1, 0, 100),
(11, 'Zone pickup C', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 1, 0, 100),
(12, 'Zone entanglement', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 4, 0, 1, 0, 100),
(13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 1, 0, 100);
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
VALUES
@ -748,38 +731,38 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`)
VALUES
(1 , 3, 1, 1, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1),
(2 , 1, 1, 1, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
(3 , 1, 7, 1, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL),
(4 , 3, 2, 1, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL),
(5 , 3, 3, 3, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL),
(6 , 1, 3, 3, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL),
(7 , NULL, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(8 , NULL, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(9 , NULL, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(10, 1, 1, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(11, 1, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(12, 1, 8, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(13, 1, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1),
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL),
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL),
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL),
(6 , 1, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL),
(7 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Mountain Drive Gotham', 1, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(8 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'Bat cave', 121, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(9 , NULL, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(10, 1, 1, 5, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'Ingram Street', 2, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(11, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1102, 'NY roofs', 122, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(12, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(13, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(14, 1, 2, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1104, 'Malibu Point', 4, NULL, 0, 9, 5, 1, util.VN_CURDATE(), NULL),
(15, 1, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(16, 1, 7, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(17, 1, 7, 2, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(18, 1, 4, 4, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL),
(15, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(16, 1, 7, 1, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(17, 1, 7, 2, 6, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1106, 'Many Places', 126, NULL, 0, 3, 5, 1, util.VN_CURDATE(), NULL),
(18, 1, 4, 4, 4, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1108, 'Cerebro', 128, NULL, 0, 12, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +12 HOUR), NULL),
(19, 1, 5, 5, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 1, NULL, 5, 1, util.VN_CURDATE(), NULL),
(20, 1, 5, 5, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(21, NULL, 5, 5, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(22, NULL, 5, 5, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(23, NULL, 8, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
(24 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
(20, 1, 5, 5, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Thailand', 129, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(21, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Holland', 102, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(22, NULL, 5, 5, 5, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 1109, 'Somewhere in Japan', 103, NULL, 0, 13, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH), NULL),
(23, NULL, 8, 1, 7, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1101, 'address 21', 121, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
(24 ,NULL, 8, 1, 7, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 5, 5, 1, util.VN_CURDATE(), NULL),
(25 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(26 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(27 ,NULL, 8, 1, NULL, util.VN_CURDATE(), util.VN_CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(28, 1, 8, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(29, 1, 8, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(30, 1, 8, 1, NULL, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(31, 1, 8, 1, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(32, 1, 8, 1, NULL, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL);
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL),
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE(), NULL);
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
@ -801,7 +784,7 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des
-- FIX for state hours on local, inter_afterInsert
-- UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND);
INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `userFk`, `created`)
VALUES
(1, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)),
(2, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)),
@ -845,6 +828,7 @@ INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`,
VALUES
(1, 'beta-server', 'nightmare@mydomain.com', '200', DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH));
INSERT INTO `vn`.`greugeType`(`id`, `name`, `code`)
VALUES
(1, 'Diff', 'diff'),
@ -907,7 +891,9 @@ INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
('SLV', 'Silver', 1, 4, 'CACFD2'),
('BRW', 'Brown', 1, 5, 'DC7633'),
('BLK', 'Black', 1, 6, '000000'),
('BAS', 'Blue/Silver', 1, 7, '5DADE2');
('BAS', 'Blue/Silver', 1, 7, '5DADE2'),
('GRN', 'Green', 1, 8, '28A745'),
('WHT', 'White', 1, 9, 'FFFFFF');
INSERT INTO `vn`.`origin`(`id`,`code`, `name`)
VALUES
@ -954,26 +940,26 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
('SER', 'Services'),
('VT', 'Sales');
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
VALUES
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3),
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 15,3),
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 10,2),
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5,5),
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL,NULL),
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
-- Update the taxClass after insert of the items
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
@ -1000,6 +986,10 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, util.VN_CURDATE(), 15, 90.00),
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, util.VN_CURDATE(), 16, 0.00);
INSERT INTO `vn`.`packagingConfig`(`upperGap`, `defaultSmallPackageFk`, `defaultBigPackageFk`)
VALUES
('10', 1, 'pallet 100');
INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
VALUES
(1, 'En reparto', 'ON DELIVERY'),
@ -1041,45 +1031,45 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`,
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
VALUES
(1, 1, 1, 'Ranged weapon longbow 2m', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(1, 1, 1, 'Ranged weapon longbow 200cm', 5, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(3, 1, 1, 'Ranged weapon longbow 2m', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(5, 1, 2, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(6, 1, 3, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, util.VN_CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, util.VN_CURDATE()),
(9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(3, 1, 1, 'Ranged weapon longbow 200cm', 2, 100.39, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.74, 0, 0, 0, util.VN_CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE()),
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()),
(11, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 1.71, 0, 0, 0, util.VN_CURDATE()),
(11, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(12, 4, 16, 'Melee weapon heavy shield 100cm', 20, 1.71, 0, 0, 0, util.VN_CURDATE()),
(13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, util.VN_CURDATE()),
(14, 1, 8, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE()),
(15, 1, 19, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(14, 1, 8, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE()),
(15, 1, 19, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
(16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, util.VN_CURDATE()),
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(19, 1, 4, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)),
(20, 1, 5, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)),
(21, 1, 6, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(22, 1, 7, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(23, 1, 9, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(24, 1, 10, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(25, 4, 12, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(26, 4, 13, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(27, 4, 14, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(28, 4, 15, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(18, 4, 22, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(19, 1, 4, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH)),
(20, 1, 5, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH)),
(21, 1, 6, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(22, 1, 7, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(23, 1, 9, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(24, 1, 10, 'Ranged weapon longbow 200cm', 1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(25, 4, 12, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(26, 4, 13, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(27, 4, 14, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(28, 4, 15, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(29, 4, 17, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(30, 4, 18, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, util.VN_CURDATE()),
(32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(32, 1, 24, 'Ranged weapon longbow 200cm', -1, 8.07, 0, 0, 0, util.VN_CURDATE()),
(33, 5, 14, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, util.VN_CURDATE()),
(34, 4, 28, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(35, 4, 29, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(36, 4, 30, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(34, 4, 28, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(35, 4, 29, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(37, 4, 31, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(36, 4, 30, 'Melee weapon heavy shield 100cm', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
(39, 1, 32, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE());
(39, 1, 32, 'Ranged weapon longbow 200cm', 2, 103.49, 0, 0, 0, util.VN_CURDATE());
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
VALUES
@ -1295,7 +1285,7 @@ INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceT
(5, NULL, 'Diámetro', 1, 1, NULL, 'mm',NULL, 'diameter'),
(7, NULL, 'Ancho de la base', 1, 1, NULL, 'mm',NULL, NULL),
(23, 'stems', 'Tallos', 1, 1, NULL, NULL, NULL, 'stems'),
(27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, NULL),
(27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, 'size'),
(36, 'producer', 'Proveedor', 1, 0, NULL, NULL, NULL, 'producer'),
(56, NULL, 'Genero', 1, 0, NULL, NULL, NULL, NULL),
(58, NULL, 'Variedad', 1, 0, NULL, NULL, NULL, NULL),
@ -1306,7 +1296,7 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
VALUES
(1, 1, 56, 'Ranged weapon', 1),
(2, 1, 58, 'longbow', 2),
(3, 1, 27, '2m', 3),
(3, 1, 27, '200cm', 3),
(4, 1, 36, 'Stark Industries', 4),
(5, 1, 1, 'Brown', 5),
(6, 1, 67, '+1 precission', 6),
@ -1320,42 +1310,42 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(14, 2, 23, '2', 7),
(15, 3, 56, 'Ranged weapon', 1),
(16, 3, 58, 'sniper rifle', 2),
(17, 3, 4, '300mm', 3),
(17, 3, 4, '113cm', 3),
(18, 3, 36, 'Stark Industries', 4),
(19, 3, 1, 'Green', 5),
(20, 3, 67, 'precission', 6),
(21, 3, 23, '3', 7),
(22, 4, 56, 'Melee weapon', 1),
(23, 4, 58, 'heavy shield', 2),
(24, 4, 4, '1x0.5m', 3),
(24, 4, 4, '100cm', 3),
(25, 4, 36, 'Stark Industries', 4),
(26, 4, 1, 'Black', 5),
(27, 4, 67, 'containtment', 6),
(28, 4, 23, '4', 7),
(29, 5, 56, 'Ranged weapon', 1),
(30, 5, 58, 'pistol', 2),
(31, 5, 27, '9mm', 3),
(31, 5, 67, '9mm', 3),
(32, 5, 36, 'Stark Industries', 4),
(33, 5, 1, 'Silver', 5),
(34, 5, 67, 'rapid fire', 6),
(34, 5, 27, '15cm', 6),
(35, 5, 23, '5', 7),
(36, 6, 56, 'Container', 1),
(37, 6, 58, 'ammo box', 2),
(38, 6, 27, '1m', 3),
(38, 6, 27, '100cm', 3),
(39, 6, 36, 'Stark Industries', 4),
(40, 6, 1, 'Green', 5),
(41, 6, 67, 'supply', 6),
(42, 6, 23, '6', 7),
(43, 7, 56, 'Container', 1),
(44, 7, 58, 'medical box', 2),
(45, 7, 27, '1m', 3),
(45, 7, 27, '100cm', 3),
(46, 7, 36, 'Stark Industries', 4),
(47, 7, 1, 'White', 5),
(48, 7, 67, 'supply', 6),
(49, 7, 23, '7', 7),
(50, 8, 56, 'Ranged Reinforced weapon', 1),
(51, 8, 58, '+1 longbow', 2),
(52, 8, 27, '2m', 3),
(52, 8, 27, '200cm', 3),
(53, 8, 36, 'Stark Industries', 4),
(54, 8, 1, 'Brown', 5),
(55, 8, 67, 'precission', 6),
@ -1369,14 +1359,14 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(63, 9, 23, '9', 7),
(64, 10, 56, 'Ranged Reinforced weapon', 1),
(65, 10, 58, 'sniper rifle', 2),
(66, 10, 4, '300mm', 3),
(66, 10, 67, '700mm', 3),
(67, 10, 36, 'Stark Industries', 4),
(68, 10, 1, 'Green', 5),
(69, 10, 67, 'precission', 6),
(69, 10, 27, '130cm', 6),
(70, 10, 23, '10', 7),
(71, 11, 56, 'Melee Reinforced weapon', 1),
(72, 11, 58, 'heavy shield', 2),
(73, 11, 4, '1x0.5m', 3),
(73, 11, 4, '120cm', 3),
(74, 11, 36, 'Stark Industries', 4),
(75, 11, 1, 'Black', 5),
(76, 11, 67, 'containtment', 6),
@ -1386,18 +1376,18 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
(80, 12, 27, '9mm', 3),
(81, 12, 36, 'Stark Industries', 4),
(82, 12, 1, 'Silver', 5),
(83, 12, 67, 'rapid fire', 6),
(83, 12, 67, '23cm', 6),
(84, 12, 23, '12', 7),
(85, 13, 56, 'Chest', 1),
(86, 13, 58, 'ammo box', 2),
(87, 13, 27, '1m', 3),
(87, 13, 27, '100cm', 3),
(88, 13, 36, 'Stark Industries', 4),
(89, 13, 1, 'Green', 5),
(90, 13, 67, 'supply', 6),
(91, 13, 23, '13', 7),
(92, 14, 56, 'Chest', 1),
(93, 14, 58, 'medical box', 2),
(94, 14, 27, '1m', 3),
(94, 14, 27, '100cm', 3),
(95, 14, 36, 'Stark Industries', 4),
(96, 14, 1, 'White', 5),
(97, 14, 67, 'supply', 6),
@ -1443,23 +1433,34 @@ INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_
INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
VALUES
(1, 0),
(2, 1),
(3, 2),
(4, 4),
(5, 6),
(15, 6);
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`)
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
VALUES
(1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1),
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2),
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1),
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2),
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1),
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2),
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2);
(1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1),
(2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1),
(3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1),
(4, '99610288821', 252, 2777, util.VN_CURDATE(), 3641, 1, 1),
(5, '07546500834', 229, 3292, util.VN_CURDATE(), 6601, 2, 1),
(6, '22101929561', 37, 458, util.VN_CURDATE(), 441, 2, 1),
(7, '07546491432', 258, 3034, util.VN_CURDATE(), 6441, 2, 1),
(8, '99610288644', 476, 4461, util.VN_CURDATE(), 5751, 442, 1),
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
VALUES
(1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2, 2),
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
VALUES
@ -1963,9 +1964,9 @@ INSERT INTO `vn`.`workerTeam`(`id`, `team`, `workerFk`)
INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `attenderFk`, `quantity`, `itemFk`, `price`, `isOk`, `saleFk`, `ticketFk`, `created`)
VALUES
(1, 'Ranged weapon longbow 2m', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)),
(1, 'Ranged weapon longbow 200cm', 18, 35, 5, 1, 9.10, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)),
(2, 'Melee weapon combat first 15cm', 18, 35, 10, 2, 1.07, 0, NULL, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY)),
(3, 'Melee weapon heavy shield 1x0.5m', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, util.VN_CURDATE()),
(3, 'Melee weapon heavy shield 100cm', 18, 35, 20, NULL, 3.06, NULL, NULL, 23, util.VN_CURDATE()),
(4, 'Melee weapon combat first 15cm', 18, 35, 15, NULL, 1.30, NULL, NULL, 11, util.VN_CURDATE()),
(5, 'Melee weapon combat first 15cm', 18, 35, 15, 4, 1.30, 0, NULL, 18, util.VN_CURDATE());
@ -2001,6 +2002,8 @@ INSERT INTO `vn`.`calendarType` (`id`, `description`, `hoursWeek`, `isPartial`)
VALUES
(1, 'General schedule', 40, 0);
INSERT INTO `vn`.`workerBusinessAgreement` (`id`, `name`, `monthHolidays`, `yearHours`, `started`, `ended`)
VALUES(1, 'flowers', 2.5, 1830, '2001-01-01', NULL);
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
CREATE TEMPORARY TABLE tmp.worker
@ -2037,6 +2040,10 @@ UPDATE `vn`.`business` b
SET b.`departmentFk` = 43
WHERE b.id IN(18, 19);
UPDATE `vn`.`business` b
SET b.`started` = b.`started` - INTERVAL 100 DAY
WHERE b.id = 1107;
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
VALUES
('1', '27.5', YEAR(util.VN_CURDATE())),
@ -2085,22 +2092,22 @@ INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlement
INSERT INTO `vn`.`calendar` (`businessFk`, `dayOffTypeFk`, `dated`)
VALUES
(1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -12 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 12 DAY))),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))),
(1106, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))),
(1106, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))),
(1106, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -12 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 12 DAY))),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))),
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))),
(1107, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))),
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))),
(1107, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL - 16 DAY));
(1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 10 DAY, util.VN_CURDATE() + INTERVAL 10 DAY)),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 10 DAY, util.VN_CURDATE() + INTERVAL 10 DAY)),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 11 DAY, util.VN_CURDATE() + INTERVAL 11 DAY)),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 12 DAY, util.VN_CURDATE() + INTERVAL 12 DAY)),
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 20 DAY, util.VN_CURDATE() + INTERVAL 20 DAY)),
(1106, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, util.VN_CURDATE() - INTERVAL 13 DAY, util.VN_CURDATE() + INTERVAL 8 DAY)),
(1106, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, util.VN_CURDATE() - INTERVAL 14 DAY, util.VN_CURDATE() + INTERVAL 9 DAY)),
(1106, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, util.VN_CURDATE() - INTERVAL 15 DAY, util.VN_CURDATE() + INTERVAL 7 DAY)),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 10 DAY, util.VN_CURDATE() + INTERVAL 10 DAY)),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 11 DAY, util.VN_CURDATE() + INTERVAL 11 DAY)),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 12 DAY, util.VN_CURDATE() + INTERVAL 12 DAY)),
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, util.VN_CURDATE() - INTERVAL 20 DAY, util.VN_CURDATE() + INTERVAL 20 DAY)),
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, util.VN_CURDATE() - INTERVAL 13 DAY, util.VN_CURDATE() + INTERVAL 8 DAY)),
(1107, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, util.VN_CURDATE() - INTERVAL 14 DAY, util.VN_CURDATE() + INTERVAL 9 DAY)),
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, util.VN_CURDATE() - INTERVAL 15 DAY, util.VN_CURDATE() + INTERVAL 7 DAY)),
(1107, 2, util.VN_CURDATE() - INTERVAL 16 DAY);
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`)
VALUES
@ -2367,9 +2374,11 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`)
(8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'),
(10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun');
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`)
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`, `weekDays`)
VALUES
(9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR));
(9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR), 'mon'),
(9, 'range', util.VN_CURDATE(), NULL, 'tue'),
(9, 'range', NULL, util.VN_CURDATE(), 'wed');
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `isSendMail`)
VALUES
@ -2382,28 +2391,28 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
(1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1),
(1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1);
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
VALUES
(1, 'Facturas Recibidas', 'recibidas', NULL, NULL, 'invoiceIn'),
(2, 'Doc oficial', 'oficial', NULL, NULL, 'officialDoc'),
(3, 'Laboral', 'laboral', 37, 37, 'hhrrData'),
(4, 'Albaranes recibidos', 'entradas', NULL, NULL, 'deliveryNote'),
(5, 'Otros', 'otros', 1, 1, 'miscellaneous'),
(6, 'Pruebas', 'pruebas', NULL, NULL, 'tests'),
(7, 'IAE Clientes', 'IAE_Clientes', 1, 1, 'economicActivitiesTax'),
(8, 'Fiscal', 'fiscal', NULL, NULL, 'fiscal'),
(9, 'Vehiculos', 'vehiculos', NULL, NULL, 'vehicles'),
(10, 'Plantillas', 'plantillas', NULL, NULL, 'templates'),
(11, 'Contratos', 'contratos', NULL, NULL, 'contracts'),
(12, 'ley de pagos', 'ley pagos', 1, 1, 'paymentsLaw'),
(13, 'Basura', 'basura', 1, 1, 'trash'),
(14, 'Ticket', 'tickets', 1, 1, 'ticket'),
(15, 'Presupuestos', 'Presupuestos', NULL, NULL, 'budgets'),
(16, 'Logistica', 'logistica', NULL, NULL, 'logistics'),
(17, 'cmr', 'cmr', NULL, NULL, 'cmr'),
(18, 'dua', 'dua', NULL, NULL, 'dua'),
(19, 'inmovilizado', 'inmovilizado', NULL, NULL, 'fixedAssets'),
(20, 'Reclamación', 'reclamacion', 1, 1, 'claim');
(1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
(2, 'Doc oficial', NULL, NULL, 'officialDoc'),
(3, 'Laboral', 37, 37, 'hhrrData'),
(4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
(5, 'Otros', 1, 1, 'miscellaneous'),
(6, 'Pruebas', NULL, NULL, 'tests'),
(7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
(8, 'Fiscal', NULL, NULL, 'fiscal'),
(9, 'Vehiculos', NULL, NULL, 'vehicles'),
(10, 'Plantillas', NULL, NULL, 'templates'),
(11, 'Contratos', NULL, NULL, 'contracts'),
(12, 'ley de pagos', 1, 1, 'paymentsLaw'),
(13, 'Basura', 1, 1, 'trash'),
(14, 'Ticket', 1, 1, 'ticket'),
(15, 'Presupuestos', NULL, NULL, 'budgets'),
(16, 'Logistica', NULL, NULL, 'logistics'),
(17, 'cmr', NULL, NULL, 'cmr'),
(18, 'dua', NULL, NULL, 'dua'),
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
(20, 'Reclamación', 1, 1, 'claim');
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES
@ -2515,20 +2524,7 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
(util.VN_CURDATE(), 1, 12, 17, 22, 27);
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
VALUES
(1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1),
(2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1),
(3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1),
(4, '99610288821', 252, 2777, util.VN_CURDATE(), 3641, 1, 1),
(5, '07546500834', 229, 3292, util.VN_CURDATE(), 6601, 2, 1),
(6, '22101929561', 37, 458, util.VN_CURDATE(), 441, 2, 1),
(7, '07546491432', 258, 3034, util.VN_CURDATE(), 6441, 2, 1),
(8, '99610288644', 476, 4461, util.VN_CURDATE(), 5751, 442, 1),
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
INSERT INTO `vn`.`dua` (id, code, awbFk__, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
VALUES
(1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
(2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
@ -2541,6 +2537,17 @@ INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried,
(9, '19ES00280132025491', 9, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 7126.23, 442),
(10, '19ES00280132025492', 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 4631.45, 442);
INSERT INTO `vn`.`duaEntry` (`duaFk`, `entryFk`, `value`, `customsValue`, `euroValue`)
VALUES
(1, 1, 1.00, 1.00, 1.00),
(2, 2, 1.00, 1.00, 1.00),
(3, 3, 1.00, 1.00, 1.00),
(4, 4, 1.00, 1.00, 1.00),
(5, 5, 1.00, 1.00, 1.00),
(6, 6, 1.00, 1.00, 1.00),
(7, 7, 1.00, 1.00, 1.00),
(8, 8, 1.00, 1.00, 1.00);
REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issued`, `created`, `supplierRef`, `isBooked`, `companyFk`, `docFk`)
VALUES
(1, 1001, 'R', 1, util.VN_CURDATE(), util.VN_CURDATE(), 1234, 0, 442, 1),
@ -2788,19 +2795,17 @@ INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk
VALUES
(1, 1);
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`, `teleworkingStart`, `teleworkingStartBreakTime`)
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`, `teleworkingStart`, `teleworkingStartBreakTime`, `maxTimeToBreak`, `maxWorkShortCycle`, `maxWorkLongCycle`)
VALUES
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13, 28800, 32400);
(1, 43200, 32400, 129600, 259200, 1080000, '', 'imap.verdnatura.es', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.00, 0.33, 40, '22:00:00', '06:00:00', 72000, 1200, 18000, 72000, 6, 13, 28800, 32400, 3600, 561600, 950400);
INSERT INTO `vn`.`host` (`id`, `code`, `description`, `warehouseFk`, `bankFk`)
VALUES
(1, 'pc1', 'pc host', 1, 1);
INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`, `printerFk`)
INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`)
VALUES
(1, 'h1', 1, '', 1);
INSERT INTO vn.packingSiteLog (packingSiteFk, hostFk, workerFk, printerModelFk) VALUES('h1', '1', 1, 'pcode1');
(1, 'h1', 1, '');
INSERT INTO `vn`.`packingSiteConfig` (`shinobiUrl`, `shinobiToken`, `shinobiGroupKey`, `avgBoxingTime`)
VALUES
@ -2814,11 +2819,18 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(2, 'invoice-electronic', 'A electronic invoice has been generated'),
(3, 'not-main-printer-configured', 'A printer distinct than main has been configured'),
(4, 'supplier-pay-method-update', 'A supplier pay method has been updated'),
(5, 'modified-entry', 'An entry has been modified');
(5, 'modified-entry', 'An entry has been modified'),
(6, 'book-entry-deleted', 'accounting entries deleted');
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
VALUES
(1, 9);
(1, 9),
(1, 1),
(2, 1),
(3, 9),
(4, 1),
(5, 9),
(6, 9);
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
VALUES
@ -2830,9 +2842,12 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
VALUES
(1, 1109),
(1, 1110),
(2, 1110),
(4, 1110),
(2, 1109),
(1, 9),
(1,3);
(1, 3),
(6, 9);
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
@ -2865,24 +2880,24 @@ UPDATE `account`.`user`
INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`)
VALUES
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL),
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL),
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL),
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 1x0.5m de '5' a '10'"),
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 5689, 'Shield');
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 22, NULL),
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 22, NULL),
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 22, NULL),
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 100cm de '5' a '10'"),
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 12, 'Shield');
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
VALUES
(1, NULL, 'delete', '2001-06-09 11:00:04', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
(1, 18, 'select', '2001-06-09 11:00:03', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 69854, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 69854, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 5689, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 69854, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 5, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 5, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 4, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 1, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
(1, 18, 'update', '2000-12-28 08:40:45', 'Ticket', 45, 'Spider Man' , '{"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"isBlocked":false,"hasPriority":false,"companyFk":442,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}','{"warehouseFk":61,"shipped":"2023-05-17T22:00:00.000Z","nickname":"Spider Man","isSigned":false,"isLabeled":false,"isPrinted":false,"packages":1,"hour":0,"isBlocked":true,"hasPriority":true,"companyFk":443,"landed":"2023-05-18T22:00:00.000Z","isBoxed":false,"isDeleted":false,"zoneFk":713,"zonePrice":13,"zoneBonus":1}', NULL),
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 5689, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 4, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
VALUES
@ -2900,6 +2915,7 @@ INSERT INTO `vn`.`profileType` (`id`, `name`)
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
VALUES
('lilium', 'development', 'http://localhost:9000/#/'),
('hedera', 'development', 'http://localhost:9090/'),
('salix', 'development', 'http://localhost:5000/#!/');
INSERT INTO `vn`.`report` (`id`, `name`, `paperSizeFk`, `method`)
@ -2908,7 +2924,9 @@ INSERT INTO `vn`.`report` (`id`, `name`, `paperSizeFk`, `method`)
INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
VALUES
(1, 1);
(1, 1),
(2, 20),
(7, 1);
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk`, `businessTypeFk`)
VALUES
@ -2916,8 +2934,7 @@ INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
VALUES
(1, 12),
(8, 10);
(24, 8);
INSERT INTO `vn`.`deviceProductionModels` (`code`)
VALUES
@ -2935,10 +2952,10 @@ INSERT INTO `vn`.`deviceProductionState` (`code`, `description`)
INSERT INTO `vn`.`deviceProduction` (`imei`, `modelFk`, `macWifi`, `serialNumber`, `android_id`, `purchased`, `stateFk`, `isInScalefusion`, `description`)
VALUES
('ime1', 'BLACKVIEW', 'macWifi1', 'serialNumber1', 'androidId0000001', util.VN_NOW(), 'active', 0, NULL),
('ime2', 'DODGEE', 'macWifi2', 'serialNumber2', 'androidId0000002', util.VN_NOW(), 'idle', 0, NULL),
('ime3', 'ZEBRA', 'macWifi3', 'serialNumber3', 'androidId0000003', util.VN_NOW(), 'active', 0, NULL),
('ime4', 'BLACKVIEW', 'macWifi4', 'serialNumber4', 'androidId0000004', util.VN_NOW(), 'idle', 0, NULL);
('ime1', 'BLACKVIEW', 'macWifi1', 'serialNumber1', 'androidid11234567890', util.VN_NOW(), 'active', 0, NULL),
('ime2', 'DODGEE', 'macWifi2', 'serialNumber2', 'androidid21234567890', util.VN_NOW(), 'idle', 0, NULL),
('ime3', 'ZEBRA', 'macWifi3', 'serialNumber3', 'androidid31234567890', util.VN_NOW(), 'active', 0, NULL),
('ime4', 'BLACKVIEW', 'macWifi4', 'serialNumber4', 'androidid41234567890', util.VN_NOW(), 'idle', 0, NULL);
INSERT INTO `vn`.`deviceProductionUser` (`deviceProductionFk`, `userFk`, `created`)
VALUES
@ -2973,9 +2990,9 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
(2, 1, 50, 2),
(3, 1, 0, 3);
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
VALUES
(1, 21600, 300);
(1, 21600, 60, 300);
INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`)
VALUES
@ -2996,3 +3013,56 @@ INSERT INTO `vn`.`invoiceInSerial` (`code`, `description`, `cplusTerIdNifFk`, `t
INSERT INTO `hedera`.`imageConfig` (`id`, `maxSize`, `useXsendfile`, `url`)
VALUES
(1, 0, 0, 'marvel.com');
INSERT INTO vn.XDiario (id, ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, BASEEURO, SERIE, FACTURA, IVA, RECEQUIV, CLAVE, CAMBIO, DEBEME, HABERME, AUXILIAR, MONEDAUSO, TIPOOPE, NFACTICK, TERIDNIF, TERNIF, TERNOM, OPBIENES, L340, enlazado, FECHA_EX, LRECT349, empresa_id, LDIFADUAN, METAL, METALIMP, CLIENTE, METALEJE, FECHA_OP, FACTURAEX, TIPOCLAVE, TIPOEXENCI, TIPONOSUJE, TIPOFACT, TIPORECTIF, SERIE_RT, FACTU_RT, BASEIMP_RT, BASEIMP_RF, RECTIFICA, FECHA_RT, FECREGCON, enlazadoSage)
VALUES
(1, 1.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T3333333', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1),
(2, 1.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T3333333 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1),
(3, 1.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T3333333 Tony Stark', NULL, 0.81, 8.07, 'T', '3333333', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 1),
(4, 2.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T4444444', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
(5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
(6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
INSERT INTO `vn`.`mistakeType` (`id`, `description`)
VALUES
(1, 'Incorrect quantity');
INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`)
VALUES
(1, 'Error in VAT calculation'),
(2, 'Error in sales details'),
(3, 'Error in customer data');
UPDATE `vn`.`client`
SET fi='65004204V'
WHERE id=1;
UPDATE `vn`.`worker`
SET fi='59328808D'
WHERE id=1106;
INSERT INTO `account`.`mailAliasAcl` (`mailAliasFk`, `roleFk`)
VALUES
(1, 1),
(2, 9),
(3, 15);
INSERT INTO `vn`.`docuwareTablet` (`tablet`,`description`)
VALUES
('Tablet1','Jarvis tablet'),
('Tablet2','Avengers tablet');
INSERT INTO `vn`.`sms` (`id`, `senderFk`, `sender`, `destination`, `message`, `statusCode`, `status`, `created`)
VALUES (1, 66, '111111111', '0001111111111', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE()),
(2, 66, '222222222', '0002222222222', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'PENDING', util.VN_CURDATE()),
(3, 66, '333333333', '0003333333333', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'ERROR', util.VN_CURDATE()),
(4, 66, '444444444', '0004444444444', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE());
INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`)
VALUES(1, 1103, 1, NULL),
(2, 1103, 2, NULL),
(3, 1103, 3, 32),
(4, 1103, 4, 32),
(13, 1101, 1, NULL),
(14, 1101, 4, 27);

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,11 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`clean`()
BEGIN
DECLARE vFourYearsAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR;
DECLARE vOneYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR;
DECLARE vTwoYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 3 YEAR;
DECLARE vThreeYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR;
DECLARE vOneYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR;
DECLARE vTwoYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR;
DECLARE vThreeYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 3 YEAR;
DECLARE vFourYearsAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR;
DECLARE vEighteenMonths DATE DEFAULT util.VN_CURDATE() - INTERVAL 18 MONTH;
DELETE FROM clientNewBorn

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`clientNewBorn_BEFORE_UPDATE`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`clientNewBorn_beforeUpdate`
BEFORE UPDATE ON `clientNewBorn`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`nightTaskBeforeInsert`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`nightTask_beforeInsert`
BEFORE INSERT ON `nightTask`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`nightTaskBeforeUpdate`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`nightTask_beforeUpdate`
BEFORE UPDATE ON `nightTask`
FOR EACH ROW
BEGIN

View File

@ -1,7 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`ekt_load`(IN `vSelf` INT)
proc:BEGIN
/**
* Carga los datos esenciales para el sistema EKT.
* Inserta compras y ventas si es necesario.
*
* @param vSelf Id de ekt
*/
DECLARE vRef INT;
DECLARE vBuy INT;
DECLARE vItem INT;
@ -19,27 +24,22 @@ proc:BEGIN
DECLARE vSaleFk INT;
-- Carga los datos necesarios del EKT
SELECT e.ref, qty, package, putOrderFk MOD 1000000, i2.id , NOT ISNULL(eea.addressFk), NOT ISNULL(igto.group_code),
CONCAT(e.`ref`, ' ', e.item, ' ', e.sub, ' EktFk:', e.id)
INTO vRef, vQty, vPackage, vPutOrderFk, vItem, vIsFloramondoDirect, vHasItemGroup, vDescription
FROM edi.ekt e
LEFT JOIN edi.item i ON e.ref = i.id
LEFT JOIN edi.putOrder po ON po.id = e.putOrderFk
FROM ekt e
LEFT JOIN item i ON e.ref = i.id
LEFT JOIN putOrder po ON po.id = e.putOrderFk
LEFT JOIN vn.item i2 ON i2.supplyResponseFk = po.supplyResponseID
LEFT JOIN vn.ektEntryAssign eea ON eea.sub = e.sub
LEFT JOIN edi.item_groupToOffer igto ON igto.group_code = i.group_id
LEFT JOIN item_groupToOffer igto ON igto.group_code = i.group_id
WHERE e.id = vSelf
LIMIT 1;
IF NOT vHasItemGroup THEN
CALL vn.mail_insert('logistica@verdnatura.es', 'nocontestar@verdnatura.es', 'Nuevo grupo en Floramondo', vDescription);
CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription);
LEAVE proc;
END IF;
-- Asigna la entrada
@ -82,26 +82,22 @@ proc:BEGIN
-- Si es una compra de Logiflora obtiene el articulo
IF vPutOrderFk THEN
SELECT i.id INTO vItem
FROM edi.putOrder po
FROM putOrder po
JOIN vn.item i ON i.supplyResponseFk = po.supplyResponseID
WHERE po.id = vPutOrderFk
LIMIT 1;
END IF;
INSERT IGNORE INTO item_track SET
item_id = vRef;
IF IFNULL(vItem,0) = 0 THEN
INSERT IGNORE INTO item_track
SET item_id = vRef;
IF vItem IS NULL THEN
-- Intenta obtener el artículo en base a los atributos holandeses
SELECT b.id, IFNULL(b.itemOriginalFk ,b.itemFk) INTO vBuy, vItem
FROM edi.ekt e
JOIN edi.item_track t ON t.item_id = e.ref
LEFT JOIN edi.ekt l ON l.ref = e.ref
FROM ekt e
JOIN item_track t ON t.item_id = e.ref
LEFT JOIN ekt l ON l.ref = e.ref
LEFT JOIN vn.buy b ON b.ektFk = l.id
LEFT JOIN vn.item i ON i.id = b.itemFk
JOIN vn2008.config cfg
@ -127,39 +123,34 @@ proc:BEGIN
END IF;
-- Si no encuentra el articulo lo crea en el caso de las compras directas en Floramondo
IF ISNULL(vItem) AND vIsFloramondoDirect THEN
CALL edi.item_getNewByEkt(vSelf, vItem);
IF vItem IS NULL AND vIsFloramondoDirect THEN
CALL item_getNewByEkt(vSelf, vItem);
END IF;
INSERT INTO vn.buy
(
entryFk
,ektFk
,buyingValue
,itemFk
,stickers
,packing
,`grouping`
,quantity
,groupingMode
,packagingFk
,weight
)
SELECT
vEntryFk
,vSelf
,(@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue
,IFNULL(vItem, cfg.generic_item) itemFk
,e.qty stickers
,@pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing
,IFNULL(b.`grouping`, e.pac)
,@pac * e.qty
,vForceToPacking
,IF(vHasToChangePackagingFk OR ISNULL(b.packagingFk), vPackage, b.packagingFk)
,(IFNULL(i.weightByPiece,0) * @pac)/1000
FROM edi.ekt e
INSERT INTO vn.buy (
entryFk,
ektFk,
buyingValue,
itemFk,
stickers,
packing,
`grouping`,
quantity,
groupingMode,
packagingFk,
weight)
SELECT vEntryFk,
vSelf,
(@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue,
IFNULL(vItem, cfg.generic_item) itemFk,
e.qty stickers,
@pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing,
IFNULL(b.`grouping`, e.pac),
@pac * e.qty,
vForceToPacking,
IF(vHasToChangePackagingFk OR b.packagingFk IS NULL, vPackage, b.packagingFk),
(IFNULL(i.weightByPiece, 0) * @pac) / 1000
FROM ekt e
LEFT JOIN vn.buy b ON b.id = vBuy
LEFT JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.supplier s ON e.pro = s.id
@ -167,9 +158,7 @@ proc:BEGIN
WHERE e.id = vSelf
LIMIT 1;
DROP TEMPORARY TABLE IF EXISTS tmp.buyRecalc;
CREATE TEMPORARY TABLE tmp.buyRecalc
CREATE OR REPLACE TEMPORARY TABLE tmp.buyRecalc
SELECT buy.id
FROM vn.buy
WHERE ektFk = vSelf;
@ -178,31 +167,26 @@ proc:BEGIN
-- Si es una compra de Logiflora hay que informar la tabla vn.saleBuy
IF vPutOrderFk THEN
REPLACE vn.saleBuy(saleFk, buyFk, workerFk)
SELECT po.saleFk, b.id, account.myUser_getId()
FROM edi.putOrder po
FROM putOrder po
JOIN vn.buy b ON b.ektFk = vSelf
WHERE po.id = vPutOrderFk;
END IF;
-- Si es una compra directa en Floramondo hay que añadirlo al ticket
IF vIsFloramondoDirect THEN
SELECT t.id INTO vTicketFk
FROM vn.ticket t
JOIN vn.ektEntryAssign eea
ON eea.addressFk = t.addressFk
JOIN vn.ektEntryAssign eea ON eea.addressFk = t.addressFk
AND t.warehouseFk = eea.warehouseInFk
JOIN edi.ekt e
ON e.sub = eea.sub
JOIN ekt e ON e.sub = eea.sub
AND e.id = vSelf
WHERE e.fec = t.shipped
LIMIT 1;
IF ISNULL(vTicketFk) THEN
IF vTicketFk IS NULL THEN
SET @clientFk = NULL;
INSERT INTO vn.ticket (
clientFk,
shipped,
@ -214,10 +198,8 @@ proc:BEGIN
landed,
zoneFk,
zonePrice,
zoneBonus
)
SELECT
a.clientFk,
zoneBonus)
SELECT @clientFk := a.clientFk,
e.fec,
a.id,
a.agencyModeFk,
@ -228,7 +210,7 @@ proc:BEGIN
z.id,
z.price,
z.bonus
FROM edi.ekt e
FROM ekt e
JOIN vn.ektEntryAssign eea ON eea.sub = e.sub
JOIN vn.address a ON a.id = eea.addressFk
JOIN vn.company c ON c.code = 'VNL'
@ -238,18 +220,15 @@ proc:BEGIN
SET vTicketFk = LAST_INSERT_ID();
INSERT INTO vn.ticketLog
SET originFk = vTicketFk,
userFk = account.myUser_getId(),
`action` = 'insert',
description = CONCAT('EktLoad ha creado el ticket:', ' ', vTicketFk);
IF @clientFk IS NULL THEN
CALL util.throw(CONCAT("Ticket creation failed: ", vSelf));
END IF;
END IF;
INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, price)
SELECT vItem, vTicketFk, e.item, e.qty * e.pac, e.pri * ( 1 + fhc.floramondoMargin )
FROM edi.ekt e
JOIN edi.floraHollandConfig fhc
FROM ekt e
JOIN floraHollandConfig fhc
WHERE e.id = vSelf;
SELECT LAST_INSERT_ID() INTO vSaleFk;
@ -261,14 +240,14 @@ proc:BEGIN
INSERT INTO vn.saleComponent(saleFk, componentFk, value)
SELECT vSaleFk, c.id, e.pri
FROM edi.ekt e
FROM ekt e
JOIN vn.component c ON c.code = 'purchaseValue'
WHERE e.id = vSelf;
INSERT INTO vn.saleComponent(saleFk, componentFk, value)
SELECT vSaleFk, c.id, e.pri * fhc.floramondoMargin
FROM edi.ekt e
JOIN edi.floraHollandConfig fhc
FROM ekt e
JOIN floraHollandConfig fhc
JOIN vn.component c ON c.code = 'margin'
WHERE e.id = vSelf;
END IF;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`item_feature_bi`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`item_feature_beforeInsert`
BEFORE INSERT ON `item_feature`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`putOrder_AFTER_UPDATE`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`putOrder_afterUpdate`
AFTER UPDATE ON `putOrder`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`putOrder_BEFORE_INSERT`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`putOrder_beforeInsert`
BEFORE INSERT ON `putOrder`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`BEFORE UPDATE`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`putOrder_beforeUpdate`
BEFORE UPDATE ON `putOrder`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`supplyResponse_AFTER_UPDATE`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `edi`.`supplyResponse_afterUpdate`
AFTER UPDATE ON `supplyResponse`
FOR EACH ROW
BEGIN

View File

@ -22,7 +22,6 @@ BEGIN
DECLARE vSerialDua VARCHAR(1) DEFAULT 'D';
DECLARE vInvoiceTypeInformativeCode VARCHAR(1);
DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2) ;
DECLARE vBookEntries TEXT;
SELECT SiglaNacion INTO vCountryCanariasCode
FROM Naciones
@ -412,40 +411,5 @@ BEGIN
AND importeDivisa > 0
AND ImporteAsiento < 0;
-- Comprobación que los importes e ivas sean correctos, avisa vía CAU
SELECT GROUP_CONCAT(Asiento ORDER BY Asiento ASC SEPARATOR ',') INTO vBookEntries
FROM(SELECT sub.Asiento
FROM (SELECT mc.Asiento, SUM(mc.ImporteAsiento) amount
FROM movConta mc
WHERE mc.enlazadoSage = FALSE
GROUP BY mc.Asiento)sub
JOIN (SELECT x.ASIEN, SUM(IFNULL(x.EURODEBE,0) + IFNULL(x.EUROHABER,0)) amount
FROM vn.XDiario x
WHERE x.enlazadoSage = FALSE
GROUP BY ASIEN)sub2 ON sub2.ASIEN = sub.Asiento
WHERE sub.amount <> sub2.amount
UNION ALL
SELECT sub.Asiento
FROM (SELECT Asiento, SUM(BaseIva1 + BaseIva2 + BaseIva3 + BaseIva4) amountTaxableBase
FROM movConta
WHERE TipoFactura <> 'I'
AND enlazadoSage = FALSE
GROUP BY Asiento) sub
JOIN (SELECT ASIEN, SUM(BASEEURO) amountTaxableBase
FROM (SELECT ASIEN, SUM(BASEEURO) BASEEURO
FROM vn.XDiario
WHERE FACTURA
AND auxiliar <> '*'
AND enlazadoSage = FALSE
GROUP BY FACTURA, ASIEN)sub3
GROUP BY ASIEN) sub2 ON sub2.ASIEN = sub.Asiento
WHERE sub.amountTaxableBase<>sub2.amountTaxableBase
AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase) sub;
IF vBookEntries IS NOT NULL THEN
SELECT util.notification_send ("book-entries-imported-incorrectly",
CONCAT('{"bookEntries":"', vBookEntries,'"}'),
null);
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`clean`()
BEGIN
/**
* Maintains tables over time by removing unnecessary data
*/
DECLARE vTwoYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR;
DELETE FROM movConta WHERE FechaAsiento < vTwoYearAgo;
END$$
DELIMITER ;

View File

@ -0,0 +1,62 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`importErrorNotification`()
BEGIN
/**
* Inserta notificaciones con los errores detectados durante la importación
*
*/
DECLARE vBookEntries TEXT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
SELECT GROUP_CONCAT(error SEPARATOR ' ') INTO vBookEntries
FROM(
SELECT CONCAT('- Importes: ', sub.Asiento) error
FROM (SELECT mc.Asiento, SUM(mc.ImporteAsiento) amount
FROM movConta mc
WHERE mc.enlazadoSage = FALSE
GROUP BY mc.Asiento)sub
JOIN (SELECT x.ASIEN, SUM(IFNULL(x.EURODEBE,0) + IFNULL(x.EUROHABER,0)) amount
FROM vn.XDiario x
WHERE x.enlazadoSage = FALSE
GROUP BY ASIEN)sub2 ON sub2.ASIEN = sub.Asiento
WHERE sub.amount <> sub2.amount
UNION ALL
SELECT CONCAT('- Base imponible: ', sub.Asiento)
FROM (SELECT Asiento, SUM(BaseIva1 + BaseIva2 + BaseIva3 + BaseIva4) amountTaxableBase
FROM movConta
WHERE TipoFactura <> 'I'
AND enlazadoSage = FALSE
GROUP BY Asiento) sub
JOIN (SELECT ASIEN, SUM(BASEEURO) amountTaxableBase
FROM (SELECT ASIEN, SUM(BASEEURO) BASEEURO
FROM vn.XDiario
WHERE FACTURA
AND auxiliar <> '*'
AND enlazadoSage = FALSE
GROUP BY FACTURA, ASIEN)sub3
GROUP BY ASIEN) sub2 ON sub2.ASIEN = sub.Asiento
WHERE sub.amountTaxableBase<>sub2.amountTaxableBase
AND sub.amountTaxableBase/2 <> sub2.amountTaxableBase
UNION ALL
SELECT CONCAT('- Factura Duplicada: ', mc.Asiento)
FROM accountingEntryError
)sub;
IF vBookEntries IS NOT NULL THEN
START TRANSACTION;
SELECT util.notification_send ("book-entries-imported-incorrectly",
CONCAT('{"bookEntries":"', vBookEntries,'"}'),
null);
TRUNCATE accountingEntryError;
COMMIT;
END IF;
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `sage`.`movConta_BEFORE_UPDATE`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `sage`.`movConta_beforeUpdate`
BEFORE UPDATE ON `movConta`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`expedition_BU`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`expedition_beforeUpdate`
BEFORE UPDATE ON `expedition`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`moving_AI`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `srt`.`moving_afterInsert`
AFTER INSERT ON `moving`
FOR EACH ROW
BEGIN

View File

@ -1,8 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`jgallego`@`%` EVENT `vn`.`client_unassignSalesPerson`
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`client_unassignSalesPerson`
ON SCHEDULE EVERY 1 DAY
STARTS '2023-06-01 03:30:00.000'
ON COMPLETION PRESERVE
DISABLE
ENABLE
DO CALL client_unassignSalesPerson$$
DELIMITER ;

View File

@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`sale_checkWithoutCompon
ON SCHEDULE EVERY 10 MINUTE
STARTS '2020-05-04 11:56:23.000'
ON COMPLETION PRESERVE
DISABLE
ENABLE
DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE))$$
DELIMITER ;

View File

@ -1,57 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`workerTimeControl_add`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL)
RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE vDirection VARCHAR(6);
DECLARE vLastIn DATETIME;
DECLARE vDayStayMax INT;
DECLARE vHasDirectionOut INT;
DECLARE vLastInsertedId INT;
SELECT dayStayMax INTO vDayStayMax
FROM workerTimeControlParams;
SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection;
IF vDirection = 'out' THEN
SELECT MAX(timed) INTO vLastIn
FROM workerTimeControl
WHERE userFk = vUserFk
AND direction = 'in'
AND timed < vTimed;
UPDATE workerTimeControl wtc
SET wtc.direction = 'middle'
WHERE userFk = vUserFk
AND direction = 'out'
AND timed BETWEEN vLastIn AND vTimed;
ELSE IF vDirection = 'in' THEN
SELECT COUNT(*) INTO vHasDirectionOut
FROM workerTimeControl wtc
WHERE userFk = vUserFk
AND direction = 'out'
AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
UPDATE workerTimeControl wtc
SET wtc.direction = IF (vHasDirectionOut,'middle','out')
WHERE userFk = vUserFk
AND direction = 'in'
AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
END IF;
END IF;
INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual)
VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual);
SET vLastInsertedId = LAST_INSERT_ID();
CALL workerTimeControlSOWP(vUserFk, vTimed);
RETURN vLastInsertedId;
END$$
DELIMITER ;

View File

@ -1,57 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`workerTimeControl_addDirection`(vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL)
RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE vDirection VARCHAR(6);
DECLARE vLastIn DATETIME;
DECLARE vDayStayMax INT;
DECLARE vHasDirectionOut INT;
DECLARE vLastInsertedId INT;
SELECT dayStayMax INTO vDayStayMax
FROM workerTimeControlParams;
SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection;
IF vDirection = 'out' THEN
SELECT MAX(timed) INTO vLastIn
FROM workerTimeControl
WHERE userFk = vUserFk
AND direction = 'in'
AND timed < vTimed;
UPDATE workerTimeControl wtc
SET wtc.direction = 'middle'
WHERE userFk = vUserFk
AND direction = 'out'
AND timed BETWEEN vLastIn AND vTimed;
ELSE IF vDirection = 'in' THEN
SELECT COUNT(*) INTO vHasDirectionOut
FROM workerTimeControl wtc
WHERE userFk = vUserFk
AND direction = 'out'
AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
UPDATE workerTimeControl wtc
SET wtc.direction = IF (vHasDirectionOut,'middle','out')
WHERE userFk = vUserFk
AND direction = 'in'
AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed);
END IF;
END IF;
INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual)
VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual);
SET vLastInsertedId = LAST_INSERT_ID();
CALL workerTimeControlSOWP(vUserFk, vTimed);
RETURN vLastInsertedId;
END$$
DELIMITER ;

View File

@ -0,0 +1,27 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`worker_isInDepartment`(vDepartmentCode VARCHAR(255))
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Devuelve booleano si el trabajador conectado pertenece
* al departamento vDepartmentCode o a sus departamentos subordinados
*
* @param vDepartmentCode code del departamento que se desea comprobar.
* @return Devuelve verdadero si es jefe del empleado por escala jerárquica.
*/
DECLARE vIsInDepartment BOOLEAN;
WITH RECURSIVE department AS (
SELECT d.id FROM vn.department d WHERE code = vDepartmentCode
UNION
SELECT d.id
FROM department ds
JOIN vn.department d ON ds.id = d.parentFk
)
SELECT COUNT(*) INTO vIsInDepartment FROM department ds
JOIN vn.workerDepartment wd ON wd.departmentFk = ds.id
WHERE wd.workerFk = account.myUser_getId();
RETURN vIsInDepartment;
END$$
DELIMITER ;

View File

@ -25,12 +25,15 @@ BEGIN
SELECT itemFk, buyFk, warehouseFk, landed landing
FROM tmp.buyUltimateFromInterval
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
AND landed <= vDated;
AND landed <= vDated
AND NOT isIgnored;
INSERT IGNORE INTO tmp.buyUltimate
SELECT itemFk, buyFk, warehouseFk, landed landing
FROM tmp.buyUltimateFromInterval
WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL)
AND landed > vDated;
AND landed > vDated
ORDER BY isIgnored = FALSE DESC;
END$$
DELIMITER ;

View File

@ -26,11 +26,13 @@ BEGIN
SELECT itemFk,
warehouseFk,
buyFk,
MAX(landed) landed
MAX(landed) landed,
isIgnored
FROM (SELECT b.itemFk,
t.warehouseInFk warehouseFk,
b.id buyFk,
t.landed
t.landed,
b.isIgnored
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
@ -42,12 +44,13 @@ BEGIN
LIMIT 10000000000000000000) sub
GROUP BY itemFk, warehouseFk;
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed)
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
SELECT
b.itemFk,
t.warehouseInFk warehouseFk,
b.id buyFk,
t.landed
t.landed,
b.isIgnored
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
@ -57,12 +60,13 @@ BEGIN
AND NOT b.isIgnored
GROUP BY itemFk, warehouseInFk;
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed)
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
SELECT
b.itemFk,
t.warehouseInFk warehouseFk,
b.id buyFk,
t.landed
t.landed,
b.isIgnored
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
@ -72,16 +76,18 @@ BEGIN
GROUP BY itemFk, warehouseInFk;
-- ItemOriginal
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed)
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
SELECT itemFk,
warehouseFk,
buyFk,
MAX(landed) landed
MAX(landed) landed,
isIgnored
FROM (SELECT b.itemFk,
t.warehouseInFk warehouseFk,
b.id buyFk,
t.landed,
itemOriginalFk
itemOriginalFk,
b.isIgnored
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
@ -95,12 +101,13 @@ BEGIN
LIMIT 10000000000000000000) sub
GROUP BY itemOriginalFk, warehouseFk;
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed)
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
SELECT
b.itemFk,
t.warehouseInFk warehouseFk,
b.id buyFk,
t.landed
t.landed,
b.isIgnored
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
@ -111,12 +118,13 @@ BEGIN
AND itemOriginalFk
GROUP BY itemOriginalFk, warehouseInFk;
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed)
INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored)
SELECT
b.itemFk,
t.warehouseInFk warehouseFk,
b.id buyFk,
t.landed
t.landed,
b.isIgnored
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk

View File

@ -12,9 +12,8 @@ BEGIN
SELECT b.id
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN duaEntry de ON de.entryFk = e.id
JOIN dua d ON d.id = de.duaFk
JOIN awb a ON a.id = d.awbFk
JOIN travel t ON t.id = e.travelFk
JOIN awb a ON a.id = t.awbFk
WHERE a.code = awbFk;
CALL buy_recalcPrices();

View File

@ -18,9 +18,9 @@ BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
CREATE OR REPLACE TEMPORARY TABLE tClientList
SELECT c.clientFk
SELECT c.id clientFk
FROM bs.clientDied cd
JOIN client c ON c.id = cd.id
JOIN client c ON c.id = cd.clientFk
LEFT JOIN clientProtected cp ON cp.clientFk = c.id
LEFT JOIN salesPersonProtected sp ON sp.salesPersonFk = c.salesPersonFk
JOIN province p ON p.id = c.provinceFk

View File

@ -1,20 +1,27 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`(vUserFk INT, OUT vCollectionFk INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`(
vUserFk INT,
OUT vCollectionFk INT
)
proc:BEGIN
/* Comprueba si existen colecciones libres que se ajustan al perfil del usuario
* y le asigna la más antigua.
* Añade un registro al semillero de colecciones
/**
* Comprueba si existen colecciones libres que se ajustan
* al perfil del usuario y le asigna la más antigua.
* Añade un registro al semillero de colecciones.
*
* @param vUserFk Id de usuario
* @param vCollectionFk Id de colección
*/
DECLARE vHasTooMuchCollections BOOL;
DECLARE vLockTime INT DEFAULT 15;
-- Si hay colecciones sin terminar, sale del proceso
CALL vn.collection_get(vUserFk);
CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
INTO vHasTooMuchCollections
FROM tCollection
JOIN vn.productionConfig pc ;
JOIN productionConfig pc ;
DROP TEMPORARY TABLE tCollection;
@ -30,40 +37,49 @@ proc:BEGIN
-- Se eliminan las colecciones sin asignar que estan obsoletas
INSERT INTO ticketTracking(stateFk, ticketFk)
SELECT s.id, tc.ticketFk
FROM vn.collection c
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id
JOIN vn.state s ON s.code = 'PRINTED_AUTO'
JOIN vn.productionConfig pc
FROM `collection` c
JOIN ticketCollection tc ON tc.collectionFk = c.id
JOIN `state` s ON s.code = 'PRINTED_AUTO'
JOIN productionConfig pc
WHERE c.workerFk IS NULL
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
DELETE c.*
FROM vn.collection c
JOIN vn.productionConfig pc
FROM `collection` c
JOIN productionConfig pc
WHERE c.workerFk IS NULL
AND TIMEDIFF(util.VN_NOW(), c.created) > pc.maxNotAssignedCollectionLifeTime;
-- Se a<EFBFBD>ade registro al semillero
INSERT INTO vn.collectionHotbed(userFk)
-- Se añade registro al semillero
INSERT INTO collectionHotbed(userFk)
VALUES(vUserFk);
-- Comprueba si hay colecciones disponibles que se ajustan a su configuracion
SELECT MIN(c.id)
INTO vCollectionFk
FROM vn.collection c
JOIN vn.operator o
FROM `collection` c
JOIN operator o
ON (o.itemPackingTypeFk = c.itemPackingTypeFk OR c.itemPackingTypeFk IS NULL)
AND o.numberOfWagons = c.wagons
AND o.trainFk = c.trainFk
AND o.warehouseFk = c.warehouseFk
AND c.workerFk IS NULL
AND (c.saleTotalCount <= o.linesLimit OR o.linesLimit IS NULL)
JOIN (
SELECT tc.collectionFk, SUM(sv.volume) volume
FROM ticketCollection tc
JOIN saleVolume sv ON sv.ticketFk = tc.ticketFk
WHERE sv.shipped >= util.VN_CURDATE()
GROUP BY tc.collectionFk
) sub ON sub.collectionFk = c.id
AND (volume <= o.volumeLimit OR o.volumeLimit IS NULL)
WHERE o.workerFk = vUserFk;
IF vCollectionFk IS NULL THEN
CALL vn.collection_new(vUserFk, vCollectionFk);
CALL collection_new(vUserFk, vCollectionFk);
END IF;
UPDATE vn.collection
UPDATE `collection`
SET workerFk = vUserFk
WHERE id = vCollectionFk;

View File

@ -9,6 +9,10 @@ proc:BEGIN
DECLARE vWarehouseFk INT;
DECLARE vWagons INT;
DECLARE vTrainFk INT;
DECLARE vLinesLimit INT DEFAULT NULL;
DECLARE vTicketLines INT;
DECLARE vVolumeLimit DECIMAL DEFAULT NULL;
DECLARE vTicketVolume DECIMAL;
DECLARE vMaxTickets INT;
DECLARE vStateFk VARCHAR(45);
DECLARE vFirstTicketFk INT;
@ -24,12 +28,11 @@ proc:BEGIN
DECLARE vLockName VARCHAR(215);
DECLARE vLockTime INT DEFAULT 15;
DECLARE vFreeWagonFk INT;
DECLARE cur1 CURSOR FOR
SELECT ticketFk
DECLARE c1 CURSOR FOR
SELECT ticketFk, `lines`, m3
FROM tmp.productionBuffer
WHERE ticketFk <> vFirstTicketFk
ORDER BY
HH,
ORDER BY HH,
mm,
productionOrder DESC,
m3 DESC,
@ -41,8 +44,7 @@ proc:BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
SELECT
pc.ticketTrolleyMax * o.numberOfWagons,
SELECT pc.ticketTrolleyMax * o.numberOfWagons,
pc.hasUniqueCollectionTime,
w.code,
o.warehouseFk,
@ -50,9 +52,10 @@ proc:BEGIN
st.code,
CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk),
o.numberOfWagons,
o.trainFk
INTO
vMaxTickets,
o.trainFk,
o.linesLimit,
o.volumeLimit
INTO vMaxTickets,
vHasUniqueCollectionTime,
vWorkerCode,
vWarehouseFk,
@ -60,7 +63,9 @@ proc:BEGIN
vStateFk,
vLockName,
vWagons,
vTrainFk
vTrainFk,
vLinesLimit,
vVolumeLimit
FROM productionConfig pc
JOIN worker w ON w.id = vUserFk
JOIN state st ON st.`code` = 'ON_PREPARATION'
@ -140,23 +145,32 @@ proc:BEGIN
JOIN agency a ON a.id = am.agencyFk
JOIN productionConfig pc
WHERE pb.shipped <> util.VN_CURDATE()
OR (pb.ubicacion IS NULL AND a.isOwn = TRUE)
OR (s.isPreparable = FALSE AND s.isPrintable = FALSE)
OR (pb.ubicacion IS NULL AND a.isOwn)
OR (NOT s.isPreparable AND NOT s.isPrintable)
OR pb.collectionH IS NOT NULL
OR pb.collectionV IS NOT NULL
OR pb.collectionN IS NOT NULL
OR (pb.H = 0 AND pb.V > 0 AND vItemPackingTypeFk = 'H')
OR (pb.V = 0 AND vItemPackingTypeFk = 'V')
OR (NOT pb.H AND pb.V > 0 AND vItemPackingTypeFk = 'H')
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
OR LENGTH(pb.problem) > 0;
OR LENGTH(pb.problem) > 0
OR (pb.lines >= vLinesLimit AND vLinesLimit IS NOT NULL)
OR (pb.m3 >= vVolumeLimit AND vVolumeLimit IS NOT NULL);
END IF;
-- Es importante que el primer ticket se coja en todos los casos
SELECT ticketFk, HH, mm
INTO vFirstTicketFk, vHour, vMinute
FROM tmp.productionBuffer
ORDER BY
SELECT ticketFk,
HH,
mm,
`lines`,
m3
INTO vFirstTicketFk,
vHour,
vMinute,
vTicketLines,
vTicketVolume
FROM tmp.productionBuffer
ORDER BY HH,
mm,
productionOrder DESC,
m3 DESC,
@ -168,30 +182,40 @@ proc:BEGIN
-- Hay que excluir aquellos que no tengan la misma hora de preparacion, si procede
IF vHasUniqueCollectionTime THEN
DELETE
FROM tmp.productionBuffer
DELETE FROM tmp.productionBuffer
WHERE HH <> vHour
OR mm <> vMinute;
END IF;
SET vTicketFk = vFirstTicketFk;
SET @lines = 0;
SET @volume = 0;
OPEN cur1;
OPEN c1;
read_loop: LOOP
SET vDone = FALSE;
CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk);
-- Buscamos un ticket que cumpla con los requisitos en el listado
IF ((vTicketLines + @lines) <= vLinesLimit OR vLinesLimit IS NULL)
AND ((vTicketVolume + @volume) <= vVolumeLimit OR vVolumeLimit IS NULL) THEN
CALL ticket_splitItemPackingType(vTicketFk, vItemPackingTypeFk);
DROP TEMPORARY TABLE tmp.ticketIPT;
UPDATE tmp.productionBuffer pb
JOIN (SELECT @litros:= SUM(litros) liters, COUNT(*) `lines`, MAX(i.`size`) height
JOIN (
SELECT SUM(litros) liters,
@lines:= COUNT(*) + @lines `lines`,
MAX(i.`size`) height,
@volume := SUM(sv.volume) + @volume volume
FROM saleVolume sv
JOIN sale s ON s.id = sv.saleFk
JOIN item i ON i.id = s.itemFk
WHERE sv.ticketFk = vTicketFk ) sub
SET pb.liters = sub.liters, pb.`lines` = sub.`lines`, pb.height = sub.height
WHERE sv.ticketFk = vTicketFk
) sub
SET pb.liters = sub.liters,
pb.`lines` = sub.`lines`,
pb.height = sub.height
WHERE pb.ticketFk = vTicketFk;
UPDATE tTrain tt
@ -201,22 +225,20 @@ proc:BEGIN
AND tt.`lines` >= pb.`lines`
AND (tt.height >= pb.height OR vItemPackingTypeFk <> 'V')
AND tt.ticketFk IS NULL
ORDER BY
wagon,
ORDER BY wagon,
shelve,
tt.liters,
tt.`lines`,
tt.height
LIMIT 1;
-- Si no le encuentra una balda adecuada, intentamos darle un carro entero
-- si queda alguno libre
-- Si no le encuentra una balda adecuada, intentamos darle un carro entero si queda alguno libre
IF NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN
SELECT tt.wagon
INTO vFreeWagonFk
FROM tTrain tt
LEFT JOIN (SELECT DISTINCT wagon
LEFT JOIN (
SELECT DISTINCT wagon
FROM tTrain
WHERE ticketFk IS NOT NULL
) nn ON nn.wagon = tt.wagon
@ -232,7 +254,8 @@ proc:BEGIN
-- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo
DELETE tt.*
FROM tTrain tt
LEFT JOIN (SELECT DISTINCT wagon
LEFT JOIN (
SELECT DISTINCT wagon
FROM tTrain
WHERE ticketFk IS NOT NULL
) nn ON nn.wagon = tt.wagon
@ -240,14 +263,18 @@ proc:BEGIN
END IF;
END IF;
FETCH cur1 INTO vTicketFk;
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
IF vDone OR NOT (SELECT COUNT(*) FROM tTrain WHERE ticketFk IS NULL) THEN
LEAVE read_loop;
END IF;
ELSE
FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume;
IF vDone THEN
LEAVE read_loop;
END IF;
END IF;
END LOOP;
CLOSE cur1;
CLOSE c1;
IF (SELECT COUNT(*) FROM tTrain WHERE ticketFk) THEN
UPDATE collection c
@ -263,7 +290,6 @@ proc:BEGIN
ORDER BY tt.wagon, tt.shelve;
-- Actualiza el estado de los tickets
CALL collection_setState(vCollectionFk, vStateFk);
-- Aviso para la preparacion previa
@ -274,9 +300,10 @@ proc:BEGIN
CALL sales_mergeByCollection(vCollectionFk);
UPDATE collection c
JOIN (SELECT count(*) saleTotalCount ,
sum(s.isPicked != 0) salePickedCount
UPDATE `collection` c
JOIN (
SELECT COUNT(*) saleTotalCount,
SUM(s.isPicked <> 0) salePickedCount
FROM ticketCollection tc
JOIN sale s ON s.ticketFk = tc.ticketFk
WHERE tc.collectionFk = vCollectionFk
@ -287,11 +314,9 @@ proc:BEGIN
WHERE c.id = vCollectionFk;
ELSE
-- CALL util.throw('No ha sido posible obtener colección');
DELETE FROM collection WHERE id = vCollectionFk;
DELETE FROM `collection`
WHERE id = vCollectionFk;
SET vCollectionFk = NULL;
END IF;
DO RELEASE_LOCK(vLockName);

View File

@ -23,9 +23,10 @@ BEGIN
FROM `time`
WHERE dated = util.VN_CURDATE();
IF vMaxPeriod < vPeriod
AND vWeek > vConfigWeek THEN
REPLACE comparative(
IF vMaxPeriod < vPeriod AND vWeek > vConfigWeek THEN
DELETE FROM comparative WHERE timePeriod BETWEEN vMaxPeriod AND vPeriod;
INSERT INTO comparative(
timePeriod,
itemFk,
warehouseFk,

View File

@ -4,8 +4,8 @@ BEGIN
DECLARE vNewDuaFk INT;
INSERT INTO dua(awbFk,companyFk)
SELECT awbFk,companyFk
INSERT INTO dua(companyFk)
SELECT companyFk
FROM dua
WHERE id = vDuaFk;

View File

@ -80,7 +80,7 @@ OPEN cur1;
FROM vn.travel tr
JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk
AND ea.warehouseInFk = tr.warehouseInFk
AND ea.agencyModeFk = tr.agencyFk
AND ea.agencyModeFk = tr.agencyModeFk
WHERE ea.id = vId
AND tr.landed = vLanded;

View File

@ -13,7 +13,8 @@ BEGIN
SELECT COUNT(*) INTO vLines
FROM invoiceInTax
WHERE invoiceInFk = vInvoiceInFk;
WHERE invoiceInFk = vInvoiceInFk
AND (taxTypeSageFk OR transactionTypeSageFk);
IF vLines >= vTaxRowLimit THEN
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));

View File

@ -17,20 +17,21 @@ BEGIN
DECLARE vPacking INT;
DECLARE vRoundQuantity INT DEFAULT 1;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk
INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE s.id = vSaleFk;
UPDATE vn.sale
SET quantity = quantity - vQuantity
WHERE id = vSaleFk;
CALL buyUltimate(vWarehouseFk, vDate);
CALL vn.buyUltimate(vWarehouseFk, vDate);
SELECT `grouping`, groupingMode, packing
INTO vGrouping,vBox,vPacking
SELECT `grouping`, groupingMode, packing INTO vGrouping, vBox, vPacking
FROM buy b
JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk
WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk;
@ -42,18 +43,28 @@ BEGIN
SET vRoundQuantity = vGrouping;
END IF;
INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept)
SELECT vTicketFk, vMateFk, CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName)
FROM vn.item i
START TRANSACTION;
UPDATE sale
SET quantity = quantity - vQuantity
WHERE id = vSaleFk;
INSERT INTO sale(ticketFk, itemFk, quantity, concept)
SELECT vTicketFk,
vMateFk,
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity,
CONCAT('+ ',i.longName)
FROM item i
WHERE id = vMateFk;
SELECT LAST_INSERT_ID() INTO vSaleFk;
CALL vn.sale_calculateComponent(vSaleFk, NULL);
CALL sale_calculateComponent(vSaleFk, NULL);
INSERT INTO vn.itemProposal(itemFk, mateFk, counter)
INSERT INTO itemProposal(itemFk, mateFk, counter)
VALUES(vItemFk, vMateFk, 1)
ON DUPLICATE KEY UPDATE counter = counter + 1;
COMMIT;
END$$
DELIMITER ;

View File

@ -23,7 +23,7 @@ proc:BEGIN
CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho,
sub.name itemColour
FROM (SELECT iss.itemFk,
CONCAT(i.longName, ' ', i.size,' ', IFNULL(i.subName,'') ) longName,
CONCAT(i.longName, ' ', IFNULL(i.size, ''),' ', IFNULL(i.subName, '') ) longName,
'' size,
CONCAT(iss.parkingCode, ' ', iss.shelvingFk) producer,
0 upstairs,

View File

@ -81,8 +81,8 @@ proc: BEGIN
rm.bufferFk
FROM tmp.productionTicket tt
JOIN ticket t ON tt.ticketFk = t.id
LEFT JOIN ticketStateToday tst ON tst.ticket = t.id
LEFT JOIN state st ON st.id = tst.state
LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id
LEFT JOIN `state` st ON st.id = tst.state
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
JOIN address a ON a.id = t.addressFk

View File

@ -1,13 +1,15 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_add`(vSectorFk INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`saleGroup_add`(vSectorFk INT,vTicketFk INT)
BEGIN
/**
* Añade un nuevo registro a la tabla y devuelve su id.
*
* @param vSectorFk Identificador de vn.sector
*/
INSERT INTO vn.saleGroup(userFk, sectorFk)
VALUES (account.myUser_getId(), vSectorFk);
INSERT INTO vn.saleGroup
SET `userFk` = account.myUser_getId(),
`sectorFk` = vSectorFk,
`ticketFk` = vTicketFk;
SELECT LAST_INSERT_ID();
END$$

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_calculateComponent`(vSelf INT, vOption INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_calculateComponent`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**
* Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes

View File

@ -61,7 +61,7 @@ BEGIN
FROM sale
WHERE id = vSaleFk;
CALL sale_calculateComponent(vSaleFk, 1);
CALL sale_calculateComponent(vSaleFk, 'renewPrices');
END LOOP;
CLOSE vCur;

View File

@ -17,6 +17,55 @@ BEGIN
CALL productionControl(vWarehouseFk, 0);
-- Products with vn.item.isBoxPickingMode = TRUE, pay atention to vn.itemShelving.packing
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(saleFk INT PRIMARY KEY)
SELECT
s.ticketFk,
s.id saleFk,
s.itemFk,
s.concept,
s.quantity,
MAKETIME(pb.HH,pb.mm,0) etd,
pb.routeFk,
FLOOR(s.quantity / ish.packing) stickers,
ish.packing,
b.packagingFk
FROM sale s
JOIN item i ON i.id = s.itemFk
JOIN itemShelving ish ON ish.itemFk = s.itemFk
LEFT JOIN ( SELECT iss.itemShelvingFk,
s.itemFk,
SUM(iss.quantity) reserve
FROM itemShelvingSale iss
JOIN sale s ON s.id = iss.saleFk
WHERE iss.isPicked = FALSE
AND iss.created >= vDated
GROUP BY iss.itemShelvingFk, s.itemFk) tISS
ON tISS.itemFk = ish.itemFk AND tISS.itemShelvingFk = ish.id
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
JOIN agencyMode am ON am.id = pb.agencyModeFk
LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
WHERE s.quantity BETWEEN ish.packing AND (ish.visible - IFNULL(tISS.reserve,0))
AND i.isBoxPickingMode
AND NOT pb.problem
AND sgd.saleFk IS NULL
AND p.sectorFk = vSectorFk
AND ts.isPreviousPreparable
AND ((rm.bufferFk AND rm.isPickingAllowed)
OR am.code = 'REC_ALG')
AND pb.shipped = vDated
GROUP BY s.id
ORDER BY etd;
-- Remaining products, vn.item.packingOut
INSERT IGNORE INTO tmp.sale
SELECT
s.ticketFk,
s.id saleFk,
@ -26,7 +75,8 @@ BEGIN
MAKETIME(pb.HH,pb.mm,0) etd,
pb.routeFk,
s.quantity / i.packingOut stickers,
i.packingOut
i.packingOut,
pc.defaultBigPackageFk
FROM sale s
JOIN item i ON i.id = s.itemFk
JOIN itemShelving ish ON ish.itemFk = s.itemFk
@ -34,25 +84,27 @@ BEGIN
JOIN parking p ON p.id = sh.parkingFk
JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk
JOIN agencyMode am ON am.id = pb.agencyModeFk
JOIN packagingConfig pc
LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk
LEFT JOIN itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = p.sectorFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
WHERE s.quantity MOD i.packingOut = 0
AND pb.problem = ""
WHERE s.quantity >= i.packingOut
AND NOT pb.problem
AND s.quantity > 0
AND sgd.saleFk IS NULL
AND p.sectorFk = vSectorFk
AND ts.isPreviousPreparable
AND iss.visible >= s.quantity
AND ((rm.bufferFk AND rm.isPickingAllowed)
OR am.name = 'REC_ALGEMESI')
OR am.code = 'REC_ALG')
AND pb.shipped = vDated
GROUP BY s.id
ORDER BY etd;
SELECT * FROM tmp.sale;
DROP TEMPORARY TABLE tmp.productionBuffer;
DROP TEMPORARY TABLE tmp.sale;
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_recalcComponent`(vOption INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_recalcComponent`(vOption VARCHAR(25))
proc: BEGIN
/**
* Este procedimiento recalcula los componentes de un conjunto de sales,
@ -99,7 +99,7 @@ proc: BEGIN
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
IF vOption IS NULL THEN
SET vOption = IF(vIsEditable, 1, 6);
SET vOption = IF(vIsEditable, 'renewPrices', 'imbalance');
END IF;
CALL ticketComponentUpdateSale(vOption);

View File

@ -0,0 +1,136 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT)
BEGIN
/**
* Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones.
*
* @param vSaleFk id de la tabla sale
* @param vNewItemFk articulo sustituto
* @param vQuantity cantidad que se va a sustituir
*/
DECLARE vTicketFk INT;
DECLARE vItemFk INT;
DECLARE vWarehouseFk SMALLINT;
DECLARE vDate DATE;
DECLARE vGrouping INT;
DECLARE vGroupingModeFk INT;
DECLARE vPacking INT;
DECLARE vRoundQuantity INT DEFAULT 1;
DECLARE vLanded DATE;
DECLARE vAddressFk INT;
DECLARE vAgencyModeFk INT;
DECLARE vNewPrice DECIMAL(10,2);
DECLARE vOldPrice DECIMAL(10,2);
DECLARE vOption INT DEFAULT NULL;
DECLARE vNewSaleFk INT;
DECLARE vChangePrice INT DEFAULT 1;
DECLARE vBuyerDiscount INT DEFAULT 4;
DECLARE vManaDiscount INT DEFAULT 3;
DECLARE vForceToGrouping INT DEFAULT 1;
DECLARE vForceToPacking INT DEFAULT 2;
DECLARE vFinalPrice DECIMAL(10,2);
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
SELECT s.ticketFk,
LEAST(s.quantity, vQuantity),
s.itemFk,
t.shipped,
t.warehouseFk,
t.landed,
t.addressFk,
t.agencyModeFk,
s.price
INTO vTicketFk,
vQuantity,
vItemFk,
vDate,
vWarehouseFk,
vLanded,
vAddressFk,
vAgencyModeFk,
vOldPrice
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
WHERE s.id = vSaleFk;
CALL buyUltimate(vWarehouseFk, vDate);
SELECT `grouping`, groupingMode, packing
INTO vGrouping,vGroupingModeFk,vPacking
FROM buy b
JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk
WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk;
IF vGroupingModeFk = vForceToPacking AND vPacking > 0 THEN
SET vRoundQuantity = vPacking;
END IF;
IF vGroupingModeFk = vForceToGrouping AND vGrouping > 0 THEN
SET vRoundQuantity = vGrouping;
END IF;
CALL catalog_calcFromItem(
vLanded,
vAddressFk,
vAgencyModeFk,
vNewItemFk);
SELECT price INTO vNewPrice
FROM tmp.ticketCalculateItem;
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
END IF;
IF vNewPrice > vOldPrice THEN
SET vFinalPrice = vOldPrice;
IF worker_isInDepartment('vt') THEN
SET vOption = vManaDiscount;
ELSE
SET vOption = vBuyerDiscount;
END IF;
ELSE
SET vFinalPrice = vNewPrice;
SET vOption = vChangePrice;
END IF;
START TRANSACTION;
UPDATE sale
SET quantity = quantity - vQuantity
WHERE id = vSaleFk;
INSERT INTO vn.sale(ticketFk,
itemFk,
quantity,
concept,
price)
SELECT vTicketFk,
vNewItemFk,
CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName),
vFinalPrice
FROM vn.item i
WHERE id = vNewItemFk;
SELECT LAST_INSERT_ID() INTO vNewSaleFk;
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
CREATE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (saleFk))
ENGINE = MEMORY
SELECT id saleFk, vWarehouseFk warehouseFk
FROM sale s WHERE id = vNewSaleFk;
CALL ticketComponentUpdateSale(vOption);
CALL catalog_componentPurge();
INSERT INTO itemProposal(itemFk, mateFk, counter)
VALUES(vItemFk, vNewItemFk, 1)
ON DUPLICATE KEY UPDATE counter = counter + 1;
COMMIT;
END$$
DELIMITER ;

View File

@ -20,7 +20,7 @@ BEGIN
FROM sale
WHERE ticketFk = vTicketNew AND price = 0;
CALL sale_recalcComponent(1);
CALL sale_recalcComponent('renewPrices');
-- Bionizamos lineas con Preu > 0
CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
@ -29,7 +29,7 @@ BEGIN
FROM sale
WHERE ticketFk = vTicketNew AND price > 0;
CALL sale_recalcComponent(6);
CALL sale_recalcComponent('imbalance');
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;

View File

@ -10,7 +10,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpda
vLanded DATE,
vIsDeleted BOOLEAN,
vHasToBeUnrouted BOOLEAN,
vOption INT)
vOption VARCHAR(25))
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
@ -27,7 +27,6 @@ BEGIN
JOIN address a ON a.id = vAddressFk
SET t.nickname = a.nickname
WHERE t.id = vTicketFk;
END IF;
UPDATE ticket t
@ -48,7 +47,6 @@ BEGIN
WHERE t.id = vTicketFk;
END IF;
IF vOption <> 8 THEN
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
CREATE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (saleFk))
@ -59,7 +57,6 @@ BEGIN
CALL ticketComponentUpdateSale (vOption);
DROP TEMPORARY TABLE tmp.sale;
END IF;
COMMIT;
END$$
DELIMITER ;

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpdateSale`(vOption INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketComponentUpdateSale`(vCode VARCHAR(25))
BEGIN
/**
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
@ -9,69 +9,11 @@ BEGIN
* @param table tmp.sale tabla memory con el campo saleFk, warehouseFk
**/
DECLARE vComponentFk INT;
DECLARE vRenewComponents BOOLEAN;
DECLARE vKeepPrices BOOLEAN;
CASE vOption
WHEN 1 THEN
SET vRenewComponents = TRUE;
SET vKeepPrices = FALSE;
WHEN 2 THEN
SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection';
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 3 THEN
SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana';
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 4 THEN
SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount';
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
/* WHEN 5 THEN
SET vComponentFk = 35;
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;*/
WHEN 6 THEN
SELECT id INTO vComponentFk FROM component WHERE `code` = 'imbalance';
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
WHEN 7 THEN
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
AND sc.componentFk NOT IN (28, 29)
GROUP BY s.id;
IF vCode <> 'renewPrices' THEN
SELECT id INTO vComponentFk FROM component WHERE `code` = vCode;
END IF;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
AND sc.componentFk NOT IN (28, 29)
GROUP BY s.id;
SET vRenewComponents = FALSE;
SET vKeepPrices = FALSE;
WHEN 8 THEN
DELETE sc.*
FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
FROM sale s
JOIN tmp.sale tmps ON tmps.saleFk = s.id;
SET vRenewComponents = FALSE;
SET vKeepPrices = FALSE;
WHEN 9 THEN
SET vRenewComponents = TRUE;
SET vKeepPrices = TRUE;
END CASE;
IF vRenewComponents THEN
DELETE sc.*
FROM tmp.sale tmps
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
@ -89,16 +31,6 @@ BEGIN
WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
-- Añadir componente venta por paquete
DROP TEMPORARY TABLE IF EXISTS tmp.sale2;
CREATE TEMPORARY TABLE tmp.sale2
(PRIMARY KEY (saleFk))
ENGINE = MEMORY
SELECT * FROM tmp.sale;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent2;
CREATE TEMPORARY TABLE tmp.ticketComponent2
SELECT * FROM tmp.ticketComponent;
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT t.id, t.componentFk, t.cost
FROM (
@ -112,20 +44,15 @@ BEGIN
LEFT JOIN (
SELECT s.id
FROM vn.sale s
JOIN tmp.sale2 tmps ON tmps.saleFk = s.id
JOIN tmp.ticketComponent2 tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
JOIN tmp.sale tmps ON tmps.saleFk = s.id
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk
JOIN `component` c ON c.id = sc.componentFk AND c.code = 'lastUnitsDiscount'
) tp ON tp.id = s.id
WHERE tp.id IS NULL
HAVING resto <> 0) t;
DROP TEMPORARY TABLE IF EXISTS
tmp.sale2,
tmp.ticketComponent2;
END IF;
IF vKeepPrices THEN
IF vCode <> 'renewPrices' THEN
REPLACE INTO saleComponent(saleFk, componentFk, value)
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
FROM sale s

View File

@ -23,7 +23,7 @@ BEGIN
JOIN vn.parking p ON p.id = tp.parkingFk
JOIN vn.sector sc ON sc.id = p.sectorFk
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk
JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk
JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk
JOIN vn.ticket t ON t.id = tp.ticketFk
JOIN vn.zone z ON z.id = t.zoneFk
JOIN vn.agencyMode am ON am.id = z.agencyModeFk

View File

@ -37,7 +37,7 @@ BEGIN
JOIN vn.parking p ON p.id = tp.parkingFk
JOIN vn.sector sc ON sc.id = p.sectorFk
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk
JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk
JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk
JOIN vn.ticket t ON t.id = tp.ticketFk
JOIN vn.zone z ON z.id = t.zoneFk
JOIN vn.agencyMode am ON am.id = z.agencyModeFk

View File

@ -14,7 +14,7 @@ BEGIN
SELECT s.alertLevel INTO vAlertLevel
FROM state s
JOIN ticketStateToday tst ON tst.state = s.id
WHERE tst.ticket = vTicketFk
WHERE tst.ticketFk = vTicketFk
LIMIT 1;
IF vAlertLevel < 2 THEN

View File

@ -22,6 +22,7 @@ BEGIN
t.warehouseFk,
ts.alertLevel,
t.shipped,
t.totalWithVat,
sub2.shipped futureShipped,
t.workerFk,
st.code stateCode,

View File

@ -37,7 +37,7 @@ BEGIN
AND c.id IS NULL
AND ic.merchandise;
CALL vn.sale_recalcComponent(1);
CALL sale_recalcComponent('renewPrices');
DROP TEMPORARY TABLE tmp.recalculateSales;
DROP TEMPORARY TABLE tmp.coste;

View File

@ -12,7 +12,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_componentMak
vLanded DATE,
vIsDeleted BOOLEAN,
vHasToBeUnrouted BOOLEAN,
vOption INT)
vOption VARCHAR(25))
BEGIN
/**
@ -76,7 +76,6 @@ BEGIN
WHERE t.id = vTicketFk;
END IF;
IF vOption <> 8 THEN
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
CREATE TEMPORARY TABLE tmp.sale
(PRIMARY KEY (saleFk))
@ -92,7 +91,6 @@ BEGIN
DROP TEMPORARY TABLE tmp.sale;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
END IF;
DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
END$$

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalcComponents`(vSelf INT, vOption INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN
/**

View File

@ -32,7 +32,7 @@ proc:BEGIN
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname )
WHERE id = vTicketFk;
SELECT CONCAT("Se ha cambiado el ticket ", vTicketFk, " al dia ", vDated);
SELECT "moved" message, NULL ticketFuture;
LEAVE proc;
END IF;
@ -46,8 +46,7 @@ proc:BEGIN
s.concept = CONCAT('(s) ', s.concept)
WHERE ss.ticketFk = vTicketFk;
SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk,
" al ticket existente ", vTicketFutureFk,"(", vDated,")");
SELECT "future" message, NULL ticketFuture;
LEAVE proc;
END IF;
@ -72,7 +71,6 @@ proc:BEGIN
CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING');
SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk,
" al nuevo ticket ", vTicketFutureFk,"(", vDated,")");
SELECT "new" message,vTicketFutureFk ticketFuture;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100))
proc: BEGIN
/**
* deprecated call workerTimeControl_check
*/
CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk);
END$$
DELIMITER ;

View File

@ -1,14 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME)
BEGIN
/*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk)
VALUES(vUserFk, vDated, FALSE, vWarehouseFk);
CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/
CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,util.VN_NOW(),FALSE);
END$$
DELIMITER ;

View File

@ -1,13 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControlPinGenerate`(
vWorkerFk INT)
BEGIN
/**
* Create new pin for workerFk or new pin for all workers if vWorkerFk is null
*
*/
END$$
DELIMITER ;

View File

@ -1,16 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControlSetOrder`()
BEGIN
SET @order := 1;
SET @userFk := 0;
SET @day := 0;
UPDATE tmp.workerTimeControl
SET `order` = IF(userFk = @userFk AND day(timed) = @day, @order := @order + 1, @order := 1),
userFk = @userFk := userFk,
manual = manual + (0 * @day := day(timed))
ORDER BY userFk, timed;
END$$
DELIMITER ;

View File

@ -1,8 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL)
BEGIN
SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual);
END$$
DELIMITER ;

View File

@ -1,39 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_repair`()
proc: BEGIN
/**
* Corrige las fichadas
*
*/
/*1- poner todos a middle*/
UPDATE vn.workerTimeControl SET direction = 'middle';
/*2- poner los out*/
UPDATE vn.workerTimeControl wtc
JOIN
(SELECT userFk,MAX(timed) maxTimed FROM
(SELECT id, userFk, timed, date(timed) dated
FROM vn.workerTimeControl
) sub
GROUP BY userFk,dated
)sub
SET direction = "out"
WHERE wtc.userFk = sub.userFk
AND wtc.timed = sub.maxTimed;
/*3- poner los in*/
UPDATE vn.workerTimeControl wtc
JOIN
(SELECT userFk,MIN(timed) maxTimed FROM
(SELECT id, userFk, timed, date(timed) dated
FROM vn.workerTimeControl
) sub
GROUP BY userFk,dated
)sub
SET direction = "in"
WHERE wtc.userFk = sub.userFk
AND wtc.timed = sub.maxTimed ;
END$$
DELIMITER ;

View File

@ -1,15 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE)
BEGIN
SET @order := 0;
SET @day := '2000-01-01';
UPDATE vn.workerTimeControl w
SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1
WHERE w.userFk = vUserFk
AND w.timed BETWEEN vStarted AND util.dayend(vFinished)
ORDER BY w.timed;
END$$
DELIMITER ;

View File

@ -5,7 +5,7 @@ BEGIN
DECLARE vForwardDays INT;
SELECT forwardDays INTO vForwardDays FROM zoneConfig;
CALL util.time_createTable(util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL vForwardDays DAY));
CALL util.time_generate(util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL vForwardDays DAY));
DROP TEMPORARY TABLE IF EXISTS tLandings;
CREATE TEMPORARY TABLE tLandings

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_AD`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_afterDelete`
AFTER DELETE ON `autonomy`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_BI`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_beforeInsert`
BEFORE INSERT ON `autonomy`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_BU`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`autonomy_beforeUpdate`
BEFORE UPDATE ON `autonomy`
FOR EACH ROW
BEGIN

View File

@ -1,5 +1,5 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awb_bi`
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awb_beforeInsert`
BEFORE INSERT ON `awb`
FOR EACH ROW
BEGIN

Some files were not shown because too many files have changed in this diff Show More