Sha256: c9669b9bc06797eb266128b25fc25e6cf18a1d9bbc6d996d698de0558958b4cc

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

# ๅŽš็”Ÿๅนด้‡‘
class TaxJp::SocialInsurances::WelfarePension
  attr_reader :grade
  attr_reader :valid_from, :valid_until
  attr_reader :general, :particular
  attr_reader :child_support

  def initialize(attrs = {})
    @grade = attrs[:grade]
    @valid_from = attrs[:valid_from]
    @valid_until = attrs[:valid_until]
    @general= attrs[:general]
    @particular= attrs[:particular]
    @child_support = attrs[:child_support]
  end

  def general_amount
    (monthly_standard * general).round(2) 
  end

  def general_amount_half
    floor_amount(general_amount / 2)
  end

  def particular_amount
    (monthly_standard * particular).round(2) 
  end

  def particular_amount_half
    floor_amount(particular_amount / 2) 
  end

  private

  def monthly_standard
    return 0 if grade.pension_grade == 0
    return 0 if grade.pension_grade > 99
    grade.monthly_standard
  end

  def daily_standard
    return 0 if grade.pension_grade == 0
    return 0 if grade.pension_grade > 99
    grade.daily_standard
  end

  def floor_amount(amount)
    (amount * 100).floor * 0.01
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tax_jp-0.5.2 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.5.1 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.4.0 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.13 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.12 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.11 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.10 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.9 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.8 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.7 lib/tax_jp/social_insurances/welfare_pension.rb
tax_jp-0.3.6 lib/tax_jp/social_insurances/welfare_pension.rb