Class: BudgetPersonnelObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, Foundry, Navigation, StringFactory, Utilities
Defined in:
lib/kuality-coeus/data_objects/budget/personnel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#get, #make_role, #make_user, #random_percentage, #set, #snake_case

Methods included from Navigation

#doc_search, #fill_out, #fill_out_item, #on_document?, #on_page?, #open_document, #window_cleanup

Constructor Details

#initialize(browser, opts = {}) ⇒ BudgetPersonnelObject

TODO: Add more variables here - “apply inflation”, “submit cost sharing”, etc.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 16

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      # Note: 'type' must be one of:
      # 'employee', 'non_employee', or 'to_be_named'
      type:             'employee',
      base_salary:      random_dollar_value(1000000),
      appointment_type: '12M DURATION',
      object_code_name: '::random::',
      percent_effort:   random_percentage,
      period_type:      '::random::'
  }

  set_options(defaults.merge(opts))
  @percent_charged ||= (@percent_effort.to_f/2).round(2)
end

Instance Attribute Details

#appointment_typeObject

Returns the value of attribute appointment_type.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def appointment_type
  @appointment_type
end

#base_salaryObject

Returns the value of attribute base_salary.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def base_salary
  @base_salary
end

#calculated_fringeObject

Returns the value of attribute calculated_fringe.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def calculated_fringe
  @calculated_fringe
end

#end_dateObject

Returns the value of attribute end_date.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def end_date
  @end_date
end

#job_codeObject

Returns the value of attribute job_code.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def job_code
  @job_code
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def name
  @name
end

#object_code_nameObject

Returns the value of attribute object_code_name.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def object_code_name
  @object_code_name
end

#percent_chargedObject

Returns the value of attribute percent_charged.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def percent_charged
  @percent_charged
end

#percent_effortObject

Returns the value of attribute percent_effort.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def percent_effort
  @percent_effort
end

#period_typeObject

Returns the value of attribute period_type.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def period_type
  @period_type
end

#requested_salaryObject

Returns the value of attribute requested_salary.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def requested_salary
  @requested_salary
end

#salary_anniversary_dateObject

Returns the value of attribute salary_anniversary_date.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def salary_anniversary_date
  @salary_anniversary_date
end

#salary_effective_dateObject

Returns the value of attribute salary_effective_date.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def salary_effective_date
  @salary_effective_date
end

#start_dateObject

Returns the value of attribute start_date.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def start_date
  @start_date
end

#typeObject

Returns the value of attribute type.



9
10
11
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 9

def type
  @type
end

Instance Method Details

#createObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/kuality-coeus/data_objects/budget/personnel.rb', line 34

def create
  # Navigation is handled by the BudgetVersionsObject method
  if on(Personnel).job_code(@name).present?
    # The person is already listed so do nothing
  else
    get_person
  end
  set_job_code
  on Personnel do |page|
    @salary_effective_date ||= page.salary_effective_date(@name).value
    fill_out_item @name, page, :appointment_type, :base_salary, :salary_effective_date,
                  :salary_anniversary_date
    page.save
    page.expand_all
    page.person.select "#{@name} - #{@job_code}"
    sleep 1 # this is required because the select list contains get updated when the person is selected.
    page.object_code_name.pick! @object_code_name
    page.add_details
    page.expand_all
    set_dates page
    fill_out_item @name, page, :percent_effort, :percent_charged, :period_type
    page.calculate @name
    @requested_salary=page.requested_salary @name
    @calculated_fringe=page.calculated_fringe @name
    page.save
  end
end