7167-testToMaster_2414 #2244
|
@ -26,7 +26,7 @@ BEGIN
|
||||||
DECLARE vParkingCode VARCHAR(10);
|
DECLARE vParkingCode VARCHAR(10);
|
||||||
DECLARE vQuantity INT;
|
DECLARE vQuantity INT;
|
||||||
DECLARE vRemainder INT DEFAULT 0;
|
DECLARE vRemainder INT DEFAULT 0;
|
||||||
DECLARE vRestSaleFk INT;
|
DECLARE vRemainderSaleFk INT;
|
||||||
DECLARE vShelving VARCHAR(10);
|
DECLARE vShelving VARCHAR(10);
|
||||||
DECLARE vTicketFk INT;
|
DECLARE vTicketFk INT;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ BEGIN
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
s.concept
|
s.concept
|
||||||
INTO vQuantity,
|
INTO vQuantity,
|
||||||
vRest,
|
vRemainder,
|
||||||
vTicketFk,
|
vTicketFk,
|
||||||
vItemFk,
|
vItemFk,
|
||||||
vConcept
|
vConcept
|
||||||
|
@ -47,14 +47,14 @@ BEGIN
|
||||||
UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk;
|
UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk;
|
||||||
|
|
||||||
INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept)
|
INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept)
|
||||||
SELECT ticketFk, itemFk, vRest, price, discount, concept
|
SELECT ticketFk, itemFk, vRemainder, price, discount, concept
|
||||||
FROM sale
|
FROM sale
|
||||||
WHERE id = vSaleFk;
|
WHERE id = vSaleFk;
|
||||||
|
|
||||||
SET vRestSaleFk = LAST_INSERT_ID();
|
SET vRemainderSaleFk = LAST_INSERT_ID();
|
||||||
|
|
||||||
INSERT INTO saleComponent(saleFk, componentFk, value)
|
INSERT INTO saleComponent(saleFk, componentFk, value)
|
||||||
SELECT vRestSaleFk, componentFk, value
|
SELECT vRemainderSaleFk, componentFk, value
|
||||||
FROM saleComponent
|
FROM saleComponent
|
||||||
WHERE saleFk = vSaleFk;
|
WHERE saleFk = vSaleFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
Loading…
Reference in New Issue