diff --git a/lib/reporting/report_row_builder.rb b/lib/reporting/report_row_builder.rb index 2beee3e631..96683138e1 100644 --- a/lib/reporting/report_row_builder.rb +++ b/lib/reporting/report_row_builder.rb @@ -80,6 +80,9 @@ module Reporting # Quantity elsif report.columns_format[column] == :quantity && report.html_render? format_quantity(value) + # Numeric + elsif report.columns_format[column] == :numeric + format_numeric(value) # Boolean elsif value.in? [true, false] format_boolean(value) @@ -89,9 +92,6 @@ module Reporting # Date elsif value.is_a?(Date) format_date(value) - # Numeric - elsif value.is_a?(Numeric) - format_numeric(value) # Default else value @@ -100,7 +100,7 @@ module Reporting # rubocop:enable Metrics/CyclomaticComplexity def format_currency(value) - number_to_currency(value, unit: Spree::Money.currency_symbol) + value.present? ? number_to_currency(value, unit: Spree::Money.currency_symbol) : "" end def format_quantity(value) diff --git a/lib/reporting/reports/sales_tax/base.rb b/lib/reporting/reports/sales_tax/base.rb index c3b5466870..399ee86231 100644 --- a/lib/reporting/reports/sales_tax/base.rb +++ b/lib/reporting/reports/sales_tax/base.rb @@ -20,13 +20,13 @@ module Reporting end def order_number_column(order) - if raw_render? - order.number - else + if html_render? url = Spree::Core::Engine.routes.url_helpers.edit_admin_order_path(order.number) <<-HTML #{order.number} HTML + else + order.number end end end diff --git a/spec/system/admin/reports_spec.rb b/spec/system/admin/reports_spec.rb index 91ac68f7bf..0c2676f64c 100644 --- a/spec/system/admin/reports_spec.rb +++ b/spec/system/admin/reports_spec.rb @@ -182,8 +182,8 @@ describe ' expect(page).to have_content order1.number.to_s # And the totals and sales tax should be correct - expect(page).to have_content "1,512.99" # items total - expect(page).to have_content "1,500.45" # taxable items total + expect(page).to have_content "1512.99" # items total + expect(page).to have_content "1500.45" # taxable items total expect(page).to have_content "250.08" # sales tax expect(page).to have_content "20.0" # enterprise fee tax @@ -559,7 +559,7 @@ describe ' xero_invoice_header, xero_invoice_summary_row('Total untaxable produce (no tax)', 12.54, 'GST Free Income'), - xero_invoice_summary_row('Total taxable produce (tax inclusive)', '1,500.45', + xero_invoice_summary_row('Total taxable produce (tax inclusive)', 1500.45, 'GST on Income'), xero_invoice_summary_row('Total untaxable fees (no tax)', 10.0, 'GST Free Income'), @@ -589,7 +589,7 @@ describe ' xero_invoice_header, xero_invoice_summary_row('Total untaxable produce (no tax)', 12.54, 'GST Free Income', opts), - xero_invoice_summary_row('Total taxable produce (tax inclusive)', '1,500.45', + xero_invoice_summary_row('Total taxable produce (tax inclusive)', 1500.45, 'GST on Income', opts), xero_invoice_summary_row('Total untaxable fees (no tax)', 10.0, 'GST Free Income', opts),