def index employee_reports Output joins employee joins output_products

1
2
3
def index
@employee_reports = Output.joins(:employee).joins(:output_products).where('extract(month from date) = ? and extract(year from date) = ?', @month, @year).group(:employee_id, :first_name, :last_name, :middle_name).select('employees.first_name as fname, employees.last_name as lname, employees.middle_name as mname, SUM(salary) AS salary, SUM(work_time) AS time')
end