Published Date : 2021年3月15日19:05

パート14: 給与所得者の所得税と住民税を計算するAndroidアプリ
Part 14: Android App Calculates Income and Resident Taxes for Salaried Workers


This blog has an English translation


ニコニコ動画にアップした動画のまとめ記事です。

This is a summary blog post about a video I uploaded to NicoNico.

細かい部分は動画を参考にしてください。

Please refer to the video for details.


目次

Table of Contents




① 動画の説明
① Video Description



警告:

今回説明する給与所得者の所得税及び住民税を計算するツールは、あくまで簡易的なお遊び用のツールです。

正確な数値、計算方法は各自で調べて下さい。

このツールは大雑把に大体の見積りを計算して楽しむ為のツールです。

決して従業員の年末調整や個人の確定申告等に使用しないでください。

さらに、税金の計算方法は変更される場合があり、控除についても同様です。

また、控除や税金の計算方法が間違っている可能性もありますので、

あまり信用せずに、各自で調べてから実験してみてください。

このツールを使って何かしらの損害が発生したとしても、私は一切の責任を負いません。

Warning:

​The tool I'm going to show you for calculating income and residence taxes for salaried workers is just a simple tool for playing.

​Please check the exact number and calculation method by yourself.

​This tool is used to calculate rough estimates and enjoy them.

​Do not use for year-end adjustment of employees or for individual tax return.

In addition, the method of calculating taxes and deductions may change.

Also, there is a possibility that the deduction and tax calculation methods are incorrect.

Don't trust it too much, and test it yourself.

​I will not be liable for any damage caused by using this tool.

前回の続きです。

Continued from last time.


Responsive image

税金計算用のアクティビティへ戻ります。

Return to the activity for tax calculation.

EditTextのIDが医療費控除額の場合です。

If EditText has medical expense deduction amount ID.

case R.id.medicalExpenseDeductionForm:
    break;

各種控除額の計算を行うメソッドを用意します。

prepare a method to calculate various deductions.

Map<String, String> medicalExpenseDeductionMap = taxCalc.vDmedicalExpenseDeduction(
    Integer.parseInt(vd));

各種控除額の計算を行うクラスファイルに戻り、医療費控除額の計算を行うメソッドを作成します。

Return to the class that calculates the various deductions and create a method to calculate the amount of medical expense deduction.

public Map<String, String> vDmedicalExpenseDeduction(int med) {
}

各種控除額の計算に使うメンバ変数とゲッターをそれぞれ作成します。

Create member variables and getters to calculate the amount of medical expense deduction, respectively.

private int medicalExpenseDeduction = 0;
public int getMedicalExpenseDeduction() { return medicalExpenseDeduction; }

詳しい計算方法は国税庁のサイトを参考にしてください。

Please refer to the website of the National Tax Agency for the detailed calculation method.

税金計算用のアクティビティへ戻り、EditTextとTextViewに計算結果の値をセットします。

Return to the activity for tax calculation and set the computed values to EditText and TextView.

editText.setText(String.format("%,d", Integer.parseInt(vd)));
medicalExpenseIncomeDeductionText.setText(medicalExpenseDeductionMap.get("医療費控除_所得税"));
medicalExpenseResidentDeductionText.setText(medicalExpenseDeductionMap.get("医療費控除_住民税"));

小規模企業共済等掛金控除の額の場合です。

Case of the amount of deduction for small enterprise mutual aid premiums.

ひとり親控除の額の場合です。

Case of the amount of single parent deduction.

ここまで作成したアプリの挙動を確かめてみましょう。

Let's take a look at the behavior of the apps we've created so far.

生命保険控除の額の場合。

Case of the amount of life insurance deduction.

地震保険料控除の額の場合。

Case of the amount of earthquake insurance deduction.

ここまで作成したアプリの挙動を確かめてみましょう。

Let's take a look at the behavior of the apps we've created so far.


Responsive image

パート15へ続く。

Continue to Part 15.



以上です。お疲れ様です。

That's all. Thank you for your hard work.