Published Date : 2021年3月31日18:58

パート16: 給与所得者の所得税と住民税を計算するAndroidアプリ
Part 16: 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.

配偶者控除の額の場合。

Case of the amount of deduction for spouse.

case R.id.dForDependentsForm:
    Map<String, String> dFordependentsMap = taxCalc.vDdFordependents(Integer.parseInt(vd));
    editText.setText(String.format("%,d", Integer.parseInt(vd)));
    incomeDForDependentsText.setText(dFordependentsMap.get("扶養控除_所得税"));
    residentDForDependentsText.setText(dFordependentsMap.get("扶養控除_住民税"));
    break;
public Map<String, String> vDdFordependents(int dfd) {
    dFordependents_incomeTax = dfd;

    if (dFordependents_incomeTax == 380000) {
        dFordependents_residentTax = 330000;
    }
    else if (dFordependents_incomeTax == 630000) {
        dFordependents_residentTax = 450000;
    }
    else if (dFordependents_incomeTax == 480000) {
        dFordependents_residentTax = 380000;
    }
    else if (dFordependents_incomeTax == 580000) {
        dFordependents_residentTax = 450000;
    }
    else {
        dFordependents_incomeTax = 0;
        dFordependents_residentTax = 0;
    }

    Map<String, String> dFordependentsMap = new HashMap<String, String>() {
        {
            put("扶養控除_所得税", String.format("%,d", dFordependents_incomeTax));
            put("扶養控除_住民税", String.format("%,d", dFordependents_residentTax));
        }
    };

    return dFordependentsMap;
}

配偶者控除額を算出する場合、配偶者の所得が必要です。

When calculating the spouse deduction, the spouse's income is required.

配偶者特別控除の額の場合。

Case of the amount of special deduction for spouse.

case R.id.dForSpouseForm:
    Map<String, String> dForSpouseMap = taxCalc.vDdForSpouse(Integer.parseInt(vd));
    editText.setText(String.format("%,d", Integer.parseInt(vd)));
    incomeDForSpouseText.setText(dForSpouseMap.get("配偶者控除_所得税"));
    residentDForSpouseText.setText(dForSpouseMap.get("配偶者控除_住民税"));
    break;
public Map<String, String> vDdForSpouse(int dfs) {
    dForSpouse_incomeTax = dfs;
    if (!(totalIncomeOfSpouses > 480000)) {
        if (super.getProvisionalTaxableIncome() <= 9000000 && dfs == 380000) {
            dForSpouse_residentTax = 330000;
        }
        else if (super.getProvisionalTaxableIncome() > 9000000 &&
                super.getProvisionalTaxableIncome() <= 9500000 && dfs == 260000) {
            dForSpouse_residentTax = 220000;
        }
        else if (super.getProvisionalTaxableIncome() > 9500000 &&
                super.getProvisionalTaxableIncome() <= 10000000 && dfs == 130000) {
            dForSpouse_residentTax = 110000;
        }

        else if (super.getProvisionalTaxableIncome() <= 9000000 && dfs == 480000) {
            dForSpouse_residentTax = 380000;
        }
        else if (super.getProvisionalTaxableIncome() > 9000000 &&
                super.getProvisionalTaxableIncome() <= 9500000 && dfs == 320000) {
            dForSpouse_residentTax = 260000;
        }
        else if (super.getProvisionalTaxableIncome() > 9500000 &&
                super.getProvisionalTaxableIncome() <= 10000000 && dfs == 160000) {
            dForSpouse_residentTax = 130000;
        }
        else {
            dForSpouse_incomeTax = 0;
            dForSpouse_residentTax = 0;
        }
    } else {
        dForSpouse_incomeTax = 0;
        dForSpouse_residentTax = 0;
    }

    Map<String, String> dForSpouseMap = new HashMap<String, String>() {
        {
            put("配偶者控除_所得税", String.format("%,d", dForSpouse_incomeTax));
            put("配偶者控除_住民税", String.format("%,d", dForSpouse_residentTax));
        }
    };

    return dForSpouseMap;
}

配偶者特別控除の場合、配偶者の所得を入力します。

For the special deduction for spouse, enter the spouse's income.

[strings.xml]のテキストを変更しましょう。

Let's change the text of [strings.xml].

レイアウトファイルのGridLayoutの行数を一つ増やしましょう。

Increase the number of GridLayout lines in the layout file by one.

そしてテキストビューを新たに追加して、テキストの表示を変えます。

Then add a new text view to change the display of the text.

その下のテキストビューのテキストの表示も変更します。

Also changes the display of text in the text view below it.

さらに配偶者特別控除のテキストビュー以下のビューの行数を全て一つずつ増やしていきましょう。

In addition, increase the number of lines by one in the spouse special deduction text view and the views below it.

準備が整ったら、各種控除を計算するクラスファイルに戻り、続きを開始してください。

When you are ready, return to the class file that calculates the various deductions and start writing code.

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

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

寄付金控除の額の場合。

Case of the amount of donation deduction.

一時所得の場合は経費も控除の計算に使用します。

For temporary income, expenses are also used to calculate deductions.

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

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

パート17へ続く。

Continue to Part 17.



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

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