Class: SalariesController

Inherits:
AuthorizedController
  • Object
show all
Defined in:
app/controllers/salaries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



34
35
36
37
38
39
# File 'app/controllers/salaries_controller.rb', line 34

def create
  @salary = Salary.new(params[:salary])
  @salary.build_booking

  create!
end

#newObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/salaries_controller.rb', line 14

def new
  # Allow pre-seeding some parameters
  salary_params = {
    :customer_id    => current_tenant.company.id,
    :state          => 'booked',
    :duration_from  => Date.today,
    :duration_to    => Date.today.in(30.days).to_date
  }

  # Set default parameters
  salary_params.merge!(params[:salary]) if params[:salary]

  @salary = Salary.new(salary_params)

  # Prebuild an empty attachment instance
  @salary.attachments.build

  new!
end

#payslipObject



41
42
43
# File 'app/controllers/salaries_controller.rb', line 41

def payslip
  show!
end

#statisticsObject

Actions



10
11
12
# File 'app/controllers/salaries_controller.rb', line 10

def statistics
  index!
end