Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Pago Proveedores

Estimados Expertos,

he realizado un query  para obtener un informe de  facturas de proveedores a pago y las notas de crédito asociadas, sin embargo solo puedo obtener una nota de crédito por factura y a veces tengo mas asociadas a una factura. La consecuencia de esto es el  campo PaidToDate pero si lo saco me arroja notas de credito saldadas anteriormente.

Favor su ayuda...  dejo el query utilizado actualmente. gracias

SELECT 

T1.LicTradNum as 'RUT',

T0.CardName AS 'Nombre',

T0.DocTotal*-1 as 'Total',

t0.FolioNum as 'N°Factura o NC',

T0.DocDueDate AS 'Fecha de vencimiento',

T0.DocNum AS 'REF'

FROM OPCH T0

inner join OCRD T1 on T1.cardCode = T0.Cardcode

inner join OACT T3 on T1.DebPayAcct = T3.AcctCode

WHERE DATEDIFF (DD, T0.DocDueDate, GETDATE( )) BETWEEN -60 AND 365

AND T0.DocStatus = 'O'

----------------------

union

SELECT 

T1.LicTradNum as 'RUT',

T4.CardName AS 'Nombre',

T0.DocTotal as 'Total',

T0.FolioNum ,

T4.DocDueDate ,

T0.DocNum

FROM ORPC T0 -- tabla de notas de credito

inner join OCRD T1 on T1.cardCode = T0.Cardcode

inner join OACT T3 on T1.DebPayAcct = T3.AcctCode

inner join OPCH T4 on

t4.PaidToDate = t0.PaidToDate  and t4.CardCode = t0.CardCode

WHERE t4.CEECFlag = 'Y'

AND T4.DocStatus = 'O'

ORDER BY T1.LicTradNum

Former Member
Former Member replied

Cristobal, si no aparecen es porque ya las reconciliaron con alguna factura o pago efectuado, no debería tomarlas en cuenta nuevamente.

no se si me explico? la nota de crédito solo debe usarla una vez.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question