feat: refs #6777 change dependecies vn2008 to vn #2000
|
@ -79,7 +79,7 @@ BEGIN
|
|||
|
||||
INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha,
|
||||
Greuges_type_id, Id_Ticket)
|
||||
SELECT Id_Cliente
|
||||
SELECT t.clientFk
|
||||
,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2)
|
||||
AS dif
|
||||
,date(t.shipped)
|
||||
|
|
|
@ -86,7 +86,7 @@ BEGIN
|
|||
) as grupo
|
||||
, NULL
|
||||
, NULL
|
||||
, t.companyFk
|
||||
, t.companyFk empresa_id
|
||||
, 7050000000
|
||||
FROM vn.ticketService ts
|
||||
JOIN vn.ticket t ON ts.ticketFk = t.id
|
||||
|
|
|
@ -8,7 +8,7 @@ BEGIN
|
|||
|
||||
DROP TEMPORARY TABLE IF EXISTS `tmp`.`ticketToInvoice`;
|
||||
|
||||
CREATE TEMPORARY TABLE `tmp.``ticketToInvoice`
|
||||
CREATE TEMPORARY TABLE `tmp`.`ticketToInvoice`
|
||||
(PRIMARY KEY (`id`))
|
||||
ENGINE = MEMORY
|
||||
SELECT id
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN
|
|||
IFNULL(nbultos,0) AS nbultos,
|
||||
IFNULL(notros,0) AS notros,
|
||||
ts.code AS Estado
|
||||
FROM Tickets ti
|
||||
FROM vn.ticket ti
|
||||
INNER JOIN Consignatarios ON ti.addressFk = Consignatarios.Id_consigna
|
||||
INNER JOIN Agencias ON ti.agencyModeFk = Agencias.Id_Agencia
|
||||
LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.id=sub1.Ticket_Id
|
||||
|
|
|
@ -22,19 +22,12 @@ proc: BEGIN
|
|||
|
||||
DELETE FROM cdr WHERE calldate < vDate18;
|
||||
DELETE FROM Monitoring WHERE ODBC_TIME < vDate;
|
||||
DELETE FROM Conteo WHERE Fecha < vDate;
|
||||
DELETE FROM mail WHERE DATE_ODBC < vDate;
|
||||
DELETE FROM expeditions_deleted WHERE odbc_date < vDate26;
|
||||
DELETE FROM Movimientos_mark WHERE odbc_date < vDate;
|
||||
DELETE FROM Splits WHERE Fecha < vDate18;
|
||||
|
||||
DELETE ts
|
||||
FROM Tickets_stack ts
|
||||
JOIN vn.ticket t ON ts.Id_Ticket = t.id
|
||||
WHERE t.shipped < vDate;
|
||||
|
||||
DELETE tobs
|
||||
FROM ticketObservation tobs
|
||||
FROM vn.ticketObservation tobs
|
||||
JOIN vn.ticket t ON tobs.ticketFk = t.id
|
||||
WHERE t.shipped < vDate;
|
||||
|
||||
|
@ -49,7 +42,7 @@ proc: BEGIN
|
|||
DELETE tw.*
|
||||
FROM vn.ticketWeekly tw
|
||||
LEFT JOIN vn.sale s USING(ticketFk)
|
||||
WHERE s.Id_Article IS NULL;
|
||||
WHERE s.id IS NULL;
|
||||
|
||||
DELETE FROM cl_main WHERE Fecha < vDate18;
|
||||
DELETE FROM hedera.`order` WHERE date_send < vDate18;
|
||||
|
@ -65,13 +58,6 @@ proc: BEGIN
|
|||
JOIN travel t ON t.id = e.travel_id
|
||||
WHERE t.landing <= vDate;
|
||||
|
||||
DELETE co
|
||||
FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra
|
||||
JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada
|
||||
JOIN travel t ON t.id = e.travel_id
|
||||
WHERE t.landing <= vDate;
|
||||
DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1;
|
||||
|
||||
IF v_full THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tTicketDelete
|
||||
SELECT DISTINCT tl.originFk ticketFk
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
date(t.shipped) as Fecha,
|
||||
hour(t.shipped) as Hora,
|
||||
hour(t.shipped) as Departure,
|
||||
t.id,
|
||||
t.id Id_Ticket,
|
||||
m.Id_Movimiento,
|
||||
m.Cantidad,
|
||||
m.Concepte,
|
||||
|
|
|
@ -14,9 +14,9 @@ BEGIN
|
|||
DECLARE txt TEXT;
|
||||
|
||||
DECLARE rs CURSOR FOR
|
||||
SELECT t.id Id_Ticket, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
|
||||
SELECT t.id Id_Ticket, nickname Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
|
||||
FROM vn.ticket t
|
||||
JOIN Consignatarios cs ON t.Id_Consigna = cs.Id_Consigna
|
||||
JOIN Consignatarios cs ON t.addressFk = cs.Id_Consigna
|
||||
JOIN (
|
||||
SELECT `Movimientos`.`Id_Ticket` AS `Id_Ticket`,
|
||||
sum(
|
||||
|
|
|
@ -8,8 +8,8 @@ BEGIN
|
|||
FROM Movimientos m
|
||||
JOIN Articles a ON m.Id_Article = a.Id_Article
|
||||
JOIN Tipos tp ON tp.tipo_id = a.tipo_id
|
||||
JOIN ticket t ON t.id = m.Id_Ticket
|
||||
JOIN Consignatarios cs using(Id_Consigna)
|
||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
||||
JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk
|
||||
WHERE cs.Id_Cliente = idPEOPLE
|
||||
AND Tipo = 'Contenedores'
|
||||
AND t.shipped > '2010-01-01'
|
||||
|
@ -35,8 +35,8 @@ BEGIN
|
|||
FROM Movimientos m
|
||||
JOIN Articles a using(Id_Article)
|
||||
JOIN Tipos tp using(tipo_id)
|
||||
JOIN ticket t ON t.id = m.Id_Ticket
|
||||
JOIN Consignatarios cs using(Id_Consigna)
|
||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
||||
JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk
|
||||
JOIN proveedores_clientes pc ON pc.Id_Cliente = cs.Id_Cliente
|
||||
WHERE Id_Proveedor = idPEOPLE
|
||||
AND reino_id = 6
|
||||
|
|
|
@ -17,10 +17,10 @@ BEGIN
|
|||
, abbreviation Empresa
|
||||
FROM Movimientos m
|
||||
JOIN Articles a using(Id_Article)
|
||||
JOIN ticket t ON t.id = m.Id_Ticket
|
||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
||||
JOIN empresa e ON e.id = t.companyFk
|
||||
JOIN warehouse w ON w.id = t.warehouseFk
|
||||
JOIN Consignatarios cs using(Id_Consigna)
|
||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
||||
JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk
|
||||
JOIN Clientes c ON c.Id_Cliente = cs.Id_Cliente
|
||||
WHERE cs.Id_Cliente = idPEOPLE
|
||||
AND m.Id_Article = idARTICLE
|
||||
|
@ -65,8 +65,8 @@ BEGIN
|
|||
, t.warehouseFk warehouse_id
|
||||
, Preu
|
||||
FROM Movimientos m
|
||||
JOIN ticket t ON t.id = m.Id_Ticket
|
||||
JOIN Consignatarios cs using(Id_Consigna)
|
||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
||||
JOIN Consignatarios cs ON cs.Id_Consigna = t.addressFk
|
||||
JOIN proveedores_clientes pc ON pc.Id_Cliente = cs.Id_Cliente
|
||||
WHERE Id_Proveedor = idPEOPLE
|
||||
AND Id_Article = idARTICLE
|
||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
|||
t.id Id_Ticket,
|
||||
t.isPrinted PedidoImpreso
|
||||
FROM Movimientos M
|
||||
INNER JOIN ticket t USING (Id_Ticket)
|
||||
INNER JOIN vn.ticket t ON t.id = M.Id_Ticket
|
||||
JOIN Clientes C ON C.Id_Cliente = t.clientFk
|
||||
WHERE t.shipped >= '2001-01-01'
|
||||
AND M.Id_Article = idART
|
||||
|
|
|
@ -69,19 +69,19 @@ BEGIN
|
|||
SELECT t.shipped as Fecha,
|
||||
NULL as Entrada,
|
||||
M.Cantidad as Salida,
|
||||
warehouse_id as wh,
|
||||
t.warehouseFk as wh,
|
||||
(M.OK <> 0 OR t.isLabeled <> 0 OR t.refFk IS NOT NULL) as OK,
|
||||
t.refFk as Referencia,
|
||||
t.id as id
|
||||
|
||||
FROM Movimientos M
|
||||
INNER JOIN ticket t ON t.id = M.Id_Ticket
|
||||
INNER JOIN vn.ticket t ON t.id = M.Id_Ticket
|
||||
WHERE t.shipped >= vDateInventory
|
||||
AND M.Id_Article = vItemFk
|
||||
|
||||
) AS Historia
|
||||
|
||||
INNER JOIN warehouse ON warehouse.id = Historia.wh
|
||||
INNER JOIN vn.warehouse ON warehouse.id = Historia.wh
|
||||
ORDER BY Fecha, Entrada DESC, OK DESC;
|
||||
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ BEGIN
|
|||
JOIN vn.ticket tt on tt.addressFk = t.addressFk
|
||||
WHERE t.shipped > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE())
|
||||
AND tt.routeFk = vRutaId
|
||||
GROUP BY addressFk
|
||||
) sub ON sub.Id_Consigna = mt.Id_Consigna
|
||||
GROUP BY t.addressFk
|
||||
) sub ON sub.Id_Consigna = mt.addressFk
|
||||
SET mt.priority = sub.Prioridad
|
||||
WHERE mt.routeFk = vRutaId;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
JOIN Clientes c ON c.Id_Cliente = t.clientFk
|
||||
WHERE c.typeFk IN ('normal','handMaking','internalUse')
|
||||
AND (
|
||||
Fecha BETWEEN util.today() AND vEndingDate
|
||||
t.shipped BETWEEN util.today() AND vEndingDate
|
||||
OR (
|
||||
ts.alertLevel < 3
|
||||
AND t.shipped >= vStartingDate
|
||||
|
|
|
@ -38,8 +38,8 @@ BEGIN
|
|||
JOIN vn.ticket t on m.Id_Ticket = t.id
|
||||
JOIN tmp.client_list c on c.Id_Cliente = t.clientFk
|
||||
JOIN vn.client cl ON cl.id = t.clientFk
|
||||
WHERE Factura IS NULL
|
||||
AND Fecha BETWEEN startingDate AND endingDate
|
||||
WHERE t.refFk IS NULL
|
||||
AND t.shipped BETWEEN startingDate AND endingDate
|
||||
GROUP BY t.clientFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.risk;
|
||||
|
|
Loading…
Reference in New Issue