Class: Mindee::Product::FR::Payslip::PayslipV2PayDetail

Inherits:
Mindee::Parsing::Standard::FeatureField show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb

Overview

Detailed information about the pay.

Instance Attribute Summary collapse

Attributes inherited from Mindee::Parsing::Standard::AbstractField

#bounding_box, #confidence, #page_id, #polygon

Instance Method Summary collapse

Methods inherited from Mindee::Parsing::Standard::FeatureField

#format_for_display

Methods inherited from Mindee::Parsing::Standard::AbstractField

array_confidence, array_sum, float_to_string

Constructor Details

#initialize(prediction, page_id) ⇒ PayslipV2PayDetail



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 45

def initialize(prediction, page_id)
  super
  @gross_salary = prediction['gross_salary']
  @gross_salary_ytd = prediction['gross_salary_ytd']
  @income_tax_rate = prediction['income_tax_rate']
  @income_tax_withheld = prediction['income_tax_withheld']
  @net_paid = prediction['net_paid']
  @net_paid_before_tax = prediction['net_paid_before_tax']
  @net_taxable = prediction['net_taxable']
  @net_taxable_ytd = prediction['net_taxable_ytd']
  @total_cost_employer = prediction['total_cost_employer']
  @total_taxes_and_deductions = prediction['total_taxes_and_deductions']
  @page_id = page_id
end

Instance Attribute Details

#gross_salaryFloat (readonly)

The gross salary of the employee.



14
15
16
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 14

def gross_salary
  @gross_salary
end

#gross_salary_ytdFloat (readonly)

The year-to-date gross salary of the employee.



17
18
19
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 17

def gross_salary_ytd
  @gross_salary_ytd
end

#income_tax_rateFloat (readonly)

The income tax rate of the employee.



20
21
22
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 20

def income_tax_rate
  @income_tax_rate
end

#income_tax_withheldFloat (readonly)

The income tax withheld from the employee's pay.



23
24
25
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 23

def income_tax_withheld
  @income_tax_withheld
end

#net_paidFloat (readonly)

The net paid amount of the employee.



26
27
28
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 26

def net_paid
  @net_paid
end

#net_paid_before_taxFloat (readonly)

The net paid amount before tax of the employee.



29
30
31
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 29

def net_paid_before_tax
  @net_paid_before_tax
end

#net_taxableFloat (readonly)

The net taxable amount of the employee.



32
33
34
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 32

def net_taxable
  @net_taxable
end

#net_taxable_ytdFloat (readonly)

The year-to-date net taxable amount of the employee.



35
36
37
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 35

def net_taxable_ytd
  @net_taxable_ytd
end

#total_cost_employerFloat (readonly)

The total cost to the employer.



38
39
40
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 38

def total_cost_employer
  @total_cost_employer
end

#total_taxes_and_deductionsFloat (readonly)

The total taxes and deductions of the employee.



41
42
43
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 41

def total_taxes_and_deductions
  @total_taxes_and_deductions
end

Instance Method Details

#printable_valuesHash



61
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
94
95
96
97
98
99
100
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 61

def printable_values
  printable = {}
  printable[:gross_salary] =
    @gross_salary.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@gross_salary)
  printable[:gross_salary_ytd] =
    @gross_salary_ytd.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@gross_salary_ytd)
  printable[:income_tax_rate] =
    @income_tax_rate.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@income_tax_rate)
  printable[:income_tax_withheld] =
    if @income_tax_withheld.nil?
      ''
    else
      Parsing::Standard::BaseField.float_to_string(@income_tax_withheld)
    end
  printable[:net_paid] =
    @net_paid.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@net_paid)
  printable[:net_paid_before_tax] =
    if @net_paid_before_tax.nil?
      ''
    else
      Parsing::Standard::BaseField.float_to_string(@net_paid_before_tax)
    end
  printable[:net_taxable] =
    @net_taxable.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@net_taxable)
  printable[:net_taxable_ytd] =
    @net_taxable_ytd.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@net_taxable_ytd)
  printable[:total_cost_employer] =
    if @total_cost_employer.nil?
      ''
    else
      Parsing::Standard::BaseField.float_to_string(@total_cost_employer)
    end
  printable[:total_taxes_and_deductions] =
    if @total_taxes_and_deductions.nil?
      ''
    else
      Parsing::Standard::BaseField.float_to_string(@total_taxes_and_deductions)
    end
  printable
end

#to_sString



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb', line 103

def to_s
  printable = printable_values
  out_str = String.new
  out_str << "\n  :Gross Salary: #{printable[:gross_salary]}"
  out_str << "\n  :Gross Salary YTD: #{printable[:gross_salary_ytd]}"
  out_str << "\n  :Income Tax Rate: #{printable[:income_tax_rate]}"
  out_str << "\n  :Income Tax Withheld: #{printable[:income_tax_withheld]}"
  out_str << "\n  :Net Paid: #{printable[:net_paid]}"
  out_str << "\n  :Net Paid Before Tax: #{printable[:net_paid_before_tax]}"
  out_str << "\n  :Net Taxable: #{printable[:net_taxable]}"
  out_str << "\n  :Net Taxable YTD: #{printable[:net_taxable_ytd]}"
  out_str << "\n  :Total Cost Employer: #{printable[:total_cost_employer]}"
  out_str << "\n  :Total Taxes and Deductions: #{printable[:total_taxes_and_deductions]}"
  out_str
end