Class: OpenTableExplorer::Finance::TaxForms

Inherits:
Object
  • Object
show all
Extended by:
Assertions::ClassMethods, ClassMethods
Includes:
OpenTableExplorer, Constants, Assertions
Defined in:
app/models/open_tax_solver.rb

Overview

Constants

Defined Under Namespace

Modules: Assertions, ClassMethods

Constant Summary

Constants included from Constants

Constants::Command, Constants::Data_source_directory, Constants::Default_tax_year, Constants::OTS_template_filename, Constants::Open_Tax_Filler_Directory, Constants::Open_tax_solver_binary, Constants::Open_tax_solver_data_directory, Constants::Open_tax_solver_directory, Constants::Open_tax_solver_input, Constants::Open_tax_solver_sysout

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Assertions::ClassMethods

assert_post_conditions, assert_pre_conditions

Methods included from Assertions

#assert_post_conditions, #assert_pre_conditions

Constructor Details

#initialize(form, jurisdiction = 'US', tax_year = Finance::Constants::Default_tax_year) ⇒ TaxForms


38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/models/open_tax_solver.rb', line 38

def initialize(form, jurisdiction='US', tax_year=Finance::Constants::Default_tax_year)
	@form=form
	@jurisdiction=jurisdiction # :US, or :CA
	@tax_year=tax_year
	@open_tax_solver_directory=Dir["../OpenTaxSolver#{@tax_year}_*"][0]
	@form_filename="#{@jurisdiction.to_s}_#{@form}"
	@open_tax_solver_data_directory="#{@open_tax_solver_directory}/examples_and_templates/#{@form_filename}"
	@open_tax_solver_output="#{open_tax_solver_data_directory}/#{@form_filename}_Lawson.txt"
	@ots_template_filename="#{Open_tax_solver_data_directory}/#{@jurisdiction.to_s}_#{@form}_template.txt"
	@output_pdf="#{Data_source_directory}/#{@form_filename}_otff.pdf"
	
end

Instance Attribute Details

#formObject (readonly)

Returns the value of attribute form


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def form
  @form
end

#form_filenameObject (readonly)

Returns the value of attribute form_filename


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def form_filename
  @form_filename
end

#jurisdictionObject (readonly)

Returns the value of attribute jurisdiction


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def jurisdiction
  @jurisdiction
end

#open_tax_solver_data_directoryObject (readonly)

Returns the value of attribute open_tax_solver_data_directory


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def open_tax_solver_data_directory
  @open_tax_solver_data_directory
end

#open_tax_solver_directoryObject (readonly)

Returns the value of attribute open_tax_solver_directory


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def open_tax_solver_directory
  @open_tax_solver_directory
end

#ots_template_filenameObject (readonly)

Returns the value of attribute ots_template_filename


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def ots_template_filename
  @ots_template_filename
end

#output_pdfObject (readonly)

Returns the value of attribute output_pdf


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def output_pdf
  @output_pdf
end

#tax_yearObject (readonly)

Returns the value of attribute tax_year


37
38
39
# File 'app/models/open_tax_solver.rb', line 37

def tax_year
  @tax_year
end

Instance Method Details

#run_open_tax_solverObject

initialize


50
51
52
53
54
55
# File 'app/models/open_tax_solver.rb', line 50

def run_open_tax_solver
	open_tax_solver_input="#{open_tax_solver_data_directory}/US_1040_Lawson.txt"
	open_tax_solver_sysout="#{open_tax_solver_data_directory}/US_1040_Lawson_sysout.txt"
	command="#{Open_tax_solver_binary} #{open_tax_solver_input} >#{open_tax_solver_sysout}"
	ShellCommands.new(command).assert_post_conditions
end

#run_open_tax_solver_to_fillerObject

run_open_tax_solver


56
57
58
59
# File 'app/models/open_tax_solver.rb', line 56

def run_open_tax_solver_to_filler
	command="nodejs #{@open_Tax_Filler_Directory}/script/json_ots.js #{@open_tax_solver_sysout} > #{Data_source_directory}/US_1040_OTS.json"
	ShellCommands.new(command).assert_post_conditions
end