2011-11-25 90 views
1

我正在考勤管理系統上工作。 在我的項目中,我想在日常報告中顯示員工的總工作時間。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秒

請讓我知道我怎麼能實現呢?

回答

1

您只需在「WorkedHours」列的腳註行中添加=Sum(Fields!WorkedHours.Value)即可。

請參閱MSDN中的鏈接http://msdn.microsoft.com/en-us/library/ms252113(v=vs.80).aspx

+0

但我的數據類型是字符串column..as其值包含'02:05:00' 型.. –

+0

併爲那些誰是不存在的這些列中包含的工作小時Null值.. –

+0

在這種情況下,我認爲你只需要在sql查詢中進行總計計算,並將總計總和作爲另一列「總計」與現有3列一起返回,然後在頁腳行中將此列用作=(Fields!Total.Value) – pramodtech

0

您可以使用時間戳類GETHER與Sum函數, 的榜樣!

= TimeSpan.FromMinutes(總和(場Dirigindo.Value) )

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 
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