Class: LucaSalary::JpPayreport
- Inherits:
-
Base
- Object
- Base
- LucaSalary::JpPayreport
- Defined in:
- lib/luca_salary/jp_payreport.rb
Class Method Summary collapse
- .export(year) ⇒ Object
-
.set_company(year) ⇒ Object
TODO: extract effective field.
Class Method Details
.export(year) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/luca_salary/jp_payreport.rb', line 9 def self.export(year) if !system("uconv --version > /dev/null") exit 1 # 半角カナ必須 end slips = LucaSalary::Total.new(year).slips company = set_company(year.to_i) CSV.generate do |csv| slips.each do |s| csv << 給与支払報告明細行(LucaSupport::Code.readable(s), company, year.to_i) end end end |
.set_company(year) ⇒ Object
TODO: extract effective field
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/luca_salary/jp_payreport.rb', line 24 def self.set_company(year) {}.tap do |h| h['name'] = CONFIG.dig('company', 'name') h['address'] = CONFIG.dig('company', 'address') h['address2'] = CONFIG.dig('company', 'address2') h['tel'] = CONFIG.dig('company', 'tel') h['tax_id'] = CONFIG.dig('company', 'tax_id') raise "会社名、住所の設定は必須" if h['name'].nil? or h['address'].nil? end end |