Class: HrLite::EmployeeProfile

Inherits:
ApplicationRecord show all
Includes:
Audited, EncryptedMoney
Defined in:
app/models/hr_lite/employee_profile.rb

Overview

Statutory identity + employment window. PII columns are encrypted at rest; masked readers feed the employee-facing view (full values render only in the leadership edit form). Records are never destroyed — exits are a date, payroll history is a statutory record.

Constant Summary collapse

TAX_REGIMES =
%w[new old].freeze

Constants included from Audited

Audited::REDACTED, Audited::SKIPPED_ATTRIBUTES

Instance Method Summary collapse

Instance Method Details

#active_on?(date) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/models/hr_lite/employee_profile.rb', line 33

def active_on?(date)
  date_of_joining <= date && (date_of_exit.nil? || date_of_exit >= date)
end

#employment_range_in(month) ⇒ Object



37
38
39
40
41
# File 'app/models/hr_lite/employee_profile.rb', line 37

def employment_range_in(month)
  from = [ date_of_joining, month.beginning_of_month ].max
  to = [ date_of_exit || month.end_of_month, month.end_of_month ].min
  from <= to ? (from..to) : nil
end

#masked_accountObject



47
48
49
50
# File 'app/models/hr_lite/employee_profile.rb', line 47

def 
  value = 
  value.blank? ? nil : "•••• #{value.last(4)}"
end

#masked_panObject



43
44
45
# File 'app/models/hr_lite/employee_profile.rb', line 43

def masked_pan
  mask_middle(pan_number)
end

#masked_uanObject



52
53
54
# File 'app/models/hr_lite/employee_profile.rb', line 52

def masked_uan
  mask_middle(pf_uan)
end