2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_printLabelPrevious`(vTicketFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Calls the report_print procedure and passes it
|
|
|
|
* the necessary parameters for printing.
|
|
|
|
*
|
|
|
|
* @param vTicketFk id ticket to print.
|
|
|
|
*/
|
|
|
|
DECLARE vPrinterFk INT;
|
|
|
|
DECLARE vSaleGroup INT;
|
|
|
|
DECLARE vUserFk INT DEFAULT account.myUser_getId();
|
|
|
|
|
|
|
|
SELECT sg.id, o.labelerFk INTO vSaleGroup, vPrinterFk
|
|
|
|
FROM saleGroup sg
|
|
|
|
JOIN sector sc ON sc.id = sg.sectorFk
|
|
|
|
JOIN saleGroupDetail sgd ON sg.id = sgd.saleGroupFk
|
|
|
|
JOIN sale s ON sgd.saleFk = s.id
|
|
|
|
JOIN ticket t ON s.ticketFk = t.id
|
|
|
|
JOIN operator o ON o.workerFk = vUserFk
|
|
|
|
WHERE sc.id = o.sectorFk
|
|
|
|
AND t.id = vTicketFk
|
|
|
|
LIMIT 1;
|
|
|
|
|
|
|
|
CALL report_print(
|
|
|
|
'LabelPrevia',
|
|
|
|
vPrinterFk,
|
|
|
|
vUserFk,
|
|
|
|
JSON_OBJECT('id', vSaleGroup, 'userFk', vUserFk),
|
|
|
|
'high'
|
|
|
|
);
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|