lucabook 0.2.7 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbbe396e906d2a98f5a87f2f08a338be5c31956039b9e6378897c052dd752ae6
4
- data.tar.gz: cce0fca70ca474902567ecd83a67bf0a8be18904ea0ade9560063167ac2cc1f7
3
+ metadata.gz: db7564331de8046e8a6507c2ccf7dc099382ff3fc1c6a603f9ecc290755398ba
4
+ data.tar.gz: 5fb64e6fbccc5a5e693211ae89d8bad6560593add1f26261879b2ae4bc67fa00
5
5
  SHA512:
6
- metadata.gz: 3aadaeb6cd7de826420830a8af50575cef9e5b89b6168e506fc6ee59cfd34f9462e6e0fedee1a470eb1eb3a778f3c4d37356be60947e592bb09cf86b0f20a7a4
7
- data.tar.gz: 10575e9029feeb6ba181fe95bb121a34a53945116c4d731859fe8dc5c788fd7428b5cc69688d1bbdfd696251be2422e934bf17cd47c6d29f10c62363269d174e
6
+ metadata.gz: 4cee8065abe4d479dc909e2e9f12f0fdb942e7b3c51b2f5f5e993598080db28411625d990c7f7a7ec85ebc96686a4dcf6d0173e8fed58fd3a3261731ea3da831
7
+ data.tar.gz: 1cd81e73a4dfcf3eef52a8105b7e1dc921f9d79d8b9945bf2b9e74d80134d2ca157346d69d98a26037d0f087fa4475e05938ae0044a7b1fcb3120b744f3a9ba8
@@ -1,54 +1,88 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require "optparse"
4
- require "luca_book/console"
5
-
6
- def list(args, params)
7
- if params["c"] or params["code"]
8
- code = params["c"] || params["code"]
9
- LucaBookConsole.new.by_code(code, args.dig(0), args.dig(1))
10
- elsif args.length > 0
11
- LucaBookConsole.new.by_month(args[0], args.dig(1))
12
- else
13
- LucaBookConsole.new.all
3
+ require 'optparse'
4
+ require 'luca_book'
5
+
6
+ module LucaCmd
7
+ class Journal
8
+ def self.import(args, params)
9
+ if params['config']
10
+ LucaBook::Import.new(args[0], params['config']).import_csv
11
+ elsif params['json']
12
+ LucaBook::Import.import_json(STDIN.read)
13
+ else
14
+ puts 'Usage: luca-book import -c import_config'
15
+ end
16
+ end
17
+
18
+ def self.list(args, params)
19
+ if params['code']
20
+ LucaBook::List.term(*args, code: params['code']).flat_list.to_yaml
21
+ elsif args.length > 0
22
+ LucaBook::List.term(*args).flat_list.to_yaml
23
+ else
24
+ # TODO: define default function
25
+ end
26
+ end
14
27
  end
15
- end
16
28
 
17
- def report(args, params)
18
- if params['bs']
19
- LucaBook::State.term(*args).bs.to_yaml
20
- elsif params['pl']
21
- LucaBook::State.term(*args).pl.to_yaml
22
- else
23
- LucaBook::State.term(*args).to_yaml
29
+ class Report
30
+ def self.balancesheet(args, params)
31
+ LucaBook::State.term(*args).bs.to_yaml
32
+ end
33
+
34
+ def self.profitloss(args, params)
35
+ LucaBook::State.term(*args).pl.to_yaml
36
+ end
24
37
  end
25
38
  end
26
39
 
40
+
41
+ LucaRecord::Base.valid_project?
27
42
  cmd = ARGV.shift
43
+ params = {}
28
44
 
29
45
  case cmd
30
- when "list"
31
- params = {}
32
- OptionParser.new do |opt|
33
- opt.banner = 'Usage: luca list [year month]'
34
- opt.on('-c', '--code VAL', 'search with code'){|v| params["code"] = v }
35
- opt.on_tail('List records. If you specify code and/or month, search on each criteria.')
36
- args = opt.parse!(ARGV)
37
- list(args, params)
46
+ when /journals?/, 'j'
47
+ subcmd = ARGV.shift
48
+ case subcmd
49
+ when 'import'
50
+ OptionParser.new do |opt|
51
+ opt.banner = 'Usage: luca import filepath'
52
+ opt.on('-c', '--config VAL', 'import definition'){|v| params['config'] = v }
53
+ opt.on('-j', '--json', 'import via json format'){|_v| params['json'] = true }
54
+ args = opt.parse!(ARGV)
55
+ LucaCmd::Journal.import(args, params)
56
+ end
57
+ when 'list'
58
+ OptionParser.new do |opt|
59
+ opt.banner = 'Usage: luca list [year month]'
60
+ opt.on('-c', '--code VAL', 'search with code') { |v| params['code'] = v }
61
+ opt.on_tail('List records. If you specify code and/or month, search on each criteria.')
62
+ args = opt.parse!(ARGV)
63
+ LucaCmd::Journal.list(args, params)
64
+ end
38
65
  end
39
- when "report"
40
- params = {}
41
- OptionParser.new do |opt|
42
- opt.banner = 'Usage: luca report'
43
- opt.on('--bs', 'show Balance sheet'){|v| params["bs"] = v }
44
- opt.on('--pl', 'show Income statement'){|v| params["pl"] = v }
45
- args = opt.parse!(ARGV)
46
- report(args, params)
66
+ when /reports?/, 'r'
67
+ subcmd = ARGV.shift
68
+ case subcmd
69
+ when 'bs'
70
+ OptionParser.new do |opt|
71
+ opt.banner = 'Usage: luca-book reports bs'
72
+ args = opt.parse!(ARGV)
73
+ LucaCmd::Report.balancesheet(args, params)
74
+ end
75
+ when 'pl'
76
+ OptionParser.new do |opt|
77
+ opt.banner = 'Usage: luca-book reports pl'
78
+ args = opt.parse!(ARGV)
79
+ LucaCmd::Report.profitloss(args, params)
80
+ end
47
81
  end
48
- when "--help"
49
- puts 'Usage: luca subcommand'
50
- puts ' list: list records'
51
- puts ' report: show reports'
82
+ when '--help'
83
+ puts 'Usage: luca-book subcommand'
84
+ puts ' journals: operate journal records'
85
+ puts ' reports: show reports'
52
86
  else
53
87
  puts 'Invalid subcommand'
54
88
  end
@@ -1,8 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'csv'
4
+ require 'luca_record'
3
5
  require 'luca_book/version'
4
6
 
5
7
  module LucaBook
8
+ autoload :Import, 'luca_book/import'
6
9
  autoload :Journal, 'luca_book/journal'
10
+ autoload :List, 'luca_book/list'
11
+ autoload :Setup, 'luca_book/setup'
7
12
  autoload :State, 'luca_book/state'
8
13
  end
@@ -1,25 +1,15 @@
1
1
  require 'luca_book'
2
2
 
3
+ # This class will be deleted
4
+ #
3
5
  class LucaBookConsole
4
6
 
5
7
  def initialize(dir_path=nil)
6
- @report = LucaBookReport.new(dir_path)
8
+ @report = LucaBook::State.new(dir_path)
7
9
  end
8
10
 
9
- def all
10
- array = @report.scan_terms(@report.book.pjdir).map{|y,m| y}.uniq.map{|year|
11
- @report.book.search(year)
12
- }.flatten
13
- show_records(array)
14
- end
15
-
16
- def by_code(code, year=nil, month=nil)
17
- array = @report.by_code(code, year, month)
18
- show_records(array)
19
- end
20
-
21
- def by_month(year, month)
22
- array = @report.book.search(year, month)
11
+ def by_term(year, month, end_year = year, end_month = month)
12
+ array = @report.book.class.term(year, month, end_year, end_month)
23
13
  show_records(array)
24
14
  end
25
15
 
@@ -12,49 +12,52 @@ module LucaBook
12
12
  DEBIT_DEFAULT = '仮払金'
13
13
  CREDIT_DEFAULT = '仮受金'
14
14
 
15
- def initialize(path)
15
+ def initialize(path, dict)
16
16
  raise 'no such file' unless FileTest.file?(path)
17
17
 
18
18
  @target_file = path
19
19
  # TODO: yaml need to be configurable
20
- @dict = LucaRecord::Dict.new('import.yaml')
20
+ @dict = LucaRecord::Dict.new("import-#{dict}.yaml")
21
21
  @code_map = LucaRecord::Dict.reverse(LucaRecord::Dict.load('base.tsv'))
22
- @config = @dict.csv_config
22
+ @config = @dict.csv_config if dict
23
23
  end
24
24
 
25
25
  # === JSON Format:
26
- # {
27
- # "date": "2020-05-04",
28
- # "debit" : [
29
- # {
30
- # "label": "savings accounts",
31
- # "value": 20000
32
- # }
33
- # ],
34
- # "credit" : [
35
- # {
36
- # "label": "trade notes receivable",
37
- # "value": 20000
38
- # }
39
- # ],
40
- # "note": "settlement for the last month trade"
41
- # }
26
+ # [
27
+ # {
28
+ # "date": "2020-05-04",
29
+ # "debit" : [
30
+ # {
31
+ # "label": "savings accounts",
32
+ # "value": 20000
33
+ # }
34
+ # ],
35
+ # "credit" : [
36
+ # {
37
+ # "label": "trade notes receivable",
38
+ # "value": 20000
39
+ # }
40
+ # ],
41
+ # "note": "settlement for the last month trade"
42
+ # }
43
+ # ]
42
44
  #
43
- def import_json(io)
44
- d = JSON.parse(io)
45
- validate(d)
45
+ def self.import_json(io)
46
+ JSON.parse(io).each do |d|
47
+ validate(d)
46
48
 
47
- # dict = LucaBook::Dict.reverse_dict(LucaBook::Dict::Data)
48
- d['debit'].each { |h| h['code'] = @dict.search(h['label'], DEBIT_DEFAULT) }
49
- d['credit'].each { |h| h['code'] = @dict.search(h['label'], CREDIT_DEFAULT) }
49
+ code_map = LucaRecord::Dict.reverse(LucaRecord::Dict.load('base.tsv'))
50
+ d['debit'].each { |h| h['code'] = code_map.dig(h['label']) || DEBIT_DEFAULT }
51
+ d['credit'].each { |h| h['code'] = code_map.dig(h['label']) || CREDIT_DEFAULT }
50
52
 
51
- LucaBook.new.create!(d)
53
+ LucaBook::Journal.create(d)
54
+ end
52
55
  end
53
56
 
54
57
  def import_csv
55
58
  @dict.load_csv(@target_file) do |row|
56
59
  if @config[:type] == 'single'
57
- LucaBook::Journal.create!(parse_single(row))
60
+ LucaBook::Journal.create(parse_single(row))
58
61
  elsif @config[:type] == 'double'
59
62
  p parse_double(row)
60
63
  else
@@ -63,12 +66,22 @@ module LucaBook
63
66
  end
64
67
  end
65
68
 
69
+ def self.validate(obj)
70
+ raise 'NoDateKey' unless obj.key?('date')
71
+ raise 'NoDebitKey' unless obj.key?('debit')
72
+ raise 'NoDebitValue' if obj['debit'].empty?
73
+ raise 'NoCreditKey' unless obj.key?('credit')
74
+ raise 'NoCreditValue' if obj['credit'].empty?
75
+ end
76
+
77
+ private
78
+
66
79
  #
67
80
  # convert single entry data
68
81
  #
69
82
  def parse_single(row)
70
83
  value = row.dig(@config[:credit_value])&.empty? ? row[@config[:debit_value]] : row[@config[:credit_value]]
71
- {}.tap do |d|
84
+ {}.tap do |d|
72
85
  d['date'] = parse_date(row)
73
86
  if row.dig(@config[:credit_value])&.empty?
74
87
  d['debit'] = [
@@ -87,7 +100,7 @@ module LucaBook
87
100
  end
88
101
  d['debit'][0]['value'] = value
89
102
  d['credit'][0]['value'] = value
90
- d['note'] = row[@config[:note]]
103
+ d['note'] = Array(@config[:note]).map{ |col| row[col] }.join(' ')
91
104
  end
92
105
  end
93
106
 
@@ -105,7 +118,7 @@ module LucaBook
105
118
  'code' => search_code(row[@config[:credit_label]], CREDIT_DEFAULT),
106
119
  'value' => row.dig(@config[:credit_value])
107
120
  }
108
- d['note'] = row[@config[:note]]
121
+ d['note'] = Array(@config[:note]).map{ |col| row[col] }.join(' ')
109
122
  end
110
123
  end
111
124
 
@@ -118,13 +131,5 @@ module LucaBook
118
131
 
119
132
  "#{row.dig(@config[:year])}-#{row.dig(@config[:month])}-#{row.dig(@config[:day])}"
120
133
  end
121
-
122
- def validate(obj)
123
- raise 'NoDateKey' if ! obj.has_key?('date')
124
- raise 'NoDebitKey' if ! obj.has_key?('debit')
125
- raise 'NoDebitValue' if obj['debit'].length < 1
126
- raise 'NoCreditKey' if ! obj.has_key?('credit')
127
- raise 'NoCreditValue' if obj['credit'].length < 1
128
- end
129
134
  end
130
135
  end
@@ -10,70 +10,81 @@ module LucaBook
10
10
  class Journal < LucaRecord::Base
11
11
  @dirname = 'journals'
12
12
 
13
- #
14
13
  # create journal from hash
15
14
  #
16
- def self.create!(d)
15
+ def self.create(d)
17
16
  date = Date.parse(d['date'])
18
17
 
19
- debit_amount = serialize_on_key(d['debit'], 'value')
20
- credit_amount = serialize_on_key(d['credit'], 'value')
18
+ debit_amount = LucaSupport::Code.decimalize(serialize_on_key(d['debit'], 'value'))
19
+ credit_amount = LucaSupport::Code.decimalize(serialize_on_key(d['credit'], 'value'))
21
20
  raise 'BalanceUnmatch' if debit_amount.inject(:+) != credit_amount.inject(:+)
22
21
 
23
22
  debit_code = serialize_on_key(d['debit'], 'code')
24
23
  credit_code = serialize_on_key(d['credit'], 'code')
25
24
 
26
- # TODO: limit code length for filename
27
- codes = (debit_code + credit_code).uniq
25
+ # TODO: need to sync filename & content. Limit code length for filename
26
+ # codes = (debit_code + credit_code).uniq
27
+ codes = nil
28
28
  create_record!(date, codes) do |f|
29
29
  f << debit_code
30
- f << debit_amount
30
+ f << LucaSupport::Code.readable(debit_amount)
31
31
  f << credit_code
32
- f << credit_amount
32
+ f << LucaSupport::Code.readable(credit_amount)
33
+ ['x-customer', 'x-editor'].each do |x_header|
34
+ f << [x_header, d[x_header]] if d.dig(x_header)
35
+ end
33
36
  f << []
34
37
  f << [d.dig('note')]
35
38
  end
36
39
  end
37
40
 
38
- #
41
+ def self.update_codes(obj)
42
+ debit_code = serialize_on_key(obj[:debit], :code)
43
+ credit_code = serialize_on_key(obj[:credit], :code)
44
+ codes = (debit_code + credit_code).uniq.sort.compact
45
+ change_codes(obj[:id], codes)
46
+ end
47
+
48
+ # define new transaction ID & write data at once
49
+ def self.create_record!(date_obj, codes = nil)
50
+ create_record(nil, date_obj, codes) do |f|
51
+ f.write CSV.generate('', col_sep: "\t", headers: false) { |c| yield(c) }
52
+ end
53
+ end
54
+
39
55
  # collect values on specified key
40
56
  #
41
57
  def self.serialize_on_key(array_of_hash, key)
42
58
  array_of_hash.map { |h| h[key] }
43
59
  end
44
60
 
45
- #
46
61
  # override de-serializing journal format
47
62
  #
48
63
  def self.load_data(io, path)
49
64
  {}.tap do |record|
50
65
  body = false
51
- record[:id] = path[0] + path[1]
66
+ record[:id] = "#{path[0]}/#{path[1]}"
52
67
  CSV.new(io, headers: false, col_sep: "\t", encoding: 'UTF-8')
53
68
  .each.with_index(0) do |line, i|
54
69
  case i
55
70
  when 0
56
71
  record[:debit] = line.map { |row| { code: row } }
57
72
  when 1
58
- line.each_with_index do |amount, i|
59
- record[:debit][i][:amount] = amount.to_i # TODO: bigdecimal support
60
- end
73
+ line.each_with_index { |amount, j| record[:debit][j][:amount] = BigDecimal(amount.to_s) }
61
74
  when 2
62
75
  record[:credit] = line.map { |row| { code: row } }
63
76
  when 3
64
- line.each_with_index do |amount, i|
65
- record[:credit][i][:amount] = amount.to_i # TODO: bigdecimal support
66
- end
77
+ line.each_with_index { |amount, j| record[:credit][j][:amount] = BigDecimal(amount.to_s) }
67
78
  else
68
- if line.empty?
79
+ if body == false && line.empty?
69
80
  record[:note] ||= []
70
81
  body = true
71
- next
82
+ else
83
+ record[:note] << line.join(' ') if body
72
84
  end
73
- record[:note] << line.join(' ') if body
74
85
  end
75
- record[:note]&.join('\n')
76
86
  end
87
+ record[:note] = record[:note]&.join('\n')
77
88
  end
78
89
  end
79
90
  end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+ require 'date'
5
+ require 'luca_support'
6
+ require 'luca_record'
7
+ require 'luca_record/dict'
8
+ require 'luca_book'
9
+
10
+ # Journal List on specified term
11
+ #
12
+ module LucaBook
13
+ class List < LucaBook::Journal
14
+ @dirname = 'journals'
15
+
16
+ def initialize(data)
17
+ @data = data
18
+ @dict = LucaRecord::Dict.load('base.tsv')
19
+ end
20
+
21
+ def self.term(from_year, from_month, to_year = from_year, to_month = from_month, code: nil, basedir: @dirname)
22
+ data = LucaBook::Journal.term(from_year, from_month, to_year, to_month, code).select do |dat|
23
+ if code.nil?
24
+ true
25
+ else
26
+ [:debit, :credit].map { |key| serialize_on_key(dat[key], :code) }.flatten.include?(code)
27
+ end
28
+ end
29
+ new data
30
+ end
31
+
32
+ def convert_label
33
+ @data.each do |dat|
34
+ dat[:debit].each { |debit| debit[:code] = "#{debit[:code]} #{@dict.dig(debit[:code], :label)}" }
35
+ dat[:credit].each { |credit| credit[:code] = "#{credit[:code]} #{@dict.dig(credit[:code], :label)}" }
36
+ end
37
+ self
38
+ end
39
+
40
+ def flat_list
41
+ convert_label
42
+ @data = @data.map do |dat|
43
+ idx = dat[:debit].length >= dat[:credit].length ? :debit : :credit
44
+ dat[idx].map.with_index do |_k, i|
45
+ date, txid = LucaSupport::Code.decode_id(dat[:id])
46
+ {}.tap do |res|
47
+ res['date'] = date
48
+ res['no'] = txid
49
+ res['id'] = dat[:id]
50
+ res['debit_code'] = dat[:debit][i][:code] if dat[:debit][i]
51
+ res['debit_amount'] = dat[:debit][i][:amount] if dat[:debit][i]
52
+ res['credit_code'] = dat[:credit][i][:code] if dat[:credit][i]
53
+ res['credit_amount'] = dat[:credit][i][:amount] if dat[:credit][i]
54
+ res['note'] = dat[:note]
55
+ end
56
+ end
57
+ end.flatten
58
+ self
59
+ end
60
+
61
+ def to_yaml
62
+ YAML.dump(LucaSupport::Code.readable(@data)).tap { |data| puts data }
63
+ end
64
+
65
+ def dict
66
+ LucaBook::Dict::Data
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'luca_book'
4
+ require 'fileutils'
5
+
6
+ module LucaBook
7
+ class Setup
8
+ # create project skeleton under specified directory
9
+ def self.create_project(country = nil, dir = LucaSupport::Config::Pjdir)
10
+ FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
11
+ Dir.chdir(dir) do
12
+ %w[data/journals dict].each do |subdir|
13
+ FileUtils.mkdir_p(subdir) unless Dir.exist?(subdir)
14
+ end
15
+ dict = if File.exist?("#{__dir__}/templates/dict-#{country}.tsv")
16
+ "dict-#{country}.tsv"
17
+ else
18
+ 'dict-en.tsv'
19
+ end
20
+ FileUtils.cp("#{__dir__}/templates/#{dict}", 'dict/base.tsv') unless File.exist?('dict/base.tsv')
21
+ end
22
+ end
23
+ end
24
+ end
@@ -51,18 +51,18 @@ module LucaBook
51
51
  end
52
52
 
53
53
  def by_code(code, year=nil, month=nil)
54
- raise "not supported year range yet" if ! year.nil? && month.nil?
54
+ raise 'not supported year range yet' if ! year.nil? && month.nil?
55
55
 
56
- bl = @book.load_start.dig(code) || 0
57
- full_term = scan_terms(LucaSupport::Config::Pjdir)
56
+ balance = @book.load_start.dig(code) || 0
57
+ full_term = self.class.scan_terms
58
58
  if ! month.nil?
59
- pre_term = full_term.select{|y,m| y <= year.to_i && m < month.to_i }
60
- bl += pre_term.map{|y,m| self.class.net(y, m)}.inject(0){|sum, h| sum + h[code]}
61
- [{ code: code, balance: bl, note: "#{code} #{dict.dig(code, :label)}" }] + records_with_balance(year, month, code, bl)
59
+ pre_term = full_term.select { |y, m| y <= year.to_i && m < month.to_i }
60
+ balance += pre_term.map { |y, m| self.class.net(y, m)}.inject(0){|sum, h| sum + h[code] }
61
+ [{ code: code, balance: balance, note: "#{code} #{dict.dig(code, :label)}" }] + records_with_balance(year, month, code, balance)
62
62
  else
63
- start = { code: code, balance: bl, note: "#{code} #{dict.dig(code, :label)}" }
64
- full_term.map {|y, m| y }.uniq.map {|y|
65
- records_with_balance(y, nil, code, bl)
63
+ start = { code: code, balance: balance, note: "#{code} #{dict.dig(code, :label)}" }
64
+ full_term.map { |y, m| y }.uniq.map { |y|
65
+ records_with_balance(y, nil, code, balance)
66
66
  }.flatten.prepend(start)
67
67
  end
68
68
  end
@@ -81,7 +81,7 @@ module LucaBook
81
81
  current = @book.load_start
82
82
  target = []
83
83
  Dir.chdir(@book.pjdir) do
84
- net_records = scan_terms(@book.pjdir).map do |year, month|
84
+ net_records = self.class.scan_terms.map do |year, month|
85
85
  target << [year, month]
86
86
  accumulate_month(year, month)
87
87
  end
@@ -218,6 +218,7 @@ module LucaBook
218
218
  end
219
219
  end
220
220
 
221
+ # TODO: replace load_tsv -> generic load_tsv_dict
221
222
  def load_start
222
223
  file = LucaSupport::Config::Pjdir + 'start.tsv'
223
224
  {}.tap do |dic|
@@ -227,6 +228,13 @@ module LucaBook
227
228
  end
228
229
  end
229
230
 
231
+ def load_tsv(path)
232
+ return enum_for(:load_tsv, path) unless block_given?
233
+
234
+ data = CSV.read(path, headers: true, col_sep: "\t", encoding: 'UTF-8')
235
+ data.each { |row| yield row }
236
+ end
237
+
230
238
  def self.calc_diff(num, code)
231
239
  amount = /\./.match(num.to_s) ? BigDecimal(num) : num.to_i
232
240
  amount * pn_debit(code.to_s)
@@ -0,0 +1,145 @@
1
+ code label consumption_tax income_tax
2
+ 10 Current Assets
3
+ 110 Cash and cash equivalents
4
+ 111 Cash
5
+ 112 Petty cash
6
+ 113 Saving accounts
7
+ 114 Checking accounts
8
+ 115 定期預金
9
+ 116 通知預金
10
+ 117 納税準備預金
11
+ 118 別段預金
12
+ 120 Notes receivable
13
+ 130 Accounts receivable - trade
14
+ 140 短期貸付金
15
+ 150 未収入金
16
+ 160 棚卸資産
17
+ 161 商品
18
+ 162 製品
19
+ 163 仕掛品
20
+ 164 貯蔵品
21
+ 180 その他流動資産
22
+ 181 前渡金
23
+ 182 Prepaid expenses
24
+ 183 立替金
25
+ 184 仮払金
26
+ 1D0 Deferred income tax
27
+ 40 Fixed Assets
28
+ 410 Tangible Assets
29
+ 411 Buildings
30
+ 412 Equipment
31
+ 413 Machinery
32
+ 414 Vehicles
33
+ 415 Tools
34
+ 416 Land
35
+ 417 Construction in progress
36
+ 418 Ships
37
+ 420 Intangible Assets
38
+ 421 Software
39
+ 422 Goodwill
40
+ 423 Patents
41
+ 424 借地権
42
+ 425 商標権
43
+ 426 電話加入権
44
+ 430 Investments
45
+ 431 Investment securities
46
+ 432 Associated companies
47
+ 433 長期貸付金
48
+ 434 破産更正債権
49
+ 435 長期前払費用
50
+ 436 敷金保証金
51
+ 437 Deferred income tax
52
+ 440 繰延資産
53
+ 441 開業費
54
+ 442 創立費
55
+ 442 新株発行費
56
+ 443 社債発行費
57
+ 50 Current Liabilities
58
+ 510 Notes payable
59
+ 511 Accounts payable - trade
60
+ 512 Short-term debt
61
+ 513 Commercial paper
62
+ 514 Accounts payable - other
63
+ 515 Income taxes payable
64
+ 516 未払消費税等
65
+ 517 Accrued expense
66
+ 518 Recipt in advance
67
+ 519 Receipt in trust
68
+ 51A 仮受金
69
+ 51B Deferred tax liabilities
70
+ 70 Long-term Liabilities
71
+ 711 Debt securities
72
+ 712 Loans payable
73
+ 713 退職給付引当金
74
+ 714 Deferred tax liabilities
75
+ 90 Net Assets
76
+ 910 Owners' Equity
77
+ 911 Capital stock
78
+ 912 Capital surplus
79
+ 913 Retained earnings
80
+ 914 Treasury stock
81
+ 920 評価換算差額等
82
+ 921 有価証券評価差額金
83
+ 922 為替換算調整勘定
84
+ 930 新株予約権
85
+ 940 Non-controlling interest
86
+ A0 Revenue
87
+ A11 Amount of Sales
88
+ B0 Cost of goods sold
89
+ B11 Purchases
90
+ B12 Parts
91
+ B13 Labor
92
+ BA Gross profit
93
+ C0 Operating expenses
94
+ C11 役員報酬
95
+ C12 Salaries
96
+ C13 Bonuses
97
+ C14 役員賞与
98
+ C15 退職金
99
+ C16 Legal welfare
100
+ C17 Travel
101
+ C18 Communication
102
+ C19 Repairs
103
+ C1A Advertising
104
+ C1B Entertainment
105
+ C1C Packing-and-freight
106
+ C1D Welfare
107
+ C1E Rents
108
+ C1F Utilities
109
+ C1G Supplies
110
+ C1H Insurance
111
+ C1I Taxes
112
+ C1J 賃借料
113
+ C1K Books
114
+ C1L 貸倒損失
115
+ C1M 諸会費
116
+ C1N 支払手数料
117
+ C1O 外注費
118
+ C1P Depriciation
119
+ C1Q Miscellaneous
120
+ C1R 貸倒引当金繰入
121
+ CA Operating profit/loss
122
+ D0 営業外収益
123
+ D11 Interest income
124
+ D12 受取配当金
125
+ D13 有価証券売却益
126
+ D14 有価証券利息
127
+ D15 為替差益
128
+ D16 Miscellaneous income
129
+ E0 営業外損失
130
+ E11 Interest expenses
131
+ E12 手形売却損
132
+ E13 有価証券売却損
133
+ E14 有価証券評価損
134
+ E15 為替差損
135
+ E16 Miscellaneous losses
136
+ EA 経常利益
137
+ F0 特別利益
138
+ F11 固定資産売却益
139
+ F12 償却債権取立益
140
+ G0 特別損失
141
+ G11 固定資産売却損
142
+ G12 固定資産除却損
143
+ G13 災害損失
144
+ GA Income before taxes
145
+ HA Net Income/Loss
@@ -0,0 +1,145 @@
1
+ code label consumption_tax income_tax
2
+ 10 流動資産
3
+ 110 現金預金
4
+ 111 現金
5
+ 112 小口現金
6
+ 113 普通預金
7
+ 114 当座預金
8
+ 115 定期預金
9
+ 116 通知預金
10
+ 117 納税準備預金
11
+ 118 別段預金
12
+ 120 受取手形
13
+ 130 売掛金
14
+ 140 短期貸付金
15
+ 150 未収入金
16
+ 160 棚卸資産
17
+ 161 商品
18
+ 162 製品
19
+ 163 仕掛品
20
+ 164 貯蔵品
21
+ 180 その他流動資産
22
+ 181 前渡金
23
+ 182 前払費用
24
+ 183 立替金
25
+ 184 仮払金
26
+ 1D0 繰延税金資産
27
+ 40 固定資産
28
+ 410 有形固定資産
29
+ 411 建物
30
+ 412 構築物
31
+ 413 機械装置
32
+ 414 車両運搬具
33
+ 415 工具器具備品
34
+ 416 土地
35
+ 417 建設仮勘定
36
+ 418 船舶
37
+ 420 無形固定資産
38
+ 421 ソフトウェア
39
+ 422 のれん
40
+ 423 特許権
41
+ 424 借地権
42
+ 425 商標権
43
+ 426 電話加入権
44
+ 430 投資その他の資産
45
+ 431 投資有価証券
46
+ 432 関係会社株式
47
+ 433 長期貸付金
48
+ 434 破産更正債権
49
+ 435 長期前払費用
50
+ 436 敷金保証金
51
+ 437 繰延税金資産
52
+ 440 繰延資産
53
+ 441 開業費
54
+ 442 創立費
55
+ 442 新株発行費
56
+ 443 社債発行費
57
+ 50 流動負債
58
+ 510 支払手形
59
+ 511 買掛金
60
+ 512 短期借入金
61
+ 513 コマーシャルペーパー
62
+ 514 未払金
63
+ 515 未払法人税等
64
+ 516 未払消費税等
65
+ 517 未払費用
66
+ 518 前受金
67
+ 519 預り金
68
+ 51A 仮受金
69
+ 51B 繰延税金負債
70
+ 70 固定負債
71
+ 711 社債
72
+ 712 長期借入金
73
+ 713 退職給付引当金
74
+ 714 繰延税金負債
75
+ 90 純資産
76
+ 910 株主資本
77
+ 911 資本金
78
+ 912 資本剰余金
79
+ 913 利益剰余金
80
+ 914 自己株式
81
+ 920 評価換算差額等
82
+ 921 有価証券評価差額金
83
+ 922 為替換算調整勘定
84
+ 930 新株予約権
85
+ 940 非支配株主持分
86
+ A0 売上
87
+ A11 売上高
88
+ B0 売上原価
89
+ B11 仕入
90
+ B12 材料費
91
+ B13 労務費
92
+ BA 粗利益
93
+ C0 販売費及び一般管理費
94
+ C11 役員報酬
95
+ C12 給料手当
96
+ C13 賞与
97
+ C14 役員賞与
98
+ C15 退職金
99
+ C16 法定福利費
100
+ C17 旅費交通費
101
+ C18 通信費
102
+ C19 修繕費
103
+ C1A 広告宣伝費
104
+ C1B 接待交際費
105
+ C1C 荷造運賃
106
+ C1D 福利厚生費
107
+ C1E 地代家賃
108
+ C1F 水道光熱費
109
+ C1G 消耗品費
110
+ C1H 保険料
111
+ C1I 租税公課
112
+ C1J 賃借料
113
+ C1K 新聞図書費
114
+ C1L 貸倒損失
115
+ C1M 諸会費
116
+ C1N 支払手数料
117
+ C1O 外注費
118
+ C1P 減価償却費
119
+ C1Q 雑費
120
+ C1R 貸倒引当金繰入
121
+ CA 営業利益
122
+ D0 営業外収益
123
+ D11 受取利息
124
+ D12 受取配当金
125
+ D13 有価証券売却益
126
+ D14 有価証券利息
127
+ D15 為替差益
128
+ D16 雑収入
129
+ E0 営業外損失
130
+ E11 支払利息
131
+ E12 手形売却損
132
+ E13 有価証券売却損
133
+ E14 有価証券評価損
134
+ E15 為替差損
135
+ E16 雑損失
136
+ EA 経常利益
137
+ F0 特別利益
138
+ F11 固定資産売却益
139
+ F12 償却債権取立益
140
+ G0 特別損失
141
+ G11 固定資産売却損
142
+ G12 固定資産除却損
143
+ G13 災害損失
144
+ GA 税引前純利益
145
+ HA 当期利益
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaBook
4
- VERSION = '0.2.7'
4
+ VERSION = '0.2.15'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucabook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-05 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lucarecord
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.17'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.17'
41
41
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 12.3.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 12.3.3
55
69
  description: 'Book keep
56
70
 
57
71
  '
@@ -69,11 +83,16 @@ files:
69
83
  - lib/luca_book/dict.rb
70
84
  - lib/luca_book/import.rb
71
85
  - lib/luca_book/journal.rb
86
+ - lib/luca_book/list.rb
72
87
  - lib/luca_book/report.rb
88
+ - lib/luca_book/setup.rb
73
89
  - lib/luca_book/state.rb
90
+ - lib/luca_book/templates/dict-en.tsv
91
+ - lib/luca_book/templates/dict-jp.tsv
74
92
  - lib/luca_book/version.rb
75
93
  homepage: https://github.com/chumaltd/luca/tree/master/lucabook
76
- licenses: []
94
+ licenses:
95
+ - GPL
77
96
  metadata:
78
97
  homepage_uri: https://github.com/chumaltd/luca/tree/master/lucabook
79
98
  source_code_uri: https://github.com/chumaltd/luca/tree/master/lucabook
@@ -85,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
104
  requirements:
86
105
  - - ">="
87
106
  - !ruby/object:Gem::Version
88
- version: '0'
107
+ version: 2.6.0
89
108
  required_rubygems_version: !ruby/object:Gem::Requirement
90
109
  requirements:
91
110
  - - ">="