From bdc202b14521a6230b14d51e4aa901d0698fb110 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 12:36:08 +0200 Subject: [PATCH] feat: refs #4948 Minor change --- .../ticket_doSelfConsumptionPackaging.sql | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/db/routines/vn/procedures/ticket_doSelfConsumptionPackaging.sql b/db/routines/vn/procedures/ticket_doSelfConsumptionPackaging.sql index 0866118f3..4f2dc1401 100644 --- a/db/routines/vn/procedures/ticket_doSelfConsumptionPackaging.sql +++ b/db/routines/vn/procedures/ticket_doSelfConsumptionPackaging.sql @@ -15,16 +15,13 @@ BEGIN DECLARE vTicketFk INT; DECLARE vWarehouseFk INT; - SELECT clientSelfConsumptionFk, addressSelfConsumptionFk - INTO vClientFk, vAddressFk - FROM productionConfig; - - SELECT id INTO vWarehouseFk - FROM warehouse - WHERE code = 'alg'; + SELECT pc.clientSelfConsumptionFk, pc.addressSelfConsumptionFk, w.id + INTO vClientFk, vAddressFk, vWarehouseFk + FROM productionConfig pc + JOIN warehouse w ON w.code = 'alg'; INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk) - SELECT vClientFk, vWarehouseFk, vDateFrom, 'AUTOCONSUMO CAJAS', vAddressFk; + SELECT vClientFk, vWarehouseFk, vDateFrom, 'CAJAS AUTOCONSUMO', vAddressFk; SET vTicketFk = LAST_INSERT_ID();