Published Date : 2021年4月25日15:41

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

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

前回の続きです。

Continued from last time.

では個人事業主の税金計算アプリを仕上げていきましょう。

Then, let's write the code of the application that calculates the income and resident tax of the sole proprietor.


Responsive image

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

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

まずはstrings.xmlにこのアプリで使う文字列を登録していきましょう。

First, let's register the string used for this application in strings.xml.


Responsive image

<resources>
    <string name="app_name">個人事業主の税金計算</string>

    <string name="incomeAmountOfBusinessItemText">事業収入(円)</string>
    <string name="expenseAmountOfBusinessItemText">事業経費(円)</string>
    <string name="spDeficitItemText">赤字(円)</string>
    <string name="incomeAmountItemText">事業所得(円)</string>
    <string name="spProvisionalTaxableIncomeItemString">課税所得(円)</string>
    <!-- calculate social insurance premiums for the previous year -->
    <string name="calcSiPpreviousYearItemTitle">前年度の社会保険料を計算</string>
    <!-- What was your business income last year? -->
    <string name="businessIncomeLastYearItemText">一昨年度の事業所得は?</string>


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


    <string name="comparisonOfWhiteAndBlueReturnsBtnText">白色申告と青色申告を比較</string>
    <string name="comparisonOfWhiteAndBlueReturnsTitle">白色申告と&lt;font color=\"#3a9efd\"&gt;青色申告&lt;/font&gt;&lt;br /&gt;(最大控除65万円を使用)を比較</string>

    <string name="compTotalTaxString">国保+所得税+住民税+年金(円)</string>
</resources>

既に完成してあるアプリを参考に、登録した文字列が画面表示のどの部分に該当しているかを見てみてください。

Refer to the application that has already been completed, and see which part of the screen display the registered character string corresponds to.


Responsive image

ではこのアプリのメイン画面となるレイアウトファイルに固有のビューやレイアウトを書き込んでいきましょう。

Now, let's write a unique view and layout in the layout file which is the main screen of this application.


Responsive image

もちろん、全体的には共通ライブラリのレイアウトファイルを利用します。

Overall, of course, it makes use of common library layout files.


Responsive image

レイアウトファイルのボタンに登録したイベントリスナーをメインのJavaファイルに書き込んでいきます。

It writes the event listeners registered on the buttons in the layout file to the main Java file.


Responsive image

public void spCreateWardListAdapter() {
    if (!spCsvDriver.getTokyoWardList().isEmpty()) {

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

    }
}

public void spOnAgeCheckBoxCliked(View view) {
    boolean ageChecked = ((CheckBox) view).isChecked();

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

}

public void spOnReturnCheckboxClicked(View view) {
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

}

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

国民健康保険料の計算結果を表示させるディスプレイのコードを書いています。

I write the code of the display which shows the calculation result of the national health insurance premium.


Responsive image

HTMLフォーマットを表示させる方法と変数の埋め込みと対応の仕方は前々回あたりのアンドロイドアプリの動画シリーズを参考にしてください。

See the previous Android app video series for information on how to display HTML and how to embed variables and map them from Java files.


Responsive image

共通ライブラリのレイアウトファイルを使用している部分は、給与所得者の税金計算アプリの時と変わりませんので、前回の動画を参考にしてください。

The part of the common library that uses the layout file is the same as the part of the salary earner tax calculation application, so please refer to the previous video.


Responsive image

パート11へ続く。

Continue to Part 11.



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

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