Skip to content

Commit

Permalink
Fixed exports
Browse files Browse the repository at this point in the history
  • Loading branch information
lentschi committed Dec 29, 2023
1 parent 948c480 commit 262e475
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/documents/order_fax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def articles_paragraph
oa.article_version.name,
# TODO-article-units: Why should we show the supplier the group order unit quantity?:
oa.article_version.convert_quantity(1, oa.article_version.supplier_order_unit, oa.article_version.group_order_unit),
format_supplier_article_unit(oa.price),
format_supplier_order_unit_with_ratios(oa.price),
number_to_currency(price),
number_to_currency(subtotal)]
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/articles_by/_article_single.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%h4.name.pull-left
= order_article.article_version.name
%small
= "(#{format_group_order_unit(order_article.article_version)}, #{number_to_currency order_article.article_version.fc_price}"
= "(#{format_group_order_unit_with_ratios(order_article.article_version)}, #{number_to_currency order_article.article_version.fc_price}"
- pkg_info = pkg_helper(order_article.price)
= ", #{pkg_info}".html_safe unless pkg_info.blank?
)
Expand Down
10 changes: 7 additions & 3 deletions lib/order_csv.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'csv'

class OrderCsv < RenderCSV
include ApplicationHelper
include ArticlesHelper

def header
[
OrderArticle.human_attribute_name(:units_to_order),
Expand All @@ -19,9 +22,10 @@ def data
oa.units_to_order,
oa.article_version.order_number,
oa.article_version.name,
oa.article_version.unit,
oa.article_version.unit_quantity > 1 ? oa.article_version.unit_quantity : nil,
number_to_currency(oa.article_version.price * oa.article_version.unit_quantity),
format_supplier_order_unit_with_ratios(oa.article_version),
# TODO-article-units: Why should we show the supplier the group order unit quantity?:
oa.article_version.convert_quantity(1, oa.article_version.supplier_order_unit, oa.article_version.group_order_unit),
number_to_currency(oa.article_version.price),
number_to_currency(oa.total_price)
]
end
Expand Down
5 changes: 3 additions & 2 deletions lib/order_pdf.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class OrderPdf < RenderPDF
include ArticlesHelper
attr_reader :order

def initialize(order, options = {})
Expand Down Expand Up @@ -47,11 +48,11 @@ def nice_table(name, data, dimrows = [])
# @return [Number] Price to show
# @see https://github.com/foodcoops/foodsoft/issues/445
def order_article_price(order_article)
order_article.article_version.fc_price
order_article.article_version.fc_group_order_price
end

def order_article_price_per_unit(order_article)
"#{number_to_currency(order_article_price(order_article))} / #{order_article.article_version.unit}"
"#{number_to_currency(order_article_price(order_article))} / #{format_group_order_unit_with_ratios(order_article.article_version)}"
end

def group_order_article_quantity_with_tolerance(goa)
Expand Down

0 comments on commit 262e475

Please sign in to comment.