Estimados, espero que todos esten muy bien.
Consulta alguien tiene la query del informe “Antiguedad de Saldo Proveedores”, necesito hacer algunas modificaciones a partir de este informe.
Desde ya agradezco su apoyo.
Buen día, tengo uno espero pueda funcionarte, saludos
SELECT T0.TransId, T0.Line_ID, MAX(T0.Account) Cuenta, MAX(T0.ShortName) CveSocio, MAX(T2.CardName) CardName, MAX(T0.TransType) TransType, MAX(T0.CreatedBy) Origen,
MAX(T0.BaseRef) Baseref, MAX(T0.SourceLine) SourceLine, MAX(T0.RefDate) FContabilizacion, MAX(T0.DueDate) FVencimiento, MAX(T0.TaxDate) FDocumento, MAX(T5.NumAtCard) NumReferenciaSN,
(MAX(T0.BalDueCred) - MAX(T0.BalDueDeb)) SaldoVencido, (MAX(T0.BalFcCred) - MAX(T0.BalFcDeb)) SaldoVencidoME, (MAX(T0.BalScCred) - MAX(T0.BalScDeb)) SaldoVencidoST,
MAX(T0.LineMemo) DetalleLinea, (MAX(T0.Debit) - MAX(T0.Credit)) SaldoAsiento, (MAX(T0.FCDebit) - MAX(T0.FCCredit)) SaldoAsientoME, (MAX(T0.SYSDeb) - MAX(T0.SYSCred)) SaldoAsientoSis,
MAX(T2.Currency) CurrencySN, MAX(T0.FCCurrency) CurrencyME, MAX(T3.CardType) TipoSN,
CASE WHEN (MAX(T0.BalFcCred) - MAX(T0.BalFcDeb)) <> 0 THEN MAX(T0.[FCCurrency]) ELSE ‘MXP’ END Moneda, MAX(T3.PymCode) MetodoPago
FROM dbo.JDT1 AS T0
INNER JOIN dbo.OJDT AS T1 ON T1.TransId = T0.TransId
INNER JOIN dbo.OCRD AS T2 ON T2.CardCode = T0.ShortName OR T2.ConnBP = T0.ShortName
INNER JOIN dbo.OCRD AS T3 ON T3.CardCode = T0.ShortName
LEFT OUTER JOIN dbo.OCRD AS T4 ON T4.ConnBP = T2.CardCode
LEFT OUTER JOIN dbo.B1_JournalTransSourceView AS T5 ON T5.ObjType = T0.TransType AND T5.DocEntry = T0.CreatedBy AND (T5.TransType <> ‘I’ OR (T5.TransType = ‘I’ AND T5.InstlmntID = T0.SourceLine))
WHERE T0.RefDate <= GETDATE() AND T2.CardType = (‘S’)
AND (T2.ConnBP IS NULL AND T2.Balance <> (0) OR T2.Balance <> - T4.Balance) AND (T0.BalDueCred <> T0.BalDueDeb OR T0.BalFcCred <> T0.BalFcDeb)
AND NOT EXISTS (SELECT U0.TransId, U0.TransRowId
FROM dbo.ITR1 AS U0
INNER JOIN dbo.OITR AS U1 ON U1.ReconNum = U0.ReconNum
WHERE T0.TransId = U0.TransId AND T0.Line_ID = U0.TransRowId AND U1.ReconDate > (GETDATE())
GROUP BY U0.TransId, U0.TransRowId)
GROUP BY T0.TransId, T0.Line_ID, T0.BPLName
Perfecto, muchas gracias.
Me sirvió bastante.
Este tema se cerró automáticamente 7 días después de la última publicación. No se permiten nuevas respuestas.