Merge pull request 'refs #7161 feat:setVisibleDiscard by itemTrash' (!2424) from 7161-deleteItemTrash into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2424 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
b060048d5d
|
@ -1,56 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemTrash`(
|
|
||||||
vItemFk INT,
|
|
||||||
vWarehouseFk INT,
|
|
||||||
vQuantity INT,
|
|
||||||
vIsTrash BOOLEAN)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vTicketFk INT;
|
|
||||||
DECLARE vClientFk INT;
|
|
||||||
DECLARE vCompanyVnlFk INT DEFAULT 442;
|
|
||||||
DECLARE vCalc INT;
|
|
||||||
|
|
||||||
SELECT barcodeToItem(vItemFk) INTO vItemFk;
|
|
||||||
|
|
||||||
SELECT IF(vIsTrash, 200, 400) INTO vClientFk;
|
|
||||||
|
|
||||||
SELECT t.id INTO vTicketFk
|
|
||||||
FROM ticket t
|
|
||||||
JOIN address a ON a.id=t.addressFk
|
|
||||||
WHERE t.warehouseFk = vWarehouseFk
|
|
||||||
AND t.clientFk = vClientFk
|
|
||||||
AND DATE(t.shipped) = util.VN_CURDATE()
|
|
||||||
AND a.isDefaultAddress
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk);
|
|
||||||
|
|
||||||
IF vTicketFk IS NULL THEN
|
|
||||||
CALL ticket_add(
|
|
||||||
vClientFk,
|
|
||||||
util.VN_CURDATE(),
|
|
||||||
vWarehouseFk,
|
|
||||||
vCompanyVnlFk,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
util.VN_CURDATE(),
|
|
||||||
account.myUser_getId(),
|
|
||||||
FALSE,
|
|
||||||
vTicketFk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO sale(ticketFk, itemFk, concept, quantity)
|
|
||||||
SELECT vTicketFk,
|
|
||||||
vItemFk,
|
|
||||||
CONCAT(longName,' ',worker_getCode(), ' ', LEFT(CAST(util.VN_NOW() AS TIME),5)),
|
|
||||||
vQuantity
|
|
||||||
FROM item
|
|
||||||
WHERE id = vItemFk;
|
|
||||||
|
|
||||||
UPDATE cache.visible
|
|
||||||
SET visible = visible - vQuantity
|
|
||||||
WHERE calc_id = vCalc
|
|
||||||
AND item_id = vItemFk;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
Loading…
Reference in New Issue