luca-jp 0.1.5 → 0.2.1

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: 293a22484ad653e329dce906de157f442f6a2b84c6157761c88e40a488eec411
4
- data.tar.gz: 9099aa4b48971bdc2015f68df09f795900e2414a55e25095a1943b8907014572
3
+ metadata.gz: 5b22664249b7ad24d2f3dd879f13e65904872a21b8c031d78466d4508e073843
4
+ data.tar.gz: ca8c9698152d247d89d0cf24de3b94c71d006fc9724bfcb7220f7d499a79f16b
5
5
  SHA512:
6
- metadata.gz: 81c8174c9f743fb97ed5ac3cc98b2d30f4d6143c7ae7256b8fc4df738a005ee4ae2c30379d2a074587adcaeff92415001f9bac044b607171a90426c11f2a0043
7
- data.tar.gz: ca6aabb77e93cd285616d7ffa0a3d5996b53fe661c88ddb3ea62dffe05ac238ea1bea03ea52d9f08d04c74c50e251ae5dfa7280a84aec8a724dd95f9bcb5b127
6
+ metadata.gz: d8a95efc786fea95828a02274f4d6d293c82c23faad6526b4e33155c2e5ffe20983cfed42aa872a69f805e6c51fa05c808df4156ed851f2f47c9faae5cd19fbe
7
+ data.tar.gz: 8276ea9fc0ad23ddbb333de3c4a61b6e6d8325b988d33d0df9ead8e9d8dfeca32a1b5e7df2897d68dc9806c39be9d123856b1afdc41e17011020f1ab66c86013
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'
@@ -51,21 +52,34 @@ module Luca
51
52
  @procedure_code = 'RHO0012'
52
53
  @procedure_name = '内国法人の確定申告(青色)'
53
54
  @version = '20.0.2'
54
- @都道府県民税中間納付 = prepaid_tax('1859') + prepaid_tax('185A')
55
- @市民税中間納付 = prepaid_tax('185D') + prepaid_tax('185E')
55
+ @都道府県民税法人税割中間納付 = prepaid_tax('1859')
56
+ @都道府県民税均等割中間納付 = prepaid_tax('185A')
57
+ @都道府県民税中間納付 = @都道府県民税法人税割中間納付 + @都道府県民税均等割中間納付
58
+ @市民税法人税割中間納付 = prepaid_tax('185D')
59
+ @市民税均等割中間納付 = prepaid_tax('185E')
60
+ @市民税中間納付 = @市民税法人税割中間納付 + @市民税均等割中間納付
56
61
  @法人税期中増, @法人税期中減 = 未納法人税期中増減
57
62
  @都道府県民税期中増, @都道府県民税期中減 = 未納都道府県民税期中増減
58
63
  @市民税期中増, @市民税期中減 = 未納市民税期中増減
59
64
  @事業税期中増, @事業税期中減 = 未納事業税期中増減
65
+ @事業税中間納付 = prepaid_tax('1854') + prepaid_tax('1855') + prepaid_tax('1856') + prepaid_tax('1857') + prepaid_tax('1858')
60
66
  @納税充当金期中増, @納税充当金期中減 = 納税充当金期中増減
61
- @還付法人税 = refund_tax('1502')
62
- @還付都道府県住民税 = refund_tax('1503')
63
- @還付市民税 = refund_tax('1505')
67
+ @翌期還付法人税 = 中間還付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
64
68
  @概況売上 = gaikyo('A0')
65
- @form_sec = ['HOA112', 'HOA116', 'HOA201', 'HOA420', 'HOA511', 'HOA522', 別表七フォーム, 'HOE200', 適用額明細フォーム, 'HOI010', 'HOI100', 'HOI141', 'HOK010'].compact.map{ |c| form_rdf(c) }.join('')
66
- #@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']
67
76
  @it = it_part
68
- @form_data = [別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五, 適用額明細, 預貯金内訳, 仮受金内訳, 役員報酬内訳, 概況説明].compact.join("\n")
77
+ @form_data = [
78
+ 別表一, 別表一次葉, 別表二, 別表四簡易, 別表五一, 別表五二, 別表七, 別表十五,
79
+ 適用額明細,
80
+ 預貯金内訳, 有価証券内訳, 買掛金内訳, 仮受金内訳, 借入金内訳, 役員報酬内訳, 地代家賃内訳,
81
+ 概況説明
82
+ ].compact.join("\n")
69
83
  render_erb(search_template('aoiro.xtx.erb'))
70
84
  end
71
85
  end
@@ -118,8 +132,17 @@ module Luca
118
132
  @当期純損益 = readable(@pl_data.dig('HA'))
119
133
  @法人税等 = readable(@pl_data.dig('H0'))
120
134
  _, @納付事業税 = 未納事業税期中増減
121
- @還付事業税 = readable(還付事業税 || 0)
122
- @別表四調整所得 = @当期純損益 + @法人税等 + @還付事業税 - @納付事業税
135
+ @別表四調整所得 = @当期純損益 + @法人税等 - @納付事業税
136
+
137
+ @当期還付法人税 = refund_tax('1502')
138
+ @当期還付都道府県住民税 = refund_tax('1503')
139
+ @翌期還付都道府県住民税 = 中間還付税額(@税額.dig(:kenmin, :kintou), @都道府県民税均等割中間納付) + 中間還付税額(@税額.dig(:kenmin, :houjinzei), @都道府県民税法人税割中間納付)
140
+ @当期還付市民税 = refund_tax('1505')
141
+ @翌期還付市民税 = 中間還付税額(@税額.dig(:shimin, :kintou), @市民税均等割中間納付) + 中間還付税額(@税額.dig(:shimin, :houjinzei), @市民税法人税割中間納付)
142
+ @当期還付事業税 = 還付事業税
143
+ @事業税期首残高 = 期首未納事業税 > 0 ? 期首未納事業税 : (@当期還付事業税 * -1)
144
+ @翌期還付事業税 = 中間還付税額(確定事業税, @事業税中間納付)
145
+ @仮払税金 = @翌期還付法人税 + @翌期還付都道府県住民税 + @翌期還付事業税 + @翌期還付市民税
123
146
 
124
147
  render_erb(search_template('beppyo4.xml.erb'))
125
148
  end
@@ -129,6 +152,10 @@ module Luca
129
152
  end
130
153
 
131
154
  def 別表五二
155
+ @消費税中間納付額 = 消費税中間納付額 + 地方消費税中間納付額
156
+ @当期還付消費税 = refund_tax('1501')
157
+ @消費税期首残高 = 期首未納消費税 > 0 ? 期首未納消費税 : (@当期還付消費税 * -1)
158
+ @翌期還付消費税 = 中間還付税額(@消費税期中増, @消費税中間納付額)
132
159
  @その他事業税 = 租税公課
133
160
  render_erb(search_template('beppyo52.xml.erb'))
134
161
  end
@@ -152,28 +179,6 @@ module Luca
152
179
  render_erb(search_template('beppyo15.xml.erb'))
153
180
  end
154
181
 
155
- def 預貯金内訳
156
- @預金 = @bs_data.each.with_object({}) do |(k, v), h|
157
- next unless /^110[0-9A-Z]/.match(k)
158
- next unless readable(v || 0) > 0
159
-
160
- h[@@dict.dig(k)[:label]] = readable(v)
161
- end
162
- render_erb(search_template('yokin-meisai.xml.erb'))
163
- end
164
-
165
- def 仮受金内訳
166
- @源泉給与 = readable(@bs_data.dig('5191') || 0)
167
- @源泉報酬 = readable(@bs_data.dig('5193') || 0)
168
- render_erb(search_template('kariuke-meisai.xml.erb'))
169
- end
170
-
171
- def 役員報酬内訳
172
- @役員報酬 = readable(@pl_data.dig('C11') || 0)
173
- @給料 = readable(@pl_data.dig('C12') || 0)
174
- render_erb(search_template('yakuin-meisai.xml.erb'))
175
- end
176
-
177
182
  def 適用額明細フォーム
178
183
  return nil if @確定法人税額 == 0
179
184
 
@@ -221,6 +226,10 @@ module Luca
221
226
  render_erb(search_template('gaikyo.xml.erb'))
222
227
  end
223
228
 
229
+ def self.dict
230
+ @@dict
231
+ end
232
+
224
233
  private
225
234
 
226
235
  def 期首未納事業税
@@ -236,13 +245,156 @@ module Luca
236
245
  end
237
246
 
238
247
  def 租税公課
239
- 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
333
+ end
334
+
335
+ def 別表四還付法人税等金額
336
+ refund_tax()
240
337
  end
241
338
 
242
339
  def 別表四還付事業税
243
- return nil if @還付事業税 == 0
340
+ return nil if @当期還付事業税 == 0
341
+
342
+ "<ARC00220><ARC00230>仮払事業税消却(未収計上した還付事業税)</ARC00230>#{render_attr('ARC00240', @当期還付事業税)}#{render_attr('ARC00250', @当期還付事業税)}</ARC00220>\n"
343
+ end
344
+
345
+ def 別表五一仮払税金
346
+ 未収仮払税金 = [@start_balance['1502'], @start_balance['1503'], @start_balance['1504'], @start_balance['1505']].compact.sum
347
+ 還付税金 = [@当期還付法人税, @当期還付都道府県住民税, @当期還付事業税, @当期還付市民税].compact.sum
348
+ return '' if 未収仮払税金 == 0 && 還付税金 == 0 && @仮払税金 == 0
244
349
 
245
- "<ARC00220><ARC00230>仮払事業税消却(未収計上した還付事業税)</ARC00230>#{render_attr('ARC00240', @還付事業税)}#{render_attr('ARC00250', @還付事業税)}</ARC00220>\n"
350
+ %Q(<ICB00140>
351
+ #{render_attr('ICB00150', '仮払税金')}
352
+ #{render_attr('ICB00160', readable(未収仮払税金) * -1)}
353
+ <ICB00170>
354
+ #{render_attr('ICB00190', readable(還付税金) * -1)}
355
+ #{render_attr('ICB00200', @仮払税金 * -1)}
356
+ </ICB00170>
357
+ #{render_attr('ICB00210', @仮払税金 * -1)}
358
+ </ICB00140>)
359
+ end
360
+
361
+ def 別表五一還付法人税
362
+ return '' if (@start_balance['1502']||0) == 0 && @翌期還付法人税 == 0
363
+
364
+ %Q(<ICB00220>
365
+ #{render_attr('ICB00230', @start_balance['1502'] || 0)}
366
+ <ICB00240>
367
+ #{render_attr('ICB00250', @当期還付法人税)}
368
+ #{render_attr('ICB00260', @翌期還付法人税)}
369
+ </ICB00240>
370
+ #{render_attr('ICB00270', @翌期還付法人税)}
371
+ </ICB00220>)
372
+ end
373
+
374
+ def 別表五一還付都道府県住民税
375
+ return '' if (@start_balance['1503']||0) == 0 && @翌期還付都道府県住民税 == 0
376
+
377
+ %Q(<ICB00280>
378
+ #{render_attr('ICB00290', @start_balance['1503'] || 0)}
379
+ <ICB00300>
380
+ #{render_attr('ICB00310', @当期還付都道府県住民税)}
381
+ #{render_attr('ICB00320', @翌期還付都道府県住民税)}
382
+ </ICB00300>
383
+ #{render_attr('ICB00330', @翌期還付都道府県住民税)}
384
+ </ICB00280>)
385
+ end
386
+
387
+ def 別表五一還付市民税
388
+ return '' if (@start_balance['1505']||0) == 0 && @翌期還付市民税 == 0
389
+
390
+ %Q(<ICB00340>
391
+ #{render_attr('ICB00350', @start_balance['1505'] || 0)}
392
+ <ICB00360>
393
+ #{render_attr('ICB00370', @当期還付市民税)}
394
+ #{render_attr('ICB00380', @翌期還付市民税)}
395
+ </ICB00360>
396
+ #{render_attr('ICB00390', @翌期還付市民税)}
397
+ </ICB00340>)
246
398
  end
247
399
 
248
400
  def 期首繰越損益
@@ -257,16 +409,11 @@ module Luca
257
409
  readable(@start_balance.dig('515')) || 0
258
410
  end
259
411
 
260
- def 期末納税充当金
261
- readable(@bs_data.dig('515')) || 0
262
- end
263
-
264
412
  def 納税充当金期中増減
265
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '515')
266
- [
267
- readable(r[:credit]['515'] || 0) + @法人税期中増 + @都道府県民税期中増 + @市民税期中増 + @事業税期中増,
268
- readable(r[:debit]['515'] || 0) + @法人税期中減 + @都道府県民税期中減 + @市民税期中減 + @事業税期中減
269
- ]
413
+ r = debit_amount('515', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
414
+ 納付 = 納付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付) + 期末未納都道府県民税 + 期末未納市民税 + 納付税額(確定事業税, @事業税中間納付)
415
+
416
+ [納付, readable(r)]
270
417
  end
271
418
 
272
419
  def 期首未納法人税
@@ -274,12 +421,12 @@ module Luca
274
421
  end
275
422
 
276
423
  def 期末未納法人税
277
- readable(@bs_data.dig('5151')) || 0
424
+ 納付税額(@確定法人税額 + @確定地方法人税額, @法人税中間納付 + @地方法人税中間納付)
278
425
  end
279
426
 
280
427
  def 未納法人税期中増減
281
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5151')
282
- [readable(r[:credit]['5151'] || 0), readable(r[:debit]['5151'] || 0)]
428
+ r = debit_amount('5151', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
429
+ [(@確定法人税額 + @確定地方法人税額), readable(r)]
283
430
  end
284
431
 
285
432
  # 中間納付した金額のうち税額とならず、還付されるべき額
@@ -303,20 +450,21 @@ module Luca
303
450
  end
304
451
 
305
452
  def 期末未納都道府県民税
306
- readable(@bs_data.dig('5153')) || 0
453
+ 納付税額(@税額.dig(:kenmin, :kintou), @都道府県民税均等割中間納付) + 納付税額(@税額.dig(:kenmin, :houjinzei), @都道府県民税法人税割中間納付)
307
454
  end
308
455
 
309
456
  def 未納都道府県民税期中増減
310
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5153')
311
- [readable(r[:credit]['5153'] || 0), readable(r[:debit]['5153'] || 0)]
457
+ r = debit_amount('5153', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
458
+ [確定都道府県住民税, readable(r)]
312
459
  end
313
460
 
314
461
  def 都道府県民税仮払納付
315
462
  [(@都道府県民税中間納付 - 確定都道府県住民税), 0].max
463
+ 中間還付税額(@税額.dig(:kenmin, :kintou), @都道府県民税均等割中間納付) + 中間還付税額(@税額.dig(:kenmin, :houjinzei), @都道府県民税法人税割中間納付)
316
464
  end
317
465
 
318
466
  def 都道府県民税損金納付
319
- [[確定都道府県住民税, 0].max, @都道府県民税中間納付].min
467
+ [@都道府県民税均等割中間納付, @税額.dig(:kenmin, :kintou)].min + [@都道府県民税法人税割中間納付, @税額.dig(:kenmin, :houjinzei)].min
320
468
  end
321
469
 
322
470
  def 確定市民税
@@ -328,20 +476,28 @@ module Luca
328
476
  end
329
477
 
330
478
  def 期末未納市民税
331
- readable(@bs_data.dig('5154')) || 0
479
+ 納付税額(@税額.dig(:shimin, :kintou), @市民税均等割中間納付) + 納付税額(@税額.dig(:shimin, :houjinzei), @市民税法人税割中間納付)
332
480
  end
333
481
 
334
482
  def 未納市民税期中増減
335
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5154')
336
- [readable(r[:credit]['5154'] || 0), readable(r[:debit]['5154'] || 0)]
483
+ r = debit_amount('5154', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
484
+ [確定市民税, readable(r)]
337
485
  end
338
486
 
339
487
  def 市民税仮払納付
340
- [0, (@市民税中間納付 - 確定市民税)].max
488
+ 中間還付税額(@税額.dig(:shimin, :kintou), @市民税均等割中間納付) + 中間還付税額(@税額.dig(:shimin, :houjinzei), @市民税法人税割中間納付)
341
489
  end
342
490
 
343
491
  def 市民税損金納付
344
- [@市民税中間納付, [確定市民税, 0].max].min
492
+ [@市民税均等割中間納付, @税額.dig(:shimin, :kintou)].min + [@市民税法人税割中間納付, @税額.dig(:shimin, :houjinzei)].min
493
+ end
494
+
495
+ def 確定事業税
496
+ @税額.dig(:kenmin, :shotoku) + @税額.dig(:kenmin, :tokubetsu)
497
+ end
498
+
499
+ def 事業税損金納付
500
+ [@事業税中間納付, 確定事業税].min
345
501
  end
346
502
 
347
503
  def 別表五一期首差引金額
@@ -349,15 +505,15 @@ module Luca
349
505
  end
350
506
 
351
507
  def 別表五一期末差引金額
352
- 期末繰越損益 + 期末納税充当金 - 期末未納法人税 - 期末未納都道府県民税 - 期末未納市民税
508
+ 期末繰越損益 + @納税充当金期中増 - 期末未納法人税 - 期末未納都道府県民税 - 期末未納市民税 - @翌期還付事業税
353
509
  end
354
510
 
355
511
  def 別表五一期中減差引金額
356
- 期首繰越損益 + @納税充当金期中減 - @法人税期中減 - @都道府県民税期中減 - @市民税期中減
512
+ 期首繰越損益 + @納税充当金期中減 - @法人税期中減 - @都道府県民税期中減 - @市民税期中減 - @翌期還付法人税 - @翌期還付都道府県住民税 - @翌期還付市民税
357
513
  end
358
514
 
359
515
  def 別表五一期中増差引金額
360
- 期末繰越損益 + @納税充当金期中増 - @法人税期中増 - @都道府県民税期中増 - @市民税期中増
516
+ 期末繰越損益 + 納付税額(確定事業税, @事業税中間納付) - @法人税中間納付 - @地方法人税中間納付 - @都道府県民税中間納付 - @市民税中間納付 - @翌期還付事業税
361
517
  end
362
518
 
363
519
  def 期末未収税金(code)
@@ -412,8 +568,22 @@ module Luca
412
568
  end
413
569
 
414
570
  def 未納消費税期中増減
415
- r = LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '516')
416
- [readable(r[:credit]['516'] || 0), readable(r[:debit]['516'] || 0)]
571
+ increase = debit_amount('C1I1', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
572
+ r = debit_amount('516', @start_date.year, @start_date.month, @end_date.year, @end_date.month)
573
+ [readable(increase), readable(r)]
574
+ end
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")
417
587
  end
418
588
 
419
589
  def 概況月(idx)
@@ -438,13 +608,17 @@ module Luca
438
608
 
439
609
  def 概況月源泉徴収(idx)
440
610
  target = @start_date.next_month(idx)
441
- readable(LucaBook::State.gross(target.year, target.month, code: '5191')[:credit]['5191'] || 0)
442
- + 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
443
615
  end
444
616
 
445
617
  def 概況源泉徴収
446
- readable(LucaBook::State.gross(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: '5191')[:credit]['5191'] || 0)
447
- + 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
448
622
  end
449
623
 
450
624
  def gaikyo(code)