--- /dev/null
+; Plan comptable d’une Cyclofficine
+; =================================
+;
+; == Utilisation
+; Doit être inclus ainsi dans un FICHIER.hledger l’utilisant :
+; ----
+; !include Plan_comptable.hledger
+; ----
+; ATTENTION: rien n’empêche techniquement un FICHIER.hledger
+; de rajouter des comptes après cette inclusion.
+
+; Définir un Plan comptable dans hledger
+; consiste à faire une écriture dont tous les montants sont nuls
+; et qui recense tous les comptes qui vont à priori être utilisés.
+
+; ATTENTION: par convention ici chaque compte doit respecter la syntaxe :
+; ----
+; A.ZZZ:B.YYY:C.XXX 0 ; ABC. INTITULÉ OFFICIEL DU COMPTE
+; ----
+
+D 1,000.00€ ; NOTE: précise le format de la devise.
+
+01/01 Initialisation des comptes
+ 1.Capital 0 ; 1. COMPTES DE CAPITAUX
+ 1.Capital:0.Fonds 0 ; 10. Fonds associatifs et reserves
+ 1.Capital:0.Fonds:2.SDR 0 ; 102. Fonds associatifs sans droit de reprise (SDR)
+ 1.Capital:0.Fonds:2.SDR:4.Apport 0 ; 1024. Apports SDR
+ 1.Capital:0.Fonds:2.SDR:6.Sub_invest_BR 0 ; 1026. Subventions d’investissement (biens renouvelables) SDR
+ 1.Capital:0.Fonds:3.ADR 0 ; 103. Fonds associatifs avec droit de reprise (ADR)
+ 1.Capital:0.Fonds:3.ADR:4.Apport 0 ; 1034. Apports ADR
+ 1.Capital:0.Fonds:3.ADR:6.Sub_invest_BR 0 ; 1036. Subventions d’investissement (biens renouvelables) ADR
+ 1.Capital:0.Fonds:6.Réserve 0 ; 106. Réserves
+ 1.Capital:0.Fonds:6.Réserve:3.Statutaire 0 ; 1063. Réserves statutaires ou contractuelles
+ 1.Capital:0.Fonds:6.Réserve:8.Autre 0 ; 1068. Autres réserves (dont réserves pour projet associatif)
+ 1.Capital:1.Report 0 ; 11. Report à nouveau
+ 1.Capital:1.Report:0.Bénéfice 0 ; 110. Report à nouveau (solde créditeur/bénéfice)
+ 1.Capital:1.Report:5.Financeur 0 ; 115. Résultats sous contrôle de tiers financeurs
+ 1.Capital:1.Report:9.Déficit 0 ; 119. Report à nouveau (solde débiteur/perte)
+ 1.Capital:2.Résultat 0 ; 12. Résultat net de l’exercice
+ 1.Capital:2.Résultat:0.Bénéfice 0 ; 120. Résultat de l’exercice (excédent/bénéfice)
+ 1.Capital:2.Résultat:9.Déficit 0 ; 129. Résultat de l’exercice (déficit/perte)
+ 1.Capital:3.Sub_invest_BNR 0 ; 13. Subventions d’investissements (biens non renouvelables) ADR
+ 1.Capital:3.Sub_invest_BNR:1.Equipement 0 ; 131. Subventions d’équipement
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:1.État 0 ; 1311. État
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:2.Région 0 ; 1312. Région
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:3.Département 0 ; 1313. Département
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:4.Commune 0 ; 1314. Commune
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:5.Collectivité_publique 0 ; 1315. Collectivités publiques
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:6.Entreprise_publique 0 ; 1316. Entreprises publiques
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:7.Organisme_privé 0 ; 1317. Entreprises et organismes privés
+ 1.Capital:3.Sub_invest_BNR:1.Equipement:8.Autre 0 ; 1318. Autres
+ 1.Capital:3.Sub_invest_BNR:8.Autre 0 ; 138. Autres subventions d’investissement
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat 0 ; 139. Subventions d’investissements inscrites au compte de résultat
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement 0 ; 1391. Subvention d'équipement
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:1.État 0 ; 13911. État
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:2.Région 0 ; 13912. Région
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:3.Département 0 ; 13913. Département
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:4.Commune 0 ; 13914. Commune
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:5.Collectivité_publique 0 ; 13915. Collectivités publiques
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:6.Entreprise_publique 0 ; 13916. Entreprises publiques
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:7.Organisme_privé 0 ; 13917. Entreprises et organismes privés
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:1.Equipement:8.Autre 0 ; 13918. Autres
+ 1.Capital:3.Sub_invest_BNR:9.Compte_résultat:2.Autre 0 ; 1392. Autres subventions d'investissement
+ 1.Capital:5.Provision_risque&charge 0 ; 15. Provisions pour risques et charges
+ 1.Capital:5.Provision_risque&charge:1.Risque 0 ; 151. Provisions pour risques
+ 1.Capital:5.Provision_risque&charge:5.Impôt 0 ; 155. Provisions pour impôts
+ 1.Capital:5.Provision_risque&charge:8.Autre 0 ; 158. Autres provisions pour charges
+ 1.Capital:5.Provision_risque&charge:8.Autre:2.Congés_à_payer 0 ; 1582. Provisions pour congés à payer
+ 1.Capital:6.Emprunt,Dette 0 ; 16. Emprunts et dettes assimilees
+ 1.Capital:6.Emprunt,Dette:4.Etablissement_crédit 0 ; 164. Emprunts auprès des établissements de crédit
+ 1.Capital:6.Emprunt,Dette:5.Dépôt,Caution 0 ; 165. Dépôts et cautionnements reçus
+ 1.Capital:6.Emprunt,Dette:8.Autre 0 ; 168. Autres emprunts et dettes assimilées
+ 1.Capital:6.Emprunt,Dette:8.Autre:1.Emprunt 0 ; 1681. Autres emprunts
+ 1.Capital:6.Emprunt,Dette:8.Autre:1.Emprunt:1.Bénévole 0 ; 16811. Bénévoles
+ 1.Capital:6.Emprunt,Dette:8.Autre:1.Emprunt:2.Salarié-e 0 ; 16812. Salarié-e-s
+ 1.Capital:6.Emprunt,Dette:8.Autre:1.Emprunt:3.Cyclofficine 0 ; 16813. Cyclofficine
+ 1.Capital:6.Emprunt,Dette:8.Autre:1.Emprunt:4.Autre 0 ; 16814. Autre
+ 1.Capital:6.Emprunt,Dette:8.Autre:7.Dette 0 ; 1687. Autres dettes
+ 1.Capital:9.Fonds_dédiés 0 ; 19. Fonds dédiés
+ 1.Capital:9.Fonds_dédiés:4.Sub_exploit 0 ; 194. Fonds dédiés sur subventions de fonctionnement
+ 1.Capital:9.Fonds_dédiés:5.Don_affecté 0 ; 195. Fonds dédiés sur dons manuels affectés
+ 2.Immobilisation 0 ; 2. COMPTES D'IMMOBILISATIONS
+ 2.Immobilisation:1.Corporelle 0 ; 21. Immobilisations corporelles
+ 2.Immobilisation:1.Corporelle:5.Equipement 0 ; 215. Installations techniques, matériel et outillage industriels
+ 2.Immobilisation:1.Corporelle:8.Autre 0 ; 218. Autres immobilisations corporelles
+ 2.Immobilisation:1.Corporelle:8.Autre:1.Travaux 0 ; 2181. Installation générale, agencement, aménagement divers
+ 2.Immobilisation:1.Corporelle:8.Autre:2.Transport 0 ; 2182. Matériel de transport
+ 2.Immobilisation:1.Corporelle:8.Autre:3.Matériel_bureau&info 0 ; 2183. Matériel de bureau et matériel informatique
+ 2.Immobilisation:1.Corporelle:8.Autre:4.Mobilier 0 ; 2184. Mobilier
+ 2.Immobilisation:2.Concession 0 ; 22. Immobilisations mises en concession
+ 2.Immobilisation:2.Concession:8.Immo_grévées_droits 0 ; 228. Immobilisations grevées de droits
+ 2.Immobilisation:2.Concession:9.Droits_propriétaire 0 ; 229. Droits des propriétaires
+ 2.Immobilisation:6.Participation 0 ; 26.Participations et créances rattachées à des participations
+ 2.Immobilisation:6.Participation:1.Titre 0 ; 261. Titres de participation
+ 2.Immobilisation:6.Participation:1.Titre:8.Autre 0 ; 2618. Autres titres
+ 2.Immobilisation:7.Financière 0 ; 27. Autres immobilisations financières
+ 2.Immobilisation:7.Financière:4.Prêt 0 ; 274. Prêts
+ 2.Immobilisation:7.Financière:4.Prêt:3.Au_personnel 0 ; 2743. Prêts au personnel
+ 2.Immobilisation:7.Financière:4.Prêt:8.Autre 0 ; 2748. Autres prêts
+ 2.Immobilisation:7.Financière:5.Dépôt,Caution 0 ; 275. Dépôts et cautionnements versés
+ 2.Immobilisation:8.Amortissement 0 ; 28. Amortissements des immobilisations
+ 2.Immobilisation:8.Amortissement:1.Immo_corp 0 ; 281. Amortissements des immobilisations corporelles
+ 2.Immobilisation:8.Amortissement:1.Immo_corp:5.Equipement 0 ; 2815. Installations techniques, matériel et outillage industriels (même ventilation que celle du_compte_215)
+ 2.Immobilisation:8.Amortissement:1.Immo_corp:8.Autre 0 ; 2818. Autres immobilisations corporelles
+ 4.Tiers 0 ; 4. COMPTES TIERS
+ 4.Tiers:0.Fournisseur 0 ; 40. Fournisseurs et comptes rattachés
+ 4.Tiers:0.Fournisseur:1.Fournisseur 0 ; 401. Fournisseurs
+ 4.Tiers:0.Fournisseur:1.Fournisseur:1.Bien,Prestation 0 ; 4011. Fournisseurs - achats de biens ou de prestations de services
+ 4.Tiers:0.Fournisseur:1.Fournisseur:7.Retenue_garantie 0 ; 4017. Fournisseurs - Retenue de garantie
+ 4.Tiers:0.Fournisseur:3.Effets_à_payer 0 ; 403. Fournisseurs - effets à payer
+ 4.Tiers:0.Fournisseur:4.Immobilisation 0 ; 404. Fournisseurs d’immobilisations
+ 4.Tiers:0.Fournisseur:4.Immobilisation:1.Achat 0 ; 4041. Fournisseurs - Achats d'immobilisations
+ 4.Tiers:0.Fournisseur:4.Immobilisation:7.Retenue_garantie 0 ; 4047. Fournisseurs d'immobilisations - Retenue de garantie
+ 4.Tiers:0.Fournisseur:5.Immo_effets_à_payer 0 ; 405. Fournisseurs d’immobilisations - Effets à payer
+ 4.Tiers:0.Fournisseur:8.Facture_non_parvenue 0 ; 408. Fournisseurs - Factures non parvenues
+ 4.Tiers:0.Fournisseur:8.Facture_non_parvenue:1.Bien,Prestation 0 ; 4081. Fournisseurs - Achats de biens ou prestations de service
+ 4.Tiers:0.Fournisseur:8.Facture_non_parvenue:4.Immobilisation 0 ; 4084. Fournisseurs - Achats d'immobilisations
+ 4.Tiers:0.Fournisseur:9.Débiteur 0 ; 409. Fournisseurs débiteurs
+ 4.Tiers:0.Fournisseur:9.Débiteur:1.Accompte 0 ; 4091. Fournisseurs - Avances et accomptes versés sur commandes
+ 4.Tiers:0.Fournisseur:9.Débiteur:7.Autre_avoir 0 ; 4097. Autres avoirs
+ 4.Tiers:1.Client 0 ; 41. Usagers et comptes rattachés
+ 4.Tiers:1.Client:1.Client 0 ; 411. Clients
+ 4.Tiers:1.Client:1.Client:1.Bien,Prestation 0 ; 4111. Clients - Vente de biens et prestations de service
+ 4.Tiers:1.Client:1.Client:7.Retenue_garantie 0 ; 4117. Clients - Retenue de garantie
+ 4.Tiers:1.Client:3.Effets_à_recevoir 0 ; 413. Clients - Effets à recevoir
+ 4.Tiers:1.Client:8.Produit_non_facturé 0 ; 418. Clients - Produits non encore facturés
+ 4.Tiers:1.Client:9.Créditeur 0 ; 419. Clients créditeurs
+ 4.Tiers:1.Client:9.Créditeur:1.Accompte 0 ; 4191. Clients - Avances et accomptes versés sur commandes
+ 4.Tiers:1.Client:9.Créditeur:7.Autre_avoir 0 ; 4197. Clients - Autres avoirs
+ 4.Tiers:2.Personnel 0 ; 42. Personnel et comptes rattachés
+ 4.Tiers:2.Personnel:1.Rémunération 0 ; 421. Rémunérations dues
+ 4.Tiers:2.Personnel:1.Rémunération:011801.S_Arca 0 ; 421011801. S. Arca
+ 4.Tiers:2.Personnel:1.Rémunération:030101.G_Caprarelli 0 ; 421030101. G. Caprarelli
+ 4.Tiers:2.Personnel:1.Rémunération:060101.T_Favier 0 ; 421060101. T.Favier
+ 4.Tiers:2.Personnel:1.Rémunération:131501.A_Morin 0 ; 421131501. A. Morin
+ 4.Tiers:2.Personnel:1.Rémunération:161501.S_Popek 0 ; 421161501. S. Popek
+ 4.Tiers:2.Personnel:5.Avances 0 ; 425. Personnel - Avances et accomptes
+ 4.Tiers:2.Personnel:8.CP&PR 0 ; 428. Personnel - Charges à payer et produits à recevoir
+ 4.Tiers:2.Personnel:8.CP&PR:2.Congés_à_payer 0 ; 4282. Dettes provisionnées pour congés à payer
+ 4.Tiers:2.Personnel:8.CP&PR:6.Autre_charge_à_payer 0 ; 4286. Autres charges à payer
+ 4.Tiers:2.Personnel:8.CP&PR:7.Produit_à_recevoir 0 ; 4287. Produits à recevoir
+ 4.Tiers:3.Caisse_sociale 0 ; 43. Securite sociale et autres organismes sociaux
+ 4.Tiers:3.Caisse_sociale:1.URSSAF 0 ; 431. URSSAF
+ 4.Tiers:3.Caisse_sociale:7.Autre 0 ; 437. Autres organismes sociaux
+ 4.Tiers:3.Caisse_sociale:7.Autre:3.B2V 0 ; 4373. Caisse de retraite
+ 4.Tiers:3.Caisse_sociale:7.Autre:8.Autre 0 ; 4378. Autres organismes sociaux
+ 4.Tiers:3.Caisse_sociale:7.Autre:8.Autre:1.AG2R 0 ; 43781. Prévoyance
+ 4.Tiers:3.Caisse_sociale:8.CP&PR 0 ; 438. Charges à payer et produits à recevoir
+ 4.Tiers:3.Caisse_sociale:8.CP&PR:2.Cotisation_congé_à_payer 0 ; 4382. Cotisations sociales sur congés à payer
+ 4.Tiers:3.Caisse_sociale:8.CP&PR:6.Autre_charge_à_payer 0 ; 4386. Autres charges à payer
+ 4.Tiers:3.Caisse_sociale:8.CP&PR:7.Produit_à_recevoir 0 ; 4387. Produits à recevoir
+ 4.Tiers:4.État,collectivité 0 ; 44. État et autres collectivites publiques
+ 4.Tiers:4.État,collectivité:1.Sub_à_recevoir 0 ; 441. Subventions à recevoir
+ 4.Tiers:4.État,collectivité:1.Sub_à_recevoir:1.Investissement 0 ; 4411. Subventions d'investissement
+ 4.Tiers:4.État,collectivité:1.Sub_à_recevoir:7.Exploitation 0 ; 4417. Subventions d'exploitation
+ 4.Tiers:4.État,collectivité:1.Sub_à_recevoir:8.Equilibre 0 ; 4418. Subvention d'équilibre
+ 4.Tiers:4.État,collectivité:1.Sub_à_recevoir:9.Avance_sur_sub 0 ; 4419. Avances sur subventions
+ 4.Tiers:4.État,collectivité:3.Opération_particulière 0 ; 443. Opérations particulières avec l’État, les collectivités publiques, les organismes internationaux
+ 4.Tiers:4.État,collectivité:4.Impôt_sur_bénéfice 0 ; 444. État- Impôts sur les bénéfices
+ 4.Tiers:4.État,collectivité:4.Impôt_sur_bénéfice:5.Sur_société 0 ; 4445. État - Impôt sur les sociétés
+ 4.Tiers:4.État,collectivité:7.Autre_impôt 0 ; 447.Autres impôts, taxes et versements assimilés
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:1.Sur_rémunération_(État) 0 ; 4471. Impôts, taxes et versements assimilés sur rémunérations (administration des impôts)
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:1.Sur_rémunération_(État):1.Taxe_salaire 0 ; 44711. Taxe sur les salaires
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:1.Sur_rémunération_(État):2.Formation_pro 0 ; 44712. Participation des employeurs à la formation professionnelle continue
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:1.Sur_rémunération_(État):8.Autre 0 ; 44718. Autres impôts, taxes et versements assimilés
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:3.Sur_rémunération_(Organisme) 0 ; 4473. Impôts, taxes et versements sur rémunérations (autres organismes)
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:3.Sur_rémunération_(Organisme):3.Formation_pro 0 ; 44733. Participation des employeurs à la formation professionnelle continue
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:5.Autre_(État) 0 ; 4475. Autres impôts, taxes et versements assimilés (administration des impôts)
+ 4.Tiers:4.État,collectivité:7.Autre_impôt:7.Autre_(Organisme) 0 ; 4477. Autres impôts, taxes et versements assimilés (autres organismes)
+ 4.Tiers:4.État,collectivité:8.CP&PR 0 ; 448. État - Charges à payer et produits à recevoir
+ 4.Tiers:4.État,collectivité:8.CP&PR:2.Charge_fiscale_sur_congés_à_payer 0 ; 4482. Charges fiscales sur congés à payer
+ 4.Tiers:4.État,collectivité:8.CP&PR:6.Charge_à_payer 0 ; 4486. Autres charges à payer
+ 4.Tiers:4.État,collectivité:8.CP&PR:7.Produit_à_recevoir 0 ; 4487. Produits à recevoir
+ 4.Tiers:6.Divers_créditeur_débiteur 0 ; 46. Débiteurs divers et créditeurs divers
+ 4.Tiers:6.Divers_créditeur_débiteur:7.Autre 0 ; 467. Autres comptes débiteurs ou créditeurs
+ 4.Tiers:6.Divers_créditeur_débiteur:7.Autre:001.Bénévole 0 ; 467001. Bénévoles
+ 4.Tiers:6.Divers_créditeur_débiteur:7.Autre:002.Salarié-e 0 ; 647002. Salariés
+ 4.Tiers:6.Divers_créditeur_débiteur:8.CP&PR 0 ; 468. Divers - Charges à payer et produits à recevoir
+ 4.Tiers:6.Divers_créditeur_débiteur:8.CP&PR:6.Charge_à_payer 0 ; 4686.Charges à payer
+ 4.Tiers:6.Divers_créditeur_débiteur:8.CP&PR:7.Produit_à_recevoir 0 ; 4687. Produits à recevoir
+ 4.Tiers:8.Régularisation 0 ; 48. Comptes de régularisation
+ 4.Tiers:8.Régularisation:6.Charge_constatée_d'avance 0 ; 486. Charges constatées d’avance
+ 4.Tiers:8.Régularisation:7.Produit_constaté_d'avance 0 ; 487. Produits constatés d’avance
+ 5.Finance 0 ; 5. COMPTES FINANCIERS
+ 5.Finance:1.Etablissement 0 ; 51. Banques, établissements financiers et assimilés
+ 5.Finance:1.Etablissement:1.Valeur 0 ; 511. Valeurs à l’encaissement
+ 5.Finance:1.Etablissement:1.Valeur:2.Chèque_à_encaisser 0 ; 5112. Chèques à encaisser
+ 5.Finance:1.Etablissement:2.Banque:001.Courant 0 ; 512001. Crédit Coopératif - Compte courant
+ 5.Finance:1.Etablissement:2.Banque:002.Livret 0 ; 512002. Crédit coopératif - Livret
+ 5.Finance:3.Caisse 0 ; 53. Caisse
+ 5.Finance:3.Caisse:1.Siège 0 ; 531. Caisse du siège
+ 5.Finance:3.Caisse:2.Atelier 0 ; 532. Caisse des lieux d’activités
+ 5.Finance:8.Virement 0 ; 58. Virements internes
+ 5.Finance:8.Virement:0.Interne 0 ; 580. Virements internes
+ 5.Finance:8.Virement:1.Fonds 0 ; 581. Virements de fonds
+ 6.Charge 0 ; 6. COMPTES D'ACHATS
+ 6.Charge:0.Achat 0 ; 60. Achats (sauf 603)
+ 6.Charge:0.Achat:1.Stocké-Matière_Prem,Fourniture 0 ; 601. Achats stockés - Matières premières et fournitures
+ 6.Charge:0.Achat:1.Stocké-Matière_Prem,Fourniture:1.Matière 0 ; 6011. Matières
+ 6.Charge:0.Achat:1.Stocké-Matière_Prem,Fourniture:2.Fourniture 0 ; 6012. Fournitures
+ 6.Charge:0.Achat:2.Stocké-Autre 0 ; 602. Achats stockés - Autres approvisionnements
+ 6.Charge:0.Achat:2.Stocké-Autre:1.Matière_consommable 0 ; 6021. Matières consommables
+ 6.Charge:0.Achat:2.Stocké-Autre:2.Fourniture_consommable 0 ; 6022. Fournitures consommables
+ 6.Charge:0.Achat:2.Stocké-Autre:2.Fourniture_consommable:1.Combustible 0 ; 60221. Combustibles
+ 6.Charge:0.Achat:2.Stocké-Autre:2.Fourniture_consommable:2.Nettoyage 0 ; 60222. Produits d’entretien
+ 6.Charge:0.Achat:2.Stocké-Autre:2.Fourniture_consommable:3.Atelier 0 ; 60223. Fournitures d’atelier
+ 6.Charge:0.Achat:2.Stocké-Autre:2.Fourniture_consommable:5.Bureau 0 ; 60225. Fournitures de bureau
+ 6.Charge:0.Achat:3.Variation_stocks 0 ; 603. Variation des stocks (approvisionnements et marchandises)
+ 6.Charge:0.Achat:4.Etude,Prestation 0 ; 604. Achats d’études et prestations de services
+ 6.Charge:0.Achat:5.Matériel,Equipement,Travaux 0 ; 605. Achats de matériels, équipements et travaux
+ 6.Charge:0.Achat:6.Non_stocké 0 ; 606. Achats non stockés de matières et fournitures
+ 6.Charge:0.Achat:6.Non_stocké:1.Non_stockable 0 ; 6061. Fournitures non stockables (eau, énergie..)
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture 0 ; 6063. Fournitures d’entretien et de petit équipement
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture:1.Produit_entretien 0 ; 60631. Produits d'entretien
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture:2.Travaux 0 ; 60632. Fournitures pour travaux
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture:3.Equipement_atelier 0 ; 60633. Equipement d'atelier
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture:4.Outillage 0 ; 60634. Outillage
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture:5.Mobilier 0 ; 60635. Mobilier
+ 6.Charge:0.Achat:6.Non_stocké:3.Fourniture:6.Matériel_informatique 0 ; 60636. Matériel informatique
+ 6.Charge:0.Achat:6.Non_stocké:4.Consommable_bureau 0 ; 6064. Fournitures de bureau
+ 6.Charge:0.Achat:6.Non_stocké:8.Autre_Matière,Fourniture 0 ; 6068. Autres matières et fournitures
+ 6.Charge:0.Achat:6.Non_stocké:8.Autre_Matière,Fourniture:1.Atelier 0 ; 60681. Consommables, fournitures atelier et vélos
+ 6.Charge:0.Achat:6.Non_stocké:8.Autre_Matière,Fourniture:8.Autre 0 ; 60688. Autre matières et fournitures
+ 6.Charge:0.Achat:7.Marchandise 0 ; 607. Achats de marchandises
+ 6.Charge:0.Achat:8.Frais_accessoire 0 ; 608. Frais accessoires d’achats
+ 6.Charge:0.Achat:9.Remise 0 ; 609. Rabais, remises et ristournes obtenus sur achats
+ 6.Charge:1.Service 0 ; 61. Services extérieurs
+ 6.Charge:1.Service:1.Sous-traitance 0 ; 611. Sous-traitance générale
+ 6.Charge:1.Service:3.Location 0 ; 613. Locations
+ 6.Charge:1.Service:3.Location:2.Immobilière 0 ; 6132. Locations immobilières
+ 6.Charge:1.Service:3.Location:5.Mobilière 0 ; 6135. Locations mobilières
+ 6.Charge:1.Service:4.Charge_locative 0 ; 614. Charges locatives et de copropriété
+ 6.Charge:1.Service:5.Entretien_Réparation 0 ; 615. Entretien et réparations
+ 6.Charge:1.Service:5.Entretien_Réparation:2.Bien_immobilier 0 ; 6152. Sur biens immobiliers
+ 6.Charge:1.Service:5.Entretien_Réparation:5.Bien_mobilier 0 ; 6155. Sur biens mobiliers
+ 6.Charge:1.Service:5.Entretien_Réparation:6.Maintenance 0 ; 6156. Maintenance
+ 6.Charge:1.Service:6.Assurance 0 ; 616. Primes d’assurance
+ 6.Charge:1.Service:8.Divers 0 ; 618. Divers
+ 6.Charge:1.Service:9:Remise 0 ; 619. Rabais, remises et ristournes obtenus sur services extérieurs
+ 6.Charge:2.Autre_service 0 ; 62. Autres services extérieurs
+ 6.Charge:2.Autre_service:1.Personnel_extérieur 0 ; 621. Personnel extérieur à l’association
+ 6.Charge:2.Autre_service:1.Personnel_extérieur:4.Mise_à_dispo 0 ; 6214. Personnel détaché ou prêté à l’association
+ 6.Charge:2.Autre_service:2.Intermédiaire 0 ; 622. Rémunérations d’intermédiaires et honoraires
+ 6.Charge:2.Autre_service:2.Intermédiaire:6.Honoraire 0 ; 6226. Honoraires
+ 6.Charge:2.Autre_service:2.Intermédiaire:7.Frais_d'acte 0 ; 6227. Frais d’actes et de contentieux
+ 6.Charge:2.Autre_service:2.Intermédiaire:8.Divers 0 ; 6228. Divers
+ 6.Charge:2.Autre_service:3.Communication 0 ; 623. Publicité, publications, relations publiques
+ 6.Charge:2.Autre_service:3.Communication:1.Annonce 0 ; 6231. Annonces et insertions
+ 6.Charge:2.Autre_service:3.Communication:3.Foire,Expo 0 ; 6233. Foires et expositions
+ 6.Charge:2.Autre_service:3.Communication:4:Cadeau 0 ; 6234. Cadeaux
+ 6.Charge:2.Autre_service:3.Communication:6.Catalogue,Imprimé 0 ; 6236. Catalogues et imprimés
+ 6.Charge:2.Autre_service:3.Communication:7.Publication 0 ; 6237. Publications
+ 6.Charge:2.Autre_service:3.Communication:8.Divers(pourboire,dons_courants) 0 ; 6238. Divers (pourboires, dons courants..)
+ 6.Charge:2.Autre_service:5.Frais 0 ; 625. Déplacements, missions et réceptions
+ 6.Charge:2.Autre_service:5.Frais:1.Déplacement 0 ; 6251. Voyages et déplacements
+ 6.Charge:2.Autre_service:5.Frais:6.Mission 0 ; 6256. Missions
+ 6.Charge:2.Autre_service:5.Frais:7.Réception 0 ; 6257. Réceptions
+ 6.Charge:2.Autre_service:6.Poste,Télécommunication 0 ; 626. Frais postaux et frais de télécommunications
+ 6.Charge:2.Autre_service:6.Poste,Télécommunication:1.Internet 0 ; 6261. Liaisons informatiques ou spécialisées
+ 6.Charge:2.Autre_service:6.Poste,Télécommunication:3.Timbre 0 ; 6263. Affranchissements
+ 6.Charge:2.Autre_service:7.Service_bancaire 0 ; 627. Services bancaires et assimilés
+ 6.Charge:2.Autre_service:8.Divers 0 ; 628. Divers
+ 6.Charge:2.Autre_service:8.Divers:1.Cotisation_(activité_économique) 0 ; 6281. Cotisations (liées à l’activité économique)
+ 6.Charge:2.Autre_service:8.Divers:4.Frais_recrutement_personnel 0 ; 6284. Frais de recrutement du personnel
+ 6.Charge:2.Autre_service:9.Remise 0 ; 629. Rabais, remises et ristournes obtenus sur autres services extérieurs
+ 6.Charge:3.Impôt 0 ; 63. Impôts, taxes et versements assimilés
+ 6.Charge:3.Impôt:1.Sur_rémunération_(État) 0 ; 631. Impôts, taxes et versements assimilés sur rémunérations (administration des impôts)
+ 6.Charge:3.Impôt:1.Sur_rémunération_(État):1.Taxe_salaire 0 ; 6311. Taxe sur les salaires
+ 6.Charge:3.Impôt:1.Sur_rémunération_(État):3.Formation_pro 0 ; 6313. Participation des employeurs à la formation professionnelle continue
+ 6.Charge:3.Impôt:1.Sur_rémunération_(État):8.Autre 0 ; 6318. Autres
+ 6.Charge:3.Impôt:3.Sur_rémunération_(Organisme) 0 ; 633. Impôts, taxes et versements assimilés sur rémunérations (autres organismes)
+ 6.Charge:3.Impôt:3.Sur_rémunération_(Organisme):3.Formation 0 ; 6333. Participation des employeurs à la formation professionnelle continue
+ 6.Charge:3.Impôt:3.Sur_rémunération_(Organisme):8.Autre 0 ; 6338. Autres
+ 6.Charge:3.Impôt:5.Autre_(État) 0 ; 635. Autres impôts, taxes et versements assimilés (administration des impôts)
+ 6.Charge:3.Impôt:5.Autre_(État):1.Direct_(sauf_bénéfice) 0 ; 6351. Impôts directs (sauf impôts sur les bénéfices)
+ 6.Charge:3.Impôt:5.Autre_(État):1.Direct_(sauf_bénéfice):2.Taxe_foncière 0 ; 63512. Taxes foncières
+ 6.Charge:3.Impôt:5.Autre_(État):1.Direct_(sauf_bénéfice):3.Autre_impôts_locaux 0 ; 63513. Autres impôts locaux
+ 6.Charge:3.Impôt:5.Autre_(État):1.Direct_(sauf_bénéfice):8.Autre 0 ; 63518. Autres impôts directs
+ 6.Charge:3.Impôt:5.Autre_(État):3.Indirect 0 ; 6353. Impôts indirects
+ 6.Charge:3.Impôt:7.Autre_(Organisme) 0 ; 637. Autres impôts, taxes et versements assimilés (autres organismes)
+ 6.Charge:4.Personnel 0 ; 64. Charges de personnel
+ 6.Charge:4.Personnel:1.Rémunération 0 ; 641. Rémunérations du personnel
+ 6.Charge:4.Personnel:1.Rémunération:1.Salaire 0 ; 6411. Salaires, appointements
+ 6.Charge:4.Personnel:1.Rémunération:2.Congés 0 ; 6412. Congés payés
+ 6.Charge:4.Personnel:1.Rémunération:3.Prime 0 ; 6413. Primes et gratifications
+ 6.Charge:4.Personnel:1.Rémunération:4.Indémnité 0 ; 6414. Indemnités et avantages divers
+ 6.Charge:4.Personnel:1.Rémunération:6.Remb_transport 0 ; 6416. Remboursement transport
+ 6.Charge:4.Personnel:5.Cotisation 0 ; 645. Cotisations de sécurité sociale et de prévoyance
+ 6.Charge:4.Personnel:5.Cotisation:1.URSSAF 0 ; 6451. Cotisations à l’URSSAF
+ 6.Charge:4.Personnel:5.Cotisation:2.Mutuelle 0 ; 6452. Cotisations aux mutuelles
+ 6.Charge:4.Personnel:5.Cotisation:3.Retraite 0 ; 6453. Cotisations aux caisses de retraite
+ 6.Charge:4.Personnel:5.Cotisation:4.Pôle_emploi 0 ; 6454. Cotisations aux ASSEDIC
+ 6.Charge:4.Personnel:5.Cotisation:8.Autre_organisme 0 ; 6458. Cotisations aux autres organismes sociaux
+ 6.Charge:4.Personnel:5.Cotisation:8.Autre_organisme:1.Prévoyance 0 ; 64581. Caisse de Prévoyance
+ 6.Charge:4.Personnel:7.Autre_cotisation 0 ; 647. Autres charges sociales
+ 6.Charge:4.Personnel:7.Autre_cotisation:5.Médecine_travail 0 ; 6475. Médecine de travail, pharmacie
+ 6.Charge:4.Personnel:8.Autre_charge_personnel 0 ; 648. Autres charges de personnel
+ 6.Charge:4.Personnel:8.Autre_charge_personnel:8.Cotisation_sur_rémunération_à_payer 0 ; 6488. Cotisations sur rémunérations à payer
+ 6.Charge:5.Gestion 0 ; 65. Autres charges de gestion courantes
+ 6.Charge:5.Gestion:1.Redevance_pour_concession,brevet,licence,procédé,droit 0 ; 651. Redevances pour concessions, brevets, licences, procédés, logiciels, droits et valeurs similaires
+ 6.Charge:5.Gestion:7.Subvention_versée 0 ; 657. Subventions versées par l’organisme
+ 6.Charge:5.Gestion:8.Divers 0 ; 658. Charges diverses de gestion courante
+ 6.Charge:5.Gestion:8.Divers:6.Cotisation_(vie_statutaire) 0 ; 6586. Cotisations (liées à la vie statutaire)
+ 6.Charge:6.Financière 0 ; 66. Charges financières
+ 6.Charge:6.Financière:1.Intérêt 0 ; 661. Charges d’intérêts
+ 6.Charge:6.Financière:1.Intérêt:1.Emprunt,Dette 0 ; 6611. Intérêts des emprunts et dettes
+ 6.Charge:6.Financière:1.Intérêt:6.Bancaire 0 ; 6616. Intérêts bancaires
+ 6.Charge:6.Financière:1.Intérêt:8.Autre_dette 0 ; 6618. Intérêts des autres dettes
+ 6.Charge:6.Financière:8.Autre 0 ; 668. Autres charges financières
+ 6.Charge:7.Exceptionnelle 0 ; 67. Charges exceptionnelles
+ 6.Charge:7.Exceptionnelle:1.Sur_gestion 0 ; 671. Charges exceptionnelles sur opérations de gestion
+ 6.Charge:7.Exceptionnelle:1.Sur_gestion:1.Pénalité_sur_marché 0 ; 6711. Pénalités sur marchés (et dédits payés sur achats et ventes)
+ 6.Charge:7.Exceptionnelle:1.Sur_gestion:2.Pénalité,Amende 0 ; 6712. Pénalités, amendes fiscales ou pénales
+ 6.Charge:7.Exceptionnelle:1.Sur_gestion:3.Don,Libéralité 0 ; 6713. Dons, libéralités
+ 6.Charge:7.Exceptionnelle:1.Sur_gestion:7.Rappel_impôt_(sauf_bénéfice) 0 ; 6717. Rappels d’impôts (autres qu’impôts sur les bénéfices)
+ 6.Charge:7.Exceptionnelle:1.Sur_gestion:8.Autre 0 ; 6718. Autres charges exceptionnelles sur opérations de gestion
+ 6.Charge:7.Exceptionnelle:8.Autre 0 ; 678. Autres charges exceptionnelles
+ 6.Charge:7.Exceptionnelle:8.Autre:8.Diverse 0 ; 6788. Charges exceptionnelles diverses
+ 6.Charge:8.Dotation 0 ; 68. Dotations aux amortissements, dépréciations, provisions et engagements
+ 6.Charge:8.Dotation:1.Charge_d'exploitation 0 ; 681. Dotations aux amortissements et aux provisions - Charges d'exploitation
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:1.Amortissement_immobilisation 0 ; 6811. Dotations aux amortissements des immobilisations incorporelles et corporelles
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:1.Amortissement_immobilisation:1.Incorporelle 0 ; 68111. Immobilisations incorporelles
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:1.Amortissement_immobilisation:2.Corporelle 0 ; 68112. Immobilisations corporelles
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:5.Provision_d'exploitation 0 ; 6815. Dotations aux provisions pour risques et charges d’exploitation
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:7.Dépréciation_actif 0 ; 6817. Dotations aux provisions pour dépréciation des actifs circulants
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:7.Dépréciation_actif:3.Stocks,En-cours 0 ; 68173. Stocks et en-cours
+ 6.Charge:8.Dotation:1.Charge_d'exploitation:7.Dépréciation_actif:4.Créance 0 ; 68174. Créances
+ 6.Charge:8.Dotation:6.Charge_financière 0 ; 686. Dotations aux amortissements et aux provisions - Charges financières
+ 6.Charge:8.Dotation:6.Charge_financière:5.Provision_financière 0 ; 6865. Dotations aux provisions pour risques et charges financiers
+ 6.Charge:8.Dotation:6.Charge_financière:6.Dépréciation_élément_financier 0 ; 6866. Dotations aux provisions pour dépréciation des éléments financiers
+ 6.Charge:8.Dotation:6.Charge_financière:8.Autre 0 ; 6868. Autres dotations
+ 6.Charge:8.Dotation:7.Charge_exceptionnelle 0 ; 687. Dotations aux amortissements et aux provisions - Charges exceptionnelles
+ 6.Charge:8.Dotation:9.Engagement_à_réaliser 0 ; 689. Engagements à réaliser sur ressources affectées
+ 6.Charge:8.Dotation:9.Engagement_à_réaliser:4.Sur_subvention_attribuée 0 ; 6894. Engagements à réaliser sur subventions attribuées
+ 6.Charge:8.Dotation:9.Engagement_à_réaliser:5.Sur_don_affecté 0 ; 6895. Engagements à réaliser sur dons manuels affectés
+ 6.Charge:9.Impôt_sur_bénéfice 0 ; 69. Impôts sur les bénéfices
+ 6.Charge:9.Impôt_sur_bénéfice:5.Impôt_sur_société 0 ; 695.Impôts sur les sociétés
+ 7.Produit 0 ; 7. COMPTES DE PRODUITS
+ 7.Produit:0.Vente 0 ; 70. ventes de produits finis, prestations de services, marchandises
+ 7.Produit:0.Vente:1.Produit_fini 0 ; 701. Ventes de produits finis
+ 7.Produit:0.Vente:1.Produit_fini:1.Vélo 0 ; 7011. Vélos
+ 7.Produit:0.Vente:1.Produit_fini:2.Autre 0 ; 7012. Autres
+ 7.Produit:0.Vente:6.Prest'action 0 ; 706. Prestations de services
+ 7.Produit:0.Vente:7.Marchandise 0 ; 707. Ventes de marchandises
+ 7.Produit:0.Vente:8.Activité_annexe 0 ; 708. Produits des activités annexes
+ 7.Produit:0.Vente:8.Activité_annexe:3.Location 0 ; 7083. Locations diverses
+ 7.Produit:0.Vente:8.Activité_annexe:4.Mise_à_dispo 0 ; 7084. Mise à disposition de personnel facturée
+ 7.Produit:0.Vente:8.Activité_annexe:8.Autre 0 ; 7088. Autres produits d’activités annexes
+ 7.Produit:1.Production_stockée 0 ; 71. Production stockée (ou déstockage)
+ 7.Produit:2.Production_immobilisée 0 ; 72. Production immobilisée
+ 7.Produit:4.Subvention_d'exploitation 0 ; 74. Subventions d’exploitation
+ 7.Produit:4.Subvention_d'exploitation:1.État 0 ; 741. État
+ 7.Produit:4.Subvention_d'exploitation:2.Région 0 ; 742. Région
+ 7.Produit:4.Subvention_d'exploitation:3.Département 0 ; 743. Département
+ 7.Produit:4.Subvention_d'exploitation:4.Commune 0 ; 744. Commune
+ 7.Produit:4.Subvention_d'exploitation:5.Collectivité_publique 0 ; 745. Collectivités publiques
+ 7.Produit:4.Subvention_d'exploitation:6.Entreprise_publique 0 ; 746. Entreprises publiques
+ 7.Produit:4.Subvention_d'exploitation:7.Organisme_privé 0 ; 747. Entreprises et organismes privés
+ 7.Produit:4.Subvention_d'exploitation:8.Autre 0 ; 748. Autres
+ 7.Produit:5.Autre_gestion_courante 0 ; 75. Autres produits de gestion courante
+ 7.Produit:5.Autre_gestion_courante:4.Collecte 0 ; 754. Collectes
+ 7.Produit:5.Autre_gestion_courante:6.Cotisation 0 ; 756. Cotisations
+ 7.Produit:5.Autre_gestion_courante:8.Divers 0 ; 758. Produits divers de gestion courante
+ 7.Produit:5.Autre_gestion_courante:8.Divers:1.Don 0 ; 7581. Dons manuels
+ 7.Produit.6.Financier 0 ; 76. Produits financiers
+ 7.Produit.6.Financier:1.Participation 0 ; 761. Produits des participations
+ 7.Produit.6.Financier:1.Participation:1.Titre 0 ; 7611. Revenus des titres de participations
+ 7.Produit.6.Financier:2.Autre_immobilisation_financière 0 ; 762. Produits des autres immobilisations financières
+ 7.Produit.6.Financier:2.Autre_immobilisation_financière:4.Prêt 0 ; 7624. Revenus des prêts
+ 7.Produit.6.Financier:3.Autre_créance 0 ; 763. Revenus des autres créances
+ 7.Produit.6.Financier:8.Autre 0 ; 768. Autres produits financiers
+ 7.Produit.7.Exceptionnel 0 ; 77. Produits exceptionnels
+ 7.Produit.7.Exceptionnel:1.Sur_gestion 0 ; 771. Produits exceptionnels sur opérations de gestion
+ 7.Produit.7.Exceptionnel:1.Sur_gestion:3.Libéralité_reçue 0 ; 7713. Libéralités perçues
+ 7.Produit.7.Exceptionnel:1.Sur_gestion:5.Subvention_d'équilibre 0 ; 7715. Subvention d’équilibre
+ 7.Produit.7.Exceptionnel:1.Sur_gestion:8.Autre 0 ; 7718. Autres produits exceptionnels sur opérations de gestion
+ 7.Produit.7.Exceptionnel:2.Sur_exercice_antérieur 0 ; 772. Produits sur exercices antérieurs (à reclasser)
+ 7.Produit.7.Exceptionnel:7.Quote-part_subvention_investissement_virée_au_résultat 0 ; 777. Quote-part des subventions d’investissement virée au résultat de l’exercice
+ 7.Produit.7.Exceptionnel:8.Autre 0 ; 778. Autres produits exceptionnels
+ 7.Produit:8.Reprise 0 ; 78. Reprises sur amortissements et provisions
+ 7.Produit:8.Reprise:1.Amortissement,Provision_(exploitation) 0 ; 781. Reprises sur amortissements et provisions (à inscrire dans les produits d’exploitation)
+ 7.Produit:8.Reprise:1.Amortissement,Provision_(exploitation):1.Amort_immo_incorp&corpl 0 ; 7811. Reprises sur amortissements des immobilisations incorporelles et corporelles
+ 7.Produit:8.Reprise:1.Amortissement,Provision_(exploitation):5.Provision_risque&charge 0 ; 7815. Reprises sur provisions pour risques et charges d’exploitation
+ 7.Produit:8.Reprise:6.Provision_(financier) 0 ; 786. Reprises sur provisions (à inscrire dans les produits financiers)
+ 7.Produit:8.Reprise:7.Provision_(exceptionnel) 0 ; 787. Reprises sur provisions (à inscrire dans les produits exceptionnels)
+ 7.Produit:8.Reprise:9.Report_ressource_N-1 0 ; 789. Report des ressources non utilisées des exercices antérieurs
+ 7.Produit:8.Reprise:9.Report_ressource_N-1:4.Sur_subvention_attribuée 0 ; 7894. Sur subventions attribués
+ 7.Produit:8.Reprise:9.Report_ressource_N-1:5.Sur_don_reçus 0 ; 7895. Sur dons manuels reçus
+ 7.Produit:9.Transfert_charge 0 ; 79. Transferts de charges
+ 7.Produit:9.Transfert_charge:1.Exploitation 0 ; 791. Transferts de charges d’exploitation
+ 7.Produit:9.Transfert_charge:6.Financière 0 ; 796. Transferts de charges financières
+ 7.Produit:9.Transfert_charge:7.Exceptionnelle 0 ; 797. Transferts de charges exceptionnelles
+ 8.Spécial 0 ; 8. COMPTES SPÉCIAUX
+ 8.Spécial:6.Emploi_contribution_volontaire 0 ; 86. Emplois des contributions volontaires en nature
+ 8.Spécial:6.Emploi_contribution_volontaire:1.Mise_à_dispo_bien 0 ; 861. Mise à disposition gratuite de biens
+ 8.Spécial:6.Emploi_contribution_volontaire:2.Prestation 0 ; 862. Prestations
+ 8.Spécial:6.Emploi_contribution_volontaire:4.Bénévolat 0 ; 864. Personnel bénévole
+ 8.Spécial:7.Contribution_volontaire 0 ; 87. Contributions volontaires en nature
+ 8.Spécial:7.Contribution_volontaire:0.Bénévolat 0 ; 870. Bénévolat
+ 8.Spécial:7.Contribution_volontaire:1.Prestation_en_nature 0 ; 871. Prestations en nature
+ 8.Spécial:7.Contribution_volontaire:5.Don_en_nature 0 ; 875. Dons en nature
+
+; NOTE: pour le complètement, possibilité d’utiliser :
+; vim: iskeyword+=.,38,39,40,41,44,45,58
--- /dev/null
+#!/usr/bin/perl
+# DESCRIPTION: import from [Oxygène](http://www.memsoft.fr) to [hledger](http://hledger.org)
+# AUTHOR: Julien Moutinho <julm+hledger@autogeree.net>
+# LICENSE: [GPLv3+](https://www.gnu.org/licenses/gpl-3.0.html)
+# NOTE: should be easily hackable to import from other .csv
+# USAGE:
+# % hledger-print-csv -f Chart_of_accounts.hledger >Chart_of_accounts.csv
+# % iconv -f latin1 -t utf8 <EXPORT.oxygen.csv |
+# perl hledger-of-oxygen-csv.pl \
+# Chart_of_accounts.csv \
+# >EXPORT.oxygen.hledger
+#
+# FORMAT of EXPORT.oxygen.csv:
+# ----
+# NUMJL;LIBJL;DTOPE;NPIEC;NUMCP;LIBCP;CODCP;LIBEC;MTDEB;MTCRE;COTVA;TXTVA
+# 60;Achats;01/01/2012;ACH01/76;401REGIEQUART;REGIE DE QUARTIER;REGIE DE QUARTI;LOYER LOCAL DEC. 2011+1T 2012 REGIE QUAR;0,00;1410,91;;0,00
+# 60;Achats;01/01/2012;ACH01/76;6132000;LOYER LOCAL 15 rue P. BONNARD;LOYER BONNARD;LOYER LOCAL DEC. 2011+1T 2012 REGIE QUAR;1076,25;0,00;;0,00
+# 60;Achats;01/01/2012;ACH01/76;6165000;Responsabilité civile;;ASSURANCE LOCAL 2012 VIA REGIEQUARTIER;86,47;0,00;;0,00
+# 60;Achats;01/01/2012;ACH01/76;6140000;Charges locatives et de copropriété;;CHARGES LOCAL 1T 2012;248,19;0,00;;0,00
+# ; ... And so on.. and so forth..
+# ----
+#
+# FORMAT of Chart_of_accounts.hledger:
+#
+# Pattern:
+# ----
+# 01/01
+# 0.ZZZ:1.YYY:2.XXX 0; 012. Description
+# 0.ZZZ:1.YYY:3.WWW 0; 013. Description
+# 0.ZZZ:1.YYY:3.WWW.4.VVV 0; 0134. Description
+# ; ... And so on.. and so forth..
+# ----
+#
+# For exemple:
+# ----
+# 01/01 Plan comptable des associations
+# 1.Capital 0 ; 1. COMPTES DE CCOAITAUX
+# 1.Capital:0.Fonds 0 ; 10. Fonds associatifs et reserves
+# 2.Immobilisation 0 ; 2. COMPTES D'IMMOBILISATIONS
+# 2.Immobilisation:1.Corporelle 0 ; 21. Immobilisations corporelles
+# 4.Tiers 0 ; 4. COMPTES TIERS
+# 4.Tiers:0.Fournisseur 0 ; 40. Fournisseurs et comptes rattachés
+# 5.Finance 0 ; 5. COMPTES FINANCIERS
+# 5.Finance:1.Etablissement 0 ; 51. Banques, établissements financiers et assimilés
+# 5.Finance:1.Etablissement:1.Valeur 0 ; 511. Valeurs à l’encaissement
+# 5.Finance:1.Etablissement:1.Valeur:2.Chèque_à_encaisser 0 ; 5112. Chèques à encaisser
+# 5.Finance:1.Etablissement:2.Banque:001.Courant 0 ; 512001. Crédit Coopératif - Compte courant
+# 5.Finance:1.Etablissement:2.Banque:002.Livret 0 ; 512002. Crédit coopératif - Livret
+# 6.Charge 0 ; 6. COMPTES D'ACHATS
+# 6.Charge:1.Service 0 ; 61. Services extérieurs
+# 6.Charge:2.Autre_service 0 ; 62. Autres services extérieurs
+# 6.Charge:3.Impôt 0 ; 63. Impôts, taxes et versements assimilés
+# 6.Charge:4.Personnel 0 ; 64. Charges de personnel
+# 6.Charge:5.Gestion 0 ; 65. Autres charges de gestion courantes
+# 6.Charge:8.Dotation 0 ; 68. Dotations aux amortissements, dépréciations, provisions et engagements
+# 7.Produit 0 ; 7. COMPTES DE PRODUITS
+# 7.Produit:0.Vente 0 ; 70. ventes de produits finis, prestations de services, marchandises
+# ; ... And so on.. and so forth..
+# ----
+
+our $VERSION = '2014.07.22';
+use strict;
+use warnings FATAL => qw(all);
+use utf8;
+use open qw/:std :utf8/;
+require Data::Dumper;
+require Encode;
+require IO::Wrap;
+require Text::CSV;
+#require Text::CSV::Encoded;
+require Text::Trim;
+
+sub parse_date (@) {
+ ($_) = @_;
+ my ($jj,$mm,undef,$yy) = ($_ =~ m{^\s*([0-3]?[0-9])\s*/\s*([0-1]?[0-9])\s*/\s*(20)?([0-9][0-9])\s*$});
+ return "20$yy/$mm/$jj";
+ }
+sub parse_code (@) {
+ ($_) = @_;
+ my ($code) = ($_ =~ m{^([0-9]*?)0*$});
+ return (defined $code ? $code : $_);
+ }
+sub parse_journal (@) {
+ ($_) = @_;
+ $_ = Text::Trim::trim($_);
+ s/\s/_/g;
+ return $_;
+ }
+
+sub parse_csv_line (@) {
+ my ($nth, $h, $c) = @_;
+ #print STDERR ("parse_csv_line: csv_line($nth)=".Data::Dumper::Dumper($c));
+ my $date = parse_date($c->{date});
+ $h->{$date} = {}
+ unless defined $h->{$date};
+ my $t;
+ if (exists $h->{$date}->{$c->{transaction}}) {
+ $t = $h->{$date}->{$c->{transaction}};
+ }
+ else {
+ $t =
+ { journal => parse_journal($c->{journal})
+ , journal_code => $c->{journal_code}
+ , postings => []
+ };
+ $h->{$date}->{$c->{transaction}} = $t;
+ }
+
+ my $amount;
+ if (defined $c->{debit} and $c->{debit} eq '0,00') {
+ $amount = "-$c->{credit}";
+ }
+ elsif (defined $c->{credit} and $c->{credit} eq '0,00') {
+ $amount = "$c->{debit}";
+ }
+ else { die "ERROR: wrong credit/debit: CSV#$nth: ".Data::Dumper::Dumper($c); }
+
+ push $t->{postings},
+ { account => parse_code($c->{account})
+ , amount => $amount
+ , comment => $c->{account_name}
+ , csv_nth => $nth+2
+ }
+ }
+sub print_hledger (@) {
+ my ($h, $ap) = @_;
+ foreach my $date (sort {$a cmp $b} (keys %$h)) {
+ my $transactions = $h->{$date};
+ while (my ($transaction, $t) = each %$transactions) {
+ print STDOUT "$date $transaction ; Journal:$t->{journal}\n";
+ my $wmax = 0;
+ foreach my $a (@{$t->{postings}}) {
+ if (not defined $a->{account}) {
+ print STDERR Data::Dumper::Dumper($t);
+ die "ERROR: wrong account in t=$transaction";
+ }
+ if (defined $ap->{$a->{account}}) {
+ $a->{account} = $ap->{$a->{account}}->{account}
+ }
+ my $w = 0 + length ($a->{account});
+ $wmax = $w
+ if $wmax < $w;
+ }
+ my $p = $t->{postings};
+ foreach my $a (sort {$a->{account} cmp $b->{account}} @$p) {
+ print STDOUT "\t$a->{account} $a->{amount} ; $a->{comment} CSV#.$a->{csv_nth}\n";
+ }
+ }
+ }
+ }
+sub parse_chart_of_accounts (@) {
+ my ($coa_file) = @_;
+ my %ap = ();
+ my $csv = Text::CSV->new
+ ({binary => 1
+ , eol => $/
+ , sep_char => ','
+ });
+ print STDERR ("Chart_of_accounts: ", $coa_file, "\n");
+ open (my $COA, "<:encoding(utf8)", $coa_file)
+ or die "ERROR: opening accounting plan given as first argument";
+ #my $coa_in = IO::Wrap::wraphandle($COA);
+ my $coa_head = $csv->getline($COA);
+ print STDERR ("coa_head: ", join("|", @$coa_head), "\n");
+ $csv->column_names(@$coa_head);
+ my $nth = 1;
+ while (my $csv_line = $csv->getline_hr($COA)) {
+ $nth++;
+ my $post_cmt = $csv_line->{'posting-comment'};
+ die "ERROR: no posting-comment COA#$nth: ".Data::Dumper::Dumper($csv_line)
+ if not defined $post_cmt;
+ my ($code, $description) = ($post_cmt =~ m{^([0-9]+)\.\s*(.*)$});
+ die "ERROR: cannot extract code in accounting plan: posting-comment COA#$nth: $csv_line->{'posting-comment'}"
+ if not defined $code;
+ $ap{$code} =
+ { account => $csv_line->{account}
+ , description => $description
+ };
+ }
+ print STDERR "Chart_of_accounts: ".Data::Dumper::Dumper(\%ap);
+ return \%ap;
+ }
+
+sub main () {
+ my $ap = parse_chart_of_accounts($ARGV[0]);
+ my $csv = Text::CSV->new
+ ({binary => 1
+ , eol => $/
+ , sep_char => ';'
+ });
+ my $in = IO::Wrap::wraphandle(\*STDIN);
+ binmode STDOUT, ':utf8';
+ my $csv_head = $csv->getline($in);
+ #print STDERR ("head: ", join("|", @$csv_head), "\n");
+ #$csv->column_names(@$csv_head);
+ $csv->column_names (qw (
+ journal_code
+ journal
+ date
+ transaction
+ account
+ account_name
+ account_code
+ description
+ debit
+ credit
+ COTVA
+ TXTVA
+ ));
+ my $hledger_data = {};
+
+ my $members = {};
+ my $nth = 0;
+ while (my $csv_line = $csv->getline_hr($in)) {
+ #print STDERR ("csv_line: ", join("|", @$csv_line), "\n");
+ parse_csv_line(2 + $nth++, $hledger_data, $csv_line);
+ }
+ #print STDERR "hledger_data=".Data::Dumper::Dumper($hledger_data);
+ print_hledger($hledger_data, $ap);
+ #my $out = IO::Wrap::wraphandle(\*STDERR);
+ }
+
+main;
--- /dev/null
+#!/usr/bin/env runhaskell
+{-|
+hledger-range-voting [-f JOURNALFILE]
+
+Perform range voting calculus
+on the default or specified journal.
+|-}
+
+import Data.List
+--import Data.List (mapAccumL)
+import Data.Maybe
+import Data.Ord
+import Data.Time.Calendar
+import System.Console.CmdArgs.Explicit
+import Text.Printf
+import qualified Data.Map as Map
+
+import Hledger
+import Hledger.Cli
+import Hledger.Cli.Options
+-- import Prelude hiding (putStr)
+import Hledger.Utils.UTF8IOCompat (putStr)
+
+
+argsmode :: Mode RawOpts
+argsmode = (defCommandMode ["range-voting"])
+ { modeHelp = "perform range voting"
+ , modeGroupFlags = Group
+ { groupNamed =
+ [ ("Input",inputflags)
+ , ("Reporting",reportflags)
+ , ("Misc",helpflags)
+ ]
+ , groupUnnamed = []
+ , groupHidden = []
+ }
+ }
+
+
+-- like Register.summarisePostings
+-- | Print various statistics for the journal.
+main :: IO ()
+main = do
+ opts <- getCliOpts argsmode
+ withJournalDo opts $
+ \CliOpts{reportopts_=reportopts_} j -> do
+ d <- getCurrentDay
+ let q = queryFromOpts d reportopts_
+ let l = ledgerFromJournal q j
+ let reportspan = (ledgerDateSpan l) `spanDefaultsFrom` (queryDateSpan False q)
+ let intervalspans = splitSpan (intervalFromOpts reportopts_) reportspan
+ let s = intercalate "\n" $ map (showRangeVoting reportopts_{empty_=True} l d) intervalspans
+ putStr s
+
+data Stats =
+ Stats
+ { stats_choice :: String
+ , stats_sum :: Double
+ , stats_blank_count :: Int
+ , stats_null_count :: Int
+ , stats_null_value :: Double
+ , stats_values :: [(Int,Int)]
+ }
+stats :: Stats
+stats = Stats
+ { stats_choice = ""
+ , stats_sum = 0.0
+ , stats_blank_count = 0
+ , stats_null_count = 0
+ , stats_null_value = 0.0
+ , stats_values = []
+ }
+
+
+showRangeVoting :: ReportOpts -> Ledger -> Day -> DateSpan -> String
+showRangeVoting ropts l today span =
+ unlines $ map (\(label,value) -> concatBottomPadded [printf fmt1 label, value]) main
+ where
+ fmt1 = "%-" ++ show w1 ++ "s: "
+ -- fmt2 = "%-" ++ show w2 ++ "s"
+ w1 = maximum $ map (length . fst) main
+ -- w2 = maximum $ map (length . show . snd) main
+ main =
+ concat $
+ [ [("Span vote (official)", printf "%s to %s (%d days)" (show $ (tdate opening)) (show $ (tdate2 opening)) votedays)
+ ,("Span vote (actual)", printf "%s to %s (%d days)" (start span) (end span) days)
+ ,("Cardinal", printf "%d" cardinal)
+ ,("Values", "{"++(intercalate "," $ map (printf "%d") values)++"}")
+ ,("Quorum", printf "%d/%d (%f%%)" votesnum votersnum (fromIntegral votesnum*100.0/fromIntegral votersnum::Double))
+ ,("Blanks", printf "%d" $ foldl (\acc t -> acc + stats_blank_count t) 0 stats)
+ ,("Nulls", printf "%d" $ foldl (\acc t -> acc + stats_null_count t) 0 stats)
+ ,("Medians", "")
+ ]
+ , map (\t ->
+ ( printf " - %s" (stats_choice t)
+ , printf "sum: %+.f" (stats_sum t)
+ ) ) medians
+ , [("Choices", printf "%d" nchoices)
+ ]
+ , map
+ (\t ->
+ ( printf " - %s" (stats_choice t)
+ , printf "sum: %+f = %d*(0:blank) + %d*(%+.2f:null) + %s"
+ (stats_sum t)
+ (stats_blank_count t)
+ (stats_null_count t)
+ (stats_null_value t)
+ (intercalate " + " $ map (\(value,sum) -> printf "%d*(%+d)" sum value) (stats_values t))
+ )
+ ) stats
+ --,("Commodities", printf "%s (%s)" (show $ length cs) (intercalate ", " cs))
+ ]
+ where
+ j = ljournal l
+ ts = sortBy (comparing tdate) $ filter (spanContainsDate span . tdate) $ jtxns j
+ as = nub $ map paccount $ concatMap tpostings ts
+ cs = Map.keys $ canonicalStyles $ concatMap amounts $ map pamount $ concatMap tpostings ts
+ showelapsed Nothing = ""
+ showelapsed (Just days) = printf " (%d %s)" days' direction
+ where days' = abs days
+ direction | days >= 0 = "days ago" :: String
+ | otherwise = "days from now"
+ start (DateSpan (Just d) _) = show d
+ start _ = ""
+ end (DateSpan _ (Just d)) = show d
+ end _ = ""
+ days = fromMaybe 0 $ daysInSpan span
+ votedays = fromMaybe 0 $ daysInSpan
+ (DateSpan
+ (Just (tdate opening))
+ (maybe Nothing Just (tdate2 opening)))
+ acctnum = length as
+ openings = filter ((== "Opening") . tdescription) $ ts
+ opening | null openings = error' "\"Opening\" transaction is missing"
+ | otherwise = head $ openings
+ cardinals = filter ((== "Cardinal") . fst) $ ttags opening
+ cardinal | null cardinals = error' "\"Cardinal\" tag is missing on \"Opening\" transaction"
+ | otherwise = read $ snd $ head $ cardinals :: Int
+ values | (cardinal `mod` 2 == 0) = delete 0 [-cardinal`div`2..cardinal`div`2]
+ | otherwise = [-(cardinal-1)`div`2..(cardinal-1)`div`2]
+ choices =
+ map paccount $
+ filter (isPrefixOf "Choice:" . paccount) $
+ tpostings opening
+
+ votes = filter ((== "Vote") . tdescription) $ ts
+ stats =
+ sortBy (\a b -> (stats_sum b) `compare` (stats_sum a)) $
+ map (\s ->
+ let mean = fromIntegral (foldl (\acc (v,c) -> acc + (v * c)) 0 (stats_values s)) / fromIntegral (length (stats_values s)) in
+ s
+ { stats_null_value = mean
+ , stats_sum = (stats_sum s) + (mean * fromIntegral (stats_null_count s))
+ }) $
+ foldl (\s vote ->
+ map (\s ->
+ case filter ((== stats_choice s) . paccount) (tpostings vote) of
+ [] -> s { stats_blank_count = stats_blank_count s + 1 }
+ [choice_posting] ->
+ case pamount choice_posting of
+ Mixed [Amount{acommodity="", aquantity=q, aprice=NoPrice}] ->
+ let i = floor q in
+ if snd (properFraction q) == 0.0 && i `elem` values
+ then s
+ { stats_sum = stats_sum s + fromIntegral i
+ , stats_values = map (\(v,c) -> if v == i then (v,c+1) else (v,c)) (stats_values s)
+ }
+ else s { stats_null_count = stats_null_count s + 1 } -- error' $ printf "TODO: null vote: invalid value: %f" q
+ _ -> s { stats_null_count = stats_null_count s + 1 } -- error' "TODO: null vote: too much informations"
+ _ -> s { stats_null_count = stats_null_count s + 1 }
+ )
+ s
+ )
+ [ Stats
+ { stats_choice = choice
+ , stats_sum = 0.0
+ , stats_blank_count = 0
+ , stats_null_count = 0
+ , stats_null_value = 0.0
+ , stats_values = [(value,0) | value<-values]
+ }
+ | choice<-choices ]
+ votes
+
+ medians =
+ filter (\c -> stats_sum c `elem` medians) stats
+ where medians =
+ if length choices `mod` 2 == 0
+ then map (stats_sum . (!!) stats) [nchoices `div` 2 - 1, nchoices `div` 2 + 1]
+ else map (stats_sum . (!!) stats) [(nchoices - 1) `div` 2]
+
+ nchoices = length choices
+
+ -- choicesbalancesropts = ropts{query_="Choice:"}
+ -- choicesbalances = tail $ fst $ balanceReport ropts (queryFromOpts today choicesbalancesropts) j
+
+ voteras = filter (isPrefixOf "Voter:" . paccount) $ tpostings opening
+ votests = filter ((== "Vote") . tdescription) $ ts
+ votesnum = length votests
+ votersnum = length voteras
+ votechoicesps = filter (isPrefixOf "Choice:" . paccount) $ tpostings opening