Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2024-02-13 16:21:02 +01:00
commit a5d1597884
4 changed files with 11 additions and 13 deletions

View File

@ -23,7 +23,8 @@ BEGIN
SUM(IFNULL(sub.amount,0)) lack, SUM(IFNULL(sub.amount,0)) lack,
i.inkFk, i.inkFk,
IFNULL(im.timed, util.midnight()) timed, IFNULL(im.timed, util.midnight()) timed,
IFNULL(izc.timed, util.midnight()) minTimed IFNULL(izc.timed, util.midnight()) minTimed,
o.name originFk
FROM (SELECT item_id, FROM (SELECT item_id,
warehouse_id, warehouse_id,
amount amount
@ -42,6 +43,7 @@ BEGIN
JOIN itemCategory ic ON ic.id = it.categoryFk JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
JOIN origin o ON o.id = i.originFk
WHERE w.isForTicket WHERE w.isForTicket
AND ic.display AND ic.display
AND it.code != 'GEN' AND it.code != 'GEN'

View File

@ -8,16 +8,10 @@ BEGIN
END; END;
START TRANSACTION; START TRANSACTION;
INSERT INTO vn.clientCredit(clientFk, amount)
SELECT c.id, 0
FROM vn.`client` c
JOIN vn.payMethod pm ON pm.id = c.payMethodFk
WHERE c.credit <> 0 AND pm.`code` = 'card';
UPDATE vn.`client` c UPDATE vn.`client` c
JOIN vn.payMethod pm ON pm.id = c.payMethodFk JOIN vn.payMethod pm ON pm.id = c.payMethodFk
SET credit = 0 SET credit = 0
WHERE pm.`code` = 'card'; WHERE pm.`code` = 'card';
DROP TEMPORARY TABLE IF EXISTS clientes_credit; DROP TEMPORARY TABLE IF EXISTS clientes_credit;
CREATE TEMPORARY TABLE clientes_credit CREATE TEMPORARY TABLE clientes_credit
@ -44,10 +38,6 @@ BEGIN
UPDATE Clientes UPDATE Clientes
JOIN clientes_credit USING(Id_Cliente) JOIN clientes_credit USING(Id_Cliente)
SET Clientes.Credito = newCredit; SET Clientes.Credito = newCredit;
INSERT INTO credit(Id_Cliente, amount, Id_Trabajador)
SELECT Id_Cliente, newCredit, NULL
FROM clientes_credit;
DROP TEMPORARY TABLE clientes_credit; DROP TEMPORARY TABLE clientes_credit;
COMMIT; COMMIT;

View File

@ -1 +1,6 @@
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`credit`AS
SELECT 1;
GRANT SELECT ON TABLE vn2008.credit TO financialBoss; GRANT SELECT ON TABLE vn2008.credit TO financialBoss;

View File

@ -0,0 +1 @@
DROP TABLE vn.timeControlDevice;