Published Date : 2021年4月6日10:56

【Androidアプリ:パート1】個人事業主と給与所得者の所得税と住民税を計算するAndroidアプリ
【Android app:Part 1】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アプリパート1。

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

今回作るアンドロイドアプリはこのようになります。

The Android app we're going to create looks like this.

前回作った給与所得者の税金計算アプリと今回作る個人事業主の税金計算アプリを合体させて同時に使えるようにしたものです。

This is a combination of the tax calculation app for salaried workers that I created last time and the tax calculation app for sole proprietors that I created this time.

メイン画面から各計算アプリに切り替えることができます。

You can switch to each calculation application from the main screen.

個人事業主の税金計算アプリは基本的には給与所得者の税金計算アプリと構造は変わりません。

The tax calculation app for sole proprietors is basically the same as the tax calculation app for salaried workers.

健康保険料の算出額は各自治体によって少し異なります。

The calculation amount of the health insurance fee differs a little depending on each municipality.

今回は東京23区のみを対象にしています。ご了承ください。

This time, only 23 wards of Tokyo are covered. Thank you for your understanding.

保険料を使うボタンは前回の時もありましたが、今回は前年度に白色申告と青色申告のどちらで申請したが選べます。

There was a button to use the insurance fee last time, but this time, you can choose either white return declaration or blue return declaration in the previous year.

その選択により、保険料の額も変わってきます。

Depending on the choice, the amount of insurance premium also changes.

そして、計算用のアクティビティの内容は前回の時とほぼ変化はありません。

And the content of the calculation activity is almost the same as last time.

勿論、簡単な四則演算のみができる簡易的な電卓アプリも使えます。

Of course, you can use a calculator application that can only do simple four basic arithmetic operations.

個人事業主の場合、事業所得に対しての経費は自分で算出する必要があります。

If you are a sole proprietor, you need to calculate expenses for business income by yourself.

給与所得者のように決められた控除額ではないので、その経費を入力をする為のエディットテキストと項目名と計算方法を変える必要があります。

It is not a fixed deduction like salary earners, so you need to change the edit text, item name and calculation method to enter the expense.

青色申告をした場合の最大特別控除額65万円を反映させた税金額も表示しています。

Tax amount reflecting the maximum special deduction of 650,000 yen when filing a blue return is also shown.

国民年金保険料や健康保険料を計算して、最終的な手取りの額を算出します。

The final amount of take-home pay is calculated by calculating national pension premiums and health insurance premiums.

39歳以下か40歳以上かを選択し、東京23区のどの区域に住んでいるかを選ぶと自動的に保険料の額が算出されます。

You choose whether you are 39 years old or less or 40 years old or more, and if you choose which area of Tokyo's 23 wards you live, the amount of insurance premium will be calculated automatically.

青色申告と白色申告の場合で、税金額にどの程度差があるかが一目で分かるように、別の表示用のアクティビティを用意しました。

In the case of a blue return and a white return, a separate display activity is provided so that the difference in tax amounts can be seen at a glance.

クリアボタンも前回の時と同様の機能です。

The Clear button has the same function as the last time.

前年度の収入が無ければ、その額を入力するように促すメッセージが表示されます。

If you do not have income from the previous year, you are prompted to enter the amount.

メイン画面に戻るボタンを押すと、メイン画面に戻れます。

You can return to the main screen by pressing the [return to the main screen] button.

給与所得者の税金計算アプリは前回の時と変わりません。

The tax calculation app for salaried workers is the same as last time.

アンドロイド端末を持っていれば、USB接続からアプリをデバックできて、端末でそのまま使えるようになります。

If you have an Android device, you can debug applications from a USB connection and use them as they are on the device.

では今回のアプリを作成してきましょう。

Then, let's create this application.

いつも通りに新しいプロジェクトを作成し、空のアクティビティを選択します。

Create a new project as usual and select an empty activity.

まずは各ライブラリを作成していきましょう。

Let's start by creating each library.

[File]、[New]、[New Module]、[Android Library]の順に選択して、ライブラリ名を決めて新しいライブラリを作成します。

Select File, New, New Module, Android Library to name the library and create a new library.

まずは全体のレイアウト等を提供する[common]ライブラリを作成します。

The first step is to create a [common] library that provides the overall layout, etc.

続いて同じ手順で電卓アプリのライブラリを作成しましょう。

Next, use the same procedure to create a library of Calculator apps.

そして、給与所得者の税金計算アプリをライブラリとして作成しましょう。

Create a library of tax apps for salaried workers.

最後に個人事業主の税金計算アプリをライブラリとして作成します。

Finally, you create a library of tax calculation apps for sole proprietors.

各ライブラリとメイン画面のアプリの[build.gradle]の設定を少し編集します。

Slightly edit the [build.gradle] settings for each library and app on the main screen.

まずはメイン画面となるアプリの[build.gradle]の[dependencies]にそれぞれのライブラリを以下のように定義します。

First, define each library as follows in the [dependencies] item in [build.gradle] of the application which is the main screen.

dependencies {
    implementation project(':common')
    implementation project(':calculator')
    implementation project(':salariedworker')
    implementation project(':soleproprietor')

    ----------------------------------------------------
    ----------------------------------------------------

}

次に電卓アプリのライブラリの[build.gradle]を開いてください。

Next, open [build.gradle] of the library of the calculator application.

一番上の項目のid名が[com.android.library]であること確認してください。

Make sure that the id name of the top item is [com.android.library].

plugins {
    id 'com.android.library'
}

そして[dependencies]に[common]を定義します。

Define [common] as [dependencies].

給与所得者の税金計算アプリのライブラリの[build.gradle]の[dependencies]に[common]と[calculator]を定義してください。

Please define [common] and [calculator] in [build.gradle] of the library of salary earner tax calculation app.

同様に個人事業主の税金計算アプリのライブラリの[build.gradle]の[dependencies]に[common]と[calculator]を定義します。

Similarly, define [build.gradle] and calculator in the dependencies section of the tax calculation app library for sole proprietors.

では一気に全てのレイアウトファイルやアクティビティを空の状態で作成しておきましょう。

Let's create all the layout files and activities as empty in one go.

まずは電卓アプリの全体のファイルから作成してきます。

First, I will create it from the whole file of the calculator application.

いつも通りに新しいアクティビティとレイアウトファイルを同時に作成します。

Create a new activity and layout file at the same time as usual.

続いて[common]ライブラリのファイルとフォルダの作成です。

Then create the files and folders in the common library.

今度は新しい[java class]ファイルを作成して、[csv]の読み込みと編集を行うクラスファイルを作成します。

Now create a new java class file and create a class file to import and edit csv.

続いて[csv]ファイルを格納する[assets]フォルダを作成します。

Then create an assets folder to store the csv file.

その中に前回の給与所得者の社会保険料の算出に使われたcsvファイルを格納します。

It contains a csv file that was used to calculate the social insurance premiums of the previous salary earner.

そして今回新たに個人事業主用の健康保険料の算出に使用する為に必要なcsvファイルを格納します。

This time, we will newly store a csv file required to calculate health insurance premiums for sole proprietors.

続いて、[android resouce directory]から[values]と[drawable]、[layout]フォルダを作成します。

Then create the values, drawable, and layout folders from the android resource directory.

パート2へ続く。

Continue to Part 2.



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

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