From f1cd4de3e66e3580a6a6d1a788ab9685d1de8409 Mon Sep 17 00:00:00 2001 From: viehlieb Date: Mon, 20 Feb 2023 22:36:20 +0100 Subject: [PATCH] add calc to gem --- lib/foodsoft_article_import/bnn.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/foodsoft_article_import/bnn.rb b/lib/foodsoft_article_import/bnn.rb index 14b1ea0..cb69e44 100644 --- a/lib/foodsoft_article_import/bnn.rb +++ b/lib/foodsoft_article_import/bnn.rb @@ -67,19 +67,24 @@ module FoodsoftArticleImport tax: translate(:tax, row[33]), unit_quantity: row[22] } + # TODO: Complete deposit list.... article.merge!(deposit: translate(:deposit, row[26])) if translate(:deposit, row[26]) # get scale prices if exists # article.merge!(:scale_quantity => row[40], :scale_price => row[41]) unless row[40].nil? or row[41].nil? + unless row[37].nil? && row[65].nil? && row[66].nil? + article.merge!(:scale_unit_price => row[66].to_f * row[37].to_f) + article.merge!(:scale_unit => row[65] ) + end + if !row[62].nil? # consider special prices article[:note] = "Sonderpreis: #{article[:price]} von #{row[62]} bis #{row[63]}" yield article, :special, i - article.merge!(:scale_unit_price => row[68] * row[37].to_f ) unless row[68].nil? or row[37].nil? # Check now for article status, we only consider outlisted articles right now # N=neu, A=Änderung, X=ausgelistet, R=Restbestand, # V=vorübergehend ausgelistet, W=wiedergelistet