luca-jp 0.1.3 → 0.1.8

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: b6d54c44deab442663640f9b11e8abd3e71cf6c9deb5b9e00afd5c059104246d
4
- data.tar.gz: 052d3583d83f6a7ea82df1bc53a75bbfa4b72373d549572eeae3266ccdaf7057
3
+ metadata.gz: a806b0b50cedaaee6bcf04c226f02fc857a4c7a651a6a06f7a22abd0e4e161cc
4
+ data.tar.gz: 9a8188a2595fc6e487b81d073a150995221f9add68768ce2c133267ec084a9b7
5
5
  SHA512:
6
- metadata.gz: 81f56987c7f87af6ae87ac2536118ab9ef58a62b61c133ad8b0b6e3b81704034fbfea485c5fb07382d42791b34c2817224f5354eb7c9076f1e163034bf9a2c9a
7
- data.tar.gz: b2c2edd9429190aaa6617bb4ef316d888be4fb1d85a576d6a5ef09f658c8f8f01c56da656c5c5fc5c2977d4adb67a64f4b4038b8a4e20ef153b9de3b90da1e0c
6
+ metadata.gz: 994c9afe22a85581401f8f78853b149bfef194cba11b2c61f24bc43fb26e9dcb6698f79f8919a0aae301e4982d324c9068c4a21b83a756775e92f2d3d61b7326
7
+ data.tar.gz: 9e001abecc4c7fd0831b2a82eb112156db3e4b8ea9666f9c42fbaf556c9b527caad948c63f17712d99bb44e2b5bd10b2d34b34a96d327dc637cd445435993dc8
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
@@ -11,6 +11,8 @@ module Luca
11
11
  autoload :Chihouzei, 'luca/jp/chihouzei'
12
12
  autoload :Common, 'luca/jp/common'
13
13
  autoload :ItPart, 'luca/jp/it_part'
14
+ autoload :Sonshitsu, 'luca/jp/sonshitsu'
15
+ autoload :Urikake, 'luca/jp/urikake'
14
16
  autoload :Util, 'luca/jp/util'
15
17
  end
16
18
 
data/lib/luca/jp/aoiro.rb CHANGED
@@ -26,6 +26,7 @@ module Luca
26
26
  @issue_date = Date.today
27
27
  @company = CGI.escapeHTML(config.dig('company', 'name'))
28
28
  @software = 'LucaJp'
29
+
29
30
  @税額 = 税額計算
30
31
  @確定法人税額 = @税額.dig(:houjin, :kokuzei)
31
32
  @法人税額 = 中小企業の軽減税額 + 一般区分の税額
@@ -50,18 +51,24 @@ module Luca
50
51
  @procedure_code = 'RHO0012'
51
52
  @procedure_name = '内国法人の確定申告(青色)'
52
53
  @version = '20.0.2'
53
- @都道府県民税中間納付 = prepaid_tax('1859') + prepaid_tax('185A')
54
- @市民税中間納付 = prepaid_tax('185D') + prepaid_tax('185E')
54
+ @都道府県民税法人税割中間納付 = prepaid_tax('1859')
55
+ @都道府県民税均等割中間納付 = prepaid_tax('185A')
56
+ @都道府県民税中間納付 = @都道府県民税法人税割中間納付 + @都道府県民税均等割中間納付
57
+ @市民税法人税割中間納付 = prepaid_tax('185D')
58
+ @市民税均等割中間納付 = prepaid_tax('185E')
59
+ @市民税中間納付 = @市民税法人税割中間納付 + @市民税均等割中間納付
55
60
  @法人税期中増, @法人税期中減 = 未納法人税期中増減
56
61
  @都道府県民税期中増, @都道府県民税期中減 = 未納都道府県民税期中増減
57
62
  @市民税期中増, @市民税期中減 = 未納市民税期中増減
58
63
  @事業税期中増, @事業税期中減 = 未納事業税期中増減
64
+ @事業税中間納付 = prepaid_tax('1854') + prepaid_tax('1855') + prepaid_tax('1856') + prepaid_tax('1857') + prepaid_tax('1858')
59
65
  @納税充当金期中増, @納税充当金期中減 = 納税充当金期中増減
66
+ @翌期還付法人税 = 中間還付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
60
67
  @概況売上 = gaikyo('A0')
61
- @form_sec = ['HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 'HOE200', 'HOE990', 'HOI010', 'HOI100', 'HOI141', 'HOK010'].map{ |c| form_rdf(c) }.join('')
68
+ @form_sec = ['HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 別表七フォーム, 'HOE200', 適用額明細フォーム, 'HOI010', 'HOI100', 'HOI141', 'HOK010'].compact.map{ |c| form_rdf(c) }.join('')
62
69
  #@extra_form_sec = ['HOI040', 'HOI060', 'HOI090', 'HOI110']
63
70
  @it = it_part
64
- @form_data = [別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表十五, 適用額明細, 預貯金内訳, 仮受金内訳, 役員報酬内訳, 概況説明].join("\n")
71
+ @form_data = [別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五, 適用額明細, 預貯金内訳, 仮受金内訳, 役員報酬内訳, 概況説明].compact.join("\n")
65
72
  render_erb(search_template('aoiro.xtx.erb'))
66
73
  end
67
74
  end
@@ -81,7 +88,7 @@ module Luca
81
88
  else
82
89
  item['credit'] << { 'label' => '未払法人税', 'amount' => dat[:kokuzei][:zeigaku] - dat[:kokuzei][:chukan] }
83
90
  end
84
- item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:kokuzei][:zeigaku] }
91
+ item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:kokuzei][:zeigaku] } if dat[:kokuzei][:zeigaku] > 0
85
92
  if dat[:chihou][:chukan] > 0
86
93
  item['credit'] << { 'label' => '仮払法人税(地方)', 'amount' => dat[:chihou][:chukan] }
87
94
  end
@@ -90,7 +97,7 @@ module Luca
90
97
  else
91
98
  item['credit'] << { 'label' => '未払法人税', 'amount' => dat[:chihou][:zeigaku] - dat[:chihou][:chukan] }
92
99
  end
93
- item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:chihou][:zeigaku] }
100
+ item['debit'] << { 'label' => '法人税、住民税及び事業税', 'amount' => dat[:chihou][:zeigaku] } if dat[:chihou][:zeigaku] > 0
94
101
  item['x-editor'] = 'LucaJp'
95
102
  res << item
96
103
  puts JSON.dump(res)
@@ -114,8 +121,17 @@ module Luca
114
121
  @当期純損益 = readable(@pl_data.dig('HA'))
115
122
  @法人税等 = readable(@pl_data.dig('H0'))
116
123
  _, @納付事業税 = 未納事業税期中増減
117
- @還付事業税 = readable(還付事業税 || 0)
118
- @別表四調整所得 = @当期純損益 + @法人税等 + @還付事業税 - @納付事業税
124
+ @別表四調整所得 = @当期純損益 + @法人税等 - @納付事業税
125
+
126
+ @当期還付法人税 = refund_tax('1502')
127
+ @当期還付都道府県住民税 = refund_tax('1503')
128
+ @翌期還付都道府県住民税 = 中間還付税額(@税額.dig(:kenmin, :kintou), @都道府県民税均等割中間納付) + 中間還付税額(@税額.dig(:kenmin, :houjinzei), @都道府県民税法人税割中間納付)
129
+ @当期還付市民税 = refund_tax('1505')
130
+ @翌期還付市民税 = 中間還付税額(@税額.dig(:shimin, :kintou), @市民税均等割中間納付) + 中間還付税額(@税額.dig(:shimin, :houjinzei), @市民税法人税割中間納付)
131
+ @当期還付事業税 = 還付事業税
132
+ @事業税期首残高 = 期首未納事業税 > 0 ? 期首未納事業税 : (@当期還付事業税 * -1)
133
+ @翌期還付事業税 = 中間還付税額(確定事業税, @事業税中間納付)
134
+ @仮払税金 = @翌期還付法人税 + @翌期還付都道府県住民税 + @翌期還付事業税 + @翌期還付市民税
119
135
 
120
136
  render_erb(search_template('beppyo4.xml.erb'))
121
137
  end
@@ -125,10 +141,26 @@ module Luca
125
141
  end
126
142
 
127
143
  def 別表五二
144
+ @消費税中間納付額 = 消費税中間納付額 + 地方消費税中間納付額
145
+ @当期還付消費税 = refund_tax('1501')
146
+ @消費税期首残高 = 期首未納消費税 > 0 ? 期首未納消費税 : (@当期還付消費税 * -1)
147
+ @翌期還付消費税 = 中間還付税額(@消費税期中増, @消費税中間納付額)
128
148
  @その他事業税 = 租税公課
129
149
  render_erb(search_template('beppyo52.xml.erb'))
130
150
  end
131
151
 
152
+ def 別表七フォーム
153
+ return nil if @繰越損失管理.records.length == 0
154
+
155
+ 'HOB710'
156
+ end
157
+
158
+ def 別表七
159
+ return nil if @繰越損失管理.records.length == 0
160
+
161
+ render_erb(search_template('beppyo7.xml.erb'))
162
+ end
163
+
132
164
  def 別表十五
133
165
  @交際費 = readable(@pl_data.dig('C1B') || 0)
134
166
  @限度額 = @交際費 < 4_000_000 ? @交際費 : 4_000_000
@@ -141,7 +173,7 @@ module Luca
141
173
  next unless /^110[0-9A-Z]/.match(k)
142
174
  next unless readable(v || 0) > 0
143
175
 
144
- h[@dict.dig(k)[:label]] = readable(v)
176
+ h[@@dict.dig(k)[:label]] = readable(v)
145
177
  end
146
178
  render_erb(search_template('yokin-meisai.xml.erb'))
147
179
  end
@@ -158,7 +190,15 @@ module Luca
158
190
  render_erb(search_template('yakuin-meisai.xml.erb'))
159
191
  end
160
192
 
193
+ def 適用額明細フォーム
194
+ return nil if @確定法人税額 == 0
195
+
196
+ 'HOE990'
197
+ end
198
+
161
199
  def 適用額明細
200
+ return nil if @確定法人税額 == 0
201
+
162
202
  render_erb(search_template('tekiyougaku.xml.erb'))
163
203
  end
164
204
 
@@ -212,13 +252,125 @@ module Luca
212
252
  end
213
253
 
214
254
  def 租税公課
215
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'C1I')[:debit]) || 0
255
+ readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'C1I')[:debit]['C1I']) || 0
256
+ end
257
+
258
+ def 別表二株主リスト
259
+ return '' if beppyo2_config('owners').nil?
260
+
261
+ tags = beppyo2_config('owners')[1..-1]&.map.with_index(2) do |owner, i|
262
+ %Q(<VAE00170>
263
+ <VAE00180>
264
+ <VAE00190>#{i}</VAE00190>
265
+ <VAE00200>#{i}</VAE00200>
266
+ </VAE00180>
267
+ <VAE00210>
268
+ #{render_attr('VAE00220', owner['address'])}
269
+ #{render_attr('VAE00230', owner['name'])}
270
+ #{render_attr('VAE00235', owner['relation'] || 'その他')}
271
+ </VAE00210>
272
+ <VAE00250>
273
+ <VAE00290>
274
+ #{render_attr('VAE00300', owner['shares'])}
275
+ <VAE00310>
276
+ #{render_attr('VAE00330', owner['votes'])}
277
+ </VAE00310>
278
+ </VAE00290>
279
+ </VAE00250>
280
+ </VAE00170>)
281
+ end
282
+ tags.compact.join("\n")
283
+ end
284
+
285
+ def 別表二上位株数
286
+ return nil if beppyo2_config('owners').nil?
287
+
288
+ beppyo2_config('owners')[0..2].map{ |owner| owner['shares']&.to_i || 0 }.sum
289
+ end
290
+
291
+ def 別表二上位株割合
292
+ return nil if beppyo2_config('total_shares').nil?
293
+ return nil if beppyo2_config('owners').nil?
294
+
295
+ (別表二上位株数 * 100.0 / beppyo2_config('total_shares')).round(1).to_s
296
+ end
297
+
298
+ def 別表二上位議決権数
299
+ return nil if beppyo2_config('owners').nil?
300
+
301
+ beppyo2_config('owners')[0..2].map{ |owner| owner['votes']&.to_i || 0 }.sum
302
+ end
303
+
304
+ def 別表二上位議決権割合
305
+ return nil if beppyo2_config('total_votes').nil?
306
+ return nil if beppyo2_config('owners').nil?
307
+
308
+ (別表二上位議決権数 * 100.0 / beppyo2_config('total_votes')).round(1).to_s
309
+ end
310
+
311
+ def 別表四還付法人税等金額
312
+ refund_tax()
216
313
  end
217
314
 
218
315
  def 別表四還付事業税
219
- return nil if @還付事業税 == 0
316
+ return nil if @当期還付事業税 == 0
317
+
318
+ "<ARC00220><ARC00230>仮払事業税消却(未収計上した還付事業税)</ARC00230>#{render_attr('ARC00240', @当期還付事業税)}#{render_attr('ARC00250', @当期還付事業税)}</ARC00220>\n"
319
+ end
320
+
321
+ def 別表五一仮払税金
322
+ 未収仮払税金 = [@start_balance['1502'], @start_balance['1503'], @start_balance['1504'], @start_balance['1505']].compact.sum
323
+ 還付税金 = [@当期還付法人税, @当期還付都道府県住民税, @当期還付事業税, @当期還付市民税].compact.sum
324
+ return '' if 未収仮払税金 == 0 && 還付税金 == 0 && @仮払税金 == 0
325
+
326
+ %Q(<ICB00140>
327
+ #{render_attr('ICB00150', '仮払税金')}
328
+ #{render_attr('ICB00160', 未収仮払税金 * -1)}
329
+ <ICB00170>
330
+ #{render_attr('ICB00190', 還付税金 * -1)}
331
+ #{render_attr('ICB00200', @仮払税金 * -1)}
332
+ </ICB00170>
333
+ #{render_attr('ICB00210', @仮払税金 * -1)}
334
+ </ICB00140>)
335
+ end
336
+
337
+ def 別表五一還付法人税
338
+ return '' if (@start_balance['1502']||0) == 0 && @翌期還付法人税 == 0
339
+
340
+ %Q(<ICB00220>
341
+ #{render_attr('ICB00230', @start_balance['1502'] || 0)}
342
+ <ICB00240>
343
+ #{render_attr('ICB00250', @当期還付法人税)}
344
+ #{render_attr('ICB00260', @翌期還付法人税)}
345
+ </ICB00240>
346
+ #{render_attr('ICB00270', @翌期還付法人税)}
347
+ </ICB00220>)
348
+ end
349
+
350
+ def 別表五一還付都道府県住民税
351
+ return '' if (@start_balance['1503']||0) == 0 && @翌期還付都道府県住民税 == 0
220
352
 
221
- "<ARC00220><ARC00230>仮払事業税消却(未収計上した還付事業税)</ARC00230>#{render_attr('ARC00240', @還付事業税)}#{render_attr('ARC00250', @還付事業税)}</ARC00220>\n"
353
+ %Q(<ICB00280>
354
+ #{render_attr('ICB00290', @start_balance['1503'] || 0)}
355
+ <ICB00300>
356
+ #{render_attr('ICB00310', @当期還付都道府県住民税)}
357
+ #{render_attr('ICB00320', @翌期還付都道府県住民税)}
358
+ </ICB00300>
359
+ #{render_attr('ICB00330', @翌期還付都道府県住民税)}
360
+ </ICB00280>)
361
+ end
362
+
363
+ def 別表五一還付市民税
364
+ return '' if (@start_balance['1505']||0) == 0 && @翌期還付市民税 == 0
365
+
366
+ %Q(<ICB00340>
367
+ #{render_attr('ICB00350', @start_balance['1505'] || 0)}
368
+ <ICB00360>
369
+ #{render_attr('ICB00370', @当期還付市民税)}
370
+ #{render_attr('ICB00380', @翌期還付市民税)}
371
+ </ICB00360>
372
+ #{render_attr('ICB00390', @翌期還付市民税)}
373
+ </ICB00340>)
222
374
  end
223
375
 
224
376
  def 期首繰越損益
@@ -233,16 +385,11 @@ module Luca
233
385
  readable(@start_balance.dig('515')) || 0
234
386
  end
235
387
 
236
- def 期末納税充当金
237
- readable(@bs_data.dig('515')) || 0
238
- end
239
-
240
388
  def 納税充当金期中増減
241
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '515')
242
- [
243
- readable(r[:credit] || 0) + @法人税期中増 + @都道府県民税期中増 + @市民税期中増 + @事業税期中増,
244
- readable(r[:debit] || 0) + @法人税期中減 + @都道府県民税期中減 + @市民税期中減 + @事業税期中減
245
- ]
389
+ r = debit_amount('515', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
390
+ 納付 = 納付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付) + 期末未納都道府県民税 + 期末未納市民税 + 納付税額(確定事業税, @事業税中間納付)
391
+
392
+ [納付, readable(r)]
246
393
  end
247
394
 
248
395
  def 期首未納法人税
@@ -250,12 +397,12 @@ module Luca
250
397
  end
251
398
 
252
399
  def 期末未納法人税
253
- readable(@bs_data.dig('5151')) || 0
400
+ 納付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
254
401
  end
255
402
 
256
403
  def 未納法人税期中増減
257
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5151')
258
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
404
+ r = debit_amount('5151', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
405
+ [(@確定法人税額 + @確定地方法人税額), readable(r)]
259
406
  end
260
407
 
261
408
  # 中間納付した金額のうち税額とならず、還付されるべき額
@@ -279,20 +426,21 @@ module Luca
279
426
  end
280
427
 
281
428
  def 期末未納都道府県民税
282
- readable(@bs_data.dig('5153')) || 0
429
+ 納付税額(@税額.dig(:kenmin, :kintou), @都道府県民税均等割中間納付) + 納付税額(@税額.dig(:kenmin, :houjinzei), @都道府県民税法人税割中間納付)
283
430
  end
284
431
 
285
432
  def 未納都道府県民税期中増減
286
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5153')
287
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
433
+ r = debit_amount('5153', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
434
+ [確定都道府県住民税, readable(r)]
288
435
  end
289
436
 
290
437
  def 都道府県民税仮払納付
291
438
  [(@都道府県民税中間納付 - 確定都道府県住民税), 0].max
439
+ 中間還付税額(@税額.dig(:kenmin, :kintou), @都道府県民税均等割中間納付) + 中間還付税額(@税額.dig(:kenmin, :houjinzei), @都道府県民税法人税割中間納付)
292
440
  end
293
441
 
294
442
  def 都道府県民税損金納付
295
- [確定都道府県住民税, @都道府県民税中間納付].min
443
+ [@都道府県民税均等割中間納付, @税額.dig(:kenmin, :kintou)].min + [@都道府県民税法人税割中間納付, @税額.dig(:kenmin, :houjinzei)].min
296
444
  end
297
445
 
298
446
  def 確定市民税
@@ -304,20 +452,28 @@ module Luca
304
452
  end
305
453
 
306
454
  def 期末未納市民税
307
- readable(@bs_data.dig('5154')) || 0
455
+ 納付税額(@税額.dig(:shimin, :kintou), @市民税均等割中間納付) + 納付税額(@税額.dig(:shimin, :houjinzei), @市民税法人税割中間納付)
308
456
  end
309
457
 
310
458
  def 未納市民税期中増減
311
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5154')
312
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
459
+ r = debit_amount('5154', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
460
+ [確定市民税, readable(r)]
313
461
  end
314
462
 
315
463
  def 市民税仮払納付
316
- [0, (@市民税中間納付 - 確定市民税)].max
464
+ 中間還付税額(@税額.dig(:shimin, :kintou), @市民税均等割中間納付) + 中間還付税額(@税額.dig(:shimin, :houjinzei), @市民税法人税割中間納付)
317
465
  end
318
466
 
319
467
  def 市民税損金納付
320
- [@市民税中間納付, 確定市民税].min
468
+ [@市民税均等割中間納付, @税額.dig(:shimin, :kintou)].min + [@市民税法人税割中間納付, @税額.dig(:shimin, :houjinzei)].min
469
+ end
470
+
471
+ def 確定事業税
472
+ @税額.dig(:kenmin, :shotoku) + @税額.dig(:kenmin, :tokubetsu)
473
+ end
474
+
475
+ def 事業税損金納付
476
+ [@事業税中間納付, 確定事業税].min
321
477
  end
322
478
 
323
479
  def 別表五一期首差引金額
@@ -325,15 +481,42 @@ module Luca
325
481
  end
326
482
 
327
483
  def 別表五一期末差引金額
328
- 期末繰越損益 + 期末納税充当金 - 期末未納法人税 - 期末未納都道府県民税 - 期末未納市民税
484
+ 期末繰越損益 + @納税充当金期中増 - 期末未納法人税 - 期末未納都道府県民税 - 期末未納市民税 - @翌期還付事業税
329
485
  end
330
486
 
331
487
  def 別表五一期中減差引金額
332
- 期首繰越損益 + @納税充当金期中減 - @法人税期中減 - @都道府県民税期中減 - @市民税期中減
488
+ 期首繰越損益 + @納税充当金期中減 - @法人税期中減 - @都道府県民税期中減 - @市民税期中減 - @翌期還付法人税 - @翌期還付都道府県住民税 - @翌期還付市民税
333
489
  end
334
490
 
335
491
  def 別表五一期中増差引金額
336
- 期末繰越損益 + @納税充当金期中増 - @法人税期中増 - @都道府県民税期中増 - @市民税期中増
492
+ 期末繰越損益 + 納付税額(確定事業税, @事業税中間納付) - @法人税中間納付 - @地方法人税中間納付 - @都道府県民税中間納付 - @市民税中間納付 - @翌期還付事業税
493
+ end
494
+
495
+ def 期末未収税金(code)
496
+ readable((@bs_data[code] || 0) * -1)
497
+ end
498
+
499
+ def 別表七各期青色損失
500
+ tags = @繰越損失管理.records
501
+ .filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date }
502
+ .map do |record|
503
+ deduction = record['decrease']&.filter{ |r| r['date'] >= @start_date }&.dig(0, 'val') || 0
504
+ next if deduction == 0 && record['amount'] == 0
505
+
506
+ %Q(<MCB00110>
507
+ <MCB00120>
508
+ #{render_attr('MCB00130', etax_date(record['start_date']))}
509
+ #{render_attr('MCB00140', etax_date(record['end_date']))}
510
+ </MCB00120>
511
+ <MCB00150>
512
+ <MCB00160><kubun_CD>1</kubun_CD></MCB00160>
513
+ </MCB00150>
514
+ #{render_attr('MCB00190', deduction + record['amount'])}
515
+ #{render_attr('MCB00200', deduction)}
516
+ #{render_attr('MCB00210', record['amount'])}
517
+ </MCB00110)
518
+ end
519
+ tags.compact.join("\n")
337
520
  end
338
521
 
339
522
  def 期首資本金
@@ -361,8 +544,9 @@ module Luca
361
544
  end
362
545
 
363
546
  def 未納消費税期中増減
364
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '516')
365
- [readable(r[:credit] || 0), readable(r[:debit] || 0)]
547
+ increase = debit_amount('C1I1', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
548
+ r = debit_amount('516', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
549
+ [readable(increase), readable(r)]
366
550
  end
367
551
 
368
552
  def 概況月(idx)
@@ -387,13 +571,13 @@ module Luca
387
571
 
388
572
  def 概況月源泉徴収(idx)
389
573
  target = @start_date.next_month(idx)
390
- readable(LucaBook::State.gross(target.year, target.month, code: '5191')[:credit] || 0)
391
- + readable(LucaBook::State.gross(target.year, target.month, code: '5193')[:credit] || 0)
574
+ readable(LucaBook::State.gross(target.year, target.month, code: '5191')[:credit]['5191'] || 0)
575
+ + readable(LucaBook::State.gross(target.year, target.month, code: '5193')[:credit]['5193'] || 0)
392
576
  end
393
577
 
394
578
  def 概況源泉徴収
395
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5191')[:credit] || 0)
396
- + readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5193')[:credit] || 0)
579
+ readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5191')[:credit]['5191'] || 0)
580
+ + readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5193')[:credit]['5193'] || 0)
397
581
  end
398
582
 
399
583
  def gaikyo(code)