Class: Luca::Jp::Syouhizei

Inherits:
LucaBook::State
  • Object
show all
Includes:
Common, ItPart, Util, LucaSupport::View
Defined in:
lib/luca/jp/syouhizei.rb

Instance Method Summary collapse

Methods included from Util

beppyo2_config, config, eltax_config, etax_date, form_rdf, gaikyo_config, gengou, it_part_config, prepaid_tax, refund_tax, render_attr, tokyo23?, uchiwake_account_config, wareki, 中間還付税額, 期首期末残高, 納付税額, 純資産期中増減

Methods included from ItPart

#it_part, #jigyo_nendo_from, #jigyo_nendo_to, #kazei_kikan_from, #kazei_kikan_to, #parse_houjinbango, #parse_kinyukikan, #parse_tel, #parse_zeimusho, #parse_zip, #render_it_tag, #teisyutsu_day

Methods included from Common

レポート種別, 一般区分の税額, 一般寄付金の損金算入限度額, 中小企業の軽減税率対象を超える所得, 中小企業の軽減税率対象所得, 中小企業の軽減税額, 中間還付税額, 事業所数による分割課税標準, 事業税の分割課税標準, 別表四所得調整, 地方法人税額, 地方消費税中間納付額, 地方税資本金等の額, 均等割, 寄付金の損金不算入額, 当期控除計, 当期繰越損失, 従業員数による分割課税標準, 所得400万以下, 所得800万以下, 所得800万超, 所得割400万以下, 所得割800万以下, 所得割800万超, 所得割税率400万以下, 所得割税率800万以下, 所得割税率800万超, 所得金額, 期末資本金, 期首繰越損失, 未納事業税期中増減, 法人税割, 法人税割税率, 消費税中間納付額, 消費税課税売上高, 特別法人事業税, 税額計算, 納付税額, 翌期繰越損失, 資本金等の額, 軽減税率不適用法人

Instance Method Details

#export_jsonObject



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
119
# File 'lib/luca/jp/syouhizei.rb', line 90

def export_json
  dat = kani(export: true)
  [].tap do |res|
    item = {}
    item['date'] = @end_date
    item['debit'] = []
    item['credit'] = []
    if dat[:kokuzei][:chukan] > 0
      item['credit'] << { 'label' => '仮払消費税', 'amount' => dat[:kokuzei][:chukan] }
    end
    if dat[:kokuzei][:chukan] > dat[:kokuzei][:zeigaku]
      item['debit'] << { 'label' => '未収消費税等', 'amount' => dat[:kokuzei][:chukan] - dat[:kokuzei][:zeigaku] }
    else
      item['credit'] << { 'label' => '未払消費税等', 'amount' => dat[:kokuzei][:zeigaku] - dat[:kokuzei][:chukan] }
    end
    item['debit'] << { 'label' => '消費税', 'amount' => dat[:kokuzei][:zeigaku] }
    if dat[:chihou][:chukan] > 0
      item['credit'] << { 'label' => '仮払地方消費税', 'amount' => dat[:chihou][:chukan] }
    end
    if dat[:chihou][:chukan] > dat[:chihou][:zeigaku]
      item['debit'] << { 'label' => '未収消費税等', 'amount' => dat[:chihou][:chukan] - dat[:chihou][:zeigaku] }
    else
      item['credit'] << { 'label' => '未払消費税等', 'amount' => dat[:chihou][:zeigaku] - dat[:chihou][:chukan] }
    end
    item['debit'] << { 'label' => '消費税', 'amount' => dat[:chihou][:zeigaku] }
    item['x-editor'] = 'LucaJp'
    res << item
    puts JSON.dump(res)
  end
end

#kani(export: false) ⇒ Object

TODO: 軽減税率売上の識別



23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
70
71
72
# File 'lib/luca/jp/syouhizei.rb', line 23

def kani(export: false)
  @2割特例 = config.dig('jp', 'syouhizei_kubun') == 2023
  set_pl(4)
  set_bs(4)
  @issue_date = Date.today
  @company = CGI.escapeHTML(config.dig('company', 'name'))
  @software = 'LucaJp'
  @shinkoku_kbn = '1' # 確定申告
  税率 = BigDecimal('7.8') # percent
  地方税率 = BigDecimal('2.2')

  @sales = @pl_data.dig('A0') * 100 / (100 + 税率 + 地方税率).floor
  @tax_amount = (課税標準額(@sales) * 税率 / 100).floor
  @基準期間の課税売上高 = LucaSupport::Code.readable(基準期間の課税売上高(税率 + 地方税率))
  @みなし仕入税額 = (@tax_amount * みなし仕入率(config.dig('jp', 'syouhizei_kubun')) / 100).floor
  @税額 = LucaSupport::Code.readable(((@tax_amount - @みなし仕入税額) / 100).floor * 100)
  @譲渡割額 = (@税額 * 地方税率 / (税率*100)).floor * 100
  @中間納付額 = 消費税中間納付額
  @地方税中間納付額 = 地方消費税中間納付額

  if export
    {
      kokuzei: {
        zeigaku: @税額,
        chukan: @中間納付額
      },
      chihou: {
        zeigaku: @譲渡割額,
        chukan: @地方税中間納付額
      }
    }
  else
    @procedure_code = 'RSH0040'
    @procedure_name = '消費税及び地方消費税申告(簡易課税・法人)'
    @form_vers = proc_version
    @version = @form_vers['proc']
    @it = it_part
    @form_sec = if @2割特例
                  ['SHA020', 'SHB070'].map{ |c| form_rdf(c) }.join('')
                else
                  ['SHA020', 'SHB047', 'SHB067'].map{ |c| form_rdf(c) }.join('')
                end
    @form_data = if @2割特例
                   [申告書簡易課税, 付表六].join("\n")
                 else
                   [申告書簡易課税, 付表四の三, 付表五の三].join("\n")
                 end
    render_erb(search_template('consumption.xtx.erb'))
  end
end

#付表五の三Object



82
83
84
# File 'lib/luca/jp/syouhizei.rb', line 82

def 付表五の三
  render_erb(search_template('fuhyo53.xml.erb'))
end

#付表六Object



86
87
88
# File 'lib/luca/jp/syouhizei.rb', line 86

def 付表六
  render_erb(search_template('fuhyo6.xml.erb'))
end

#付表四の三Object



78
79
80
# File 'lib/luca/jp/syouhizei.rb', line 78

def 付表四の三
  render_erb(search_template('fuhyo43.xml.erb'))
end

#申告書簡易課税Object



74
75
76
# File 'lib/luca/jp/syouhizei.rb', line 74

def 申告書簡易課税
  render_erb(search_template('syouhizei-shinkoku-kanni.xml.erb'))
end