Class: TaskJuggler::AccountScenario
- Inherits:
-
ScenarioData
- Object
- ScenarioData
- TaskJuggler::AccountScenario
- Defined in:
- lib/taskjuggler/AccountScenario.rb
Overview
This class handles the scenario specific features of a Account object.
Instance Attribute Summary
Attributes inherited from ScenarioData
Instance Method Summary collapse
-
#initialize(account, scenarioIdx, attributes) ⇒ AccountScenario
constructor
A new instance of AccountScenario.
- #query_balance(query) ⇒ Object
- #query_turnover(query) ⇒ Object
Methods inherited from ScenarioData
#a, #deep_clone, #error, #info, #warning
Constructor Details
#initialize(account, scenarioIdx, attributes) ⇒ AccountScenario
Returns a new instance of AccountScenario.
21 22 23 24 25 26 |
# File 'lib/taskjuggler/AccountScenario.rb', line 21 def initialize(account, scenarioIdx, attributes) super %w( credits ).each do |attr| @property[attr, @scenarioIdx] end end |
Instance Method Details
#query_balance(query) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/taskjuggler/AccountScenario.rb', line 28 def query_balance(query) # The account balance is the turnover from project start (index 0) to # the start of the query period. It's the start because that's what the # label in the column header says. startIdx = 0 endIdx = @project.dateToIdx(query.start) query.sortable = query.numerical = amount = turnover(startIdx, endIdx) query.string = query.currencyFormat.format(amount) end |
#query_turnover(query) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/taskjuggler/AccountScenario.rb', line 39 def query_turnover(query) startIdx = @project.dateToIdx(query.start) endIdx = @project.dateToIdx(query.end) query.sortable = query.numerical = amount = turnover(startIdx, endIdx) query.string = query.currencyFormat.format(amount) end |