Dashboard MFG100 Job Ops \ Operations Management and Production Management Queries

JO \ OM and PM require different statements.

This one is for JobOps

SELECT  MD_HDR_S2 as 'Dilution', MD_HDR_S2 as 'DilutionMethod', BatchNo, LastName+', '+FirstName AS 'Employee Name', SalesOrderNo+'-'+WTNumber+'-'+WTStep AS 'Work Ticket', ActivityCode AS 'E_Activity Code', DepartmentWorkedIn AS 'E_Department Worked In', StatusCode AS 'E_Status Code', TransactionQuantity AS 'E_Quantity Completed', StartDate AS 'E_Start Date', StartTime AS 'E_Start Time', EndDate AS 'E_End Date', EndTime AS 'E_End Time', '' AS 'Total Hours', HoursWorked, BC_Header.HeaderKey, BC_Header.UserID, DetailKey  FROM { OJ BC_Header LEFT JOIN BC_Detail ON BC_Header.SessionKey = BC_Detail.SessionKey AND BC_Header.UserID = BC_Detail.UserID AND BC_Header.HeaderKey = BC_Detail.HeaderKey }, JT_Employee WHERE JT_Employee.EmployeeNo = BC_Header.EmployeeNo AND JT_Employee.DepartmentNo = BC_Header.EmployeeDeptNo AND BCTransactionCode = '73' AND Processing < '2'  

This one is Processing of Labor entry for PM

SELECT EmployeeDeptNo, JT_Employee.EmployeeNo, MD_HDR_S2 as 'Dilution', MD_HDR_S2 as 'DilutionMethod', LastName+', '+FirstName AS 'Employee Name',  BatchNo,   WTNumber+'-'+WTStep AS 'Work Ticket', ActivityCode AS 'E_Activity Code', DepartmentWorkedIn AS 'E_Department Worked In', StatusCode AS 'E_Status Code', TransactionQuantity AS 'E_Quantity Completed', MD_Line_S5 AS 'E_Comment', StartDate AS 'E_Start Date', StartTime AS 'E_Start Time', EndDate AS 'E_End Date', EndTime AS 'E_End Time', '' AS 'Total Hours', HoursWorked, BC_Header.HeaderKey, BC_Header.UserID, DetailKey  FROM { OJ BC_Header LEFT JOIN BC_Detail ON BC_Header.SessionKey = BC_Detail.SessionKey AND BC_Header.UserID = BC_Detail.UserID AND BC_Header.HeaderKey = BC_Detail.HeaderKey }, JT_Employee WHERE JT_Employee.EmployeeNo = BC_Header.EmployeeNo AND JT_Employee.DepartmentNo = BC_Header.EmployeeDeptNo AND BCTransactionCode = '73' AND Processing < '2'