Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 3426-ticket_index
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-12-14 12:43:40 +01:00
commit 5960d40891
7 changed files with 367 additions and 69 deletions

View File

@ -130,8 +130,7 @@ BEGIN
END END
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
LEFT JOIN claim cl ON cl.ticketFk = t.id LEFT JOIN claimBeginning cb ON s.id = cb.saleFk
LEFT JOIN claimBeginning cb ON cl.id = cb.claimFk AND s.id = cb.saleFk
WHERE t.shipped >= vDateInventory WHERE t.shipped >= vDateInventory
AND s.itemFk = vItemId AND s.itemFk = vItemId
AND vWarehouse =t.warehouseFk AND vWarehouse =t.warehouseFk

View File

@ -0,0 +1 @@
Delete me!

View File

@ -1,6 +1,6 @@
USE `util`; USE `util`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: util -- Host: db.verdnatura.es Database: util
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -34,9 +34,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:34 -- Dump completed on 2021-12-01 7:59:57
USE `account`; USE `account`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: account -- Host: db.verdnatura.es Database: account
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -120,9 +120,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:35 -- Dump completed on 2021-12-01 7:59:59
USE `salix`; USE `salix`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: salix -- Host: db.verdnatura.es Database: salix
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -186,9 +186,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:36 -- Dump completed on 2021-12-01 8:00:00
USE `vn`; USE `vn`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: vn -- Host: db.verdnatura.es Database: vn
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -452,9 +452,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:41 -- Dump completed on 2021-12-01 8:00:05
USE `cache`; USE `cache`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: cache -- Host: db.verdnatura.es Database: cache
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -488,9 +488,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:42 -- Dump completed on 2021-12-01 8:00:06
USE `hedera`; USE `hedera`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: hedera -- Host: db.verdnatura.es Database: hedera
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -554,9 +554,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:43 -- Dump completed on 2021-12-01 8:00:07
USE `postgresql`; USE `postgresql`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: postgresql -- Host: db.verdnatura.es Database: postgresql
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -640,9 +640,9 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:44 -- Dump completed on 2021-12-01 8:00:08
USE `sage`; USE `sage`;
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: sage -- Host: db.verdnatura.es Database: sage
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -696,4 +696,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-24 12:27:44 -- Dump completed on 2021-12-01 8:00:09

View File

@ -1870,7 +1870,7 @@ INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
VALUES VALUES
('1', '27.5', YEAR(CURDATE())), ('1', '27.5', YEAR(CURDATE())),
('5', '22', YEAR(CURDATE())), ('5', '22', YEAR(CURDATE())),
('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))), ('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))),
('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))); ('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)));
INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`) INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`)

View File

@ -1,4 +1,4 @@
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64) -- MariaDB dump 10.19 Distrib 10.6.5-MariaDB, for debian-linux-gnu (x86_64)
-- --
-- Host: db.verdnatura.es Database: account -- Host: db.verdnatura.es Database: account
-- ------------------------------------------------------ -- ------------------------------------------------------
@ -14652,9 +14652,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8 */ ; /*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
@ -14703,8 +14703,8 @@ BEGIN
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate
FROM order_row r FROM order_row r
JOIN vn.item i ON i.id = r.item_id JOIN vn.item i ON i.id = r.item_id
WHERE /*r.amount != 0 JGF 2021-11-15 WHERE r.amount != 0
AND*/ r.warehouse_id = vWarehouse AND r.warehouse_id = vWarehouse
AND r.order_id = vOrder AND r.order_id = vOrder
ORDER BY r.rate DESC; ORDER BY r.rate DESC;
@ -25233,11 +25233,11 @@ CREATE TABLE `buy` (
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8 */ ; /*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `buy_beforeInsert` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `buy_beforeInsert`
BEFORE INSERT ON `buy` BEFORE INSERT ON `buy`
@ -25327,11 +25327,11 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ; /*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8 */ ; /*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ; /*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `buy_beforeUpdate` /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `buy_beforeUpdate`
BEFORE UPDATE ON `buy` BEFORE UPDATE ON `buy`
@ -29855,9 +29855,17 @@ CREATE TABLE `genericAllocation` (
`color` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `color` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`quality` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `quality` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`numFlores` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `numFlores` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
`category` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`productor` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `genericAllocation_FK` (`itemFk`), KEY `genericAllocation_FK` (`itemFk`),
KEY `genericAllocation_FK_1` (`typeFk`), KEY `genericAllocation_FK_1` (`typeFk`),
KEY `genericAllocation_origin_IDX` (`origin`) USING BTREE,
KEY `genericAllocation_color_IDX` (`color`) USING BTREE,
KEY `genericAllocation_quality_IDX` (`quality`) USING BTREE,
KEY `genericAllocation_numFlores_IDX` (`numFlores`) USING BTREE,
KEY `genericAllocation_category_IDX` (`category`) USING BTREE,
KEY `genericAllocation_productor_IDX` (`productor`) USING BTREE,
CONSTRAINT `genericAllocation_FK` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT `genericAllocation_FK` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items'; ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items';
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@ -35838,11 +35846,12 @@ DELIMITER ;;
AFTER INSERT AFTER INSERT
ON saleBuy FOR EACH ROW ON saleBuy FOR EACH ROW
BEGIN BEGIN
/* Activar de nuevo cuando volvamos a vender fruta y verdura
*
UPDATE vn.sale s UPDATE vn.sale s
SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk) SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk)
WHERE s.id = NEW.saleFk; WHERE s.id = NEW.saleFk;
*/
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -36590,6 +36599,33 @@ DELIMITER ;
/*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `shelvingLog`
--
DROP TABLE IF EXISTS `shelvingLog`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shelvingLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` varchar(10) CHARACTER SET utf8 NOT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`description` text CHARACTER SET utf8,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci,
`newInstance` text COLLATE utf8_unicode_ci,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `userFk` (`userFk`),
KEY `originFk` (`originFk`),
CONSTRAINT `shelvingLog_FK_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `silexACL` -- Table structure for table `silexACL`
-- --
@ -48640,7 +48676,7 @@ BEGIN
DELETE g FROM glsExpedition g DELETE g FROM glsExpedition g
JOIN expedition e ON e.id = g.expeditionFk JOIN expedition e ON e.id = g.expeditionFk
WHERE e.created < v26Month; WHERE e.created < v26Month;
DELETE FROM expedition WHERE created < v26Month; DELETE IGNORE FROM expedition WHERE created < v26Month;
DELETE FROM sms WHERE created < v18Month; DELETE FROM sms WHERE created < v18Month;
DELETE FROM saleTracking WHERE created < vDateShort; DELETE FROM saleTracking WHERE created < vDateShort;
DELETE tobs FROM ticketObservation tobs DELETE tobs FROM ticketObservation tobs
@ -50260,6 +50296,50 @@ BEGIN
AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH)
AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH); AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH);
-- END IF; -- END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `collectionOrTicket_printSticker` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `collectionOrTicket_printSticker`(vParam INT, vSectorFk INT)
BEGIN
/*Imprime una etiqueta amarilla a partir de una colección o ticket
*
* @param vParam colección o ticket a imprimir
* @param vSectorFk id del sector
*/
DECLARE vLabelReport INT;
SELECT labelReportFk INTO vLabelReport
FROM sector
WHERE id = vSectorFk;
IF vLabelReport THEN
INSERT INTO ticketTrolley(ticket, labelCount)
SELECT ticketFk, 1
FROM ticketCollection
WHERE collectionFk = vParam OR ticketFK = vParam
ON DUPLICATE KEY UPDATE labelCount = labelCount + 1;
INSERT INTO printServerQueue(labelReportFk, param1, workerFk)
SELECT vLabelReport, vParam, getUser();
END IF;
END ;; END ;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -50603,6 +50683,9 @@ DELIMITER ;
DELIMITER ;; DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `collectionSticker_print`(vCollectionFk INT, vSectorFk INT) CREATE DEFINER=`root`@`%` PROCEDURE `collectionSticker_print`(vCollectionFk INT, vSectorFk INT)
BEGIN BEGIN
/*@deprecated :utilizar collectionOrTicket_printSticker*/
DECLARE vLabelReport INT; DECLARE vLabelReport INT;
SELECT labelReportFk INTO vLabelReport SELECT labelReportFk INTO vLabelReport
@ -54382,7 +54465,7 @@ BEGIN
SELECT COUNT(*) INTO vIsDepartment SELECT COUNT(*) INTO vIsDepartment
FROM vn.workerDepartment dp FROM vn.workerDepartment dp
JOIN department d ON d.id = dp.departmentFk JOIN department d ON d.id = dp.departmentFk
WHERE dp.workerFk = vUserFk AND d.name = "PRODUCCION"; WHERE dp.workerFk = vUserFk AND (d.name = "PRODUCCION" OR d.name = "CAMARA" OR d.name = "PALETIZADO" OR d.name = "ARTIFICIAL" OR d.name="NATURAL" OR d.name="TALLER ARTIFICIAL" OR d.name="TALLER NATURAL") ;
IF vIsDepartment THEN IF vIsDepartment THEN
SELECT COUNT(*) INTO vIsAuthorized SELECT COUNT(*) INTO vIsAuthorized
@ -56147,9 +56230,7 @@ BEGIN
DECLARE vEntryFk INTEGER; DECLARE vEntryFk INTEGER;
DECLARE vCur CURSOR FOR DECLARE vCur CURSOR FOR
SELECT e.id FROM vn.entry e SELECT id FROM tmp.recalcEntryCommision;
JOIN vn.travel t ON t.id = e.travelFk
WHERE t.shipped >= '2021-10-08' AND t.warehouseInFk= 60;
DECLARE CONTINUE HANDLER FOR NOT FOUND DECLARE CONTINUE HANDLER FOR NOT FOUND
SET v_done = TRUE; SET v_done = TRUE;
@ -62140,6 +62221,67 @@ BEGIN
DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.item;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemSale_byWeek` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT)
BEGIN
DECLARE datSTART DATE;
DECLARE datEND DATETIME;
SELECT MIN(dated), TIMESTAMP(MAX(dated),'23:59:59') INTO datSTART, datEND
FROM vn.`time` t
WHERE t.`week` = vWeek
AND t.`year` = vYear;
SELECT
t.shipped,
w.name warehouse,
s.ticketFk,
c.quality,
t.nickname AS client,
am.name AS agencyName,
wk.code AS salesPerson,
s.itemFk,
IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept,
s.quantity,
s.price,
s.priceFixed,
s.discount,
tls.name stateName,
sb.buyFk,
s.id saleFk,
wk.id salesPersonFk
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.warehouse w ON w.id = t.warehouseFk
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
JOIN vn.client c ON c.id = a.clientFk
JOIN vn.worker wk ON wk.id = c.salesPersonFk
LEFT JOIN vn.ticketLastState tls ON tls.ticketFk = t.id
LEFT JOIN vn.saleBuy sb ON sb.saleFk = s.id
LEFT JOIN vn.buy b ON b.id = sb.buyFk
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
WHERE s.itemFk = vItemFk
AND t.shipped BETWEEN datSTART and datEND
AND IF(vWarehouseFk = 0, w.hasComission , t.warehouseFk= vWarehouseFk)
ORDER BY t.shipped, t.id;
END ;; END ;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -64353,7 +64495,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemTagReplace` */; /*!50003 DROP PROCEDURE IF EXISTS `itemTagReplace__` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
@ -64363,10 +64505,12 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `itemTagReplace`(fromItemFk INT, toItemFk INT) CREATE DEFINER=`root`@`%` PROCEDURE `itemTagReplace__`(fromItemFk INT, toItemFk INT)
BEGIN BEGIN
/*
* deprecated use itemTag_replace
*/
DELETE FROM itemTag DELETE FROM itemTag
WHERE itemFk = toItemFk; WHERE itemFk = toItemFk;
@ -64375,6 +64519,54 @@ BEGIN
FROM itemTag FROM itemTag
WHERE itemFk = fromItemFk; WHERE itemFk = fromItemFk;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `itemTag_replace` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100))
BEGIN
/* Reemplaza los tags de un artículo por los de otro, así como su imagen
*
* @param vItemFromFk id de vn.item con el artículo del que se toman los tags
* @param vItemToFk id de vn.item con el artículo del que se toman los tags
* @param vPicture imagen del artículo. Opcional. Si no se especifica, hereada la del vItemFromFk
*/
DELETE FROM vn.itemTag
WHERE itemFk = vItemToFk;
INSERT INTO vn.itemTag(itemFk, tagFk, value, priority)
SELECT vItemToFk, tagFk, value, priority
FROM vn.itemTag
WHERE itemFk = vItemFromFk;
IF ISNULL(vPicture) THEN
SELECT image INTO vPicture
FROM vn.item
WHERE id = vItemFromFk;
END IF;
UPDATE vn.item i
SET i.image = vPicture
WHERE i.id = vItemToFk;
CALL vn.itemRefreshTags(vItemToFk);
END ;; END ;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -65072,7 +65264,7 @@ BEGIN
LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id
LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value`
LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id
LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` AND ta2.`value` != 'Rosa'
LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id
LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value`
SET i.`name` = CONCAT_WS(' ', SET i.`name` = CONCAT_WS(' ',
@ -65563,13 +65755,17 @@ BEGIN
SELECT ga.itemFk INTO vGenericFk SELECT ga.itemFk INTO vGenericFk
FROM vn.genericAllocation ga FROM vn.genericAllocation ga
JOIN vn.item i ON i.typeFk = ga.typeFk OR ISNULL(ga.typeFk) JOIN vn.item i ON (i.typeFk = ga.typeFk OR ISNULL(ga.typeFk))
JOIN vn.itemTag it1 ON it1.itemFk = i.id AND (it1.value = ga.origin OR ISNULL(ga.origin)) JOIN vn.itemTag it1 ON it1.itemFk = i.id AND (it1.value = ga.origin OR ISNULL(ga.origin))
JOIN vn.itemTag it2 ON it2.itemFk = i.id AND (it2.value = ga.color OR ISNULL(ga.color)) JOIN vn.itemTag it2 ON it2.itemFk = i.id AND (it2.value = ga.color OR ISNULL(ga.color))
JOIN vn.itemTag it3 ON it3.itemFk = i.id AND (it3.value = ga.quality OR ISNULL(ga.quality)) JOIN vn.itemTag it3 ON it3.itemFk = i.id AND (it3.value = ga.quality OR ISNULL(ga.quality))
JOIN vn.itemTag it4 ON it4.itemFk = i.id AND (it4.value = ga.numFlores OR ISNULL(ga.numFlores)) JOIN vn.itemTag it4 ON it4.itemFk = i.id AND (it4.value = ga.numFlores OR ISNULL(ga.numFlores))
JOIN vn.itemTag it5 ON it5.itemFk = i.id AND (it5.value = ga.category OR ISNULL(ga.category))
JOIN vn.itemTag it6 ON it6.itemFk = i.id AND (it6.value = ga.productor OR ISNULL(ga.productor))
WHERE i.id = vSelf WHERE i.id = vSelf
AND NOT i.isFloramondo; AND ga.itemFk != vSelf
AND NOT i.isFloramondo
LIMIT 1;
UPDATE vn.item UPDATE vn.item
SET genericFk = vGenericFk SET genericFk = vGenericFk
@ -70469,16 +70665,21 @@ DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT) CREATE DEFINER=`root`@`%` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT)
BEGIN BEGIN
DECLARE isFood BOOLEAN; /* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad
*
IF (SELECT COUNT(*) * @param vSaleFk clave primaria de vn.sale
* @param vBuyFk clave primaria de vn.buy
*/
/*IF (SELECT COUNT(*)
FROM vn.sale s FROM vn.sale s
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk
WHERE s.id = vSaleFk WHERE s.id = vSaleFk
AND ic.code = 'fruit') THEN AND ic.code = 'fruit') THEN */
IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN
INSERT INTO vn.saleBuy (saleFk, buyFk) INSERT INTO vn.saleBuy (saleFk, buyFk)
VALUES(vSaleFk, vBuyFk); VALUES(vSaleFk, vBuyFk);
@ -72322,6 +72523,36 @@ BEGIN
SELECT * FROM tmp.result SELECT * FROM tmp.result
ORDER BY created, visible; ORDER BY created, visible;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `shelvingLog_get` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `shelvingLog_get`(shelvingFk VARCHAR(10))
BEGIN
/* Lista el log de un carro
*
* @param shelvingFk matrícula del carro
*
*/
SELECT originFk, name, creationDate, description
FROM shelvingLog sl
JOIN user u ON u.id = sl.userFk
WHERE sl.originFk = shelvingFk COLLATE utf8_general_ci;
END ;; END ;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -72382,6 +72613,12 @@ proc: BEGIN
ELSE ELSE
INSERT INTO vn.shelvingLog (originFk, userFk, action , description)
SELECT vShelvingFk, getUser(), 'update', CONCAT("Cambio parking ",vShelvingFk," de ", p.code," a ", vParkingCode)
FROM parking p
JOIN shelving s ON s.parkingFk = p.id
WHERE s.code = vShelvingFk COLLATE utf8_unicode_ci;
UPDATE vn.shelving UPDATE vn.shelving
SET parkingFk = vParkingFk, parked = NOW(), isPrinted = 1 SET parkingFk = vParkingFk, parked = NOW(), isPrinted = 1
WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci;
@ -74541,7 +74778,7 @@ BEGIN
AND sc.componentFk = tc.componentFk AND sc.componentFk = tc.componentFk
LEFT JOIN `component` c ON c.id = tc.componentFk LEFT JOIN `component` c ON c.id = tc.componentFk
WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
/*
-- Añadir componente venta por paquete -- Añadir componente venta por paquete
DROP TEMPORARY TABLE IF EXISTS tmp.sale2; DROP TEMPORARY TABLE IF EXISTS tmp.sale2;
CREATE TEMPORARY TABLE tmp.sale2 CREATE TEMPORARY TABLE tmp.sale2
@ -74576,7 +74813,7 @@ BEGIN
DROP TEMPORARY TABLE IF EXISTS DROP TEMPORARY TABLE IF EXISTS
tmp.sale2, tmp.sale2,
tmp.ticketComponent2;*/ tmp.ticketComponent2;
END IF; END IF;
IF vKeepPrices THEN IF vKeepPrices THEN
@ -76133,6 +76370,45 @@ BEGIN
END IF; END IF;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `ticketStateToday_setOnPreviousChecking` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `ticketStateToday_setOnPreviousChecking`(vParamFk INT)
BEGIN
/*
* Cambia el estado del ticket al estado de "control previa"
*
* @param vParamFk ticket a cambiar el estado
*
*/
DECLARE vAlertLevel INT;
SELECT s.alertLevel INTO vAlertLevel
FROM state s
JOIN ticketStateToday tst ON tst.state = s.id
WHERE tst.ticket = vParamFk
LIMIT 1;
IF vAlertLevel < 2 THEN
CALL ticketStateUpdate(vParamFk, 'PREVIOUS_CONTROL');
END IF;
END ;; END ;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -77131,9 +77407,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
@ -82229,7 +82505,7 @@ DELIMITER ;
/*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlNonDays` */; /*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlNonDays__` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
@ -82239,7 +82515,7 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `workerTimeControlNonDays`() CREATE DEFINER=`root`@`%` PROCEDURE `workerTimeControlNonDays__`()
BEGIN BEGIN
SET @cont := 0; SET @cont := 0;
SELECT sub2.userFk, sub2.dated Fecha, CONCAT (w.firstName," ", w.lastName) worker, au.name Boss, d.name SELECT sub2.userFk, sub2.dated Fecha, CONCAT (w.firstName," ", w.lastName) worker, au.name Boss, d.name
@ -84080,7 +84356,7 @@ BEGIN
GROUP BY tm.userFk,t.dated GROUP BY tm.userFk,t.dated
ORDER BY tm.userFk,t.dated; ORDER BY tm.userFk,t.dated;
-- INSERT INTO vn.mail (receiver, replyTo, subject, body) INSERT INTO vn.mail (receiver, replyTo, subject, body)
SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', WEEK(CURDATE())-1, ' año ', YEAR(CURDATE())) , SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', WEEK(CURDATE())-1, ' año ', YEAR(CURDATE())) ,
CONCAT(' CONCAT('
<!DOCTYPE html> <!DOCTYPE html>
@ -87525,9 +87801,9 @@ DELIMITER ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8mb4_general_ci */ ; /*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;; DELIMITER ;;
@ -87536,11 +87812,31 @@ DELIMITER ;;
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
DECLARE vNumTicketsPrepared INT;
REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name)
SELECT NEW.Id_Ticket, NEW.inter_id, `name` SELECT NEW.Id_Ticket, NEW.inter_id, `name`
FROM vn.state FROM vn.state
WHERE id = NEW.state_id; WHERE id = NEW.state_id;
/*
SELECT count(*) INTO vNumTicketsPrepared
FROM vn.ticketCollection tc2
JOIN vn.ticketState ts2 ON ts2.ticketFk = tc2.ticketFk
WHERE tc2.collectionFk IN
(SELECT tc.collectionFk
FROM vn.ticketCollection tc
WHERE tc.ticketFk IN
(SELECT ts.ticketFk
FROM vn.ticketState ts
WHERE code = 'ON_PREPARATION'
)
AND tc.collectionFk IN (SELECT collectionFk FROM vn.ticketCollection WHERE ticketFk = NEW.Id_Ticket));
IF vNumTicketsPrepared = 0 THEN
UPDATE vn.collection SET stateFk = (SELECT id FROM vn.state WHERE code = 'ON_CHECKING')
WHERE id = (SELECT tc.collectionFk FROM vn.ticketCollection tc WHERE tc.ticketFk = NEW.Id_Ticket);
END IF;
*/
END */;; END */;;
DELIMITER ; DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET sql_mode = @saved_sql_mode */ ;
@ -91030,7 +91326,7 @@ USE `vn`;
/*!50001 SET collation_connection = utf8_general_ci */; /*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */ /*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,`b`.`itemFk` AS `itemFk` 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 `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; /*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,ifnull(`b`.`itemOriginalFk`,`b`.`itemFk`) AS `itemFk` 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 `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */;
/*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 SET collation_connection = @saved_col_connection */;
@ -91430,4 +91726,4 @@ USE `vncontrol`;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-11-23 14:44:10 -- Dump completed on 2021-12-01 7:52:52

View File

@ -182,6 +182,8 @@ module.exports = Self => {
return {'a.provinceFk': value}; return {'a.provinceFk': value};
case 'stateFk': case 'stateFk':
return {'ts.stateFk': value}; return {'ts.stateFk': value};
case 'collectionFk':
return {'cll.id': value};
case 'mine': case 'mine':
case 'myTeam': case 'myTeam':
if (value) if (value)
@ -286,9 +288,8 @@ module.exports = Self => {
if (args.collectionFk) { if (args.collectionFk) {
stmt.merge({ stmt.merge({
sql: ` sql: `
JOIN collection cll ON cll.id = ? JOIN collection cll
JOIN ticketCollection tc ON tc.collectionFk = cll.id AND tc.ticketFk = t.id`, JOIN ticketCollection tc ON tc.collectionFk = cll.id AND tc.ticketFk = t.id`
params: [args.collectionFk]
}); });
} }

View File

@ -8,6 +8,7 @@ export default class Ticket extends ModuleMain {
'to', 'to',
'search', 'search',
'clientFk', 'clientFk',
'collectionFk',
'orderFk', 'orderFk',
'refFk', 'refFk',
'scopeDays' 'scopeDays'