display v2 and v3 bilans bdf
This commit is contained in:
parent
0f083db32b
commit
42acc71cbe
4 changed files with 101 additions and 5 deletions
|
@ -1,14 +1,23 @@
|
|||
module EtablissementHelper
|
||||
def value_for_bilan_key(bilan, key)
|
||||
if bilan["data"]
|
||||
return "NA" if key == "resultat_exercice"
|
||||
bilan["data"][key].presence || bilan["data"]["valeurs_calculees"][0][key].present? ? bilan["data"]["valeurs_calculees"][0][key]["valeur"] : nil
|
||||
else
|
||||
bilan[key]
|
||||
end
|
||||
end
|
||||
|
||||
def pretty_siret(siret)
|
||||
"#{siret[0..2]} #{siret[3..5]} #{siret[6..8]} #{siret[9..]}"
|
||||
end
|
||||
|
||||
def pretty_currency(capital_social, unit: '€')
|
||||
number_to_currency(capital_social, locale: :fr, unit: unit, precision: 0)
|
||||
def pretty_currency(value, unit: '€')
|
||||
number_to_currency(value, locale: :fr, unit: unit, precision: 0)
|
||||
end
|
||||
|
||||
def pretty_currency_unit(unit)
|
||||
dict = { 'kEuros' => 'k€' }
|
||||
dict = { 'kEuros' => 'k€', 'euros' => '€' }
|
||||
dict[unit]
|
||||
end
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
%details
|
||||
- etablissement.entreprise_bilans_bdf.each do |bilan|
|
||||
= "#{pretty_date_exercice(bilan["date_arret_exercice"])} : "
|
||||
= pretty_currency(bilan[key], unit: pretty_currency_unit(etablissement.entreprise_bilans_bdf_monnaie))
|
||||
= pretty_currency(value_for_bilan_key(bilan, key), unit: pretty_currency_unit(etablissement.entreprise_bilans_bdf_monnaie))
|
||||
%br
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue