Merge branch 'master' into hotfix-postCodeACLS
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Javier Segarra 2024-09-20 11:51:11 +00:00
commit 6f78a7470c
1 changed files with 12 additions and 8 deletions

View File

@ -14,13 +14,17 @@ BEGIN
DECLARE vTicketFk INT;
DECLARE vParkingFk INT;
DECLARE vSectorFk INT;
DECLARE vPreviousLines INT;
DECLARE vTicketLines INT;
SELECT s.ticketFk, COUNT(*)
INTO vTicketFk, vPreviousLines
FROM saleGroupDetail sgd
JOIN sale s ON s.id = sgd.saleFk
WHERE sgd.saleGroupFk = vSaleGroupFk;
WITH ticketData AS(
SELECT s.ticketFk
FROM vn.saleGroupDetail sgd
JOIN vn.sale s ON s.id = sgd.saleFk
WHERE sgd.saleGroupFk = vSaleGroupFk
)
SELECT COUNT(*), s.ticketFk INTO vTicketLines, vTicketFk
FROM vn.sale s
JOIN ticketData td ON td.ticketFk = s.ticketFk;
SELECT sg.parkingFk, sc.sectorFk
INTO vParkingFk, vSectorFk
@ -40,11 +44,11 @@ BEGIN
SELECT sgd.saleGroupFk,
t.id ticketFk,
vPreviousLines previousLines,
COUNT(*) previousLines,
IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour,
IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute ,
IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk ,
COUNT(*) ticketLines,
vTicketLines ticketLines,
p.code `location`,
sc.description sector
FROM sale s