mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-22 05:18:51 +00:00
Add more fields to revenue report as used by Aus
We currently maintain our own CSV generation script which could be replaced if we got all this information here.
This commit is contained in:
@@ -2745,7 +2745,17 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
report_header_to_hub: To Hub
|
||||
report_header_hub_code: Hub Code
|
||||
report_header_hub_id: Hub ID
|
||||
report_header_hub_business_number: "Hub Business Number"
|
||||
report_header_hub_legal_name: "Hub Legal Name"
|
||||
report_header_hub_contact_name: "Hub Contact Name"
|
||||
report_header_hub_email: "Hub Public Email"
|
||||
report_header_hub_owner_email: Hub Owner Email
|
||||
report_header_hub_phone: "Hub Phone Number"
|
||||
report_header_hub_address_line1: "Hub Address Line 1"
|
||||
report_header_hub_address_line2: "Hub Address Line 2"
|
||||
report_header_hub_address_city: "Hub Suburb"
|
||||
report_header_hub_address_zipcode: "Hub Postcode"
|
||||
report_header_hub_address_state_name: "Hub State"
|
||||
report_header_code: Code
|
||||
report_header_paid: Paid?
|
||||
report_header_delivery: Delivery?
|
||||
@@ -2780,6 +2790,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
report_header_total_tax: "Total Tax (%{currency_symbol})"
|
||||
report_header_total_excl_tax: "Total excl. tax (%{currency_symbol})"
|
||||
report_header_total_incl_tax: "Total incl. tax (%{currency_symbol})"
|
||||
report_header_total_orders: "Total Number of Orders"
|
||||
report_header_enterprise: Enterprise
|
||||
report_header_customer: Customer
|
||||
report_header_customer_code: Customer Code
|
||||
|
||||
@@ -19,11 +19,22 @@ module Reporting
|
||||
}
|
||||
end
|
||||
|
||||
def columns
|
||||
def columns # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
||||
{
|
||||
hub: proc { |orders| distributor(orders).name },
|
||||
hub_id: proc { |orders| distributor(orders).id },
|
||||
hub_business_number: proc { |orders| distributor(orders).abn },
|
||||
hub_legal_name: proc { |orders| distributor(orders).business_address&.company },
|
||||
hub_contact_name: proc { |orders| distributor(orders).contact_name },
|
||||
hub_email: proc { |orders| distributor(orders).email_address },
|
||||
hub_owner_email: proc { |orders| distributor(orders).owner.email },
|
||||
hub_phone: proc { |orders| distributor(orders).phone },
|
||||
hub_address_line1: proc { |orders| distributor(orders).address&.address1 },
|
||||
hub_address_line2: proc { |orders| distributor(orders).address&.address2 },
|
||||
hub_address_city: proc { |orders| distributor(orders).address&.city },
|
||||
hub_address_zipcode: proc { |orders| distributor(orders).address&.zipcode },
|
||||
hub_address_state_name: proc { |orders| distributor(orders).address&.state_name },
|
||||
total_orders: proc { |orders| orders.count },
|
||||
total_excl_tax: proc { |orders|
|
||||
orders.sum { |order| order.total - order.total_tax }
|
||||
},
|
||||
|
||||
@@ -32,7 +32,18 @@ describe "Revenues By Hub Reports" do
|
||||
expect(page.find("table.report__table thead tr").text).to have_content([
|
||||
"HUB",
|
||||
"HUB ID",
|
||||
"HUB BUSINESS NUMBER",
|
||||
"HUB LEGAL NAME",
|
||||
"HUB CONTACT NAME",
|
||||
"HUB PUBLIC EMAIL",
|
||||
"HUB OWNER EMAIL",
|
||||
"HUB PHONE NUMBER",
|
||||
"HUB ADDRESS LINE 1",
|
||||
"HUB ADDRESS LINE 2",
|
||||
"HUB SUBURB",
|
||||
"HUB POSTCODE",
|
||||
"HUB STATE",
|
||||
"TOTAL NUMBER OF ORDERS",
|
||||
"TOTAL EXCL. TAX ($)",
|
||||
"TOTAL TAX ($)",
|
||||
"TOTAL INCL. TAX ($)"
|
||||
@@ -41,7 +52,18 @@ describe "Revenues By Hub Reports" do
|
||||
expect(page.find("table.report__table tbody tr").text).to have_content([
|
||||
"Hub 1",
|
||||
order.distributor.id,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
"email@email.com",
|
||||
nil,
|
||||
"10 Lovely Street",
|
||||
nil,
|
||||
"Northwest Herndon",
|
||||
"20170",
|
||||
"Victoria",
|
||||
"1",
|
||||
order.total - order.total_tax,
|
||||
order.total_tax,
|
||||
order.total
|
||||
|
||||
Reference in New Issue
Block a user