Skip to Content

Alguien conoce la tabla de los pagos que hace join con los anticipos y los pagos?.

Trato de generar una consulta que me extraiga la información del el anticipo cuando se paga a favor del cliente, y cuando se paga el anticipo a la factura.

tengo esto:

pero solo me extrae el último pago hecho.

SELECT

T0.[DocNum], t0.canceled,T1.[SumApplied], T1.[PaidDpm], T2.[DocNum], T2

.[CANCELED], T2.[DocDate], T2.[U_FechaPagoAnticipo], T2.[NumAtCard], T3

.[DocNum], T3.[DocDate], T6.[AcctName], T5.[Debit], T5.[Credit], T5.[RefDate]

FROM

ORCT T0 

LEFT JOIN RCT2 T1 ON T0.DocEntry=T1.DocNum AND T1.INVTYPE=13

INNER JOIN ODPI T2 ON T0.DocEntry=T2.ReceiptNum

LEFT JOIN OINV T3 ON T1.DocEntry=T3.DocEntry

INNER JOIN OJDT T4 ON T0.TRANSID=T4.TRANSID

INNER JOIN JDT1     T5 ON T4.TRANSID=T5.TRANSID

INNER JOIN OACT T6 ON T5.ACCOUNT=T6.ACCTCODE

WHERE

T0.DOCDATE>=‘[%0]’ AND T0.DOCDATE<=‘[%1]’

UNION ALL

SELECT

T0.[DocNum], t0.canceled, T2.[Doctotal],T0.cardcode,T2.Docnum, T2

.[CANCELED], T2.[DocDate], T2.[U_FechaPagoAnticipo], T2.[NumAtCard], t2

.docnum,t2.docdate, T6.[AcctName], T5.[Debit], T5.[Credit], T5

.[RefDate]

FROM

ORCT T0 

INNER JOIN ODPI T2 ON T0.DocEntry=T2.ReceiptNum

INNER JOIN OJDT T4 ON T0.TRANSID=T4.TRANSID

INNER JOIN JDT1     T5 ON T4.TRANSID=T5.TRANSID

INNER JOIN OACT T6 ON T5.ACCOUNT=T6.ACCTCODE

WHERE

T0.DOCDATE>=‘[%0]’ AND T0.DOCDATE<=‘[%1]’

[code]

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply