diff --git a/lib/xeroizer.rb b/lib/xeroizer.rb index 9a80ea06..530513f7 100644 --- a/lib/xeroizer.rb +++ b/lib/xeroizer.rb @@ -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' diff --git a/lib/xeroizer/models/payroll/deduction_line.rb b/lib/xeroizer/models/payroll/deduction_line.rb new file mode 100644 index 00000000..e6baa5d2 --- /dev/null +++ b/lib/xeroizer/models/payroll/deduction_line.rb @@ -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 \ No newline at end of file diff --git a/lib/xeroizer/models/payroll/earnings_line.rb b/lib/xeroizer/models/payroll/earnings_line.rb new file mode 100644 index 00000000..92174ba6 --- /dev/null +++ b/lib/xeroizer/models/payroll/earnings_line.rb @@ -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 \ No newline at end of file diff --git a/lib/xeroizer/models/payroll/employee.rb b/lib/xeroizer/models/payroll/employee.rb index 4c4b8c9f..d7def217 100644 --- a/lib/xeroizer/models/payroll/employee.rb +++ b/lib/xeroizer/models/payroll/employee.rb @@ -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? diff --git a/lib/xeroizer/models/payroll/leave_line.rb b/lib/xeroizer/models/payroll/leave_line.rb new file mode 100644 index 00000000..3db77cbd --- /dev/null +++ b/lib/xeroizer/models/payroll/leave_line.rb @@ -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 \ No newline at end of file diff --git a/lib/xeroizer/models/payroll/pay_template.rb b/lib/xeroizer/models/payroll/pay_template.rb new file mode 100644 index 00000000..a90d8765 --- /dev/null +++ b/lib/xeroizer/models/payroll/pay_template.rb @@ -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 \ No newline at end of file diff --git a/lib/xeroizer/models/payroll/reimbursement_line.rb b/lib/xeroizer/models/payroll/reimbursement_line.rb new file mode 100644 index 00000000..5281574c --- /dev/null +++ b/lib/xeroizer/models/payroll/reimbursement_line.rb @@ -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 \ No newline at end of file diff --git a/lib/xeroizer/models/payroll/super_line.rb b/lib/xeroizer/models/payroll/super_line.rb new file mode 100644 index 00000000..2e6835dc --- /dev/null +++ b/lib/xeroizer/models/payroll/super_line.rb @@ -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 \ No newline at end of file