Sha256: d7a7836dd0f6141b406b139f67d6b12e9e85e6819c1fbeee66ffefe063312048

Contents?: true

Size: 972 Bytes

Versions: 11

Compression:

Stored size: 972 Bytes

Contents

# 健康保健
class TaxJp::SocialInsurances::HealthInsurance
  attr_reader :grade
  attr_reader :valid_from, :valid_until
  attr_reader :prefecture
  attr_reader :general, :care
  attr_reader :particular, :basic

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

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

  def general_amount_half
    floor_amount(general_amount / 2)
  end

  def general_amount_care
    (monthly_standard * (general + care)).round(1) 
  end

  def general_amount_care_half
    floor_amount(general_amount_care / 2) 
  end

  private

  def monthly_standard
    grade.grade > 0 ? grade.monthly_standard : 0
  end

  def floor_amount(amount)
    (amount * 10).floor * 0.1
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

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