fix: refs#8011 previousSticker_get
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-09-20 13:50:08 +02:00
parent 7dce536f43
commit 190c964ec2
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