Class: EmployeeTimesheet

Inherits:
ApplicationRecord show all
Includes:
EmployeeTimesheetsProcedures
Defined in:
app/models/employee_timesheet.rb

Overview

Represents a timesheet entry for an employee.

Defined Under Namespace

Classes: View

Instance Method Summary collapse

Methods included from EmployeeTimesheetsProcedures

#insert_or_update_procedure!

Methods inherited from ApplicationRecord

define_decrypted_attribute, define_decrypted_attributes, #errors_in_bullet_points, primary_connection, special_connection

Instance Method Details

#within_unlocked_period?Boolean

Checks if the timesheet entry is within an unlocked payroll period.

Examples:

timesheet.within_unlocked_period?

Returns:

  • (Boolean)

    true if the timesheet entry is within an unlocked payroll period, false otherwise



33
34
35
36
37
38
39
# File 'app/models/employee_timesheet.rb', line 33

def within_unlocked_period?
  company = employee.company
  period = company.payroll_period_for_date(transaction_date)
  return true if period.nil?

  period.unlocked?
end