feat: refs #6777 tabulacion

This commit is contained in:
Robert Ferrús 2024-02-06 08:37:28 +01:00
parent 01512c7d36
commit 3500886149
1 changed files with 15 additions and 18 deletions

View File

@ -15,31 +15,31 @@ BEGIN
hour(t.shipped) as Hora,
hour(t.shipped) as Departure,
t.id,
m.Id_Movimiento,
m.Id_Movimiento,
m.Cantidad,
m.Concepte,
ABS(m.Reservado) Reservado,
ABS(m.Reservado) Reservado,
i.Categoria,
tp.Tipo,
tp.Tipo,
t.nickname as Cliente,
wh.name as Almacen,
t.warehouseFk,
cs.province_id,
a.agency_id,
ct.description as Taller,
stock.visible,
stock.available
ct.description as Taller,
stock.visible,
stock.available
FROM vn.ticket t
JOIN vn2008.Agencias a ON a.Id_Agencia = t.agencyModeFk
JOIN vn.warehouse wh ON wh.id = t.warehouseFk
JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id
JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article
JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article
JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id
JOIN vn.confectionType ct ON ct.id = tp.confeccion
JOIN vn.confectionType ct ON ct.id = tp.confeccion
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.addressFk
LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id
LEFT JOIN
(
LEFT JOIN
(
SELECT item_id, sum(visible) visible, sum(available) available
FROM
(
@ -57,12 +57,12 @@ BEGIN
where cc.cache_id IN (2,8) and cc.params IN ("1","44")
) sub
GROUP BY item_id
) stock ON stock.item_id = m.Id_Article
) stock ON stock.item_id = m.Id_Article
WHERE tp.confeccion
AND tls.alertLevel < maxAlertLevel
AND wh.hasConfectionTeam
AND t.shipped BETWEEN vDated AND vEndingDate
AND m.Cantidad > 0;
AND m.Cantidad > 0;
-- Entradas
@ -74,9 +74,9 @@ BEGIN
Categoria,
Cliente,
Almacen,
Taller
Taller
)
SELECT
SELECT
tr.shipment AS Fecha,
e.Id_Entrada AS Id_Ticket,
c.Cantidad,
@ -96,10 +96,7 @@ BEGIN
WHERE who.hasConfectionTeam
AND tp.confeccion
AND tr.shipment BETWEEN vDated AND vEndingDate;
SELECT * FROM tmp.production_buffer;
SELECT * FROM tmp.production_buffer;
END$$
DELIMITER ;