done
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Pako Natek 2024-05-09 11:52:25 +02:00
parent abd692cbd3
commit 42d17aa7f5
2 changed files with 12 additions and 1 deletions

View File

@ -44,6 +44,7 @@ BEGIN
hasComponentLack INTEGER(1),
hasRounding VARCHAR(255),
isTooLittle BOOL DEFAULT FALSE,
isVIP BOOL DEFAULT FALSE,
PRIMARY KEY (ticketFk, saleFk)
) ENGINE = MEMORY;
@ -80,6 +81,14 @@ BEGIN
WHERE sub.litros < vc.minTicketVolume
AND sub.totalWithoutVat < vc.minTicketValue;
-- VIP
INSERT INTO tmp.sale_problems(ticketFk, isVIP)
SELECT DISTINCT tl.ticketFk, TRUE
FROM tmp.ticket_list tl
JOIN client c ON c.id = tl.clientFk
WHERE c.businessTypeFk = 'VIP'
ON DUPLICATE KEY UPDATE isVIP = TRUE;
-- Faltan componentes
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)
SELECT ticketFk, (vComponentCount > nComp) hasComponentLack, saleFk

View File

@ -25,6 +25,7 @@ BEGIN
MAX(itemDelay) itemDelay,
MAX(hasRounding) hasRounding,
MAX(itemLost) itemLost,
MAX(isVIP) isVIP,
0 totalProblems
FROM tmp.sale_problems
GROUP BY ticketFk;
@ -40,7 +41,8 @@ BEGIN
(tp.isTooLittle) +
(tp.itemLost) +
(tp.hasRounding) +
(tp.itemShortage)
(tp.itemShortage) +
(tp.isVIP)
);
DROP TEMPORARY TABLE tmp.sale_problems;