You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
3.6 KiB

  1. ------------------------------------
  2. --(u_0R[SO[av~Oo`
  3. --yv Ty
  4. --f
  5. --e2014/7/9 NHS 07:05:11
  6. ------------------------------------
  7. ALTER PROCEDURE [dbo].[OSP_OTB_Rpt_GetPrjWorkhoursInfoRpt]
  8. @ProjectNumber VARCHAR(MAX) ,
  9. @MemberID VARCHAR(MAX) ,
  10. @OrganizationID VARCHAR(50) ,
  11. @DateStart VARCHAR(50) ,
  12. @DateEnd VARCHAR(50)
  13. AS
  14. SELECT ROW_NUMBER() OVER ( ORDER BY StartDate ) AS RowID ,
  15. CONVERT(VARCHAR(100), StartDate, 111) AS CreateDate ,
  16. SUBSTRING(CONVERT(VARCHAR(100), StartDate, 24), 0, 6) + '~'
  17. + SUBSTRING(CONVERT(VARCHAR(100), EndDate, 24), 0, 6) AS DateFromTo ,
  18. dbo.OFN_SYS_ArgumentValueByArgumentID(Worktype, 'DayWorkTP') AS WorktypeName ,
  19. [description] ,
  20. [Subject] ,
  21. dbo.OFN_SYS_ArgumentValueByArgumentID(Worktype, 'DayWorkTP') AS Worktype ,
  22. ROUND(( DATEDIFF(MINUTE, StartDate, EndDate) / 60.0 ), 2) AS InfoHours ,
  23. CASE ISNULL(dbo.OFN_SYS_ProjectNameByProjectNumber(dw.ProjectNumber),
  24. '')
  25. WHEN '' THEN N'0vQ�N0(^�\Hh)'
  26. ELSE ISNULL(dbo.OFN_SYS_ProjectNameByProjectNumber(dw.ProjectNumber),
  27. '')
  28. END AS PrjName ,
  29. dbo.OFN_SYS_MemberNameByMemberID(dw.UserID, dw.OrganizationID) AS UserName
  30. FROM dbo.OTB_MNG_DayWork AS dw
  31. WHERE ( CHARINDEX(ProjectNumber, @ProjectNumber) > 0
  32. OR @ProjectNumber = ''
  33. )
  34. AND CHARINDEX(CreateUser, @MemberID) > 0
  35. AND ( StartDate >= @DateStart
  36. OR @DateStart = ''
  37. )
  38. AND ( EndDate <= @DateEnd
  39. OR @DateEnd = ''
  40. )
  41. AND OrganizationID = @OrganizationID
  42. ORDER BY CreateDate ,
  43. StartDate