lib/taskjuggler/reports/NikuReport.rb in taskjuggler-0.0.11 vs lib/taskjuggler/reports/NikuReport.rb in taskjuggler-0.1.0
- old
+ new
@@ -116,33 +116,35 @@
end
tr << htmlTabCell('Total', true, 'center')
# The actual content. One line per resource.
table << (tbody = XMLElement.new('tbody'))
+ numberFormat = a('numberFormat')
@resourcesTotalEffort.keys.sort.each do |resourceId|
tbody << (tr = XMLElement.new('tr', 'class' => 'tabline'))
tr << htmlTabCell("#{@resources[resourceId].name} (#{resourceId})",
true, 'left')
@projects.keys.sort.each do |projectId|
next if projectTotal(projectId) <= 0.0
value = sum(projectId, resourceId)
- tr << htmlTabCell(value >= 0.01 ? format("%.2f", value) : '')
+ valStr = numberFormat.format(value)
+ valStr = '' if valStr.to_f == 0.0
+ tr << htmlTabCell(valStr)
end
- tr << htmlTabCell(format("%.2f", resourceTotal(resourceId)), true)
+ tr << htmlTabCell(numberFormat.format(resourceTotal(resourceId)), true)
end
# Project totals
tbody << (tr = XMLElement.new('tr', 'class' => 'tabline'))
tr << htmlTabCell('Total', 'true', 'left')
@projects.keys.sort.each do |projectId|
- next if projectTotal(projectId) <= 0.0
- tr << htmlTabCell(format("%.2f", projectTotal(projectId)), true,
- 'right')
+ next if (pTotal = projectTotal(projectId)) <= 0.0
+ tr << htmlTabCell(numberFormat.format(pTotal), true, 'right')
end
- tr << htmlTabCell(format("%.2f", total()), true, 'right')
+ tr << htmlTabCell(numberFormat.format(total()), true, 'right')
tableFrame
end
def to_niku
xml = XMLDocument.new
@@ -164,10 +166,11 @@
'objectType' => 'project',
'version' => '7.5.0')
nikuDataBus << (projects = XMLElement.new('Projects'))
timeFormat = '%Y-%m-%dT%H:%M:%S'
+ numberFormat = a('numberFormat')
@projects.keys.sort.each do |projectId|
prj = @projects[projectId]
projects << (project =
XMLElement.new('Project',
'name' => prj.name,
@@ -183,10 +186,11 @@
allocCurve << (XMLElement.new('Segment',
'start' =>
a('start').to_s(timeFormat),
'finish' =>
(a('end') - 1).to_s(timeFormat),
- 'sum' => sum(prj.id, res.id).to_s))
+ 'sum' => numberFormat.format(
+ sum(prj.id, res.id)).to_s))
end
# The custom information section usually contains Clarity installation
# specific parts. They are identical for each project section, so we
# mis-use the title attribute to insert them as an XML blob.