Mi estimado Ares17000
Este es el codigo , para que me podas comentar ya aplique lo indicado pero de igual forma no aparece.
Saludos
--Facturas
SELECT
T1.[CardCode][Código De Cliente],
T1.[CardName][Nombre del Cliente],
CASE T0.[ObjType]
WHEN '13' THEN 'FA'
WHEN '14' THEN 'NC'
ELSE 'AS'
END [Tipo],
T0.[DocNum][No. Documento],
T0.[U_FacSerie][Serie],
T0.[U_FacNum][No.Factura],
T0.[DocDate][Fecha de Contabilización],
T0.[DocDueDate] [Fecha de Vencimiento],
T0.[DocTotal][Total Factura],
SUM(T0.DocTotal - T0.PaidToDate) [Saldo Pendiente],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=0 THEN SUM(T0.DocTotal - T0.PaidToDate)
ELSE 0
END [Vigente],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=30 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >0 THEN SUM(T0.DocTotal - T0.PaidToDate)
ELSE 0
END [0-30 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=60 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >30 THEN SUM(T0.DocTotal - T0.PaidToDate)
ELSE 0
END [30-60 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=90 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >60 THEN SUM(T0.DocTotal - T0.PaidToDate)
ELSE 0
END [60-90 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=120 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >90 THEN SUM(T0.DocTotal - T0.PaidToDate)
ELSE 0
END [90-120 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) >120 THEN SUM(T0.DocTotal - T0.PaidToDate)
ELSE 0
END [Mas 120 Dias]
FROM
OINV T0
INNER JOIN OCRD T1 ON T0.[CardCode] = T1.[CardCode]
WHERE
(T0.DocTotal - T0.PaidToDate)<>0 and CAST(T0.[DocDate] AS DATE) between [%0]and [%1]
GROUP BY
T1.[CardCode],
T1.[CardName],
T0.[ObjType],
T0.[DocNum],
T0.[U_FacSerie],
T0.[U_FacNum],
T0.[DocDate],
T0.[DocDueDate],
T0.[DocTotal]
union all
--Notas de crédito
SELECT
T1.[CardCode][Código De Cliente],
T1.[CardName][Nombre del Cliente],
CASE T0.[ObjType]
WHEN '13' THEN 'FA'
WHEN '14' THEN 'NC'
ELSE 'AS'
END [Tipo],
T0.[DocNum][No. Documento],
T0.[U_FacSerie][Serie],
T0.[U_FacNum][No.Factura],
T0.[DocDate][Fecha de Contabilización],
T0.[DocDueDate][Fecha de Vencimiento],
T0.DocTotal[Total Factura],
SUM(T0.DocTotal - T0.PaidToDate)* -1 [Saldo Pendiente],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=0 THEN SUM(T0.DocTotal - T0.PaidToDate)* -1
ELSE 0
END [Vigente],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=30 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >0 THEN SUM(T0.DocTotal - T0.PaidToDate)* -1
ELSE 0
END [0-30 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=60 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >30 THEN SUM(T0.DocTotal - T0.PaidToDate)* -1
ELSE 0
END [30-60 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=90 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >60 THEN SUM(T0.DocTotal - T0.PaidToDate)* -1
ELSE 0
END [60-90 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) <=120 AND DATEDIFF(day,T0.[DocDueDate],getdate()) >90 THEN SUM(T0.DocTotal - T0.PaidToDate)* -1
ELSE 0
END [90-120 Dias],
CASE
WHEN DATEDIFF(day,T0.[DocDueDate],getdate()) >120 THEN SUM(T0.DocTotal - T0.PaidToDate)* -1
ELSE 0
END [Mas 120 Dias]
FROM
ORIN T0
INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
WHERE
(T0.DocTotal - T0.PaidToDate)<>0 and CAST(T0.[DocDate] AS DATE) between [%0]and [%1]
GROUP BY
T1.[CardCode],
T1.[CardName],
T0.[ObjType],
T0.[DocNum],
T0.[U_FacSerie],
T0.[U_FacNum],
T0.[DocDate],
T0.[DocDueDate],
T0.[DocTotal]
Union all
--Débitos
SELECT
T0.[ShortName][Código De Cliente],
T1.[CardName][Nombre del Cliente],
CASE T0.[TransType]
WHEN '13' THEN 'FA'
WHEN '14' THEN 'NC'
WHEN '24' THEN 'PR'
WHEN '-3' THEN 'CB'
WHEN '-2' THEN 'SI'
ELSE 'AS'
END [Tipo],
T0.[TransId][No. Documento],
IsNull(T2.[U_FacSerie],''),
IsNull(T2.[U_FacNum],''),
T0.[RefDate][Fecha de Contabilización],
T0.[DueDate][Fecha de Vencimiento],
0, sum(T0.[BalDueDeb])[Monto],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=0 THEN sum(T0.[BalDueDeb])
ELSE 0
END [Vigente],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=30 AND DATEDIFF(day,T0.[DueDate],getdate()) >0 THEN sum(T0.[BalDueDeb])
ELSE 0
END [0-30 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=60 AND DATEDIFF(day,T0.[DueDate],getdate()) >30 THEN sum(T0.[BalDueDeb])
ELSE 0
END [30-60 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=90 AND DATEDIFF(day,T0.[DueDate],getdate()) >60 THEN sum(T0.[BalDueDeb])
ELSE 0
END [60-90 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=120 AND DATEDIFF(day,T0.[DueDate],getdate()) >90 THEN sum(T0.[BalDueDeb])
ELSE 0
END [90-120 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) >120 THEN sum(T0.[BalDueDeb])
ELSE 0
END [Mas 120 Dias]
FROM
JDT1 T0
INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
LEFT JOIN OINV T2 ON T0.TransId = T2.TransId
WHERE
T0.[ShortName] = T1.[CardCode] and T0.[TransType]<>'13' and T1.[CardType] ='C' and
T0.[BalDueDeb]<>0 and T0.[RefDate] between [%0]and [%1]
GROUP BY
T0.[ShortName],
T1.[CardName],
T0.[TransType],
T0.[TransId],
IsNull(T2.[U_FacSerie],''),
IsNull(T2.[U_FacNum],''),
T0.[RefDate],
T0.[DueDate]
union all
--Créditos
SELECT
T0.[ShortName][Código De Cliente],
T1.[CardName][Nombre del Cliente],
CASE T0.[TransType]
WHEN '13' THEN 'FA'
WHEN '14' THEN 'NC'
WHEN '24' THEN 'PR'
WHEN '-3' THEN 'CB'
WHEN '-2' THEN 'SI'
ELSE 'AS'
END [Tipo],
T0.[TransId][No. Documento],
IsNull(T2.[U_FacSerie],''),
IsNull(T2.[U_FacNum],''),
T0.[RefDate][Fecha de Contabilización],
T0.[DueDate][Fecha de Vencimiento],
0, sum(T0.[BalDueCred]*-1)[Monto],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=0 THEN sum(T0.[BalDueCred]*-1)
ELSE 0
END [Vigente],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=30 AND DATEDIFF(day,T0.[DueDate],getdate()) >0 THEN sum(T0.[BalDueCred]*-1)
ELSE 0
END [0-30 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=60 AND DATEDIFF(day,T0.[DueDate],getdate()) >30 THEN sum(T0.[BalDueCred]*-1)
ELSE 0
END [30-60 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=90 AND DATEDIFF(day,T0.[DueDate],getdate()) >60 THEN sum(T0.[BalDueCred]*-1)
ELSE 0
END [60-90 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) <=120 AND DATEDIFF(day,T0.[DueDate],getdate()) >90 THEN sum(T0.[BalDueCred]*-1)
ELSE 0
END [90-120 Dias],
CASE
WHEN DATEDIFF(day,T0.[DueDate],getdate()) >120 THEN sum(T0.[BalDueCred]*-1)
ELSE 0
END [Mas 120 Dias]
FROM
JDT1 T0
INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
LEFT JOIN OINV T2 ON T0.TransId = T2.TransId
WHERE
T0.[ShortName] = T1.[CardCode]and
T0.[BalDueCred]<>0 and
T0.[TransType]<>'13' and T1.[CardType] ='C' and
T0.[RefDate] between [%0]and [%1]
GROUP BY
T0.[ShortName],
T1.[CardName],
T0.[TransType],
T0.[TransId],
IsNull(T2.[U_FacSerie],''),
IsNull(T2.[U_FacNum],''),
T0.[RefDate],
T0.[DueDate]