Project

jptax

0.0
No commit activity in last 3 years
No release in over 3 years
Easy calculating Japanese consumption tax.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0
 Project Readme

Jptax

Jptax は日本の消費税額を計算します。

Installation

Add this line to your application's Gemfile:

gem 'jptax'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install jptax

Reference

Jptax.amount_with_tax(通常税率の税抜金額, 軽減税率の税抜金額, 丸め方法)

丸め方法

端数の丸方法として、以下のいずれかを指定します。 未指定の場合は切り捨てられます。

  • floor: 切り捨て
  • ceil: 切り上げ
  • round: 四捨五入

Usage

税込金額計算

税抜金額を元に税込金額を計算します。 端数は切り捨て・切り上げ・四捨五入を指定できます。 未指定の場合は切り捨てられます。

通常税率の税込金額を計算(切り捨て)

Jptax.amount_with_tax(100)
# => 110

軽減税率の税込金額を計算(切り捨て)

Jptax.amount_with_tax(0, 200)
# => 216

通常税率と軽減税率の税込金額を計算(切り捨て)

Jptax.amount_with_tax(100, 199)
# => 314

通常税率と軽減税率の税込金額を計算(四捨五入)

Jptax.amount_with_tax(100, 199, 'round')
# => 315

Note

計算間違いによる一切の責任は負えませんので、よくご確認の上ご利用ください。

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Jptax project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.