1361 - Añadir filtro por año #348
|
@ -8,6 +8,11 @@ RUN apt-get update \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg2 \
|
gnupg2 \
|
||||||
libfontconfig \
|
libfontconfig \
|
||||||
|
&& apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
|
||||||
|
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
|
||||||
|
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
|
||||||
|
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
|
||||||
|
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
|
||||||
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
nodejs \
|
nodejs \
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WorkerLog', '*', 'READ', 'ALLOW', 'ROLE', 'hr');
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `vn`.`claim`
|
|
||||||
ADD COLUMN `hasToPickUp` TINYINT(1) NOT NULL AFTER `ticketFk`;
|
|
|
@ -1,28 +0,0 @@
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
DROP FOREIGN KEY `roleFgn`;
|
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
ADD COLUMN `code` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL AFTER `id`,
|
|
||||||
CHANGE COLUMN `roleFk` `roleFk` INT(10) UNSIGNED NOT NULL DEFAULT '1' ;
|
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
ADD CONSTRAINT `roleFgn`
|
|
||||||
FOREIGN KEY (`roleFk`)
|
|
||||||
REFERENCES `account`.`role` (`id`)
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'pending' WHERE (`id` = '1');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'canceled' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'resolved' WHERE (`id` = '3');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'disputed' WHERE (`id` = '5');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'mana' WHERE (`id` = '6');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'managed' WHERE (`id` = '2');
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
ADD COLUMN `priority` INT NOT NULL DEFAULT 1 AFTER `roleFk`;
|
|
||||||
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '1' WHERE (`id` = '1');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '5' WHERE (`id` = '2');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '7' WHERE (`id` = '3');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '6' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '3' WHERE (`id` = '5');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '4' WHERE (`id` = '6');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '2' WHERE (`id` = '7');
|
|
|
@ -1,13 +0,0 @@
|
||||||
ALTER TABLE `vn`.`ticketWeekly`
|
|
||||||
ADD COLUMN `agencyModeFk` INT(11) NULL DEFAULT NULL AFTER `weekDay`,
|
|
||||||
ADD INDEX `agencyModeFk_idx` (`agencyModeFk` ASC);
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`ticketWeekly`
|
|
||||||
ADD CONSTRAINT `agencyModeFk`
|
|
||||||
FOREIGN KEY (`agencyModeFk`)
|
|
||||||
REFERENCES `vn`.`agencyMode` (`id`)
|
|
||||||
ON DELETE SET NULL
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`ticketWeekly`
|
|
||||||
CHANGE COLUMN `weekDay` `weekDay` TINYINT(1) NOT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6' ;
|
|
|
@ -1,130 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vIsDone BOOL;
|
|
||||||
DECLARE vLanding DATE;
|
|
||||||
DECLARE vShipment DATE;
|
|
||||||
DECLARE vWarehouse INT;
|
|
||||||
DECLARE vTicket INT;
|
|
||||||
DECLARE vWeekDay INT;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vEmpresa INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vNewTicket INT;
|
|
||||||
DECLARE vYear INT;
|
|
||||||
|
|
||||||
DECLARE rsTicket CURSOR FOR
|
|
||||||
SELECT tw.ticketFk, weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tw.agencyModeFk
|
|
||||||
FROM ticketWeekly tw
|
|
||||||
JOIN ticket t ON tt.ticketFk = t.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
|
||||||
|
|
||||||
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
|
|
||||||
|
|
||||||
OPEN rsTicket;
|
|
||||||
|
|
||||||
myLoop: LOOP
|
|
||||||
BEGIN
|
|
||||||
DECLARE vError TEXT;
|
|
||||||
DECLARE vSalesPersonEmail VARCHAR(150);
|
|
||||||
DECLARE vMailSent BOOL;
|
|
||||||
DECLARE vSubject VARCHAR(150);
|
|
||||||
DECLARE vMessage TEXT;
|
|
||||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
GET DIAGNOSTICS CONDITION 1
|
|
||||||
vError = MESSAGE_TEXT;
|
|
||||||
|
|
||||||
END;
|
|
||||||
|
|
||||||
SET vIsDone = FALSE;
|
|
||||||
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk;
|
|
||||||
|
|
||||||
IF vIsDone THEN
|
|
||||||
|
|
||||||
LEAVE myLoop;
|
|
||||||
END IF;
|
|
||||||
SELECT date INTO vShipment
|
|
||||||
FROM `time`
|
|
||||||
WHERE `year` = vYear AND `week` = vWeek
|
|
||||||
AND WEEKDAY(date) = vWeekDay;
|
|
||||||
|
|
||||||
-- busca si el ticket ya ha sido clonado
|
|
||||||
IF (SELECT COUNT(*) FROM vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
|
|
||||||
WHERE tOrig.id = vTicket AND DATE(tClon.shipped) = vShipment) > 0
|
|
||||||
THEN
|
|
||||||
ITERATE myLoop;
|
|
||||||
END IF;
|
|
||||||
CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouse);
|
|
||||||
|
|
||||||
SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
|
|
||||||
|
|
||||||
CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk, NULL, vLanding, account.userGetId(), vNewTicket);
|
|
||||||
|
|
||||||
IF (vLanding IS NULL) THEN
|
|
||||||
|
|
||||||
SELECT e.email INTO vSalesPersonEmail
|
|
||||||
FROM vn.client c
|
|
||||||
JOIN vn.worker sp ON sp.id = c.salesPersonFk
|
|
||||||
JOIN account.emailUser e ON e.userFk = sp.userFk
|
|
||||||
WHERE c.id = vClient;
|
|
||||||
|
|
||||||
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment);
|
|
||||||
SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment,
|
|
||||||
' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
|
|
||||||
' pero ha que revisar las fechas y la agencia');
|
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vMailSent
|
|
||||||
FROM vn.mail
|
|
||||||
WHERE sender = vSalesPersonEmail
|
|
||||||
AND subject = vSubject;
|
|
||||||
|
|
||||||
IF NOT vMailSent THEN
|
|
||||||
INSERT INTO vn.mail (sender,`subject`,body)
|
|
||||||
VALUES (vSalesPersonEmail, vSubject, vMessage);
|
|
||||||
END IF;
|
|
||||||
CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
|
|
||||||
SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
|
|
||||||
FROM vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
LEFT JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
LEFT JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
LEFT JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk AND DATE(tClon.shipped) = vShipment
|
|
||||||
WHERE tOrig.id = vTicket AND saleClon.id IS NULL;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
|
|
||||||
SELECT saleOriginal.id, saleClon.id
|
|
||||||
FROM vn.sale saleOriginal
|
|
||||||
JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
|
|
||||||
WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
INSERT INTO ticketRequest (description, ordered, shipped, salesPersonCode, buyerCode, quantity, price,
|
|
||||||
itemFk ,clientFk, response, total, buyed, saleFk)
|
|
||||||
SELECT tr.description, tr.ordered, tr.shipped, tr.salesPersonCode, tr.buyerCode, tr.quantity, tr.price,
|
|
||||||
tr.itemFk, tr.clientFk, tr.response, tr.total, tr.buyed, tr.saleFk
|
|
||||||
FROM sale s JOIN ticketRequest tr ON tr.saleFk = s.id
|
|
||||||
JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND m.Id_Article = m2.Id_Article
|
|
||||||
WHERE s.ticketFk = vTicket AND s2.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
|
|
||||||
END;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE rsTicket;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
USE `util`;
|
|
||||||
DROP procedure IF EXISTS `time_createTable`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `util`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `time_createTable`(vStarted DATE, vEnded DATE)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vCurrentDate DATE;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.time;
|
|
||||||
CREATE TEMPORARY TABLE tmp.time (dated DATE PRIMARY KEY) ENGINE = MEMORY;
|
|
||||||
SET vCurrentDate = vStarted;
|
|
||||||
WHILE vCurrentDate <= vEnded DO
|
|
||||||
INSERT INTO tmp.time (dated) VALUES (vCurrentDate);
|
|
||||||
SET vCurrentDate = DATE_ADD(vCurrentDate, INTERVAL 1 DAY);
|
|
||||||
END WHILE;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,6 +0,0 @@
|
||||||
ALTER TABLE `vn`.`workerLog`
|
|
||||||
ADD COLUMN `changedModel` VARCHAR(45) NULL DEFAULT NULL AFTER `description`,
|
|
||||||
ADD COLUMN `oldInstance` TEXT NULL DEFAULT NULL AFTER `changedModel`,
|
|
||||||
ADD COLUMN `newInstance` TEXT NULL DEFAULT NULL AFTER `oldInstance`,
|
|
||||||
ADD COLUMN `changedModelId` INT(11) NULL DEFAULT NULL AFTER `newInstance`,
|
|
||||||
ADD COLUMN `changedModelValue` VARCHAR(45) NULL DEFAULT NULL AFTER `changedModelId`;
|
|
|
@ -1 +0,0 @@
|
||||||
UPDATE `vn`.`component` SET `code` = 'imbalance' WHERE (`id` = '36');
|
|
|
@ -1,6 +0,0 @@
|
||||||
UPDATE vn.ticketWeekly tw
|
|
||||||
JOIN vn.ticket t ON t.id = tw.ticketFk
|
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
|
||||||
SET tw.agencyModeFk = t.agencyModeFk
|
|
||||||
WHERE am.name NOT LIKE '%turno%';
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `vn`.`zoneConfig`
|
|
||||||
ADD COLUMN `forwardDays` INT(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries' AFTER `scope`;
|
|
|
@ -1,148 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `catalog_calculate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `catalog_calculate`(
|
|
||||||
vLanded DATE,
|
|
||||||
vAddressFk INT,
|
|
||||||
vAgencyModeFk INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Calcula los articulos disponibles y sus precios
|
|
||||||
*
|
|
||||||
* @table tmp.item(itemFk) Listado de artÃculos a calcular
|
|
||||||
* @param vLanded Fecha de recepcion de mercancia
|
|
||||||
* @param vAddressFk Id del consignatario
|
|
||||||
* @param vAgencyModeFk Id de la agencia
|
|
||||||
* @return tmp.ticketCalculateItem(itemFk, available, producer,
|
|
||||||
* item, size, stems, category, inkFk, image, origin, price)
|
|
||||||
* @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk)
|
|
||||||
* @return tmp.ticketComponent
|
|
||||||
* @return tmp.ticketComponentPrice
|
|
||||||
* @return tmp.zoneGetShipped
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE vAvailableCalc INT;
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vZoneFk INT;
|
|
||||||
DECLARE vDone BOOL;
|
|
||||||
DECLARE cTravelTree CURSOR FOR
|
|
||||||
SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
||||||
|
|
||||||
-- Establece los almacenes y las fechas que van a entrar al disponible
|
|
||||||
|
|
||||||
CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot(
|
|
||||||
`warehouseFk` smallint(5) unsigned NOT NULL,
|
|
||||||
`itemFk` int(11) NOT NULL,
|
|
||||||
`available` double DEFAULT NULL,
|
|
||||||
`buyFk` int(11) DEFAULT NULL,
|
|
||||||
`fix` tinyint(3) unsigned DEFAULT '0',
|
|
||||||
`zoneFk` int(11) NOT NULL,
|
|
||||||
KEY `itemFk` (`itemFk`),
|
|
||||||
KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH
|
|
||||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketCalculateItem(
|
|
||||||
itemFk INT(11) NOT NULL,
|
|
||||||
available INT(11),
|
|
||||||
producer VARCHAR(50),
|
|
||||||
item VARCHAR(50),
|
|
||||||
size INT(10) UNSIGNED,
|
|
||||||
stems INT(11),
|
|
||||||
category VARCHAR(3),
|
|
||||||
inkFk VARCHAR(3),
|
|
||||||
image VARCHAR(50),
|
|
||||||
origin VARCHAR(3),
|
|
||||||
price DECIMAL(10,2),
|
|
||||||
priceKg DECIMAL(10,2),
|
|
||||||
KEY `itemFk` (`itemFk`)
|
|
||||||
) ENGINE = MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
OPEN cTravelTree;
|
|
||||||
|
|
||||||
l: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE l;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
|
|
||||||
SELECT vWarehouseFk,
|
|
||||||
i.item_id,
|
|
||||||
IFNULL(i.available, 0),
|
|
||||||
bu.buyFk,
|
|
||||||
vZoneFk
|
|
||||||
FROM `cache`.available i
|
|
||||||
JOIN tmp.item br ON br.itemFk = i.item_id
|
|
||||||
LEFT JOIN item it ON it.id = i.item_id
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.item_id
|
|
||||||
WHERE i.calc_id = vAvailableCalc
|
|
||||||
AND i.available > 0;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
|
|
||||||
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketCalculateItem (
|
|
||||||
itemFk,
|
|
||||||
available,
|
|
||||||
producer,
|
|
||||||
item,
|
|
||||||
size,
|
|
||||||
stems,
|
|
||||||
category,
|
|
||||||
inkFk,
|
|
||||||
image,
|
|
||||||
origin,
|
|
||||||
price,
|
|
||||||
priceKg)
|
|
||||||
SELECT
|
|
||||||
tl.itemFk,
|
|
||||||
SUM(tl.available) available,
|
|
||||||
p.name producer,
|
|
||||||
i.name item,
|
|
||||||
i.size size,
|
|
||||||
i.stems,
|
|
||||||
i.category,
|
|
||||||
i.inkFk,
|
|
||||||
i.image,
|
|
||||||
o.code origin,
|
|
||||||
bl.price,
|
|
||||||
bl.priceKg
|
|
||||||
FROM tmp.ticketLot tl
|
|
||||||
JOIN item i ON tl.itemFk = i.id
|
|
||||||
LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible
|
|
||||||
JOIN origin o ON o.id = i.originFk
|
|
||||||
JOIN (
|
|
||||||
SELECT MIN(price) price, itemFk, priceKg
|
|
||||||
FROM tmp.ticketComponentPrice
|
|
||||||
WHERE warehouseFk = vWarehouseFk
|
|
||||||
GROUP BY itemFk
|
|
||||||
) bl ON bl.itemFk = tl.itemFk
|
|
||||||
WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk
|
|
||||||
GROUP BY tl.itemFk;
|
|
||||||
-- on duplicatekey update
|
|
||||||
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cTravelTree;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,262 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `catalog_componentCalculate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `catalog_componentCalculate`(
|
|
||||||
vZoneFk INT,
|
|
||||||
vAddressFk INT,
|
|
||||||
vShipped DATE,
|
|
||||||
vWarehouseFk INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Calcula los componentes de los articulos de tmp.ticketLot
|
|
||||||
*
|
|
||||||
* @param vZoneFk para calcular el transporte
|
|
||||||
* @param vAddressFk Consignatario
|
|
||||||
* @param vShipped dia de salida del pedido
|
|
||||||
* @param tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk)
|
|
||||||
*
|
|
||||||
* @return tmp.ticketComponent(itemFk, warehouseFk, available, rate2, rate3, minPrice,
|
|
||||||
* packing, grouping, groupingMode, buyFk, typeFk)
|
|
||||||
* @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, grouping, price)
|
|
||||||
*/
|
|
||||||
DECLARE vClientFk INT;
|
|
||||||
DECLARE vGeneralInflationCoefficient INT DEFAULT 1;
|
|
||||||
DECLARE vMinimumDensityWeight INT DEFAULT 167;
|
|
||||||
DECLARE vBoxVolume BIGINT; -- DEFAULT 138000;
|
|
||||||
DECLARE vSpecialPriceComponent INT DEFAULT 10;
|
|
||||||
DECLARE vDeliveryComponent INT DEFAULT 15;
|
|
||||||
DECLARE vRecoveryComponent INT DEFAULT 17;
|
|
||||||
DECLARE vSellByPacketComponent INT DEFAULT 22;
|
|
||||||
DECLARE vBuyValueComponent INT DEFAULT 28;
|
|
||||||
DECLARE vMarginComponent INT DEFAULT 29;
|
|
||||||
DECLARE vDiscountLastItemComponent INT DEFAULT 32;
|
|
||||||
DECLARE vExtraBaggedComponent INT DEFAULT 38;
|
|
||||||
DECLARE vManaAutoComponent INT DEFAULT 39;
|
|
||||||
|
|
||||||
SELECT volume INTO vBoxVolume
|
|
||||||
FROM vn.packaging
|
|
||||||
WHERE id = '94';
|
|
||||||
|
|
||||||
SELECT clientFk INTO vClientFK
|
|
||||||
FROM address
|
|
||||||
WHERE id = vAddressFk;
|
|
||||||
|
|
||||||
SET @rate2 := 0;
|
|
||||||
SET @rate3 := 0;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentCalculate
|
|
||||||
(PRIMARY KEY (itemFk, warehouseFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT
|
|
||||||
tl.itemFk, tl.warehouseFk, tl.available,
|
|
||||||
IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2,
|
|
||||||
IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3,
|
|
||||||
IFNULL(pf.rate3, 0) AS minPrice,
|
|
||||||
IFNULL(pf.packing, b.packing) packing,
|
|
||||||
IFNULL(pf.`grouping`, b.`grouping`) `grouping`,
|
|
||||||
ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
|
|
||||||
tl.buyFk,
|
|
||||||
i.typeFk,
|
|
||||||
IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping
|
|
||||||
FROM tmp.ticketLot tl
|
|
||||||
JOIN buy b ON b.id = tl.buyFk
|
|
||||||
JOIN item i ON i.id = tl.itemFk
|
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
|
||||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
|
||||||
LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT * FROM (
|
|
||||||
SELECT pf.itemFk, pf.`grouping`, pf.packing, pf.box, pf.rate2, pf.rate3, zw.warehouseFk
|
|
||||||
FROM priceFixed pf
|
|
||||||
JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk AND (zw.warehouseFk = pf.warehouseFk OR pf.warehouseFk = 0)
|
|
||||||
WHERE vShipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC
|
|
||||||
) tpf
|
|
||||||
GROUP BY tpf.itemFk, tpf.warehouseFk
|
|
||||||
) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk
|
|
||||||
WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.display <> 0
|
|
||||||
AND tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
SELECT
|
|
||||||
tcc.warehouseFk,
|
|
||||||
tcc.itemFk,
|
|
||||||
vBuyValueComponent,
|
|
||||||
b.buyingValue + b.freightValue + b.packageValue + b.comissionValue
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN buy b ON b.id = tcc.buyFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
SELECT
|
|
||||||
tcc.warehouseFk,
|
|
||||||
tcc.itemFk,
|
|
||||||
vMarginComponent,
|
|
||||||
tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN buy b ON b.id = tcc.buyFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY
|
|
||||||
SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk
|
|
||||||
FROM tmp.ticketComponent tc
|
|
||||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
|
|
||||||
GROUP BY tc.itemFk, warehouseFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3)
|
|
||||||
FROM tmp.ticketComponentBase tcb
|
|
||||||
JOIN claimRatio cr ON cr.clientFk = vClientFk
|
|
||||||
WHERE cr.priceIncreasing > 0.009;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto
|
|
||||||
FROM tmp.ticketComponentBase tcb
|
|
||||||
JOIN `client` c on c.id = vClientFk
|
|
||||||
JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
|
|
||||||
WHERE wm.isPricesModifierActivated
|
|
||||||
HAVING manaAuto <> 0;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcb.warehouseFk,
|
|
||||||
tcb.itemFk,
|
|
||||||
c.id,
|
|
||||||
GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
|
||||||
FROM tmp.ticketComponentBase tcb
|
|
||||||
JOIN component c
|
|
||||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
|
|
||||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
|
||||||
WHERE c.id = vDiscountLastItemComponent AND c.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN buy b ON b.id = tcc.buyFk
|
|
||||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
|
||||||
WHERE sp.value IS NULL;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zone;
|
|
||||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT vZoneFk id;
|
|
||||||
|
|
||||||
CALL zone_getOptionsForShipment(vShipped, TRUE);
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcc.warehouseFK,
|
|
||||||
tcc.itemFk,
|
|
||||||
vDeliveryComponent,
|
|
||||||
vGeneralInflationCoefficient
|
|
||||||
* ROUND((
|
|
||||||
i.compression
|
|
||||||
* ic.cm3
|
|
||||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
|
||||||
* IFNULL((zo.price - zo.bonus)
|
|
||||||
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
|
||||||
) cost
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN item i ON i.id = tcc.itemFk
|
|
||||||
JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk
|
|
||||||
JOIN zone z ON z.id = vZoneFk
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
|
|
||||||
AND ic.itemFk = tcc.itemFk
|
|
||||||
HAVING cost <> 0;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneOption;
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN vn.addressForPackaging ap
|
|
||||||
WHERE ap.addressFk = vAddressFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY
|
|
||||||
SELECT * FROM tmp.ticketComponent;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcc.warehouseFk,
|
|
||||||
tcc.itemFk,
|
|
||||||
vSpecialPriceComponent,
|
|
||||||
sp.value - SUM(tcc.cost) sumCost
|
|
||||||
FROM tmp.ticketComponentCopy tcc
|
|
||||||
JOIN component c ON c.id = tcc.componentFk
|
|
||||||
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
|
|
||||||
WHERE c.classRate IS NULL
|
|
||||||
GROUP BY tcc.itemFk, tcc.warehouseFk
|
|
||||||
HAVING ABS(sumCost) > 0.001;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentSum
|
|
||||||
(INDEX (itemFk, warehouseFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate
|
|
||||||
FROM tmp.ticketComponent tc
|
|
||||||
JOIN component c ON c.id = tc.componentFk
|
|
||||||
GROUP BY tc.itemFk, tc.warehouseFk, c.classRate;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
|
|
||||||
SELECT tcc.warehouseFk,
|
|
||||||
tcc.itemFk,
|
|
||||||
1 rate,
|
|
||||||
IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`,
|
|
||||||
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price,
|
|
||||||
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
|
||||||
AND tcs.warehouseFk = tcc.warehouseFk
|
|
||||||
WHERE IFNULL(tcs.classRate, 1) = 1
|
|
||||||
AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0)
|
|
||||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
|
|
||||||
SELECT
|
|
||||||
tcc.warehouseFk,
|
|
||||||
tcc.itemFk,
|
|
||||||
2 rate,
|
|
||||||
tcc.packing `grouping`,
|
|
||||||
SUM(tcs.sumCost) price,
|
|
||||||
SUM(tcs.sumCost) / weightGrouping priceKg
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
|
||||||
AND tcs.warehouseFk = tcc.warehouseFk
|
|
||||||
WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2
|
|
||||||
AND tcc.packing > 0 AND tcc.available >= tcc.packing)
|
|
||||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
|
|
||||||
SELECT
|
|
||||||
tcc.warehouseFk,
|
|
||||||
tcc.itemFk,
|
|
||||||
3 rate,
|
|
||||||
tcc.available `grouping`,
|
|
||||||
SUM(tcs.sumCost) price,
|
|
||||||
SUM(tcs.sumCost) / weightGrouping priceKg
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
|
||||||
AND tcs.warehouseFk = tcc.warehouseFk
|
|
||||||
WHERE IFNULL(tcs.classRate, 3) = 3
|
|
||||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
|
|
||||||
SELECT * FROM (
|
|
||||||
SELECT * FROM tmp.ticketComponentRate ORDER BY price
|
|
||||||
) t
|
|
||||||
GROUP BY itemFk, warehouseFk, `grouping`;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.ticketComponentCalculate,
|
|
||||||
tmp.ticketComponentSum,
|
|
||||||
tmp.ticketComponentBase,
|
|
||||||
tmp.ticketComponentRate,
|
|
||||||
tmp.ticketComponentCopy;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `catalog_componentPrepare`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE PROCEDURE `catalog_componentPrepare` ()
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponent (
|
|
||||||
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
||||||
`itemFk` INT NOT NULL,
|
|
||||||
`componentFk` INT UNSIGNED NOT NULL,
|
|
||||||
`cost` DECIMAL(10,4) NOT NULL,
|
|
||||||
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
||||||
UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)
|
|
||||||
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentPrice (
|
|
||||||
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
||||||
`itemFk` INT NOT NULL,
|
|
||||||
`rate` INT NOT NULL,
|
|
||||||
`grouping` INT UNSIGNED NOT NULL,
|
|
||||||
`price` DECIMAL(10,4) NOT NULL,
|
|
||||||
`priceKg` DECIMAL(10,4),
|
|
||||||
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
||||||
UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC)
|
|
||||||
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `vn`.`catalog_componentPurge`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `catalog_componentPurge`()
|
|
||||||
BEGIN
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.ticketComponentPrice,
|
|
||||||
tmp.ticketComponent,
|
|
||||||
tmp.ticketLot;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
;
|
|
|
@ -1,250 +0,0 @@
|
||||||
USE `hedera`;
|
|
||||||
DROP procedure IF EXISTS `order_confirmWithUser`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `hedera`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Confirms an order, creating each of its tickets on the corresponding
|
|
||||||
* date, store and user.
|
|
||||||
*
|
|
||||||
* @param vOrder The order identifier
|
|
||||||
* @param vUser The user identifier
|
|
||||||
*/
|
|
||||||
DECLARE vOk BOOL;
|
|
||||||
DECLARE vDone BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vWarehouse INT;
|
|
||||||
DECLARE vShipment DATETIME;
|
|
||||||
DECLARE vTicket INT;
|
|
||||||
DECLARE vNotes VARCHAR(255);
|
|
||||||
DECLARE vItem INT;
|
|
||||||
DECLARE vConcept VARCHAR(30);
|
|
||||||
DECLARE vAmount INT;
|
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
|
||||||
DECLARE vSale INT;
|
|
||||||
DECLARE vRate INT;
|
|
||||||
DECLARE vRowId INT;
|
|
||||||
DECLARE vDelivery DATE;
|
|
||||||
DECLARE vAddress INT;
|
|
||||||
DECLARE vIsConfirmed BOOL;
|
|
||||||
DECLARE vClientId INT;
|
|
||||||
DECLARE vCompanyId INT;
|
|
||||||
DECLARE vAgencyModeId INT;
|
|
||||||
DECLARE TICKET_FREE INT DEFAULT 2;
|
|
||||||
|
|
||||||
DECLARE cDates CURSOR FOR
|
|
||||||
SELECT zgs.shipped, r.warehouse_id
|
|
||||||
FROM `order` o
|
|
||||||
JOIN order_row r ON r.order_id = o.id
|
|
||||||
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
|
|
||||||
WHERE o.id = vOrder AND r.amount != 0
|
|
||||||
GROUP BY r.warehouse_id;
|
|
||||||
|
|
||||||
DECLARE cRows CURSOR FOR
|
|
||||||
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate
|
|
||||||
FROM order_row r
|
|
||||||
JOIN vn.item i ON i.id = r.item_id
|
|
||||||
WHERE r.amount != 0
|
|
||||||
AND r.warehouse_id = vWarehouse
|
|
||||||
AND r.order_id = vOrder
|
|
||||||
ORDER BY r.rate DESC;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
||||||
SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
-- Carga los datos del pedido
|
|
||||||
|
|
||||||
SELECT o.date_send, o.address_id, o.note,
|
|
||||||
o.confirmed, a.clientFk, o.company_id, o.agency_id
|
|
||||||
INTO vDelivery, vAddress, vNotes,
|
|
||||||
vIsConfirmed, vClientId, vCompanyId, vAgencyModeId
|
|
||||||
FROM hedera.`order` o
|
|
||||||
JOIN vn.address a ON a.id = o.address_id
|
|
||||||
WHERE o.id = vOrder;
|
|
||||||
|
|
||||||
-- Comprueba que el pedido no está confirmado
|
|
||||||
|
|
||||||
IF vIsConfirmed THEN
|
|
||||||
CALL util.throw ('ORDER_ALREADY_CONFIRMED');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Comprueba que el pedido no está vacío
|
|
||||||
|
|
||||||
SELECT COUNT(*) > 0 INTO vOk
|
|
||||||
FROM order_row WHERE order_id = vOrder AND amount > 0;
|
|
||||||
|
|
||||||
IF NOT vOk THEN
|
|
||||||
CALL util.throw ('ORDER_EMPTY');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Carga las fechas de salida de cada almacén
|
|
||||||
|
|
||||||
CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
|
|
||||||
|
|
||||||
-- Trabajador que realiza la acción
|
|
||||||
|
|
||||||
IF vUserId IS NULL THEN
|
|
||||||
SELECT employeeFk INTO vUserId FROM orderConfig;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Crea los tickets del pedido
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
OPEN cDates;
|
|
||||||
|
|
||||||
lDates:
|
|
||||||
LOOP
|
|
||||||
SET vTicket = NULL;
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cDates INTO vShipment, vWarehouse;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE lDates;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Busca un ticket existente que coincida con los parametros
|
|
||||||
|
|
||||||
SELECT t.id INTO vTicket
|
|
||||||
FROM vn.ticket t
|
|
||||||
LEFT JOIN vn.ticketState tls on tls.ticket = t.id
|
|
||||||
JOIN `order` o
|
|
||||||
ON o.address_id = t.addressFk
|
|
||||||
AND vWarehouse = t.warehouseFk
|
|
||||||
AND o.agency_id = t.agencyModeFk
|
|
||||||
AND o.date_send = t.landed
|
|
||||||
AND vShipment = DATE(t.shipped)
|
|
||||||
WHERE o.id = vOrder
|
|
||||||
AND t.invoiceOutFk IS NULL
|
|
||||||
AND IFNULL(tls.alertLevel,0) = 0
|
|
||||||
AND t.clientFk <> 1118
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- Crea el ticket en el caso de no existir uno adecuado
|
|
||||||
|
|
||||||
IF vTicket IS NULL
|
|
||||||
THEN
|
|
||||||
CALL vn.ticketCreateWithUser(
|
|
||||||
vClientId,
|
|
||||||
IFNULL(vShipment, CURDATE()),
|
|
||||||
vWarehouse,
|
|
||||||
vCompanyId,
|
|
||||||
vAddress,
|
|
||||||
vAgencyModeId,
|
|
||||||
NULL,
|
|
||||||
vDelivery,
|
|
||||||
vUserId,
|
|
||||||
vTicket
|
|
||||||
);
|
|
||||||
ELSE
|
|
||||||
INSERT INTO vncontrol.inter
|
|
||||||
SET Id_Ticket = vTicket,
|
|
||||||
Id_Trabajador = vUserId,
|
|
||||||
state_id = TICKET_FREE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.orderTicket
|
|
||||||
SET orderFk = vOrder,
|
|
||||||
ticketFk = vTicket;
|
|
||||||
|
|
||||||
-- Añade las notas
|
|
||||||
|
|
||||||
IF vNotes IS NOT NULL AND vNotes != ''
|
|
||||||
THEN
|
|
||||||
INSERT INTO vn.ticketObservation SET
|
|
||||||
ticketFk = vTicket,
|
|
||||||
observationTypeFk = 4 /* salesperson */ ,
|
|
||||||
`description` = vNotes
|
|
||||||
ON DUPLICATE KEY UPDATE
|
|
||||||
`description` = CONCAT(VALUES(`description`),'. ', `description`);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Añade los movimientos y sus componentes
|
|
||||||
|
|
||||||
OPEN cRows;
|
|
||||||
|
|
||||||
lRows:
|
|
||||||
LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE lRows;
|
|
||||||
END IF;
|
|
||||||
SET vSale = NULL;
|
|
||||||
SELECT s.id INTO vSale
|
|
||||||
FROM vn.sale s
|
|
||||||
WHERE ticketFk = vTicket
|
|
||||||
AND price = vPrice
|
|
||||||
AND itemFk = vItem
|
|
||||||
LIMIT 1;
|
|
||||||
IF vSale THEN
|
|
||||||
UPDATE vn.sale
|
|
||||||
SET quantity = quantity + vAmount
|
|
||||||
WHERE id = vSale;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO vn.sale
|
|
||||||
SET
|
|
||||||
itemFk = vItem,
|
|
||||||
ticketFk = vTicket,
|
|
||||||
concept = vConcept,
|
|
||||||
quantity = vAmount,
|
|
||||||
price = vPrice,
|
|
||||||
priceFixed = 0,
|
|
||||||
isPriceFixed = TRUE;
|
|
||||||
|
|
||||||
SET vSale = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
INSERT INTO vn.saleComponent
|
|
||||||
(saleFk, componentFk, `value`)
|
|
||||||
SELECT vSale, cm.component_id, cm.price
|
|
||||||
FROM order_component cm
|
|
||||||
JOIN vn.component c ON c.id = cm.component_id
|
|
||||||
WHERE cm.order_row_id = vRowId
|
|
||||||
GROUP BY vSale, cm.component_id;
|
|
||||||
END IF;
|
|
||||||
UPDATE order_row SET Id_Movimiento = vSale
|
|
||||||
WHERE id = vRowId;
|
|
||||||
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cRows;
|
|
||||||
|
|
||||||
-- Fija el coste
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tComponents;
|
|
||||||
CREATE TEMPORARY TABLE tComponents
|
|
||||||
(INDEX (saleFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT SUM(sc.`value`) valueSum, sc.saleFk
|
|
||||||
FROM vn.saleComponent sc
|
|
||||||
JOIN vn.component c ON c.id = sc.componentFk
|
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
|
|
||||||
JOIN vn.sale s ON s.id = sc.saleFk
|
|
||||||
WHERE s.ticketFk = vTicket
|
|
||||||
GROUP BY sc.saleFk;
|
|
||||||
|
|
||||||
UPDATE vn.sale s
|
|
||||||
JOIN tComponents mc ON mc.saleFk = s.id
|
|
||||||
SET s.priceFixed = valueSum;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tComponents;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cDates;
|
|
||||||
|
|
||||||
DELETE FROM basketOrder WHERE orderFk = vOrder;
|
|
||||||
UPDATE `order` SET confirmed = TRUE, confirm_date = NOW()
|
|
||||||
WHERE id = vOrder;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,103 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `sale_calculateComponent`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sale_calculateComponent`(vSale INT, vOption INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Actualiza los componentes
|
|
||||||
*
|
|
||||||
* @param vSale Delivery date
|
|
||||||
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicketFk BIGINT;
|
|
||||||
DECLARE vItemFk BIGINT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vIsEditable BOOLEAN;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
|
|
||||||
s.ticketFk,
|
|
||||||
s.itemFk ,
|
|
||||||
t.zoneFk,
|
|
||||||
t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed
|
|
||||||
INTO vIsEditable,
|
|
||||||
vTicketFk,
|
|
||||||
vItemFk,
|
|
||||||
vZoneFk,
|
|
||||||
vWarehouseFk,
|
|
||||||
vShipped,
|
|
||||||
vAddressFk,
|
|
||||||
vAgencyModeFk,
|
|
||||||
vLanded
|
|
||||||
FROM ticket t
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
|
||||||
WHERE s.id = vSale;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
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;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
IF vOption IS NULL THEN
|
|
||||||
SET vOption = IF(vIsEditable, 1, 6);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(vOption);
|
|
||||||
|
|
||||||
INSERT INTO ticketLog (originFk, userFk, `action`, description)
|
|
||||||
VALUES (vTicketFk, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateClon`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `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
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vWarehouse SMALLINT;
|
|
||||||
DECLARE vAgencyMode INT;
|
|
||||||
DECLARE vAddress INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vAgency INT;
|
|
||||||
DECLARE vZoneFk INT;
|
|
||||||
|
|
||||||
REPLACE INTO orderTicket(orderFk,ticketFk)
|
|
||||||
SELECT orderFk, vTicketNew
|
|
||||||
FROM orderTicket
|
|
||||||
WHERE ticketFk = vTicketOld;
|
|
||||||
|
|
||||||
SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk
|
|
||||||
INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
IF vLanded IS NULL THEN
|
|
||||||
CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse);
|
|
||||||
UPDATE ticket t
|
|
||||||
JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
|
|
||||||
SET t.landed = zgl.landed,
|
|
||||||
t.zone = zgl.zoneFk
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla tmp.buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate(vWarehouse, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode, vWarehouse);
|
|
||||||
|
|
||||||
-- Bionizamos lineas con Preu = 0
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT s.id saleFk, vWarehouse warehouseFk
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(1);
|
|
||||||
|
|
||||||
-- Bionizamos lineas con Preu > 0
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT s.id saleFk, vWarehouse warehouseFk
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew
|
|
||||||
AND s.price > 0;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(6);
|
|
||||||
|
|
||||||
-- Log
|
|
||||||
CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
|
|
||||||
|
|
||||||
-- Limpieza
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale,
|
|
||||||
tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSaleForcePrice`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateSaleForcePrice`(IN vSale BIGINT)
|
|
||||||
proc: BEGIN
|
|
||||||
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicket BIGINT;
|
|
||||||
DECLARE vItem BIGINT;
|
|
||||||
DECLARE vZoneFk INT;
|
|
||||||
|
|
||||||
SELECT ticketFk, itemFk
|
|
||||||
INTO vTicket, vItem
|
|
||||||
FROM sale
|
|
||||||
WHERE id = vSale;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicket;
|
|
||||||
|
|
||||||
IF vZoneFk IS NULL THEN
|
|
||||||
CALL util.throw('ticket without zone');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItem;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItem;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(1);
|
|
||||||
|
|
||||||
INSERT INTO vn.ticketLog (originFk, userFk, `action`, description)
|
|
||||||
VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,154 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketComponentUpdateSale`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdateSale`(vOption INT)
|
|
||||||
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;
|
|
||||||
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;
|
|
||||||
|
|
||||||
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
|
|
||||||
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);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vKeepPrices 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
|
|
||||||
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 ;
|
|
||||||
|
|
|
@ -1,107 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_componentMakeUpdate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentMakeUpdate`(
|
|
||||||
vTicketFk INT,
|
|
||||||
vClientFk INT,
|
|
||||||
vAgencyModeFk INT,
|
|
||||||
vAddressFk INT,
|
|
||||||
vZoneFk INT,
|
|
||||||
vWarehouseFk TINYINT,
|
|
||||||
vCompanyFk SMALLINT,
|
|
||||||
vShipped DATETIME,
|
|
||||||
vLanded DATE,
|
|
||||||
vIsDeleted BOOLEAN,
|
|
||||||
vHasToBeUnrouted BOOLEAN,
|
|
||||||
vOption INT)
|
|
||||||
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 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);
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
CALL zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
|
|
||||||
|
|
||||||
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
|
|
||||||
FROM tmp.zoneGetShipped
|
|
||||||
WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET
|
|
||||||
t.clientFk = vClientFk,
|
|
||||||
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;
|
|
||||||
|
|
||||||
IF vOption <> 8 THEN
|
|
||||||
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;
|
|
||||||
END IF;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,111 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_componentPreview`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentPreview`(
|
|
||||||
vTicketFk INT,
|
|
||||||
vLanded DATE,
|
|
||||||
vAddressFk INT,
|
|
||||||
vZoneFk INT,
|
|
||||||
vWarehouseFk SMALLINT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Calcula los componentes de los articulos de un ticket
|
|
||||||
*
|
|
||||||
* @param vTicketFk id del ticket
|
|
||||||
* @param vLanded nueva fecha de entrega
|
|
||||||
* @param vAddressFk nuevo consignatario
|
|
||||||
* @param vZoneFk nueva zona
|
|
||||||
* @param vWarehouseFk nuevo warehouse
|
|
||||||
*
|
|
||||||
* @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
*/
|
|
||||||
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasAddressChanged BOOL;
|
|
||||||
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vAddressTypeRateFk INT DEFAULT NULL;
|
|
||||||
DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL;
|
|
||||||
|
|
||||||
DECLARE vHasChangeAll BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
SELECT DATE(landed) <> vLanded,
|
|
||||||
addressFk <> vAddressFk,
|
|
||||||
zoneFk <> vZoneFk,
|
|
||||||
warehouseFk <> vWarehouseFk
|
|
||||||
INTO
|
|
||||||
vHasDataChanged,
|
|
||||||
vHasAddressChanged,
|
|
||||||
vHasZoneChanged,
|
|
||||||
vHasWarehouseChanged
|
|
||||||
FROM vn.ticket t
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vHasDataChanged OR vHasWarehouseChanged THEN
|
|
||||||
SET vHasChangeAll = TRUE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vHasAddressChanged THEN
|
|
||||||
SET vAddressTypeRateFk = 5;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vHasZoneChanged THEN
|
|
||||||
SET vAgencyModeTypeRateFk = 6;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped
|
|
||||||
FROM zone
|
|
||||||
WHERE id = vZoneFk;
|
|
||||||
|
|
||||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
|
|
||||||
SELECT
|
|
||||||
vWarehouseFk AS warehouseFk,
|
|
||||||
NULL AS available,
|
|
||||||
s.itemFk,
|
|
||||||
bu.buyFk,
|
|
||||||
vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
GROUP BY bu.warehouseFk, bu.itemFk);
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value
|
|
||||||
FROM saleComponent sc
|
|
||||||
JOIN sale s ON s.id = sc.saleFk
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN `component` c ON c.id = sc.componentFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
AND (c.isRenewable = FALSE
|
|
||||||
OR
|
|
||||||
(NOT vHasChangeAll
|
|
||||||
AND (NOT (c.typeFk <=> vAddressTypeRateFk
|
|
||||||
OR c.typeFk <=> vAgencyModeTypeRateFk))));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentPreview
|
|
||||||
SELECT * FROM tmp.ticketComponent;
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
|
|
||||||
IF vShipped IS NULL THEN
|
|
||||||
CALL util.throw('NO_ZONE_AVAILABLE');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vShipped < CURDATE() THEN
|
|
||||||
CALL util.throw('ERROR_PAST_SHIPMENT');
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_priceDifference`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_priceDifference`(
|
|
||||||
vTicketFk INT,
|
|
||||||
vLanded DATE,
|
|
||||||
vAddressFk INT,
|
|
||||||
vZoneFk INT,
|
|
||||||
vWarehouseFk INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Devuelve las diferencias de precio de los movimientos de un ticket.
|
|
||||||
*
|
|
||||||
* @param vTicketFk Id del ticket
|
|
||||||
* @param vLanded Fecha de recepcion
|
|
||||||
* @param vAddressFk Id del consignatario
|
|
||||||
* @param vZoneFk Id de la zona
|
|
||||||
* @param vWarehouseFk Id del almacén
|
|
||||||
*/
|
|
||||||
CALL vn.ticket_componentPreview(vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
|
||||||
|
|
||||||
SELECT s.itemFk,
|
|
||||||
i.name,
|
|
||||||
i.size,
|
|
||||||
i.category,
|
|
||||||
IFNULL(s.quantity, 0) AS quantity,
|
|
||||||
IFNULL(s.price, 0) AS price,
|
|
||||||
ROUND(SUM(tc.cost), 2) AS newPrice,
|
|
||||||
s.quantity * (s.price - ROUND(SUM(tc.cost), 2)) difference,
|
|
||||||
s.id AS saleFk
|
|
||||||
FROM sale s
|
|
||||||
JOIN item i ON i.id = s.itemFk
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
LEFT JOIN tmp.ticketComponentPreview tc ON tc.itemFk = s.itemFk
|
|
||||||
AND tc.warehouseFk = t.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 t.id = vTicketFk
|
|
||||||
AND IF(sc.componentFk IS NULL
|
|
||||||
AND c.classRate IS NOT NULL, FALSE, TRUE)
|
|
||||||
GROUP BY s.id ORDER BY s.id;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticketComponentPreview;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_recalcComponents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN)
|
|
||||||
proc: BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Este procedimiento recalcula los componentes de un ticket,
|
|
||||||
* eliminando los componentes existentes e insertandolos de nuevo
|
|
||||||
*
|
|
||||||
* @param vTicketFk Id del ticket
|
|
||||||
* @param vIsTicketEditable si no se quiere forzar llamar con NULL
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
IF vIsTicketEditable IS NULL THEN
|
|
||||||
SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = ''
|
|
||||||
INTO vIsTicketEditable
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE id = vTicketFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed,
|
|
||||||
t.zoneFk
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
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;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available,
|
|
||||||
s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
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);
|
|
||||||
|
|
||||||
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 s.ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
-- si el ticket esta facturado, respeta los precios
|
|
||||||
CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_recalcComponentsForcePrice`;
|
|
|
@ -1,72 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_withoutComponents`;
|
|
||||||
DROP procedure IF EXISTS `ticket_checkNoComponents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comprueba que los tickets entre un rango de fechas tienen componentes
|
|
||||||
*
|
|
||||||
* @param vDatedFrom Id del ticket
|
|
||||||
* @param vIsTicketEditable si no se quiere forzar llamar con NULL
|
|
||||||
*/
|
|
||||||
DECLARE v_done BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vSaleFk INTEGER;
|
|
||||||
DECLARE vCur CURSOR FOR
|
|
||||||
SELECT s.id
|
|
||||||
FROM ticket t
|
|
||||||
JOIN client clt ON clt.id = t.clientFk
|
|
||||||
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 >= vDatedFrom AND t.shipped <= vDatedTo
|
|
||||||
AND c.id IS NULL
|
|
||||||
AND clt.isActive != 0
|
|
||||||
AND ic.merchandise != 0
|
|
||||||
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 ticket t
|
|
||||||
JOIN client clt ON clt.id = t.clientFk
|
|
||||||
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 >= vDatedFrom
|
|
||||||
AND ic.merchandise != 0;
|
|
||||||
|
|
||||||
OPEN vCur;
|
|
||||||
|
|
||||||
l: LOOP
|
|
||||||
SET v_done = FALSE;
|
|
||||||
FETCH vCur INTO vSaleFk;
|
|
||||||
|
|
||||||
IF v_done THEN
|
|
||||||
LEAVE l;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL sale_calculateComponent(vSaleFk, 1);
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE vCur;
|
|
||||||
DROP TEMPORARY TABLE tmp.coste;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,162 +0,0 @@
|
||||||
|
|
||||||
USE `edi`;
|
|
||||||
DROP procedure IF EXISTS `ekt_load`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `edi`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ekt_load`(IN `vSelf` INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vRef INT;
|
|
||||||
DECLARE vBuy INT;
|
|
||||||
DECLARE vItem INT;
|
|
||||||
DECLARE vQty INT;
|
|
||||||
DECLARE vPackage INT;
|
|
||||||
DECLARE vIsLot BOOLEAN;
|
|
||||||
DECLARE vForceToPacking INT DEFAULT 2;
|
|
||||||
|
|
||||||
-- Carga los datos necesarios del EKT
|
|
||||||
|
|
||||||
SELECT ref, qty, package INTO vRef, vQty, vPackage
|
|
||||||
FROM ekt e
|
|
||||||
LEFT JOIN item i ON e.ref = i.id
|
|
||||||
WHERE e.id = vSelf;
|
|
||||||
|
|
||||||
-- Inserta el cubo si no existe
|
|
||||||
|
|
||||||
IF vPackage = 800
|
|
||||||
THEN
|
|
||||||
SET vPackage = 800 + vQty;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn2008.Cubos SET
|
|
||||||
Id_Cubo = vPackage,
|
|
||||||
x = 7200 / vQty,
|
|
||||||
y = 1;
|
|
||||||
ELSE
|
|
||||||
INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z)
|
|
||||||
SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10)
|
|
||||||
FROM bucket WHERE bucket_id = vPackage;
|
|
||||||
|
|
||||||
IF ROW_COUNT() > 0
|
|
||||||
THEN
|
|
||||||
INSERT INTO vn2008.mail SET
|
|
||||||
`subject` = 'Cubo añadido',
|
|
||||||
`text` = CONCAT('Se ha añadido el cubo: ', vPackage),
|
|
||||||
`to` = 'ekt@verdnatura.es';
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Intenta obtener el artículo en base a los atributos holandeses
|
|
||||||
|
|
||||||
INSERT IGNORE INTO item_track SET
|
|
||||||
item_id = vRef;
|
|
||||||
|
|
||||||
SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem
|
|
||||||
FROM vn2008.buy_edi e
|
|
||||||
JOIN item_track t ON t.item_id = e.ref
|
|
||||||
LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref
|
|
||||||
LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id
|
|
||||||
JOIN vn2008.config cfg
|
|
||||||
WHERE e.id = vSelf
|
|
||||||
AND l.id != vSelf
|
|
||||||
AND c.Id_Article != cfg.generic_item
|
|
||||||
AND IF(t.s1, l.s1 = e.s1, TRUE)
|
|
||||||
AND IF(t.s2, l.s2 = e.s2, TRUE)
|
|
||||||
AND IF(t.s3, l.s3 = e.s3, TRUE)
|
|
||||||
AND IF(t.s4, l.s4 = e.s4, TRUE)
|
|
||||||
AND IF(t.s5, l.s5 = e.s5, TRUE)
|
|
||||||
AND IF(t.s6, l.s6 = e.s6, TRUE)
|
|
||||||
AND IF(t.kop, l.kop = e.kop, TRUE)
|
|
||||||
AND IF(t.pac, l.pac = e.pac, TRUE)
|
|
||||||
AND IF(t.cat, l.cat = e.cat, TRUE)
|
|
||||||
AND IF(t.ori, l.ori = e.ori, TRUE)
|
|
||||||
AND IF(t.pro, l.pro = e.pro, TRUE)
|
|
||||||
AND IF(t.sub, l.sub = e.sub, TRUE)
|
|
||||||
AND IF(t.package, l.package = e.package, TRUE)
|
|
||||||
AND c.Id_Article < 170000
|
|
||||||
ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1;
|
|
||||||
|
|
||||||
-- Determina si el articulo se vende por lotes
|
|
||||||
|
|
||||||
IF vItem
|
|
||||||
THEN
|
|
||||||
SELECT COUNT(*) > 0 INTO vIsLot
|
|
||||||
FROM vn2008.Articles a
|
|
||||||
LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
|
|
||||||
WHERE a.Id_Article = vItem
|
|
||||||
AND t.`transaction`;
|
|
||||||
|
|
||||||
-- Si el articulo se vende por lotes se inserta un nuevo artículo
|
|
||||||
|
|
||||||
IF vIsLot
|
|
||||||
THEN
|
|
||||||
INSERT INTO vn2008.Articles (
|
|
||||||
Article
|
|
||||||
,Medida
|
|
||||||
,Categoria
|
|
||||||
,Id_Origen
|
|
||||||
,iva_group_id
|
|
||||||
,Foto
|
|
||||||
,Color
|
|
||||||
,Codintrastat
|
|
||||||
,tipo_id
|
|
||||||
,Tallos
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
i.`name`
|
|
||||||
,IFNULL(e.s1, e.pac)
|
|
||||||
,e.cat
|
|
||||||
,IFNULL(o.id, 17)
|
|
||||||
,IFNULL(a.iva_group_id, 1)
|
|
||||||
,a.Foto
|
|
||||||
,a.Color
|
|
||||||
,a.Codintrastat
|
|
||||||
,IFNULL(a.tipo_id, 10)
|
|
||||||
,IF(a.tipo_id = 15, 0, 1)
|
|
||||||
FROM vn2008.buy_edi e
|
|
||||||
LEFT JOIN item i ON i.id = e.ref
|
|
||||||
LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori
|
|
||||||
LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem
|
|
||||||
WHERE e.id = vSelf;
|
|
||||||
|
|
||||||
SET vItem = LAST_INSERT_ID();
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Inserta la compra asociada al EKT
|
|
||||||
|
|
||||||
INSERT INTO vn2008.Compres
|
|
||||||
(
|
|
||||||
Id_Entrada
|
|
||||||
,buy_edi_id
|
|
||||||
,Costefijo
|
|
||||||
,Id_Article
|
|
||||||
,`grouping`
|
|
||||||
,caja
|
|
||||||
,Packing
|
|
||||||
,Cantidad
|
|
||||||
,Productor
|
|
||||||
,Etiquetas
|
|
||||||
,Id_Cubo
|
|
||||||
,`weight`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
cfg.edi_entry
|
|
||||||
,vSelf
|
|
||||||
,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri
|
|
||||||
,IFNULL(vItem, cfg.generic_item)
|
|
||||||
,IFNULL(c.`grouping`, e.pac)
|
|
||||||
,vForceToPacking
|
|
||||||
,@pac := e.pac / @t
|
|
||||||
,@pac * e.qty
|
|
||||||
,s.company_name
|
|
||||||
,e.qty
|
|
||||||
,IFNULL(c.Id_Cubo, e.package)
|
|
||||||
,a.density * (vn.item_getVolume(a.Id_Article, IFNULL(c.Id_Cubo, e.package)) / 1000000)
|
|
||||||
FROM vn2008.buy_edi e
|
|
||||||
LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy
|
|
||||||
LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article
|
|
||||||
LEFT JOIN supplier s ON e.pro = s.supplier_id
|
|
||||||
JOIN vn2008.config cfg
|
|
||||||
WHERE e.id = vSelf
|
|
||||||
LIMIT 1;
|
|
||||||
END
|
|
|
@ -1,130 +0,0 @@
|
||||||
DROP procedure IF EXISTS `vn`.`item_getBalance`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `item_getBalance`(IN vItemId INT, IN vWarehouse INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vDateInventory DATETIME;
|
|
||||||
DECLARE vCurdate DATE DEFAULT CURDATE();
|
|
||||||
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
|
|
||||||
|
|
||||||
SELECT inventoried INTO vDateInventory FROM config;
|
|
||||||
SET @a = 0;
|
|
||||||
SET @currentLineFk = 0;
|
|
||||||
SET @shipped = '';
|
|
||||||
|
|
||||||
SELECT DATE(@shipped:= shipped) shipped,
|
|
||||||
alertLevel,
|
|
||||||
stateName,
|
|
||||||
origin,
|
|
||||||
reference,
|
|
||||||
clientFk,
|
|
||||||
name,
|
|
||||||
`in`,
|
|
||||||
`out`,
|
|
||||||
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
|
|
||||||
@currentLineFk := IF (@shipped < CURDATE()
|
|
||||||
OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)),
|
|
||||||
lineFk,@currentLineFk) lastPreparedLineFk,
|
|
||||||
isTicket,
|
|
||||||
lineFk,isPicked
|
|
||||||
FROM
|
|
||||||
( SELECT tr.landed as shipped,
|
|
||||||
b.quantity as `in`,
|
|
||||||
NULL as `out`,
|
|
||||||
al.alertLevel as alertLevel,
|
|
||||||
st.name AS stateName,
|
|
||||||
s.name as name,
|
|
||||||
e.ref as reference,
|
|
||||||
e.id as origin,
|
|
||||||
s.id as clientFk,
|
|
||||||
IF(al.alertLevel = 3, TRUE, FALSE) isPicked,
|
|
||||||
FALSE AS isTicket,
|
|
||||||
b.id lineFk,
|
|
||||||
NULL `order`
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
|
||||||
JOIN alertLevel al ON al.alertLevel =
|
|
||||||
CASE
|
|
||||||
WHEN tr.shipped < CURDATE() THEN 3
|
|
||||||
WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
|
|
||||||
ELSE 0
|
|
||||||
END
|
|
||||||
JOIN state st ON st.code = al.code
|
|
||||||
WHERE tr.landed >= vDateInventory
|
|
||||||
AND vWarehouse = tr.warehouseInFk
|
|
||||||
AND b.itemFk = vItemId
|
|
||||||
AND e.isInventory = FALSE
|
|
||||||
AND e.isRaid = FALSE
|
|
||||||
UNION ALL
|
|
||||||
|
|
||||||
SELECT tr.shipped,
|
|
||||||
NULL as `in`,
|
|
||||||
b.quantity as `out`,
|
|
||||||
al.alertLevel as alertLevel,
|
|
||||||
st.name AS stateName,
|
|
||||||
s.name as name,
|
|
||||||
e.ref as reference,
|
|
||||||
e.id as origin,
|
|
||||||
s.id as clientFk,
|
|
||||||
IF(al.alertLevel = 3, TRUE, FALSE) isPicked,
|
|
||||||
FALSE AS isTicket,
|
|
||||||
b.id,
|
|
||||||
NULL `order`
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
|
||||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
|
||||||
JOIN alertLevel al ON al.alertLevel =
|
|
||||||
CASE
|
|
||||||
WHEN tr.shipped < CURDATE() THEN 3
|
|
||||||
WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
|
|
||||||
ELSE 0
|
|
||||||
END
|
|
||||||
JOIN state st ON st.code = al.code
|
|
||||||
WHERE tr.shipped >= vDateInventory
|
|
||||||
AND vWarehouse =tr.warehouseOutFk
|
|
||||||
AND s.id <> 4
|
|
||||||
AND b.itemFk = vItemId
|
|
||||||
AND e.isInventory = FALSE
|
|
||||||
AND w.isFeedStock = FALSE
|
|
||||||
AND e.isRaid = FALSE
|
|
||||||
UNION ALL
|
|
||||||
|
|
||||||
SELECT DATE(t.shipped),
|
|
||||||
NULL as `in`,
|
|
||||||
s.quantity as `out`,
|
|
||||||
al.alertLevel as alertLevel,
|
|
||||||
st.name AS stateName,
|
|
||||||
t.nickname as name,
|
|
||||||
t.refFk as reference,
|
|
||||||
t.id as origin,
|
|
||||||
t.clientFk,
|
|
||||||
stk.id as isPicked,
|
|
||||||
TRUE as isTicket,
|
|
||||||
s.id,
|
|
||||||
st.`order`
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticket = t.id
|
|
||||||
LEFT JOIN state st ON st.code = ts.code
|
|
||||||
JOIN client c ON c.id = t.clientFk
|
|
||||||
JOIN alertLevel al ON al.alertLevel =
|
|
||||||
CASE
|
|
||||||
WHEN t.shipped < curdate() THEN 3
|
|
||||||
WHEN t.shipped > util.dayEnd(curdate()) THEN 0
|
|
||||||
ELSE IFNULL(ts.alertLevel, 0)
|
|
||||||
END
|
|
||||||
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
|
|
||||||
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
|
|
||||||
WHERE t.shipped >= vDateInventory
|
|
||||||
AND s.itemFk = vItemId
|
|
||||||
AND vWarehouse =t.warehouseFk
|
|
||||||
ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC
|
|
||||||
) AS itemDiary;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
delimiter ;
|
|
|
@ -1,2 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSaleForcePrice2`;
|
|
|
@ -1,2 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSaleForcePrice`;
|
|
|
@ -1,68 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSale`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSale__`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateSale__`(IN vSale BIGINT)
|
|
||||||
proc: BEGIN
|
|
||||||
-- OBSOLETO USAR: sale_calculateComponent(vSale, NULL)
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicket BIGINT;
|
|
||||||
DECLARE vItem BIGINT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vTicketFree BOOLEAN DEFAULT TRUE;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk
|
|
||||||
INTO vTicketFree, vTicket, vItem, vZoneFk
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
|
||||||
WHERE s.id = vSale
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicket;
|
|
||||||
|
|
||||||
IF IFNULL(vZoneFk,0) = 0 THEN
|
|
||||||
CALL util.throw('ticket dont have zone');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItem;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItem;
|
|
||||||
|
|
||||||
CALL vn.catalog_componentCalculate;
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(IF(vTicketFree,1,6));
|
|
||||||
|
|
||||||
INSERT INTO vn.ticketLog (originFk, userFk, `action`, description)
|
|
||||||
VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `vn`.`ticket_componentUpdate`;
|
|
||||||
DROP procedure IF EXISTS `vn`.`ticket_componentUpdate__`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentUpdate__`(
|
|
||||||
vTicketFk INT,
|
|
||||||
vClientFk INT,
|
|
||||||
vAgencyModeFk INT,
|
|
||||||
vAddressFk INT,
|
|
||||||
vZoneFk INT,
|
|
||||||
vWarehouseFk TINYINT,
|
|
||||||
vCompanyFk SMALLINT,
|
|
||||||
vShipped DATETIME,
|
|
||||||
vLanded DATE,
|
|
||||||
vIsDeleted BOOLEAN,
|
|
||||||
vHasToBeUnrouted BOOLEAN,
|
|
||||||
vOption INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
|
||||||
DECLARE vBonus DECIMAL(10,2);
|
|
||||||
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;
|
|
||||||
|
|
||||||
CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
|
|
||||||
|
|
||||||
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
|
|
||||||
FROM tmp.zoneGetShipped
|
|
||||||
WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET
|
|
||||||
t.clientFk = vClientFk,
|
|
||||||
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;
|
|
||||||
|
|
||||||
IF vOption <> 8 THEN
|
|
||||||
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;
|
|
||||||
END IF;
|
|
||||||
COMMIT;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
;
|
|
|
@ -1,80 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_upcomingDeliveries`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_upcomingDeliveries`()
|
|
||||||
BEGIN
|
|
||||||
DECLARE vForwardDays INT;
|
|
||||||
|
|
||||||
SELECT forwardDays INTO vForwardDays FROM zoneConfig;
|
|
||||||
CALL util.time_createTable(CURDATE(), DATE_ADD(CURDATE(), INTERVAL vForwardDays DAY));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tLandings;
|
|
||||||
CREATE TEMPORARY TABLE tLandings
|
|
||||||
(INDEX (eventFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT e.id eventFk,
|
|
||||||
@travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays,
|
|
||||||
TIMESTAMPADD(DAY, @travelingDays, ti.dated) landed,
|
|
||||||
ti.dated shipped
|
|
||||||
FROM zone z
|
|
||||||
JOIN zoneEvent e ON e.zoneFk = z.id
|
|
||||||
JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate());
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption;
|
|
||||||
CREATE TEMPORARY TABLE tmp.zoneOption
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT *
|
|
||||||
FROM (
|
|
||||||
SELECT z.id zoneFk,
|
|
||||||
TIME(IFNULL(e.`hour`, z.`hour`)) `hour`,
|
|
||||||
l.travelingDays,
|
|
||||||
IFNULL(e.price, z.price) price,
|
|
||||||
IFNULL(e.bonus, z.bonus) bonus,
|
|
||||||
l.landed,
|
|
||||||
l.shipped
|
|
||||||
FROM zone z
|
|
||||||
JOIN zoneEvent e ON e.zoneFk = z.id
|
|
||||||
JOIN tLandings l ON l.eventFk = e.id
|
|
||||||
WHERE (
|
|
||||||
e.`type` = 'day'
|
|
||||||
AND e.`dated` = l.landed
|
|
||||||
) OR (
|
|
||||||
e.`type` != 'day'
|
|
||||||
AND e.weekDays & (1 << WEEKDAY(l.landed))
|
|
||||||
AND (e.`started` IS NULL OR l.landed >= e.`started`)
|
|
||||||
AND (e.`ended` IS NULL OR l.landed <= e.`ended`)
|
|
||||||
)
|
|
||||||
ORDER BY
|
|
||||||
zoneFk,
|
|
||||||
CASE
|
|
||||||
WHEN e.`type` = 'day'
|
|
||||||
THEN 1
|
|
||||||
WHEN e.`type` = 'range'
|
|
||||||
THEN 2
|
|
||||||
ELSE 3
|
|
||||||
END
|
|
||||||
) t
|
|
||||||
GROUP BY zoneFk, landed;
|
|
||||||
|
|
||||||
DELETE t FROM tmp.zoneOption t
|
|
||||||
JOIN zoneExclusion e
|
|
||||||
ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed;
|
|
||||||
|
|
||||||
SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped
|
|
||||||
FROM tmp.zoneOption zo
|
|
||||||
JOIN `zone` z ON z.id = zo.zoneFk
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
|
||||||
JOIN zoneIncluded zi ON zi.zoneFk = z.id
|
|
||||||
JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.type = 'province'
|
|
||||||
WHERE dm.code = 'DELIVERY'
|
|
||||||
GROUP BY shipped, zg.`name`
|
|
||||||
ORDER BY shipped, zg.`name`;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.time, tLandings;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
|
|
||||||
DROP procedure IF EXISTS `vn`.`itemLastEntries`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`itemLastEntries`(IN `vItem` INT, IN `vDays` DATE)
|
|
||||||
BEGIN
|
|
||||||
SELECT
|
|
||||||
w.id AS warehouseFk,
|
|
||||||
w.name AS warehouse,
|
|
||||||
tr.landed,
|
|
||||||
b.entryFk,
|
|
||||||
b.isIgnored,
|
|
||||||
b.price2,
|
|
||||||
b.price3,
|
|
||||||
b.stickers,
|
|
||||||
b.packing,
|
|
||||||
b.`grouping`,
|
|
||||||
b.groupingMode,
|
|
||||||
b.weight,
|
|
||||||
i.stems,
|
|
||||||
b.quantity,
|
|
||||||
b.buyingValue,
|
|
||||||
b.packageFk ,
|
|
||||||
s.id AS supplierFk,
|
|
||||||
s.name AS supplier
|
|
||||||
FROM itemType it
|
|
||||||
RIGHT JOIN (entry e
|
|
||||||
LEFT JOIN supplier s ON s.id = e.supplierFk
|
|
||||||
RIGHT JOIN buy b ON b.entryFk = e.id
|
|
||||||
LEFT JOIN item i ON i.id = b.itemFk
|
|
||||||
LEFT JOIN ink ON ink.id = i.inkFk
|
|
||||||
LEFT JOIN travel tr ON tr.id = e.travelFk
|
|
||||||
LEFT JOIN warehouse w ON w.id = tr.warehouseInFk
|
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
|
||||||
) ON it.id = i.typeFk
|
|
||||||
LEFT JOIN edi.ekt ek ON b.ektFk = ek.id
|
|
||||||
WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(CURDATE(), INTERVAl + 10 DAY)
|
|
||||||
ORDER BY tr.landed DESC , b.id DESC;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
ALTER TABLE `vn`.`route`
|
|
||||||
DROP FOREIGN KEY `fk_route_1`;
|
|
||||||
ALTER TABLE `vn`.`route`
|
|
||||||
ADD CONSTRAINT `fk_route_1`
|
|
||||||
FOREIGN KEY (`zoneFk`)
|
|
||||||
REFERENCES `vn`.`zone` (`id`)
|
|
||||||
ON DELETE SET NULL
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,99 +0,0 @@
|
||||||
|
|
||||||
DROP procedure IF EXISTS `vn`.`sale_calculateComponent`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_calculateComponent`(vSale INT, vOption INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Actualiza los componentes
|
|
||||||
*
|
|
||||||
* @param vSale Delivery date
|
|
||||||
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicketFk BIGINT;
|
|
||||||
DECLARE vItemFk BIGINT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vIsEditable BOOLEAN;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
|
|
||||||
s.ticketFk,
|
|
||||||
s.itemFk ,
|
|
||||||
t.zoneFk,
|
|
||||||
t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed
|
|
||||||
INTO vIsEditable,
|
|
||||||
vTicketFk,
|
|
||||||
vItemFk,
|
|
||||||
vZoneFk,
|
|
||||||
vWarehouseFk,
|
|
||||||
vShipped,
|
|
||||||
vAddressFk,
|
|
||||||
vAgencyModeFk,
|
|
||||||
vLanded
|
|
||||||
FROM ticket t
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
|
||||||
WHERE s.id = vSale;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
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;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
IF vOption IS NULL THEN
|
|
||||||
SET vOption = IF(vIsEditable, 1, 6);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(vOption);
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateClon`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `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
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vWarehouse SMALLINT;
|
|
||||||
DECLARE vAgencyMode INT;
|
|
||||||
DECLARE vAddress INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vAgency INT;
|
|
||||||
DECLARE vZoneFk INT;
|
|
||||||
|
|
||||||
REPLACE INTO orderTicket(orderFk,ticketFk)
|
|
||||||
SELECT orderFk, vTicketNew
|
|
||||||
FROM orderTicket
|
|
||||||
WHERE ticketFk = vTicketOld;
|
|
||||||
|
|
||||||
SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk
|
|
||||||
INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
IF vLanded IS NULL THEN
|
|
||||||
CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse, TRUE);
|
|
||||||
UPDATE ticket t
|
|
||||||
JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
|
|
||||||
SET t.landed = zgl.landed,
|
|
||||||
t.zone = zgl.zoneFk
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla tmp.buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate(vWarehouse, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode, vWarehouse);
|
|
||||||
|
|
||||||
-- Bionizamos lineas con Preu = 0
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT s.id saleFk, vWarehouse warehouseFk
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(1);
|
|
||||||
|
|
||||||
-- Bionizamos lineas con Preu > 0
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT s.id saleFk, vWarehouse warehouseFk
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew
|
|
||||||
AND s.price > 0;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(6);
|
|
||||||
|
|
||||||
-- Log
|
|
||||||
CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
|
|
||||||
|
|
||||||
-- Limpieza
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale,
|
|
||||||
tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_cloneWeekly`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vIsDone BOOL;
|
|
||||||
DECLARE vLanding DATE;
|
|
||||||
DECLARE vShipment DATE;
|
|
||||||
DECLARE vWarehouse INT;
|
|
||||||
DECLARE vTicket INT;
|
|
||||||
DECLARE vWeekDay INT;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vEmpresa INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vNewTicket INT;
|
|
||||||
DECLARE vYear INT;
|
|
||||||
|
|
||||||
DECLARE rsTicket CURSOR FOR
|
|
||||||
SELECT tw.ticketFk, weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tw.agencyModeFk
|
|
||||||
FROM ticketWeekly tw
|
|
||||||
JOIN ticket t ON tt.ticketFk = t.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
|
||||||
|
|
||||||
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
|
|
||||||
|
|
||||||
OPEN rsTicket;
|
|
||||||
|
|
||||||
myLoop: LOOP
|
|
||||||
BEGIN
|
|
||||||
DECLARE vError TEXT;
|
|
||||||
DECLARE vSalesPersonEmail VARCHAR(150);
|
|
||||||
DECLARE vMailSent BOOL;
|
|
||||||
DECLARE vSubject VARCHAR(150);
|
|
||||||
DECLARE vMessage TEXT;
|
|
||||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
GET DIAGNOSTICS CONDITION 1
|
|
||||||
vError = MESSAGE_TEXT;
|
|
||||||
END;
|
|
||||||
|
|
||||||
SET vIsDone = FALSE;
|
|
||||||
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk;
|
|
||||||
|
|
||||||
IF vIsDone THEN
|
|
||||||
|
|
||||||
LEAVE myLoop;
|
|
||||||
END IF;
|
|
||||||
SELECT date INTO vShipment
|
|
||||||
FROM `time`
|
|
||||||
WHERE `year` = vYear AND `week` = vWeek
|
|
||||||
AND WEEKDAY(date) = vWeekDay;
|
|
||||||
|
|
||||||
-- busca si el ticket ya ha sido clonado
|
|
||||||
IF (SELECT COUNT(*) FROM vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
|
|
||||||
WHERE tOrig.id = vTicket AND DATE(tClon.shipped) = vShipment) > 0
|
|
||||||
THEN
|
|
||||||
ITERATE myLoop;
|
|
||||||
END IF;
|
|
||||||
CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouse, TRUE);
|
|
||||||
|
|
||||||
SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
|
|
||||||
|
|
||||||
CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk, NULL, vLanding, account.userGetId(), vNewTicket);
|
|
||||||
|
|
||||||
IF (vLanding IS NULL) THEN
|
|
||||||
|
|
||||||
SELECT e.email INTO vSalesPersonEmail
|
|
||||||
FROM vn.client c
|
|
||||||
JOIN vn.worker sp ON sp.id = c.salesPersonFk
|
|
||||||
JOIN account.emailUser e ON e.userFk = sp.userFk
|
|
||||||
WHERE c.id = vClient;
|
|
||||||
|
|
||||||
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment);
|
|
||||||
SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment,
|
|
||||||
' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
|
|
||||||
' pero ha que revisar las fechas y la agencia');
|
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vMailSent
|
|
||||||
FROM vn.mail
|
|
||||||
WHERE sender = vSalesPersonEmail
|
|
||||||
AND subject = vSubject;
|
|
||||||
|
|
||||||
IF NOT vMailSent THEN
|
|
||||||
INSERT INTO vn.mail (sender,`subject`,body)
|
|
||||||
VALUES (vSalesPersonEmail, vSubject, vMessage);
|
|
||||||
END IF;
|
|
||||||
CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
|
|
||||||
SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
|
|
||||||
FROM vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
LEFT JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
LEFT JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
LEFT JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk AND DATE(tClon.shipped) = vShipment
|
|
||||||
WHERE tOrig.id = vTicket AND saleClon.id IS NULL;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
|
|
||||||
SELECT saleOriginal.id, saleClon.id
|
|
||||||
FROM vn.sale saleOriginal
|
|
||||||
JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
|
|
||||||
WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
INSERT INTO ticketRequest (description, ordered, shipped, salesPersonCode, buyerCode, quantity, price,
|
|
||||||
itemFk ,clientFk, response, total, buyed, saleFk)
|
|
||||||
SELECT tr.description, tr.ordered, tr.shipped, tr.salesPersonCode, tr.buyerCode, tr.quantity, tr.price,
|
|
||||||
tr.itemFk, tr.clientFk, tr.response, tr.total, tr.buyed, tr.saleFk
|
|
||||||
FROM sale s JOIN ticketRequest tr ON tr.saleFk = s.id
|
|
||||||
JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND m.Id_Article = m2.Id_Article
|
|
||||||
WHERE s.ticketFk = vTicket AND s2.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
|
|
||||||
END;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE rsTicket;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_recalcComponents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN)
|
|
||||||
proc: BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Este procedimiento recalcula los componentes de un ticket,
|
|
||||||
* eliminando los componentes existentes e insertandolos de nuevo
|
|
||||||
*
|
|
||||||
* @param vTicketFk Id del ticket
|
|
||||||
* @param vIsTicketEditable si no se quiere forzar llamar con NULL
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
IF vIsTicketEditable IS NULL THEN
|
|
||||||
SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = ''
|
|
||||||
INTO vIsTicketEditable
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE id = vTicketFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed,
|
|
||||||
t.zoneFk
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
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;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available,
|
|
||||||
s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
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);
|
|
||||||
|
|
||||||
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 s.ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
-- si el ticket esta facturado, respeta los precios
|
|
||||||
CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,40 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_getLanded`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Devuelve una tabla temporal con el dia de recepcion para vShipped.
|
|
||||||
*
|
|
||||||
* @param vShipped Fecha de preparacion de mercancia
|
|
||||||
* @param vAddressFk Id de consignatario, %NULL para recogida
|
|
||||||
* @param vAgencyModeFk Id agencia
|
|
||||||
* @param vWarehouseFk vWarehouseFk
|
|
||||||
* @table tmp.zoneGetLanded Datos de recepción
|
|
||||||
*/
|
|
||||||
|
|
||||||
CALL zone_getFromGeo(address_getGeo(vAddressFk));
|
|
||||||
CALL zone_getOptionsForShipment(vShipped, vShowExpiredZones);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
||||||
CREATE TEMPORARY TABLE tmp.zoneGetLanded
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT vWarehouseFk warehouseFk,
|
|
||||||
TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed,
|
|
||||||
zo.zoneFk
|
|
||||||
FROM tmp.zoneOption zo
|
|
||||||
JOIN zone z ON z.id = zo.zoneFk
|
|
||||||
JOIN zoneWarehouse zw ON zw.zoneFk = z.id
|
|
||||||
WHERE agencyModeFk = vAgencyModeFk
|
|
||||||
AND zw.warehouseFk = vWarehouseFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.zone,
|
|
||||||
tmp.zoneOption;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
ALTER TABLE `postgresql`.`calendar_employee`
|
|
||||||
ADD COLUMN `id` INT NULL AUTO_INCREMENT FIRST,
|
|
||||||
ADD UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE,
|
|
||||||
ADD INDEX `id_index` (`id` ASC) VISIBLE;
|
|
||||||
;
|
|
File diff suppressed because one or more lines are too long
|
@ -1199,8 +1199,8 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
|
||||||
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0),
|
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0),
|
||||||
(5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1),
|
(5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1),
|
||||||
(6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1),
|
(6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1),
|
||||||
(7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 1),
|
(7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 2),
|
||||||
(8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1);
|
(8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1251,30 +1251,30 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package
|
||||||
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE());
|
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE());
|
||||||
|
|
||||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
|
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1,'155.89', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1,'100.10', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
(3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1,'107.25', DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||||
(4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
(4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||||
(5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
(5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
||||||
(6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0,'123.53', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0,'60.90', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0,'155.89', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0,'16.50', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
(20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0,'21.45', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
(21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0,'0.00', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
|
(22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0,'148.50', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
|
||||||
|
|
||||||
INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
|
INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,20 +17,20 @@ module.exports = Self => {
|
||||||
type: 'String',
|
type: 'String',
|
||||||
description: `If it's and integer searchs by id, otherwise it searchs by name`
|
description: `If it's and integer searchs by id, otherwise it searchs by name`
|
||||||
}, {
|
}, {
|
||||||
arg: 'itemFk',
|
arg: 'itemId',
|
||||||
type: 'Integer',
|
type: 'Number',
|
||||||
description: 'Item id'
|
description: 'Item id'
|
||||||
}, {
|
}, {
|
||||||
arg: 'categoryFk',
|
arg: 'categoryId',
|
||||||
type: 'Integer',
|
type: 'Number',
|
||||||
description: 'Category id'
|
description: 'Category id'
|
||||||
}, {
|
}, {
|
||||||
arg: 'typeFk',
|
arg: 'typeId',
|
||||||
type: 'Integer',
|
type: 'Number',
|
||||||
description: 'Item type id',
|
description: 'Item type id',
|
||||||
}, {
|
}, {
|
||||||
arg: 'buyerFk',
|
arg: 'buyerId',
|
||||||
type: 'Integer',
|
type: 'Number',
|
||||||
description: 'Buyer id'
|
description: 'Buyer id'
|
||||||
}, {
|
}, {
|
||||||
arg: 'from',
|
arg: 'from',
|
||||||
|
@ -75,6 +75,10 @@ module.exports = Self => {
|
||||||
return {'it.id': value};
|
return {'it.id': value};
|
||||||
case 'buyerId':
|
case 'buyerId':
|
||||||
return {'it.workerFk': value};
|
return {'it.workerFk': value};
|
||||||
|
case 'from':
|
||||||
|
return {'t.shipped': {gte: value}};
|
||||||
|
case 'to':
|
||||||
|
return {'t.shipped': {lte: value}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
filter = mergeFilters(filter, {where});
|
filter = mergeFilters(filter, {where});
|
||||||
|
|
|
@ -37,4 +37,24 @@ describe('client consumption() filter', () => {
|
||||||
expect(secondRow.quantity).toEqual(15);
|
expect(secondRow.quantity).toEqual(15);
|
||||||
expect(thirdRow.quantity).toEqual(20);
|
expect(thirdRow.quantity).toEqual(20);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return a list of tickets from the item id 4', async() => {
|
||||||
|
const ctx = {req: {accessToken: {userId: 9}},
|
||||||
|
args: {
|
||||||
|
itemId: 4
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const filter = {
|
||||||
|
where: {
|
||||||
|
clientFk: 101
|
||||||
|
},
|
||||||
|
order: 'itemTypeFk, itemName, itemSize'
|
||||||
|
};
|
||||||
|
const result = await app.models.Client.consumption(ctx, filter);
|
||||||
|
|
||||||
|
const expectedItemId = 4;
|
||||||
|
const firstRow = result[0];
|
||||||
|
|
||||||
|
expect(firstRow.itemFk).toEqual(expectedItemId);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,6 @@ describe('Client get', () => {
|
||||||
|
|
||||||
expect(result.id).toEqual(101);
|
expect(result.id).toEqual(101);
|
||||||
expect(result.name).toEqual('Bruce Wayne');
|
expect(result.name).toEqual('Bruce Wayne');
|
||||||
expect(result.debt).toEqual(889.38);
|
expect(result.debt).toEqual(879.38);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe('client getDebt()', () => {
|
||||||
it('should return the client debt', async() => {
|
it('should return the client debt', async() => {
|
||||||
let result = await app.models.Client.getDebt(101);
|
let result = await app.models.Client.getDebt(101);
|
||||||
|
|
||||||
expect(result.debt).toEqual(889.38);
|
expect(result.debt).toEqual(879.38);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('client summary()', () => {
|
||||||
it('should return a summary object containing debt', async() => {
|
it('should return a summary object containing debt', async() => {
|
||||||
let result = await app.models.Client.summary(101);
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
expect(result.debt.debt).toEqual(889.38);
|
expect(result.debt.debt).toEqual(879.38);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a summary object containing averageInvoiced', async() => {
|
it('should return a summary object containing averageInvoiced', async() => {
|
||||||
|
|
|
@ -135,7 +135,6 @@ module.exports = Self => {
|
||||||
JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk`
|
JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
let itemsIndex = stmts.push(stmt) - 1;
|
let itemsIndex = stmts.push(stmt) - 1;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,10 @@ class Report extends Component {
|
||||||
if (fs.existsSync(fullPath))
|
if (fs.existsSync(fullPath))
|
||||||
options = require(optionsPath);
|
options = require(optionsPath);
|
||||||
|
|
||||||
const browser = await puppeteer.launch({headless: true});
|
const browser = await puppeteer.launch({
|
||||||
|
headless: true,
|
||||||
|
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||||
|
});
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
await page.setContent(template);
|
await page.setContent(template);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,26 @@
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/node": {
|
||||||
|
"version": "14.0.27",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz",
|
||||||
|
"integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@types/yauzl": {
|
||||||
|
"version": "2.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz",
|
||||||
|
"integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"agent-base": {
|
||||||
|
"version": "5.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
|
||||||
|
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g=="
|
||||||
|
},
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.7.0",
|
"version": "6.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz",
|
||||||
|
@ -69,6 +89,16 @@
|
||||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
|
||||||
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
|
||||||
},
|
},
|
||||||
|
"balanced-match": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||||
|
},
|
||||||
|
"base64-js": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
|
||||||
|
},
|
||||||
"bcrypt-pbkdf": {
|
"bcrypt-pbkdf": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
||||||
|
@ -77,11 +107,51 @@
|
||||||
"tweetnacl": "^0.14.3"
|
"tweetnacl": "^0.14.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"bl": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==",
|
||||||
|
"requires": {
|
||||||
|
"buffer": "^5.5.0",
|
||||||
|
"inherits": "^2.0.4",
|
||||||
|
"readable-stream": "^3.4.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"boolbase": {
|
"boolbase": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||||
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
|
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
|
||||||
},
|
},
|
||||||
|
"brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"requires": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffer": {
|
||||||
|
"version": "5.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
|
||||||
|
"integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
|
||||||
|
"requires": {
|
||||||
|
"base64-js": "^1.0.2",
|
||||||
|
"ieee754": "^1.1.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffer-crc32": {
|
||||||
|
"version": "0.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||||
|
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
|
||||||
|
},
|
||||||
"buffer-from": {
|
"buffer-from": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||||
|
@ -131,6 +201,11 @@
|
||||||
"lodash.some": "^4.4.0"
|
"lodash.some": "^4.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"chownr": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||||
|
},
|
||||||
"cliui": {
|
"cliui": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||||
|
@ -182,6 +257,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||||
},
|
},
|
||||||
|
"concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||||
|
},
|
||||||
"concat-stream": {
|
"concat-stream": {
|
||||||
"version": "1.6.2",
|
"version": "1.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
|
||||||
|
@ -299,6 +379,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz",
|
||||||
"integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ=="
|
"integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ=="
|
||||||
},
|
},
|
||||||
|
"devtools-protocol": {
|
||||||
|
"version": "0.0.781568",
|
||||||
|
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.781568.tgz",
|
||||||
|
"integrity": "sha512-9Uqnzy6m6zEStluH9iyJ3iHyaQziFnMnLeC8vK0eN6smiJmIx7+yB64d67C2lH/LZra+5cGscJAJsNXO+MdPMg=="
|
||||||
|
},
|
||||||
"dijkstrajs": {
|
"dijkstrajs": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz",
|
||||||
|
@ -349,6 +434,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||||
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
|
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
|
||||||
},
|
},
|
||||||
|
"end-of-stream": {
|
||||||
|
"version": "1.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||||
|
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||||
|
"requires": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"entities": {
|
"entities": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
|
||||||
|
@ -434,6 +527,11 @@
|
||||||
"mime-types": "^2.1.12"
|
"mime-types": "^2.1.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fs-constants": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||||
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "7.0.1",
|
"version": "7.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
|
||||||
|
@ -444,6 +542,11 @@
|
||||||
"universalify": "^0.1.0"
|
"universalify": "^0.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fs.realpath": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
|
},
|
||||||
"generate-function": {
|
"generate-function": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
|
||||||
|
@ -457,6 +560,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
|
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
|
||||||
},
|
},
|
||||||
|
"get-stream": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||||
|
"requires": {
|
||||||
|
"pump": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"getpass": {
|
"getpass": {
|
||||||
"version": "0.1.7",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||||
|
@ -465,6 +576,19 @@
|
||||||
"assert-plus": "^1.0.0"
|
"assert-plus": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"glob": {
|
||||||
|
"version": "7.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
|
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||||
|
"requires": {
|
||||||
|
"fs.realpath": "^1.0.0",
|
||||||
|
"inflight": "^1.0.4",
|
||||||
|
"inherits": "2",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"path-is-absolute": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"graceful-fs": {
|
"graceful-fs": {
|
||||||
"version": "4.1.15",
|
"version": "4.1.15",
|
||||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
||||||
|
@ -548,6 +672,30 @@
|
||||||
"sshpk": "^1.7.0"
|
"sshpk": "^1.7.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"https-proxy-agent": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
|
||||||
|
"requires": {
|
||||||
|
"agent-base": "5",
|
||||||
|
"debug": "4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||||
|
"requires": {
|
||||||
|
"ms": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"iconv-lite": {
|
"iconv-lite": {
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz",
|
||||||
|
@ -556,11 +704,25 @@
|
||||||
"safer-buffer": ">= 2.1.2 < 3"
|
"safer-buffer": ">= 2.1.2 < 3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ieee754": {
|
||||||
|
"version": "1.1.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
|
||||||
|
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
|
||||||
|
},
|
||||||
"image-size": {
|
"image-size": {
|
||||||
"version": "0.7.5",
|
"version": "0.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.7.5.tgz",
|
||||||
"integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g=="
|
"integrity": "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g=="
|
||||||
},
|
},
|
||||||
|
"inflight": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"requires": {
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||||
|
@ -804,6 +966,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/mensch/-/mensch-0.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/mensch/-/mensch-0.3.3.tgz",
|
||||||
"integrity": "sha1-4gD/TdgjcX+OBWOzLj9UgfyiYrI="
|
"integrity": "sha1-4gD/TdgjcX+OBWOzLj9UgfyiYrI="
|
||||||
},
|
},
|
||||||
|
"mime": {
|
||||||
|
"version": "2.4.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz",
|
||||||
|
"integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA=="
|
||||||
|
},
|
||||||
"mime-db": {
|
"mime-db": {
|
||||||
"version": "1.37.0",
|
"version": "1.37.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
|
||||||
|
@ -822,6 +989,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/mimer/-/mimer-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/mimer/-/mimer-1.0.0.tgz",
|
||||||
"integrity": "sha512-4ZJvCzfcwsBgPbkKXUzGoVZMWjv8IDIygkGzVc7uUYhgnK0t2LmGxxjdgH1i+pn0/KQfB5F/VKUJlfyTSOFQjg=="
|
"integrity": "sha512-4ZJvCzfcwsBgPbkKXUzGoVZMWjv8IDIygkGzVc7uUYhgnK0t2LmGxxjdgH1i+pn0/KQfB5F/VKUJlfyTSOFQjg=="
|
||||||
},
|
},
|
||||||
|
"minimatch": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
|
"requires": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||||
|
@ -837,6 +1012,11 @@
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mkdirp-classic": {
|
||||||
|
"version": "0.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||||
|
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
||||||
|
},
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
@ -905,6 +1085,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
||||||
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
|
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
|
||||||
},
|
},
|
||||||
|
"once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
|
"requires": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"p-limit": {
|
"p-limit": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
|
||||||
|
@ -931,6 +1119,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
|
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
|
||||||
},
|
},
|
||||||
|
"path-is-absolute": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||||
|
},
|
||||||
"path-key": {
|
"path-key": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
|
||||||
|
@ -944,8 +1137,7 @@
|
||||||
"pend": {
|
"pend": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
|
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
|
||||||
"optional": true
|
|
||||||
},
|
},
|
||||||
"performance-now": {
|
"performance-now": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
|
@ -1006,6 +1198,46 @@
|
||||||
"pinkie": "^2.0.0"
|
"pinkie": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pkg-dir": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
|
||||||
|
"requires": {
|
||||||
|
"find-up": "^4.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"find-up": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^5.0.0",
|
||||||
|
"path-exists": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^4.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"path-exists": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"pngjs": {
|
"pngjs": {
|
||||||
"version": "3.4.0",
|
"version": "3.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz",
|
||||||
|
@ -1023,6 +1255,11 @@
|
||||||
"integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=",
|
"integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
|
},
|
||||||
"pseudomap": {
|
"pseudomap": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||||
|
@ -1033,11 +1270,87 @@
|
||||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz",
|
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz",
|
||||||
"integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw=="
|
"integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw=="
|
||||||
},
|
},
|
||||||
|
"pump": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||||
|
"requires": {
|
||||||
|
"end-of-stream": "^1.1.0",
|
||||||
|
"once": "^1.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"punycode": {
|
"punycode": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||||
},
|
},
|
||||||
|
"puppeteer": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-PZoZG7u+T6N1GFWBQmGVG162Ak5MAy8nYSVpeeQrwJK2oYUlDWpHEJPcd/zopyuEMTv7DiztS1blgny1txR2qw==",
|
||||||
|
"requires": {
|
||||||
|
"debug": "^4.1.0",
|
||||||
|
"devtools-protocol": "0.0.781568",
|
||||||
|
"extract-zip": "^2.0.0",
|
||||||
|
"https-proxy-agent": "^4.0.0",
|
||||||
|
"mime": "^2.0.3",
|
||||||
|
"pkg-dir": "^4.2.0",
|
||||||
|
"progress": "^2.0.1",
|
||||||
|
"proxy-from-env": "^1.0.0",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"tar-fs": "^2.0.0",
|
||||||
|
"unbzip2-stream": "^1.3.3",
|
||||||
|
"ws": "^7.2.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||||
|
"requires": {
|
||||||
|
"ms": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-zip": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
|
||||||
|
"requires": {
|
||||||
|
"@types/yauzl": "^2.9.1",
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"get-stream": "^5.1.0",
|
||||||
|
"yauzl": "^2.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fd-slicer": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
|
||||||
|
"requires": {
|
||||||
|
"pend": "~1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
|
||||||
|
},
|
||||||
|
"yauzl": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
|
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
|
||||||
|
"requires": {
|
||||||
|
"buffer-crc32": "~0.2.3",
|
||||||
|
"fd-slicer": "~1.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"qrcode": {
|
"qrcode": {
|
||||||
"version": "1.4.2",
|
"version": "1.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.2.tgz",
|
||||||
|
@ -1125,6 +1438,14 @@
|
||||||
"path-parse": "^1.0.6"
|
"path-parse": "^1.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rimraf": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
|
||||||
|
"requires": {
|
||||||
|
"glob": "^7.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
@ -1265,12 +1586,40 @@
|
||||||
"has-flag": "^3.0.0"
|
"has-flag": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tar-fs": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==",
|
||||||
|
"requires": {
|
||||||
|
"chownr": "^1.1.1",
|
||||||
|
"mkdirp-classic": "^0.5.2",
|
||||||
|
"pump": "^3.0.0",
|
||||||
|
"tar-stream": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tar-stream": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-Z9yri56Dih8IaK8gncVPx4Wqt86NDmQTSh49XLZgjWpGZL9GK9HKParS2scqHCC4w6X9Gh2jwaU45V47XTKwVA==",
|
||||||
|
"requires": {
|
||||||
|
"bl": "^4.0.1",
|
||||||
|
"end-of-stream": "^1.4.1",
|
||||||
|
"fs-constants": "^1.0.0",
|
||||||
|
"inherits": "^2.0.3",
|
||||||
|
"readable-stream": "^3.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"throttleit": {
|
"throttleit": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
|
||||||
"integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=",
|
"integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"through": {
|
||||||
|
"version": "2.3.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||||
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||||
|
},
|
||||||
"tough-cookie": {
|
"tough-cookie": {
|
||||||
"version": "2.4.3",
|
"version": "2.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
|
||||||
|
@ -1306,6 +1655,15 @@
|
||||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"unbzip2-stream": {
|
||||||
|
"version": "1.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
||||||
|
"integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
|
||||||
|
"requires": {
|
||||||
|
"buffer": "^5.2.1",
|
||||||
|
"through": "^2.3.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"universalify": {
|
"universalify": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||||
|
@ -1455,6 +1813,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
|
},
|
||||||
|
"ws": {
|
||||||
|
"version": "7.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz",
|
||||||
|
"integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA=="
|
||||||
|
},
|
||||||
"xtend": {
|
"xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
"juice": "^5.2.0",
|
"juice": "^5.2.0",
|
||||||
"mysql2": "^1.7.0",
|
"mysql2": "^1.7.0",
|
||||||
"nodemailer": "^4.7.0",
|
"nodemailer": "^4.7.0",
|
||||||
|
"puppeteer": "^2.0.0",
|
||||||
"qrcode": "^1.4.2",
|
"qrcode": "^1.4.2",
|
||||||
"strftime": "^0.10.0",
|
"strftime": "^0.10.0",
|
||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
|
|
Loading…
Reference in New Issue