7161DeleteitemTrash #2273
|
@ -13,6 +13,7 @@ BEGIN
|
||||||
* @param vQuantity a dar de alta/baja
|
* @param vQuantity a dar de alta/baja
|
||||||
* @param vAddressFk id address
|
* @param vAddressFk id address
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DECLARE vTicketFk INT;
|
DECLARE vTicketFk INT;
|
||||||
DECLARE vClientFk INT;
|
DECLARE vClientFk INT;
|
||||||
DECLARE vDefaultCompanyFk INT;
|
DECLARE vDefaultCompanyFk INT;
|
||||||
|
@ -23,17 +24,17 @@ BEGIN
|
||||||
|
|
||||||
SELECT DEFAULT(companyFk) INTO vDefaultCompanyFk
|
SELECT DEFAULT(companyFk) INTO vDefaultCompanyFk
|
||||||
FROM vn.ticket LIMIT 1;
|
FROM vn.ticket LIMIT 1;
|
||||||
|
|
||||||
IF vAddressFk IS NULL THEN
|
IF vAddressFk IS NULL THEN
|
||||||
SELECT pc.shortageAddressFk INTO vAddressShortage
|
SELECT pc.shortageAddressFk INTO vAddressShortage
|
||||||
FROM productionConfig pc ;
|
FROM productionConfig pc ;
|
||||||
ELSE
|
ELSE
|
||||||
SET vAddressShortage = vAddressFk;
|
SET vAddressShortage = vAddressFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT a.clientFk INTO vClientFk
|
SELECT a.clientFk INTO vClientFk
|
||||||
FROM address a
|
FROM address a
|
||||||
WHERE a.id = vAddressFk;
|
WHERE a.id = vAddressShortage;
|
||||||
|
|
||||||
SELECT t.id INTO vTicketFk
|
SELECT t.id INTO vTicketFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
|
@ -65,7 +66,7 @@ BEGIN
|
||||||
INSERT INTO sale(ticketFk, itemFk, concept, quantity)
|
INSERT INTO sale(ticketFk, itemFk, concept, quantity)
|
||||||
SELECT vTicketFk,
|
SELECT vTicketFk,
|
||||||
vItemFk,
|
vItemFk,
|
||||||
CONCAT(longName,' ', worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)),
|
name,
|
||||||
vQuantity
|
vQuantity
|
||||||
FROM item
|
FROM item
|
||||||
WHERE id = vItemFk;
|
WHERE id = vItemFk;
|
||||||
|
|
Loading…
Reference in New Issue