view [dbo].[CT_PF_OperationTimeRecordingSelectQueryRSC] as 
SELECT t2.DocNum, t1.U_OprCode, t3.U_OprName, t0.U_OprSequence, t1.U_RscCode, t4.U_RscName, t0.DocEntry, t1.U_LineNum, t1.U_RunTime, t1.U_StockTime, t1.U_SetupTime, 
               t1.U_QueueTime, Case t1.U_RunRate when  'FS'then 1 when 'FM'then 1 when  'FH'then 1 else  t1.U_NrOfResources end [U_NrOfResources],t1.U_RunTotal, t1.U_StockTotal, t1.U_SetupTotal, t1.U_QueueTotal, t1.U_Project, t1.U_OcrCode, t1.U_OcrCode2, t1.U_OcrCode3, t1.U_OcrCode4, t1.U_OcrCode5, t1.U_Qty
FROM  dbo.[@CT_PF_MOR12] AS t0 INNER JOIN
               dbo.[@CT_PF_MOR16] AS t1 ON t0.DocEntry = t1.DocEntry AND t0.U_RtgOprCode = t1.U_RtgOprCode AND t0.U_RtgCode = t1.U_RtgCode INNER JOIN
               dbo.[@CT_PF_OMOR] AS t2 ON t0.DocEntry = t2.DocEntry INNER JOIN
               dbo.[@CT_PF_OOPR] AS t3 ON t0.U_OprCode = t3.U_OprCode INNER JOIN
               dbo.[@CT_PF_ORSC] AS t4 ON t1.U_RscCode = t4.U_RscCode
WHERE (t2.U_Status IN ('ST', 'RL')) AND (t0.U_Status IN ('NS', 'ST', 'HO')) AND (t4.U_RscType<> N'T') and t1.U_Active='Y' and isnull(t1."U_TotalSeconds",0)>0