luca-jp 0.1.0 → 0.1.5
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 +57 -0
- data/lib/luca/jp.rb +13 -0
- data/lib/luca/jp/aoiro.rb +470 -0
- data/lib/luca/jp/chihouzei.rb +197 -0
- data/lib/luca/jp/common.rb +216 -0
- data/lib/luca/jp/it_part.rb +99 -0
- data/lib/luca/jp/sonshitsu.rb +102 -0
- data/lib/luca/jp/syouhizei.rb +120 -12
- data/lib/luca/jp/templates/aoiro.xtx.erb +21 -0
- data/lib/luca/jp/templates/beppyo1-next.xml.erb +31 -0
- data/lib/luca/jp/templates/beppyo1.xml.erb +71 -0
- data/lib/luca/jp/templates/beppyo15.xml.erb +30 -0
- data/lib/luca/jp/templates/beppyo2.xml.erb +9 -0
- data/lib/luca/jp/templates/beppyo4.xml.erb +84 -0
- data/lib/luca/jp/templates/beppyo51.xml.erb +85 -0
- data/lib/luca/jp/templates/beppyo52.xml.erb +241 -0
- data/lib/luca/jp/templates/beppyo7.xml.erb +31 -0
- data/lib/luca/jp/templates/consumption.xtx.erb +21 -0
- data/lib/luca/jp/templates/el-no6-43.xml.erb +178 -0
- data/lib/luca/jp/templates/el-no6-9.xml.erb +51 -0
- data/lib/luca/jp/templates/el-no6.xml.erb +206 -0
- data/lib/luca/jp/templates/eltax.xml.erb +117 -0
- data/lib/luca/jp/templates/fuhyo43.xml.erb +37 -0
- data/lib/luca/jp/templates/fuhyo53.xml.erb +24 -0
- data/lib/luca/jp/templates/gaikyo.xml.erb +89 -0
- data/lib/luca/jp/templates/kariuke-meisai.xml.erb +37 -0
- data/lib/luca/jp/templates/syouhizei-shinkoku-kanni.xml.erb +95 -0
- data/lib/luca/jp/templates/tekiyougaku.xml.erb +35 -0
- data/lib/luca/jp/templates/yakuin-meisai.xml.erb +13 -0
- data/lib/luca/jp/templates/yokin-meisai.xml.erb +13 -0
- data/lib/luca/jp/util.rb +69 -0
- data/lib/luca/jp/version.rb +1 -1
- metadata +30 -2
@@ -0,0 +1,197 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'cgi/escape'
|
5
|
+
require 'luca_book'
|
6
|
+
require 'luca_support'
|
7
|
+
require 'luca_record/dict'
|
8
|
+
require 'luca_support/config'
|
9
|
+
require 'luca/jp'
|
10
|
+
|
11
|
+
module Luca
|
12
|
+
module Jp
|
13
|
+
class Chihouzei < LucaBook::State
|
14
|
+
include LucaSupport::View
|
15
|
+
include Luca::Jp::Common
|
16
|
+
include Luca::Jp::Util
|
17
|
+
|
18
|
+
@dirname = 'journals'
|
19
|
+
@record_type = 'raw'
|
20
|
+
|
21
|
+
def kani(export: false)
|
22
|
+
set_pl(4)
|
23
|
+
set_bs(4)
|
24
|
+
@issue_date = Date.today
|
25
|
+
@company = CGI.escapeHTML(config.dig('company', 'name'))
|
26
|
+
@software = 'LucaJp'
|
27
|
+
@jimusho_code = config.dig('jp', 'eltax', 'jimusho_code')
|
28
|
+
@jimusho_name = '都税事務所長'
|
29
|
+
|
30
|
+
@税額 = 税額計算
|
31
|
+
@均等割 = @税額.dig(:kenmin, :kintou)
|
32
|
+
@法人税割課税標準 = 法人税割課税標準
|
33
|
+
@確定法人税割 = (@税額.dig(:kenmin, :houjinzei) / 100).floor * 100
|
34
|
+
@地方特別法人事業税中間納付 = prepaid_tax('1854')
|
35
|
+
@所得割中間納付 = prepaid_tax('1855')
|
36
|
+
@法人税割中間納付 = prepaid_tax('1859')
|
37
|
+
@均等割中間納付 = prepaid_tax('185A')
|
38
|
+
@所得割 = @税額.dig(:kenmin, :shotoku)
|
39
|
+
if export
|
40
|
+
{
|
41
|
+
jigyouzei: {
|
42
|
+
shotoku: {
|
43
|
+
zeigaku: @所得割,
|
44
|
+
chukan: @所得割中間納付
|
45
|
+
},
|
46
|
+
tokubetsu: {
|
47
|
+
zeigaku: @税額.dig(:kenmin, :tokubetsu),
|
48
|
+
chukan: @地方特別法人事業税中間納付
|
49
|
+
},
|
50
|
+
},
|
51
|
+
juminzei: {
|
52
|
+
kinto: {
|
53
|
+
zeigaku: @均等割,
|
54
|
+
chukan: @均等割中間納付
|
55
|
+
},
|
56
|
+
houjinzei: {
|
57
|
+
zeigaku: @確定法人税割,
|
58
|
+
chukan: @法人税割中間納付
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
else
|
63
|
+
@procedure_code = 'R0102100'
|
64
|
+
@procedure_name = '法人都道府県民税・事業税・特別法人事業税又は地方法人特別税 確定申告'
|
65
|
+
@form_sec = ['R0102AA190', 'R0102AG120', 別表九フォーム].compact.map{ |c| form_attr(c) }.join('')
|
66
|
+
@user_inf = render_erb(search_template('el-userinf.xml.erb'))
|
67
|
+
@form_data = [第六号, 別表四三, 別表九].compact.join("\n")
|
68
|
+
render_erb(search_template('eltax.xml.erb'))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def export_json
|
73
|
+
records = kani(export: true)
|
74
|
+
[].tap do |res|
|
75
|
+
item = {}
|
76
|
+
item['date'] = @end_date
|
77
|
+
item['debit'] = []
|
78
|
+
item['credit'] = []
|
79
|
+
records[:jigyouzei].each do |k, dat|
|
80
|
+
if dat[:chukan] > 0
|
81
|
+
item['credit'] << { 'label' => karibarai_label(k), 'amount' => dat[:chukan] }
|
82
|
+
end
|
83
|
+
if dat[:chukan] > dat[:zeigaku]
|
84
|
+
item['debit'] << { 'label' => '未収地方事業税', 'amount' => dat[:chukan] - dat[:zeigaku] }
|
85
|
+
else
|
86
|
+
item['credit'] << { 'label' => '未払地方事業税', 'amount' => dat[:zeigaku] - dat[:chukan] }
|
87
|
+
end
|
88
|
+
item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:zeigaku] } if dat[:zeigaku] > 0
|
89
|
+
end
|
90
|
+
records[:juminzei].each do |k, dat|
|
91
|
+
if dat[:chukan] > 0
|
92
|
+
item['credit'] << { 'label' => karibarai_label(k), 'amount' => dat[:chukan] }
|
93
|
+
end
|
94
|
+
if dat[:chukan] > dat[:zeigaku]
|
95
|
+
item['debit'] << { 'label' => '未収都道府県住民税', 'amount' => dat[:chukan] - dat[:zeigaku] }
|
96
|
+
else
|
97
|
+
item['credit'] << { 'label' => '未払都道府県民税', 'amount' => dat[:zeigaku] - dat[:chukan] }
|
98
|
+
end
|
99
|
+
item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:zeigaku] } if dat[:zeigaku] > 0
|
100
|
+
end
|
101
|
+
item['x-editor'] = 'LucaJp'
|
102
|
+
res << item
|
103
|
+
puts JSON.dump(res)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def 第六号
|
108
|
+
render_erb(search_template('el-no6.xml.erb'))
|
109
|
+
end
|
110
|
+
|
111
|
+
def 別表四三
|
112
|
+
@office_23ku = config.dig('jp', 'eltax', 'office_23ku')
|
113
|
+
render_erb(search_template('el-no6-43.xml.erb'))
|
114
|
+
end
|
115
|
+
|
116
|
+
def 別表九フォーム
|
117
|
+
return nil if @繰越損失管理.records.length == 0
|
118
|
+
|
119
|
+
'R0102AM190'
|
120
|
+
end
|
121
|
+
|
122
|
+
def 別表九
|
123
|
+
return nil if @繰越損失管理.records.length == 0
|
124
|
+
|
125
|
+
render_erb(search_template('el-no6-9.xml.erb'))
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def 法人税割課税標準
|
131
|
+
national_tax = Luca::Jp::Aoiro.range(@start_date.year, @start_date.month, @end_date.year, @end_date.month).kani(export: true)
|
132
|
+
(national_tax[:kokuzei][:zeigaku] / 1000).floor * 1000
|
133
|
+
end
|
134
|
+
|
135
|
+
def 事業税中間納付
|
136
|
+
@所得割中間納付
|
137
|
+
end
|
138
|
+
|
139
|
+
# TODO: 損失の区分
|
140
|
+
#
|
141
|
+
def 別表九各期青色損失
|
142
|
+
tags = @繰越損失管理.records
|
143
|
+
.filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
|
144
|
+
.map do |record|
|
145
|
+
deduction = record['decrease']&.filter{ |r| r['date'] >= @start_date }&.dig(0, 'val') || 0
|
146
|
+
next if deduction == 0 && record['amount'] == 0
|
147
|
+
|
148
|
+
%Q(<AMB00200>
|
149
|
+
<AMB00210>#{etax_date(@start_date)}</AMB00210>
|
150
|
+
<AMB00220>#{etax_date(@end_date)}</AMB00220>
|
151
|
+
<AMB00225 />
|
152
|
+
#{render_attr('AMB00230', deduction + record['amount'])}
|
153
|
+
#{render_attr('AMB00240', deduction)}
|
154
|
+
#{render_attr('AMB00250', record['amount'])}
|
155
|
+
</AMB00200>)
|
156
|
+
end
|
157
|
+
return tags.compact.join("\n") if tags.length > 0
|
158
|
+
|
159
|
+
%Q(<AMB00200>
|
160
|
+
<AMB00210><gen:era /><gen:yy /><gen:mm /><gen:dd /></AMB00210>
|
161
|
+
<AMB00220><gen:era /><gen:yy /><gen:mm /><gen:dd /></AMB00220>
|
162
|
+
<AMB00225 />
|
163
|
+
<AMB00230 />
|
164
|
+
<AMB00240 />
|
165
|
+
<AMB00250 />
|
166
|
+
</AMB00200>)
|
167
|
+
end
|
168
|
+
|
169
|
+
def form_attr(code)
|
170
|
+
"<FORM_ATTR><FORM_ID>#{code}</FORM_ID><FORM_NAME></FORM_NAME><FORM_FILE_NAME></FORM_FILE_NAME><FORM_XSL_NAME></FORM_XSL_NAME></FORM_ATTR>"
|
171
|
+
end
|
172
|
+
|
173
|
+
def karibarai_label(key)
|
174
|
+
case key
|
175
|
+
when :tokubetsu
|
176
|
+
'仮払地方税特別法人事業税'
|
177
|
+
when :shotoku
|
178
|
+
'仮払地方税所得割'
|
179
|
+
when :syunyu
|
180
|
+
'仮払地方税収入割'
|
181
|
+
when :shihon
|
182
|
+
'仮払地方税資本割'
|
183
|
+
when :fukakachi
|
184
|
+
'仮払地方税付加価値割'
|
185
|
+
when :houjinzei
|
186
|
+
'仮払地方税法人税割'
|
187
|
+
when :kinto
|
188
|
+
'仮払地方税均等割'
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def lib_path
|
193
|
+
__dir__
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'luca_support'
|
4
|
+
|
5
|
+
module Luca
|
6
|
+
module Jp
|
7
|
+
module Common
|
8
|
+
module_function
|
9
|
+
|
10
|
+
# 法人税、地方税の当期確定税額の計算
|
11
|
+
#
|
12
|
+
def 税額計算
|
13
|
+
所得 = 所得金額
|
14
|
+
{ houjin: {}, kenmin: {}, shimin: {} }.tap do |tax|
|
15
|
+
法人税額 = 中小企業の軽減税額(所得) + 一般区分の税額(所得)
|
16
|
+
tax[:houjin][:kokuzei] = (法人税額 / 100).floor * 100
|
17
|
+
地方法人税課税標準 = (法人税額 / 1000).floor * 1000
|
18
|
+
地方法人税 = 地方法人税額(地方法人税課税標準)
|
19
|
+
tax[:houjin][:chihou] = (地方法人税 / 100).floor * 100
|
20
|
+
|
21
|
+
tax[:kenmin][:houjinzei], tax[:shimin][:houjinzei] = 法人税割(法人税額)
|
22
|
+
tax[:kenmin][:kintou], tax[:shimin][:kintou] = 均等割
|
23
|
+
tax[:kenmin][:shotoku] = 所得割400万以下(所得) + 所得割800万以下(所得) + 所得割800万超(所得)
|
24
|
+
tax[:kenmin][:tokubetsu] = 地方法人特別税(tax[:kenmin][:shotoku])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# -----------------------------------------------------
|
29
|
+
# :section: 法人税額の計算
|
30
|
+
# -----------------------------------------------------
|
31
|
+
|
32
|
+
def 中小企業の軽減税率対象所得(所得 = nil)
|
33
|
+
所得 ||= 所得金額
|
34
|
+
return 0 if 所得 <= 0
|
35
|
+
|
36
|
+
if 所得 >= 8_000_000
|
37
|
+
8_000_000
|
38
|
+
elsif 所得 < 0
|
39
|
+
0
|
40
|
+
else
|
41
|
+
(所得 / 1000).floor * 1000
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def 中小企業の軽減税額(所得 = nil)
|
46
|
+
中小企業の軽減税率対象所得(所得) * 15 / 100
|
47
|
+
end
|
48
|
+
|
49
|
+
def 中小企業の軽減税率対象を超える所得(所得 = nil)
|
50
|
+
所得 ||= 所得金額
|
51
|
+
return 0 if 所得 <= 0
|
52
|
+
|
53
|
+
if 所得 <= 8_000_000
|
54
|
+
0
|
55
|
+
else
|
56
|
+
((所得 - 8_000_000) / 1000).floor * 1000
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def 一般区分の税額(所得 = nil)
|
61
|
+
(中小企業の軽減税率対象を超える所得(所得) * 23.2 / 100).to_i
|
62
|
+
end
|
63
|
+
|
64
|
+
def 地方法人税額(地方法人税課税標準)
|
65
|
+
(地方法人税課税標準 * 10.3 / 100).to_i
|
66
|
+
end
|
67
|
+
|
68
|
+
# 繰越損失適用後の所得金額
|
69
|
+
#
|
70
|
+
def 所得金額
|
71
|
+
@繰越損失管理 = Sonshitsu.load(@end_date).update(当期所得金額).save if @繰越損失管理.nil?
|
72
|
+
@繰越損失管理.profit
|
73
|
+
end
|
74
|
+
|
75
|
+
# 税引前当期利益をもとに計算
|
76
|
+
# 消費税を租税公課に計上している場合、控除済みの金額
|
77
|
+
# 未払事業税は精算時に認識
|
78
|
+
#
|
79
|
+
def 当期所得金額
|
80
|
+
_, 納付事業税 = 未納事業税期中増減
|
81
|
+
LucaSupport::Code.readable(@pl_data.dig('GA') - 納付事業税)
|
82
|
+
end
|
83
|
+
|
84
|
+
# -----------------------------------------------------
|
85
|
+
# :section: 繰越損失の計算
|
86
|
+
# -----------------------------------------------------
|
87
|
+
|
88
|
+
def 期首繰越損失
|
89
|
+
@繰越損失管理.records
|
90
|
+
.filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
|
91
|
+
.inject(0) { |sum, record| sum + (record['amount'] || 0) }
|
92
|
+
end
|
93
|
+
|
94
|
+
def 当期控除計
|
95
|
+
@繰越損失管理.deduction
|
96
|
+
end
|
97
|
+
|
98
|
+
def 翌期繰越損失
|
99
|
+
@繰越損失管理.records
|
100
|
+
.filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
|
101
|
+
.inject(0) { |sum, record| sum + (record['amount'] || 0) }
|
102
|
+
end
|
103
|
+
|
104
|
+
def 当期繰越損失
|
105
|
+
@繰越損失管理.records
|
106
|
+
.filter { |record| record['start_date'] == @start_date }.dig(0, 'increase') || 0
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
# -----------------------------------------------------
|
111
|
+
# :section: 地方税額の計算
|
112
|
+
# -----------------------------------------------------
|
113
|
+
|
114
|
+
def 均等割
|
115
|
+
if config.dig('jp', 'eltax', 'office_23ku')
|
116
|
+
[70_000, 0]
|
117
|
+
else
|
118
|
+
[20_000, 50_000]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def 法人税割(法人税 = nil)
|
123
|
+
課税標準 = if 法人税
|
124
|
+
(法人税 / 1000).floor * 1000
|
125
|
+
else
|
126
|
+
@法人税割課税標準
|
127
|
+
end
|
128
|
+
if config.dig('jp', 'eltax', 'office_23ku')
|
129
|
+
[(課税標準 * 7 / 100).floor, 0]
|
130
|
+
else
|
131
|
+
[(課税標準 * 1 / 100).floor, (課税標準 * 6 / 100).floor]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def 所得400万以下(所得 = nil)
|
136
|
+
所得 ||= 所得金額
|
137
|
+
return 0 if 所得 < 0
|
138
|
+
|
139
|
+
if 所得 >= 4_000_000
|
140
|
+
4_000_000
|
141
|
+
else
|
142
|
+
(所得 / 1000).floor * 1000
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def 所得割400万以下(所得 = nil)
|
147
|
+
((所得400万以下(所得) * 3.5 / 100) / 100).floor * 100
|
148
|
+
end
|
149
|
+
|
150
|
+
def 所得800万以下(所得 = nil)
|
151
|
+
所得 ||= 所得金額
|
152
|
+
return 0 if 所得 < 0
|
153
|
+
|
154
|
+
if 所得 <= 4_000_000
|
155
|
+
0
|
156
|
+
elsif 所得 >= 8_000_000
|
157
|
+
4_000_000
|
158
|
+
else
|
159
|
+
((所得 - 4_000_000) / 1000).floor * 1000
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def 所得割800万以下(所得 = nil)
|
164
|
+
((所得800万以下(所得) * 5.3 / 100) / 100).floor * 100
|
165
|
+
end
|
166
|
+
|
167
|
+
def 所得800万超(所得 = nil)
|
168
|
+
所得 ||= 所得金額
|
169
|
+
return 0 if 所得 < 0
|
170
|
+
|
171
|
+
if 所得 <= 8_000_000
|
172
|
+
0
|
173
|
+
else
|
174
|
+
((所得 - 8_000_000) / 1000).floor * 1000
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def 所得割800万超(所得 = nil)
|
179
|
+
((所得800万超(所得) * 7.0 / 100) / 100).floor * 100
|
180
|
+
end
|
181
|
+
|
182
|
+
def 地方法人特別税(事業税)
|
183
|
+
((事業税 * 37 / 100) / 100).floor * 100
|
184
|
+
end
|
185
|
+
|
186
|
+
def 消費税課税売上高(税率 = 10)
|
187
|
+
LucaSupport::Code.readable(@pl_data.dig('A0') * 100 / (100 + 税率).floor || 0)
|
188
|
+
end
|
189
|
+
|
190
|
+
def 納付税額(税額, 中間納付額)
|
191
|
+
if 税額 > 中間納付額
|
192
|
+
税額 - 中間納付額
|
193
|
+
else
|
194
|
+
0
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
def 中間還付税額(税額, 中間納付額)
|
199
|
+
if 税額 < 中間納付額
|
200
|
+
中間納付額 - 税額
|
201
|
+
else
|
202
|
+
0
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def 還付事業税
|
207
|
+
LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '1504')[:credit]['1504']
|
208
|
+
end
|
209
|
+
|
210
|
+
def 未納事業税期中増減
|
211
|
+
r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5152')
|
212
|
+
[LucaSupport::Code.readable(r[:credit]['5152'] || 0), LucaSupport::Code.readable(r[:debit]['5152'] || 0)]
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'luca_support'
|
4
|
+
require 'luca_support/config'
|
5
|
+
|
6
|
+
module Luca
|
7
|
+
module Jp
|
8
|
+
module ItPart
|
9
|
+
# タグの出現順序は順不同ではない。eTaxの定義に準拠
|
10
|
+
#
|
11
|
+
def it_part
|
12
|
+
entries = ['<IT VR="1.4" id="IT">']
|
13
|
+
entries.concat(['zeimusho']
|
14
|
+
.map{ |key| render_it_tag(key) })
|
15
|
+
entries << teisyutsu_day
|
16
|
+
entries.concat(['nozeisha_id', 'nozeisha_bango']
|
17
|
+
.map{ |key| render_it_tag(key) })
|
18
|
+
entries.concat(['nozeisha_nm_kn', 'nozeisha_nm', 'nozeisha_zip', 'nozeisha_adr_kn', 'nozeisha_adr', 'nozeisha_tel']
|
19
|
+
.map{ |key| render_it_tag(key) })
|
20
|
+
entries.concat(['shihon_kin', 'jigyo_naiyo', 'kanpu_kinyukikan']
|
21
|
+
.map{ |key| render_it_tag(key) })
|
22
|
+
entries.concat(['daihyo_nm_kn', 'daihyo_nm', 'daihyo_zip', 'daihyo_adr', 'daihyo_tel']
|
23
|
+
.map{ |key| render_it_tag(key) })
|
24
|
+
entries << %Q(<TETSUZUKI ID="TETSUZUKI"><procedure_CD>#{@procedure_code}</procedure_CD><procedure_NM>#{@procedure_name}</procedure_NM></TETSUZUKI>)
|
25
|
+
entries.concat([jigyo_nendo_from, jigyo_nendo_to, kazei_kikan_from, kazei_kikan_to])
|
26
|
+
entries << render_it_tag('keiri_sekininsha')
|
27
|
+
entries << '<SHINKOKU_KBN ID="SHINKOKU_KBN"><kubun_CD>1</kubun_CD></SHINKOKU_KBN>'
|
28
|
+
entries.concat(['eltax_id'].map{ |key| render_it_tag(key) })
|
29
|
+
entries << '</IT>'
|
30
|
+
entries.compact.join("\n")
|
31
|
+
end
|
32
|
+
|
33
|
+
def render_it_tag(key)
|
34
|
+
content = config.dig('jp', 'it_part', key)
|
35
|
+
return nil if content.nil?
|
36
|
+
|
37
|
+
case key
|
38
|
+
when 'zeimusho'
|
39
|
+
content = parse_zeimusho(content)
|
40
|
+
when 'nozeisha_tel', 'daihyo_tel'
|
41
|
+
content = parse_tel(content)
|
42
|
+
when 'nozeisha_zip', 'daihyo_zip'
|
43
|
+
content = parse_zip(content)
|
44
|
+
when 'nozeisha_bango'
|
45
|
+
content = parse_houjinbango(content)
|
46
|
+
when 'kanpu_kinyukikan'
|
47
|
+
content = parse_kinyukikan(content)
|
48
|
+
end
|
49
|
+
|
50
|
+
tag = key.to_s.upcase
|
51
|
+
%Q(<#{tag} ID="#{tag}">#{content}</#{tag}>)
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_zeimusho(str)
|
55
|
+
items = str.split('-')
|
56
|
+
%Q(<gen:zeimusho_CD>#{items[0]}</gen:zeimusho_CD><gen:zeimusho_NM>#{items[1]}</gen:zeimusho_NM>)
|
57
|
+
end
|
58
|
+
|
59
|
+
def parse_houjinbango(str)
|
60
|
+
%Q(<gen:hojinbango>#{str}</gen:hojinbango>)
|
61
|
+
end
|
62
|
+
|
63
|
+
def parse_kinyukikan(str)
|
64
|
+
items = str.split('-')
|
65
|
+
%Q(<gen:kinyukikan_NM kinyukikan_KB="1">#{items[0]}</gen:kinyukikan_NM><gen:shiten_NM shiten_KB="2">#{items[1]}</gen:shiten_NM><gen:yokin>#{items[2]}</gen:yokin><gen:koza>#{items[3]}</gen:koza>)
|
66
|
+
end
|
67
|
+
|
68
|
+
def parse_tel(str)
|
69
|
+
num = str.split('-')
|
70
|
+
%Q(<gen:tel1>#{num[0]}</gen:tel1><gen:tel2>#{num[1]}</gen:tel2><gen:tel3>#{num[2]}</gen:tel3>)
|
71
|
+
end
|
72
|
+
|
73
|
+
def parse_zip(str)
|
74
|
+
num = str.split('-')
|
75
|
+
%Q(<gen:zip1>#{num[0]}</gen:zip1><gen:zip2>#{num[1]}</gen:zip2>)
|
76
|
+
end
|
77
|
+
|
78
|
+
def teisyutsu_day
|
79
|
+
%Q(<TEISYUTSU_DAY ID="TEISYUTSU_DAY"><gen:era>#{gengou(@issue_date)}</gen:era><gen:yy>#{wareki(@issue_date)}</gen:yy><gen:mm>#{@issue_date.month}</gen:mm><gen:dd>#{@issue_date.day}</gen:dd></TEISYUTSU_DAY>)
|
80
|
+
end
|
81
|
+
|
82
|
+
def jigyo_nendo_from
|
83
|
+
%Q(<JIGYO_NENDO_FROM ID="JIGYO_NENDO_FROM"><gen:era>#{gengou(@start_date)}</gen:era><gen:yy>#{wareki(@start_date)}</gen:yy><gen:mm>#{@start_date.month}</gen:mm><gen:dd>#{@start_date.day}</gen:dd></JIGYO_NENDO_FROM>)
|
84
|
+
end
|
85
|
+
|
86
|
+
def jigyo_nendo_to
|
87
|
+
%Q(<JIGYO_NENDO_TO ID="JIGYO_NENDO_TO"><gen:era>#{gengou(@end_date)}</gen:era><gen:yy>#{wareki(@end_date)}</gen:yy><gen:mm>#{@end_date.month}</gen:mm><gen:dd>#{@end_date.day}</gen:dd></JIGYO_NENDO_TO>)
|
88
|
+
end
|
89
|
+
|
90
|
+
def kazei_kikan_from
|
91
|
+
%Q(<KAZEI_KIKAN_FROM ID="KAZEI_KIKAN_FROM"><gen:era>#{gengou(@start_date)}</gen:era><gen:yy>#{wareki(@start_date)}</gen:yy><gen:mm>#{@start_date.month}</gen:mm><gen:dd>#{@start_date.day}</gen:dd></KAZEI_KIKAN_FROM>)
|
92
|
+
end
|
93
|
+
|
94
|
+
def kazei_kikan_to
|
95
|
+
%Q(<KAZEI_KIKAN_TO ID="KAZEI_KIKAN_TO"><gen:era>#{gengou(@end_date)}</gen:era><gen:yy>#{wareki(@end_date)}</gen:yy><gen:mm>#{@end_date.month}</gen:mm><gen:dd>#{@end_date.day}</gen:dd></KAZEI_KIKAN_TO>)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|