Class: SalaryReportsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SalaryReportsController
- Defined in:
- app/controllers/salary_reports_controller.rb
Instance Method Summary collapse
- #salary_declaration ⇒ Object
-
#yearly_ahv_statement ⇒ Object
Actions =======.
Instance Method Details
#salary_declaration ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/salary_reports_controller.rb', line 13 def salary_declaration @value_period = Date.parse(params[:by_value_period][:from] || Date.today.beginning_of_year)..Date.parse(params[:by_value_period][:to] || Date.today.end_of_year) if params[:by_value_period] @value_period ||= Date.today.beginning_of_year..Date.today.end_of_year @employee = Employee.find(params[:employee_id]) @salaries = @employee.salaries.where(:value_date => @value_period) @line_items = @salaries.collect{|salary| salary.line_items}.flatten # TODO: better sorting @salary_declaration_codes = SalaryBookingTemplate.pluck(:salary_declaration_code).uniq.select{|code| code.present?} end |
#yearly_ahv_statement ⇒ Object
Actions
6 7 8 9 10 11 |
# File 'app/controllers/salary_reports_controller.rb', line 6 def yearly_ahv_statement @value_period = Date.parse(params[:by_value_period][:from] || Date.today.beginning_of_year)..Date.parse(params[:by_value_period][:to] || Date.today.end_of_year) if params[:by_value_period] @value_period ||= Date.today.beginning_of_year..Date.today.end_of_year @employments = Employment.valid_during(@value_period).all end |