Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6861-Pasar-modo-trabajo-de-previa-a-reservas
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-05-07 07:21:59 +02:00
commit 7368561bad
5 changed files with 27 additions and 18 deletions

View File

@ -131,7 +131,8 @@ BEGIN
DELETE e
FROM entry e
JOIN tEntryToDelete tmp ON tmp.id = e.id;
JOIN tEntryToDelete tmp ON tmp.id = e.id
WHERE NOT e.isBooked;
-- borrar de route registros menores a 4 años
CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete

View File

@ -52,6 +52,10 @@ BEGIN
SELECT LAST_INSERT_ID() INTO vSaleFk;
UPDATE sale
SET originalQuantity = 0
WHERE id = vSaleFk;
CALL sale_calculateComponent(vSaleFk, NULL);
END$$
DELIMITER ;

View File

@ -21,7 +21,7 @@ BEGIN
SELECT id
FROM warehouse
WHERE isInventory;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
@ -38,18 +38,18 @@ BEGIN
INTO vMaxRecentInventories,
vWarehouseOutFkInventory,
vAgencyModeFkInventory
FROM inventoryConfig
FROM inventoryConfig
LIMIT 1;
IF vDateLastInventory IS NULL
IF vDateLastInventory IS NULL
OR vInventorySupplierFk IS NULL
OR vMaxRecentInventories IS NULL
OR vInventoryDate IS NULL
OR vMaxRecentInventories IS NULL
OR vInventoryDate IS NULL
OR vWarehouseOutFkInventory IS NULL
OR vAgencyModeFkInventory IS NULL THEN
CALL util.throw('Some config parameters are not set');
END IF;
START TRANSACTION;
OPEN cWarehouses;
@ -77,7 +77,7 @@ BEGIN
LIMIT 1;
IF vTravelFk IS NULL THEN
INSERT INTO travel
INSERT INTO travel
SET warehouseOutFk = vWarehouseOutFkInventory,
warehouseInFk = vWarehouseFk,
shipped = vInventoryDate,
@ -94,15 +94,16 @@ BEGIN
SELECT id INTO vEntryFk
FROM entry
WHERE supplierFk = vInventorySupplierFk
AND travelFk = vTravelFk;
AND travelFk = vTravelFk
AND typeFk = 'inventory';
IF vEntryFk IS NULL THEN
INSERT INTO entry
INSERT INTO entry
SET supplierFk = vInventorySupplierFk,
isConfirmed = TRUE,
isOrdered = TRUE,
travelFk = vTravelFk;
travelFk = vTravelFk,
typeFk = 'inventory';
SELECT LAST_INSERT_ID() INTO vEntryFk;
ELSE
DELETE FROM buy WHERE entryFk = vEntryFk;
@ -224,15 +225,15 @@ BEGIN
JOIN tInventory i2 ON i2.itemFk = i.id
SET i.lastUsed = NOW()
WHERE i2.quantity;
DROP TEMPORARY TABLE tInventory;
END LOOP;
CLOSE cWarehouses;
UPDATE config SET inventoried = vInventoryDate;
CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
(INDEX(entryId)) ENGINE = MEMORY
SELECT e.id entryId,
@ -252,7 +253,7 @@ BEGIN
WHERE e.supplierFk = vInventorySupplierFk
AND t.shipped IN (sub.shipped);
DELETE e
DELETE e
FROM `entry` e
JOIN tEntryToDelete tmp ON tmp.entryId = e.id;

View File

@ -26,7 +26,7 @@ BEGIN
FROM workerTimeControl
WHERE userFk = vWorkerFk
AND direction = 'middle'
AND timed BETWEEN vLastIn AND util.VN_NOW();
AND timed BETWEEN vLastIn AND vTimed;
DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection;
CREATE TEMPORARY TABLE tmp.workerTimeControlDirection

View File

@ -27,8 +27,11 @@ module.exports = Self => {
const where = filter.where;
const query = 'CALL vn.item_getBalance(?, ?, ?)';
if (where?.date) {
where.date = new Date(where.date);
where.date.setHours(0, 0, 0, 0);
}
const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, where.date], myOptions);
for (const entry of diary)
if (entry.clientType === 'loses') entry.highlighted = true;