Class: WorkingTimes::Invoice

Inherits:
Object
  • Object
show all
Includes:
Config
Defined in:
lib/working_times/invoice.rb

Overview

Class about creating invoice This class is designed to build data_dir/invoices/current_term/invoice.tex from data_dir/invoices/template.tex

Constant Summary collapse

WDAYS =
%w[日 月 火 水 木 金 土].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInvoice

path_template : String salary_per_hour : Integer tax_rate : Float company : String



17
18
19
20
21
22
23
24
# File 'lib/working_times/invoice.rb', line 17

def initialize
  h_invoice_info = invoice_info

  @path_template   = h_invoice_info['template']
  @salary_per_hour = h_invoice_info['salaryPerHour']
  @tax_rate        = h_invoice_info['taxRate']
  @company         = h_invoice_info['company']
end

Instance Attribute Details

#companyObject (readonly)

Returns the value of attribute company.



7
8
9
# File 'lib/working_times/invoice.rb', line 7

def company
  @company
end

#path_templateObject (readonly)

Returns the value of attribute path_template.



7
8
9
# File 'lib/working_times/invoice.rb', line 7

def path_template
  @path_template
end

#salary_per_hourObject (readonly)

Returns the value of attribute salary_per_hour.



7
8
9
# File 'lib/working_times/invoice.rb', line 7

def salary_per_hour
  @salary_per_hour
end

#tax_rateObject (readonly)

Returns the value of attribute tax_rate.



7
8
9
# File 'lib/working_times/invoice.rb', line 7

def tax_rate
  @tax_rate
end

Instance Method Details

#buildObject



32
33
34
35
# File 'lib/working_times/invoice.rb', line 32

def build
  puts 'Currently, it is not available to build pdf with latexmk.'
  puts 'Wait for new version!'
end

#generateObject



26
27
28
29
30
# File 'lib/working_times/invoice.rb', line 26

def generate
  create_dir_invoice_current_term
  makeup_worktable
  generate_invoice_from_template
end