Module: Luca::Jp::Common
Class Method Summary collapse
- .レポート種別 ⇒ Object
- .一般区分の税額(所得 = nil) ⇒ Object
- .一般寄付金の損金算入限度額 ⇒ Object
- .中小企業の軽減税率対象を超える所得(所得 = nil) ⇒ Object
-
.中小企業の軽減税率対象所得(所得 = nil) ⇒ Object
—————————————————– :section: 法人税額の計算 —————————————————–.
- .中小企業の軽減税額(所得 = nil) ⇒ Object
- .中間還付税額(税額, 中間納付額) ⇒ Object
- .事業所数による分割課税標準(課税標準) ⇒ Object
-
.事業税の分割課税標準(課税標準) ⇒ Object
—————————————————– :section: 複数自治体間の分割計算 —————————————————–.
-
.別表四所得調整(ext_config = nil) ⇒ Object
消費税を租税公課に計上している場合、控除済みの金額 事業税は仮払経理の場合にも納付時損金/還付時益金.
- .地方法人税額(地方法人税課税標準) ⇒ Object
- .地方消費税中間納付額 ⇒ Object
- .地方税資本金等の額 ⇒ Object
-
.均等割 ⇒ Object
—————————————————– :section: 地方税額の計算 —————————————————–.
- .寄付金の損金不算入額 ⇒ Object
- .当期控除計 ⇒ Object
- .当期繰越損失 ⇒ Object
- .従業員数による分割課税標準(課税標準) ⇒ Object
- .所得400万以下(所得 = nil) ⇒ Object
- .所得800万以下(所得 = nil) ⇒ Object
- .所得800万超(所得 = nil) ⇒ Object
-
.所得割400万以下(所得 = nil) ⇒ Object
100円未満切り捨て.
-
.所得割800万以下(所得 = 0) ⇒ Object
100円未満切り捨て.
-
.所得割800万超(所得 = 0) ⇒ Object
100円未満切り捨て.
- .所得割税率400万以下(所得 = nil) ⇒ Object
- .所得割税率800万以下(所得 = nil) ⇒ Object
- .所得割税率800万超(所得 = nil) ⇒ Object
-
.所得金額 ⇒ Object
繰越損失適用後の所得金額.
- .期末資本金 ⇒ Object
-
.期首繰越損失 ⇒ Object
—————————————————– :section: 繰越損失の計算 —————————————————–.
- .未納事業税期中増減 ⇒ Object
-
.法人税割(法人税 = nil) ⇒ Object
100円未満切り捨て.
- .法人税割税率(法人税 = nil) ⇒ Object
-
.消費税中間納付額 ⇒ Object
—————————————————– :section: 消費税の計算 —————————————————–.
- .消費税課税売上高(税率 = 10) ⇒ Object
-
.特別法人事業税(事業税) ⇒ Object
100円未満切り捨て.
-
.税額計算 ⇒ Object
法人税、地方税の当期確定税額の計算.
- .納付税額(税額, 中間納付額) ⇒ Object
- .翌期繰越損失 ⇒ Object
-
.資本金等の額 ⇒ Object
—————————————————– :section: 外形標準の計算 —————————————————–.
- .軽減税率不適用法人 ⇒ Object
Class Method Details
.レポート種別 ⇒ Object
405 406 407 |
# File 'lib/luca/jp/common.rb', line 405 def レポート種別 @report_category == 'city' ? ['city', '23ku'] : ['prefecture', '23ku'] end |
.一般区分の税額(所得 = nil) ⇒ Object
60 61 62 |
# File 'lib/luca/jp/common.rb', line 60 def 一般区分の税額(所得 = nil) (中小企業の軽減税率対象を超える所得(所得) * 23.2 / 100).to_i end |
.一般寄付金の損金算入限度額 ⇒ Object
130 131 132 133 134 135 136 137 138 |
# File 'lib/luca/jp/common.rb', line 130 def 一般寄付金の損金算入限度額 寄付金算定所得 = @税引前損益 + @損金不算入額税額未確定 - @益金不算入額税額未確定 + LucaSupport::Code.readable(@pl_data.dig('C1X')||0) 期末資本準備金 = LucaSupport::Code.readable(@bs_data.dig('9131')||0) ([ ([寄付金算定所得, 0].max * 2.5 / 100).floor, ([期末資本金, 期末資本準備金].compact.sum * 2.5 / 1000).floor ].compact.sum / 4).floor end |
.中小企業の軽減税率対象を超える所得(所得 = nil) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/luca/jp/common.rb', line 49 def 中小企業の軽減税率対象を超える所得(所得 = nil) 所得 ||= 所得金額 return 0 if 所得 <= 0 if 所得 <= 8_000_000 0 else ((所得 - 8_000_000) / 1000).floor * 1000 end end |
.中小企業の軽減税率対象所得(所得 = nil) ⇒ Object
:section: 法人税額の計算
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/luca/jp/common.rb', line 32 def 中小企業の軽減税率対象所得(所得 = nil) 所得 ||= 所得金額 return 0 if 所得 <= 0 if 所得 >= 8_000_000 8_000_000 elsif 所得 < 0 0 else (所得 / 1000).floor * 1000 end end |
.中小企業の軽減税額(所得 = nil) ⇒ Object
45 46 47 |
# File 'lib/luca/jp/common.rb', line 45 def 中小企業の軽減税額(所得 = nil) 中小企業の軽減税率対象所得(所得) * 15 / 100 end |
.中間還付税額(税額, 中間納付額) ⇒ Object
325 326 327 328 329 330 331 |
# File 'lib/luca/jp/common.rb', line 325 def 中間還付税額(税額, 中間納付額) if 税額 < 中間納付額 中間納付額 - 税額 else 0 end end |
.事業所数による分割課税標準(課税標準) ⇒ Object
397 398 399 400 401 402 403 |
# File 'lib/luca/jp/common.rb', line 397 def 事業所数による分割課税標準(課税標準) 分割基準の総数 = Luca::Jp::Util.eltax_config('reports') .filter { |r| レポート種別.include?(r['type']) } .map { |r| (r['office_count'] || 1).to_i }.sum ((課税標準.to_f / 分割基準の総数).floor(分割基準の総数.to_s.length) * @office_count / 1000) .floor * 1000 end |
.事業税の分割課税標準(課税標準) ⇒ Object
:section: 複数自治体間の分割計算
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/luca/jp/common.rb', line 373 def 事業税の分割課税標準(課税標準) return 課税標準 if ! Luca::Jp::Util.eltax_config('reports') case Luca::Jp::Util.eltax_config('reports') .filter { |r| レポート種別.include?(r['type']) }.length when 0, 1 課税標準 else half = (課税標準 / 2 / 1000).floor * 1000 [ 事業所数による分割課税標準(half), 従業員数による分割課税標準(half) ].sum end end |
.別表四所得調整(ext_config = nil) ⇒ Object
消費税を租税公課に計上している場合、控除済みの金額 事業税は仮払経理の場合にも納付時損金/還付時益金
78 79 80 81 82 83 84 85 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 111 112 113 114 115 116 117 118 |
# File 'lib/luca/jp/common.rb', line 78 def 別表四所得調整(ext_config = nil) @税引前損益 = readable(@pl_data.dig('GA')) if ext_config @減価償却の償却超過額 = ext_config.dig('損金不算入', '減価償却') @役員給与の損金不算入額 = ext_config.dig('損金不算入', '役員給与') @交際費等の損金不算入額 = ext_config.dig('損金不算入', '交際費') # 損金不算入額は損金経理したもの、税額控除額は仮払経理したもの @所得税等の損金不算入額 = ext_config.dig('損金不算入', '所得税') @減価償却超過額の当期認容額 = ext_config.dig('益金不算入', '減価償却') @受取配当金の益金不算入額 = ext_config.dig('益金不算入', '受取配当金') @受贈益の益金不算入額 = ext_config.dig('益金不算入', '受贈益') end @当期還付事業税 = refund_tax('1504') @損金不算入額税額未確定 = [ @減価償却の償却超過額, @役員給与の損金不算入額, @交際費等の損金不算入額, @所得税等の損金不算入額, @当期還付事業税 ].compact.sum _, @納付事業税 = 未納事業税期中増減 @事業税中間納付 = ['1854', '1855', '1856', '1857', '1858'] .map{ |k| prepaid_tax(k) }.compact.sum @益金不算入額税額未確定 = [ @納付事業税, @事業税中間納付, @減価償却超過額の当期認容額, @受取配当金の益金不算入額, @受贈益の益金不算入額, ].compact.sum @別表四調整所得 = @税引前損益 + @損金不算入額税額未確定 - @益金不算入額税額未確定 + 寄付金の損金不算入額 # 税引前損益に含まれない税額控除対象所得税の認識 @所得税等の損金不算入額 = [ @所得税等の損金不算入額, prepaid_tax('H115') ].compact.sum end |
.地方法人税額(地方法人税課税標準) ⇒ Object
64 65 66 |
# File 'lib/luca/jp/common.rb', line 64 def 地方法人税額(地方法人税課税標準) (地方法人税課税標準 * 10.3 / 100).to_i end |
.地方消費税中間納付額 ⇒ Object
347 348 349 |
# File 'lib/luca/jp/common.rb', line 347 def 地方消費税中間納付額 prepaid_tax('185C') end |
.地方税資本金等の額 ⇒ Object
358 359 360 |
# File 'lib/luca/jp/common.rb', line 358 def 地方税資本金等の額 [資本金等の額, readable(['911', '9131'].map { |cd| @bs_data.dig(cd) }.compact.sum)].max end |
.均等割 ⇒ Object
:section: 地方税額の計算
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/luca/jp/common.rb', line 168 def 均等割 if @employee.nil? STDERR.puts "地方税の提出先設定に従業員人数がないため、1名とみなして計算" @employee ||= 1 end tax = if 地方税資本金等の額 <= 10_000_000 city = @employee > 50 ? 120_000 : 50_000 [20_000, city] elsif 地方税資本金等の額 <= 100_000_000 city = @employee > 50 ? 150_000 : 130_000 [50_000, city] elsif 地方税資本金等の額 <= 1_000_000_000 city = @employee > 50 ? 400_000 : 160_000 [130_000, city] elsif 地方税資本金等の額 <= 5_000_000_000 city = @employee > 50 ? 1_750_000 : 410_000 [540_000, city] else city = @employee > 50 ? 3_000_000 : 410_000 [800_000, city] end tokyo23? ? [tax.sum, 0] : tax end |
.寄付金の損金不算入額 ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'lib/luca/jp/common.rb', line 120 def 寄付金の損金不算入額 寄付金 = LucaSupport::Code.readable(@pl_data.dig('C1X')||0) 指定寄付金 = LucaSupport::Code.readable(@pl_data.dig('C1X1')||0) [ 寄付金 - 指定寄付金 - 一般寄付金の損金算入限度額, 0 ].max end |
.当期控除計 ⇒ Object
148 149 150 |
# File 'lib/luca/jp/common.rb', line 148 def 当期控除計 @繰越損失管理.deduction end |
.当期繰越損失 ⇒ Object
158 159 160 161 |
# File 'lib/luca/jp/common.rb', line 158 def 当期繰越損失 @繰越損失管理.records .filter { |record| record['start_date'] == @start_date }.dig(0, 'increase') || 0 end |
.従業員数による分割課税標準(課税標準) ⇒ Object
389 390 391 392 393 394 395 |
# File 'lib/luca/jp/common.rb', line 389 def 従業員数による分割課税標準(課税標準) 分割基準の総数 = Luca::Jp::Util.eltax_config('reports') .filter { |r| レポート種別.include?(r['type']) } .map { |r| (r['employee'] || 1).to_i }.sum ((課税標準.to_f / 分割基準の総数).floor(分割基準の総数.to_s.length) * @employee / 1000) .floor * 1000 end |
.所得400万以下(所得 = nil) ⇒ Object
227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/luca/jp/common.rb', line 227 def 所得400万以下(所得 = nil) 所得 ||= 所得金額 return 0 if 所得 < 0 total = if 所得 >= 4_000_000 4_000_000 else (所得 / 1000).floor * 1000 end 事業税の分割課税標準(total) end |
.所得800万以下(所得 = nil) ⇒ Object
255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/luca/jp/common.rb', line 255 def 所得800万以下(所得 = nil) 所得 ||= 所得金額 return 0 if 所得 < 0 total = if 所得 <= 4_000_000 0 elsif 所得 >= 8_000_000 4_000_000 else ((所得 - 4_000_000) / 1000).floor * 1000 end 事業税の分割課税標準(total) end |
.所得800万超(所得 = nil) ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/luca/jp/common.rb', line 285 def 所得800万超(所得 = nil) 所得 ||= 所得金額 return 0 if 所得 < 0 total = if 所得 <= 8_000_000 0 else ((所得 - 8_000_000) / 1000).floor * 1000 end 事業税の分割課税標準(total) end |
.所得割400万以下(所得 = nil) ⇒ Object
100円未満切り捨て
223 224 225 |
# File 'lib/luca/jp/common.rb', line 223 def 所得割400万以下(所得 = nil) ((所得400万以下(所得) * 所得割税率400万以下(所得) / 100) / 100).floor * 100 end |
.所得割800万以下(所得 = 0) ⇒ Object
100円未満切り捨て
251 252 253 |
# File 'lib/luca/jp/common.rb', line 251 def 所得割800万以下(所得 = 0) ((所得800万以下(所得) * 所得割税率800万以下(所得) / 100) / 100).floor * 100 end |
.所得割800万超(所得 = 0) ⇒ Object
100円未満切り捨て
281 282 283 |
# File 'lib/luca/jp/common.rb', line 281 def 所得割800万超(所得 = 0) ((所得800万超(所得) * 所得割税率800万超(所得) / 100) / 100).floor * 100 end |
.所得割税率400万以下(所得 = nil) ⇒ Object
239 240 241 242 243 244 245 246 247 248 |
# File 'lib/luca/jp/common.rb', line 239 def 所得割税率400万以下(所得 = nil) return @shotyoku399.to_f if @shotoku399 所得 ||= 所得金額 if 期末資本金 > 100_000_000 || 所得 > 25_000_000 軽減税率不適用法人 ? 7.48 : 3.75 else 軽減税率不適用法人 ? 7.0 : 3.5 end end |
.所得割税率800万以下(所得 = nil) ⇒ Object
269 270 271 272 273 274 275 276 277 278 |
# File 'lib/luca/jp/common.rb', line 269 def 所得割税率800万以下(所得 = nil) return @shotyoku401.to_f if @shotoku401 所得 ||= 所得金額 if 期末資本金 > 100_000_000 || 所得 > 25_000_000 軽減税率不適用法人 ? 7.48 : 5.665 else 軽減税率不適用法人 ? 7.0 : 5.3 end end |
.所得割税率800万超(所得 = nil) ⇒ Object
297 298 299 300 301 302 303 304 305 306 |
# File 'lib/luca/jp/common.rb', line 297 def 所得割税率800万超(所得 = nil) return @shotyoku801.to_f if @shotoku801 所得 ||= 所得金額 if 期末資本金 > 100_000_000 || 所得 > 25_000_000 7.48 else 7.0 end end |
.所得金額 ⇒ Object
繰越損失適用後の所得金額
70 71 72 73 |
# File 'lib/luca/jp/common.rb', line 70 def 所得金額 @繰越損失管理 = Sonshitsu.load(@end_date).update(@別表四調整所得).save if @繰越損失管理.nil? @繰越損失管理.profit end |
.期末資本金 ⇒ Object
366 367 368 |
# File 'lib/luca/jp/common.rb', line 366 def 期末資本金 readable(@bs_data.dig('911')) end |
.期首繰越損失 ⇒ Object
:section: 繰越損失の計算
144 145 146 |
# File 'lib/luca/jp/common.rb', line 144 def 期首繰越損失 翌期繰越損失 + @繰越損失管理.deduction end |
.未納事業税期中増減 ⇒ Object
333 334 335 336 |
# File 'lib/luca/jp/common.rb', line 333 def 未納事業税期中増減 r = gross_amount('5152', @start_date.year, @start_date.month, @end_date.year, @end_date.month) [LucaSupport::Code.readable(r[1]), LucaSupport::Code.readable(r[0])] end |
.法人税割(法人税 = nil) ⇒ Object
100円未満切り捨て
193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/luca/jp/common.rb', line 193 def 法人税割(法人税 = nil) 課税標準 = if 法人税 (法人税 / 1000).floor * 1000 else 法人税割課税標準 end 県税率, 市税率 = 法人税割税率(課税標準) [ (課税標準 * 県税率 / 100 / 100).floor * 100, (課税標準 * 市税率 / 100 / 100).floor * 100 ] end |
.法人税割税率(法人税 = nil) ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/luca/jp/common.rb', line 206 def 法人税割税率(法人税 = nil) return [@houjinzeiwari_rate.to_f, @houjinzeiwari_rate.to_f] if @houjinzeiwari_rate 課税標準 = if 法人税 (法人税 / 1000).floor * 1000 else 法人税割課税標準 end rate = if 期末資本金 > 100_000_000 || 課税標準 > 10_000_000 [2.0, 8.4] else [1.0, 6.0] end tokyo23? ? [rate.sum, 0] : rate end |
.消費税中間納付額 ⇒ Object
:section: 消費税の計算
343 344 345 |
# File 'lib/luca/jp/common.rb', line 343 def 消費税中間納付額 prepaid_tax('185B') end |
.消費税課税売上高(税率 = 10) ⇒ Object
313 314 315 |
# File 'lib/luca/jp/common.rb', line 313 def 消費税課税売上高(税率 = 10) LucaSupport::Code.readable(@pl_data.dig('A0') * 100 / (100 + 税率).floor || 0) end |
.特別法人事業税(事業税) ⇒ Object
100円未満切り捨て
309 310 311 |
# File 'lib/luca/jp/common.rb', line 309 def 特別法人事業税(事業税) ((事業税 * 37 / 100) / 100).floor * 100 end |
.税額計算 ⇒ Object
法人税、地方税の当期確定税額の計算
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/luca/jp/common.rb', line 12 def 税額計算 所得 = 所得金額 法人税額 = 中小企業の軽減税額(所得) + 一般区分の税額(所得) 地方法人税課税標準 = (法人税額 / 1000).floor * 1000 地方法人税 = 地方法人税額(地方法人税課税標準) { houjin: {}, kenmin: {}, shimin: {} }.tap do |tax| tax[:houjin][:kokuzei] = (法人税額 / 100).floor * 100 tax[:houjin][:chihou] = (地方法人税 / 100).floor * 100 tax[:kenmin][:houjinzei], tax[:shimin][:houjinzei] = 法人税割(法人税額) tax[:kenmin][:kintou], tax[:shimin][:kintou] = 均等割 if @report_category tax[:kenmin][:shotoku] = 所得割400万以下(所得) + 所得割800万以下(所得) + 所得割800万超(所得) tax[:kenmin][:tokubetsu] = 特別法人事業税(tax[:kenmin][:shotoku]) end end |
.納付税額(税額, 中間納付額) ⇒ Object
317 318 319 320 321 322 323 |
# File 'lib/luca/jp/common.rb', line 317 def 納付税額(税額, 中間納付額) if 税額 > 中間納付額 税額 - 中間納付額 else 0 end end |
.翌期繰越損失 ⇒ Object
152 153 154 155 156 |
# File 'lib/luca/jp/common.rb', line 152 def 翌期繰越損失 @繰越損失管理.records .filter { |record| record['start_date'] > @end_date.prev_year(10) && record['end_date'] < @start_date } .inject(0) { |sum, record| [sum, record['amount']].compact.sum } end |
.資本金等の額 ⇒ Object
:section: 外形標準の計算
354 355 356 |
# File 'lib/luca/jp/common.rb', line 354 def 資本金等の額 readable(['911', '913', '916'].map { |cd| @bs_data.dig(cd) }.compact.sum) end |
.軽減税率不適用法人 ⇒ Object
362 363 364 |
# File 'lib/luca/jp/common.rb', line 362 def 軽減税率不適用法人 期末資本金 > 10_000_000 && eltax_config('no_keigen') end |