luca-jp 0.15.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/luca-jp +41 -6
- data/lib/luca/jp/aoiro.rb +0 -1
- data/lib/luca/jp/chihouzei.rb +0 -1
- data/lib/luca/jp/it_part.rb +0 -1
- data/lib/luca/jp/sonshitsu.rb +2 -2
- data/lib/luca/jp/syouhizei.rb +0 -1
- data/lib/luca/jp/urikake.rb +0 -1
- data/lib/luca/jp/util.rb +1 -1
- data/lib/luca/jp/version.rb +1 -1
- data/lib/luca/jp.rb +2 -7
- data/lib/luca_salary/jp/version.rb +1 -1
- data/lib/luca_salary/jp.rb +95 -12
- data/lib/luca_salary/jp_payreport.rb +6 -6
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a6dbb648afd83fd8f7240fcda13d1ab94f7cbff8d3499edfd3dba0641a94ab6
|
4
|
+
data.tar.gz: '087559b7426943953b6ece1cfc8e25b3dfed1da12a0047fbc6367884751e1bb9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 290000091d4b1fcbff40cbd11ed97d477d4a3c6144bc668cc93ad4d40568869ad1ad69bf0bdad3df1301dcc76c3c4322eff30bb4f602ede1d120f579801af8da
|
7
|
+
data.tar.gz: 1fc13e4658ed8735f80abdb087cfae9f3abbc18dfed81709d9174b0e70a10ceb0bb11ec535e690ca4c1ea414b4c6d183c6ef5dae25dd71b49cb1af4a1cee63e4
|
data/exe/luca-jp
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
require 'optparse'
|
5
5
|
require 'luca/jp'
|
6
6
|
require 'luca_salary/jp_payreport'
|
7
|
+
require 'luca_cmd'
|
8
|
+
require 'luca_support/const'
|
7
9
|
|
8
10
|
class LucaCmd
|
9
11
|
def self.syouhizei(args, params)
|
@@ -54,6 +56,26 @@ class LucaCmd
|
|
54
56
|
[r[0].year, r[0].month, r[1].year, r[1].month]
|
55
57
|
end
|
56
58
|
end
|
59
|
+
|
60
|
+
def self.check_dir_jp(target)
|
61
|
+
check_dir(target) do
|
62
|
+
begin
|
63
|
+
ex_conf = YAML.safe_load(
|
64
|
+
File.read(Pathname(LucaSupport::CONST.pjdir) / 'config-lucajp.yml'),
|
65
|
+
permitted_classes: [Date]
|
66
|
+
)
|
67
|
+
if ex_conf
|
68
|
+
LucaSupport::CONST.set_config(
|
69
|
+
LucaSupport::CONST.config.merge(ex_conf)
|
70
|
+
)
|
71
|
+
end
|
72
|
+
rescue Errno::ENOENT
|
73
|
+
nil
|
74
|
+
end
|
75
|
+
|
76
|
+
yield
|
77
|
+
end
|
78
|
+
end
|
57
79
|
end
|
58
80
|
|
59
81
|
module LucaSalaryCmd
|
@@ -64,7 +86,7 @@ module LucaSalaryCmd
|
|
64
86
|
end
|
65
87
|
end
|
66
88
|
|
67
|
-
LucaRecord::Base.valid_project?
|
89
|
+
#LucaRecord::Base.valid_project?
|
68
90
|
cmd = ARGV.shift
|
69
91
|
params = {}
|
70
92
|
|
@@ -75,7 +97,9 @@ when 'h', /hou?jinzei/
|
|
75
97
|
opt.on('--export', 'export json') { |_v| params[:export] = true }
|
76
98
|
opt.on('--lastyear', 'report on last Financial year') { |_v| params[:lastyear] = true }
|
77
99
|
args = opt.parse!(ARGV)
|
78
|
-
LucaCmd.
|
100
|
+
LucaCmd.check_dir_jp('journals') do
|
101
|
+
LucaCmd.houjinzei(args, params)
|
102
|
+
end
|
79
103
|
end
|
80
104
|
when 's', /s[yh]ou?hizei/
|
81
105
|
OptionParser.new do |opt|
|
@@ -83,7 +107,9 @@ when 's', /s[yh]ou?hizei/
|
|
83
107
|
opt.on('--export', 'export json') { |_v| params[:export] = true }
|
84
108
|
opt.on('--lastyear', 'report on last Financial year') { |_v| params[:lastyear] = true }
|
85
109
|
args = opt.parse!(ARGV)
|
86
|
-
LucaCmd.
|
110
|
+
LucaCmd.check_dir_jp('journals') do
|
111
|
+
LucaCmd.syouhizei(args, params)
|
112
|
+
end
|
87
113
|
end
|
88
114
|
when 'c', /chihou?zei/
|
89
115
|
OptionParser.new do |opt|
|
@@ -91,7 +117,9 @@ when 'c', /chihou?zei/
|
|
91
117
|
opt.on('--export', 'export json') { |_v| params[:export] = true }
|
92
118
|
opt.on('--lastyear', 'report on last Financial year') { |_v| params[:lastyear] = true }
|
93
119
|
args = opt.parse!(ARGV)
|
94
|
-
LucaCmd.
|
120
|
+
LucaCmd.check_dir_jp('journals') do
|
121
|
+
LucaCmd.chihouzei(args, params)
|
122
|
+
end
|
95
123
|
end
|
96
124
|
when /urikake/
|
97
125
|
OptionParser.new do |opt|
|
@@ -99,14 +127,21 @@ when /urikake/
|
|
99
127
|
opt.on('--total VAL', '売掛金総額') { |v| params[:total] = v&.to_i }
|
100
128
|
opt.on('--utf8', 'UTF-8でファイル生成') { |_v| params[:encode] = 'UTF-8' }
|
101
129
|
args = opt.parse!(ARGV)
|
102
|
-
LucaCmd.
|
130
|
+
LucaCmd.check_dir_jp('invoices') do
|
131
|
+
LucaCmd.urikake(args, params)
|
132
|
+
end
|
103
133
|
end
|
104
134
|
when 'k', 'kyuyo', 'salary'
|
105
135
|
OptionParser.new do |opt|
|
106
136
|
opt.banner = 'Usage: luca-jp kyuyo [--export] year'
|
107
137
|
args = opt.parse(ARGV)
|
108
|
-
|
138
|
+
LucaCmd.check_dir_jp('profiles') do
|
139
|
+
LucaSalaryCmd::Export.payreport(args)
|
140
|
+
end
|
109
141
|
end
|
142
|
+
when 'version'
|
143
|
+
puts "luca-jp: version #{Luca::Jp::VERSION}"
|
144
|
+
exit 0
|
110
145
|
else
|
111
146
|
puts 'Proper subcommand needed.'
|
112
147
|
puts
|
data/lib/luca/jp/aoiro.rb
CHANGED
data/lib/luca/jp/chihouzei.rb
CHANGED
data/lib/luca/jp/it_part.rb
CHANGED
data/lib/luca/jp/sonshitsu.rb
CHANGED
@@ -4,7 +4,7 @@ require 'date'
|
|
4
4
|
require 'pathname'
|
5
5
|
require 'yaml'
|
6
6
|
require 'luca_book'
|
7
|
-
require 'luca_support/
|
7
|
+
require 'luca_support/const'
|
8
8
|
|
9
9
|
module Luca
|
10
10
|
module Jp
|
@@ -95,7 +95,7 @@ module Luca
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def self.record_file
|
98
|
-
Pathname(LucaSupport::
|
98
|
+
Pathname(LucaSupport::CONST.pjdir) / 'data' / 'balance' / 'sonshitsu.yml'
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
data/lib/luca/jp/syouhizei.rb
CHANGED
data/lib/luca/jp/urikake.rb
CHANGED
data/lib/luca/jp/util.rb
CHANGED
data/lib/luca/jp/version.rb
CHANGED
data/lib/luca/jp.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'date'
|
4
4
|
require 'luca/jp/version'
|
5
|
-
require 'luca_support/
|
5
|
+
require 'luca_support/const'
|
6
|
+
require 'yaml'
|
6
7
|
|
7
8
|
module Luca
|
8
9
|
module Jp
|
@@ -17,10 +18,4 @@ module Luca
|
|
17
18
|
autoload :Uchiwake, 'luca/jp/uchiwake'
|
18
19
|
autoload :Util, 'luca/jp/util'
|
19
20
|
end
|
20
|
-
|
21
|
-
EX_CONF = begin
|
22
|
-
YAML.safe_load(File.read(Pathname(LucaSupport::PJDIR) / 'config-lucajp.yml'), permitted_classes: [Date])
|
23
|
-
rescue Errno::ENOENT
|
24
|
-
nil
|
25
|
-
end
|
26
21
|
end
|
data/lib/luca_salary/jp.rb
CHANGED
@@ -16,13 +16,15 @@ class LucaSalary::Jp < LucaSalary::Base
|
|
16
16
|
__dir__
|
17
17
|
end
|
18
18
|
|
19
|
-
def calc_payment(profile)
|
19
|
+
def calc_payment(profile, date)
|
20
|
+
配偶者控除 = profile.include?('spouse')
|
21
|
+
扶養控除 = self.class.扶養控除対象者の数(profile['family'], Date.new(date.year, 12, 31))
|
20
22
|
{}.tap do |h|
|
21
23
|
select_code(profile, '1').each { |k, v| h[k] = v }
|
22
24
|
h['201'] = @insurance.health_insurance_salary(insurance_rank(profile))
|
23
25
|
h['202'] = @insurance.pension_salary(pension_rank(profile))
|
24
26
|
tax_base = self.class.sum_code(h, '1', income_tax_exception) - h['201'] - h['202']
|
25
|
-
h['203'] = JpNationalTax::IncomeTax.calc_kouran(tax_base, Date.today,
|
27
|
+
h['203'] = JpNationalTax::IncomeTax.calc_kouran(tax_base, Date.today, 配偶者控除, 扶養控除)
|
26
28
|
h['211'] = resident_tax(profile)
|
27
29
|
select_code(profile, '3').each { |k, v| h[k] = v }
|
28
30
|
select_code(profile, '4').each { |k, v| h[k] = v }
|
@@ -31,13 +33,17 @@ class LucaSalary::Jp < LucaSalary::Base
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
|
-
def self.year_total(payment, date)
|
36
|
+
def self.year_total(profile, payment, date)
|
37
|
+
raise '年末調整の対象となりません' if payment['1'] == 0
|
38
|
+
|
35
39
|
payment.tap do |p|
|
36
40
|
p['911'] = JpNationalTax::IncomeTax.basic_deduction(p['1'], date)
|
37
|
-
p['916'] =
|
41
|
+
p['916'] = 配偶者控除の金額(p['1'], profile['spouse'], date)
|
42
|
+
p['917'] = 配偶者特別控除の金額(p['1'], profile['spouse'], date)
|
43
|
+
p['918'] = 扶養控除の金額(profile['family'], date)
|
38
44
|
p['912'] = ['201', '202', '204', '205'].map{ |cd| p[cd] }.compact.sum
|
39
45
|
p['901'] = JpNationalTax::IncomeTax.year_salary_taxable(p['1'], date)
|
40
|
-
p['941'] = p['901'] -
|
46
|
+
p['941'] = p['901'] - ['911', '912', '916', '917', '918'].map{ |cd| p[cd] }.compact.sum
|
41
47
|
p['961'] = JpNationalTax::IncomeTax.year_tax(p['941'], date)
|
42
48
|
diff = p['961'] - p['203']
|
43
49
|
if diff.positive?
|
@@ -54,18 +60,95 @@ class LucaSalary::Jp < LucaSalary::Base
|
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
57
|
-
def self
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
def self.配偶者控除の金額(income, spouse, date)
|
64
|
+
puts spouse
|
65
|
+
return nil if spouse.nil?
|
66
|
+
|
67
|
+
puts spouse
|
68
|
+
spouse_salary = JpNationalTax::IncomeTax.year_salary_taxable(spouse['income'][date.year.to_s] || 0, date)
|
69
|
+
return 0 if spouse_salary > 480_000
|
70
|
+
|
71
|
+
salary = JpNationalTax::IncomeTax.year_salary_taxable(income || 0, date)
|
72
|
+
birth_date = spouse['birth_date'] || date
|
73
|
+
if salary <= 9_000_000
|
74
|
+
birth_date <= date.prev_year(70) ? 480_000 : 380_000
|
75
|
+
elsif salary <= 9_500_000
|
76
|
+
birth_date <= date.prev_year(70) ? 320_000 : 260_000
|
77
|
+
elsif salary <= 10_000_000
|
78
|
+
birth_date <= date.prev_year(70) ? 160_000 : 130_000
|
64
79
|
else
|
65
80
|
0
|
66
81
|
end
|
67
82
|
end
|
68
83
|
|
84
|
+
def self.配偶者特別控除の金額(income, spouse, date)
|
85
|
+
return nil if spouse.nil?
|
86
|
+
|
87
|
+
salary = JpNationalTax::IncomeTax.year_salary_taxable(income || 0, date)
|
88
|
+
return 0 if salary > 10_000_000
|
89
|
+
|
90
|
+
spouse_salary = JpNationalTax::IncomeTax.year_salary_taxable(spouse['income'][date.year.to_s] || 0, date)
|
91
|
+
return 0 if spouse_salary <= 480_000
|
92
|
+
return 0 if spouse_salary > 1_330_000
|
93
|
+
|
94
|
+
if salary <= 9_000_000
|
95
|
+
return 380_000 if spouse_salary <= 950_000
|
96
|
+
return 360_000 if spouse_salary <= 1_000_000
|
97
|
+
return 310_000 if spouse_salary <= 1_050_000
|
98
|
+
return 260_000 if spouse_salary <= 1_100_000
|
99
|
+
return 210_000 if spouse_salary <= 1_150_000
|
100
|
+
return 160_000 if spouse_salary <= 1_200_000
|
101
|
+
return 110_000 if spouse_salary <= 1_250_000
|
102
|
+
return 60_000 if spouse_salary <= 1_300_000
|
103
|
+
return 30_000
|
104
|
+
elsif salary <= 9_500_000
|
105
|
+
return 260_000 if spouse_salary <= 950_000
|
106
|
+
return 240_000 if spouse_salary <= 1_000_000
|
107
|
+
return 210_000 if spouse_salary <= 1_050_000
|
108
|
+
return 180_000 if spouse_salary <= 1_100_000
|
109
|
+
return 140_000 if spouse_salary <= 1_150_000
|
110
|
+
return 110_000 if spouse_salary <= 1_200_000
|
111
|
+
return 80_000 if spouse_salary <= 1_250_000
|
112
|
+
return 40_000 if spouse_salary <= 1_300_000
|
113
|
+
return 20_000
|
114
|
+
else
|
115
|
+
return 130_000 if spouse_salary <= 950_000
|
116
|
+
return 120_000 if spouse_salary <= 1_000_000
|
117
|
+
return 110_000 if spouse_salary <= 1_050_000
|
118
|
+
return 90_000 if spouse_salary <= 1_100_000
|
119
|
+
return 70_000 if spouse_salary <= 1_150_000
|
120
|
+
return 60_000 if spouse_salary <= 1_200_000
|
121
|
+
return 40_000 if spouse_salary <= 1_250_000
|
122
|
+
return 20_000 if spouse_salary <= 1_300_000
|
123
|
+
return 10_000
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.扶養控除の金額(family, date)
|
128
|
+
return if family.nil?
|
129
|
+
|
130
|
+
family.map { |person| 各家族の扶養控除の額(person, date) }.sum
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.各家族の扶養控除の額(person, date)
|
134
|
+
birth_date = person['birth_date']
|
135
|
+
return 0 if birth_date.nil?
|
136
|
+
|
137
|
+
if birth_date > date.prev_year(16)
|
138
|
+
0
|
139
|
+
elsif birth_date <= date.prev_year(70)
|
140
|
+
person['live_with'] ? 580_000 : 480_000 # 老人扶養親族
|
141
|
+
elsif birth_date <= date.prev_year(19) and birth_date > date.prev_year(23)
|
142
|
+
630_000 # 特定扶養親族
|
143
|
+
else
|
144
|
+
380_000
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.扶養控除対象者の数(family, date)
|
149
|
+
family.map { |person| 各家族の扶養控除の額(person, date) > 0 ? 1 : 0 }.sum
|
150
|
+
end
|
151
|
+
|
69
152
|
def income_tax_exception
|
70
153
|
%w[116 118 119 11A 11B]
|
71
154
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'luca_salary'
|
3
|
-
require 'luca_support/
|
3
|
+
require 'luca_support/const'
|
4
4
|
require 'csv'
|
5
5
|
require 'open3'
|
6
6
|
|
@@ -24,11 +24,11 @@ module LucaSalary
|
|
24
24
|
# TODO: extract effective field
|
25
25
|
def self.set_company(year)
|
26
26
|
{}.tap do |h|
|
27
|
-
h['name'] =
|
28
|
-
h['address'] =
|
29
|
-
h['address2'] =
|
30
|
-
h['tel'] =
|
31
|
-
h['tax_id'] =
|
27
|
+
h['name'] = LucaSupport::CONST.config.dig('company', 'name')
|
28
|
+
h['address'] = LucaSupport::CONST.config.dig('company', 'address')
|
29
|
+
h['address2'] = LucaSupport::CONST.config.dig('company', 'address2')
|
30
|
+
h['tel'] = LucaSupport::CONST.config.dig('company', 'tel')
|
31
|
+
h['tax_id'] = LucaSupport::CONST.config.dig('company', 'tax_id')
|
32
32
|
|
33
33
|
raise "会社名、住所の設定は必須" if h['name'].nil? or h['address'].nil?
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luca-jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucabook
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.7.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jp-national-tax
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,7 @@ metadata:
|
|
174
174
|
homepage_uri: https://github.com/chumaltd/luca-jp
|
175
175
|
source_code_uri: https://github.com/chumaltd/luca-jp
|
176
176
|
changelog_uri: https://github.com/chumaltd/luca-jp/CHANGELOG.md
|
177
|
-
post_install_message:
|
177
|
+
post_install_message:
|
178
178
|
rdoc_options: []
|
179
179
|
require_paths:
|
180
180
|
- lib
|
@@ -189,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
193
|
-
signing_key:
|
192
|
+
rubygems_version: 3.4.10
|
193
|
+
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: JP tax extension for Luca
|
196
196
|
test_files: []
|