tax_jp 0.5.4 → 0.5.5

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: abb57ffb800c9774815ec28f56da7502c30b112cf9c3d05b3b38126b018bfc15
4
- data.tar.gz: ec84cbcd5120b0dc413655e928fba77abcf2a0349b6eafd3069416d090ae35a5
3
+ metadata.gz: 4a6c0a4c5a2b6c4e6068fd78440a89de985020aac4274dfef9c7472c8195714d
4
+ data.tar.gz: 0c483de128eec29b328e6e45b7ed6ce69a3808f8e35fac1f5087a712099df974
5
5
  SHA512:
6
- metadata.gz: 22312abd7983472c40ac53d72c84fb0eba92c83db5fa45eab749fa0972a7318a5f50ca1e4d951cfe556f3f97077243ff02d0e8fd67996fcd833d1ce2e5ff3d59
7
- data.tar.gz: 19a6f2f3ce1d7587976fd096be36dd32715ec415459c552430ee02a0e5aa1b9271447a7f2a81c8b2ba16184fcb852aa74f0bb682cee44ad8425e839fc4ab0601
6
+ metadata.gz: 3c8a5b3567662da8918f944c6abdcbe92ab4f61df63cdfd44ebad233433d4c34f9100fc7653ebd2e66d36bd88beb811f969ee27492f014e847a3ec58ce12f1c3
7
+ data.tar.gz: 6d61f4e88649520646fb3e5d86eb8d28af2804e8855ffd0e5104684ba5aef6aa48830eca4961a7f926f91dc1b2aea3db240b8efa680e337e6c777b3468a04b6a
@@ -0,0 +1,29 @@
1
+ require_dependency "tax_jp/application_controller"
2
+
3
+ module TaxJp
4
+ class SocialInsurancesController < ApplicationController
5
+ before_action :preload_finder
6
+
7
+ def index
8
+ if params[:commit]
9
+ @social_insurances = TaxJp::SocialInsurance.find_all_by_date_and_prefecture(@finder.from, @finder.prefecture_code)
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def preload_finder
16
+ @finder = TaxJp::Finder.new(finder_params)
17
+ @finder.from ||= Date.today.strftime('%Y-%m-%d')
18
+ end
19
+
20
+ def finder_params
21
+ if params[:finder].present?
22
+ params.require(:finder).permit(:from, :prefecture_code)
23
+ else
24
+ {}
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -2,4 +2,5 @@ class TaxJp::Finder
2
2
  include ActiveModel::Model
3
3
 
4
4
  attr_accessor :from
5
+ attr_accessor :prefecture_code
5
6
  end
@@ -1,6 +1,7 @@
1
1
  <nav class="nav justify-content-center">
2
2
  <%= link_to '源泉徴収税', withheld_taxes_path, class: "nav-link #{controller_name == 'withheld_taxes' ? 'active' : nil}" %>
3
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}" %>
4
5
  <%= link_to '雇用保険料', employment_insurances_path, class: "nav-link #{controller_name == 'employment_insurances' ? 'active' : nil}" %>
5
6
  <%= link_to '減価償却率', depreciation_rates_path, class: "nav-link #{controller_name == 'depreciation_rates' ? 'active' : nil}" %>
6
7
  </nav>
@@ -2,29 +2,12 @@
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
4
  <div class="col-sm-3 form-group">
5
- <div class="input-group date" id="datetimepicker4" data-target-input="nearest">
6
- <label for="datetimepicker1" class="pt-2 pr-2">年月日:</label>
7
- <%= f.text_field :from, class: 'form-control datetimepicker-input', data: {target: '#datetimepicker4'} %>
8
- <div class="input-group-append" data-target="#datetimepicker4" data-toggle="datetimepicker">
9
- <div class="input-group-text"><i class="fa fa-calendar"></i></div>
10
- </div>
11
- </div>
5
+ <%= f.t_date_field :from %>
12
6
  </div>
13
7
  <div class="col">
14
8
  <%= f.submit '表示', class: 'btn btn-sm btn-default mt-1' %>
15
9
  </div>
16
10
  </div>
17
- <script>
18
- $(function () {
19
- $('#datetimepicker4').datetimepicker({
20
- format: 'YYYY-MM-DD',
21
- locale: 'ja',
22
- buttons: {
23
- showClose: true
24
- }
25
- });
26
- });
27
- </script>
28
11
  <% end %>
29
12
  </div>
30
13
  <div class="pl-4 pr-4">
@@ -0,0 +1,18 @@
1
+ <div class="input-group date" id="datetimepicker4" data-target-input="nearest">
2
+ <label for="datetimepicker1" class="pt-2 pr-2">年月日:</label>
3
+ <%= f.text_field method, class: 'form-control datetimepicker-input', data: {target: '#datetimepicker4'} %>
4
+ <div class="input-group-append" data-target="#datetimepicker4" data-toggle="datetimepicker">
5
+ <div class="input-group-text"><i class="fa fa-calendar"></i></div>
6
+ </div>
7
+ <script>
8
+ $(function () {
9
+ $('#datetimepicker4').datetimepicker({
10
+ format: 'YYYY-MM-DD',
11
+ locale: 'ja',
12
+ buttons: {
13
+ showClose: true
14
+ }
15
+ });
16
+ });
17
+ </script>
18
+ </div>
@@ -0,0 +1,69 @@
1
+ <div class="container">
2
+ <%= form_with model: @finder, url: {action: 'index'}, method: 'get', class: 'form form-vertical', local: true do |f| %>
3
+ <div class="row">
4
+ <div class="col-sm-3 form-group">
5
+ <%= f.t_date_field :from %>
6
+ </div>
7
+ <div class="col-sm-4 form-group form-inline">
8
+ <label for="finder_prefecture_code" class="pr-2">都道府県:</label>
9
+ <%= f.collection_select :prefecture_code, TaxJp::Prefecture.all, :code, :name, {}, class: 'form-control' %>
10
+ </div>
11
+ <div class="col">
12
+ <%= f.submit '表示', class: 'btn btn-sm btn-default mt-1' %>
13
+ </div>
14
+ </div>
15
+ <% end %>
16
+ </div>
17
+ <% if @social_insurances %>
18
+ <div class="pl-4 pr-4">
19
+ <div>
20
+ <span><%= @social_insurances.first.valid_from %></span>
21
+ <span>~</span>
22
+ <span><%= @social_insurances.first.valid_until %></span>
23
+ </div>
24
+ <table class="table table-striped table-bordered table-hover table-sm">
25
+ <thead class="thead-light">
26
+ <tr>
27
+ <th class="text-center" colspan="3">標準報酬</th>
28
+ <th class="text-center" colspan="2">報酬月額</th>
29
+ <th class="text-center" colspan="4">全国健康保険協会管掌健康保険料</th>
30
+ <th class="text-center" colspan="4">厚生年金保険料(厚生年金基金加入員を除く)</th>
31
+ </tr>
32
+ <tr>
33
+ <th class="text-center">等級</th>
34
+ <th class="text-center">月額</th>
35
+ <th class="text-center">日額</th>
36
+ <th class="text-center">円以上</th>
37
+ <th class="text-center">円未満</th>
38
+ <th class="text-center">全額</th>
39
+ <th class="text-center">折半額</th>
40
+ <th class="text-center"><span class="text-nowrap">全額</span> <span class="text-nowrap">(介護保険2号)</span></th>
41
+ <th class="text-center"><span class="text-nowrap">折半額</span> <span class="text-nowrap">(介護保険2号)</span></th>
42
+ <th class="text-center">全額</th>
43
+ <th class="text-center">折半額</th>
44
+ <th class="text-center"><span class="text-nowrap">全額</span> <span class="text-nowrap">(坑内員/船員)</th>
45
+ <th class="text-center"><span class="text-nowrap">折半額</span> <span class="text-nowrap">(坑内員/船員)</th>
46
+ </tr>
47
+ </thead>
48
+ <tbody>
49
+ <% @social_insurances.each do |si| %>
50
+ <tr>
51
+ <td class="text-center"><%= si.grade.grade %><%= "(#{si.grade.pension_grade})" if si.welfare_pension.general_amount > 0 %></td>
52
+ <td class="text-right"><%= si.grade.monthly_standard.to_s(:delimited) %></td>
53
+ <td class="text-right"><%= si.grade.daily_standard.to_s(:delimited) %></td>
54
+ <td class="text-right"><%= si.grade.salary_from.to_s(:delimited) %></td>
55
+ <td class="text-right"><%= si.grade.salary_to.to_s(:delimited) if si.grade.salary_to < 2_147_483_647 %></td>
56
+ <td class="text-right"><%= si.health_insurance.general_amount.to_s(:delimited) %></td>
57
+ <td class="text-right"><%= si.health_insurance.general_amount_half.to_s(:delimited) %></td>
58
+ <td class="text-right"><%= si.health_insurance.general_amount_care.to_s(:delimited) %></td>
59
+ <td class="text-right"><%= si.health_insurance.general_amount_care_half.to_s(:delimited) %></td>
60
+ <td class="text-right"><%= number_to_currency(si.welfare_pension.general_amount, unit: '', precision: 2) if si.welfare_pension.general_amount > 0 %></td>
61
+ <td class="text-right"><%= number_to_currency(si.welfare_pension.general_amount_half, unit: '', precision: 2) if si.welfare_pension.general_amount_half > 0 %></td>
62
+ <td class="text-right"><%= number_to_currency(si.welfare_pension.particular_amount, unit: '', precision: 2) if si.welfare_pension.particular_amount > 0 %></td>
63
+ <td class="text-right"><%= number_to_currency(si.welfare_pension.particular_amount_half, unit: '', precision: 2) if si.welfare_pension.particular_amount_half > 0 %></td>
64
+ </tr>
65
+ <% end %>
66
+ </tbody>
67
+ </table>
68
+ </div>
69
+ <% end %>
@@ -2,29 +2,12 @@
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
4
  <div class="col-sm-3 form-group">
5
- <div class="input-group date" id="datetimepicker4" data-target-input="nearest">
6
- <label for="datetimepicker1" class="pt-2 pr-2">年月日:</label>
7
- <%= f.text_field :from, class: 'form-control datetimepicker-input', data: {target: '#datetimepicker4'} %>
8
- <div class="input-group-append" data-target="#datetimepicker4" data-toggle="datetimepicker">
9
- <div class="input-group-text"><i class="fa fa-calendar"></i></div>
10
- </div>
11
- </div>
5
+ <%= f.t_date_field :from %>
12
6
  </div>
13
7
  <div class="col">
14
8
  <%= f.submit '表示', class: 'btn btn-sm btn-default mt-1' %>
15
9
  </div>
16
10
  </div>
17
- <script>
18
- $(function () {
19
- $('#datetimepicker4').datetimepicker({
20
- format: 'YYYY-MM-DD',
21
- locale: 'ja',
22
- buttons: {
23
- showClose: true
24
- }
25
- });
26
- });
27
- </script>
28
11
  <% end %>
29
12
  </div>
30
13
  <div class="pl-4 pr-4">
data/config/routes.rb CHANGED
@@ -2,6 +2,7 @@ TaxJp::Engine.routes.draw do
2
2
  resources :bonus_withheld_taxes, only: 'index'
3
3
  resources :depreciation_rates, only: 'index'
4
4
  resources :employment_insurances, only: 'index'
5
+ resources :social_insurances, only: 'index'
5
6
  resources :withheld_taxes, only: 'index'
6
7
 
7
8
  root to: 'top#index'
data/lib/tax_jp/engine.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bootstrap4-datetime-picker-rails'
2
2
  require 'font-awesome-rails'
3
+ require_relative 'form_builder'
3
4
 
4
5
  module TaxJp
5
6
  class Engine < ::Rails::Engine
@@ -0,0 +1,10 @@
1
+ require 'action_view'
2
+
3
+ class ActionView::Helpers::FormBuilder
4
+ include ActionView::Helpers::AssetTagHelper
5
+
6
+ def t_date_field(method, options = {})
7
+ @template.render 'tax_jp/common/date_field', f: self, method: method
8
+ end
9
+
10
+ end
@@ -34,7 +34,7 @@ class TaxJp::SocialInsurances::HealthInsurance
34
34
  end
35
35
 
36
36
  def general_amount_half
37
- floor_amount(general_amount / 2)
37
+ (general_amount / 2).floor(1)
38
38
  end
39
39
 
40
40
  def general_amount_care
@@ -42,7 +42,7 @@ class TaxJp::SocialInsurances::HealthInsurance
42
42
  end
43
43
 
44
44
  def general_amount_care_half
45
- floor_amount(general_amount_care / 2)
45
+ (general_amount_care / 2).floor(1)
46
46
  end
47
47
 
48
48
  def salary
@@ -56,8 +56,4 @@ class TaxJp::SocialInsurances::HealthInsurance
56
56
  grade.grade > 0 ? grade.monthly_standard : 0
57
57
  end
58
58
 
59
- def floor_amount(amount)
60
- (amount * 10).floor * 0.1
61
- end
62
-
63
59
  end
@@ -29,7 +29,7 @@ class TaxJp::SocialInsurances::WelfarePension
29
29
  end
30
30
 
31
31
  def general_amount_half
32
- floor_amount(general_amount / 2)
32
+ (general_amount / 2).floor(2)
33
33
  end
34
34
 
35
35
  def particular_amount
@@ -37,7 +37,7 @@ class TaxJp::SocialInsurances::WelfarePension
37
37
  end
38
38
 
39
39
  def particular_amount_half
40
- floor_amount(particular_amount / 2)
40
+ (particular_amount / 2).floor(2)
41
41
  end
42
42
 
43
43
  def salary
@@ -60,8 +60,4 @@ class TaxJp::SocialInsurances::WelfarePension
60
60
  grade.daily_standard
61
61
  end
62
62
 
63
- def floor_amount(amount)
64
- (amount * 100).floor * 0.01
65
- end
66
-
67
63
  end
@@ -1,3 +1,3 @@
1
1
  module TaxJp
2
- VERSION = '0.5.4'
2
+ VERSION = '0.5.5'
3
3
  end
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.4
4
+ version: 0.5.5
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-09 00:00:00.000000000 Z
12
+ date: 2018-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 4.1.3
20
+ version: 4.2.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 4.1.3
27
+ version: 4.2.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bootstrap4-datetime-picker-rails
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,7 @@ files:
114
114
  - app/controllers/tax_jp/bonus_withheld_taxes_controller.rb
115
115
  - app/controllers/tax_jp/depreciation_rates_controller.rb
116
116
  - app/controllers/tax_jp/employment_insurances_controller.rb
117
+ - app/controllers/tax_jp/social_insurances_controller.rb
117
118
  - app/controllers/tax_jp/top_controller.rb
118
119
  - app/controllers/tax_jp/withheld_taxes_controller.rb
119
120
  - app/helpers/tax_jp/application_helper.rb
@@ -124,8 +125,10 @@ files:
124
125
  - app/views/layouts/tax_jp/_nav.html.erb
125
126
  - app/views/layouts/tax_jp/application.html.erb
126
127
  - app/views/tax_jp/bonus_withheld_taxes/index.html.erb
128
+ - app/views/tax_jp/common/_date_field.html.erb
127
129
  - app/views/tax_jp/depreciation_rates/index.html.erb
128
130
  - app/views/tax_jp/employment_insurances/index.html.erb
131
+ - app/views/tax_jp/social_insurances/index.html.erb
129
132
  - app/views/tax_jp/top/index.html.erb
130
133
  - app/views/tax_jp/withheld_taxes/index.html.erb
131
134
  - config/routes.rb
@@ -187,6 +190,7 @@ files:
187
190
  - lib/tax_jp/depreciation_rate.rb
188
191
  - lib/tax_jp/depreciation_rates/db_builder.rb
189
192
  - lib/tax_jp/engine.rb
193
+ - lib/tax_jp/form_builder.rb
190
194
  - lib/tax_jp/gengou.rb
191
195
  - lib/tax_jp/labor_insurance.rb
192
196
  - lib/tax_jp/labor_insurances/employment_insurance.rb