Class: PayrollRunService
- Inherits:
-
Object
- Object
- PayrollRunService
- Defined in:
- app/services/payroll_run_service.rb
Instance Attribute Summary collapse
-
#company_id ⇒ Object
readonly
Returns the value of attribute company_id.
Instance Method Summary collapse
- #create_or_find_transaction_header_id ⇒ Object
-
#initialize(company_id:) ⇒ PayrollRunService
constructor
A new instance of PayrollRunService.
- #period_options ⇒ Object
- #recompute_transaction_header ⇒ Object
- #reopen_transaction_header_for_review ⇒ Object
- #review_transaction_header ⇒ Object
- #transaction_header_related_records ⇒ Object
- #transaction_header_summary ⇒ Object
- #unlock_transaction_detail ⇒ Object
Constructor Details
#initialize(company_id:) ⇒ PayrollRunService
Returns a new instance of PayrollRunService.
4 5 6 |
# File 'app/services/payroll_run_service.rb', line 4 def initialize(company_id:) @company_id = company_id end |
Instance Attribute Details
#company_id ⇒ Object (readonly)
Returns the value of attribute company_id.
2 3 4 |
# File 'app/services/payroll_run_service.rb', line 2 def company_id @company_id end |
Instance Method Details
#create_or_find_transaction_header_id ⇒ Object
43 44 |
# File 'app/services/payroll_run_service.rb', line 43 def create_or_find_transaction_header_id end |
#period_options ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/services/payroll_run_service.rb', line 8 def result = ActiveRecord::Base.execute_procedure( 'pr_run_and_schedule_payroll_step_1', company.company_id )[0] open_period_id = result['CurrentOpenPayrollPeriodId'] next_period_id = result['Next_Payroll_Period_Id'] open_period next_period grouped_payroll_periods default_payroll_period company_name default_hours_per_week period_id = [open_period_id, next_period_id, company.current_payroll_period_id].find { |id| id != 0 } period_option = open_period_id == 0 ? 'next_period' : 'open_period' period_info = PayrollPeriod .find_by(payroll_period_id: period_id) &.wizard_info(option: period_option) periods_with_timesheets = company.payroll_periods_data(must_have_timesheet: true, no_future: true) grouped_payroll_periods = Company.group_payroll_periods_by_year(periods_with_timesheets) default_payroll_period = periods_with_timesheets.first result.merge( grouped_payroll_periods: grouped_payroll_periods, default_payroll_period: default_payroll_period, company_name: company.company_name_e, default_hours_per_week: company.default_hours_per_week, period_option => period_info ) end |
#recompute_transaction_header ⇒ Object
49 50 |
# File 'app/services/payroll_run_service.rb', line 49 def recompute_transaction_header end |
#reopen_transaction_header_for_review ⇒ Object
61 62 |
# File 'app/services/payroll_run_service.rb', line 61 def reopen_transaction_header_for_review end |
#review_transaction_header ⇒ Object
58 59 |
# File 'app/services/payroll_run_service.rb', line 58 def review_transaction_header end |
#transaction_header_related_records ⇒ Object
46 47 |
# File 'app/services/payroll_run_service.rb', line 46 def end |
#transaction_header_summary ⇒ Object
52 53 |
# File 'app/services/payroll_run_service.rb', line 52 def transaction_header_summary end |
#unlock_transaction_detail ⇒ Object
55 56 |
# File 'app/services/payroll_run_service.rb', line 55 def unlock_transaction_detail end |