render csv bidf bilans
This commit is contained in:
parent
b12226c667
commit
22e2c2e133
4 changed files with 21 additions and 0 deletions
|
@ -31,6 +31,10 @@ module Instructeurs
|
||||||
render 'admin/attestation_templates/show', formats: [:pdf]
|
render 'admin/attestation_templates/show', formats: [:pdf]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bilans_bdf
|
||||||
|
render csv: dossier.etablissement.entreprise_bilans_bdf_to_csv
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@demande_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.demande_seen_at
|
@demande_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.demande_seen_at
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,15 @@ class Etablissement < ApplicationRecord
|
||||||
upload_attestation(url, entreprise_attestation_fiscale)
|
upload_attestation(url, entreprise_attestation_fiscale)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def entreprise_bilans_bdf_to_csv
|
||||||
|
headers = ["bilans"].concat(entreprise_bilans_bdf[0].keys)
|
||||||
|
data = entreprise_bilans_bdf.each_with_index.map do |bilan, i|
|
||||||
|
month = I18n.l(Date.current - (i + 1).year, format: "%m/%Y")
|
||||||
|
[month].concat(bilan.values)
|
||||||
|
end
|
||||||
|
SpreadsheetArchitect.to_csv(headers: headers, data: data)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def dossier_id_for_export
|
def dossier_id_for_export
|
||||||
|
|
|
@ -78,6 +78,13 @@
|
||||||
%th.libelle Attestation fiscale
|
%th.libelle Attestation fiscale
|
||||||
%td= link_to "Consulter l'attestation", url_for(etablissement.entreprise_attestation_fiscale)
|
%td= link_to "Consulter l'attestation", url_for(etablissement.entreprise_attestation_fiscale)
|
||||||
|
|
||||||
|
- if etablissement.entreprise_bilans_bdf_to_csv.present?
|
||||||
|
%tr
|
||||||
|
%th.libelle
|
||||||
|
Bilans Banque de France
|
||||||
|
= "en #{etablissement.entreprise_bilans_bdf_monnaie}"
|
||||||
|
%td= link_to "Consulter les bilans", bilans_bdf_instructeur_dossier_path
|
||||||
|
|
||||||
- if etablissement.association?
|
- if etablissement.association?
|
||||||
%tr
|
%tr
|
||||||
%th.libelle Numéro RNA :
|
%th.libelle Numéro RNA :
|
||||||
|
|
|
@ -318,6 +318,7 @@ Rails.application.routes.draw do
|
||||||
get 'attestation'
|
get 'attestation'
|
||||||
get 'geo_data'
|
get 'geo_data'
|
||||||
get 'apercu_attestation'
|
get 'apercu_attestation'
|
||||||
|
get 'bilans_bdf'
|
||||||
get 'messagerie'
|
get 'messagerie'
|
||||||
get 'annotations-privees' => 'dossiers#annotations_privees'
|
get 'annotations-privees' => 'dossiers#annotations_privees'
|
||||||
get 'avis'
|
get 'avis'
|
||||||
|
|
Loading…
Reference in a new issue