Published Date : 2021年5月5日21:31

【Androidアプリ:パート14】個人事業主と給与所得者の所得税と住民税を計算するAndroidアプリ
【Android app:Part 14】Android App Calculates Income and Resident Taxes for sole proprietors and 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 app I'm going to show you for calculating income and residence taxes for salaried workers and Individual employers, etc. is just a simple application for playing.

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

​This app 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 app.

個人事業主と給与所得者の所得税と住民税を計算するAndroidアプリパート14。

Android App Calculates Income and Resident Taxes for sole proprietors and salaried workers, Part 14.

前回の続きです。

Continued from last time.

今回もゆっくりと動画を再生させます。時間が無い方は6倍速くらいで見たほうが丁度いいかもしれません。

I will play the video slowly again this time. If you don't have time, it might be just right to watch at 6 times speed.

では計算アクティビティのJavaクラスファイルの中身のコードを書いていきましょう。

Let's write the code for the content of the Java class file for the calculation activity.


Responsive image

こちらのロジックも前回のアプリ(給与所得者の所得税及び住民税の計算アプリ)とほぼ同じです。

This logic is pretty much the same as the previous app (which calculates the income and residence taxes of salaried workers).

しかし、若干の違いがありますので、おさらいの意味を含めてゆっくりと動画を再生させてます。

However, there are some differences, so I play the video slowly including the meaning of review.

まず必要なライブラリ類をインポートしていきます。

First, import the necessary libraries.


Responsive image

import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.GridLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import java.util.Map;

電卓アプリとcsvdriverをそれぞれのライブラリからインポートします。

Import the Calculator app and csvdriver from their respective libraries.


Responsive image

import com.akasatanahama.calculator.CalculatorActivity;
import com.akasatanahama.common.CsvDriver;
import com.akasatanahama.soleproprietor.spcalctax.SpTaxCalc;

表示エラーを無くすため、先に実際に税金の計算をするパッケージの中のクラスファイル群の一部を一時的に作成してしまいましょう。

To avoid display errors, temporarily create a portion of the class files in the package that actually calculates the tax first.


Responsive image

後はいつものように、インスタンスとなる変数をそれぞれの型で宣言していきます。

Then, as usual, you declare the variables to be instances in their respective types.


Responsive image

private String topPagePackageName;
private String topPageClassName;

private ScrollView spScrollView;

private GridLayout inputSpIncomeLayout;
private GridLayout spInputSocialInsuranceDeductionLayout;
private GridLayout spBasicDeductionLayout;
private GridLayout blueReturnDeductionLayout;
private GridLayout spVariousDeductionsLayout;
private GridLayout spBottomCollapseBtnHolder;
private GridLayout spDfromResidentAincomeTaxesLayout;
private GridLayout spToTaxationLayout;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            

完成してあるアプリを基に、それぞれの変数がどの部分に対応するか見ていきましょう。

Based on the finished app, let's look at where each variable corresponds to.


Responsive image

今回もゆっくりと動画を再生させます。時間が無い方は6倍速くらいで見たほうが丁度いいかもしれません。

I will play the video slowly again this time. If you don't have time, it might be just right to watch at 6 times speed.

完成してあるアプリを基に、それぞれの変数がどの部分に対応するか見ていきましょう。

Based on the finished app, let's look at where each variable corresponds to.


Responsive image

こちらのロジックも前回のアプリ(給与所得者の所得税及び住民税の計算アプリ)とほぼ同じです。

This logic is pretty much the same as the previous app (which calculates the income and residence taxes of salaried workers).

しかし、若干の違いがありますので、おさらいの意味を含めてゆっくりと動画を再生させてます。

However, there are some differences, so I play the video slowly including the meaning of review.


Responsive image


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

spCalcSelectedAge = 0;
spCalcSelectedWordPos = 11;

spCalcThirtyNineYOorLessCheckBox = findViewById(R.id.spCalcThirtyNineYOorLessCheckBox);
spCalcFortyYOorMoreCheckBox = findViewById(R.id.spCalcFortyYOorMoreCheckBox);

spCalcCreateWardListAdapter();

spCalcSelectOfYourWardSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    @Override
    public void onNothingSelected(AdapterView adapterView) {
    }
    @Override
    public void onItemSelected(AdapterView parent, View view, int position, long id) {
        if (spCalcSelectedAge != 0) {
            spCalculateSpSi();
            toShowingComparisonActivity();
        }
    }
});

findViewById(R.id.spCalcUseCalculatorBtn).setOnClickListener(this::spStartCalculator);


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

パート15へ続く。

Continue to Part 15.



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

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