Class: TaskJuggler::AccountListRE
- Inherits:
-
TableReport
- Object
- ReportBase
- TableReport
- TaskJuggler::AccountListRE
- Defined in:
- lib/taskjuggler/reports/AccountListRE.rb
Overview
This specialization of TableReport implements a task listing. It generates a list of tasks that can optionally have the allocated resources nested underneath each task line.
Instance Attribute Summary
Attributes inherited from TableReport
Instance Method Summary collapse
-
#generateIntermediateFormat ⇒ Object
Generate the table in the intermediate format.
-
#initialize(report) ⇒ AccountListRE
constructor
Create a new object and set some default values.
Methods inherited from TableReport
alignment, calculated?, defaultColumnTitle, indent, scenarioSpecific?, #to_csv, #to_html
Methods inherited from ReportBase
#a, #filterAccountList, #filterResourceList, #filterTaskList
Constructor Details
#initialize(report) ⇒ AccountListRE
Create a new object and set some default values.
27 28 29 30 31 32 |
# File 'lib/taskjuggler/reports/AccountListRE.rb', line 27 def initialize(report) super @table = ReportTable.new @table.selfcontained = report.get('selfcontained') @table.auxDir = report.get('auxdir') end |
Instance Method Details
#generateIntermediateFormat ⇒ Object
Generate the table in the intermediate format.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/taskjuggler/reports/AccountListRE.rb', line 35 def generateIntermediateFormat super # Prepare the account list. accountList = PropertyList.new(@project.accounts) accountList.setSorting(@report.get('sortAccounts')) accountList.query = @report.project.reportContexts.last.query accountList = filterAccountList(accountList, @report.get('hideAccount'), @report.get('rollupAccount'), @report.get('openNodes')) accountList.sort! # Generate the table header. @report.get('columns').each do |columnDescr| adjustColumnPeriod(columnDescr) generateHeaderCell(columnDescr) end if (costAccount = @report.get('costaccount')) && (revenueAccount = @report.get('revenueaccount')) # We are in balance mode. First show the cost and then the revenue # accounts and then the total balance. costAccountList = PropertyList.new(@project.accounts) costAccountList.clear costAccountList.setSorting(@report.get('sortAccounts')) costAccountList.query = @report.project.reportContexts.last.query revenueAccountList = PropertyList.new(@project.accounts) revenueAccountList.clear revenueAccountList.setSorting(@report.get('sortAccounts')) revenueAccountList.query = @report.project.reportContexts.last.query # Split the account list into a cost and a revenue account list. accountList.each do |account| if account.isChildOf?(costAccount) || account == costAccount costAccountList << account elsif account.isChildOf?(revenueAccount) || account == revenueAccount revenueAccountList << account end end # Make sure that the top-level cost and revenue accounts are always # included in the lists. unless costAccountList.include?(costAccount) costAccountList << costAccount end unless revenueAccountList.include?(revenueAccount) revenueAccountList << revenueAccount end generateAccountList(costAccountList, 0, nil) generateAccountList(revenueAccountList, costAccountList.length, nil) # To generate a total line that reports revenue minus cost, we create # a temporary Account object that adopts the cost and revenue # accounts. totalAccount = Account.new(@report.project, '0', "Total", nil) totalAccount.adopt(costAccount) totalAccount.adopt(revenueAccount) totalAccountList = PropertyList.new(@project.accounts) totalAccountList.clear totalAccountList.setSorting(@report.get('sortAccounts')) totalAccountList.query = @report.project.reportContexts.last.query totalAccountList << totalAccount generateAccountList(totalAccountList, costAccountList.length + revenueAccountList.length, nil) @report.project.removeAccount(totalAccount) else # We are not in balance mode. Simply show a list of all reports that # aren't filtered out. generateAccountList(accountList, 0, nil) end end |