Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add super, leave and more to payroll #233

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/xeroizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
require 'xeroizer/models/tracking_category_child'
require 'xeroizer/models/journal_line_tracking_category'

require 'xeroizer/models/payroll/earnings_line'
require 'xeroizer/models/payroll/deduction_line'
require 'xeroizer/models/payroll/super_line'
require 'xeroizer/models/payroll/reimbursement_line'
require 'xeroizer/models/payroll/leave_line'
require 'xeroizer/models/payroll/pay_template'

require 'xeroizer/models/payroll/tax_declaration'
require 'xeroizer/models/payroll/home_address'
require 'xeroizer/models/payroll/bank_account'
Expand Down
29 changes: 29 additions & 0 deletions lib/xeroizer/models/payroll/deduction_line.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module Xeroizer
module Record
module Payroll

class DeductionLineModel < PayrollBaseModel

end

class DeductionLine < PayrollBase

DEDUCTION_TYPE_CALCULATION_TYPE = {
'FIXEDAMOUNT' => '',
'PRETAX' => '',
'POSTTAX' => ''
} unless defined?(DEDUCTION_TYPE_CALCULATION_TYPE)

guid :deduction_type_id, :api_name => 'DeductionTypeID'
string :calculation_type

decimal :percentage
decimal :amount

validates_presence_of :earning_rate_id, :calculation_type, :unless => :new_record?
validates_inclusion_of :calculation_type, :in => DEDUCTION_TYPE_CALCULATION_TYPE
end

end
end
end
31 changes: 31 additions & 0 deletions lib/xeroizer/models/payroll/earnings_line.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module Xeroizer
module Record
module Payroll

class EarningsLineModel < PayrollBaseModel

end

class EarningsLine < PayrollBase

EARNINGS_RATE_CALCULATION_TYPE = {
'USEEARNINGSRATE' => 'Use the rate per unit recorded for the earnings rate under Settings',
'ENTEREARNINGSRATE' => 'The rate per unit is be added manually to the earnings line',
'ANNUALSALARY' => 'If the employee receives a salary, the annual salary amount and units of work per week are added to the earnings line'
} unless defined?(EARNINGS_RATE_CALCULATION_TYPE)

guid :earning_rate_id, :api_name => 'EarningsRateID'
string :calculation_type

decimal :number_of_units_per_week
decimal :annual_salary
decimal :rate_per_unit
decimal :normal_number_of_units

validates_presence_of :earning_rate_id, :calculation_type, :unless => :new_record?
validates_inclusion_of :calculation_type, :in => EARNINGS_RATE_CALCULATION_TYPE
end

end
end
end
1 change: 1 addition & 0 deletions lib/xeroizer/models/payroll/employee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Employee < PayrollBase

has_one :home_address, :internal_name_singular => "home_address", :model_name => "HomeAddress"
has_one :tax_declaration, :internal_name_singular => "tax_declaration", :model_name => "TaxDeclaration"
has_one :pay_template, :internal_name_singular => "pay_template", :model_name => "PayTemplate"
has_many :bank_accounts

validates_presence_of :first_name, :last_name, :unless => :new_record?
Expand Down
30 changes: 30 additions & 0 deletions lib/xeroizer/models/payroll/leave_line.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module Xeroizer
module Record
module Payroll

class LeaveLineModel < PayrollBaseModel

end

class LeaveLine < PayrollBase

LEAVE_TYPE_CALCULATION_TYPE = {
'FIXEDAMOUNTEACHPERIOD' => 'You can enter a manually calculated rate for the accrual, accrue a fixed amount of leave each pay period based on an annual entitlement (for example, if you pay your employees monthly, you would accrue 1/12th of their annual entitlement each month), or accrue an amount relative to the number of hours an employee worked in the pay period',
'ENTERRATEINPAYTEMPLATE' => '',
'BASEDONORDINARYEARNINGS' => ''
} unless defined?(LEAVE_TYPE_CALCULATION_TYPE)

guid :leave_type_id, :api_name => 'LeaveTypeID'
string :calculation_type

decimal :annual_number_of_units
decimal :full_time_number_of_units_per_period
decimal :number_of_units

validates_presence_of :leave_type_id, :calculation_type, :unless => :new_record?
validates_inclusion_of :contribution_type, :in => LEAVE_TYPE_CALCULATION_TYPE
end

end
end
end
21 changes: 21 additions & 0 deletions lib/xeroizer/models/payroll/pay_template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Xeroizer
module Record
module Payroll

class PayTemplateModel < PayrollBaseModel

end

class PayTemplate < PayrollBase

has_many :earnings_lines
has_many :deduction_lines
has_many :super_lines
has_many :reimbursement_lines
has_many :leave_lines

end

end
end
end
21 changes: 21 additions & 0 deletions lib/xeroizer/models/payroll/reimbursement_line.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Xeroizer
module Record
module Payroll

class ReimbursementLineModel < PayrollBaseModel

end

class ReimbursementLine < PayrollBase

guid :reimbursement_type_id, :api_name => 'ReimbursementTypeID'

string :description
decimal :amount

validates_presence_of :reimbursement_type_id, :unless => :new_record?
end

end
end
end
40 changes: 40 additions & 0 deletions lib/xeroizer/models/payroll/super_line.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module Xeroizer
module Record
module Payroll

class SuperLineModel < PayrollBaseModel

end

class SuperLine < PayrollBase

SUPERANNUATION_CONTRIBUTION_TYPE = {
'SGC' => 'Mandatory 9% contribution',
'SALARYSACRIFICE' => 'Pre-tax reportable employer superannuation contribution, which is displayed separately on payment summaries',
'EMPLOYERADDITIONAL' => 'Additional employer superannuation contribution, which is displayed as RESC on payment summaries',
'EMPLOYEE' => 'Post-tax employee superannuation contribution'
} unless defined?(SUPERANNUATION_CONTRIBUTION_TYPE)

SUPERANNUATION_CALCULATION_TYPE = {
'FIXEDAMOUNT' => 'For voluntary superannuation, the contribution amount can be a fixed rate or a percentage of earnings. For SGC contributions it must be a percentage',
'PERCENTAGEOFEARNINGS' => '',
'STATUTORY' => ''
} unless defined?(SUPERANNUATION_CALCULATION_TYPE)

guid :super_membership_id, :api_name => 'SuperMembershipID'
string :contribution_type
string :calculation_type
integer :expense_account_code
integer :liability_account_code

decimal :minimum_monthly_earnings
decimal :percentage

validates_presence_of :super_membership_id, :contribution_type, :calculation_type, :expense_account_code, :liability_account_code, :unless => :new_record?
validates_inclusion_of :contribution_type, :in => SUPERANNUATION_CONTRIBUTION_TYPE
validates_inclusion_of :calculation_type, :in => SUPERANNUATION_CALCULATION_TYPE
end

end
end
end