Jptax は日本の消費税額を計算します。
Add this line to your application's Gemfile:
gem 'jptax'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install jptax
Jptax.amount_with_tax(通常税率の税抜金額, 軽減税率の税抜金額, 丸め方法)
端数の丸方法として、以下のいずれかを指定します。 未指定の場合は切り捨てられます。
floor
: 切り捨てceil
: 切り上げround
: 四捨五入
税抜金額を元に税込金額を計算します。 端数は切り捨て・切り上げ・四捨五入を指定できます。 未指定の場合は切り捨てられます。
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
計算間違いによる一切の責任は負えませんので、よくご確認の上ご利用ください。
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Jptax project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.