Class: TypesMaster

Inherits:
ApplicationRecord show all
Defined in:
app/models/types_master.rb

Constant Summary collapse

PAYROLL_FREQUENCIES =
{
  BY_WEEKLY_TYPE: '02'
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

define_decrypted_attribute, define_decrypted_attributes, #errors_in_bullet_points, primary_connection, special_connection

Class Method Details

.by_weekly_payroll_frequencyObject



22
23
24
# File 'app/models/types_master.rb', line 22

def by_weekly_payroll_frequency
  payroll_frequencies.find_by!(type: PAYROLL_FREQUENCIES[:BY_WEEKLY_TYPE])
end

.contact_categoriesObject



44
45
46
47
48
# File 'app/models/types_master.rb', line 44

def contact_categories
  where(element: 'Contact Position')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

.federal_tax_codesObject



32
33
34
35
36
# File 'app/models/types_master.rb', line 32

def federal_tax_codes
  where(element: 'Federal Tax Description')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

.gov_remittance_frequencyObject



56
57
58
59
60
# File 'app/models/types_master.rb', line 56

def gov_remittance_frequency
  where(element: 'Govt Remittance Frequency')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

.industry_sectorsObject



50
51
52
53
54
# File 'app/models/types_master.rb', line 50

def industry_sectors
  where(element: 'industry sector')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

.payroll_frequenciesObject



16
17
18
19
20
# File 'app/models/types_master.rb', line 16

def payroll_frequencies
  where(element: 'Payroll Frequency')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

.provincial_tax_codesObject



38
39
40
41
42
# File 'app/models/types_master.rb', line 38

def provincial_tax_codes
  where(element: 'Quebec Tax Codes')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

.termination_reasonsObject



26
27
28
29
30
# File 'app/models/types_master.rb', line 26

def termination_reasons
  where(element: 'Termination Reason')
    .select(:types_id, :type, :type_description, :description_french)
    .order(sort_order: :asc)
end

Instance Method Details

#type_descriptionObject



11
12
13
# File 'app/models/types_master.rb', line 11

def type_description
  I18n.locale == :fr ? description_french : attributes['type_description']
end