on 08-23-2013 6:22 AM
Buenas Noches Estimados.
Estoy con una duda, talvez me pueden ayudar.. deseo calcular el saldo anterior al posteo de un documento, recibo o Nota Credito o nota de Debito... Ojo NO restando el DocTotal del OCRD.Balance ya que en una fecha posterior donde se genere otro documento me devolveria un valor incorrecto,
O sea como calculo el saldo del SN al momento anterior del posteo de un documento.
alguna idea?
Saludos.
Ruben G.
Que tal Rubén,
Haber si te entendí, como se me ocurre podrías solucionarlo sería consultando las tablas de los asientos contables (OJDT, JDT1), hacer la liga de estas tablas con el "TransId" del documento de marketing y de los asientos contables. Te anexo un pequeño ejemplo:
SELECT SUM(T1.Debit-T1.Credit) [Saldo SN]
FROM OJDT T0
INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
INNER JOIN OCRD T2 ON T1.ShortName = T2.CardCode
-- AQUÍ PUEDES PONER LA CONDICIÓN DE QUE OBTENGA TODOS LOS MOVIMIENTOS CONTABLES
-- QUE SEAN MENORES AL TRANSID DEL DOCUMENTO GENERADO Y QUE CORRESPONDA AL CLIENTE
WHERE T0.TransId < 1000 AND T2.CardCode = 'C-022'
GROUP BY T2.CardCode
Espero te sea de utilidad.
Saludos,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.