kirico 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +37 -0
- data/.github/workflows/test.yml +39 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +48 -21
- data/CODE_OF_CONDUCT.md +86 -0
- data/Gemfile.lock +105 -0
- data/LICENSE.md +4 -4
- data/README.md +32 -24
- data/kirico.gemspec +8 -15
- data/lib/kirico/config/locales/en.yml +9 -0
- data/lib/kirico/config/locales/ja.yml +106 -4
- data/lib/kirico/csv_generator.rb +1 -0
- data/lib/kirico/models/application_record.rb +2 -1
- data/lib/kirico/models/base_company_count.rb +1 -0
- data/lib/kirico/models/base_fd_management_record.rb +1 -0
- data/lib/kirico/models/company.rb +16 -6
- data/lib/kirico/models/company_count.rb +1 -0
- data/lib/kirico/models/company_identifier.rb +1 -0
- data/lib/kirico/models/data_identifier.rb +1 -0
- data/lib/kirico/models/data_record22187041.rb +4 -3
- data/lib/kirico/models/data_record2221700.rb +175 -0
- data/lib/kirico/models/data_record2225700.rb +227 -0
- data/lib/kirico/models/data_record22257041.rb +7 -5
- data/lib/kirico/models/data_record2265700.rb +98 -0
- data/lib/kirico/models/fd_management_record.rb +5 -1
- data/lib/kirico/models/form.rb +5 -2
- data/lib/kirico/models/helper.rb +2 -0
- data/lib/kirico/models/mappers.yml +61 -0
- data/lib/kirico/models/sr_company_count.rb +2 -1
- data/lib/kirico/models/sr_fd_management_record.rb +3 -1
- data/lib/kirico/validators/charset_validator.rb +1 -1
- data/lib/kirico/validators/sjis_bytesize_validator.rb +10 -17
- data/lib/kirico/validators/space_divider_validator.rb +2 -3
- data/lib/kirico/version.rb +2 -1
- data/lib/kirico.rb +4 -0
- metadata +30 -111
- data/.ruby-version +0 -1
- data/Guardfile +0 -15
- data/circle.yml +0 -7
@@ -4,9 +4,9 @@ ja:
|
|
4
4
|
messages:
|
5
5
|
invalid_charset: "に利用できない文字が入力されています。%{error_chars}"
|
6
6
|
invalid_space_divider: "は%{space_type}で区切ってください。"
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
too_long_in_bytes: は%{count}バイト以内で入力してください。
|
8
|
+
too_short_in_bytes: は%{count}バイト以上で入力してください。
|
9
|
+
wrong_length_in_bytes: は%{count}バイトで入力してください。
|
10
10
|
invalid_date: "は正しい形式で入力してください。"
|
11
11
|
invalid_time: "は正しい形式で入力してください。"
|
12
12
|
invalid_datetime: "は正しい形式で入力してください。"
|
@@ -49,6 +49,43 @@ ja:
|
|
49
49
|
old_address_yomi: 変更前被保険者住所(カナ)
|
50
50
|
old_address: 変更前被保険者住所(漢字)
|
51
51
|
memo: 備考欄
|
52
|
+
# 月額変更届
|
53
|
+
kirico/data_record2221700:
|
54
|
+
prefecture_code: 都道府県コード
|
55
|
+
area_code: 群市区符号
|
56
|
+
office_code: 事業所記号
|
57
|
+
ip_code: 被保険者整理番号
|
58
|
+
ip_name_yomi: 被保険者氏名(カナ)
|
59
|
+
ip_name: 被保険者氏名(漢字)
|
60
|
+
birth_at: 生年月日
|
61
|
+
applied_at: 改定年月日
|
62
|
+
old_monthly_standard_income_hel_ins: 従前の標準報酬月額(健保)
|
63
|
+
old_monthly_standard_income_pns_ins: 従前の標準報酬月額(厚保)
|
64
|
+
old_applied_at: 従前の改定年
|
65
|
+
income_updated_at: 昇(降)給年月日
|
66
|
+
income_updated_type: 昇(降)給区分
|
67
|
+
retroacted_payment_at: 遡及支払月
|
68
|
+
retroacted_payment: 遡及支払額
|
69
|
+
before_3_month_days: 給与計算の基礎日数(前三ヶ月)
|
70
|
+
before_2_month_days: 給与計算の基礎日数(前二ヶ月)
|
71
|
+
before_1_month_days: 給与計算の基礎日数(前一ヶ月)
|
72
|
+
before_3_month_income_currency: 通貨によるものの額(前三ヶ月)
|
73
|
+
before_2_month_income_currency: 通貨によるものの額(前二ヶ月)
|
74
|
+
before_1_month_income_currency: 通貨によるものの額(前一ヶ月)
|
75
|
+
before_3_month_income_goods: 現物によるものの額(前三ヶ月)
|
76
|
+
before_2_month_income_goods: 現物によるものの額(前二ヶ月)
|
77
|
+
before_1_month_income_goods: 現物によるものの額(前一ヶ月)
|
78
|
+
avg_adjustment: 修正平均額
|
79
|
+
my_number: 個人番号
|
80
|
+
area_code_of_basic_pension_number: 基礎年金番号 課所符号
|
81
|
+
serial_number_of_basic_pension_number: 基礎年金番号 一連番号
|
82
|
+
seventy_years_and_over: 70歳以上被用者
|
83
|
+
work_in_multiple_company: 二以上勤務
|
84
|
+
short_time_worker: 短時間労働者(特定適用事業所等)
|
85
|
+
reason: 月額変更に該当することになった理由
|
86
|
+
change_only_hel_ins: 健康保険のみ月額変更
|
87
|
+
memo: 備考欄
|
88
|
+
submit_only_seventy_years_and_over: 70歳以上被用者届のみ提出
|
52
89
|
# 算定基礎届
|
53
90
|
kirico/data_record22257041:
|
54
91
|
area_code: 都市区符号
|
@@ -78,9 +115,71 @@ ja:
|
|
78
115
|
income_diff_amount: 昇(降)給差の月額
|
79
116
|
income_updated_at: 昇(降)給年月日
|
80
117
|
memo: 備考欄
|
118
|
+
# 2018年3月以降 算定基礎届
|
119
|
+
kirico/data_record2225700:
|
120
|
+
prefecture_code: 都道府県コード
|
121
|
+
area_code: 群市区符号
|
122
|
+
office_code: 事業所記号
|
123
|
+
ip_code: 被保険者整理番号
|
124
|
+
ip_name_yomi: 被保険者氏名(カナ)
|
125
|
+
ip_name: 被保険者氏名(漢字)
|
126
|
+
birth_at: 生年月日
|
127
|
+
applied_at: 適用年月日
|
128
|
+
old_monthly_standard_income_hel_ins: 従前の標準報酬月額(健保)
|
129
|
+
old_monthly_standard_income_pns_ins: 従前の標準報酬月額(厚保)
|
130
|
+
old_applied_at: 従前の改定年月日
|
131
|
+
apr_days: 支払基礎日数(4月)
|
132
|
+
may_days: 支払基礎日数(5月)
|
133
|
+
jun_days: 支払基礎日数(6月)
|
134
|
+
apr_income_currency: 通貨によるものの額(4月)
|
135
|
+
may_income_currency: 通貨によるものの額(5月)
|
136
|
+
jun_income_currency: 通貨によるものの額(6月)
|
137
|
+
apr_income_goods: 現物によるものの額(4月)
|
138
|
+
may_income_goods: 現物によるものの額(5月)
|
139
|
+
jun_income_goods: 現物によるものの額(6月)
|
140
|
+
avg_adjustment: 修正平均額
|
141
|
+
ip_type: 被保険者区分
|
142
|
+
income_updated_at: 昇(降)給年月日
|
143
|
+
income_updated_type: 昇(降)給区分
|
144
|
+
retroacted_payment_at: 遡及支払月
|
145
|
+
retroacted_payment: 遡及支払額
|
146
|
+
my_number: 個人番号
|
147
|
+
area_code_of_basic_pension_number: 基礎年金番号 課所符号
|
148
|
+
serial_number_of_basic_pension_number: 基礎年金番号 一連番号
|
149
|
+
seventy_years_and_over: 70歳以上被用者算定
|
150
|
+
seventy_years_old_months: 70歳以上被用者 算定基礎月
|
151
|
+
work_in_multiple_company: 二以上勤務
|
152
|
+
will_change_monthly_income: 月額変更予定
|
153
|
+
join_middle_of_month: 中途入社
|
154
|
+
leave_of_absence: 病休・育休・休職等
|
155
|
+
short_time_worker: 短時間労働者(特定適用事業所等)
|
156
|
+
part_time_worker: パート
|
157
|
+
annual_average_caluculation: 年間平均
|
158
|
+
memo: 備考欄
|
159
|
+
submit_only_seventy_years_and_over: 70歳以上被用者届のみ提出
|
160
|
+
# 賞与支払届
|
161
|
+
kirico/data_record2265700:
|
162
|
+
prefecture_code: 都道府県コード
|
163
|
+
area_code: 群市区符号
|
164
|
+
office_code: 事業所記号
|
165
|
+
ip_code: 被保険者整理番号
|
166
|
+
ip_name_yomi: 被保険者氏名(カナ)
|
167
|
+
ip_name: 被保険者氏名(漢字)
|
168
|
+
birth_at: 生年月日
|
169
|
+
bonus_payment_at: 賞与支払日
|
170
|
+
payment_in_currency: 通貨支給額
|
171
|
+
payment_in_goods: 現物支給額
|
172
|
+
my_number: 個人番号
|
173
|
+
area_code_of_basic_pension_number: 基礎年金番号 課所符号
|
174
|
+
serial_number_of_basic_pension_number: 基礎年金番号 一連番号
|
175
|
+
seventy_years_and_over: 70歳以上被用者算定
|
176
|
+
work_in_multiple_company: 二以上勤務
|
177
|
+
first_payment_day_of_multiple_payments_within_the_same_month: 同一月内の賞与合算 初回支払日
|
178
|
+
submit_only_seventy_years_and_over: 70歳以上被用者届のみ提出
|
81
179
|
kirico/company:
|
82
180
|
sr_name: 社会保険労務士氏名
|
83
181
|
count: 事業所数情報
|
182
|
+
prefecture_code: 都道府県コード
|
84
183
|
area_code: 都市区符号
|
85
184
|
office_code: 事業所記号
|
86
185
|
office_number: 事業所番号
|
@@ -89,8 +188,11 @@ ja:
|
|
89
188
|
address: 事業所所在地
|
90
189
|
name: 事業所名称
|
91
190
|
owner_name: 事業主氏名
|
92
|
-
|
191
|
+
tel_area_code: 電話番号 市外局番等
|
192
|
+
tel_city_code: 電話番号 市内局番等
|
193
|
+
tel_subscriber_number: 電話番号 加入者番号
|
93
194
|
kirico/fd_management_record:
|
195
|
+
prefecture_code: 都道府県コード
|
94
196
|
area_code: 都市区符号
|
95
197
|
office_code: 事業所記号
|
96
198
|
fd_seq_number: FD通番
|
data/lib/kirico/csv_generator.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'virtus'
|
3
4
|
require 'active_model'
|
4
5
|
|
@@ -7,6 +8,7 @@ module Kirico
|
|
7
8
|
include Virtus.model
|
8
9
|
include ActiveModel::Validations
|
9
10
|
|
11
|
+
attribute :prefecture_code, String
|
10
12
|
attribute :area_code, String
|
11
13
|
attribute :office_code, String
|
12
14
|
attribute :office_number, String
|
@@ -15,17 +17,22 @@ module Kirico
|
|
15
17
|
attribute :address, String
|
16
18
|
attribute :name, String
|
17
19
|
attribute :owner_name, String
|
18
|
-
attribute :
|
20
|
+
attribute :tel_area_code, String
|
21
|
+
attribute :tel_city_code, String
|
22
|
+
attribute :tel_subscriber_number, String
|
19
23
|
|
24
|
+
validates :prefecture_code, charset: { accept: [:numeric] }, sjis_bytesize: { is: 2 }
|
20
25
|
validates :area_code, charset: { accept: [:numeric] }, sjis_bytesize: { is: 2 }
|
21
|
-
validates :office_code, charset: { accept: [
|
26
|
+
validates :office_code, charset: { accept: %i[numeric latin katakana] }, sjis_bytesize: { in: 1..4 }
|
22
27
|
validates :office_number, charset: { accept: [:numeric] }, sjis_bytesize: { in: 1..5 }
|
23
28
|
validates :zip_code1, charset: { accept: [:numeric] }, sjis_bytesize: { is: 3 }
|
24
29
|
validates :zip_code2, charset: { accept: [:numeric] }, sjis_bytesize: { is: 4 }
|
25
30
|
validates :address, charset: { accept: [:all] }, sjis_bytesize: { in: 1..75 }
|
26
|
-
validates :name, charset: { accept: [
|
27
|
-
validates :owner_name, charset: { accept: [
|
28
|
-
validates :
|
31
|
+
validates :name, charset: { accept: %i[katakana kanji] }, sjis_bytesize: { in: 1..50 }
|
32
|
+
validates :owner_name, charset: { accept: %i[katakana kanji] }, sjis_bytesize: { in: 1..25 }, space_divider: { space: :both_width }
|
33
|
+
validates :tel_area_code, charset: { accept: %i[latin numeric] }, sjis_bytesize: { in: 2..5 }
|
34
|
+
validates :tel_city_code, charset: { accept: %i[latin numeric] }, sjis_bytesize: { in: 1..4 }
|
35
|
+
validates :tel_subscriber_number, charset: { accept: %i[latin numeric] }, sjis_bytesize: { in: 4..5 }
|
29
36
|
|
30
37
|
def initialize
|
31
38
|
yield(self) if block_given?
|
@@ -33,6 +40,7 @@ module Kirico
|
|
33
40
|
|
34
41
|
def to_csv
|
35
42
|
[
|
43
|
+
prefecture_code,
|
36
44
|
area_code,
|
37
45
|
office_code,
|
38
46
|
office_number,
|
@@ -41,7 +49,9 @@ module Kirico
|
|
41
49
|
address,
|
42
50
|
name,
|
43
51
|
owner_name,
|
44
|
-
|
52
|
+
tel_area_code,
|
53
|
+
tel_city_code,
|
54
|
+
tel_subscriber_number
|
45
55
|
].map { |attr| attr.to_s.encode('CP932') }.join(',')
|
46
56
|
end
|
47
57
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# 住所変更届データレコード
|
3
4
|
module Kirico
|
4
5
|
class DataRecord22187041 < ApplicationRecord
|
@@ -22,18 +23,18 @@ module Kirico
|
|
22
23
|
attribute :memo, String
|
23
24
|
|
24
25
|
validates :area_code, charset: { accept: [:numeric] }, sjis_bytesize: { is: 2 }
|
25
|
-
validates :office_code, charset: { accept: [
|
26
|
+
validates :office_code, charset: { accept: %i[numeric latin katakana] }, sjis_bytesize: { in: 1..4 }
|
26
27
|
validates :ip_code, charset: { accept: [:numeric] }, sjis_bytesize: { in: 1..6 }
|
27
28
|
validates :basic_pension_number1, charset: { accept: [:numeric] }, sjis_bytesize: { is: 4 }, allow_blank: true
|
28
29
|
validates :basic_pension_number2, charset: { accept: [:numeric] }, sjis_bytesize: { is: 6 }, allow_blank: true
|
29
30
|
validates :zip_code1, charset: { accept: [:numeric] }, sjis_bytesize: { is: 3 }
|
30
31
|
validates :zip_code2, charset: { accept: [:numeric] }, sjis_bytesize: { is: 4 }
|
31
|
-
validates :new_address_yomi, charset: { accept: [
|
32
|
+
validates :new_address_yomi, charset: { accept: %i[numeric latin katakana] }, sjis_bytesize: { in: 1..75 }
|
32
33
|
validates :new_address, charset: { accept: [:all] }, sjis_bytesize: { in: 0..74 }, allow_blank: true
|
33
34
|
validates :updated_at, timeliness: { on_or_before: :today, type: :date }
|
34
35
|
validates :ip_name_yomi, charset: { accept: [:katakana] }, sjis_bytesize: { in: 1..25 }, space_divider: { space: :half_width }
|
35
36
|
validates :ip_name, charset: { accept: [:all] }, sjis_bytesize: { in: 0..24 }, allow_blank: true, space_divider: { space: :full_width }
|
36
|
-
validates :old_address_yomi, charset: { accept: [
|
37
|
+
validates :old_address_yomi, charset: { accept: %i[numeric latin katakana] }, sjis_bytesize: { in: 1..75 }
|
37
38
|
validates :old_address, charset: { accept: [:all] }, sjis_bytesize: { in: 0..74 }, allow_blank: true
|
38
39
|
validates :memo, charset: { accept: [:all] }, sjis_bytesize: { in: 0..75 }, allow_blank: true
|
39
40
|
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# 月額変更届・70歳以上被用者月額変更届データレコード
|
4
|
+
module Kirico
|
5
|
+
class DataRecord2221700 < ApplicationRecord
|
6
|
+
DOC_CODE = '2221700'
|
7
|
+
|
8
|
+
attribute :prefecture_code, String
|
9
|
+
attribute :area_code, String
|
10
|
+
attribute :office_code, String
|
11
|
+
attribute :ip_code, String
|
12
|
+
attribute :ip_name_yomi, String
|
13
|
+
attribute :ip_name, String
|
14
|
+
attribute :birth_at, Date
|
15
|
+
attribute :applied_at, Date
|
16
|
+
attribute :old_monthly_standard_income_hel_ins, Integer
|
17
|
+
attribute :old_monthly_standard_income_pns_ins, Integer
|
18
|
+
attribute :old_applied_at, Date
|
19
|
+
attribute :income_updated_at, Date
|
20
|
+
attribute :income_updated_type, Symbol
|
21
|
+
attribute :retroacted_payment_at, Date
|
22
|
+
attribute :retroacted_payment, Integer
|
23
|
+
[3, 2, 1].each do |month|
|
24
|
+
attribute "before_#{month}_month_days", String
|
25
|
+
attribute "before_#{month}_month_income_currency", String
|
26
|
+
attribute "before_#{month}_month_income_goods", String
|
27
|
+
end
|
28
|
+
attribute :avg_adjustment, Integer
|
29
|
+
attribute :my_number, String
|
30
|
+
attribute :area_code_of_basic_pension_number, String
|
31
|
+
attribute :serial_number_of_basic_pension_number, String
|
32
|
+
attribute :seventy_years_and_over, Integer
|
33
|
+
attribute :work_in_multiple_company, Integer
|
34
|
+
attribute :short_time_worker, Integer
|
35
|
+
attribute :reason, String
|
36
|
+
attribute :change_only_hel_ins, Integer
|
37
|
+
attribute :memo, String
|
38
|
+
attribute :submit_only_seventy_years_and_over, Integer
|
39
|
+
|
40
|
+
define_format_date_method :birth_at, :applied_at, :old_applied_at, :income_updated_at, :retroacted_payment_at
|
41
|
+
define_code_mapper_method :birth_at_era_nengo, :applied_at_era_nengo, :old_applied_at_era_nengo, :income_updated_type
|
42
|
+
define_in_k_method :old_monthly_standard_income_hel_ins, :old_monthly_standard_income_pns_ins
|
43
|
+
|
44
|
+
validates :prefecture_code, charset: { accept: [:numeric] }, sjis_bytesize: { is: 2 }
|
45
|
+
validates :area_code, charset: { accept: [:numeric] }, sjis_bytesize: { is: 2 }
|
46
|
+
validates :office_code, charset: { accept: %i[numeric latin katakana] }, sjis_bytesize: { in: 1..4 }
|
47
|
+
validates :ip_code, charset: { accept: [:numeric] }, sjis_bytesize: { in: 0..6 }, allow_blank: true
|
48
|
+
validates :ip_name_yomi, charset: { accept: [:katakana] }, sjis_bytesize: { in: 1..25 }, space_divider: { space: :half_width }
|
49
|
+
validates :ip_name, charset: { accept: [:all] }, sjis_bytesize: { in: 0..24 }, allow_blank: true, space_divider: { space: :full_width }
|
50
|
+
validates :applied_at, timeliness: { on_or_after: -> { Date.new(1989, 1, 8) }, type: :date }
|
51
|
+
validates :old_monthly_standard_income_hel_ins, numericality: { greater_than_or_equal_to: 1_000, less_than_or_equal_to: 9_999_999 }, allow_blank: true
|
52
|
+
validates :old_monthly_standard_income_pns_ins, numericality: { greater_than_or_equal_to: 1_000, less_than_or_equal_to: 9_999_999 }, allow_blank: true
|
53
|
+
validates :old_applied_at, timeliness: { on_or_after: -> { Date.new(1989, 1, 8) }, type: :date }
|
54
|
+
validates :income_updated_at, timeliness: { on_or_after: -> { Date.new(1989, 1, 8) }, type: :date }, allow_blank: true
|
55
|
+
validates :income_updated_type, inclusion: { in: %i[income_updated_type_0 income_updated_type_1] }, allow_blank: true
|
56
|
+
validates :retroacted_payment_at, timeliness: { on_or_after: -> { Date.new(1989, 1, 8) }, type: :date }, allow_blank: true
|
57
|
+
validates :retroacted_payment, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 9_999_999 }, allow_blank: true
|
58
|
+
[3, 2, 1].each do |month|
|
59
|
+
validates "before_#{month}_month_income_currency", numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 9_999_999 }
|
60
|
+
validates "before_#{month}_month_income_goods", numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 9_999_999 }
|
61
|
+
end
|
62
|
+
validates :avg_adjustment, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 9_999_999 }, allow_blank: true
|
63
|
+
validates :my_number, charset: { accept: [:numeric] }, sjis_bytesize: { is: 12 }, allow_nil: true
|
64
|
+
validates :area_code_of_basic_pension_number, charset: { accept: [:numeric] }, sjis_bytesize: { is: 4 }, allow_nil: true
|
65
|
+
validates :serial_number_of_basic_pension_number, charset: { accept: [:numeric] }, sjis_bytesize: { is: 6 }, allow_nil: true
|
66
|
+
validates :seventy_years_and_over, inclusion: { in: [1] }, allow_nil: true
|
67
|
+
validates :work_in_multiple_company, inclusion: { in: [1] }, allow_nil: true
|
68
|
+
validates :short_time_worker, inclusion: { in: [1] }, allow_nil: true
|
69
|
+
validates :reason, charset: { accept: [:all] }, sjis_bytesize: { in: 0..75 }
|
70
|
+
validates :change_only_hel_ins, inclusion: { in: [1] }, allow_nil: true
|
71
|
+
validates :memo, charset: { accept: [:all] }, sjis_bytesize: { in: 0..75 }, allow_nil: true
|
72
|
+
validates :submit_only_seventy_years_and_over, inclusion: { in: [1] }, allow_nil: true
|
73
|
+
|
74
|
+
validate :each_month_days_should_be_greater_than_or_equal_11_or_17
|
75
|
+
validate :seventy_years_and_over_employee_need_to_input_my_number_or_basic_pension_number
|
76
|
+
|
77
|
+
def initialize
|
78
|
+
yield(self) if block_given?
|
79
|
+
end
|
80
|
+
|
81
|
+
# rubocop:disable all
|
82
|
+
def to_csv
|
83
|
+
[
|
84
|
+
DOC_CODE,
|
85
|
+
prefecture_code,
|
86
|
+
area_code,
|
87
|
+
office_code,
|
88
|
+
ip_code,
|
89
|
+
ip_name_yomi,
|
90
|
+
ip_name,
|
91
|
+
mapped_birth_at_era_nengo,
|
92
|
+
fmt_era_ymd_birth_at,
|
93
|
+
mapped_applied_at_era_nengo,
|
94
|
+
applied_at_era_year,
|
95
|
+
applied_at_month,
|
96
|
+
old_monthly_standard_income_hel_ins.nil? ? nil : old_monthly_standard_income_hel_ins_in_k.to_s.rjust(4, '0'),
|
97
|
+
old_monthly_standard_income_pns_ins.nil? ? nil : old_monthly_standard_income_pns_ins_in_k.to_s.rjust(4, '0'),
|
98
|
+
mapped_old_applied_at_era_nengo,
|
99
|
+
old_applied_at_era_year,
|
100
|
+
old_applied_at_month,
|
101
|
+
income_updated_at.nil? ? nil : income_updated_at_month,
|
102
|
+
mapped_income_updated_type,
|
103
|
+
retroacted_payment_at.nil? ? nil : retroacted_payment_at_month,
|
104
|
+
retroacted_payment.nil? ? nil : retroacted_payment,
|
105
|
+
applied_at.prev_month(3).strftime('%m'),
|
106
|
+
applied_at.prev_month(2).strftime('%m'),
|
107
|
+
applied_at.prev_month(1).strftime('%m'),
|
108
|
+
before_3_month_days.to_s.rjust(2, '0'),
|
109
|
+
before_2_month_days.to_s.rjust(2, '0'),
|
110
|
+
before_1_month_days.to_s.rjust(2, '0'),
|
111
|
+
before_3_month_income_currency,
|
112
|
+
before_2_month_income_currency,
|
113
|
+
before_1_month_income_currency,
|
114
|
+
before_3_month_income_goods,
|
115
|
+
before_2_month_income_goods,
|
116
|
+
before_1_month_income_goods,
|
117
|
+
round_income(income_total(before_3_month_income_currency, before_3_month_income_goods)),
|
118
|
+
round_income(income_total(before_2_month_income_currency, before_2_month_income_goods)),
|
119
|
+
round_income(income_total(before_1_month_income_currency, before_1_month_income_goods)),
|
120
|
+
round_income(income_all_total),
|
121
|
+
round_income(income_average),
|
122
|
+
avg_adjustment.nil? ? nil : avg_adjustment,
|
123
|
+
my_number,
|
124
|
+
area_code_of_basic_pension_number,
|
125
|
+
serial_number_of_basic_pension_number,
|
126
|
+
seventy_years_and_over,
|
127
|
+
work_in_multiple_company,
|
128
|
+
short_time_worker,
|
129
|
+
reason,
|
130
|
+
change_only_hel_ins,
|
131
|
+
memo,
|
132
|
+
submit_only_seventy_years_and_over,
|
133
|
+
].map { |attr| attr.to_s.encode('CP932') }.join(',')
|
134
|
+
end
|
135
|
+
# rubocop:enable all
|
136
|
+
|
137
|
+
def income_total(currency, goods)
|
138
|
+
currency.to_i + goods.to_i
|
139
|
+
end
|
140
|
+
|
141
|
+
def income_all_total
|
142
|
+
[
|
143
|
+
income_total(before_3_month_income_currency, before_3_month_income_goods),
|
144
|
+
income_total(before_2_month_income_currency, before_2_month_income_goods),
|
145
|
+
income_total(before_1_month_income_currency, before_1_month_income_goods)
|
146
|
+
].sum
|
147
|
+
end
|
148
|
+
|
149
|
+
# 1 円未満は切り捨て
|
150
|
+
def income_average
|
151
|
+
income_all_total / 3
|
152
|
+
end
|
153
|
+
|
154
|
+
def round_income(income)
|
155
|
+
income < 10_000_000 ? income : 9_999_999
|
156
|
+
end
|
157
|
+
|
158
|
+
private
|
159
|
+
|
160
|
+
# 一般の被保険者(短時間労働者以外)の場合、17~31 日の範囲で設定する
|
161
|
+
# 短時間労働者(特定適用事業所のみ)の場合、11~31 日の範囲で設定する
|
162
|
+
def each_month_days_should_be_greater_than_or_equal_11_or_17
|
163
|
+
threshold = short_time_worker == 1 ? 11 : 17
|
164
|
+
[3, 2, 1].each do |month|
|
165
|
+
errors.add(:base, "前#{month}ヶ月の給与計算の基礎日数は、#{threshold}~31日の範囲で設定しなくてはいけません") unless threshold <= send(:"before_#{month}_month_days").to_i && send(:"before_#{month}_month_days").to_i <= 31
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def seventy_years_and_over_employee_need_to_input_my_number_or_basic_pension_number
|
170
|
+
return if seventy_years_and_over.nil?
|
171
|
+
|
172
|
+
errors.add(:base, '70歳以上被用者の場合、マイナンバー、もしくは基礎年金番号の入力は必須です。') if my_number.nil? && area_code_of_basic_pension_number.nil? && serial_number_of_basic_pension_number.nil?
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|