Module: Luca::Jp::Uchiwake
- Included in:
- Aoiro
- Defined in:
- lib/luca/jp/uchiwake.rb
Overview
勘定科目内訳明細書のレンダリング
Instance Method Summary collapse
- #仮受金内訳 ⇒ Object
- #借入金内訳 ⇒ Object
- #借入金内訳フォーム ⇒ Object
- #借入金合計 ⇒ Object
- #地代家賃内訳 ⇒ Object
- #地代家賃内訳フォーム ⇒ Object
- #役員報酬内訳 ⇒ Object
- #有価証券内訳 ⇒ Object
- #有価証券内訳フォーム ⇒ Object
- #有価証券合計 ⇒ Object
- #買掛金内訳 ⇒ Object
- #買掛金内訳フォーム ⇒ Object
- #買掛金等合計 ⇒ Object
- #雑益雑損失内訳 ⇒ Object
-
#雑益雑損失内訳フォーム ⇒ Object
雑収入のうち、10万円以上または未収入金とのセット仕訳 雑収入の補助科目のうち、10万円以上 雑損失とその補助科目のうち、10万円以上の仕訳.
- #預貯金内訳 ⇒ Object
Instance Method Details
#仮受金内訳 ⇒ Object
119 120 121 122 123 |
# File 'lib/luca/jp/uchiwake.rb', line 119 def 仮受金内訳 @源泉給与 = readable(@bs_data.dig('5191') || 0) @源泉報酬 = readable(@bs_data.dig('5193') || 0) render_erb(search_template('kariuke-meisai.xml.erb')) end |
#借入金内訳 ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/luca/jp/uchiwake.rb', line 133 def 借入金内訳 account_codes = uchiwake_account_config('512').map { |account| account['code'].to_s } account_codes.concat uchiwake_account_config('712').map { |account| account['code'].to_s } return nil if account_codes.length == 0 @借入金 = @bs_data.each.with_object({}) do |(k, v), h| next unless account_codes.include?(k.to_s) next unless readable(v || 0) > 0 h[k] = { name: self.class.dict.dig(k)[:label], amount: readable(v) } = uchiwake_account_config(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
125 126 127 128 129 130 131 |
# File 'lib/luca/jp/uchiwake.rb', line 125 def 借入金内訳フォーム accounts = uchiwake_account_config('512') accounts.concat uchiwake_account_config('712') return nil if accounts.length == 0 'HOI110' end |
#借入金合計 ⇒ Object
157 158 159 160 161 |
# File 'lib/luca/jp/uchiwake.rb', line 157 def 借入金合計 @bs_data.filter { |k, _v| ['512', '712'].include?(k.to_s) } .map { |_k, v| readable(v) || 0 } .sum end |
#地代家賃内訳 ⇒ Object
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/luca/jp/uchiwake.rb', line 169 def 地代家賃内訳 account_codes = uchiwake_account_config('C1E').map { |account| account['code'].to_s } return nil if account_codes.length == 0 STDERR.puts "勘定科目内訳書(地代家賃)の支払対象期間の追記が必要" @地代家賃 = @bs_data.each.with_object({}) do |(k, v), h| next unless account_codes.include?(k) next unless readable(v || 0) > 0 h[k] = { name: self.class.dict.dig(k)[:label], amount: readable(v) } = uchiwake_account_config(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
163 164 165 166 167 |
# File 'lib/luca/jp/uchiwake.rb', line 163 def 地代家賃内訳フォーム return nil if uchiwake_account_config('C1E').length == 0 'HOI150' end |
#役員報酬内訳 ⇒ Object
195 196 197 198 199 200 |
# File 'lib/luca/jp/uchiwake.rb', line 195 def 役員報酬内訳 STDERR.puts "勘定科目内訳書(役員報酬)の個人別金額の追記が必要" @役員報酬 = 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 70 |
# File 'lib/luca/jp/uchiwake.rb', line 37 def 有価証券内訳 account_codes = uchiwake_account_config('331').map { |account| account['code'].to_s } account_codes.concat uchiwake_account_config('332').map { |account| account['code'].to_s } return nil if account_codes.length == 0 @有価証券 = @bs_data.each.with_object({}) do |(k, v), h| next unless account_codes.include?(k.to_s) 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 next if v.nil? || (v <= 0 && inc <= 0 && dec <= 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? = uchiwake_account_config(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 = uchiwake_account_config('331') accounts.concat uchiwake_account_config('332') return nil if accounts.length == 0 'HOI060' end |
#有価証券合計 ⇒ Object
72 73 74 75 76 |
# File 'lib/luca/jp/uchiwake.rb', line 72 def 有価証券合計 @bs_data.filter { |k, _v| ['331', '332'].include?(k.to_s) } .map { |_k, v| readable(v) || 0 } .sum end |
#買掛金内訳 ⇒ Object
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 |
# File 'lib/luca/jp/uchiwake.rb', line 87 def 買掛金内訳 account_codes = uchiwake_account_config('511').map { |account| account['code'].to_s } account_codes.concat uchiwake_account_config('514').map { |account| account['code'].to_s } account_codes.concat uchiwake_account_config('517').map { |account| account['code'].to_s } return nil if account_codes.length == 0 @買掛金 = @bs_data.each.with_object({}) do |(k, v), h| next unless account_codes.include?(k.to_s) next unless readable(v || 0) > 0 h[k] = { name: self.class.dict.dig(k)[:label], amount: readable(v) } = uchiwake_account_config(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
78 79 80 81 82 83 84 85 |
# File 'lib/luca/jp/uchiwake.rb', line 78 def 買掛金内訳フォーム accounts = uchiwake_account_config('511') accounts.concat uchiwake_account_config('514') accounts.concat uchiwake_account_config('517') return nil if accounts.length == 0 'HOI090' end |
#買掛金等合計 ⇒ Object
113 114 115 116 117 |
# File 'lib/luca/jp/uchiwake.rb', line 113 def 買掛金等合計 @bs_data.filter { |k, _v| ['511', '514', '517'].include?(k.to_s) } .map { |_k, v| readable(v) || 0 } .sum end |
#雑益雑損失内訳 ⇒ Object
250 251 252 253 254 255 |
# File 'lib/luca/jp/uchiwake.rb', line 250 def 雑益雑損失内訳 return nil if @雑益.empty? && @雑損失.empty? STDERR.puts "勘定科目内訳書(雑益雑損失)の内容確認" render_erb(search_template('zatsueki-meisai.xml.erb')) end |
#雑益雑損失内訳フォーム ⇒ Object
雑収入のうち、10万円以上または未収入金とのセット仕訳 雑収入の補助科目のうち、10万円以上 雑損失とその補助科目のうち、10万円以上の仕訳
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/luca/jp/uchiwake.rb', line 206 def 雑益雑損失内訳フォーム @雑益 = LucaBook::List.term(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'D16') .data .map { |journal| { note: journal[:note], amount: readable(journal[:credit].select { |entry| entry[:code] == 'D16' } .map { |entry| entry[:amount] }.compact.sum), tax_refund: journal[:credit].index { |entry| entry[:code] =~ /^150/ } } } .select { |obj| obj[:amount] >= 100_000 || obj[:tax_refund] } @pl_data.keys .select { |k| k =~ /^D16[0-9A-Z]+/ && @pl_data[k] >= 100_000 } .each do |k| @雑益.push({ note: self.class.dict.dig(k)[:label], amount: @pl_data[k] }) end @雑益 = @雑益.sort_by{ |obj| obj[:amount] } .reverse.take(10) @雑損失 = LucaBook::List.term(@start_date.year, @start_date.month, @end_date.year, @end_date.month, code: 'E16') .data .map { |journal| { note: journal[:note], amount: readable(journal[:debit].select { |entry| entry[:code] == 'E16' } .map { |entry| entry[:amount] }.compact.sum) } } .select { |obj| obj[:amount] >= 100_000 } @pl_data.keys .select { |k| k =~ /^E16[0-9A-Z]+/ && @pl_data[k] >= 100_000 } .each do |k| @雑損失.push({ note: self.class.dict.dig(k)[:label], amount: @pl_data[k] }) end @雑損失 = @雑損失.sort_by{ |obj| obj[:amount] } .reverse.take(10) return nil if @雑益.empty? && @雑損失.empty? 'HOI160' 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) } = uchiwake_account_config(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 |