|
|
|
@ -33,6 +33,8 @@ if require_dependency 'cost_reports_controller' |
|
|
|
|
# Overwrite a few mappings. |
|
|
|
|
def field_representation_map(key, value) |
|
|
|
|
case key.to_sym |
|
|
|
|
when :units then value.to_i |
|
|
|
|
when :spent_on then value.to_date |
|
|
|
|
when :activity_id then mapped value, Enumeration, l(:caption_material_costs) |
|
|
|
|
when :project_id then (l(:label_none) if value.to_i == 0) or Project.find(value.to_i).name |
|
|
|
|
when :user_id, :assigned_to_id then (l(:label_none) if value.to_i == 0) or User.find(value.to_i).name |
|
|
|
@ -44,6 +46,13 @@ if require_dependency 'cost_reports_controller' |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def show_result(row, unit_id = @unit_id) |
|
|
|
|
case unit_id |
|
|
|
|
when 0 then row.real_costs ? row.real_costs : '-' |
|
|
|
|
else row.units |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# Build an xls file from a cost report. |
|
|
|
|
def report_to_xls |
|
|
|
|
find_optional_project |
|
|
|
|