Hello,
I have one table like,..
Break and column name
BreakId bigint pk,BreakTypeIn int,BreakTimeIn datetime,BreakTypeOut int,BreakTimeOut
datetime,CreateDateTime,UpdateDateTime.
on date 26/10/2016 two record are there.like
BreakId BreakTypeIn BreakTimeIn BreakTypeOut BreakTimeOut CreateDateTime
1 1 12:03 2 12:13 2016-10-19 12:03:55.350
2 1 12:44 2 12:48 2016-10-19 12:44:48.813
so First timebreak spent is 10 minutes and second is 4 minutes.
I want to display this record in gridview in same row like that..
StarofDay BreakIn BreakOut BreakSpent BreakIn BreakOut BreakSpent OutTime TimeSpent
12:52PM 12:03 12:13 00:10 12:44 12:48 00:04 4:21PM 03:15
Sub Total 03:15
Grand Total 03:15
how can we get this kind output in gridview .
What I have tried:
CONVERT(varchar(5),ISNULL(DATEADD(minute, DATEDIFF(minute, AttendanceTimeIn, ISNULL(AttendanceTimeOut,SWITCHOFFSET(SYSDATETIMEOFFSET(), ''+05:30''))), 0),0)-
ISNULL(DATEADD(minute, DATEDIFF(minute, breakTimeIn, ISNULL(breakTimeOut,SWITCHOFFSET(SYSDATETIMEOFFSET(), ''+05:30''))), 0),0) AS [TimeSpentWork],
DATEDIFF(minute, AttendanceTimeIn, ISNULL(AttendanceTimeOut,SWITCHOFFSET(SYSDATETIMEOFFSET(), ''+05:30'')))-
ISNULL(DATEDIFF(minute, breakTimeIn, ISNULL(breakTimeOut,SWITCHOFFSET(SYSDATETIMEOFFSET(), ''+05:30''))),0) ) AS [TimeSpentMinutesWork]