在rdlc中需要时间总和的帮助

时间:2011-11-25 04:42:48

标签: reporting rdlc

我正在研究考勤管理系统。 在我的项目中,我想在每日报告中显示员工的总工作时间。

在我的数据库表中,我已经计算了每位员工的工作时间。 现在我想显示报告底部每个条目的总工作时间。

e.g

EmployeeId EmployeeName  WorkedHours
1             ABC        04:00:25
2             XYZ        07:23:01
3             PQR        11:02:15

所以我想在RDLC报告结尾处显示所有3名员工的总数。

喜欢总计:22:25:42

请让我知道如何实现它?

4 个答案:

答案 0 :(得分:1)

您只需在“WorkedHours”列的页脚行中添加=Sum(Fields!WorkedHours.Value)

请参阅MSDN中的链接http://msdn.microsoft.com/en-us/library/ms252113(v=vs.80).aspx

答案 1 :(得分:0)

你可以使用TimeStamp类和Sum函数, 举个例子:

  

= TimeSpan.FromMinutes(萨姆(字段!Dirigindo.Value))

答案 2 :(得分:0)

试一试,看看它是否有效

=(SUM(Cint(Split(Fields!WORKEDHOUR.value,":").GetValue(0))) + (SUM(Cint(Split(Fields!WORKEDHOUR.Value,":").GetValue(1))) + Sum(Cint(split(Fields!WORKEDHOUR.Value,":").GetValue(2)))\60)\60 ).ToString + ":" + ((SUM(Cint(Split(Fields!WORKEDHOUR.Value,":").GetValue(1))) + Sum(Cint(split(Fields!WORKEDHOUR.Value,":").GetValue(2)))\60) Mod 60).ToString + ":" + (Sum(Cint(split(Fields!WORKEDHOUR.Value,":").GetValue(2))) Mod 60).ToString

答案 3 :(得分:0)

        Facing the same issue here is your final answer.

    Step1: Go to your textbox expression and past below code
 =Code.MinutesToHoursMinutes(SUM(Hour(Fields!TTShortTime.Value)*60)+SUM(Minute(Fields!TTShortTime.Value)))    

        Step2: Goto your rdlc report properties => Tab Code, Here past below function       
        Function MinutesToHoursMinutes(ByVal vMins As Integer) As String
        Dim Mins As Integer
        Dim Hours As Integer
        vMins = IIF(vMins <= 0, 0, vMins)
        Hours = Floor(vMins / 60)
        Mins = vMins - (Hours * 60)
        MinutesToHoursMinutes = IIF(Hours < 9, "0" & CStr(Hours), CStr(Hours)) & ":" & IIF(Mins < 9, "0" & 
        CStr(Mins), CStr(Mins))
        Return MinutesToHoursMinutes
        End Function


    Here in Step1 we get hours and convert it into minutes then get minutes and sum with hour calculated minutes.
    then passes it to function which returns string format like hh:mm
相关问题