feat: refs #7774 #7774 Changes ticket_cloneWeekly
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
c4e8202261
commit
3cf2cec946
|
@ -4,7 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`
|
||||||
vDateTo DATE
|
vDateTo DATE
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vIsDone BOOL;
|
|
||||||
DECLARE vLanding DATE;
|
DECLARE vLanding DATE;
|
||||||
DECLARE vShipment DATE;
|
DECLARE vShipment DATE;
|
||||||
DECLARE vWarehouseFk INT;
|
DECLARE vWarehouseFk INT;
|
||||||
|
@ -15,12 +14,15 @@ BEGIN
|
||||||
DECLARE vAgencyModeFk INT;
|
DECLARE vAgencyModeFk INT;
|
||||||
DECLARE vNewTicket INT;
|
DECLARE vNewTicket INT;
|
||||||
DECLARE vYear INT;
|
DECLARE vYear INT;
|
||||||
DECLARE vSalesPersonFK INT;
|
DECLARE vObservationSalesPersonFk INT
|
||||||
DECLARE vItemPicker INT;
|
DEFAULT (SELECT id FROM observationType WHERE code = 'salesPerson');
|
||||||
DECLARE vEmail VARCHAR(150);
|
DECLARE vObservationItemPickerFk INT
|
||||||
|
DEFAULT (SELECT id FROM observationType WHERE code = 'itemPicker');
|
||||||
|
DECLARE vEmail VARCHAR(255);
|
||||||
DECLARE vIsDuplicateMail BOOL;
|
DECLARE vIsDuplicateMail BOOL;
|
||||||
DECLARE vSubject VARCHAR(150);
|
DECLARE vSubject VARCHAR(100);
|
||||||
DECLARE vMessage TEXT;
|
DECLARE vMessage TEXT;
|
||||||
|
DECLARE vDone BOOL;
|
||||||
|
|
||||||
DECLARE vTickets CURSOR FOR
|
DECLARE vTickets CURSOR FOR
|
||||||
SELECT tt.ticketFk,
|
SELECT tt.ticketFk,
|
||||||
|
@ -35,14 +37,13 @@ BEGIN
|
||||||
JOIN tmp.time ti
|
JOIN tmp.time ti
|
||||||
WHERE WEEKDAY(ti.dated) = tt.weekDay;
|
WHERE WEEKDAY(ti.dated) = tt.weekDay;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
CALL `util`.`time_generate`(vDateFrom, vDateTo);
|
CALL `util`.`time_generate`(vDateFrom, vDateTo);
|
||||||
|
|
||||||
OPEN vTickets;
|
OPEN vTickets;
|
||||||
l: LOOP
|
l: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
SET vIsDone = FALSE;
|
|
||||||
FETCH vTickets INTO
|
FETCH vTickets INTO
|
||||||
vTicketFk,
|
vTicketFk,
|
||||||
vClientFk,
|
vClientFk,
|
||||||
|
@ -52,7 +53,7 @@ BEGIN
|
||||||
vAgencyModeFk,
|
vAgencyModeFk,
|
||||||
vShipment;
|
vShipment;
|
||||||
|
|
||||||
IF vIsDone THEN
|
IF vDone THEN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
@ -106,15 +107,15 @@ BEGIN
|
||||||
priceFixed,
|
priceFixed,
|
||||||
isPriceFixed)
|
isPriceFixed)
|
||||||
SELECT vNewTicket,
|
SELECT vNewTicket,
|
||||||
saleOrig.itemFk,
|
itemFk,
|
||||||
saleOrig.concept,
|
concept,
|
||||||
saleOrig.quantity,
|
quantity,
|
||||||
saleOrig.price,
|
price,
|
||||||
saleOrig.discount,
|
discount,
|
||||||
saleOrig.priceFixed,
|
priceFixed,
|
||||||
saleOrig.isPriceFixed
|
isPriceFixed
|
||||||
FROM sale saleOrig
|
FROM sale
|
||||||
WHERE saleOrig.ticketFk = vTicketFk;
|
WHERE ticketFk = vTicketFk;
|
||||||
|
|
||||||
INSERT IGNORE INTO saleCloned(saleOriginalFk, saleClonedFk)
|
INSERT IGNORE INTO saleCloned(saleOriginalFk, saleClonedFk)
|
||||||
SELECT saleOriginal.id, saleClon.id
|
SELECT saleOriginal.id, saleClon.id
|
||||||
|
@ -151,15 +152,7 @@ BEGIN
|
||||||
attenderFk,
|
attenderFk,
|
||||||
vNewTicket
|
vNewTicket
|
||||||
FROM ticketRequest
|
FROM ticketRequest
|
||||||
WHERE ticketFk =vTicketFk;
|
WHERE ticketFk = vTicketFk;
|
||||||
|
|
||||||
SELECT id INTO vSalesPersonFK
|
|
||||||
FROM observationType
|
|
||||||
WHERE code = 'salesPerson';
|
|
||||||
|
|
||||||
SELECT id INTO vItemPicker
|
|
||||||
FROM observationType
|
|
||||||
WHERE code = 'itemPicker';
|
|
||||||
|
|
||||||
INSERT INTO ticketObservation(
|
INSERT INTO ticketObservation(
|
||||||
ticketFk,
|
ticketFk,
|
||||||
|
@ -167,7 +160,7 @@ BEGIN
|
||||||
description)
|
description)
|
||||||
VALUES(
|
VALUES(
|
||||||
vNewTicket,
|
vNewTicket,
|
||||||
vSalesPersonFK,
|
vObservationSalesPersonFk,
|
||||||
CONCAT('turno desde ticket: ',vTicketFk))
|
CONCAT('turno desde ticket: ',vTicketFk))
|
||||||
ON DUPLICATE KEY UPDATE description =
|
ON DUPLICATE KEY UPDATE description =
|
||||||
CONCAT(ticketObservation.description,VALUES(description),' ');
|
CONCAT(ticketObservation.description,VALUES(description),' ');
|
||||||
|
@ -177,13 +170,12 @@ BEGIN
|
||||||
description)
|
description)
|
||||||
VALUES(
|
VALUES(
|
||||||
vNewTicket,
|
vNewTicket,
|
||||||
vItemPicker,
|
vObservationItemPickerFk,
|
||||||
'ATENCION: Contiene lineas de TURNO')
|
'ATENCION: Contiene lineas de TURNO')
|
||||||
ON DUPLICATE KEY UPDATE description =
|
ON DUPLICATE KEY UPDATE description =
|
||||||
CONCAT(ticketObservation.description,VALUES(description),' ');
|
CONCAT(ticketObservation.description,VALUES(description),' ');
|
||||||
|
|
||||||
IF vLanding IS NULL THEN
|
IF vLanding IS NULL THEN
|
||||||
|
|
||||||
SELECT IFNULL(d.notificationEmail, e.email) INTO vEmail
|
SELECT IFNULL(d.notificationEmail, e.email) INTO vEmail
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN worker w ON w.id = c.salesPersonFk
|
JOIN worker w ON w.id = c.salesPersonFk
|
||||||
|
|
Loading…
Reference in New Issue