Module: Luca::Jp::Uchiwake

Included in:
Aoiro
Defined in:
lib/luca/jp/uchiwake.rb

Overview

勘定科目内訳明細書のレンダリング

Instance Method Summary collapse

Instance Method Details

#仮受金内訳Object



118
119
120
121
122
# File 'lib/luca/jp/uchiwake.rb', line 118

def 仮受金内訳
  @源泉給与 = readable(@bs_data.dig('5191') || 0)
  @源泉報酬 = readable(@bs_data.dig('5193') || 0)
  render_erb(search_template('kariuke-meisai.xml.erb'))
end

#借入金内訳Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/luca/jp/uchiwake.rb', line 132

def 借入金内訳
   = ('512').map { || ['code'].to_s }
  .concat ('712').map { || ['code'].to_s }
  return nil if .length == 0

  @借入金 = @bs_data.each.with_object({}) do |(k, v), h|
    next unless .include?(k.to_s)
    next unless readable(v || 0) > 0

    h[k] = {
      name: self.class.dict.dig(k)[:label],
      amount: readable(v)
    }
     = (k).first
    if  && ['name']
      h[k][:name] = ['name']
      h[k][:address] = ['address']
      h[k][:note] = ['note']
    end
  end

  render_erb(search_template('kariire-meisai.xml.erb'))
end

#借入金内訳フォームObject



124
125
126
127
128
129
130
# File 'lib/luca/jp/uchiwake.rb', line 124

def 借入金内訳フォーム
  accounts = ('512')
  accounts.concat ('712')
  return nil if accounts.length == 0

  'HOI110'
end

#借入金合計Object



156
157
158
159
160
# File 'lib/luca/jp/uchiwake.rb', line 156

def 借入金合計
  @bs_data.filter { |k, _v| ['512', '712'].include?(k.to_s) }
    .map { |_k, v| readable(v) || 0 }
    .sum
end

#地代家賃内訳Object



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/luca/jp/uchiwake.rb', line 168

def 地代家賃内訳
   = ('C1E').map { || ['code'].to_s }
  return nil if .length == 0

  @地代家賃 = @bs_data.each.with_object({}) do |(k, v), h|
    next unless .include?(k)
    next unless readable(v || 0) > 0

    h[k] = {
      name: self.class.dict.dig(k)[:label],
      amount: readable(v)
    }
     = (k).first
    if  && ['name']
      h[k][:name] = ['name']
      h[k][:address] = ['address']
      h[k][:rent_type] = ['rent_type'] || '家賃'
      h[k][:rent_purpose] = ['rent_purpose']
      h[k][:rent_address] = ['rent_address']
      h[k][:note] = ['note']
    end
  end
  render_erb(search_template('chidai-meisai.xml.erb'))
end

#地代家賃内訳フォームObject



162
163
164
165
166
# File 'lib/luca/jp/uchiwake.rb', line 162

def 地代家賃内訳フォーム
  return nil if ('C1E').length == 0

  'HOI150'
end

#役員報酬内訳Object



193
194
195
196
197
# File 'lib/luca/jp/uchiwake.rb', line 193

def 役員報酬内訳
  @役員報酬 = readable(@pl_data.dig('C11') || 0)
  @給料 = readable(@pl_data.dig('C12') || 0)
  render_erb(search_template('yakuin-meisai.xml.erb'))
end

#有価証券内訳Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/luca/jp/uchiwake.rb', line 37

def 有価証券内訳
   = ('331').map { || ['code'].to_s }
  .concat ('332').map { || ['code'].to_s }
  return nil if .length == 0

  @有価証券 = @bs_data.each.with_object({}) do |(k, v), h|
    next unless .include?(k.to_s)
    next if v.nil? || v <= 0

    inc = debit_amount(k, @start_date.year, @start_date.month, @end_date.year, @end_date.month) || 0
    dec = credit_amount(k, @start_date.year, @start_date.month, @end_date.year, @end_date.month) || 0
    h[k] = {
      name: self.class.dict.dig(k)[:label],
      amount: readable(v),
      diff: readable(inc - dec)
    }
    STDERR.puts "勘定科目内訳書(有価証券)異動の追記が必要: #{h[k][:name]}" unless (inc - dec).zero?

     = (k).first
    if  && ['name']
      h[k][:name] = ['name'][0..9] if ['name']
      h[k][:security_purpose] = ['security_purpose']
      h[k][:security_genre] = ['security_genre']
      h[k][:security_units] = (h[k][:amount].nil? || h[k][:amount].zero?) ? 0 : ['security_units']
      h[k][:note] = ['note']
    end
    h[k][:security_purpose] ||= 'その他' if /^332/.match(k.to_s)
    h[k][:security_genre] ||= '株式' if /^33[12]/.match(k.to_s)
    h[k][:note] ||= '関係会社株式' if /^332/.match(k.to_s)
  end

  render_erb(search_template('shoken-meisai.xml.erb'))
end

#有価証券内訳フォームObject



29
30
31
32
33
34
35
# File 'lib/luca/jp/uchiwake.rb', line 29

def 有価証券内訳フォーム
  accounts = ('331')
  accounts.concat ('332')
  return nil if accounts.length == 0

  'HOI060'
end

#有価証券合計Object



71
72
73
74
75
# File 'lib/luca/jp/uchiwake.rb', line 71

def 有価証券合計
  @bs_data.filter { |k, _v| ['331', '332'].include?(k.to_s) }
    .map { |_k, v| readable(v) || 0 }
    .sum
end

#買掛金内訳Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/luca/jp/uchiwake.rb', line 86

def 買掛金内訳
   = ('511').map { || ['code'].to_s }
  .concat ('514').map { || ['code'].to_s }
  .concat ('517').map { || ['code'].to_s }
  return nil if .length == 0

  @買掛金 = @bs_data.each.with_object({}) do |(k, v), h|
    next unless .include?(k.to_s)
    next unless readable(v || 0) > 0

    h[k] = {
      name: self.class.dict.dig(k)[:label],
      amount: readable(v)
    }
     = (k).first
    if  && ['name']
      h[k][:name] = ['name']
      h[k][:payable_type] = self.class.dict.dig(k[0..2], :label)
      h[k][:address] = ['address']
      h[k][:note] = ['note']
    end
  end

  render_erb(search_template('kaikake-meisai.xml.erb'))
end

#買掛金内訳フォームObject



77
78
79
80
81
82
83
84
# File 'lib/luca/jp/uchiwake.rb', line 77

def 買掛金内訳フォーム
  accounts = ('511')
  accounts.concat ('514')
  accounts.concat ('517')
  return nil if accounts.length == 0

  'HOI090'
end

#買掛金等合計Object



112
113
114
115
116
# File 'lib/luca/jp/uchiwake.rb', line 112

def 買掛金等合計
  @bs_data.filter { |k, _v| ['511', '514', '517'].include?(k.to_s) }
    .map { |_k, v| readable(v) || 0 }
    .sum
end

#預貯金内訳Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/luca/jp/uchiwake.rb', line 8

def 預貯金内訳
  @預金 = @bs_data.each.with_object({}) do |(k, v), h|
    next unless /^110[0-9A-Z]/.match(k)
    next unless readable(v || 0) > 0

    h[k] = {
      name: self.class.dict.dig(k)[:label],
      amount: readable(v)
    }
     = (k).first
    if  && ['name']
      h[k][:name] = ['name']
      h[k][:branch] = ['branch']
      h[k][:account_type] = ['account_type'] || '普通預金'
      h[k][:account_no] = ['account_no']
      h[k][:note] = ['note']
    end
  end
  render_erb(search_template('yokin-meisai.xml.erb'))
end