Buenas tardes Estimados:
Estoy haciendo un reporte que me muestre las ventas y notas de credito por fecha y hora pero cuando lo ejecuto la columna de hora no me sale con el formato HH:MM, me pueden decir como se hace?
Adjunto mi consulta:
/* SELECT FROM [dbo].[OJDT T2] T2 */
Declare @fecha1 as datetime
/*WHERE*/
Set @fecha1 = /* T2.RefDate */ '[%0]'
/* SELECT FROM [dbo].[OJDT T2] T2 */
Declare @fecha2 as datetime
/*WHERE*/
Set @fecha2 = /* T2.RefDate */ '[%1]'
SELECT '1','FACTURA' as 'Operación',T3.PymntGroup as 'Grupo', T0.DocDate as 'Fecha', T0.DocTime as 'Hora', T0.DocNum as'Documento',T0.NumAtCard as 'Ref#1', T0.CardCode+'('+T0.CardName+')'
as 'Cliente',ISNULL(((T0.DocTotal+T0.DiscSum)-(T0.TotalExpns+T0.VatSum)),0.0)as 'Sub-Total S/D',ISNULL((T0.DiscSum),0.0)as'Descuento',
ISNULL(((T0.DocTotal)-(T0.TotalExpns+T0.VatSum)),0.0)as 'Sub-Total',ISNULL((T0.TotalExpns),0.0)as 'Gastos',
ISNULL(( T0.VatSum),0.0)as 'ITBMS',ISNULL(( T0.DocTotal),0.0)as 'Total'FROM OINV T0 INNER JOIN OCTG T3 ON T0.GroupNum = T3.GroupNum
where (T0.docnum between 59907 and 1000000) and (T0.DocDate >=@fecha1 and T0.DocDate <= @fecha2)
UNION
SELECT '2','NOTA DE CREDITO',T3.PymntGroup as 'Grupo',T1.DocDate, T1.DocTime as 'Hora', T1.DocNum,T1.NumAtCard as 'Ref#1', T1.CardCode+'('+T1.CardName+')'
as Cliente,ISNULL(((T1.DocTotal+T1.DiscSum)-(T1.TotalExpns+T1.VatSum)),0.0) * -1 as 'Sub-Total S/D',ISNULL(( T1.DiscSum),0.0)* -1 as 'Descuento',
ISNULL(((T1.DocTotal)-(T1.TotalExpns+T1.VatSum)),0.0)* -1 as 'Sub-Total',ISNULL((T1.TotalExpns),0.0)* -1 as 'Gastos', ISNULL((T1.VatSum),0.0)* -1 as 'ITBMS',ISNULL((T1.DocTotal),0.0)* -1 as'Total' FROM ORIN T1 INNER JOIN OCTG T3 ON T1.GroupNum = T3.GroupNum
WHERE (T1.docnum between 1 and 10000000) and T1.DocDate >=@fecha1 and T1.DocDate <= @fecha2 and not T1.DocNum='1'