Extract translations from lib folder

This commit is contained in:
Julius Pabrinkis
2017-05-10 17:47:18 +01:00
committed by Maikel Linke
parent 60060a7017
commit 55b2c19b64
21 changed files with 487 additions and 171 deletions

View File

@@ -37,6 +37,37 @@ Spree::Admin::ReportsController.class_eval do
render_to_string(partial: 'sales_tax_description', layout: false, locals: {report_types: report_types[:sales_tax]}).html_safe
} } }
def report_types
{
orders_and_fulfillment: [
[I18n.t('admin.reports.supplier_totals'), :order_cycle_supplier_totals],
[I18n.t('admin.reports.supplier_totals_by_distributor'), :order_cycle_supplier_totals_by_distributor],
[I18n.t('admin.reports.totals_by_supplier'), :order_cycle_distributor_totals_by_supplier],
[I18n.t('admin.reports.customer_totals'), :order_cycle_customer_totals]
],
products_and_inventory: [
[I18n.t('admin.reports.all_products'), :all_products],
[I18n.t('admin.reports.inventory'), :inventory],
[I18n.t('admin.reports.lettuce_share'), :lettuce_share]
],
customers: [
[I18n.t('admin.reports.mailing_list'), :mailing_list],
[I18n.t('admin.reports.addresses'), :addresses]
],
order_cycle_management: [
[I18n.t('admin.reports.payment_methods'), :payment_methods],
[I18n.t('admin.reports.delivery'), :delivery]
],
sales_tax: [
[I18n.t('admin.reports.tax_types'), :tax_types],
[I18n.t('admin.reports.tax_rates'), :tax_rates]
],
packing: [
[I18n.t('admin.reports.pack_by_customer'), :pack_by_customer],
[I18n.t('admin.reports.pack_by_supplier'), :pack_by_supplier]
]
}
end
# Overide spree reports list.
def index
@@ -254,38 +285,6 @@ Spree::Admin::ReportsController.class_eval do
end
private
def report_types
{
orders_and_fulfillment: [
[I18n.t('admin.reports.supplier_totals'), :order_cycle_supplier_totals],
[I18n.t('admin.reports.supplier_totals_by_distributor'), :order_cycle_supplier_totals_by_distributor],
[I18n.t('admin.reports.totals_by_supplier'), :order_cycle_distributor_totals_by_supplier],
[I18n.t('admin.reports.customer_totals'), :order_cycle_customer_totals]
],
products_and_inventory: [
[I18n.t('admin.reports.all_products'), :all_products],
[I18n.t('admin.reports.inventory'), :inventory],
[I18n.t('admin.reports.lettuce_share'), :lettuce_share]
],
customers: [
[I18n.t('admin.reports.mailing_list'), :mailing_list],
[I18n.t('admin.reports.addresses'), :addresses]
],
order_cycle_management: [
[I18n.t('admin.reports.payment_methods'), :payment_methods],
[I18n.t('admin.reports.delivery'), :delivery]
],
sales_tax: [
[I18n.t('admin.reports.tax_types'), :tax_types],
[I18n.t('admin.reports.tax_rates'), :tax_rates]
],
packing: [
[I18n.t('admin.reports.pack_by_customer'), :pack_by_customer],
[I18n.t('admin.reports.pack_by_supplier'), :pack_by_supplier]
]
}
end
def prepare_date_params(params)
# -- Prepare parameters

View File

@@ -140,7 +140,8 @@ en:
current: Current
available: Available
dashboard: Dashboard
'yes': "Yes"
'no': "No"
admin:
# Common properties / models
date: Date
@@ -206,6 +207,10 @@ en:
finalise_user_invoices: "Finalise User Invoices"
finalise_user_invoice_explained: "Use this button to finalize all invoices in the system for the previous calendar month. This task can be set up to run automatically once a month."
update_user_invoices: "Update User Invoices"
errors:
accounts_distributor: must be set if you wish to create invoices for enterprise users.
default_payment_method: must be set if you wish to create invoices for enterprise users.
default_shipping_method: must be set if you wish to create invoices for enterprise users.
business_model_configuration:
edit:
@@ -628,8 +633,22 @@ en:
zero: order cycle
one: order cycle
other: order cycles
enterprise_issues:
create_new: Create New
resend_email: Resend Email
no_shipping: no shipping methods
no_payment: no payment methods
no_shipping_or_payment: no shipping or payment methods
unconfirmed: unconfirmed
has_no_payment_methods: "%{enterprise} currently has no payment methods"
has_no_shipping_methods: "%{enterprise} currently has no shipping methods"
email_confirmation: "Email confirmation is pending. We've sent a confirmation email to #{email}."
not_visible: "%{enterprise} is not visible and so cannot be found on the map or in searches"
reports:
hidden: HIDDEN
unitsize: UNITSIZE
total: TOTAL
total_items: TOTAL ITEMS
supplier_totals: Order Cycle Supplier Totals
supplier_totals_by_distributor: Order Cycle Supplier Totals by Distributor
totals_by_supplier: Order Cycle Distributor Totals by Supplier
@@ -1466,7 +1485,11 @@ Please follow the instructions there to make your enterprise visible on the Open
price: "Price"
on_hand: "On hand"
save_changes: "Save Changes"
<<<<<<< HEAD
order_saved: "Order Saved"
=======
no_products: No Products
>>>>>>> Extract translations from lib folder
spree_admin_overview_enterprises_header: "My Enterprises"
spree_admin_overview_enterprises_footer: "MANAGE MY ENTERPRISES"
spree_admin_enterprises_hubs_name: "Name"
@@ -1551,11 +1574,60 @@ Please follow the instructions there to make your enterprise visible on the Open
report_order_cycle: "Order Cycle: "
report_entreprises: "Enterprises: "
report_users: "Users: "
report_tax_rates: "Tax rates"
report_tax_types: "Tax types"
report_header_order_number: "Order number"
report_header_date: "Date"
report_header_items: "Items"
report_tax_rates: Tax rates
report_tax_types: Tax types
report_tax_type: Tax type
report_header_tracking_name_1: Tracking Name 1
report_header_tracking_name_2: Tracking Name 2
report_header_tracking_option_1: Tracking Option 1
report_header_tracking_option_2: Tracking Option 2
report_header_branding_theme: Branding Theme
report_header_currency: Currency
report_header_order_cycle: Order Cycle
report_header_user: User
report_header_email: Email
report_header_status: Status
report_header_comments: Comments
report_header_contact_name: Contact Name
report_header_first_name: First Name
report_header_last_name: Last Name
report_header_suburb: Suburb
report_header_phone: Phone
report_header_suburb: Suburb
report_header_address: Address
report_header_billing_address: Billing Address
report_header_relationship: Relationship
report_header_hub: Hub
report_header_to_hub: To Hub
report_header_hub_code: Hub code
report_header_paid: Paid?
report_header_delivery: Delivery?
report_header_shipping: Shipping
report_header_shipping_method: Shipping Method
report_header_shipping_instructions: Shipping instructions
report_header_ship_street: Ship Street
report_header_ship_street_2: Ship Street 2
report_header_ship_city: Ship City
report_header_ship_postcode: Ship Postcode
report_header_ship_state: Ship State
report_header_billing_street: Billing Street
report_header_billing_street_2: Billing Street 2
report_header_billing_city: Billing City
report_header_billing_postcode: Billing Postcode
report_header_billing_region: Billing Region
report_header_billing_state: Billing State
report_header_billing_country: Billing Country
report_header_incoming_transport: Incoming Transport
report_header_special_instructions: Special instructions
report_header_order_number: Order number
report_header_invoice_number: Invoice number
report_header_reference: Reference
report_header_invoice_date: Invoice date
report_header_due_date: Due date
report_header_date: Date
report_header_confirmation_date: Confirmation Date
report_header_tags: Tags
report_header_items: Items
report_header_items_total: "Items total %{currency_symbol}"
report_header_taxable_items_total: "Taxable Items Total (%{currency_symbol})"
report_header_sales_tax: "Sales Tax (%{currency_symbol})"
@@ -1563,10 +1635,104 @@ Please follow the instructions there to make your enterprise visible on the Open
report_header_tax_on_delivery: "Tax on Delivery (%{currency_symbol})"
report_header_tax_on_fees: "Tax on Fees (%{currency_symbol})"
report_header_total_tax: "Total Tax (%{currency_symbol})"
report_header_customer: "Customer"
report_header_distributor: "Distributor"
report_header_enterprise: Enterprise
report_header_customer: Customer
report_header_customer_code: Customer Code
report_header_product: Product
report_header_product_properties: Product Properties
report_header_description: Description
report_header_qty: Qty
report_header_quantity: Quantity
report_header_max_quantity: Max Quantity
report_header_variant: Variant
report_header_variant_value: Variant Value
report_header_variant_unit: Variant Unit
report_header_total_available: Total available
report_header_unallocated: Unallocated
report_header_max_quantity_excess: Max Quantity Excess
report_header_taxon: Taxon
report_header_taxons: Taxons
report_header_supplier: Supplier
report_header_producer: Producer
report_header_producer_suburb: Producer Suburb
report_header_unit: Unit
report_header_group_buy_unit_quantity: Group by unit quantity
report_header_cost: Cost
report_header_shipping_cost: Shipping Cost
report_header_curr_cost_per_unit: Curr. Cost per Unit
report_header_total_shipping_cost: Total Shipping Cost
report_header_payment_method: Payment Method
report_header_sells: Sells
report_header_visible: Visible
report_header_unit_price: Unit Price
report_header_price: Price
report_header_unit_size: Unit Size
report_header_pack_size: Pack Size
report_header_distributor: Distributor
report_header_distributor_address: Distributor address
report_header_distributor_city: Distributor city
report_header_distributor_postcode: Distributor postcode
report_header_delivery_address: Delivery Address
report_header_delivery_postcode: Delivery Postcode
report_header_bulk_unit_size: Bulk Unit Size
report_header_weight: Weight
report_header_sum_total: Sum Total
report_header_date_of_order: Date of Order
report_header_amount_owing: Amount Owing
report_header_amount_paid: Amount Paid
report_header_units_required: Units Required
report_header_remainder: Remainder
report_header_order_date: Order date
report_header_order_id: Order Id
report_header_item_name: Item name
report_header_inventory_item_code: Inventory Item Code
report_header_temp_controlled_items: Temp Controlled Items?
report_header_customer_name: Customer Name
report_header_customer_email: Customer Email
report_header_customer_phone: Customer Phone
report_header_customer_city: Customer City
report_header_payment_state: Payment State
report_header_payment_type: Payment Type
report_header_item_price: "Item (%{currency})"
report_header_item_fees_price: "Item + Fees (%{currency})"
report_header_admin_handling_fees: "Admin & Handling (%{currency})"
report_header_ship_price: "Ship (%{currency})"
report_header_pay_fee_price: "Pay fee (%{currency})"
report_header_total_price: "Total (%{currency})"
report_header_product_total_price: "Product Total (%{currency})"
report_header_shipping_total_price: "Shipping Total (%{currency})"
report_header_outstanding_balance_price: "Outstanding Balance (%{currency})"
report_header_eft_price: "EFT (%{currency})"
report_header_paypal_price: "PayPal (%{currency})"
report_header_sku: SKU
report_header_amount: Amount
report_header_unit_amount: Unit Amount
report_header_discount: Discount
report_header_account_code: Account code
report_header_balance: Balance
report_header_total: Total
report_header_total_cost: "Total Cost"
report_header_total_ordered: Total Ordered
report_header_total_max: Total Max
report_header_total_units: Total Units
report_header_sum_max_total: "Sum Max Total"
report_header_total_excl_vat: "Total excl. tax (%{currency_symbol})"
report_header_total_incl_vat: "Total incl. tax (%{currency_symbol})"
report_header_gst_incl: GST incl.
report_header_grower_and_method: Grower and growing method
report_header_temp_controlled: TempControlled?
report_header_is_producer: Producer?
report_header_not_confirmed: Not Confirmed
report_header_gst_on_income: GST on Income
report_header_gst_free_income: GST Free Income
report_header_total_untaxable_produce: Total untaxable produce (no tax)
report_header_total_taxable_produce: Total taxable produce (tax inclusive)
report_header_total_untaxable_fees: Total untaxable fees (no tax)
report_header_total_taxable_fees: Total taxable fees (tax inclusive)
report_header_delivery_shipping_cost: Delivery Shipping Cost (tax inclusive)
report_header_transaction_fee: Transaction Fee (no tax)
report_header_total_untaxable_admin: Total untaxable admin adjustments (no tax)
report_header_total_taxable_admin: Total taxable admin adjustments (tax inclusive)
initial_invoice_number: "Initial invoice number:"
invoice_date: "Invoice date:"
due_date: "Due date:"
@@ -1601,10 +1767,11 @@ Please follow the instructions there to make your enterprise visible on the Open
shipping_methods: "Shipping Methods"
payment_methods: "Payment Methods"
payment_method_fee: "Transaction fee"
enterprise_fees: "Enterprise Fees"
inventory_settings: "Inventory Settings"
tag_rules: "Tag Rules"
shop_preferences: "Shop Preferences"
enterprise_fee_whole_order: Whole order
enterprise_fee_by: fee by
validation_msg_relationship_already_established: "^That relationship is already established."
validation_msg_at_least_one_hub: "^At least one hub must be selected"
validation_msg_product_category_cant_be_blank: "^Product Category cant be blank"

View File

@@ -20,21 +20,21 @@ module OpenFoodNetwork
def ensure_accounts_distributor_set
unless Enterprise.find_by_id(accounts_distributor_id)
errors.add(:accounts_distributor, "must be set if you wish to create invoices for enterprise users.")
errors.add(:accounts_distributor, I18n.t('admin.accounts_and_billing_settings.errors.accounts_distributor'))
end
end
def ensure_default_payment_method_set
unless Enterprise.find_by_id(accounts_distributor_id) &&
Enterprise.find_by_id(accounts_distributor_id).payment_methods.find_by_id(default_accounts_payment_method_id)
errors.add(:default_payment_method, "must be set if you wish to create invoices for enterprise users.")
errors.add(:default_payment_method, I18n.t('admin.accounts_and_billing_settings.errors.default_payment_method'))
end
end
def ensure_default_shipping_method_set
unless Enterprise.find_by_id(accounts_distributor_id) &&
Enterprise.find_by_id(accounts_distributor_id).shipping_methods.find_by_id(default_accounts_shipping_method_id)
errors.add(:default_shipping_method, "must be set if you wish to create invoices for enterprise users.")
errors.add(:default_shipping_method, I18n.t('admin.accounts_and_billing_settings.errors.default_shipping_method'))
end
end
end

View File

@@ -19,11 +19,27 @@ module OpenFoodNetwork
when "bulk_coop_allocation"
@allocation_report.header
when "bulk_coop_packing_sheets"
["Customer", "Product", "Variant", "Sum Total"]
[I18n.t(:report_header_customer),
I18n.t(:report_header_product),
I18n.t(:report_header_variant),
I18n.t(:report_header_sum_total)]
when "bulk_coop_customer_payments"
["Customer", "Date of Order", "Total Cost", "Amount Owing", "Amount Paid"]
[I18n.t(:report_header_customer),
I18n.t(:report_header_date_of_order),
I18n.t(:report_header_total_cost),
I18n.t(:report_header_amount_owing),
I18n.t(:report_header_amount_paid)]
else
["Supplier", "Product", "Bulk Unit Size", "Variant", "Weight", "Sum Total", "Sum Max Total", "Units Required", "Remainder"]
[I18n.t(:report_header_supplier),
I18n.t(:report_header_product),
I18n.t(:report_header_product),
I18n.t(:report_header_bulk_unit_size),
I18n.t(:report_header_variant),
I18n.t(:report_header_weight),
I18n.t(:report_header_sum_total),
I18n.t(:report_header_sum_max_total),
I18n.t(:report_header_units_required),
I18n.t(:report_header_remainder)]
end
end
@@ -42,9 +58,9 @@ module OpenFoodNetwork
line_items.select{ |li| line_items_with_hidden_details.include? li }.each do |line_item|
# TODO We should really be hiding customer code here too, but until we
# have an actual association between order and customer, it's a bit tricky
line_item.order.bill_address.andand.assign_attributes(firstname: "HIDDEN", lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.ship_address.andand.assign_attributes(firstname: "HIDDEN", lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.assign_attributes(email: "HIDDEN")
line_item.order.bill_address.andand.assign_attributes(firstname: I18n.t('admin.reports.hidden'), lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.ship_address.andand.assign_attributes(firstname: I18n.t('admin.reports.hidden'), lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.assign_attributes(email: I18n.t('admin.reports.hidden'))
end
line_items
end

View File

@@ -14,11 +14,11 @@ module OpenFoodNetwork
end
def products_json
raise NoProducts.new("No Products") if @distributor.nil? || @order_cycle.nil?
raise NoProducts.new(I18n.t(:no_products)) if @distributor.nil? || @order_cycle.nil?
products_json = cached_products_json
raise NoProducts.new("No Products") if products_json.nil?
raise NoProducts.new(I18n.t(:no_products)) if products_json.nil?
products_json
end

View File

@@ -8,9 +8,19 @@ module OpenFoodNetwork
def header
if is_mailing_list?
["Email", "First Name", "Last Name", "Suburb"]
[I18n.t(:report_header_email),
I18n.t(:report_header_first_name),
I18n.t(:report_header_last_name),
I18n.t(:report_header_suburb)]
else
["First Name", "Last Name", "Billing Address", "Email", "Phone", "Hub", "Hub Address", "Shipping Method"]
[I18n.t(:report_header_first_name),
I18n.t(:report_header_last_name),
I18n.t(:report_header_billing_address),
I18n.t(:report_header_email),
I18n.t(:report_header_phone),
I18n.t(:report_header_hub),
I18n.t(:report_header_hub_address),
I18n.t(:report_header_shipping_method)]
end
end

View File

@@ -24,11 +24,11 @@ module OpenFoodNetwork
end
def order_adjustment_label
"Whole order - #{base_adjustment_label}"
"#{I18n.t(:enterprise_fee_whole_order)} - #{base_adjustment_label}"
end
def base_adjustment_label
"#{enterprise_fee.fee_type} fee by #{role} #{enterprise_fee.enterprise.name}"
"#{enterprise_fee.fee_type} #{I18n.t(:enterprise_fee_by)} #{role} #{enterprise_fee.enterprise.name}"
end
def adjustment_tax(adjustable, adjustment)

View File

@@ -11,18 +11,18 @@ module OpenFoodNetwork
issues = []
issues << {
description: "#{@enterprise.name} currently has no shipping methods.",
link: "<a class='button fullwidth' href='#{spree.new_admin_shipping_method_path}'>Create New</a>"
description: I18n.t('admin.enterprise_issues.has_no_shipping_methods', enterprise: @enterprise.name),
link: "<a class='button fullwidth' href='#{spree.new_admin_shipping_method_path}'>#{I18n.t('admin.enterprise_issues.create_new')}</a>"
} unless shipping_methods_ok?
issues << {
description: "#{@enterprise.name} currently has no payment methods.",
link: "<a class='button fullwidth' href='#{spree.new_admin_payment_method_path}'>Create New</a>"
description: I18n.t('admin.enterprise_issues.has_no_payment_methods', enterprise: @enterprise.name),
link: "<a class='button fullwidth' href='#{spree.new_admin_payment_method_path}'>#{I18n.t('admin.enterprise_issues.create_new')}</a>"
} unless payment_methods_ok?
issues << {
description: "Email confirmation is pending. We've sent a confirmation email to #{@enterprise.email}.",
link: "<a class='button fullwidth' href='#{enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: @enterprise.email } )}' method='post'>Resend Email</a>"
description: I18n.t('admin.enterprise_issues.email_confirmation', email: @enterprise.email),
link: "<a class='button fullwidth' href='#{enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: @enterprise.email } )}' method='post'>#{I18n.t('admin.enterprise_issues.resend_email')}</a>"
} unless confirmed?
issues
@@ -30,13 +30,13 @@ module OpenFoodNetwork
def issues_summary(opts={})
if !opts[:confirmation_only] && !shipping_methods_ok? && !payment_methods_ok?
'no shipping or payment methods'
I18n.t('admin.enterprise_issues.no_shipping_or_payment')
elsif !opts[:confirmation_only] && !shipping_methods_ok?
'no shipping methods'
I18n.t('admin.enterprise_issues.no_shipping')
elsif !opts[:confirmation_only] && !payment_methods_ok?
'no payment methods'
I18n.t('admin.enterprise_issues.no_payment')
elsif !confirmed?
'unconfirmed'
I18n.t('admin.enterprise_issues.unconfirmed')
end
end
@@ -44,8 +44,8 @@ module OpenFoodNetwork
warnings = []
warnings << {
description: "#{@enterprise.name} is not visible and so cannot be found on the map or in searches",
link: "<a class='button fullwidth' href='#{edit_admin_enterprise_path(@enterprise)}'>Edit</a>"
description: I18n.t('admin.enterprise_issues.not_visible', enterprise: @enterprise.name),
link: "<a class='button fullwidth' href='#{edit_admin_enterprise_path(@enterprise)}'>#{I18n.t(:edit)}</a>"
} unless @enterprise.visible
warnings

View File

@@ -2,13 +2,13 @@ module OpenFoodNetwork
GroupBuyVariantRow = Struct.new(:variant, :sum_quantities, :sum_max_quantities) do
def to_row
[variant.product.supplier.name, variant.product.name, "UNITSIZE", variant.options_text, variant.weight, sum_quantities, sum_max_quantities]
[variant.product.supplier.name, variant.product.name, I18n.t('admin.reports.unitsize'), variant.options_text, variant.weight, sum_quantities, sum_max_quantities]
end
end
GroupBuyProductRow = Struct.new(:product, :sum_quantities, :sum_max_quantities) do
def to_row
[product.supplier.name, product.name, "UNITSIZE", "TOTAL", "", sum_quantities, sum_max_quantities]
[product.supplier.name, product.name, I18n.t('admin.reports.unitsize'), I18n.t('admin.reports.total'), "", sum_quantities, sum_max_quantities]
end
end
@@ -18,7 +18,13 @@ module OpenFoodNetwork
end
def header
["Supplier", "Product", "Unit Size", "Variant", "Weight", "Total Ordered", "Total Max"]
[I18n.t(:report_header_supplier),
I18n.t(:report_header_product),
I18n.t(:report_header_unit_size),
I18n.t(:report_header_variant),
I18n.t(:report_header_weight),
I18n.t(:report_header_total_ordered),
I18n.t(:report_header_total_max)]
end
def variants_and_quantities
@@ -33,7 +39,7 @@ module OpenFoodNetwork
variant_groups = line_items_by_product.group_by { |li| li.variant }
variant_groups.each do |variant, line_items_by_variant|
sum_quantities = line_items_by_variant.sum { |li| li.quantity }
sum_max_quantities = line_items_by_variant.sum { |li| li.max_quantity || 0 }
sum_max_quantities = line_items_by_variant.sum { |li| li.max_quantity || 0 }
variants_and_quantities << GroupBuyVariantRow.new(variant, sum_quantities, sum_max_quantities)
end

View File

@@ -4,16 +4,16 @@ module OpenFoodNetwork
class LettuceShareReport < ProductsAndInventoryReportBase
def header
[
"PRODUCT",
"Description",
"Qty",
"Pack Size",
"Unit",
"Unit Price",
"Total",
"GST incl.",
"Grower and growing method",
"Taxon"
I18n.t(:report_header_product),
I18n.t(:report_header_description),
I18n.t(:report_header_qty),
I18n.t(:report_header_pack_size),
I18n.t(:report_header_unit),
I18n.t(:report_header_unit_price),
I18n.t(:report_header_total),
I18n.t(:report_header_gst_incl),
I18n.t(:report_header_grower_and_method),
I18n.t(:report_header_taxon)
]
end

View File

@@ -6,11 +6,25 @@ module OpenFoodNetwork
end
def header
["Order date", "Order Id",
"Customer Name","Customer Email", "Customer Phone", "Customer City",
"SKU", "Item name", "Variant", "Quantity", "Max Quantity", "Cost", "Shipping cost",
"Payment method",
"Distributor", "Distributor address", "Distributor city", "Distributor postcode", "Shipping instructions"]
[I18n.t(:report_header_order_date),
I18n.t(:report_header_order_id),
I18n.t(:report_header_customer_name),
I18n.t(:report_header_customer_email),
I18n.t(:report_header_customer_phone),
I18n.t(:report_header_customer_city),
I18n.t(:report_header_sku),
I18n.t(:report_header_item_name),
I18n.t(:report_header_variant),
I18n.t(:report_header_quantity),
I18n.t(:report_header_max_quantity),
I18n.t(:report_header_cost),
I18n.t(:report_header_shipping_cost),
I18n.t(:report_header_payment_method),
I18n.t(:report_header_distributor),
I18n.t(:report_header_distributor_address),
I18n.t(:report_header_distributor_city),
I18n.t(:report_header_distributor_postcode),
I18n.t(:report_header_shipping_instructions)]
end
def table

View File

@@ -10,9 +10,30 @@ module OpenFoodNetwork
def header
if is_payment_methods?
["First Name", "Last Name", "Hub", "Hub Code", "Email", "Phone", "Shipping Method", "Payment Method", "Amount", "Balance"]
[I18n.t(:report_header_first_name),
I18n.t(:report_header_last_name),
I18n.t(:report_header_hub),
I18n.t(:report_header_hub_code),
I18n.t(:report_header_email),
I18n.t(:report_header_phone),
I18n.t(:report_header_shipping_method),
I18n.t(:report_header_payment_method),
I18n.t(:report_header_amount),
I18n.t(:report_header_balance)]
else
["First Name", "Last Name", "Hub", "Hub Code", "Delivery Address", "Delivery Postcode", "Phone", "Shipping Method", "Payment Method", "Amount", "Balance", "Temp Controlled Items?", "Special Instructions"]
[I18n.t(:report_header_first_name),
I18n.t(:report_header_last_name),
I18n.t(:report_header_hub),
I18n.t(:report_header_hub_code),
I18n.t(:report_header_delivery_address),
I18n.t(:report_header_delivery_postcode),
I18n.t(:report_header_phone),
I18n.t(:report_header_shipping_method),
I18n.t(:report_header_payment_method),
I18n.t(:report_header_amount),
I18n.t(:report_header_balance),
I18n.t(:report_header_temp_controlled_items),
I18n.t(:report_header_special_instructions)]
end
end

View File

@@ -10,30 +10,38 @@ module OpenFoodNetwork
def header
case params[:report_type]
when "order_cycle_supplier_totals"
["Producer", "Product", "Variant", "Amount", "Total Units", "Curr. Cost per Unit", "Total Cost", "Status", "Incoming Transport"]
[I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant), I18n.t(:report_header_amount),
I18n.t(:report_header_total_units), I18n.t(:report_header_curr_cost_per_unit), I18n.t(:report_header_total_cost),
I18n.t(:report_header_status), I18n.t(:report_header_incoming_transport)]
when "order_cycle_supplier_totals_by_distributor"
["Producer", "Product", "Variant", "To Hub", "Amount", "Curr. Cost per Unit", "Total Cost", "Shipping Method"]
[I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant), I18n.t(:report_header_to_hub),
I18n.t(:report_header_amount), I18n.t(:report_header_curr_cost_per_unit), I18n.t(:report_header_total_cost),
I18n.t(:report_header_shipping_method)]
when "order_cycle_distributor_totals_by_supplier"
["Hub", "Producer", "Product", "Variant", "Amount", "Curr. Cost per Unit", "Total Cost", "Total Shipping Cost", "Shipping Method"]
[I18n.t(:report_header_hub), I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant),
I18n.t(:report_header_amount), I18n.t(:report_header_curr_cost_per_unit), I18n.t(:report_header_total_cost),
I18n.t(:report_header_total_shipping_cost), I18n.t(:report_header_shipping_method)]
when "order_cycle_customer_totals"
["Hub", "Customer", "Email", "Phone", "Producer", "Product", "Variant",
"Amount",
"Item (#{currency_symbol})",
"Item + Fees (#{currency_symbol})",
"Admin & Handling (#{currency_symbol})",
"Ship (#{currency_symbol})",
"Pay fee (#{currency_symbol})",
"Total (#{currency_symbol})",
"Paid?",
"Shipping", "Delivery?",
"Ship Street", "Ship Street 2", "Ship City", "Ship Postcode", "Ship State",
"Comments", "SKU",
"Order Cycle", "Payment Method", "Customer Code", "Tags",
"Billing Street 1", "Billing Street 2", "Billing City", "Billing Postcode", "Billing State"
[I18n.t(:report_header_hub), I18n.t(:report_header_customer), I18n.t(:report_header_email), I18n.t(:report_header_phone),
I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant), I18n.t(:report_header_amount),
I18n.t(:report_header_item_price, currency: currency_symbol),
I18n.t(:report_header_item_fees_price, currency: currency_symbol),
I18n.t(:report_header_admin_handling_fees, currency: currency_symbol),
I18n.t(:report_header_ship_price, currency: currency_symbol),
I18n.t(:report_header_pay_fee_price, currency: currency_symbol),
I18n.t(:report_header_total_price, currency: currency_symbol),
I18n.t(:report_header_paid), I18n.t(:report_header_shipping), I18n.t(:report_header_delivery),
I18n.t(:report_header_ship_street), I18n.t(:report_header_ship_street_2), I18n.t(:report_header_ship_city), I18n.t(:report_header_ship_postcode), I18n.t(:report_header_ship_state),
I18n.t(:report_header_comments), I18n.t(:report_header_sku),
I18n.t(:report_header_order_cycle), I18n.t(:report_header_payment_method), I18n.t(:report_header_customer_code), I18n.t(:report_header_tags),
I18n.t(:report_header_billing_street), I18n.t(:report_header_billing_street_2), I18n.t(:report_header_billing_city), I18n.t(:report_header_billing_postcode), I18n.t(:report_header_billing_state),
]
else
["Producer", "Product", "Variant", "Amount", "Curr. Cost per Unit", "Total Cost", "Status", "Incoming Transport"]
[I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant),
I18n.t(:report_header_amount), I18n.t(:report_header_curr_cost_per_unit), I18n.t(:report_header_total_cost),
I18n.t(:report_header_status), I18n.t(:report_header_incoming_transport)]
end
end
@@ -55,9 +63,9 @@ module OpenFoodNetwork
line_items.select{ |li| line_items_with_hidden_details.include? li }.each do |line_item|
# TODO We should really be hiding customer code here too, but until we
# have an actual association between order and customer, it's a bit tricky
line_item.order.bill_address.andand.assign_attributes(firstname: "HIDDEN", lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.ship_address.andand.assign_attributes(firstname: "HIDDEN", lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.assign_attributes(email: "HIDDEN")
line_item.order.bill_address.andand.assign_attributes(firstname: I18n.t('admin.reports.hidden'), lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.ship_address.andand.assign_attributes(firstname: I18n.t('admin.reports.hidden'), lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.assign_attributes(email: I18n.t('admin.reports.hidden'))
end
line_items
end
@@ -81,7 +89,7 @@ module OpenFoodNetwork
summary_columns: [ proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "TOTAL" },
proc { |line_items| I18n.t('admin.reports.total') },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| line_items.sum { |li| li.amount } },
@@ -92,7 +100,7 @@ module OpenFoodNetwork
[ { group_by: proc { |line_item| line_item.order.distributor },
sort_by: proc { |distributor| distributor.name },
summary_columns: [ proc { |line_items| "" },
proc { |line_items| "TOTAL" },
proc { |line_items| I18n.t('admin.reports.total') },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "" },
@@ -117,7 +125,7 @@ module OpenFoodNetwork
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "TOTAL" },
proc { |line_items| I18n.t('admin.reports.total') },
proc { |line_items| "" },
proc { |line_items| "" },
@@ -127,7 +135,7 @@ module OpenFoodNetwork
proc { |line_items| line_items.map { |li| li.order }.uniq.sum { |o| o.ship_total } },
proc { |line_items| line_items.map { |li| li.order }.uniq.sum { |o| o.payment_fee } },
proc { |line_items| line_items.map { |li| li.order }.uniq.sum { |o| o.total } },
proc { |line_items| line_items.all? { |li| li.order.paid? } ? "Yes" : "No" },
proc { |line_items| line_items.all? { |li| li.order.paid? } ? I18n.t(:yes) : I18n.t(:no) },
proc { |line_items| "" },
proc { |line_items| "" },
@@ -178,7 +186,7 @@ module OpenFoodNetwork
proc { |line_items| line_items.first.price },
proc { |line_items| line_items.sum { |li| li.amount } },
proc { |line_items| "" },
proc { |line_items| "incoming transport" } ]
proc { |line_items| I18n.t(:report_header_incoming_transport) } ]
when "order_cycle_supplier_totals_by_distributor"
[ proc { |line_items| line_items.first.product.supplier.name },
proc { |line_items| line_items.first.product.name },
@@ -187,7 +195,7 @@ module OpenFoodNetwork
proc { |line_items| line_items.sum { |li| li.quantity } },
proc { |line_items| line_items.first.price },
proc { |line_items| line_items.sum { |li| li.amount } },
proc { |line_items| "shipping method" } ]
proc { |line_items| I18n.t(:report_header_shipping_method) } ]
when "order_cycle_distributor_totals_by_supplier"
[ proc { |line_items| line_items.first.order.distributor.name },
proc { |line_items| line_items.first.product.supplier.name },
@@ -197,7 +205,7 @@ module OpenFoodNetwork
proc { |line_items| line_items.first.price },
proc { |line_items| line_items.sum { |li| li.amount } },
proc { |line_items| "" },
proc { |line_items| "shipping method" } ]
proc { |line_items| I18n.t(:report_header_shipping_method) } ]
when "order_cycle_customer_totals"
rsa = proc { |line_items| line_items.first.order.shipping_method.andand.require_ship_address }
[
@@ -216,10 +224,10 @@ module OpenFoodNetwork
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| line_items.all? { |li| li.order.paid? } ? "Yes" : "No" },
proc { |line_items| line_items.all? { |li| li.order.paid? } ? I18n.t(:yes) : I18n.t(:no) },
proc { |line_items| line_items.first.order.shipping_method.andand.name },
proc { |line_items| rsa.call(line_items) ? 'Y' : 'N' },
proc { |line_items| rsa.call(line_items) ? I18n.t(:yes) : I18n.t(:no) },
proc { |line_items| line_items.first.order.ship_address.andand.address1 if rsa.call(line_items) },
proc { |line_items| line_items.first.order.ship_address.andand.address2 if rsa.call(line_items) },
@@ -248,7 +256,7 @@ module OpenFoodNetwork
proc { |line_items| line_items.first.price },
proc { |line_items| line_items.sum { |li| li.quantity * li.price } },
proc { |line_items| "" },
proc { |line_items| "incoming transport" } ]
proc { |line_items| I18n.t(:report_header_incoming_transport) } ]
end
end

View File

@@ -8,9 +8,25 @@ module OpenFoodNetwork
def header
if is_by_customer?
["Hub", "Code", "First Name", "Last Name", "Supplier", "Product", "Variant", "Quantity", "TempControlled?"]
[I18n.t(:report_header_hub),
I18n.t(:report_header_code),
I18n.t(:report_header_first_name),
I18n.t(:report_header_last_name),
I18n.t(:report_header_supplier),
I18n.t(:report_header_product),
I18n.t(:report_header_variant),
I18n.t(:report_header_quantity),
I18n.t(:report_header_temp_controlled)]
else
["Hub", "Supplier", "Code", "First Name", "Last Name", "Product", "Variant", "Quantity", "TempControlled?"]
[I18n.t(:report_header_hub),
I18n.t(:report_header_supplier),
I18n.t(:report_header_code),
I18n.t(:report_header_first_name),
I18n.t(:report_header_last_name),
I18n.t(:report_header_product),
I18n.t(:report_header_variant),
I18n.t(:report_header_quantity),
I18n.t(:report_header_temp_controlled)]
end
end
@@ -30,9 +46,9 @@ module OpenFoodNetwork
line_items.select{ |li| line_items_with_hidden_details.include? li }.each do |line_item|
# TODO We should really be hiding customer code here too, but until we
# have an actual association between order and customer, it's a bit tricky
line_item.order.bill_address.andand.assign_attributes(firstname: "HIDDEN", lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.ship_address.andand.assign_attributes(firstname: "HIDDEN", lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.assign_attributes(email: "HIDDEN")
line_item.order.bill_address.andand.assign_attributes(firstname: I18n.t('admin.reports.hidden'), lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.ship_address.andand.assign_attributes(firstname: I18n.t('admin.reports.hidden'), lastname: "", phone: "", address1: "", address2: "", city: "", zipcode: "", state: nil)
line_item.order.assign_attributes(email: I18n.t('admin.reports.hidden'))
end
line_items
end
@@ -52,7 +68,7 @@ module OpenFoodNetwork
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "TOTAL ITEMS" },
proc { |line_items| I18n.t('admin.reports.total_items')},
proc { |line_items| "" },
proc { |line_items| line_items.sum { |li| li.quantity } },
proc { |line_items| "" } ] },
@@ -75,7 +91,7 @@ module OpenFoodNetwork
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "" },
proc { |line_items| "TOTAL ITEMS" },
proc { |line_items| I18n.t('admin.reports.total_items')},
proc { |line_items| "" },
proc { |line_items| line_items.sum { |li| li.quantity } },
proc { |line_items| "" } ] },

View File

@@ -9,13 +9,26 @@ module OpenFoodNetwork
def header
case params[:report_type]
when "payments_by_payment_type"
["Payment State", "Distributor", "Payment Type", "Total (#{currency_symbol})"]
I18n.t(:report_header_payment_type)
[I18n.t(:report_header_payment_state), I18n.t(:report_header_distributor), I18n.t(:report_header_payment_type),
I18n.t(:report_header_total_price, currency: currency_symbol)]
when "itemised_payment_totals"
["Payment State", "Distributor", "Product Total (#{currency_symbol})", "Shipping Total (#{currency_symbol})", "Outstanding Balance (#{currency_symbol})", "Total (#{currency_symbol})"]
[I18n.t(:report_header_payment_state), I18n.t(:report_header_distributor),
I18n.t(:report_header_product_total_price, currency: currency_symbol),
I18n.t(:report_header_shipping_total_price, currency: currency_symbol),
I18n.t(:report_header_outstanding_balance_price, currency: currency_symbol),
I18n.t(:report_header_total_price, currency: currency_symbol)]
when "payment_totals"
["Payment State", "Distributor", "Product Total (#{currency_symbol})", "Shipping Total (#{currency_symbol})", "Total (#{currency_symbol})", "EFT (#{currency_symbol})", "PayPal (#{currency_symbol})", "Outstanding Balance (#{currency_symbol})"]
[I18n.t(:report_header_payment_state), I18n.t(:report_header_distributor),
I18n.t(:report_header_product_total_price, currency: currency_symbol),
I18n.t(:report_header_shipping_total_price, currency: currency_symbol),
I18n.t(:report_header_total_price, currency: currency_symbol),
I18n.t(:report_header_eft_price, currency: currency_symbol),
I18n.t(:report_header_paypal_price, currency: currency_symbol),
I18n.t(:report_header_outstanding_balance_price, currency: currency_symbol)]
else
["Payment State", "Distributor", "Payment Type", "Total (#{currency_symbol})"]
[I18n.t(:report_header_payment_state), I18n.t(:report_header_distributor), I18n.t(:report_header_payment_type),
I18n.t(:report_header_total_price, currency: currency_symbol)]
end
end

View File

@@ -4,16 +4,16 @@ module OpenFoodNetwork
class ProductsAndInventoryReport < ProductsAndInventoryReportBase
def header
[
"Supplier",
"Producer Suburb",
"Product",
"Product Properties",
"Taxons",
"Variant Value",
"Price",
"Group Buy Unit Quantity",
"Amount",
"SKU"
I18n.t(:report_header_supplier),
I18n.t(:report_header_producer_suburb),
I18n.t(:report_header_product),
I18n.t(:report_header_product_properties),
I18n.t(:report_header_taxons),
I18n.t(:report_header_variant_value),
I18n.t(:report_header_price),
I18n.t(:report_header_group_buy_unit_quantity),
I18n.t(:report_header_amount),
I18n.t(:report_header_sku)
]
end

View File

@@ -2,14 +2,26 @@ require 'open_food_network/reports/bulk_coop_report'
module OpenFoodNetwork::Reports
class BulkCoopAllocationReport < BulkCoopReport
header "Customer", "Product", "Bulk Unit Size", "Variant", "Variant value", "Variant unit", "Weight", "Sum Total", "Total Available", "Unallocated", "Max quantity excess"
def header
[I18n.t(:report_header_customer),
I18n.t(:report_header_product),
I18n.t(:report_header_bulk_unit_size),
I18n.t(:report_header_variant),
I18n.t(:report_header_variant_value),
I18n.t(:report_header_variant_unit),
I18n.t(:report_header_weight),
I18n.t(:report_header_sum_total),
I18n.t(:report_header_total_available),
I18n.t(:report_header_unallocated),
I18n.t(:report_header_max_quantity_excess)]
end
organise do
group { |li| li.product }
sort(&:name)
summary_row do
column { |lis| "TOTAL" }
column { |lis| I18n.t('admin.reports.total') }
column { |lis| product_name(lis) }
column { |lis| group_buy_unit_size_f(lis) }
column { |lis| "" }

View File

@@ -2,7 +2,19 @@ require 'open_food_network/reports/bulk_coop_report'
module OpenFoodNetwork::Reports
class BulkCoopSupplierReport < BulkCoopReport
header "Supplier", "Product", "Bulk Unit Size", "Variant", "Variant value", "Variant unit", "Weight", "Sum Total", "Units Required", "Unallocated", "Max quantity excess"
def header
[I18n.t(:report_header_supplier),
I18n.t(:report_header_product),
I18n.t(:report_header_bulk_unit_size),
I18n.t(:report_header_variant),
I18n.t(:report_header_variant_value),
I18n.t(:report_header_variant_unit),
I18n.t(:report_header_weight),
I18n.t(:report_header_sum_total),
I18n.t(:report_header_units_required),
I18n.t(:report_header_unallocated),
I18n.t(:report_header_max_quantity_excess)]
end
organise do
group { |li| li.product.supplier }

View File

@@ -10,14 +10,13 @@ module OpenFoodNetwork
end
def header
[
"User",
"Relationship",
"Enterprise",
"Producer?",
"Sells",
"Visible",
"Confirmation Date"
[I18n.t(:report_header_user),
I18n.t(:report_header_relationship),
I18n.t(:report_header_enterprise),
I18n.t(:report_header_is_producer),
I18n.t(:report_header_sells),
I18n.t(:report_header_visible),
I18n.t(:report_header_confirmation_date)
]
end
@@ -81,7 +80,7 @@ module OpenFoodNetwork
end
def to_local_datetime(string)
return "Not Confirmed" if string.nil?
return I18n.t(:report_header_not_confirmed) if string.nil?
string.to_datetime.in_time_zone.strftime "%Y-%m-%d %H:%M"
end
end

View File

@@ -12,7 +12,32 @@ module OpenFoodNetwork
end
def header
%w(*ContactName EmailAddress POAddressLine1 POAddressLine2 POAddressLine3 POAddressLine4 POCity PORegion POPostalCode POCountry *InvoiceNumber Reference *InvoiceDate *DueDate InventoryItemCode *Description *Quantity *UnitAmount Discount *AccountCode *TaxType TrackingName1 TrackingOption1 TrackingName2 TrackingOption2 Currency BrandingTheme Paid?)
["*#{I18n.t(:report_header_contact_name)}",
I18n.t(:report_header_email),
I18n.t(:report_header_billing_street),
I18n.t(:report_header_billing_street_2),
I18n.t(:report_header_billing_city),
I18n.t(:report_header_billing_region),
I18n.t(:report_header_billing_postcode),
I18n.t(:report_header_billing_country),
"*#{I18n.t(:report_header_invoice_number)}",
I18n.t(:report_header_reference),
"*#{I18n.t(:report_header_invoice_date)}",
"*#{I18n.t(:report_header_due_date)}",
I18n.t(:report_header_inventory_item_code),
"*#{I18n.t(:report_header_description)}",
"*#{I18n.t(:report_header_quantity)}",
"*#{I18n.t(:report_header_unit_amount)}",
I18n.t(:report_header_discount),
"*#{I18n.t(:report_header_account_code)}",
"*#{I18n.t(:report_header_tax_type)}",
I18n.t(:report_header_tracking_name_1),
I18n.t(:report_header_tracking_option_1),
I18n.t(:report_header_tracking_name_2),
I18n.t(:report_header_tracking_option_2),
I18n.t(:report_header_currency),
I18n.t(:report_header_branding_theme),
I18n.t(:report_header_paid)]
end
def search
@@ -95,26 +120,26 @@ module OpenFoodNetwork
end
def produce_summary_rows(order, invoice_number, opts)
[summary_row(order, 'Total untaxable produce (no tax)', total_untaxable_products(order), invoice_number, 'GST Free Income', opts),
summary_row(order, 'Total taxable produce (tax inclusive)', total_taxable_products(order), invoice_number, 'GST on Income', opts)]
[summary_row(order, I18n.t(:report_header_total_untaxable_produce), total_untaxable_products(order), invoice_number, I18n.t(:report_header_gst_free_income), opts),
summary_row(order, I18n.t(:report_header_total_taxable_produce), total_taxable_products(order), invoice_number, I18n.t(:report_header_gst_on_income), opts)]
end
def fee_summary_rows(order, invoice_number, opts)
[summary_row(order, 'Total untaxable fees (no tax)', total_untaxable_fees(order), invoice_number, 'GST Free Income', opts),
summary_row(order, 'Total taxable fees (tax inclusive)', total_taxable_fees(order), invoice_number, 'GST on Income', opts)]
[summary_row(order, I18n.t(:report_header_total_untaxable_fees), total_untaxable_fees(order), invoice_number, I18n.t(:report_header_gst_free_income), opts),
summary_row(order, I18n.t(:report_header_total_taxable_fees), total_taxable_fees(order), invoice_number, I18n.t(:report_header_gst_on_income), opts)]
end
def shipping_summary_rows(order, invoice_number, opts)
[summary_row(order, 'Delivery Shipping Cost (tax inclusive)', total_shipping(order), invoice_number, tax_on_shipping_s(order), opts)]
[summary_row(order, I18n.t(:report_header_delivery_shipping_cost), total_shipping(order), invoice_number, tax_on_shipping_s(order), opts)]
end
def payment_summary_rows(order, invoice_number, opts)
[summary_row(order, 'Transaction Fee (no tax)', total_transaction(order), invoice_number, 'GST Free Income', opts)]
[summary_row(order, I18n.t(:report_header_transaction_fee), total_transaction(order), invoice_number, I18n.t(:report_header_gst_free_income), opts)]
end
def admin_adjustment_summary_rows(order, invoice_number, opts)
[summary_row(order, 'Total untaxable admin adjustments (no tax)', total_untaxable_admin_adjustments(order), invoice_number, 'GST Free Income', opts),
summary_row(order, 'Total taxable admin adjustments (tax inclusive)', total_taxable_admin_adjustments(order), invoice_number, 'GST on Income', opts)]
[summary_row(order, I18n.t(:report_header_total_untaxable_admin), total_untaxable_admin_adjustments(order), invoice_number, I18n.t(:report_header_gst_free_income), opts),
summary_row(order, I18n.t(:report_header_total_taxable_admin), total_taxable_admin_adjustments(order), invoice_number, I18n.t(:report_header_gst_on_income), opts)]
end
def summary_row(order, description, amount, invoice_number, tax_type, opts={})
@@ -128,8 +153,6 @@ module OpenFoodNetwork
order.email,
order.bill_address.andand.address1,
order.bill_address.andand.address2,
'',
'',
order.bill_address.andand.city,
order.bill_address.andand.state,
order.bill_address.andand.zipcode,
@@ -151,7 +174,7 @@ module OpenFoodNetwork
'',
Spree::Config.currency,
'',
order.paid? ? 'Y' : 'N'
order.paid? ? I18n.t(:yes) : I18n.t(:no)
]
end
@@ -200,7 +223,7 @@ module OpenFoodNetwork
def tax_on_shipping_s(order)
tax_on_shipping = order.adjustments.shipping.sum(&:included_tax) > 0
tax_on_shipping ? 'GST on Income' : 'GST Free Income'
tax_on_shipping ? I18n.t(:report_header_gst_on_income) : I18n.t(:report_header_gst_free_income)
end
def total_untaxable_admin_adjustments(order)
@@ -216,7 +239,7 @@ module OpenFoodNetwork
end
def tax_type(taxable)
taxable.has_tax? ? 'GST on Income' : 'GST Free Income'
taxable.has_tax? ? I18n.t(:report_header_gst_on_income) : I18n.t(:report_header_gst_free_income)
end
end
end

View File

@@ -205,7 +205,7 @@ describe Spree::Admin::ReportsController do
it "assigns report types" do
spree_get :products_and_inventory
assigns(:report_types).should == Spree::Admin::ReportsController::REPORT_TYPES[:products_and_inventory]
assigns(:report_types).should == subject.report_types[:products_and_inventory]
end
it "creates a ProductAndInventoryReport" do
@@ -223,7 +223,7 @@ describe Spree::Admin::ReportsController do
before { login_as_admin }
it "should have report types for customers" do
Spree::Admin::ReportsController::REPORT_TYPES[:customers].should == [
subject.report_types[:customers].should == [
["Mailing List", :mailing_list],
["Addresses", :addresses]
]
@@ -246,7 +246,7 @@ describe Spree::Admin::ReportsController do
it "assigns report types" do
spree_get :customers
assigns(:report_types).should == Spree::Admin::ReportsController::REPORT_TYPES[:customers]
assigns(:report_types).should == subject.report_types[:customers]
end
it "creates a CustomersReport" do