luca-jp 0.16.0 → 0.16.2
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_payreport.rb +25 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a2439c73cf61040d39604aba50f3765abd94a42ca9a6a3f531864993856e2c6
|
4
|
+
data.tar.gz: 6ecf8ad72b8fe7c6ac1a68c04360f0a5dc4f7c5ec754291c728d4a172319c6fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9983fbb9704f1867813024e0da0653d2079443190673c62964074d4c81cac6d92a5a8a6a86c1c8b4988b6f1e0db7d974ba9ed504ff0c35176961dd8e755c63f
|
7
|
+
data.tar.gz: 7e0303ee440175e577d7ef1c563f06278edf4f48e42a4e9c4a930c92cd353f9e7a511dcea715491c37e6f31af72b46dc687b3f31ff08949bc7cca9c12e9bd64b
|
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
|
@@ -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
|
@@ -49,7 +49,7 @@ def 給与支払報告明細行(slip, company, year)
|
|
49
49
|
支払を受ける者の詳細(slip, year),
|
50
50
|
company['tax_id'], # 法人番号
|
51
51
|
支払を受ける者の扶養情報(slip['profile'], year),
|
52
|
-
slip['911'], #
|
52
|
+
slip['911'] == 480_000 ? nil : slip['911'], # 基礎控除の額、48万の場合記載しない
|
53
53
|
nil, # 所得金額調整控除額 TODO: 未実装 措法41の3の3
|
54
54
|
nil, # ひとり親
|
55
55
|
提出先判定(slip), # 必須:作成区分(国税のみ0, 地方のみ1, 両方2)
|
@@ -82,6 +82,7 @@ end
|
|
82
82
|
|
83
83
|
def 支払(slip, year)
|
84
84
|
配偶者控除等 = [slip['916'], slip['917']].compact.sum
|
85
|
+
扶養対象 = 扶養親族分類(slip.dig('profile', 'family'), year)
|
85
86
|
[
|
86
87
|
'給料', # 種別
|
87
88
|
slip['1'], # 支払金額
|
@@ -93,12 +94,12 @@ def 支払(slip, year)
|
|
93
94
|
配偶者控除等 > 0 ? 1 : 2, # 控除対象配偶者の有無 TODO: 従たる給与
|
94
95
|
老人控除対象配偶者(slip.dig('profile', 'spouse'), year),
|
95
96
|
配偶者控除等, # 配偶者控除の額
|
96
|
-
|
97
|
+
扶養対象['特定'].length, # 控除対象扶養親族の数 特定 主
|
97
98
|
nil, # 控除対象扶養親族の数 特定 従
|
98
|
-
|
99
|
+
扶養対象['老人'].length, # 控除対象扶養親族の数 老人 主
|
99
100
|
nil, # 控除対象扶養親族の数 老人 上の内訳
|
100
101
|
nil, # 控除対象扶養親族の数 老人 従
|
101
|
-
|
102
|
+
扶養対象['その他'].length, # 控除対象扶養親族の数 その他 主
|
102
103
|
nil, # 控除対象扶養親族の数 その他 従
|
103
104
|
nil, # 障害者の数 特別障害者
|
104
105
|
nil, # 障害者の数 上の内訳 NOTE: 同居・同一生計
|
@@ -122,7 +123,7 @@ def 支払を受ける者の詳細(slip, year)
|
|
122
123
|
nil, # 地震保険料の控除額
|
123
124
|
nil, # 住宅借入金等特別控除等の額
|
124
125
|
nil, # 旧個人年金保険料の額
|
125
|
-
slip.dig('spouse', 'income'), # 配偶者の合計所得
|
126
|
+
slip.dig('profile', 'spouse', 'income', year), # 配偶者の合計所得
|
126
127
|
nil, # 旧長期損害保険料の額
|
127
128
|
生年月日[0], # 必須:受給者の生年月日 元号
|
128
129
|
生年月日[1], # 必須:受給者の生年月日 年
|
@@ -174,7 +175,7 @@ def 支払を受ける者の扶養情報(profile, year)
|
|
174
175
|
nil, # 青色専従者
|
175
176
|
nil, # 条約免除
|
176
177
|
半角変換(profile['katakana']), # 必須:支払を受ける者のフリガナ(半角)
|
177
|
-
nil, #
|
178
|
+
nil, # 受給者番号
|
178
179
|
profile.dig('resident', 'area_code'), # 必須:提出先市町村コード
|
179
180
|
profile.dig('resident', 'tax_id'), # 指定番号
|
180
181
|
]
|
@@ -203,17 +204,27 @@ end
|
|
203
204
|
def 扶養親族分類(family, year)
|
204
205
|
return {} if family.nil?
|
205
206
|
|
206
|
-
|
207
|
+
this_year = Date.new(year, 12, -1)
|
208
|
+
{ '16才以上' => [], '16才未満' => [], '老人' => [], '特定' => [], 'その他' => [] }.tap do |result|
|
207
209
|
family.each do |p|
|
208
210
|
if !p['birth_date']
|
209
211
|
result['16才以上'] << p
|
212
|
+
result['その他'] << p
|
210
213
|
else
|
211
214
|
date = p['birth_date']
|
212
215
|
date = Date.parse(date) if date.is_a?(String)
|
213
|
-
if date.next_year(16)
|
216
|
+
if date.next_year(16) <= this_year
|
214
217
|
result['16才以上'] << p
|
218
|
+
if date.next_year(70) <= this_year
|
219
|
+
result['老人'] << p
|
220
|
+
elsif date.next_year(19) <= this_year and date.next_year(23) > this_year
|
221
|
+
result['特定'] << p
|
222
|
+
else
|
223
|
+
result['その他'] << p
|
224
|
+
end
|
215
225
|
else
|
216
226
|
result['16才未満'] << p
|
227
|
+
result['その他'] << p
|
217
228
|
end
|
218
229
|
end
|
219
230
|
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.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
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
|