on 09-30-2014 8:28 PM
Hola tengo una consulta con el siguiente codigo para obtener por meses del año todo las CxC Cuentas por Cobrar, lo ajuste a la tabla pivote aun no encuentro el error podrías por favor me podrian corregir (ojo me falta la parte de factura de anticipos, solo es factura de deudores)
Gracias
SELECT
P.[# Mes],
[1] as [Ene],
[2] as [Feb],
[3] as [Mar],
[4] as [Abr],
[5] as [May],
[6] as [Jun],
[7] as [Jul],
[8] as [Ago],
[9] as [Sep],
[10] as [Oct],
[11] as [Nov],
[12] as [Dic]
FROM (
SELECT datepart(month, t0.U_fechavenccontra)[# Mes]
,CASE T0.DocCur WHEN 'MXP' THEN sum(t0.doctotal -
t0.PaidToDate) ELSE sum(t0.doctotalFC - T0.PaidFC) END as
'TotalxCobrar',t0.doccur AS 'Moneda', 'MHO' as 'Sociedad'
FROM [MHO_Produccion].[dbo].oinv t0
WHERE docstatus = 'O' and t0.CardCode != '0663-000-P'And
t0.CardCode != '0663-001-D' and t0.U_fechavenccontra is not null
and t0.U_fechavenccontra between '20140101' and '20141231'
GROUP BY datepart(month, t0.U_fechavenccontra), T0.DocCur
) P
PIVOT (
SUM(TotalxCobrar)
FOR [datepart(month, t0.U_fechavenccontra)[# Mes]] IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])
) P
ORDER BY P.[# Mes]
en vez de una tabla pivote, mucho más fácil y sencillo manejar Reporting services. La verdad ha mi me ha facilitado muchísimo la vida en cuestión de reportes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok me podrias decir de donde bajo un manual de reporting services por favor,
Muchas gracias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SQL Server 2008: Reporting Services
hay muchos tutos... yo he hecho reportes sobre la bd de SAP. y quedan muy bien. se pueden exportar a Excel y pdf. la única limitante de la versión 2008 es que me las envía a Excel 2007 y sus limitantes de columnas y renglones. la 2012 ya te envía a Excel 2010.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.