Class: PayrollReconciliationController
Instance Method Summary
collapse
#base64_attachments_to_files, #base64_with_filename_to_files
#accessible_company_ids_from_tenant_and_user, #application_mode_from_hostname, #current_company_id_from_accessible_company_ids, #current_tenant_from_user, #current_user_and_locale_from_token
Instance Method Details
#files ⇒ Object
54
55
56
57
58
59
60
|
# File 'app/controllers/payroll_reconciliation_controller.rb', line 54
def files
batch_id = params[:id].to_i
@files = PayrollReconciliation.get_files(
batch_id: batch_id
)
render json: @files, status: :ok
end
|
#index ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/payroll_reconciliation_controller.rb', line 7
def index
year = params[:year]
@reconciliations = PayrollReconciliation.find(
result_type: 'S',
year: year,
batch_id: 0
)
render json: @reconciliations, status: :ok
end
|
#pds_breakdown ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'app/controllers/payroll_reconciliation_controller.rb', line 95
def pds_breakdown
batch_id = params[:id].to_i
= params[:payroll_transaction_header_id]
company_id = params[:company_id]
@pds_breakdown = PayrollReconciliation.get_pds_breakdown(
batch_id: batch_id,
payroll_transaction_header_id: ,
company_id: company_id
)
render json: @pds_breakdown, status: :ok
end
|
#remove_payroll ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'app/controllers/payroll_reconciliation_controller.rb', line 62
def remove_payroll
payroll_batch_id = params[:payroll_batch_id]
payroll_stage = '04'
deletion_reason_description = params[:deletion_reason_description]
user = current_user.user_name
subject = params[:subject]
base_64_attachments = params[:base64_attachments] || []
company = if current_user.system_record
Company.find_by(company_id: params[:company_id]) || current_company
else
current_company
end
attachments = base64_attachments_to_files(base_64_attachments)
PayrollReconciliation.remove_payroll(
payroll_batch_id: payroll_batch_id,
payroll_stage: payroll_stage,
deletion_reason_description: deletion_reason_description,
user: user
)
data = ZendeskApiService.new(company: company).create_ticket_with_cc(
cc_users: company.cfo_users,
subject: subject,
description: deletion_reason_description,
uploads: attachments,
priority: params[:priority] || 'normal'
)
render json: { message: 'Payroll removed successfully' }, status: :ok
end
|
#show ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/payroll_reconciliation_controller.rb', line 19
def show
year = params[:year]
batch_id = params[:id].to_i
@reconciliation_summary = PayrollReconciliation.find(
result_type: 'S',
year: year,
batch_id: batch_id
).first
@reconciliation_details = PayrollReconciliation.find(
result_type: 'D',
year: year,
batch_id: batch_id
)
render json: {
summary: @reconciliation_summary,
details: @reconciliation_details
}, status: :ok
end
|
#summary ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/payroll_reconciliation_controller.rb', line 41
def summary
year = params[:year]
batch_id = params[:id].to_i
@reconciliation_summary = PayrollReconciliation.find(
result_type: 'S',
year: year,
batch_id: batch_id
).first
render json: @reconciliation_summary, status: :ok
end
|