lucasalary-jp 0.1.1 → 0.1.2

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: 4d7725635bc010fab7f33c2aae18589f6e7bd950b217db8d046b76cff7e37df7
4
- data.tar.gz: 4b79a094663e8248c4bede6306a79e5ba06d2f37c3ededd75cea0a22f6eae973
3
+ metadata.gz: 5c7fff7c7b40c95899b960a3c507508cfd073514123ca0e6c0ab6cf2a6a47c7c
4
+ data.tar.gz: c2e35dcf8879de84427e7a26e46e5c67f6b8281cb4ac121adeebd536887f16dc
5
5
  SHA512:
6
- metadata.gz: 809829f5850a7b223945306f99b130ca8612fa1cf564979c78e2cff95e670acc44da19abe190c34268b659c639ec9d74c6db304639b4f586aae2f699779b3400
7
- data.tar.gz: 2a299c57efff68eb152d03e9eda0487aaeb5cab9b9bee5d1623460296f3baa0e3c48d2b6c2c71ee73b1a56becd48f7b905dc786410ce9cfa376f4782349cacfa
6
+ metadata.gz: 259a1429a5bf2e542213aaf6f9f83ac9628b77d7fc7b51537c52017b25cb43258eee3131b5e6e5e9f15a407f3ba10b046cee64313a1a660848ea812e013017a6
7
+ data.tar.gz: 5225c85430a43e60516f40b5be8582448b501df056351e7b303809d1fa90b0d1d5a0d295af8cfa8846ffdc2822282d36c3f50770640cf2ae474dac8422fa5dd9
@@ -41,16 +41,22 @@ code label acct_label
41
41
  204 雇用保険料 預り金
42
42
  205 介護保険料 法定福利費
43
43
  211 住民税 住民税
44
- 221 社会保険料控除
45
- 222 生命保険料控除
46
- 223 地震保険料控除
47
- 224 小規模企業共済等掛金控除
48
- 225 配偶者控除
49
- 226 配偶者特別控除
50
- 227 住宅借入金等特別控除
51
44
  3 その他控除額
52
45
  311 社宅本人負担分 雑収入
53
46
  3A1 年末調整不足分 預り金
54
47
  4 加算額
55
48
  4A1 年末調整還付 預り金
56
49
  5 差引支給金額 未払費用
50
+ 901 給与所得控除後の給与等の金額
51
+ 911 基礎控除
52
+ 912 社会保険料控除
53
+ 913 生命保険料控除
54
+ 914 地震保険料控除
55
+ 915 小規模企業共済等掛金控除
56
+ 916 配偶者控除
57
+ 917 配偶者特別控除
58
+ 918 扶養控除
59
+ 919 住宅借入金等特別控除
60
+ 920 障害者等の控除
61
+ 941 課税給与所得金額
62
+ 961 年調年税額
@@ -4,7 +4,7 @@ require 'luca_salary'
4
4
  require 'luca_salary/jp/insurance'
5
5
  require 'jp_national_tax'
6
6
 
7
- class LucaSalary::JP < LucaSalary::Base
7
+ class LucaSalary::Jp < LucaSalary::Base
8
8
  def initialize(dir_path, config = nil, date = nil)
9
9
  @pjdir = dir_path
10
10
  @date = date
@@ -31,6 +31,103 @@ class LucaSalary::JP < LucaSalary::Base
31
31
  end
32
32
  end
33
33
 
34
+ def self.year_total(payment)
35
+ payment.tap do |p|
36
+ p['911'] = basic_deduction(p['1'])
37
+ p['916'] = partner_deduction(p['1'])
38
+ p['912'] = (p['201'] || 0) + (p['202'] || 0)
39
+ p['901'] = year_salary(p['1'])
40
+ p['941'] = p['901'] - p['911'] - p['912'] - p['916']
41
+ p['961'] = year_tax(p['941'])
42
+ diff = p['961'] - p['203']
43
+ if diff.positive?
44
+ p['3A1'] = diff
45
+ else
46
+ p['4A1'] = diff * -1
47
+ end
48
+ end
49
+ end
50
+
51
+ def self.year_salary(income)
52
+ rounded = if income < 1_619_000
53
+ income
54
+ elsif income < 1_620_000
55
+ income - ((income - 1_619_000) % 1_000)
56
+ elsif income < 1_624_000
57
+ income - ((income - 1_620_000) % 2_000)
58
+ elsif income < 1_624_000
59
+ income - ((income - 1_624_000) % 4_000)
60
+ else
61
+ income
62
+ end
63
+ if rounded < 551_000
64
+ 0
65
+ elsif rounded < 1_619_000
66
+ rounded - 550_000
67
+ elsif rounded < 1_620_000
68
+ rounded * 0.6 + 97_600
69
+ elsif rounded < 1_622_000
70
+ rounded * 0.6 + 98_000
71
+ elsif rounded < 1_624_000
72
+ rounded * 0.6 + 98_800
73
+ elsif rounded < 1_628_000
74
+ rounded * 0.6 + 99_600
75
+ elsif rounded < 1_800_000
76
+ rounded * 0.6 + 100_000
77
+ elsif rounded < 3_600_000
78
+ rounded * 0.7 - 80_000
79
+ elsif rounded < 6_600_000
80
+ rounded * 0.8 - 440_000
81
+ elsif rounded < 8_500_000
82
+ rounded * 0.9 - 1_100_000
83
+ else
84
+ rounded - 1_950_000
85
+ end
86
+ end
87
+
88
+ def self.year_tax(income)
89
+ tax = if income < 1_950_000
90
+ income * 0.05
91
+ elsif income <= 3_300_000
92
+ income * 0.1 - 97_500
93
+ elsif income <= 6_950_000
94
+ income * 0.2 - 427_500
95
+ elsif income <= 9_000_000
96
+ income * 0.23 - 636_000
97
+ elsif income <= 18_000_000
98
+ income * 0.33 - 1_536_000
99
+ elsif income <= 18_050_000
100
+ income * 0.4 - 2_796_000
101
+ else
102
+ raise "no target"
103
+ end
104
+ (tax / 1000).floor * 1000
105
+ end
106
+
107
+ def self.basic_deduction(income)
108
+ if income <= 24_000_000
109
+ 480_000
110
+ elsif income <= 24_500_000
111
+ 320_000
112
+ elsif income <= 25_000_000
113
+ 160_000
114
+ else
115
+ 0
116
+ end
117
+ end
118
+
119
+ def self.partner_deduction(income)
120
+ if income <= 9_000_000
121
+ 380_000
122
+ elsif income <= 9_500_000
123
+ 260_000
124
+ elsif income <= 10_000_000
125
+ 130_000
126
+ else
127
+ 0
128
+ end
129
+ end
130
+
34
131
  def income_tax_exception
35
132
  %w[116 118 119 11A 11B]
36
133
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LucaSalaryJp
2
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucasalary-jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-07 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucasalary
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.1.14
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.1.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement