Export dossiers v2

This commit is contained in:
Paul Chavard 2019-04-03 14:29:30 +02:00
parent 28e9fca02e
commit fb0ef15e3c
14 changed files with 424 additions and 11 deletions

View file

@ -33,6 +33,43 @@ class Etablissement < ApplicationRecord
]
end
def spreadsheet_columns
[
['Dossier ID', :dossier_id_for_export],
['Champ', :libelle_for_export],
['Établissement SIRET', :siret],
['Établissement siège social', :siege_social],
['Établissement NAF', :naf],
['Établissement libellé NAF', :libelle_naf],
['Établissement Adresse', :adresse],
['Établissement numero voie', :numero_voie],
['Établissement type voie', :type_voie],
['Établissement nom voie', :nom_voie],
['Établissement complément adresse', :complement_adresse],
['Établissement code postal', :code_postal],
['Établissement localité', :localite],
['Établissement code INSEE localité', :code_insee_localite],
['Entreprise SIREN', :entreprise_siren],
['Entreprise capital social', :entreprise_capital_social],
['Entreprise numero TVA intracommunautaire', :entreprise_numero_tva_intracommunautaire],
['Entreprise forme juridique', :entreprise_forme_juridique],
['Entreprise forme juridique code', :entreprise_forme_juridique_code],
['Entreprise nom commercial', :entreprise_nom_commercial],
['Entreprise raison sociale', :entreprise_raison_sociale],
['Entreprise SIRET siège social', :entreprise_siret_siege_social],
['Entreprise code effectif entreprise', :entreprise_code_effectif_entreprise],
['Entreprise date de création', :entreprise_date_creation],
['Entreprise nom', :entreprise_nom],
['Entreprise prénom', :entreprise_prenom],
['Association RNA', :association_rna],
['Association titre', :association_titre],
['Association objet', :association_objet],
['Association date de création', :association_date_creation],
['Association date de déclaration', :association_date_declaration],
['Association date de publication', :association_date_publication]
]
end
def siren
entreprise_siren
end
@ -71,4 +108,18 @@ class Etablissement < ApplicationRecord
inline_adresse: inline_adresse
)
end
private
def dossier_id_for_export
if dossier_id
dossier_id.to_s
elsif champ
champ.dossier_id.to_s
end
end
def libelle_for_export
champ&.libelle
end
end