luca-jp 0.18.0 → 0.19.0

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: 6a98448036b1788b2abc23519ad4cfc8e0cd0396514575adf8bd7503f88a28cf
4
- data.tar.gz: a02f5398a24dc46f4b0a635eafcb2b0f6416198cffc99381f96503b1a7bd3822
3
+ metadata.gz: 90bae24e5243dd793a1c43b66e67d4aa92df675264b5f80e1ad2020b86fb7a85
4
+ data.tar.gz: 54064470cd7f69a391ce7a22e25fea56eea0eb0820c94a3678fb6fb8eca0cf58
5
5
  SHA512:
6
- metadata.gz: 2bb9826708254e146de42058bcea099f4c50bf2f27e5101f549fffc7f5aa284b55131ccd634305fc2b05d0a1d7b303aecc2148f336ec64836a1fdc5a136f8c30
7
- data.tar.gz: cd0f64837e95bf6d6291fac1ac8f7160acd9e303cb2c09a2500f202a63b725809a8dd3d1bfd353dcc19934edfee65841f94278e040cd0c5b1caa698bfac849d0
6
+ metadata.gz: 85ce4d176026e2250e5a8feca739f212730461231801b633a078d6a3895db04a7cdba2ec2916aa94a2d3f5da62b96b3eb5808f2991a92ea05d6718d6e1cbdbb9
7
+ data.tar.gz: 134e8fe26f2dd02d2606b56915eb25be299644c8a1ead108078b8f4695923d2a9e7ef9245a0d3fd7e4dd989461da25905333a9be7306ce327f5efd725d223e66
data/exe/luca-jp CHANGED
@@ -24,7 +24,7 @@ class LucaCmd
24
24
  if params[:export]
25
25
  puts Luca::Jp::Aoiro.range(*auto_range(args, params)).export_json(ext_config: ext_config)
26
26
  else
27
- puts Luca::Jp::Aoiro.range(*auto_range(args, params)).kani(ext_config: ext_config)
27
+ puts Luca::Jp::Aoiro.range(*auto_range(args, params)).kani(ext_config: ext_config, no_xbrl: params[:noxbrl])
28
28
  end
29
29
  end
30
30
 
@@ -37,14 +37,14 @@ class LucaCmd
37
37
  puts JSON.dump(accounts)
38
38
  else
39
39
  Luca::Jp::Util.eltax_config('reports').each do |report|
40
- File.open("chihouzei-#{report['jichitai_code']}#{report['jimusho_code']}.xml", 'w') { |f| f.puts(Luca::Jp::Chihouzei.range(*auto_range(args, params)).kani(report))}
40
+ File.open("chihouzei-#{report['jichitai_code']}#{report['jimusho_code']}.xml", 'w') { |f| f.puts(Luca::Jp::Chihouzei.range(*auto_range(args, params)).kani(report, ext_config: ext_config))}
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
45
  def self.urikake(args, params)
46
46
  date = "#{args[0]}-#{args[1]}-1"
47
- Luca::Jp::Urikake.new(date).report(params[:total], params[:encode])
47
+ Luca::Jp::Urikake.new(date).report(params[:encode])
48
48
  end
49
49
 
50
50
  def self.auto_range(args, params)
@@ -82,6 +82,7 @@ when 'h', /hou?jinzei/
82
82
  opt.on('-x VAL', 'extra config') { |v| params[:extra] = v }
83
83
  opt.on('--export', 'export json') { |_v| params[:export] = true }
84
84
  opt.on('--lastyear', 'report on last Financial year') { |_v| params[:lastyear] = true }
85
+ opt.on('--no-xbrl', 'skip XBRL statement') { |_v| params[:noxbrl] = true }
85
86
  args = opt.parse!(ARGV)
86
87
  LucaCmd.check_dir('journals', ext_conf: EXT_CONF) do
87
88
  LucaCmd.houjinzei(args, params)
@@ -111,7 +112,6 @@ when 'c', /chihou?zei/
111
112
  when /urikake/
112
113
  OptionParser.new do |opt|
113
114
  opt.banner = 'Usage: luca-jp urikake [options] yyyy mm'
114
- opt.on('--total VAL', '売掛金総額') { |v| params[:total] = v&.to_i }
115
115
  opt.on('--utf8', 'UTF-8でファイル生成') { |_v| params[:encode] = 'UTF-8' }
116
116
  args = opt.parse!(ARGV)
117
117
  LucaCmd.check_dir('invoices', ext_conf: EXT_CONF) do
data/lib/luca/jp/aoiro.rb CHANGED
@@ -20,13 +20,14 @@ module Luca
20
20
  @dirname = 'journals'
21
21
  @record_type = 'raw'
22
22
 
23
- def kani(ext_config: nil, export: false)
23
+ def kani(ext_config: nil, export: false, no_xbrl: false)
24
24
  set_pl(4)
25
25
  set_bs(4)
26
26
  @issue_date = Date.today
27
27
  @company = CGI.escapeHTML(config.dig('company', 'name'))
28
28
  @software = 'LucaJp'
29
29
  @shinkoku_kbn = '30' # 確定申告
30
+ @no_xbrl = no_xbrl # 決算書XBRLの組み込み省略
30
31
 
31
32
  別表四所得調整(ext_config)
32
33
  @税額 = 税額計算
@@ -99,7 +100,7 @@ module Luca
99
100
  別表六一, 別表七, 別表八一, 別表十四二, 別表十五,
100
101
  適用額明細,
101
102
  預貯金内訳, 有価証券内訳, 買掛金内訳, 仮受金内訳, 借入金内訳, 役員報酬内訳, 地代家賃内訳, 雑益雑損失内訳,
102
- 概況説明
103
+ 概況説明, 決算書
103
104
  ].compact.join("\n")
104
105
  render_erb(search_template('aoiro.xtx.erb'))
105
106
  end
@@ -382,6 +383,25 @@ module Luca
382
383
  render_erb(search_template('gaikyo.xml.erb'))
383
384
  end
384
385
 
386
+ def 決算書フォーム
387
+ return %Q(<XBRL2_1_SEC/>) if @no_xbrl
388
+
389
+ xsd_filename = %Q(#statement-#{@issue_date.to_s}.xsd)
390
+ %Q(<XBRL2_1_SEC><rdf:Seq>
391
+ <rdf:li><rdf:description><Instance><rdf:Bag><rdf:li><rdf:description about="#HOT010-1"/></rdf:li></rdf:Bag></Instance></rdf:description></rdf:li>
392
+ <rdf:li><rdf:description><taxonomy><rdf:Bag><rdf:li><rdf:description about="#{xsd_filename}"/></rdf:li></rdf:Bag></taxonomy></rdf:description></rdf:li>
393
+ </rdf:Seq></XBRL2_1_SEC>)
394
+ end
395
+
396
+ def 決算書
397
+ return nil if @no_xbrl
398
+
399
+ @xbrl_filename = %Q(statement-#{@issue_date.to_s})
400
+ @xbrl, @xsd = LucaBook::State.range(@start_date.year, @start_date.month, @end_date.year, @end_date.month)
401
+ .render_xbrl(@xbrl_filename)
402
+ render_erb(search_template('xbrl21.xml.erb'))
403
+ end
404
+
385
405
  def self.dict
386
406
  @@dict
387
407
  end
@@ -737,10 +757,6 @@ module Luca
737
757
  [@事業税中間納付, 確定事業税].min
738
758
  end
739
759
 
740
- def 期末未納事業税
741
- readable(@bs_data['5152']) || 0
742
- end
743
-
744
760
  def 別表五一期首差引金額
745
761
  [
746
762
  @当期還付法人税,
@@ -40,7 +40,7 @@ module Luca
40
40
  @地方特別法人事業税中間納付 = prepaid_tax('1854', @jimusho_name)
41
41
  @所得割中間納付 = prepaid_tax('1855', @jimusho_name)
42
42
  @法人税割中間納付 = prepaid_tax(
43
- @report_category == 'city' ? '185D' :'1859',
43
+ @report_category == 'city' ? '185D' : '1859',
44
44
  @jimusho_name
45
45
  )
46
46
  @均等割中間納付 = prepaid_tax(
@@ -132,7 +132,7 @@ module Luca
132
132
  期末資本準備金 = LucaSupport::Code.readable(@bs_data.dig('9131')||0)
133
133
 
134
134
  ([
135
- (寄付金算定所得 * 2.5 / 100).floor,
135
+ ([寄付金算定所得, 0].max * 2.5 / 100).floor,
136
136
  ([期末資本金, 期末資本準備金].compact.sum * 2.5 / 1000).floor
137
137
  ].compact.sum / 4).floor
138
138
  end
@@ -7,7 +7,7 @@
7
7
  <SEND_DATA/>
8
8
  <FORM_SEC><rdf:Seq><%= @form_sec %></rdf:Seq></FORM_SEC>
9
9
  <IT_SEC><rdf:description about="#IT"/></IT_SEC>
10
- <TENPU_SEC/><XBRL_SEC/><XBRL_2_1_SEC/>
10
+ <TENPU_SEC/><XBRL_SEC/><%= 決算書フォーム %>
11
11
  <SOFUSHO_SEC/><ATTACH_SEC/><CSV_SEC/>
12
12
  </rdf:description>
13
13
  </rdf:RDF>
@@ -0,0 +1,8 @@
1
+ <XBRL2_1>
2
+ <XBRL2_1_INSTANCE VR="2.0" id="HOT010-1" page="1" sakuseiDay="<%= @issue_date %>" sakuseiNM="<%= @company %>" softNM="<%= @software %> <%= @company %>">
3
+ <%= @xbrl %>
4
+ </XBRL2_1_INSTANCE>
5
+ <XBRL2_1_TAXONOMY id="<%= @xbrl_filename %>.xsd">
6
+ <%= @xsd %>
7
+ </XBRL2_1_TAXONOMY>
8
+ </XBRL2_1>
@@ -41,10 +41,11 @@ module Luca #:nodoc:
41
41
 
42
42
  @有価証券 = @bs_data.each.with_object({}) do |(k, v), h|
43
43
  next unless account_codes.include?(k.to_s)
44
- next if v.nil? || v <= 0
45
44
 
46
45
  inc = debit_amount(k, @start_date.year, @start_date.month, @end_date.year, @end_date.month) || 0
47
46
  dec = credit_amount(k, @start_date.year, @start_date.month, @end_date.year, @end_date.month) || 0
47
+ next if v.nil? || (v <= 0 && inc <= 0 && dec <= 0)
48
+
48
49
  h[k] = {
49
50
  name: self.class.dict.dig(k)[:label],
50
51
  amount: readable(v),
@@ -11,38 +11,37 @@ module Luca
11
11
  class Urikake < LucaDeal::Invoice
12
12
  @dirname = 'invoices'
13
13
 
14
- def report(total = nil, encoding = nil)
14
+ def report(encoding = nil)
15
15
  listed_amount = 0
16
16
  encoding ||= 'SJIS'
17
+ customers, total = list
17
18
  str = CSV.generate(String.new, headers: false, col_sep: ',', encoding: encoding) do |f|
18
- list.map do |invoice|
19
- amount = readable(invoice.dig('subtotal', 0, 'items') + invoice.dig('subtotal', 0, 'tax'))
19
+ customers.map do |c|
20
+ amount = readable(c['unsettled'])
20
21
  listed_amount += amount
21
- f << ['3', '0', '売掛金', invoice.dig('customer', 'name'), invoice.dig('customer', 'address'), amount, nil ]
22
+ f << ['3', '0', '売掛金', c['customer'], c['address'], amount, nil ]
22
23
  end
23
- if total
24
+ if total - listed_amount > 0
24
25
  f << ['3', '0', '売掛金', 'その他', nil, total - listed_amount, nil ]
25
- f << ['3', '1', nil, nil, nil, total, nil ]
26
- else
27
- f << ['3', '1', nil, nil, nil, listed_amount, nil ]
28
26
  end
27
+ f << ['3', '1', nil, nil, nil, total, nil ]
29
28
  end
30
29
  File.open('HOI030_3.0.csv', 'w') { |f| f.write(str) }
31
30
  end
32
31
 
33
32
  def list
34
- invoices = self.class.asof(@date.year, @date.month)
35
- .map { |dat, _path| dat }
36
- .sort_by { |invoice| invoice.dig('subtotal', 0, 'items') }
33
+ customers = self.class.report(@date, detail: true)
34
+ .sort_by { |customer| customer['unsettled'] }
37
35
  .reverse
36
+ total = customers.inject(0) { |sum, customer| sum + customer['unsettled'] }
38
37
 
39
- reports = invoices.filter { |invoice| 500_000 <= invoice['subtotal'].inject(0) { |sum, i| sum + i['items'] + i['tax'] } }
40
- return reports if reports.length >= 5
38
+ reports = customers.filter { |customer| 500_000 <= customer['unsettled'] }
39
+ return [reports, total] if reports.length >= 5
41
40
 
42
- additional = invoices
43
- .filter { |invoice| 500_000 > invoice['subtotal'].inject(0) { |sum, i| sum + i['items'] + i['tax'] } }
41
+ additional = customers
42
+ .filter { |customer| 500_000 > customer['unsettled'] }
44
43
  .take(5 - reports.length)
45
- reports.concat(additional)
44
+ [reports.concat(additional), total]
46
45
  end
47
46
  end
48
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Luca
4
4
  module Jp
5
- VERSION = '0.18.0'
5
+ VERSION = '0.19.0'
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.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-09 00:00:00.000000000 Z
11
+ date: 2024-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucabook
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.3
19
+ version: 0.5.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.3
26
+ version: 0.5.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: lucadeal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.5.5
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: lucasalary
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +173,7 @@ files:
159
173
  - lib/luca/jp/templates/shoken-meisai.xml.erb
160
174
  - lib/luca/jp/templates/syouhizei-shinkoku-kanni.xml.erb
161
175
  - lib/luca/jp/templates/tekiyougaku.xml.erb
176
+ - lib/luca/jp/templates/xbrl21.xml.erb
162
177
  - lib/luca/jp/templates/yakuin-meisai.xml.erb
163
178
  - lib/luca/jp/templates/yokin-meisai.xml.erb
164
179
  - lib/luca/jp/templates/zatsueki-meisai.xml.erb