OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix column format for simple report
ulfertsd0cb49219705
diff --git a/modules/xls_export/lib/open_project/xls_export/xls_views/simple_cost_report_table.xls.rb b/modules/xls_export/lib/open_project/xls_export/xls_views/simple_cost_report_table.xls.rbindex 61f01fc06bb..cd4910ea0c1 100644--- a/modules/xls_export/lib/open_project/xls_export/xls_views/simple_cost_report_table.xls.rb+++ b/modules/xls_export/lib/open_project/xls_export/xls_views/simple_cost_report_table.xls.rb@@ -2,17 +2,31 @@ require_relative './one_dimensional_table.xls'class OpenProject::XlsExport::XlsViews::SimpleCostReportTable < OpenProject::XlsExport::XlsViews::OneDimensionalTabledef format_columns(spreadsheet)- spreadsheet.add_format_option_to_column(headers.length - 1, number_format: currency_format)- spreadsheet.add_format_option_to_column(headers.length - 2, number_format: number_format) if show_units?+ column_count = headers.size++ if column_count - exported_fields.size == 1+ spreadsheet.add_format_option_to_column(column_count - 1, number_format: currency_format)+ elsif column_count - exported_fields.size == 2+ spreadsheet.add_format_option_to_column(column_count - 2, number_format: number_format)+ else+ spreadsheet.add_format_option_to_column(column_count - 2, number_format: number_format)+ spreadsheet.add_format_option_to_column(column_count - 4, number_format: currency_format)+ end+ end++ def build_cost_rows(spreadsheet)+ query.each do |result|+ spreadsheet.add_row(cost_row(result))+ endenddef cost_row(result)current_cost_type_id = result.fields[:cost_type_id].to_irow = [show_row(result)]row << show_result(result, current_cost_type_id) if show_units?- row << cost_type_unit_label(current_cost_type_id, @cost_type) if show_units?+ row << cost_type_unit_label(current_cost_type_id, cost_type) if show_units?row << show_result(result)- row << cost_type_unit_label(@unit_id, @cost_type)+ row << cost_type_unit_label(unit_id, cost_type) if show_unit_label?rowend@@ -20,13 +34,17 @@ class OpenProject::XlsExport::XlsViews::SimpleCostReportTable < OpenProject::Xlsdef build_footer(spreadsheet)footer = [''] * exported_fields.sizefooter += ['', ''] if show_units?- spreadsheet.add_row(footer + [show_result(query), cost_type_unit_label(@unit_id, @cost_type)]) # footer+ footer << show_result(query)+ footer << cost_type_unit_label(unit_id, cost_type) if show_unit_label?++ spreadsheet.add_row(footer)enddef headersheaders = exported_fields.collect { |field| label_for(field) }- headers << label_for(:field_units) << "" if show_units?- headers << label_for(:label_sum) << ""+ headers << CostEntry.human_attribute_name(:costs) << "" if show_units?+ headers << label_for(:label_sum)+ headers << "" if show_unit_label?headersend@@ -36,6 +54,10 @@ class OpenProject::XlsExport::XlsViews::SimpleCostReportTable < OpenProject::Xlsenddef show_units?- @query.collect(&:important_fields).flatten.uniq.include? "cost_type_id"+ cost_type.present?+ end++ def show_unit_label?+ unit_id != 0endend