luca-jp 0.18.0 → 0.18.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: 6a98448036b1788b2abc23519ad4cfc8e0cd0396514575adf8bd7503f88a28cf
4
- data.tar.gz: a02f5398a24dc46f4b0a635eafcb2b0f6416198cffc99381f96503b1a7bd3822
3
+ metadata.gz: b480588d30ad8662d44c2ab3f2c0575fa91250b2b24928d4ccc089f1fee34f48
4
+ data.tar.gz: 3843a90218ddccc9969d80ec955783a799e3095b6a1a01abe870632a3831f356
5
5
  SHA512:
6
- metadata.gz: 2bb9826708254e146de42058bcea099f4c50bf2f27e5101f549fffc7f5aa284b55131ccd634305fc2b05d0a1d7b303aecc2148f336ec64836a1fdc5a136f8c30
7
- data.tar.gz: cd0f64837e95bf6d6291fac1ac8f7160acd9e303cb2c09a2500f202a63b725809a8dd3d1bfd353dcc19934edfee65841f94278e040cd0c5b1caa698bfac849d0
6
+ metadata.gz: 6a87556ce0b2da2c016624df23efa9e73d00816e0682713596841426d95be8a13b256e6b6ae848b3e6ef16ac10ef9b0e6763b964f6f2cf5a8f14057a6bb52add
7
+ data.tar.gz: f3dd2de0bc8686bc7643ade70cb584a1e8e5e3d3c9c6019249e8cbcff07ee85c36ac65465df408bc7cb82611624201988f3b42c277ee392128f961238206c1cb
data/exe/luca-jp CHANGED
@@ -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)
@@ -111,7 +111,6 @@ when 'c', /chihou?zei/
111
111
  when /urikake/
112
112
  OptionParser.new do |opt|
113
113
  opt.banner = 'Usage: luca-jp urikake [options] yyyy mm'
114
- opt.on('--total VAL', '売掛金総額') { |v| params[:total] = v&.to_i }
115
114
  opt.on('--utf8', 'UTF-8でファイル生成') { |_v| params[:encode] = 'UTF-8' }
116
115
  args = opt.parse!(ARGV)
117
116
  LucaCmd.check_dir('invoices', ext_conf: EXT_CONF) do
data/lib/luca/jp/aoiro.rb CHANGED
@@ -737,10 +737,6 @@ module Luca
737
737
  [@事業税中間納付, 確定事業税].min
738
738
  end
739
739
 
740
- def 期末未納事業税
741
- readable(@bs_data['5152']) || 0
742
- end
743
-
744
740
  def 別表五一期首差引金額
745
741
  [
746
742
  @当期還付法人税,
@@ -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
@@ -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.18.1'
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.18.1
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
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.5.3
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