mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
fixes on invoice and tax report
This commit is contained in:
committed by
Rob Harrington
parent
3fc2070b2c
commit
cc1ef5b28b
@@ -53,6 +53,15 @@ module CheckoutHelper
|
||||
line_item.tax_rates.map { |tr| number_to_percentage(tr.amount * 100, :precision => 1) }.join(", ")
|
||||
end
|
||||
|
||||
def display_adjustment_tax_rates(adjustment)
|
||||
tax_rate = (adjustment.included_tax / (adjustment.amount - adjustment.included_tax)).round(2)
|
||||
if tax_rate == 0 || tax_rate.infinite?
|
||||
""
|
||||
else
|
||||
number_to_percentage(tax_rate * 100, :precision => 1)
|
||||
end
|
||||
end
|
||||
|
||||
def display_checkout_total_less_tax(order)
|
||||
Spree::Money.new order.total - order.total_tax, currency: order.currency
|
||||
end
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
%td
|
||||
%strong= "#{raw(adjustment.label)}"
|
||||
%td{:align => "right"}
|
||||
1
|
||||
%td{:align => "right"}
|
||||
= adjustment.included_tax > 0 ? adjustment.display_included_tax : ""
|
||||
%td{:align => "right"}
|
||||
= adjustment.display_amount
|
||||
- if @order.total_tax > 0
|
||||
%td{:align => "right"}
|
||||
= display_adjustment_tax_rates(adjustment)
|
||||
%tfoot
|
||||
%tr
|
||||
%td{:align => "right", :colspan => "3"}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
%br
|
||||
= @order.distributor.address.address_part2
|
||||
%br
|
||||
= @order.distributor.email
|
||||
= @order.distributor.email_address
|
||||
- if @order.distributor.phone.present?
|
||||
%br
|
||||
= @order.distributor.phone
|
||||
@@ -31,6 +31,7 @@
|
||||
%td{ :align => "left", colspan: 2 }
|
||||
%tr{ valign: "top" }
|
||||
%td{ :align => "left" }
|
||||
%br
|
||||
= t :invoice_issued_on
|
||||
= l Time.zone.now.to_date
|
||||
%br
|
||||
@@ -40,6 +41,8 @@
|
||||
= t :order_number
|
||||
= @order.number
|
||||
%td{ :align => "right" }
|
||||
= t :invoice_billing_address
|
||||
%br
|
||||
%strong= @order.ship_address.full_name
|
||||
- if @order.customer.code.present?
|
||||
%br
|
||||
|
||||
@@ -529,17 +529,18 @@ en:
|
||||
require_customer_html: "Please %{contact} %{enterprise} to become a customer."
|
||||
|
||||
# Printable Invoice Columns
|
||||
invoice_billing_address: "Billing address:"
|
||||
invoice_column_item: "Item"
|
||||
invoice_column_qty: "Qty"
|
||||
invoice_column_unit_price_with_taxes: "Unit price (Incl. GST)"
|
||||
invoice_column_unit_price_without_taxes: "Unit price (Excl. GST)"
|
||||
invoice_column_price_with_taxes: "Total price (Incl. GST)"
|
||||
invoice_column_price_without_taxes: "Total price (Excl. GST)"
|
||||
invoice_column_unit_price_with_taxes: "Unit price (Incl. tax)"
|
||||
invoice_column_unit_price_without_taxes: "Unit price (Excl. tax)"
|
||||
invoice_column_price_with_taxes: "Total price (Incl. tax)"
|
||||
invoice_column_price_without_taxes: "Total price (Excl. tax)"
|
||||
invoice_column_tax_rate: "Tax rate"
|
||||
tax_invoice: "TAX INVOICE"
|
||||
tax_total: "GST Total (%{rate}):"
|
||||
total_excl_tax: "Total (Excl. GST):"
|
||||
total_incl_tax: "Total (Incl. GST):"
|
||||
tax_total: "Total tax (%{rate}):"
|
||||
total_excl_tax: "Total (Excl. tax):"
|
||||
total_incl_tax: "Total (Incl. tax):"
|
||||
abn: "ABN:"
|
||||
acn: "ACN:"
|
||||
invoice_issued_on: "Invoice issued on:"
|
||||
@@ -1357,8 +1358,8 @@ Please follow the instructions there to make your enterprise visible on the Open
|
||||
report_header_total_tax: "Total Tax (%{currency_symbol})"
|
||||
report_header_customer: "Customer"
|
||||
report_header_distributor: "Distributor"
|
||||
report_header_total_excl_vat: "Total excl. GST (%{currency_symbol})"
|
||||
report_header_total_incl_vat: "Total incl. GST (%{currency_symbol})"
|
||||
report_header_total_excl_vat: "Total excl. tax (%{currency_symbol})"
|
||||
report_header_total_incl_vat: "Total incl. tax (%{currency_symbol})"
|
||||
initial_invoice_number: "Initial invoice number:"
|
||||
invoice_date: "Invoice date:"
|
||||
due_date: "Due date:"
|
||||
|
||||
@@ -482,6 +482,8 @@ fr:
|
||||
require_customer_login: "La boutique est réservée aux membres."
|
||||
require_login_html: "Déjà inscrit? %{login}. Sinon, %{register} pour pouvoir faire vos achats."
|
||||
require_customer_html: "Veuillez %{contact} %{enterprise} pour devenir membre."
|
||||
|
||||
invoice_billing_address: "Adresse de facturation :"
|
||||
invoice_column_item: "Produit"
|
||||
invoice_column_qty: "Qté"
|
||||
invoice_column_unit_price_with_taxes: "Prix unitaire (TTC)"
|
||||
|
||||
@@ -56,7 +56,7 @@ module OpenFoodNetwork
|
||||
orders.map do |order|
|
||||
[order.number, order.total - order.total_tax] +
|
||||
relevant_rates.map { |rate| order.tax_adjustment_totals.fetch(rate, 0) } +
|
||||
[order.total_tax, order.display_total]
|
||||
[order.total_tax, order.total]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user