luca-jp 0.1.6 → 0.2.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: 0763c16ddabd7e36e33e3e52d669c7332c96c06413545741dd4901b44d747ecc
4
- data.tar.gz: 3880f6e68a30de644c7a78f28d57eba1743f983026c6badb96c6d1a83a9b4f4e
3
+ metadata.gz: 409f68316d30d3c2ebd44d2251c5bf158a93301f8c5d5561f69cf96a6332ab77
4
+ data.tar.gz: 20de0938d14d48f0bb733f5ca79fdb8c6f6157a0fac07114b82ae9851ae67688
5
5
  SHA512:
6
- metadata.gz: 8e4b891e123e3724cc74b4db3d45b913d2e72c12a339eefbb536d9761b288d3b577c1f48f3d4d3c7f629dcfa33d2e3bc0c3ee1f3eee8d9be7c4fd0a766b45a4d
7
- data.tar.gz: 2ce89b1ffce83efd18ef5fb63b9e3a9079301cb9e19b64b31de27803a7db81c1da4469317259f80802b4374b0a9359cce1109a711653b99f3a9afba013996ef8
6
+ metadata.gz: 6014749bc78f5fb165152e18c1828a783e2bb3bc2ce1bde618e1eeb5592dd94e613fbc1b40dd7a42560cd13601f75ec6018ff6eee97059d2b3bd1cac0e78b99b
7
+ data.tar.gz: f3b1c7a59698c5c5c9e9fbe35c0bab15da58ad970e5c7a867c9c23ce1e9844b543eafe14678f49a5174d109e51c0f0cc0e594b3c90f8a0a85f6d1020c9122e11
data/exe/luca-jp CHANGED
@@ -27,6 +27,11 @@ class LucaCmd
27
27
  puts Luca::Jp::Chihouzei.range(*args).kani
28
28
  end
29
29
  end
30
+
31
+ def self.urikake(args, params)
32
+ date = "#{args[0]}-#{args[1]}-1"
33
+ Luca::Jp::Urikake.new(date).report(params[:total])
34
+ end
30
35
  end
31
36
 
32
37
  cmd = ARGV.shift
@@ -54,4 +59,11 @@ when /chihou?zei/
54
59
  args = opt.parse!(ARGV)
55
60
  LucaCmd.chihouzei(args, params)
56
61
  end
62
+ when /urikake/
63
+ OptionParser.new do |opt|
64
+ opt.banner = 'Usage: luca-jp urikake [options] yyyy mm'
65
+ opt.on('--total VAL', '売掛金総額') { |v| params[:total] = v&.to_i }
66
+ args = opt.parse!(ARGV)
67
+ LucaCmd.urikake(args, params)
68
+ end
57
69
  end
data/lib/luca/jp.rb CHANGED
@@ -12,6 +12,8 @@ module Luca
12
12
  autoload :Common, 'luca/jp/common'
13
13
  autoload :ItPart, 'luca/jp/it_part'
14
14
  autoload :Sonshitsu, 'luca/jp/sonshitsu'
15
+ autoload :Urikake, 'luca/jp/urikake'
16
+ autoload :Uchiwake, 'luca/jp/uchiwake'
15
17
  autoload :Util, 'luca/jp/util'
16
18
  end
17
19
 
data/lib/luca/jp/aoiro.rb CHANGED
@@ -16,6 +16,7 @@ module Luca
16
16
  include Luca::Jp::Common
17
17
  include Luca::Jp::ItPart
18
18
  include Luca::Jp::Util
19
+ include Luca::Jp::Uchiwake
19
20
 
20
21
  @dirname = 'journals'
21
22
  @record_type = 'raw'
@@ -65,10 +66,20 @@ module Luca
65
66
  @納税充当金期中増, @納税充当金期中減 = 納税充当金期中増減
66
67
  @翌期還付法人税 = 中間還付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
67
68
  @概況売上 = gaikyo('A0')
68
- @form_sec = ['HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 別表七フォーム, 'HOE200', 適用額明細フォーム, 'HOI010', 'HOI100', 'HOI141', 'HOK010'].compact.map{ |c| form_rdf(c) }.join('')
69
- #@extra_form_sec = ['HOI040', 'HOI060', 'HOI090', 'HOI110']
69
+ @form_sec = [
70
+ 'HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 別表七フォーム,
71
+ 'HOE200', 適用額明細フォーム,
72
+ 'HOI010', 有価証券内訳フォーム, 買掛金内訳フォーム, 'HOI100', 借入金内訳フォーム, 'HOI141', 地代家賃内訳フォーム,
73
+ 'HOK010'
74
+ ].compact.map{ |c| form_rdf(c) }.join('')
75
+ #@extra_form_sec = ['HOI040']
70
76
  @it = it_part
71
- @form_data = [別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五, 適用額明細, 預貯金内訳, 仮受金内訳, 役員報酬内訳, 概況説明].compact.join("\n")
77
+ @form_data = [
78
+ 別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五,
79
+ 適用額明細,
80
+ 預貯金内訳, 有価証券内訳, 買掛金内訳, 仮受金内訳, 借入金内訳, 役員報酬内訳, 地代家賃内訳,
81
+ 概況説明
82
+ ].compact.join("\n")
72
83
  render_erb(search_template('aoiro.xtx.erb'))
73
84
  end
74
85
  end
@@ -168,28 +179,6 @@ module Luca
168
179
  render_erb(search_template('beppyo15.xml.erb'))
169
180
  end
170
181
 
171
- def 預貯金内訳
172
- @預金 = @bs_data.each.with_object({}) do |(k, v), h|
173
- next unless /^110[0-9A-Z]/.match(k)
174
- next unless readable(v || 0) > 0
175
-
176
- h[@@dict.dig(k)[:label]] = readable(v)
177
- end
178
- render_erb(search_template('yokin-meisai.xml.erb'))
179
- end
180
-
181
- def 仮受金内訳
182
- @源泉給与 = readable(@bs_data.dig('5191') || 0)
183
- @源泉報酬 = readable(@bs_data.dig('5193') || 0)
184
- render_erb(search_template('kariuke-meisai.xml.erb'))
185
- end
186
-
187
- def 役員報酬内訳
188
- @役員報酬 = readable(@pl_data.dig('C11') || 0)
189
- @給料 = readable(@pl_data.dig('C12') || 0)
190
- render_erb(search_template('yakuin-meisai.xml.erb'))
191
- end
192
-
193
182
  def 適用額明細フォーム
194
183
  return nil if @確定法人税額 == 0
195
184
 
@@ -237,6 +226,10 @@ module Luca
237
226
  render_erb(search_template('gaikyo.xml.erb'))
238
227
  end
239
228
 
229
+ def self.dict
230
+ @@dict
231
+ end
232
+
240
233
  private
241
234
 
242
235
  def 期首未納事業税
@@ -252,7 +245,91 @@ module Luca
252
245
  end
253
246
 
254
247
  def 租税公課
255
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'C1I')[:debit]['C1I']) || 0
248
+ readable(debit_amount('C1I', @start_date.year, @start_date.month, @end_date.year, @end_date.month))
249
+ end
250
+
251
+ def 別表一同族区分
252
+ case 同族会社?
253
+ when nil
254
+ nil
255
+ when true
256
+ '<kubun_CD>1</kubun_CD>'
257
+ else
258
+ '<kubun_CD>3</kubun_CD>'
259
+ end
260
+ end
261
+
262
+ def 別表二同族区分
263
+ case 同族会社?
264
+ when nil
265
+ nil
266
+ when true
267
+ '<kubun_CD>2</kubun_CD>'
268
+ else
269
+ '<kubun_CD>3</kubun_CD>'
270
+ end
271
+ end
272
+
273
+ def 別表二株主リスト
274
+ return '' if beppyo2_config('owners').nil?
275
+
276
+ tags = beppyo2_config('owners')[1..-1]&.map.with_index(2) do |owner, i|
277
+ %Q(<VAE00170>
278
+ <VAE00180>
279
+ <VAE00190>#{i}</VAE00190>
280
+ <VAE00200>#{i}</VAE00200>
281
+ </VAE00180>
282
+ <VAE00210>
283
+ #{render_attr('VAE00220', owner['address'])}
284
+ #{render_attr('VAE00230', owner['name'])}
285
+ </VAE00210>
286
+ #{render_attr('VAE00235', owner['relation'] || '<kubun_CD>90</kubun_CD>')}
287
+ <VAE00250>
288
+ <VAE00290>
289
+ #{render_attr('VAE00300', owner['shares'])}
290
+ <VAE00310>
291
+ #{render_attr('VAE00330', owner['votes'])}
292
+ </VAE00310>
293
+ </VAE00290>
294
+ </VAE00250>
295
+ </VAE00170>)
296
+ end
297
+ tags.compact.join("\n")
298
+ end
299
+
300
+ def 別表二上位株数
301
+ return nil if beppyo2_config('owners').nil?
302
+
303
+ beppyo2_config('owners')[0..2].map{ |owner| owner['shares']&.to_i || 0 }.sum
304
+ end
305
+
306
+ def 別表二上位株割合
307
+ return nil if beppyo2_config('total_shares').nil?
308
+ return nil if beppyo2_config('owners').nil?
309
+
310
+ (別表二上位株数 * 100.0 / beppyo2_config('total_shares')).round(1)
311
+ end
312
+
313
+ def 別表二上位議決権数
314
+ return nil if beppyo2_config('owners').nil?
315
+
316
+ beppyo2_config('owners')[0..2].map{ |owner| owner['votes']&.to_i || 0 }.sum
317
+ end
318
+
319
+ def 別表二上位議決権割合
320
+ return nil if beppyo2_config('total_votes').nil?
321
+ return nil if beppyo2_config('owners').nil?
322
+
323
+ (別表二上位議決権数 * 100.0 / beppyo2_config('total_votes')).round(1)
324
+ end
325
+
326
+ # TODO: 特定同族会社の判定
327
+ #
328
+ def 同族会社?
329
+ return nil if it_part_config('shihon_kin') > 100_000_000
330
+
331
+ return true if 別表二上位議決権割合 > 50 || 別表二上位株割合 > 50
332
+ false
256
333
  end
257
334
 
258
335
  def 別表四還付法人税等金額
@@ -272,9 +349,9 @@ module Luca
272
349
 
273
350
  %Q(<ICB00140>
274
351
  #{render_attr('ICB00150', '仮払税金')}
275
- #{render_attr('ICB00160', 未収仮払税金 * -1)}
352
+ #{render_attr('ICB00160', readable(未収仮払税金) * -1)}
276
353
  <ICB00170>
277
- #{render_attr('ICB00190', 還付税金 * -1)}
354
+ #{render_attr('ICB00190', readable(還付税金) * -1)}
278
355
  #{render_attr('ICB00200', @仮払税金 * -1)}
279
356
  </ICB00170>
280
357
  #{render_attr('ICB00210', @仮払税金 * -1)}
@@ -496,6 +573,19 @@ module Luca
496
573
  [readable(increase), readable(r)]
497
574
  end
498
575
 
576
+ def 概況源泉徴収種類
577
+ tags = []
578
+ if credit_count('5191', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
579
+ tags << render_attr('IAF03100', '<kubun_CD>1</kubun_CD>')
580
+ end
581
+ if credit_count('5193', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
582
+ tags << render_attr('IAF03200', '<kubun_CD>1</kubun_CD>')
583
+ elsif credit_count('5194', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
584
+ tags << render_attr('IAF03200', '<kubun_CD>1</kubun_CD>')
585
+ end
586
+ tags.compact.join("\n")
587
+ end
588
+
499
589
  def 概況月(idx)
500
590
  @start_date.next_month(idx).month
501
591
  end
@@ -518,13 +608,17 @@ module Luca
518
608
 
519
609
  def 概況月源泉徴収(idx)
520
610
  target = @start_date.next_month(idx)
521
- readable(LucaBook::State.gross(target.year, target.month, code: '5191')[:credit]['5191'] || 0)
522
- + readable(LucaBook::State.gross(target.year, target.month, code: '5193')[:credit]['5193'] || 0)
611
+ [
612
+ readable(credit_amount('5191', target.year, target.month, target.year, target.month)),
613
+ readable(credit_amount('5193', target.year, target.month, target.year, target.month))
614
+ ].sum
523
615
  end
524
616
 
525
617
  def 概況源泉徴収
526
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5191')[:credit]['5191'] || 0)
527
- + readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5193')[:credit]['5193'] || 0)
618
+ [
619
+ readable(credit_amount('5191', @start_date.year, @start_date.month, @end_date.year, @end_date.month)),
620
+ readable(credit_amount('5193', @start_date.year, @start_date.month, @end_date.year, @end_date.month))
621
+ ].sum
528
622
  end
529
623
 
530
624
  def gaikyo(code)
@@ -24,8 +24,9 @@ module Luca
24
24
  @issue_date = Date.today
25
25
  @company = CGI.escapeHTML(config.dig('company', 'name'))
26
26
  @software = 'LucaJp'
27
- @jimusho_code = config.dig('jp', 'eltax', 'jimusho_code')
28
- @jimusho_name = '都税事務所長'
27
+ @jimusho_code = eltax_config('jimusho_code')
28
+ @jimusho_name = eltax_config('jimusho_name')
29
+ @app_version = eltax_config('app_version')
29
30
 
30
31
  @税額 = 税額計算
31
32
  @均等割 = @税額.dig(:kenmin, :kintou)
@@ -63,7 +64,7 @@ module Luca
63
64
  @procedure_code = 'R0102100'
64
65
  @procedure_name = '法人都道府県民税・事業税・特別法人事業税又は地方法人特別税 確定申告'
65
66
  @form_sec = ['R0102AA190', 'R0102AG120', 別表九フォーム].compact.map{ |c| form_attr(c) }.join('')
66
- @user_inf = render_erb(search_template('el-userinf.xml.erb'))
67
+ @user_inf = render_erb(search_template('eltax-userinf.xml.erb'))
67
68
  @form_data = [第六号, 別表四三, 別表九].compact.join("\n")
68
69
  render_erb(search_template('eltax.xml.erb'))
69
70
  end
@@ -105,6 +106,7 @@ module Luca
105
106
  end
106
107
 
107
108
  def 第六号
109
+ @資本金準備金 = eltax_config('shihon') || it_part_config('shihon_kin')
108
110
  render_erb(search_template('el-no6.xml.erb'))
109
111
  end
110
112
 
@@ -128,8 +130,7 @@ module Luca
128
130
  private
129
131
 
130
132
  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
+ (@税額.dig(:houjin, :kokuzei) / 1000).floor * 1000
133
134
  end
134
135
 
135
136
  def 事業税中間納付
@@ -166,8 +167,24 @@ module Luca
166
167
  </AMB00200>)
167
168
  end
168
169
 
170
+ def eltax_kouza
171
+ items = it_part_config('kanpu_kinyukikan').split('-')
172
+ %Q(<gen:kubun_CD />
173
+ <gen:kinyukikan_NM>#{items[0]}</gen:kinyukikan_NM>
174
+ <gen:shiten_NM>#{items[1]}</gen:shiten_NM>
175
+ <gen:kinyukikan_CD />
176
+ <gen:shiten_CD />
177
+ <gen:yokin>1</gen:yokin>
178
+ <gen:koza>#{items[3]}</gen:koza>)
179
+ end
180
+
169
181
  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>"
182
+ name = {
183
+ 'R0102AA' => '中間・確定申告書',
184
+ 'R0102AG' => '均等割額の計算に関する明細書',
185
+ 'R0102AM' => '欠損金額等及び災害損失金の控除明細書'
186
+ }[code[0,7]]
187
+ "<FORM_ATTR><FORM_ID>#{code}</FORM_ID><FORM_NAME>#{name}</FORM_NAME><FORM_FILE_NAME></FORM_FILE_NAME><FORM_XSL_NAME></FORM_XSL_NAME></FORM_ATTR>"
171
188
  end
172
189
 
173
190
  def karibarai_label(key)
@@ -208,8 +208,8 @@ module Luca
208
208
  end
209
209
 
210
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)]
211
+ r = gross_amount('5152', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
212
+ [LucaSupport::Code.readable(r[0]), LucaSupport::Code.readable(r[1])]
213
213
  end
214
214
 
215
215
 
@@ -24,7 +24,7 @@ module Luca
24
24
  entries << %Q(<TETSUZUKI ID="TETSUZUKI"><procedure_CD>#{@procedure_code}</procedure_CD><procedure_NM>#{@procedure_name}</procedure_NM></TETSUZUKI>)
25
25
  entries.concat([jigyo_nendo_from, jigyo_nendo_to, kazei_kikan_from, kazei_kikan_to])
26
26
  entries << render_it_tag('keiri_sekininsha')
27
- entries << '<SHINKOKU_KBN ID="SHINKOKU_KBN"><kubun_CD>1</kubun_CD></SHINKOKU_KBN>'
27
+ entries << '<SHINKOKU_KBN ID="SHINKOKU_KBN"><kubun_CD>30</kubun_CD></SHINKOKU_KBN>'
28
28
  entries.concat(['eltax_id'].map{ |key| render_it_tag(key) })
29
29
  entries << '</IT>'
30
30
  entries.compact.join("\n")
@@ -12,6 +12,7 @@ module Luca
12
12
  module Jp
13
13
  class Syouhizei < LucaBook::State
14
14
  include LucaSupport::View
15
+ include Luca::Jp::Common
15
16
  include Luca::Jp::ItPart
16
17
  include Luca::Jp::Util
17
18
 
@@ -14,8 +14,10 @@
14
14
  <BGA00110 IDREF="DAIHYO_NM"/>
15
15
  </BGA00090>
16
16
  <BGA00120 IDREF="DAIHYO_ADR"/>
17
+ <BGA00130><kubun_CD>1</kubun_CD></BGA00130>
17
18
  <BGA00140 IDREF="JIGYO_NAIYO"/>
18
19
  <BGA00150 IDREF="SHIHON_KIN"/>
20
+ <%= render_attr('BGA00170', 別表一同族区分) %>
19
21
  <BGA00210>
20
22
  <BGA00220><kubun_CD>1</kubun_CD></BGA00220>
21
23
  <BGA00230><kubun_CD>1</kubun_CD></BGA00230>
@@ -6,4 +6,36 @@
6
6
  </VAA00010>
7
7
  <VAA00040 IDREF="NOZEISHA_NM"/>
8
8
  </VAA00000>
9
+ <VAB00000>
10
+ <%= render_attr('VAB00010', beppyo2_config('total_shares')) %>
11
+ <%= render_attr('VAB00020', 別表二上位株数) %>
12
+ <%= render_attr('VAB00030', 別表二上位株割合) %>
13
+ <VAB00040>
14
+ <%= render_attr('VAB00060', beppyo2_config('total_votes')) %>
15
+ </VAB00040>
16
+ <%= render_attr('VAB00070', 別表二上位議決権数) %>
17
+ <%= render_attr('VAB00080', 別表二上位議決権割合) %>
18
+ </VAB00000>
19
+ <%= render_attr('VAD00000', 別表二同族区分) %>
20
+ <VAE00000>
21
+ <VAE00010>
22
+ <VAE00020>
23
+ <VAE00030>1</VAE00030>
24
+ <VAE00040>1</VAE00040>
25
+ </VAE00020>
26
+ <VAE00050>
27
+ <%= render_attr('VAE00060', beppyo2_config('owners')&.dig(0, 'address')) %>
28
+ <%= render_attr('VAE00070', beppyo2_config('owners')&.dig(0, 'name')) %>
29
+ </VAE00050>
30
+ <VAE00080>
31
+ <VAE00120>
32
+ <%= render_attr('VAE00130', beppyo2_config('owners')&.dig(0, 'shares')) %>
33
+ <VAE00140>
34
+ <%= render_attr('VAE00160', beppyo2_config('owners')&.dig(0, 'votes')) %>
35
+ </VAE00140>
36
+ </VAE00120>
37
+ </VAE00080>
38
+ </VAE00010>
39
+ <%= 別表二株主リスト %>
40
+ </VAE00000>
9
41
  </HOA201>
@@ -61,6 +61,10 @@
61
61
  <%= render_attr('ARE00010', @別表四調整所得) %>
62
62
  <%= render_attr('ARE00020', @別表四調整所得) %>
63
63
  </ARE00000>
64
+ <ARZ10000>
65
+ <%= render_attr('ARZ10010', @別表四調整所得) %>
66
+ <%= render_attr('ARZ10020', @別表四調整所得) %>
67
+ </ARZ10000>
64
68
  <ARK00000>
65
69
  <%= render_attr('ARK00010', @別表四調整所得) %>
66
70
  <%= render_attr('ARK00020', @別表四調整所得) %>
@@ -0,0 +1,15 @@
1
+ <HOI150 page="1" VR="3.0" id="HOI150" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <HOB00000>
3
+ <% @地代家賃.values.each do |rent| %>
4
+ <HOB10000>
5
+ <%= render_attr('HOB11000', rent[:rent_type]) %>
6
+ <%= render_attr('HOB12000', rent[:rent_purpose]) %>
7
+ <%= render_attr('HOB13000', rent[:rent_address]) %>
8
+ <%= render_attr('HOB14000', rent[:name]) %>
9
+ <%= render_attr('HOB15000', rent[:address]) %>
10
+ <%= render_attr('HOB17000', rent[:amount]) %>
11
+ <%= render_attr('HOB18000', rent[:note]) %>
12
+ </HOB10000>
13
+ <% end %>
14
+ </HOB00000>
15
+ </HOI150>
@@ -1,4 +1,4 @@
1
- <R0102AG120 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="120" page="" seiseiSoft="<%= @software %>" seiseiVr="" seiseiDay="" seiseiNM="" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
1
+ <R0102AG120 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="120" page="" seiseiSoft="<%= @software %>" seiseiVr="1" seiseiDay="<%= Date.today.strftime('%Y%m%d') %>" seiseiNM="<%= it_part_config('nozeisha_nm') %>" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
2
2
  <AGA_JIGYO_SDATE idref="SDATE">
3
3
  <gen:era></gen:era><gen:yy></gen:yy><gen:mm></gen:mm><gen:dd></gen:dd>
4
4
  <gen:yyyymmdd></gen:yyyymmdd>
@@ -1,4 +1,4 @@
1
- <R0102AM190 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="190" page="" seiseiSoft="<%= @software %>" seiseiVr="" seiseiDay="" seiseiNM="" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
1
+ <R0102AM190 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="190" page="" seiseiSoft="<%= @software %>" seiseiVr="1" seiseiDay="<%= Date.today.strftime('%Y%m%d') %>" seiseiNM="<%= it_part_config('nozeisha_nm') %>" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
2
2
  <AMA_JIGYO_SDATE idref="SDATE">
3
3
  <gen:era></gen:era><gen:yy></gen:yy><gen:mm></gen:mm><gen:dd></gen:dd>
4
4
  <gen:yyyymmdd></gen:yyyymmdd>
@@ -29,7 +29,7 @@
29
29
  <%= render_attr('AMB00430', 期首繰越損失) %>
30
30
  <%= render_attr('AMB00440', 当期控除計) %>
31
31
  <%= render_attr('AMB00450', 翌期繰越損失) %>
32
- <AMB00325 />
32
+ <AMB00325>1</AMB00325>
33
33
  <%= render_attr('AMB00330', 当期繰越損失) %>
34
34
  <AMB00360 />
35
35
  <AMB00365 />
@@ -1,4 +1,4 @@
1
- <R0102AA190 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="190" page="" seiseiSoft="<%= @software %>" seiseiVr="" seiseiDay="" seiseiNM="" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
1
+ <R0102AA190 xmlns="http://eltax.jp/HOJIN_DOFUKEN" vr="190" page="" seiseiSoft="<%= @software %>" seiseiVr="1" seiseiDay="<%= Date.today.strftime('%Y%m%d') %>" seiseiNM="<%= it_part_config('nozeisha_nm') %>" koshinSoft="" koshinVr="" koshinDay="" koshinNM="" taari="">
2
2
  <AAA00100 idref="SEIRI_NUM" />
3
3
  <AAA00200 idref="JIMUSHO_NUM"></AAA00200>
4
4
  <AAA00300 idref="HOJIN_NUM"></AAA00300>
@@ -41,9 +41,9 @@
41
41
  <AAA_SHIHON idref="SHIHON"></AAA_SHIHON>
42
42
  <AAA_SHIHON3></AAA_SHIHON3>
43
43
  <AAA_SHIHON4></AAA_SHIHON4>
44
- <AAA_SHIHON2 />
45
- <AAA_SHIHON5></AAA_SHIHON5>
46
- <AAA_SHIHON6></AAA_SHIHON6>
44
+ <AAA_SHIHON2><%= @資本金準備金 %></AAA_SHIHON2>
45
+ <AAA_SHIHON5><%= @資本金準備金 %></AAA_SHIHON5>
46
+ <AAA_SHIHON6><%= @資本金準備金 %></AAA_SHIHON6>
47
47
  <AAA_JIGYO_SDATE idref="SDATE">
48
48
  <gen:era></gen:era>
49
49
  <gen:yy></gen:yy>
@@ -68,7 +68,7 @@
68
68
  <AAB00600><%= 法人税割課税標準 %></AAB00600>
69
69
  <AAB00700 />
70
70
  <AAB00800 />
71
- <AAB00810><%= 法人税割 %></AAB00810>
71
+ <AAB00810><%= 法人税割[0] %></AAB00810>
72
72
  <AAB00820 />
73
73
  <AAB00850 />
74
74
  <AAB00900 />
@@ -155,16 +155,8 @@
155
155
  <%= render_attr('AAF00700', @繰越損失管理.deduction) %>
156
156
  <%= render_attr('AAG00100', 所得金額) %>
157
157
  <AAH00100 />
158
- <AAH00200 />
159
- <AAH00400>
160
- <gen:kubun_CD />
161
- <gen:kinyukikan_NM></gen:kinyukikan_NM>
162
- <gen:shiten_NM></gen:shiten_NM>
163
- <gen:kinyukikan_CD />
164
- <gen:shiten_CD />
165
- <gen:yokin>1</gen:yokin>
166
- <gen:koza></gen:koza>
167
- </AAH00400>
158
+ <AAH00200><%= 中間還付税額(@確定法人税割, @法人税割中間納付) + 中間還付税額(@所得割, 事業税中間納付) + 中間還付税額(地方法人特別税(@所得割), @地方特別法人事業税中間納付) %></AAH00200>
159
+ <AAH00400><%= eltax_kouza %></AAH00400>
168
160
  <AAI00100>
169
161
  <gen:era />
170
162
  <gen:yy />
@@ -183,8 +175,8 @@
183
175
  <gen:mm />
184
176
  <gen:dd />
185
177
  </AAI01000>
186
- <AAI00600 />
187
- <AAI00500 />
178
+ <AAI00600>2</AAI00600>
179
+ <AAI00500>2</AAI00500>
188
180
  <AAI00200>
189
181
  <gen:era />
190
182
  <gen:yy />
@@ -197,9 +189,9 @@
197
189
  <gen:mm />
198
190
  <gen:dd />
199
191
  </AAI00300>
200
- <AAI00400 />
201
- <AAI00450 />
202
- <AAI00700 />
192
+ <AAI00400>1</AAI00400>
193
+ <AAI00450><%= @税額.dig(:houjin, :kokuzei) %></AAI00450>
194
+ <AAI00700><%= @税額.dig(:houjin, :kokuzei) > 200000 ? 1 : 2 %></AAI00700>
203
195
  <AAI00800 />
204
196
  <AAJ_DAIRI_NAME></AAJ_DAIRI_NAME>
205
197
  <AAJ_DAIRI_TEL_NUM></AAJ_DAIRI_TEL_NUM>
@@ -0,0 +1,20 @@
1
+ <USER_INF id="USER_INF">
2
+ <USER_ID id="USER_ID"><%= it_part_config('eltax_id') %></USER_ID>
3
+ <KANA id="KANA"><%= it_part_config('nozeisha_nm_kn') %></KANA>
4
+ <NAME id="NAME"><%= it_part_config('nozeisha_nm') %></NAME>
5
+ <HONTEN id="HONTEN">
6
+ <HONTEN_ADDR id="HONTEN_ADDR"><%= it_part_config('nozeisha_adr') %></HONTEN_ADDR>
7
+ <HONTEN_ZIP id="HONTEN_ZIP"><%= it_part_config('nozeisha_zip').gsub('-', '') %></HONTEN_ZIP>
8
+ <HONTEN_TEL id="HONTEN_TEL"><%= it_part_config('nozeisha_tel').gsub('-', '') %></HONTEN_TEL>
9
+ </HONTEN>
10
+ <DAIHYO id="DAIHYO">
11
+ <DAIHYOKAKU_CD id="DAIHYOKAKU_CD">01</DAIHYOKAKU_CD>
12
+ <DAIHYO_KANA id="DAIHYO_KANA"><%= it_part_config('daihyo_nm_kn') %></DAIHYO_KANA>
13
+ <DAIHYO_NAME id="DAIHYO_NAME"><%= it_part_config('daihyo_nm') %></DAIHYO_NAME>
14
+ <DAIHYO_ADDR id="DAIHYO_ADDR"><%= it_part_config('daihyo_adr') %></DAIHYO_ADDR>
15
+ <DAIHYO_ZIP id="DAIHYO_ZIP"><%= it_part_config('daihyo_zip').gsub('-', '') %></DAIHYO_ZIP>
16
+ <DAIHYO_TEL id="DAIHYO_TEL"></DAIHYO_TEL>
17
+ </DAIHYO>
18
+ <T_RCPT_NUM id="T_RCPT_NUM"><%= eltax_config('receipt_num') %></T_RCPT_NUM>
19
+ <HOJIN_NUMBER id="HOJIN_NUMBER"><%= it_part_config('nozeisha_bango') %></HOJIN_NUMBER>
20
+ </USER_INF>
@@ -21,14 +21,14 @@
21
21
  <gen:yy><%= wareki(@start_date) %></gen:yy>
22
22
  <gen:mm><%= @start_date.month %></gen:mm>
23
23
  <gen:dd><%= @start_date.day %></gen:dd>
24
- <gen:yyyymmdd></gen:yyyymmdd>
24
+ <gen:yyyymmdd><%= @start_date.strftime('%Y%m%d') %></gen:yyyymmdd>
25
25
  </SDATE>
26
26
  <EDATE id="EDATE">
27
27
  <gen:era><%= gengou(@end_date) %></gen:era>
28
28
  <gen:yy><%= wareki(@end_date) %></gen:yy>
29
29
  <gen:mm><%= @end_date.month %></gen:mm>
30
30
  <gen:dd><%= @end_date.day %></gen:dd>
31
- <gen:yyyymmdd></gen:yyyymmdd >
31
+ <gen:yyyymmdd><%= @end_date.strftime('%Y%m%d') %></gen:yyyymmdd >
32
32
  </EDATE>
33
33
  <RPT_DATE id="RPT_DATE">
34
34
  <gen:era><%= gengou(@issue_date) %></gen:era>
@@ -74,15 +74,15 @@
74
74
  <KAZEI_TEL id="KAZEI_TEL" />
75
75
  <HOGEN_NUM id="HOGEN_NUM" />
76
76
  <KANRI_NUM id="KANRI_NUM" />
77
- <KAZEI_NUM id="KAZEI_NUM"></KAZEI_NUM>
77
+ <KAZEI_NUM id="KAZEI_NUM"><%= eltax_config('x_houjin_bango') %></KAZEI_NUM>
78
78
  <HOJO_NUM id="HOJO_NUM" />
79
79
  <STF_NUM id="STF_NUM" />
80
80
  </ORG_INF>
81
- <STIME id="STIME"></STIME>
81
+ <STIME id="STIME"><%= @app_version %></STIME>
82
82
  <HOJIN_DOFUKEN id="HOJIN_DOFUKEN">
83
83
  <FORM_INF id="FORM_INF">
84
- <JIGYO_NAME id="JIGYO_NAME"></JIGYO_NAME>
85
- <SHIHON id="SHIHON"></SHIHON>
84
+ <JIGYO_NAME id="JIGYO_NAME"><%= it_part_config('jigyo_naiyo') %></JIGYO_NAME>
85
+ <SHIHON id="SHIHON"><%= it_part_config('shihon_kin') %></SHIHON>
86
86
  <HOJIN_NUM id="HOJIN_NUM"></HOJIN_NUM>
87
87
  <JIMUSHO_NUM id="JIMUSHO_NUM"><%= @jimusho_code %></JIMUSHO_NUM>
88
88
  <SEIRI_NUM id="SEIRI_NUM" />
@@ -104,7 +104,7 @@
104
104
  <SYSTEM_INF id="SYSTEM_INF">
105
105
  <SYSTEM_DATA id="SYSTEM_DATA"></SYSTEM_DATA>
106
106
  <NOUZEI_UPDATE id="NOUZEI_UPDATE">
107
- <SDATE></SDATE>
107
+ <SDATE><%= DateTime.now.strftime('%Y%m%d%H%M%S') %></SDATE>
108
108
  <UDATE></UDATE>
109
109
  <SIGN_DATE></SIGN_DATE>
110
110
  <SEND_DATE></SEND_DATE>
@@ -10,8 +10,46 @@
10
10
  <IAA02200 IDREF="JIGYO_NENDO_TO"/>
11
11
  </IAA02000>
12
12
  <IAA02300 IDREF="NOZEISHA_BANGO"/>
13
+ <IAA02400><kubun_CD><%= gaikyo_config('homepage') ? 1 : 2 %></kubun_CD></IAA02400>
14
+ <%= render_attr('IAA02500', gaikyo_config('homepage')) %>
13
15
  </IAA00000>
16
+ <%= render_attr('IAS00000', it_part_config('jigyo_naiyo')) %>
17
+ <IAC00000>
18
+ <IAC01000>
19
+ <%= render_attr('IAC01100', gaikyo_config('shiten_kokunai')) %>
20
+ <%= render_attr('IAC01300', gaikyo_config('shiten_kaigai')) %>
21
+ </IAC01000>
22
+ <IAC02000>
23
+ <%= render_attr('IAC02050', gaikyo_config('kogaisha_kokunai')) %>
24
+ <%= render_attr('IAC02100', gaikyo_config('kogaisha_kaigai')) %>
25
+ </IAC02000>
26
+ </IAC00000>
27
+ <IAD00000>
28
+ <IAD01000>
29
+ <%= render_attr('IAD01100', gaikyo_config('yakuin')) %>
30
+ </IAD01000>
31
+ </IAD00000>
32
+ <IAE00000>
33
+ <%= render_attr('IAE01000', gaikyo_config('software_kaikei') ? '<kubun_CD>1</kubun_CD>' : nil) %>
34
+ <IAE03000>
35
+ <%= render_attr('IAE03600', gaikyo_config('software_kaikei') ? '<kubun_CD>1</kubun_CD>' : nil) %>
36
+ </IAE03000>
37
+ <%= render_attr('IAE04300', gaikyo_config('software_kaikei') ? '<kubun_CD>1</kubun_CD>' : nil) %>
38
+ <%= render_attr('IAE04500', gaikyo_config('software_kaikei')) %>
39
+ <%= render_attr('IAE04600', gaikyo_config('software_mail')) %>
40
+ </IAE00000>
14
41
  <IAF00000>
42
+ <IAF01000>
43
+ <IAF01100>
44
+ <%= render_attr('IAF01110', gaikyo_config('genkin_kanrisha')) %>
45
+ </IAF01100>
46
+ <IAF01200>
47
+ <%= render_attr('IAF01210', gaikyo_config('tsucho_kanrisha')) %>
48
+ </IAF01200>
49
+ </IAF01000>
50
+ <IAF03000>
51
+ <%= 概況源泉徴収種類 %>
52
+ </IAF03000>
15
53
  <IAF04000>
16
54
  <%= render_attr('IAF04200', 消費税課税売上高) %>
17
55
  </IAF04000>
@@ -58,6 +96,33 @@
58
96
  </IAI03000>
59
97
  </HOK010-1>
60
98
  <HOK010-2>
99
+ <IAJ00000>
100
+ <IAJ03000>
101
+ <%= render_attr('IAJ03100', gaikyo_config('genkin_share')) %>
102
+ <%= render_attr('IAJ03200', gaikyo_config('kake_share')) %>
103
+ </IAJ03000>
104
+ </IAJ00000>
105
+ <IAL00000>
106
+ <IAL01000>
107
+ <%= render_attr('IAL01100', gaikyo_config('shimekiri_uriage')||gaikyo_config('shimekiri')) %>
108
+ <%= render_attr('IAL01200', gaikyo_config('kessai_uriage')||gaikyo_config('kessai')) %>
109
+ </IAL01000>
110
+ <IAL02000>
111
+ <%= render_attr('IAL02100', gaikyo_config('shimekiri_shiire')||gaikyo_config('shimekiri')) %>
112
+ <%= render_attr('IAL02200', gaikyo_config('kessai_shiire')||gaikyo_config('kessai')) %>
113
+ </IAL02000>
114
+ <IAL03000>
115
+ <%= render_attr('IAL03100', gaikyo_config('shimekiri_gaichu')||gaikyo_config('shimekiri')) %>
116
+ <%= render_attr('IAL03200', gaikyo_config('kessai_gaichu')||gaikyo_config('kessai')) %>
117
+ </IAL03000>
118
+ <IAL04000>
119
+ <%= render_attr('IAL04100', gaikyo_config('shimekiri_kyuryou')||gaikyo_config('shimekiri')) %>
120
+ <%= render_attr('IAL04200', gaikyo_config('kessai_kyuryou')||gaikyo_config('kessai')) %>
121
+ </IAL04000>
122
+ </IAL00000>
123
+ <IAM00000>
124
+ <%= render_attr('IAM01000', '総勘定元帳') %>
125
+ </IAM00000>
61
126
  <IAP00000>
62
127
  <% 12.times do |i| %>
63
128
  <IAP20000>
@@ -0,0 +1,16 @@
1
+ <HOI090 page="1" VR="4.0" id="HOI090" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <% @買掛金.values.each do |payable| %>
3
+ <HIB00000>
4
+ <%= render_attr('HIB00100', payable[:payable_type]) %>
5
+ <HIB00200>
6
+ <%= render_attr('HIB00210', payable[:name]) %>
7
+ <%= render_attr('HIB00220', payable[:address]) %>
8
+ </HIB00200>
9
+ <%= render_attr('HIB00300', payable[:amount]) %>
10
+ <%= render_attr('HIB00400', payable[:note]) %>
11
+ </HIB00000>
12
+ <% end %>
13
+ <HIC00000>
14
+ <%= render_attr('HIC00100', 買掛金等合計) %>
15
+ </HIC00000>
16
+ </HOI090>
@@ -0,0 +1,13 @@
1
+ <HOI110 page="1" VR="3.0" id="HOI110" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <% @借入金.values.each do |debt| %>
3
+ <HKB00000>
4
+ <%= render_attr('HKB00100', debt[:name]) %>
5
+ <%= render_attr('HKB00300', debt[:address]) %>
6
+ <%= render_attr('HKB00400', debt[:amount]) %>
7
+ <%= render_attr('HKB00800', debt[:note]) %>
8
+ </HKB00000>
9
+ <% end %>
10
+ <HKC00000>
11
+ <%= render_attr('HKC00100', 借入金合計) %>
12
+ </HKC00000>
13
+ </HOI110>
@@ -0,0 +1,21 @@
1
+ <HOI060 page="1" VR="4.0" id="HOI060" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
+ <% @有価証券.values.each do |scurity| %>
3
+ <HFB00000>
4
+ <HFB00110>
5
+ <%= render_attr('HFB00120', scurity[:security_purpose]) %>
6
+ <%= render_attr('HFB00130', scurity[:security_genre]) %>
7
+ <%= render_attr('HFB00140', scurity[:name]) %>
8
+ </HFB00110>
9
+ <HFB00200>
10
+ <%= render_attr('HFB00210', scurity[:security_units]) %>
11
+ <HFB00215>
12
+ <%= render_attr('HFB00230', scurity[:amount]) %>
13
+ </HFB00215>
14
+ </HFB00200>
15
+ <%= render_attr('HFB00400', scurity[:note]) %>
16
+ </HFB00000>
17
+ <% end %>
18
+ <HFC00000>
19
+ <%= render_attr('HFC00100', 有価証券合計) %>
20
+ </HFC00000>
21
+ </HOI060>
@@ -4,6 +4,7 @@
4
4
  <MAA00020 IDREF="JIGYO_NENDO_FROM"/>
5
5
  <MAA00030 IDREF="JIGYO_NENDO_TO"/>
6
6
  </MAA00010>
7
+ <MAA00040><kubun_CD>1</kubun_CD></MAA00040>
7
8
  <MAA00050 IDREF="TEISYUTSU_DAY"/>
8
9
  <MAA00060 IDREF="ZEIMUSHO"/>
9
10
  <MAA00070 IDREF="NOZEISHA_ADR"/>
@@ -14,6 +15,7 @@
14
15
  </MAA00090>
15
16
  <MAA00115 IDREF="NOZEISHA_BANGO"/>
16
17
  <MAA00120 IDREF="SHIHON_KIN"/>
18
+ <%= render_attr('MAA00130', @別表四調整所得 - @繰越損失管理.deduction) %>
17
19
  <MAA00140>
18
20
  <%= render_attr('MAA00150', 1) %>
19
21
  <%= render_attr('MAA00160', 1) %>
@@ -1,13 +1,16 @@
1
1
  <HOI010 page="1" VR="4.0" id="HOI010" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>" sakuseiDay="<%= @issue_date %>">
2
- <% @預金.each do |k, v| %>
2
+ <% @預金.values.each do |bank| %>
3
3
  <HAB00000>
4
4
  <HAB00100>
5
- <%= render_attr('HAB00110', k) %>
5
+ <%= render_attr('HAB00110', bank[:name]) %>
6
+ <%= render_attr('HAB00120', bank[:branch]) %>
6
7
  </HAB00100>
7
- <%= render_attr('HAB00400', v) %>
8
+ <%= render_attr('HAB00200', bank[:account_type]) %>
9
+ <%= render_attr('HAB00300', bank[:account_no]) %>
10
+ <%= render_attr('HAB00400', bank[:amount]) %>
8
11
  </HAB00000>
9
12
  <% end %>
10
13
  <HAC00000>
11
- <%= render_attr('HAC00100', @預金.values.sum) %>
14
+ <%= render_attr('HAC00100', @預金.values.map { |b| b[:amount] }.sum) %>
12
15
  </HAC00000>
13
16
  </HOI010>
@@ -0,0 +1,195 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Luca #:nodoc:
4
+ module Jp #:nodoc:
5
+ # 勘定科目内訳明細書のレンダリング
6
+ #
7
+ module Uchiwake
8
+ def 預貯金内訳
9
+ @預金 = @bs_data.each.with_object({}) do |(k, v), h|
10
+ next unless /^110[0-9A-Z]/.match(k)
11
+ next unless readable(v || 0) > 0
12
+
13
+ h[k] = {
14
+ name: self.class.dict.dig(k)[:label],
15
+ amount: readable(v)
16
+ }
17
+ metadata = uchiwake_account_config(k).first
18
+ if metadata && metadata['name']
19
+ h[k][:name] = metadata['name']
20
+ h[k][:branch] = metadata['branch']
21
+ h[k][:account_type] = metadata['account_type'] || '普通預金'
22
+ h[k][:account_no] = metadata['account_no']
23
+ h[k][:note] = metadata['note']
24
+ end
25
+ end
26
+ render_erb(search_template('yokin-meisai.xml.erb'))
27
+ end
28
+
29
+ def 有価証券内訳フォーム
30
+ accounts = uchiwake_account_config('331')
31
+ accounts.concat uchiwake_account_config('332')
32
+ return nil if accounts.length == 0
33
+
34
+ 'HOI060'
35
+ end
36
+
37
+ def 有価証券内訳
38
+ account_codes = uchiwake_account_config('331').map { |account| account['code'].to_s }
39
+ account_codes.concat uchiwake_account_config('332').map { |account| account['code'].to_s }
40
+ return nil if account_codes.length == 0
41
+
42
+ @有価証券 = @bs_data.each.with_object({}) do |(k, v), h|
43
+ next unless account_codes.include?(k.to_s)
44
+ next unless readable(v || 0) > 0
45
+
46
+ h[k] = {
47
+ name: self.class.dict.dig(k)[:label],
48
+ amount: readable(v)
49
+ }
50
+ metadata = uchiwake_account_config(k).first
51
+ if metadata && metadata['name']
52
+ h[k][:name] = metadata['name'][0..9] if metadata['name']
53
+ h[k][:security_purpose] = metadata['security_purpose']
54
+ h[k][:security_genre] = metadata['security_genre']
55
+ h[k][:security_units] = metadata['security_units']
56
+ h[k][:note] = metadata['note']
57
+ end
58
+ h[k][:security_purpose] ||= 'その他' if /^332/.match(k.to_s)
59
+ h[k][:security_genre] ||= '株式' if /^33[12]/.match(k.to_s)
60
+ h[k][:note] ||= '関係会社株式' if /^332/.match(k.to_s)
61
+ end
62
+
63
+ render_erb(search_template('shoken-meisai.xml.erb'))
64
+ end
65
+
66
+ def 有価証券合計
67
+ @bs_data.filter { |k, _v| ['331', '332'].include?(k.to_s) }
68
+ .map { |_k, v| readable(v) || 0 }
69
+ .sum
70
+ end
71
+
72
+ def 買掛金内訳フォーム
73
+ accounts = uchiwake_account_config('511')
74
+ accounts.concat uchiwake_account_config('514')
75
+ accounts.concat uchiwake_account_config('517')
76
+ return nil if accounts.length == 0
77
+
78
+ 'HOI090'
79
+ end
80
+
81
+ def 買掛金内訳
82
+ account_codes = uchiwake_account_config('511').map { |account| account['code'].to_s }
83
+ account_codes.concat uchiwake_account_config('514').map { |account| account['code'].to_s }
84
+ account_codes.concat uchiwake_account_config('517').map { |account| account['code'].to_s }
85
+ return nil if account_codes.length == 0
86
+
87
+ @買掛金 = @bs_data.each.with_object({}) do |(k, v), h|
88
+ next unless account_codes.include?(k.to_s)
89
+ next unless readable(v || 0) > 0
90
+
91
+ h[k] = {
92
+ name: self.class.dict.dig(k)[:label],
93
+ amount: readable(v)
94
+ }
95
+ metadata = uchiwake_account_config(k).first
96
+ if metadata && metadata['name']
97
+ h[k][:name] = metadata['name']
98
+ h[k][:payable_type] = self.class.dict.dig(k[0..2], :label)
99
+ h[k][:address] = metadata['address']
100
+ h[k][:note] = metadata['note']
101
+ end
102
+ end
103
+
104
+ render_erb(search_template('kaikake-meisai.xml.erb'))
105
+ end
106
+
107
+ def 買掛金等合計
108
+ @bs_data.filter { |k, _v| ['511', '514', '517'].include?(k.to_s) }
109
+ .map { |_k, v| readable(v) || 0 }
110
+ .sum
111
+ end
112
+
113
+ def 仮受金内訳
114
+ @源泉給与 = readable(@bs_data.dig('5191') || 0)
115
+ @源泉報酬 = readable(@bs_data.dig('5193') || 0)
116
+ render_erb(search_template('kariuke-meisai.xml.erb'))
117
+ end
118
+
119
+ def 借入金内訳フォーム
120
+ accounts = uchiwake_account_config('512')
121
+ accounts.concat uchiwake_account_config('712')
122
+ return nil if accounts.length == 0
123
+
124
+ 'HOI110'
125
+ end
126
+
127
+ def 借入金内訳
128
+ account_codes = uchiwake_account_config('512').map { |account| account['code'].to_s }
129
+ account_codes.concat uchiwake_account_config('712').map { |account| account['code'].to_s }
130
+ return nil if account_codes.length == 0
131
+
132
+ @借入金 = @bs_data.each.with_object({}) do |(k, v), h|
133
+ next unless account_codes.include?(k.to_s)
134
+ next unless readable(v || 0) > 0
135
+
136
+ h[k] = {
137
+ name: self.class.dict.dig(k)[:label],
138
+ amount: readable(v)
139
+ }
140
+ metadata = uchiwake_account_config(k).first
141
+ if metadata && metadata['name']
142
+ h[k][:name] = metadata['name']
143
+ h[k][:address] = metadata['address']
144
+ h[k][:note] = metadata['note']
145
+ end
146
+ end
147
+
148
+ render_erb(search_template('kariire-meisai.xml.erb'))
149
+ end
150
+
151
+ def 借入金合計
152
+ @bs_data.filter { |k, _v| ['512', '712'].include?(k.to_s) }
153
+ .map { |_k, v| readable(v) || 0 }
154
+ .sum
155
+ end
156
+
157
+ def 地代家賃内訳フォーム
158
+ return nil if uchiwake_account_config('C1E').length == 0
159
+
160
+ 'HOI150'
161
+ end
162
+
163
+ def 地代家賃内訳
164
+ account_codes = uchiwake_account_config('C1E').map { |account| account['code'].to_s }
165
+ return nil if account_codes.length == 0
166
+
167
+ @地代家賃 = @bs_data.each.with_object({}) do |(k, v), h|
168
+ next unless account_codes.include?(k)
169
+ next unless readable(v || 0) > 0
170
+
171
+ h[k] = {
172
+ name: self.class.dict.dig(k)[:label],
173
+ amount: readable(v)
174
+ }
175
+ metadata = uchiwake_account_config(k).first
176
+ if metadata && metadata['name']
177
+ h[k][:name] = metadata['name']
178
+ h[k][:address] = metadata['address']
179
+ h[k][:rent_type] = metadata['rent_type'] || '家賃'
180
+ h[k][:rent_purpose] = metadata['rent_purpose']
181
+ h[k][:rent_address] = metadata['rent_address']
182
+ h[k][:note] = metadata['note']
183
+ end
184
+ end
185
+ render_erb(search_template('chidai-meisai.xml.erb'))
186
+ end
187
+
188
+ def 役員報酬内訳
189
+ @役員報酬 = readable(@pl_data.dig('C11') || 0)
190
+ @給料 = readable(@pl_data.dig('C12') || 0)
191
+ render_erb(search_template('yakuin-meisai.xml.erb'))
192
+ end
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'cgi/escape'
5
+ require 'luca_deal'
6
+ require 'luca_support'
7
+ require 'luca_support/config'
8
+ require 'luca/jp'
9
+
10
+ module Luca
11
+ module Jp
12
+ class Urikake < LucaDeal::Invoice
13
+ @dirname = 'invoices'
14
+
15
+ def report(total = nil)
16
+ listed_amount = 0
17
+ str = CSV.generate(String.new, headers: false, col_sep: ',', encoding: 'UTF-8') do |f|
18
+ list.map do |invoice|
19
+ amount = readable(invoice.dig('subtotal', 0, 'items') + invoice.dig('subtotal', 0, 'tax'))
20
+ listed_amount += amount
21
+ f << ['3', '0', '売掛金', invoice.dig('customer', 'name'), invoice.dig('customer', 'address'), amount, nil ]
22
+ end
23
+ if total
24
+ f << ['3', '0', '売掛金', 'その他', nil, total - listed_amount, nil ]
25
+ f << ['3', '1', nil, nil, nil, total, nil ]
26
+ end
27
+ end
28
+ File.open('HOI030_3.0.csv', 'w') { |f| f.write(str) }
29
+ end
30
+
31
+ def list
32
+ invoices = self.class.asof(@date.year, @date.month)
33
+ .map { |dat, _path| dat }
34
+ .sort_by { |invoice| invoice.dig('subtotal', 0, 'items') }
35
+ .reverse
36
+
37
+ reports = invoices.filter { |invoice| 500_000 <= invoice['subtotal'].inject(0) { |sum, i| sum + i['items'] + i['tax'] } }
38
+ return reports if reports.length >= 5
39
+
40
+ additional = invoices
41
+ .filter { |invoice| 500_000 > invoice['subtotal'].inject(0) { |sum, i| sum + i['items'] + i['tax'] } }
42
+ .take(5 - reports.length)
43
+ reports.concat(additional)
44
+ end
45
+ end
46
+ end
47
+ end
data/lib/luca/jp/util.rb CHANGED
@@ -54,6 +54,8 @@ module Luca
54
54
  end
55
55
 
56
56
  def render_attr(code, val)
57
+ return '' if val.nil? || val.to_s.length == 0
58
+
57
59
  "<#{code}>#{val}</#{code}>"
58
60
  end
59
61
 
@@ -64,6 +66,29 @@ module Luca
64
66
  def config
65
67
  EX_CONF.nil? ? LucaSupport::CONFIG : LucaSupport::CONFIG.merge(EX_CONF)
66
68
  end
69
+
70
+ def it_part_config(key)
71
+ config.dig('jp', 'it_part', key)
72
+ end
73
+
74
+ def beppyo2_config(key)
75
+ config.dig('jp', 'beppyo2', key)
76
+ end
77
+
78
+ def gaikyo_config(key)
79
+ config.dig('jp', 'gaikyo', key)
80
+ end
81
+
82
+ def uchiwake_account_config(key)
83
+ account_list = config.dig('jp', 'accounts')
84
+ return [] if account_list.nil?
85
+
86
+ Array(account_list).filter { |account| /^#{key}/.match(account['code'].to_s) }
87
+ end
88
+
89
+ def eltax_config(key)
90
+ config.dig('jp', 'eltax', key)
91
+ end
67
92
  end
68
93
  end
69
94
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.1.6'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  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.1.6
4
+ version: 0.2.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: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucabook
@@ -96,19 +96,26 @@ files:
96
96
  - lib/luca/jp/templates/beppyo51.xml.erb
97
97
  - lib/luca/jp/templates/beppyo52.xml.erb
98
98
  - lib/luca/jp/templates/beppyo7.xml.erb
99
+ - lib/luca/jp/templates/chidai-meisai.xml.erb
99
100
  - lib/luca/jp/templates/consumption.xtx.erb
100
101
  - lib/luca/jp/templates/el-no6-43.xml.erb
101
102
  - lib/luca/jp/templates/el-no6-9.xml.erb
102
103
  - lib/luca/jp/templates/el-no6.xml.erb
104
+ - lib/luca/jp/templates/eltax-userinf.xml.erb
103
105
  - lib/luca/jp/templates/eltax.xml.erb
104
106
  - lib/luca/jp/templates/fuhyo43.xml.erb
105
107
  - lib/luca/jp/templates/fuhyo53.xml.erb
106
108
  - lib/luca/jp/templates/gaikyo.xml.erb
109
+ - lib/luca/jp/templates/kaikake-meisai.xml.erb
110
+ - lib/luca/jp/templates/kariire-meisai.xml.erb
107
111
  - lib/luca/jp/templates/kariuke-meisai.xml.erb
112
+ - lib/luca/jp/templates/shoken-meisai.xml.erb
108
113
  - lib/luca/jp/templates/syouhizei-shinkoku-kanni.xml.erb
109
114
  - lib/luca/jp/templates/tekiyougaku.xml.erb
110
115
  - lib/luca/jp/templates/yakuin-meisai.xml.erb
111
116
  - lib/luca/jp/templates/yokin-meisai.xml.erb
117
+ - lib/luca/jp/uchiwake.rb
118
+ - lib/luca/jp/urikake.rb
112
119
  - lib/luca/jp/util.rb
113
120
  - lib/luca/jp/version.rb
114
121
  homepage: https://github.com/chumaltd/luca-jp/tree/main