done #2432

Merged
pako merged 5 commits from 7362-VIP into dev 2024-05-14 10:52:12 +00:00
2 changed files with 12 additions and 1 deletions

View File

@ -44,6 +44,7 @@ BEGIN
hasComponentLack INTEGER(1), hasComponentLack INTEGER(1),
hasRounding VARCHAR(255), hasRounding VARCHAR(255),
isTooLittle BOOL DEFAULT FALSE, isTooLittle BOOL DEFAULT FALSE,
isVip BOOL DEFAULT FALSE,

en camelcase és isVip

en camelcase és isVip
PRIMARY KEY (ticketFk, saleFk) PRIMARY KEY (ticketFk, saleFk)
) ENGINE = MEMORY; ) ENGINE = MEMORY;
@ -79,6 +80,14 @@ BEGIN
JOIN volumeConfig vc JOIN volumeConfig vc
WHERE sub.litros < vc.minTicketVolume WHERE sub.litros < vc.minTicketVolume
AND sub.totalWithoutVat < vc.minTicketValue; 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 -- Faltan componentes
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk) INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)

View File

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