tax_jp 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f3fbe7999273768975212eb4cd581e10678d44378f232fbd7f7834c0d5c6224
4
- data.tar.gz: 5c1be85a5aec02df29755cd1cf7c123399f97cdf12f9c2fc4cf03d9c997ea478
3
+ metadata.gz: 438e6fc5fdcdf40d44d653f10139e204861579f3db44ccb26af6dabee62ad42f
4
+ data.tar.gz: ee7d70c0bb46247548e21b97f86394c13f39b53762a5d09f579200f2c7ed1cca
5
5
  SHA512:
6
- metadata.gz: 12d0622ade501d072579417828e2ac9b3aef0ce0e951da6d4a7591a3c23acbcab1a48ea5cd8b67554cdc077b36b6a2a3687a693e42c072af38c8ef0e725145b4
7
- data.tar.gz: 6005738b112ee04f8b0ecb7072e67f04ea6ddf433ba88e19a61f31d77095b1796b080e60c568c1df89d8c8b8d9460f2e291c856260de069cd0d912a9c56220e8
6
+ metadata.gz: c791aaab288035b998409f8d07a6db3b4cc96c14438005a329a264d252a147c0a4b19b6301f223233b0d0ff0bb7334a09b097e5d6efb7d3acaac4df5195fb346
7
+ data.tar.gz: cf83548d64b7ce03d73851de39680720c710a6850d33373345b1bc25869742c805b0f0ca4ce754d61fed6dc7cd8a1148da7d4cef796422a0bc95faeb6b2a3a3a
@@ -0,0 +1,5 @@
1
+ .taxjp {
2
+ main {
3
+ padding: 4rem 0;
4
+ }
5
+ }
@@ -0,0 +1,11 @@
1
+ require_dependency "tax_jp/application_controller"
2
+
3
+ module TaxJp
4
+ class ConsumptionTaxesController < ApplicationController
5
+
6
+ def index
7
+ @consumption_taxes = ConsumptionTax.all
8
+ end
9
+
10
+ end
11
+ end
@@ -1,7 +1,23 @@
1
- <nav class="nav justify-content-center">
2
- <%= link_to '源泉徴収税', withheld_taxes_path, class: "nav-link #{controller_name == 'withheld_taxes' ? 'active' : nil}" %>
3
- <%= link_to '源泉徴収税(賞与)', bonus_withheld_taxes_path, class: "nav-link #{controller_name == 'bonus_withheld_taxes' ? 'active' : nil}" %>
4
- <%= link_to '社会保険料', social_insurances_path, class: "nav-link #{controller_name == 'social_insurances' ? 'active' : nil}" %>
5
- <%= link_to '雇用保険料', employment_insurances_path, class: "nav-link #{controller_name == 'employment_insurances' ? 'active' : nil}" %>
6
- <%= link_to '減価償却率', depreciation_rates_path, class: "nav-link #{controller_name == 'depreciation_rates' ? 'active' : nil}" %>
1
+ <nav class="navbar navbar-expand-sm navbar-light bg-light fixed-top">
2
+ <span class="navbar-brand">TaxJP</span>
3
+ <ul class="navbar-nav mr-auto">
4
+ <li class="nav-item <%= 'active' if controller_name == 'withheld_taxes' %>">
5
+ <%= link_to '源泉徴収税', withheld_taxes_path, class: "nav-link" %>
6
+ </li>
7
+ <li class="nav-item <%= 'active' if controller_name == 'bonus_withheld_taxes' %>">
8
+ <%= link_to '源泉徴収税(賞与)', bonus_withheld_taxes_path, class: "nav-link" %>
9
+ </li>
10
+ <li class="nav-item <%= 'active' if controller_name == 'social_insurances' %>">
11
+ <%= link_to '社会保険料', social_insurances_path, class: "nav-link" %>
12
+ </li>
13
+ <li class="nav-item <%= 'active' if controller_name == 'employment_insurances' %>">
14
+ <%= link_to '雇用保険料', employment_insurances_path, class: "nav-link" %>
15
+ </li>
16
+ <li class="nav-item <%= 'active' if controller_name == 'consumption_taxes' %>">
17
+ <%= link_to '消費税', consumption_taxes_path, class: "nav-link" %>
18
+ </li>
19
+ <li class="nav-item <%= 'active' if controller_name == 'depreciation_rates' %>">
20
+ <%= link_to '減価償却率', depreciation_rates_path, class: "nav-link" %>
21
+ </li>
22
+ </ul>
7
23
  </nav>
@@ -8,10 +8,12 @@
8
8
  <%= stylesheet_link_tag "tax_jp/application", media: "all" %>
9
9
  <%= javascript_include_tag "tax_jp/application" %>
10
10
  </head>
11
- <body>
11
+ <body class="taxjp">
12
12
 
13
13
  <%= render 'layouts/tax_jp/nav' %>
14
- <%= yield %>
14
+ <main role="main">
15
+ <%= yield %>
16
+ </main>
15
17
 
16
18
  </body>
17
19
  </html>
@@ -1,16 +1,16 @@
1
1
  <div class="container">
2
2
  <%= form_with model: @finder, url: {action: 'index'}, method: 'get', class: 'form form-vertical', local: true do |f| %>
3
3
  <div class="row">
4
- <div class="col-sm-3 form-group">
4
+ <div class="form-group m-2">
5
5
  <%= f.t_date_field :from %>
6
6
  </div>
7
- <div class="col">
8
- <%= f.submit '表示', class: 'btn btn-sm btn-default mt-1' %>
7
+ <div class="m-2">
8
+ <%= f.submit '表示', class: 'btn btn-light' %>
9
9
  </div>
10
10
  </div>
11
11
  <% end %>
12
12
  </div>
13
- <div class="pl-4 pr-4">
13
+ <div class="py-2 px-4">
14
14
  <table class="table table-striped table-bordered table-hover table-sm">
15
15
  <thead class="thead-light">
16
16
  <tr>
@@ -1,6 +1,6 @@
1
1
  <div class="input-group date" id="datetimepicker4" data-target-input="nearest">
2
2
  <label for="datetimepicker1" class="pt-2 pr-2">年月日:</label>
3
- <%= f.text_field method, class: 'form-control datetimepicker-input', data: {target: '#datetimepicker4'} %>
3
+ <%= f.text_field method, class: 'form-control datetimepicker-input', style: 'width: 7em;', data: {target: '#datetimepicker4'} %>
4
4
  <div class="input-group-append" data-target="#datetimepicker4" data-toggle="datetimepicker">
5
5
  <div class="input-group-text"><i class="fa fa-calendar"></i></div>
6
6
  </div>
@@ -0,0 +1,32 @@
1
+ <div class="py-2 px-4">
2
+ <table class="table table-striped table-bordered table-hover table-sm col">
3
+ <thead class="thead-light">
4
+ <tr>
5
+ <th rowspan="2" class="align-middle text-center">適用開始日</th>
6
+ <th colspan="3" class="text-center">標準税率</th>
7
+ <th colspan="3" class="text-center">軽減税率</th>
8
+ </tr>
9
+ <tr>
10
+ <th class="text-center">消費税率(%)</th>
11
+ <th class="text-center">地方消費税率(%)</th>
12
+ <th class="text-center">合計(%)</th>
13
+ <th class="text-center">消費税率(%)</th>
14
+ <th class="text-center">地方消費税率(%)</th>
15
+ <th class="text-center">合計(%)</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% @consumption_taxes.each do |ct| %>
20
+ <tr>
21
+ <td class="text-center"><%= ct.valid_from %></td>
22
+ <td class="text-center"><%= number_to_currency(ct.national_percent, unit: '', precision: 1) if ct.national_percent > 0 %></td>
23
+ <td class="text-center"><%= number_to_currency(ct.local_percent, unit: '', precision: 1) if ct.local_percent > 0 %></td>
24
+ <td class="text-center"><%= number_to_currency(ct.total_percent, unit: '') if ct.total_percent > 0 %></td>
25
+ <td class="text-center"></td>
26
+ <td class="text-center"></td>
27
+ <td class="text-center"></td>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
32
+ </div>
@@ -1,4 +1,4 @@
1
- <div class="container">
1
+ <div class="py-2 px-4">
2
2
  <table class="table table-striped table-bordered table-hover table-sm">
3
3
  <thead class="thead-light">
4
4
  <tr>
@@ -1,4 +1,4 @@
1
- <div class="container">
1
+ <div class="py-2 px-4">
2
2
  <table class="table table-striped table-bordered table-hover table-sm">
3
3
  <thead class="thead-light">
4
4
  <tr>
@@ -1,15 +1,15 @@
1
1
  <div class="container">
2
2
  <%= form_with model: @finder, url: {action: 'index'}, method: 'get', class: 'form form-vertical', local: true do |f| %>
3
3
  <div class="row">
4
- <div class="col-sm-3 form-group">
4
+ <div class="form-group m-2">
5
5
  <%= f.t_date_field :from %>
6
6
  </div>
7
- <div class="col-sm-4 form-group form-inline">
7
+ <div class="form-group form-inline m-2">
8
8
  <label for="finder_prefecture_code" class="pr-2">都道府県:</label>
9
9
  <%= f.collection_select :prefecture_code, TaxJp::Prefecture.all, :code, :name, {}, class: 'form-control' %>
10
10
  </div>
11
- <div class="col">
12
- <%= f.submit '表示', class: 'btn btn-sm btn-default mt-1' %>
11
+ <div class="m-2">
12
+ <%= f.submit '表示', class: 'btn btn-light' %>
13
13
  </div>
14
14
  </div>
15
15
  <% end %>
@@ -1,18 +1,18 @@
1
1
  <div class="container">
2
2
  <%= form_with model: @finder, url: {action: 'index'}, method: 'get', class: 'form form-vertical', local: true do |f| %>
3
3
  <div class="row">
4
- <div class="col-sm-3 form-group">
4
+ <div class="form-group m-2">
5
5
  <%= f.t_date_field :from %>
6
6
  </div>
7
- <div class="col">
8
- <%= f.submit '表示', class: 'btn btn-sm btn-default mt-1' %>
7
+ <div class="m-2">
8
+ <%= f.submit '表示', class: 'btn btn-light' %>
9
9
  </div>
10
10
  </div>
11
11
  <% end %>
12
12
  </div>
13
- <div class="pl-4 pr-4">
13
+ <div class="py-2 px-4">
14
14
  <table class="table table-striped table-bordered table-hover table-sm">
15
- <thead>
15
+ <thead class="thead-light">
16
16
  <tr>
17
17
  <th class="text-center">社会保険料控除後の<br/>給与範囲(以上)</th>
18
18
  <th class="text-center">社会保険料控除後の<br/>給与範囲(未満)</th>
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  TaxJp::Engine.routes.draw do
2
+ resources :consumption_taxes, only: 'index'
2
3
  resources :bonus_withheld_taxes, only: 'index'
3
4
  resources :depreciation_rates, only: 'index'
4
5
  resources :employment_insurances, only: 'index'
@@ -10,3 +10,10 @@
10
10
  national: 0.063
11
11
  local: 0.017
12
12
  total: 0.08
13
+ 2019-10-01:
14
+ national: 0.078
15
+ local: 0.022
16
+ total: 0.1
17
+ national_reduced: 0.0624
18
+ local_reduced: 0.0176
19
+ total_reduced: 0.08
@@ -1,24 +1,57 @@
1
1
  module TaxJp
2
- module ConsumptionTax
2
+ module ConsumptionTaxes
3
+ end
4
+
5
+ class ConsumptionTax
3
6
  @@consumption_taxes = TaxJp::Utils.load_yaml('消費税.yml')
4
7
 
5
- def rate_on(date, options = {})
8
+ attr_reader :valid_from
9
+ attr_reader :national, :local, :total
10
+
11
+ def initialize(valid_from, values)
12
+ @valid_from = valid_from
13
+ @national = values['national']
14
+ @local = values['local']
15
+ @total = values['total']
16
+ end
17
+
18
+ def self.all
19
+ ret = []
20
+ @@consumption_taxes.each do |valid_from, values|
21
+ ret << ConsumptionTax.new(valid_from, values)
22
+ end
23
+ ret
24
+ end
25
+
26
+ def self.rate_on(date, options = {})
6
27
  if date.is_a?(String)
7
28
  date = Date.parse(date)
8
29
  end
9
30
 
10
31
  ret = 0
11
- @@consumption_taxes.reverse_each do |start_date, rate|
32
+ @@consumption_taxes.reverse_each do |valid_from, rate|
12
33
  ret = rate['total']
13
- break if date >= start_date
34
+ break if date >= valid_from
14
35
  end
15
-
36
+
16
37
  if options[:percent]
17
38
  ret *= 100
18
39
  end
19
-
40
+
20
41
  ret
21
42
  end
22
43
 
44
+ def national_percent
45
+ national * 100
46
+ end
47
+
48
+ def local_percent
49
+ local * 100
50
+ end
51
+
52
+ def total_percent
53
+ total * 100
54
+ end
55
+
23
56
  end
24
57
  end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.5.6'
2
+ VERSION = '0.6.0'
3
3
  end
data/lib/tax_jp.rb CHANGED
@@ -13,7 +13,6 @@ module TaxJp
13
13
 
14
14
  # 消費税
15
15
  require 'tax_jp/consumption_tax'
16
- extend TaxJp::ConsumptionTax
17
16
 
18
17
  # 法人税-区分番号
19
18
  require 'tax_jp/corporate_tax'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tax_jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichylinux
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-30 00:00:00.000000000 Z
12
+ date: 2019-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap
@@ -110,8 +110,10 @@ files:
110
110
  - app/assets/javascripts/tax_jp.js
111
111
  - app/assets/javascripts/tax_jp/application.js
112
112
  - app/assets/stylesheets/tax_jp/application.css.scss
113
+ - app/assets/stylesheets/tax_jp/layout,css.scss
113
114
  - app/controllers/tax_jp/application_controller.rb
114
115
  - app/controllers/tax_jp/bonus_withheld_taxes_controller.rb
116
+ - app/controllers/tax_jp/consumption_taxes_controller.rb
115
117
  - app/controllers/tax_jp/depreciation_rates_controller.rb
116
118
  - app/controllers/tax_jp/employment_insurances_controller.rb
117
119
  - app/controllers/tax_jp/social_insurances_controller.rb
@@ -126,6 +128,7 @@ files:
126
128
  - app/views/layouts/tax_jp/application.html.erb
127
129
  - app/views/tax_jp/bonus_withheld_taxes/index.html.erb
128
130
  - app/views/tax_jp/common/_date_field.html.erb
131
+ - app/views/tax_jp/consumption_taxes/index.html.erb
129
132
  - app/views/tax_jp/depreciation_rates/index.html.erb
130
133
  - app/views/tax_jp/employment_insurances/index.html.erb
131
134
  - app/views/tax_jp/social_insurances/index.html.erb