This commit is contained in:
parent
c598e62d1e
commit
714cd3c2c3
|
@ -59,7 +59,7 @@ BEGIN
|
|||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||
(PRIMARY KEY (Id_Ticket))
|
||||
SELECT DISTINCT t.id
|
||||
SELECT DISTINCT t.id Id_Ticket
|
||||
FROM vn2008.Movimientos_componentes mc
|
||||
JOIN vn2008.Movimientos m ON mc.Id_Movimiento = m.Id_Movimiento
|
||||
JOIN vn.ticket t ON t.id = m.Id_Ticket
|
||||
|
|
|
@ -70,7 +70,7 @@ BEGIN
|
|||
AND (v.fecha BETWEEN TIMESTAMPADD(DAY, - DAY(vDate) + 1, vDate) AND TIMESTAMPADD(DAY, - 1, vDate))
|
||||
GROUP BY Id_Cliente) mes_actual ON mes_actual.Id_Cliente = c.Id_Cliente
|
||||
LEFT JOIN
|
||||
(SELECT t.clientFk, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur
|
||||
(SELECT t.clientFk Id_Cliente, SUM(m.preu * m.Cantidad * (1 - m.Descuento / 100)) futur
|
||||
FROM vn.ticket t
|
||||
JOIN vn2008.Clientes c ON c.Id_Cliente = t.clientFk
|
||||
JOIN vn2008.Movimientos m ON m.Id_Ticket = t.id
|
||||
|
|
|
@ -14,12 +14,12 @@ BEGIN
|
|||
SELECT id
|
||||
FROM vn.ticket t
|
||||
JOIN vn2008.Facturas f ON f.Id_Factura = t.refFk
|
||||
WHERE year(f.shipped) = vYear
|
||||
AND month(f.shipped) = vMonth;
|
||||
WHERE year(f.Fecha) = vYear
|
||||
AND month(f.Fecha) = vMonth;
|
||||
|
||||
SELECT vYear Año,
|
||||
vMonth Mes,
|
||||
t.clientFk,
|
||||
t.clientFk Id_Cliente,
|
||||
round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) Venta,
|
||||
IF(e.empresa_grupo = e2.empresa_grupo,
|
||||
1,
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
CREATE TEMPORARY TABLE `tmp.``ticketToInvoice`
|
||||
(PRIMARY KEY (`id`))
|
||||
ENGINE = MEMORY
|
||||
SELECT id id
|
||||
SELECT id
|
||||
FROM ticket
|
||||
WHERE (shipped BETWEEN vMinDateTicket AND vMaxTicketDate)
|
||||
AND addressFk = vAddress
|
||||
|
|
|
@ -23,7 +23,7 @@ BEGIN
|
|||
tp.Tipo,
|
||||
t.nickname as Cliente,
|
||||
wh.name as Almacen,
|
||||
t.warehouseFk,
|
||||
t.warehouseFk warehouse_id,
|
||||
cs.province_id,
|
||||
a.agency_id,
|
||||
ct.description as Taller,
|
||||
|
|
|
@ -28,7 +28,7 @@ SELECT * FROM
|
|||
FROM bi.customerDebtInventory
|
||||
WHERE Id_Cliente = vCustomer
|
||||
UNION ALL
|
||||
SELECT t.shipped, - SUM(m.Cantidad * m.Preu * (100 - m.Descuento ) * 1.10 / 100)
|
||||
SELECT t.shipped Fecha, - SUM(m.Cantidad * m.Preu * (100 - m.Descuento ) * 1.10 / 100)
|
||||
FROM vn.ticket t
|
||||
JOIN Movimientos m on m.Id_Ticket = t.id
|
||||
WHERE t.clientFk = vCustomer
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
DECLARE txt TEXT;
|
||||
|
||||
DECLARE rs CURSOR FOR
|
||||
SELECT t.id, Alias, cast(amount as decimal(10,2)) Importe, Domicilio, POBLACION
|
||||
SELECT t.id Id_Ticket, 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 (
|
||||
|
|
Loading…
Reference in New Issue