on 10-22-2008 9:04 PM
Necesito sacar el total de la deuda con proveedores y los dias de vencimiento ya intente sacar de una tabla pero me da muchos problemas esto es lo que yo hice
SELECT T0.[CardCode], T0.[CardName], T0.[Comments], T0.[DocTotal], T0.[TaxDate], cast(DATEDIFF(DAY, T0.[TaxDate], GETDATE()) as varchar) + ' Dias vencidos'
FROM OPCH T0 where T0.[DocTotal] > T0.[PaidSum]
necesito ayuda
Muchas gracias por haber respondido mi duda me ayudaron mucho
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Estimado,
En la tabla OPCH solo encontraras las facturas, te faltarian los Asientos manuales y las notas de credito.
Creo que debes sacar la informacion de los asientos de la tabla OJDT y JDT1.
PD: En la version 2007 el folio queda en la tabla OJDT
att,
Manuel Lazcano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
VERIFICA ESTOYME COMENTAS PORFAS:
SELECT DISTINCT T0.CardCode AS CodigoCliente, T0.CardName AS NombreCliente, DocNum AS NumFactura, T0.DocDate AS FechaDoc, T0.DocDueDate AS FechaVenc, T1.SlpName AS Vendedor, T2.WhsCode,
'Saldo'= (case when DocCur='$' then (T0.DocTotalFC-T0.PaidFC) else (DocTotal-PaidToDate) end), DocCur as Moneda,
'Por Vencer' = (case when (Doccur='$' and getdate() <= DocDueDate) then (DocTotal-PaidToDate) else (case when getdate() <= DocDueDate and Doccur='$' then (DocTotalFC-PaidFC) else 0 end) end),
'0-30' = (case when (Doccur='$' and DATEDIFF(day, docduedate, getdate())>=0 and DATEDIFF(day, docduedate, getdate())<=30) then (T0.DocTotal-T0.PaidToDate) else (case when DATEDIFF(day, docduedate, getdate())>=0 and DATEDIFF(day, docduedate, getdate())<=30 and Doccur='$' then (DocTotalFC-PaidFC) else 0 end) end),
'31-60' = (case when (DocCur='$' and DATEDIFF(day, docduedate, getdate())>=31 and DATEDIFF(day, docduedate, getdate())<=60) then (T0.DocTotal-T0.PaidToDate) else (case when DATEDIFF(day, docduedate, getdate())>=31 and DATEDIFF(day, docduedate, getdate())<=60 and DocCur='$' then (DocTotalFC-PaidFC) else 0 end) end),
'61-90' = (case when (DocCur='$' and DATEDIFF(day, docduedate, getdate())>=61 and DATEDIFF(day, docduedate, getdate())<=90) then (T0.DocTotal-T0.PaidToDate) else (case when DATEDIFF(day, docduedate, getdate())>=61 and DATEDIFF(day, docduedate, getdate())<=90 and DocCur='$' then (DocTotalFC-PaidFC) else 0 end) end),
'90+' = (case when (DocCur='$' and DATEDIFF(day, docduedate, getdate())>=90) then (T0.DocTotal-T0.PaidToDate) else (case when (DocCur='$' and DATEDIFF(day, docduedate, getdate())>=90) then (T0.DocTotalFC-T0.PaidFC) else 0 end) end)
FROM OPCH T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode INNER JOIN PCH1 T2 ON T0.DocEntry = T2.DocEntry WHERE (T0.DocTotal-T0.PaidToDate>0 or DocTotalFC-PaidFC >0) AND T0.DocDate >= '2008-07-01' AND T0.DocDate <= '2008-09-30'
order by CardCode
Si te marca algun error, puedes contactarme a juliancab(arroba)autopartesrv.com.mx o msn julian_chino(arroba)hotmail.com
Saludos
User | Count |
---|---|
89 | |
7 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.