From f36c5ce2b4490265c0977c1aa7bbb3cb712e1bea Mon Sep 17 00:00:00 2001
From: Ebersold Andre 
Date: Sun, 2 Jan 2022 21:10:03 +0100
Subject: [PATCH 1/1] Initial import from syndic-dev svn
---
 .gitmodules                                   |   12 +
 accounting/accueil.en_US.UTF-8.xml            |   72 +
 accounting/accueil.fr_FR.UTF-8.xml            |   75 +
 accounting/bilan.fr_FR.UTF-8.xml              |    7 +
 accounting/budget.fr_FR.UTF-8.xml             |   13 +
 accounting/cgu.fr_FR.UTF-8.xml                |   23 +
 accounting/contact.en_US.UTF-8.xml            |   34 +
 accounting/contact.fr_FR.UTF-8.xml            |   34 +
 accounting/copro_exercice.fr_FR.UTF-8.xml     |    7 +
 accounting/copro_lots.fr_FR.UTF-8.xml         |    6 +
 .../copro_lots_attribuer.fr_FR.UTF-8.xml      |    4 +
 accounting/copropriete.fr_FR.UTF-8.xml        |    8 +
 accounting/dede.txt                           |   16 +
 accounting/donates.fr_FR.UTF-8.xml            |   29 +
 accounting/fournisseur.fr_FR.UTF-8.xml        |   13 +
 accounting/journaux.fr_FR.UTF-8.xml           |   17 +
 accounting/liens_syndic.en_US.UTF-8.xml       |   21 +
 accounting/liens_syndic.fr_FR.UTF-8.xml       |   30 +
 accounting/plan_comptable.fr_FR.UTF-8.xml     |   10 +
 accounting/products.en_US.UTF-8.xml           |   41 +
 accounting/products.fr_FR.UTF-8.xml           |   42 +
 accounting/services.en_US.UTF-8.xml           |   21 +
 accounting/services.fr_FR.UTF-8.xml           |   34 +
 accueil.en_US.UTF-8.xml                       |   73 +
 accueil.fr_FR.UTF-8.xml                       |   71 +
 accueil.xml                                   |   98 +
 app/admin/crontab.php                         |   28 +
 app/admin/index.js                            |  141 +
 app/admin/patch_db.php                        |   65 +
 app/admin/view/index.fr_FR.UTF-8.xml          |  351 +
 app/basic.php                                 |  222 +
 app/common.php                                |  138 +
 app/compta/Accounting.mysql.keep              | 2414 ++++++
 app/compta/Dialog.js                          |   83 +
 app/compta/api/bank.php                       |   55 +
 app/compta/api_base.php                       |  153 +
 app/compta/api_booking.php                    |  365 +
 app/compta/api_budget.php                     |  157 +
 app/compta/api_entretien.php                  |   90 +
 app/compta/api_exercice.php                   |  224 +
 app/compta/api_identity.php                   |  335 +
 app/compta/api_loan.php                       |  138 +
 app/compta/api_pcmn.php                       |  220 +
 app/compta/api_recurrent.php                  |  145 +
 app/compta/api_retrieve.php                   |  319 +
 app/compta/api_syndic.php                     |  295 +
 app/compta/bilan.js                           |   69 +
 app/compta/bilanBootstrap.js                  |   41 +
 app/compta/budget.js                          |  257 +
 app/compta/budgetBootstrap.js                 |   59 +
 app/compta/budget_edit.xml                    |   60 +
 app/compta/class.schema.php                   |  119 +
 app/compta/controler_base.php                 |   59 +
 app/compta/controlers/account.php             |   75 +
 app/compta/controlers/admin.php               |   44 +
 app/compta/controlers/bank.php                |   90 +
 app/compta/controlers/bilan.php               |   44 +
 app/compta/controlers/bill.php                |    0
 app/compta/controlers/budget.php              |   74 +
 app/compta/controlers/chart.php               |   44 +
 app/compta/controlers/compta.php              |  137 +
 app/compta/controlers/exercice.php            |   93 +
 app/compta/controlers/jrnx.php                |   44 +
 app/compta/controlers/loan.php                |  105 +
 app/compta/controlers/lot.php                 |   81 +
 app/compta/controlers/org.php                 |   44 +
 app/compta/controlers/recurrent.php           |  106 +
 app/compta/controlers/supplier.php            |   47 +
 app/compta/controlers/transaction.php         |   41 +
 app/compta/copro.js                           |  787 ++
 app/compta/coproBootstrap.js                  |   54 +
 app/compta/copro_decompte.xml                 |  102 +
 app/compta/copro_entretien.xml                |   47 +
 app/compta/copro_pay.xml                      |   68 +
 app/compta/copro_role.xml                     |   54 +
 app/compta/copro_users.xml                    |   44 +
 app/compta/coprote.js                         |  193 +
 app/compta/coproteBootstrap.js                |   71 +
 app/compta/entretien.js                       |   71 +
 app/compta/exercice.js                        |  204 +
 app/compta/exercice.xml                       |   62 +
 app/compta/exerciceBootstrap.js               |   63 +
 app/compta/forms.php                          |  197 +
 app/compta/index.php                          |  117 +
 app/compta/index.xml                          |  240 +
 app/compta/journaux.js                        |  764 ++
 app/compta/journaux.xml                       |  240 +
 app/compta/jrnx.xml                           |   62 +
 app/compta/jrnxBootstrap.js                   |   51 +
 app/compta/jrnx_detail.xml                    |   62 +
 app/compta/jrnx_record.xml                    |   80 +
 app/compta/jrnx_trans.xml                     |   60 +
 app/compta/ledger_church.xml                  |  396 +
 app/compta/ledger_create.xml                  |  179 +
 app/compta/ledger_syndic.xml                  |  538 ++
 app/compta/logging.php                        |  120 +
 app/compta/lot.xml                            |  121 +
 app/compta/lot_attribuer.xml                  |   51 +
 app/compta/lot_charge.xml                     |  125 +
 app/compta/lots.js                            |  334 +
 app/compta/models/account.php                 |   61 +
 app/compta/models/bank.php                    |   58 +
 app/compta/models/budget.php                  |   48 +
 app/compta/models/loan.php                    |  121 +
 app/compta/models/lot.php                     |   65 +
 app/compta/models/recurrent.php               |  119 +
 app/compta/models/transaction.php             |   33 +
 app/compta/page_ledger.php                    |  286 +
 app/compta/page_ledger_coproprietaire.php     |  129 +
 app/compta/page_ledger_entretien.php          |   84 +
 app/compta/page_ledger_exercice.php           |   85 +
 app/compta/page_ledger_fournisseur.php        |   53 +
 app/compta/page_ledger_journaux.php           |   85 +
 app/compta/page_ledger_mes_documents.php      |   94 +
 app/compta/page_ledger_plan_comptable.php     |  111 +
 app/compta/page_ledger_syndic.php             |   26 +
 app/compta/pages.php                          |  127 +
 app/compta/parametre.js                       |  204 +
 app/compta/parametre.xml                      |   71 +
 .../patchs/00_missing_solde_compte_out.xml    |   41 +
 app/compta/patchs/01_patch_tantieme.xml       |  251 +
 app/compta/patchs/02_create_pcg.txt           |   11 +
 app/compta/patchs/02_next.xml                 |  263 +
 app/compta/patchs/03_pcg_abegre.txt           |  112 +
 app/compta/patchs/03_pcg_syndic.txt           |   44 +
 app/compta/patchs/04_account.txt              |  260 +
 app/compta/patchs/05_calo.txt                 |   23 +
 app/compta/patchs/backup_20210731.txt         | 1653 ++++
 app/compta/patchs/loan.txt                    |   77 +
 app/compta/patchs/procedures.txt              |  115 +
 app/compta/patchs/recurrent.txt               |   37 +
 app/compta/patchs/requetes_utils.txt          |   21 +
 .../solde_compte_per_month_per_year.txt       |    9 +
 app/compta/patchs/tantieme_per_lot.sql        |    9 +
 .../patchs/update_transation_foreign_key.txt  |    6 +
 app/compta/pcmn.js                            |  158 +
 app/compta/pcmn.xml                           |  395 +
 app/compta/pcmnBootstrap.js                   |   49 +
 app/compta/pcmn_syndic.txt                    |  120 +
 app/compta/reports/decompte_charge.php        |  466 ++
 app/compta/reports/recu_taxe.php              |  195 +
 app/compta/reports/syndic_annexe1.php         |  514 ++
 app/compta/reports/syndic_annexe2.php         |  536 ++
 app/compta/reports/syndic_annexe3.php         |  298 +
 app/compta/reports/syndic_annexe4.php         |   97 +
 app/compta/reports/syndic_annexe_data.php     |  267 +
 app/compta/reports/syndic_annexes.php         | 1161 +++
 app/compta/reports/syndic_builder_annexe.php  |  135 +
 .../reports/syndic_builder_decompte.php       |  217 +
 app/compta/reports/syndic_charges.php         |  259 +
 app/compta/reports/syndic_compte.php          |  419 +
 app/compta/schema_mysql.php                   |  988 +++
 app/compta/schema_pcmn_abrege_mysql.php       |  241 +
 app/compta/schema_pcmn_syndic_mysql.php       |  124 +
 app/compta/services.js                        |  524 ++
 app/compta/services.php                       |  117 +
 app/compta/session.php                        |  137 +
 app/compta/supplier.js                        |  479 ++
 app/compta/supplierBootstrap.js               |   35 +
 app/compta/supplier_account.xml               |  104 +
 app/compta/supplier_add.xml                   |  109 +
 app/compta/supplier_bill.xml                  |  119 +
 app/compta/supplier_pay.xml                   |  109 +
 app/compta/supplier_remove.xml                |  240 +
 app/compta/transaction.js                     |  189 +
 app/compta/upload.php                         |   30 +
 app/compta/users.xml                          |  240 +
 app/compta/views/account_detail.php           |  150 +
 app/compta/views/admin_index.php              |  100 +
 app/compta/views/bank_index.php               |  138 +
 app/compta/views/bank_upload.php              |  136 +
 app/compta/views/bilan_index.php              |  153 +
 app/compta/views/budget_detail.php            |  127 +
 app/compta/views/budget_index.php             |  120 +
 app/compta/views/budget_nouveau.php           |  172 +
 app/compta/views/chart_index.php              |  144 +
 app/compta/views/compta_index.php             |  289 +
 app/compta/views/exercice_index.php           |  127 +
 app/compta/views/jrnx_index.php               |  128 +
 app/compta/views/loan_detail.php              |  159 +
 app/compta/views/loan_index.php               |  278 +
 app/compta/views/loan_nouveau.php             |  131 +
 app/compta/views/loan_payer.php               |  139 +
 app/compta/views/lot_attribuer.php            |  254 +
 app/compta/views/lot_index.php                |  274 +
 app/compta/views/lot_nouveau.php              |  268 +
 app/compta/views/lot_update.php               |  268 +
 app/compta/views/org_index.php                |  255 +
 app/compta/views/recurrent_detail.php         |  113 +
 app/compta/views/recurrent_index.php          |  310 +
 app/compta/views/recurrent_nouveau.php        |  310 +
 app/compta/views/recurrent_payer.php          |  203 +
 app/compta/views/recurrent_update.php         |  119 +
 app/config/analystictracking_andre.php        |   13 +
 app/config/analystictracking_syndic.php       |   13 +
 app/config/andre.php                          |  543 ++
 app/config/config.php.example                 |  191 +
 app/config/feebf.php                          |  161 +
 app/config/mysql.conf.php.example             |   83 +
 app/config/mysql.conf.php.home                |   86 +
 app/config/syndic.php                         |  510 ++
 app/index.php                                 |  137 +
 app/index.xml                                 |  360 +
 app/member                                    |    1 +
 app/registration/class.db_stats.php           |   24 +
 app/registration/counting.php                 |  134 +
 app/registration/register.php                 |  160 +
 app/users.xml                                 |  240 +
 app/xsl                                       |    1 +
 calendar.en_US.UTF-8.xml                      |   26 +
 calendar.fr_FR.UTF-8.xml                      |   27 +
 calendar.xml                                  |   33 +
 calendar_doc.xml                              |   44 +
 config.xml                                    |   46 +
 contact.en_US.UTF-8.xml                       |   34 +
 contact.fr_FR.UTF-8.xml                       |   23 +
 contact.php                                   |   71 +
 contact.xml                                   |   62 +
 flist.txt                                     |   46 +
 googlea757b08c9f17b183.html                   |    1 +
 header.xml                                    |   41 +
 header_php.xml                                |   45 +
 images/accounting/NewMenuHBlack60px.png       |  Bin 0 -> 306 bytes
 images/accounting/barre_etat.png              |  Bin 0 -> 6701 bytes
 images/accounting/bilan.png                   |  Bin 0 -> 25154 bytes
 images/accounting/book-dolars.png             |  Bin 0 -> 1499 bytes
 images/accounting/budget_edit.png             |  Bin 0 -> 23689 bytes
 images/accounting/budget_liste.png            |  Bin 0 -> 7313 bytes
 images/accounting/budget_menu.png             |  Bin 0 -> 1833 bytes
 images/accounting/building.jpg                |  Bin 0 -> 66146 bytes
 images/accounting/copro_exercices.png         |  Bin 0 -> 22825 bytes
 images/accounting/fournisseur_compte.png      |  Bin 0 -> 59553 bytes
 images/accounting/fournisseur_facture.png     |  Bin 0 -> 23108 bytes
 images/accounting/fournisseur_payer.png       |  Bin 0 -> 21415 bytes
 images/accounting/gestion_lots.png            |  Bin 0 -> 41832 bytes
 images/accounting/iu-bilan.jpg                |  Bin 0 -> 75847 bytes
 images/accounting/iu-budget.jpg               |  Bin 0 -> 151555 bytes
 images/accounting/iu-copro.jpg                |  Bin 0 -> 67649 bytes
 images/accounting/iu-coproprietaire.jpg       |  Bin 0 -> 44714 bytes
 images/accounting/iu-exercice.jpg             |  Bin 0 -> 40537 bytes
 images/accounting/iu-fournisseur.jpg          |  Bin 0 -> 49661 bytes
 images/accounting/iu-journaux.jpg             |  Bin 0 -> 107567 bytes
 images/accounting/iu-plan-comptable.jpg       |  Bin 0 -> 38418 bytes
 images/accounting/iu-syndic.jpg               |  Bin 0 -> 43100 bytes
 images/accounting/journaux.png                |  Bin 0 -> 41594 bytes
 images/accounting/journaux_menu.png           |  Bin 0 -> 11541 bytes
 images/accounting/menu_coprorpiete.png        |  Bin 0 -> 8728 bytes
 images/accounting/payer_facture.png           |  Bin 0 -> 9436 bytes
 images/accounting/plan_compte.png             |  Bin 0 -> 29103 bytes
 images/accounting/plan_menu.png               |  Bin 0 -> 11208 bytes
 images/accounting/poste_charge_affecter.png   |  Bin 0 -> 29387 bytes
 images/accounting/saisie_facture.png          |  Bin 0 -> 23463 bytes
 images/accounting/syndic-header-n.png         |  Bin 0 -> 14533 bytes
 images/accounting/syndic-logo.png             |  Bin 0 -> 8673 bytes
 images/button-dessin.svg                      |  198 +
 images/icons/news.svg                         |   80 +
 images/icons/style.svg                        |   74 +
 images/icons/summary.svg                      |   80 +
 images/icons/title.svg                        |   74 +
 images/template-trinity.svg                   | 1412 ++++
 images/template.svg                           | 1245 +++
 images/test-box3D.svg                         |  225 +
 images/test-clock.svg                         |  441 ++
 images/x-click-butcc-donate.gif               |  Bin 0 -> 1040 bytes
 index.php                                     |  202 +
 js/NameValuePairCollection.js                 |  110 +
 js/Tree-optimized.js                          | 3503 ++++++++
 js/Tree.js                                    | 5692 +++++++++++++
 js/cstutils.js                                |   11 +
 js/custom-elements-es5-adapter.js             |    1 +
 js/custom-elements-es5-adapter.min.js         |    5 +
 js/drawing.js                                 |  206 +
 js/email.js                                   |   48 +
 js/index.html                                 |   45 +
 js/jsmin                                      |  Bin 0 -> 9260 bytes
 js/jsmin.c                                    |  278 +
 js/json2.js                                   |  273 +
 js/lightbox.js                                |  497 ++
 js/load_request.js                            |   31 +
 js/login.js                                   |  509 ++
 js/md5.js                                     |  407 +
 js/mydate.js                                  |  231 +
 js/mymenu.js                                  |  230 +
 js/request.js                                 |   64 +
 js/require-min.js                             |    5 +
 js/require.js                                 | 2146 +++++
 js/scriptaculus/builder.js                    |  136 +
 js/scriptaculus/controls.js                   |  965 +++
 js/scriptaculus/dragdrop.js                   |  974 +++
 js/scriptaculus/effects.js                    | 1123 +++
 js/scriptaculus/proto.menu.0.6.js             |   99 +
 js/scriptaculus/prototype.js                  | 7041 +++++++++++++++++
 js/scriptaculus/scriptaculous.js              |   68 +
 js/scriptaculus/slider.js                     |  275 +
 js/scriptaculus/sound.js                      |   59 +
 js/scriptaculus/unittest.js                   |  568 ++
 js/slidemenu.js                               |  307 +
 js/styleswitcher.js                           |   70 +
 js/syntaxhighlight/shBrushBash.js             |   51 +
 js/syntaxhighlight/shBrushCSharp.js           |   51 +
 js/syntaxhighlight/shBrushCpp.js              |   75 +
 js/syntaxhighlight/shBrushCss.js              |   82 +
 js/syntaxhighlight/shBrushDelphi.js           |   53 +
 js/syntaxhighlight/shBrushGroovy.js           |   68 +
 js/syntaxhighlight/shBrushJScript.js          |   41 +
 js/syntaxhighlight/shBrushJava.js             |   47 +
 js/syntaxhighlight/shBrushPhp.js              |   80 +
 js/syntaxhighlight/shBrushPython.js           |   49 +
 js/syntaxhighlight/shBrushRuby.js             |   47 +
 js/syntaxhighlight/shBrushScala.js            |   46 +
 js/syntaxhighlight/shBrushSql.js              |   61 +
 js/syntaxhighlight/shBrushVb.js               |   48 +
 js/syntaxhighlight/shBrushXml.js              |   89 +
 js/syntaxhighlight/shCore.js                  |  726 ++
 js/tslib.js                                   |  243 +
 js/urlparams.js                               |   20 +
 .../custom-elements-es5-adapter.js            |   15 +
 js/webcomponentsjs/package.json               |   51 +
 js/webcomponentsjs/webcomponents-bundle.js    |  373 +
 js/webcomponentsjs/webcomponents-loader.js    |  185 +
 js/xgui/CtrlDialogbox.js                      |   53 +
 js/xgui/Entry.js                              |   42 +
 js/xgui/Table.js                              |  249 +
 js/xgui/Xgui.js                               |    5 +
 js/xgui/aebw.bat                              |    2 +
 js/xgui/aebw.js                               |  135 +
 js/xgui/aebw.sh                               |    4 +
 js/xgui/index.js                              |    6 +
 js/xgui/torm/Entry.js                         |   42 +
 js/xgui/torm/Table.js                         |  249 +
 js/xgui/torm/Xgui.js                          |    5 +
 js/xgui/torm/index.js                         |    6 +
 js/xgui/xgui.js                               |  466 ++
 js/xgui/xgui_asn1.js                          |    7 +
 js/xgui/xgui_base64.js                        |  107 +
 js/xgui/xgui_button.js                        |    7 +
 js/xgui/xgui_calendar.js                      |  300 +
 js/xgui/xgui_combobox.js                      |   79 +
 js/xgui/xgui_corba.js                         |   49 +
 js/xgui/xgui_dialogbox.js                     |   82 +
 js/xgui/xgui_hex.js                           |   46 +
 js/xgui/xgui_json.js                          |   87 +
 js/xgui/xgui_jsonrpc.js                       |   49 +
 js/xgui/xgui_menu.js                          |   67 +
 js/xgui/xgui_stream.js                        |    7 +
 js/xgui/xgui_tab.js                           |   61 +
 js/xgui/xgui_table.js                         |  165 +
 js/xgui/xgui_wizard.js                        |   81 +
 liens.xml                                     |   63 +
 liens_php.xml                                 |   60 +
 locale/de_DE/LC_MESSAGES/fr_FR.UTF-8.mo       |  Bin 0 -> 2742 bytes
 locale/default.mo                             |  Bin 0 -> 388 bytes
 locale/default.po                             |   37 +
 locale/fr_FR.UTF-8.mo                         |  Bin 0 -> 1389 bytes
 locale/fr_FR.UTF-8.po                         |  362 +
 locale/fr_FR/LC_MESSAGES/syndic.mo            |  Bin 0 -> 3839 bytes
 locale/syndic_fr_FR.UTF-8.mo                  |  Bin 0 -> 3839 bytes
 locale/syndic_fr_FR.UTF-8.po                  |  408 +
 menu.xml                                      |  334 +
 menu_andre.xml                                |  155 +
 messages.po                                   |  409 +
 messages.pot                                  |   42 +
 news.xml                                      |   37 +
 phplib                                        |    1 +
 robots.txt                                    |    8 +
 site/article.xsl                              |   75 +
 site/cv.xsl                                   |  279 +
 site/footer.xsl                               |   16 +
 site/generate_header.xsl                      |  134 +
 site/generate_html.xsl                        |  461 ++
 site/menuh.xsl                                |  102 +
 site/menuv.xsl                                |  235 +
 site/news.xsl                                 |  226 +
 site/page.xsl                                 | 1257 +++
 site/root.xsl                                 |   10 +
 site/test.xsl                                 |   15 +
 sitemap.php                                   |   69 +
 src/app/compta/.@__thumb/adefaultcopro.ts     |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/adefaultcoprote.ts   |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/adefaultjournaux.ts  |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/adefaultpcmn.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/adefaultservices.ts  |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/adefaultsupplier.ts  |  Bin 0 -> 386 bytes
 .../compta/.@__thumb/adefaulttransaction.ts   |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100copro.ts         |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100coprote.ts       |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100journaux.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100pcmn.ts          |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100services.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100supplier.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s100transaction.ts   |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800copro.ts         |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800coprote.ts       |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800journaux.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800pcmn.ts          |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800services.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800supplier.ts      |  Bin 0 -> 386 bytes
 src/app/compta/.@__thumb/s800transaction.ts   |  Bin 0 -> 386 bytes
 src/app/compta/Dialog.ts                      |  120 +
 src/app/compta/bilan.ts                       |  104 +
 src/app/compta/budget.ts                      |  342 +
 src/app/compta/copro.ts                       | 1008 +++
 src/app/compta/coprote.ts                     |  259 +
 src/app/compta/entretien.ts                   |  178 +
 src/app/compta/exercice.ts                    |  263 +
 src/app/compta/journaux.ts                    |  993 +++
 src/app/compta/lots.ts                        |  453 ++
 src/app/compta/pcmn.ts                        |  213 +
 src/app/compta/services.ts                    |  990 +++
 src/app/compta/supplier.ts                    |  637 ++
 src/app/compta/supplierBootstrap.ts           |   41 +
 src/app/compta/transaction.ts                 |  280 +
 src/js/xgui/.@__thumb/adefaultEntry.ts        |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/adefaultTable.ts        |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/adefaultXgui.ts         |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/adefaultindex.ts        |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s100Entry.ts            |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s100Table.ts            |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s100Xgui.ts             |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s100index.ts            |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s800Entry.ts            |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s800Table.ts            |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s800Xgui.ts             |  Bin 0 -> 386 bytes
 src/js/xgui/.@__thumb/s800index.ts            |  Bin 0 -> 386 bytes
 src/js/xgui/CtrlDialogbox.ts                  |   73 +
 src/js/xgui/Entry.ts                          |   62 +
 src/js/xgui/Table.ts                          |  374 +
 src/js/xgui/Xgui.ts                           |    3 +
 src/js/xgui/index.ts                          |    4 +
 .../custom-elements/CHANGELOG.md              |   38 +
 .../@webcomponents/custom-elements/LICENSE.md |   19 +
 .../@webcomponents/custom-elements/README.md  |  269 +
 .../custom-elements/custom-elements.min.js    |   57 +
 .../custom-elements.min.js.map                |    1 +
 .../externs/custom-elements.js                |  108 +
 .../custom-elements/package.json              |   75 +
 .../adefaultAlreadyConstructedMarker.d.ts     |  Bin 0 -> 386 bytes
 .../adefaultCustomElementInternals.d.ts       |  Bin 0 -> 386 bytes
 .../adefaultCustomElementRegistry.d.ts        |  Bin 0 -> 386 bytes
 .../.@__thumb/adefaultCustomElementState.d.ts |  Bin 0 -> 386 bytes
 .../src/.@__thumb/adefaultDeferred.d.ts       |  Bin 0 -> 386 bytes
 .../adefaultDocumentConstructionObserver.d.ts |  Bin 0 -> 386 bytes
 .../src/.@__thumb/adefaultExterns.d.ts        |  Bin 0 -> 386 bytes
 .../src/.@__thumb/adefaultUtilities.d.ts      |  Bin 0 -> 386 bytes
 .../.@__thumb/adefaultcustom-elements.d.ts    |  Bin 0 -> 386 bytes
 .../src/.@__thumb/adefaultnative-shim.d.ts    |  Bin 0 -> 386 bytes
 .../s100AlreadyConstructedMarker.d.ts         |  Bin 0 -> 386 bytes
 .../.@__thumb/s100CustomElementInternals.d.ts |  Bin 0 -> 386 bytes
 .../.@__thumb/s100CustomElementRegistry.d.ts  |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s100CustomElementState.d.ts |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s100Deferred.d.ts           |  Bin 0 -> 386 bytes
 .../s100DocumentConstructionObserver.d.ts     |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s100Externs.d.ts            |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s100Utilities.d.ts          |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s100custom-elements.d.ts    |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s100native-shim.d.ts        |  Bin 0 -> 386 bytes
 .../s800AlreadyConstructedMarker.d.ts         |  Bin 0 -> 386 bytes
 .../.@__thumb/s800CustomElementInternals.d.ts |  Bin 0 -> 386 bytes
 .../.@__thumb/s800CustomElementRegistry.d.ts  |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s800CustomElementState.d.ts |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s800Deferred.d.ts           |  Bin 0 -> 386 bytes
 .../s800DocumentConstructionObserver.d.ts     |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s800Externs.d.ts            |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s800Utilities.d.ts          |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s800custom-elements.d.ts    |  Bin 0 -> 386 bytes
 .../src/.@__thumb/s800native-shim.d.ts        |  Bin 0 -> 386 bytes
 .../src/AlreadyConstructedMarker.d.ts         |   21 +
 .../src/AlreadyConstructedMarker.js           |   19 +
 .../src/AlreadyConstructedMarker.js.map       |    1 +
 .../src/CustomElementInternals.d.ts           |  126 +
 .../src/CustomElementInternals.js             |  471 ++
 .../src/CustomElementInternals.js.map         |    1 +
 .../src/CustomElementRegistry.d.ts            |   68 +
 .../src/CustomElementRegistry.js              |  271 +
 .../src/CustomElementRegistry.js.map          |    1 +
 .../src/CustomElementState.d.ts               |   16 +
 .../custom-elements/src/CustomElementState.js |   16 +
 .../src/CustomElementState.js.map             |    1 +
 .../custom-elements/src/Deferred.d.ts         |   18 +
 .../custom-elements/src/Deferred.js           |   29 +
 .../custom-elements/src/Deferred.js.map       |    1 +
 .../src/DocumentConstructionObserver.d.ts     |   19 +
 .../src/DocumentConstructionObserver.js       |   53 +
 .../src/DocumentConstructionObserver.js.map   |    1 +
 .../custom-elements/src/Externs.d.ts          |   86 +
 .../custom-elements/src/Externs.js            |   11 +
 .../custom-elements/src/Externs.js.map        |    1 +
 .../src/Patch/.@__thumb/adefaultDocument.d.ts |  Bin 0 -> 386 bytes
 .../.@__thumb/adefaultDocumentFragment.d.ts   |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/adefaultElement.d.ts  |  Bin 0 -> 386 bytes
 .../Patch/.@__thumb/adefaultHTMLElement.d.ts  |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/adefaultNative.d.ts   |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/adefaultNode.d.ts     |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s100Document.d.ts     |  Bin 0 -> 386 bytes
 .../Patch/.@__thumb/s100DocumentFragment.d.ts |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s100Element.d.ts      |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s100HTMLElement.d.ts  |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s100Native.d.ts       |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s100Node.d.ts         |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s800Document.d.ts     |  Bin 0 -> 386 bytes
 .../Patch/.@__thumb/s800DocumentFragment.d.ts |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s800Element.d.ts      |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s800HTMLElement.d.ts  |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s800Native.d.ts       |  Bin 0 -> 386 bytes
 .../src/Patch/.@__thumb/s800Node.d.ts         |  Bin 0 -> 386 bytes
 .../custom-elements/src/Patch/Document.d.ts   |   12 +
 .../custom-elements/src/Patch/Document.js     |   38 +
 .../custom-elements/src/Patch/Document.js.map |    1 +
 .../src/Patch/DocumentFragment.d.ts           |   12 +
 .../src/Patch/DocumentFragment.js             |   19 +
 .../src/Patch/DocumentFragment.js.map         |    1 +
 .../custom-elements/src/Patch/Element.d.ts    |   12 +
 .../custom-elements/src/Patch/Element.js      |  233 +
 .../custom-elements/src/Patch/Element.js.map  |    1 +
 .../src/Patch/HTMLElement.d.ts                |   12 +
 .../custom-elements/src/Patch/HTMLElement.js  |   62 +
 .../src/Patch/HTMLElement.js.map              |    1 +
 .../.@__thumb/adefaultChildNode.d.ts          |  Bin 0 -> 386 bytes
 .../.@__thumb/adefaultParentNode.d.ts         |  Bin 0 -> 386 bytes
 .../Interface/.@__thumb/s100ChildNode.d.ts    |  Bin 0 -> 386 bytes
 .../Interface/.@__thumb/s100ParentNode.d.ts   |  Bin 0 -> 386 bytes
 .../Interface/.@__thumb/s800ChildNode.d.ts    |  Bin 0 -> 386 bytes
 .../Interface/.@__thumb/s800ParentNode.d.ts   |  Bin 0 -> 386 bytes
 .../src/Patch/Interface/ChildNode.d.ts        |   20 +
 .../src/Patch/Interface/ChildNode.js          |  101 +
 .../src/Patch/Interface/ChildNode.js.map      |    1 +
 .../src/Patch/Interface/ParentNode.d.ts       |   18 +
 .../src/Patch/Interface/ParentNode.js         |   58 +
 .../src/Patch/Interface/ParentNode.js.map     |    1 +
 .../custom-elements/src/Patch/Native.d.ts     |   56 +
 .../custom-elements/src/Patch/Native.js       |   44 +
 .../custom-elements/src/Patch/Native.js.map   |    1 +
 .../custom-elements/src/Patch/Node.d.ts       |   12 +
 .../custom-elements/src/Patch/Node.js         |  180 +
 .../custom-elements/src/Patch/Node.js.map     |    1 +
 .../custom-elements/src/Utilities.d.ts        |   14 +
 .../custom-elements/src/Utilities.js          |  123 +
 .../custom-elements/src/Utilities.js.map      |    1 +
 .../custom-elements/src/custom-elements.d.ts  |   11 +
 .../custom-elements/src/custom-elements.js    |   45 +
 .../src/custom-elements.js.map                |    1 +
 .../custom-elements/src/native-shim.d.ts      |   10 +
 .../custom-elements/src/native-shim.js        |   46 +
 .../custom-elements/src/native-shim.js.map    |    1 +
 .../webcomponentsjs/CHANGELOG.md              |   57 +
 .../@webcomponents/webcomponentsjs/LICENSE.md |   19 +
 .../@webcomponents/webcomponentsjs/README.md  |  232 +
 .../bundles/webcomponents-ce.js               |   73 +
 .../bundles/webcomponents-ce.js.map           |    1 +
 .../bundles/webcomponents-pf_dom.js           |   60 +
 .../bundles/webcomponents-pf_dom.js.map       |    1 +
 .../bundles/webcomponents-pf_js.js            |   92 +
 .../bundles/webcomponents-pf_js.js.map        |    1 +
 .../bundles/webcomponents-sd-ce-pf.js         |  363 +
 .../bundles/webcomponents-sd-ce-pf.js.map     |    1 +
 .../bundles/webcomponents-sd-ce.js            |  234 +
 .../bundles/webcomponents-sd-ce.js.map        |    1 +
 .../bundles/webcomponents-sd.js               |  182 +
 .../bundles/webcomponents-sd.js.map           |    1 +
 .../custom-elements-es5-adapter.js            |   15 +
 .../webcomponentsjs/package.json              |   83 +
 .../custom-elements-es5-adapter-index.js      |   16 +
 .../entrypoints/webcomponents-bundle-index.js |   53 +
 .../src/entrypoints/webcomponents-ce-index.js |   17 +
 .../entrypoints/webcomponents-pf_dom-index.js |   17 +
 .../entrypoints/webcomponents-pf_js-index.js  |   13 +
 .../entrypoints/webcomponents-sd-ce-index.js  |   19 +
 .../webcomponents-sd-ce-pf-index.js           |   25 +
 .../src/entrypoints/webcomponents-sd-index.js |   18 +
 .../webcomponentsjs/src/flag-parser.js        |   64 +
 .../webcomponentsjs/src/platform/baseuri.js   |   27 +
 .../src/platform/child-node/after.js          |   42 +
 .../src/platform/child-node/before.js         |   37 +
 .../src/platform/child-node/index.js          |   14 +
 .../src/platform/child-node/remove.js         |   34 +
 .../src/platform/child-node/replace-with.js   |   39 +
 .../src/platform/custom-event.js              |   83 +
 .../webcomponentsjs/src/platform/es6-misc.js  |   36 +
 .../src/platform/get-attribute-names.js       |   24 +
 .../webcomponentsjs/src/platform/matches.js   |   16 +
 .../src/platform/parent-node/append.js        |   30 +
 .../src/platform/parent-node/index.js         |   13 +
 .../src/platform/parent-node/prepend.js       |   39 +
 .../platform/parent-node/replace-children.js  |   42 +
 .../webcomponentsjs/src/platform/promise.js   |   50 +
 .../src/platform/svg-element-class-list.js    |   27 +
 .../webcomponentsjs/src/platform/symbol.js    |   64 +
 .../webcomponentsjs/src/unresolved.js         |   30 +
 .../webcomponentsjs/webcomponents-bundle.js   |  373 +
 .../webcomponents-bundle.js.map               |    1 +
 .../webcomponentsjs/webcomponents-loader.js   |  185 +
 .../tslib/.@__thumb/adefaulttslib.d.ts        |  Bin 0 -> 386 bytes
 .../tslib/.@__thumb/s100tslib.d.ts            |  Bin 0 -> 386 bytes
 .../tslib/.@__thumb/s800tslib.d.ts            |  Bin 0 -> 386 bytes
 src/node_modules/tslib/CopyrightNotice.txt    |   15 +
 src/node_modules/tslib/LICENSE.txt            |   12 +
 src/node_modules/tslib/README.md              |  154 +
 src/node_modules/tslib/modules/index.js       |   53 +
 src/node_modules/tslib/modules/package.json   |    3 +
 src/node_modules/tslib/package.json           |   65 +
 src/node_modules/tslib/tslib.d.ts             |   40 +
 src/node_modules/tslib/tslib.es6.html         |    1 +
 src/node_modules/tslib/tslib.es6.js           |  237 +
 src/node_modules/tslib/tslib.html             |    1 +
 src/node_modules/tslib/tslib.js               |  304 +
 src/package-lock.json                         |   22 +
 src/package.json                              |   10 +
 src/tsconfig.json                             |   39 +
 src/tsconfig.xgui.json                        |    9 +
 src/types/aebw/.@__thumb/adefaultindex.d.ts   |  Bin 0 -> 386 bytes
 src/types/aebw/.@__thumb/s100index.d.ts       |  Bin 0 -> 386 bytes
 src/types/aebw/.@__thumb/s800index.d.ts       |  Bin 0 -> 386 bytes
 src/types/aebw/index.d.ts                     |   89 +
 src/types/prototypejs/index.d.ts              |   80 +
 src/types/require.d.ts                        |   45 +
 src/types/require1.d.ts                       |  208 +
 src/types/requirejs.d.ts                      |  434 +
 src/types/requirejs/index.d.ts                |  434 +
 syndic.pot                                    |  271 +
 syndic_file_list.txt                          |   40 +
 tiers/tcpdf                                   |    1 +
 tools/gen_tex.bat                             |   15 +
 tools/generate.bat                            |   32 +
 tools/generate.sh                             |  136 +
 tools/generate.wsf                            |  116 +
 tools/generate1.bat                           |   21 +
 update.php                                    |  694 ++
 web.xml                                       |   89 +
 webfonts/fa-brands-400.eot                    |  Bin 0 -> 125320 bytes
 webfonts/fa-brands-400.svg                    | 3296 ++++++++
 webfonts/fa-brands-400.ttf                    |  Bin 0 -> 125016 bytes
 webfonts/fa-brands-400.woff                   |  Bin 0 -> 84564 bytes
 webfonts/fa-brands-400.woff2                  |  Bin 0 -> 72112 bytes
 webfonts/fa-regular-400.eot                   |  Bin 0 -> 34388 bytes
 webfonts/fa-regular-400.svg                   |  799 ++
 webfonts/fa-regular-400.ttf                   |  Bin 0 -> 34092 bytes
 webfonts/fa-regular-400.woff                  |  Bin 0 -> 16812 bytes
 webfonts/fa-regular-400.woff2                 |  Bin 0 -> 13592 bytes
 webfonts/fa-solid-900.eot                     |  Bin 0 -> 186512 bytes
 webfonts/fa-solid-900.svg                     | 4516 +++++++++++
 webfonts/fa-solid-900.ttf                     |  Bin 0 -> 186228 bytes
 webfonts/fa-solid-900.woff                    |  Bin 0 -> 96244 bytes
 webfonts/fa-solid-900.woff2                   |  Bin 0 -> 74348 bytes
 643 files changed, 100174 insertions(+)
 create mode 100644 .gitmodules
 create mode 100644 accounting/accueil.en_US.UTF-8.xml
 create mode 100644 accounting/accueil.fr_FR.UTF-8.xml
 create mode 100644 accounting/bilan.fr_FR.UTF-8.xml
 create mode 100644 accounting/budget.fr_FR.UTF-8.xml
 create mode 100644 accounting/cgu.fr_FR.UTF-8.xml
 create mode 100644 accounting/contact.en_US.UTF-8.xml
 create mode 100644 accounting/contact.fr_FR.UTF-8.xml
 create mode 100644 accounting/copro_exercice.fr_FR.UTF-8.xml
 create mode 100644 accounting/copro_lots.fr_FR.UTF-8.xml
 create mode 100644 accounting/copro_lots_attribuer.fr_FR.UTF-8.xml
 create mode 100644 accounting/copropriete.fr_FR.UTF-8.xml
 create mode 100644 accounting/dede.txt
 create mode 100644 accounting/donates.fr_FR.UTF-8.xml
 create mode 100644 accounting/fournisseur.fr_FR.UTF-8.xml
 create mode 100644 accounting/journaux.fr_FR.UTF-8.xml
 create mode 100644 accounting/liens_syndic.en_US.UTF-8.xml
 create mode 100644 accounting/liens_syndic.fr_FR.UTF-8.xml
 create mode 100644 accounting/plan_comptable.fr_FR.UTF-8.xml
 create mode 100644 accounting/products.en_US.UTF-8.xml
 create mode 100644 accounting/products.fr_FR.UTF-8.xml
 create mode 100644 accounting/services.en_US.UTF-8.xml
 create mode 100644 accounting/services.fr_FR.UTF-8.xml
 create mode 100644 accueil.en_US.UTF-8.xml
 create mode 100644 accueil.fr_FR.UTF-8.xml
 create mode 100644 accueil.xml
 create mode 100644 app/admin/crontab.php
 create mode 100644 app/admin/index.js
 create mode 100644 app/admin/patch_db.php
 create mode 100644 app/admin/view/index.fr_FR.UTF-8.xml
 create mode 100644 app/basic.php
 create mode 100644 app/common.php
 create mode 100644 app/compta/Accounting.mysql.keep
 create mode 100644 app/compta/Dialog.js
 create mode 100644 app/compta/api/bank.php
 create mode 100644 app/compta/api_base.php
 create mode 100644 app/compta/api_booking.php
 create mode 100644 app/compta/api_budget.php
 create mode 100644 app/compta/api_entretien.php
 create mode 100644 app/compta/api_exercice.php
 create mode 100644 app/compta/api_identity.php
 create mode 100644 app/compta/api_loan.php
 create mode 100644 app/compta/api_pcmn.php
 create mode 100644 app/compta/api_recurrent.php
 create mode 100644 app/compta/api_retrieve.php
 create mode 100644 app/compta/api_syndic.php
 create mode 100644 app/compta/bilan.js
 create mode 100644 app/compta/bilanBootstrap.js
 create mode 100644 app/compta/budget.js
 create mode 100644 app/compta/budgetBootstrap.js
 create mode 100644 app/compta/budget_edit.xml
 create mode 100644 app/compta/class.schema.php
 create mode 100644 app/compta/controler_base.php
 create mode 100644 app/compta/controlers/account.php
 create mode 100644 app/compta/controlers/admin.php
 create mode 100644 app/compta/controlers/bank.php
 create mode 100644 app/compta/controlers/bilan.php
 create mode 100644 app/compta/controlers/bill.php
 create mode 100644 app/compta/controlers/budget.php
 create mode 100644 app/compta/controlers/chart.php
 create mode 100644 app/compta/controlers/compta.php
 create mode 100644 app/compta/controlers/exercice.php
 create mode 100644 app/compta/controlers/jrnx.php
 create mode 100644 app/compta/controlers/loan.php
 create mode 100644 app/compta/controlers/lot.php
 create mode 100644 app/compta/controlers/org.php
 create mode 100644 app/compta/controlers/recurrent.php
 create mode 100644 app/compta/controlers/supplier.php
 create mode 100644 app/compta/controlers/transaction.php
 create mode 100644 app/compta/copro.js
 create mode 100644 app/compta/coproBootstrap.js
 create mode 100644 app/compta/copro_decompte.xml
 create mode 100644 app/compta/copro_entretien.xml
 create mode 100644 app/compta/copro_pay.xml
 create mode 100644 app/compta/copro_role.xml
 create mode 100644 app/compta/copro_users.xml
 create mode 100644 app/compta/coprote.js
 create mode 100644 app/compta/coproteBootstrap.js
 create mode 100644 app/compta/entretien.js
 create mode 100644 app/compta/exercice.js
 create mode 100644 app/compta/exercice.xml
 create mode 100644 app/compta/exerciceBootstrap.js
 create mode 100644 app/compta/forms.php
 create mode 100644 app/compta/index.php
 create mode 100644 app/compta/index.xml
 create mode 100644 app/compta/journaux.js
 create mode 100644 app/compta/journaux.xml
 create mode 100644 app/compta/jrnx.xml
 create mode 100644 app/compta/jrnxBootstrap.js
 create mode 100644 app/compta/jrnx_detail.xml
 create mode 100644 app/compta/jrnx_record.xml
 create mode 100644 app/compta/jrnx_trans.xml
 create mode 100644 app/compta/ledger_church.xml
 create mode 100644 app/compta/ledger_create.xml
 create mode 100644 app/compta/ledger_syndic.xml
 create mode 100644 app/compta/logging.php
 create mode 100644 app/compta/lot.xml
 create mode 100644 app/compta/lot_attribuer.xml
 create mode 100644 app/compta/lot_charge.xml
 create mode 100644 app/compta/lots.js
 create mode 100644 app/compta/models/account.php
 create mode 100644 app/compta/models/bank.php
 create mode 100644 app/compta/models/budget.php
 create mode 100644 app/compta/models/loan.php
 create mode 100644 app/compta/models/lot.php
 create mode 100644 app/compta/models/recurrent.php
 create mode 100644 app/compta/models/transaction.php
 create mode 100644 app/compta/page_ledger.php
 create mode 100644 app/compta/page_ledger_coproprietaire.php
 create mode 100644 app/compta/page_ledger_entretien.php
 create mode 100644 app/compta/page_ledger_exercice.php
 create mode 100644 app/compta/page_ledger_fournisseur.php
 create mode 100644 app/compta/page_ledger_journaux.php
 create mode 100644 app/compta/page_ledger_mes_documents.php
 create mode 100644 app/compta/page_ledger_plan_comptable.php
 create mode 100644 app/compta/page_ledger_syndic.php
 create mode 100644 app/compta/pages.php
 create mode 100644 app/compta/parametre.js
 create mode 100644 app/compta/parametre.xml
 create mode 100644 app/compta/patchs/00_missing_solde_compte_out.xml
 create mode 100644 app/compta/patchs/01_patch_tantieme.xml
 create mode 100644 app/compta/patchs/02_create_pcg.txt
 create mode 100644 app/compta/patchs/02_next.xml
 create mode 100644 app/compta/patchs/03_pcg_abegre.txt
 create mode 100644 app/compta/patchs/03_pcg_syndic.txt
 create mode 100644 app/compta/patchs/04_account.txt
 create mode 100644 app/compta/patchs/05_calo.txt
 create mode 100644 app/compta/patchs/backup_20210731.txt
 create mode 100644 app/compta/patchs/loan.txt
 create mode 100644 app/compta/patchs/procedures.txt
 create mode 100644 app/compta/patchs/recurrent.txt
 create mode 100644 app/compta/patchs/requetes_utils.txt
 create mode 100644 app/compta/patchs/solde_compte_per_month_per_year.txt
 create mode 100644 app/compta/patchs/tantieme_per_lot.sql
 create mode 100644 app/compta/patchs/update_transation_foreign_key.txt
 create mode 100644 app/compta/pcmn.js
 create mode 100644 app/compta/pcmn.xml
 create mode 100644 app/compta/pcmnBootstrap.js
 create mode 100644 app/compta/pcmn_syndic.txt
 create mode 100644 app/compta/reports/decompte_charge.php
 create mode 100644 app/compta/reports/recu_taxe.php
 create mode 100644 app/compta/reports/syndic_annexe1.php
 create mode 100644 app/compta/reports/syndic_annexe2.php
 create mode 100644 app/compta/reports/syndic_annexe3.php
 create mode 100644 app/compta/reports/syndic_annexe4.php
 create mode 100644 app/compta/reports/syndic_annexe_data.php
 create mode 100644 app/compta/reports/syndic_annexes.php
 create mode 100644 app/compta/reports/syndic_builder_annexe.php
 create mode 100644 app/compta/reports/syndic_builder_decompte.php
 create mode 100644 app/compta/reports/syndic_charges.php
 create mode 100644 app/compta/reports/syndic_compte.php
 create mode 100644 app/compta/schema_mysql.php
 create mode 100644 app/compta/schema_pcmn_abrege_mysql.php
 create mode 100644 app/compta/schema_pcmn_syndic_mysql.php
 create mode 100644 app/compta/services.js
 create mode 100644 app/compta/services.php
 create mode 100644 app/compta/session.php
 create mode 100644 app/compta/supplier.js
 create mode 100644 app/compta/supplierBootstrap.js
 create mode 100644 app/compta/supplier_account.xml
 create mode 100644 app/compta/supplier_add.xml
 create mode 100644 app/compta/supplier_bill.xml
 create mode 100644 app/compta/supplier_pay.xml
 create mode 100644 app/compta/supplier_remove.xml
 create mode 100644 app/compta/transaction.js
 create mode 100644 app/compta/upload.php
 create mode 100644 app/compta/users.xml
 create mode 100644 app/compta/views/account_detail.php
 create mode 100644 app/compta/views/admin_index.php
 create mode 100644 app/compta/views/bank_index.php
 create mode 100644 app/compta/views/bank_upload.php
 create mode 100644 app/compta/views/bilan_index.php
 create mode 100644 app/compta/views/budget_detail.php
 create mode 100644 app/compta/views/budget_index.php
 create mode 100644 app/compta/views/budget_nouveau.php
 create mode 100644 app/compta/views/chart_index.php
 create mode 100644 app/compta/views/compta_index.php
 create mode 100644 app/compta/views/exercice_index.php
 create mode 100644 app/compta/views/jrnx_index.php
 create mode 100644 app/compta/views/loan_detail.php
 create mode 100644 app/compta/views/loan_index.php
 create mode 100644 app/compta/views/loan_nouveau.php
 create mode 100644 app/compta/views/loan_payer.php
 create mode 100644 app/compta/views/lot_attribuer.php
 create mode 100644 app/compta/views/lot_index.php
 create mode 100644 app/compta/views/lot_nouveau.php
 create mode 100644 app/compta/views/lot_update.php
 create mode 100644 app/compta/views/org_index.php
 create mode 100644 app/compta/views/recurrent_detail.php
 create mode 100644 app/compta/views/recurrent_index.php
 create mode 100644 app/compta/views/recurrent_nouveau.php
 create mode 100644 app/compta/views/recurrent_payer.php
 create mode 100644 app/compta/views/recurrent_update.php
 create mode 100644 app/config/analystictracking_andre.php
 create mode 100644 app/config/analystictracking_syndic.php
 create mode 100644 app/config/andre.php
 create mode 100644 app/config/config.php.example
 create mode 100644 app/config/feebf.php
 create mode 100644 app/config/mysql.conf.php.example
 create mode 100644 app/config/mysql.conf.php.home
 create mode 100644 app/config/syndic.php
 create mode 100644 app/index.php
 create mode 100644 app/index.xml
 create mode 160000 app/member
 create mode 100644 app/registration/class.db_stats.php
 create mode 100644 app/registration/counting.php
 create mode 100644 app/registration/register.php
 create mode 100644 app/users.xml
 create mode 160000 app/xsl
 create mode 100644 calendar.en_US.UTF-8.xml
 create mode 100644 calendar.fr_FR.UTF-8.xml
 create mode 100644 calendar.xml
 create mode 100644 calendar_doc.xml
 create mode 100644 config.xml
 create mode 100644 contact.en_US.UTF-8.xml
 create mode 100644 contact.fr_FR.UTF-8.xml
 create mode 100644 contact.php
 create mode 100644 contact.xml
 create mode 100644 flist.txt
 create mode 100644 googlea757b08c9f17b183.html
 create mode 100644 header.xml
 create mode 100644 header_php.xml
 create mode 100755 images/accounting/NewMenuHBlack60px.png
 create mode 100755 images/accounting/barre_etat.png
 create mode 100755 images/accounting/bilan.png
 create mode 100755 images/accounting/book-dolars.png
 create mode 100755 images/accounting/budget_edit.png
 create mode 100755 images/accounting/budget_liste.png
 create mode 100755 images/accounting/budget_menu.png
 create mode 100755 images/accounting/building.jpg
 create mode 100755 images/accounting/copro_exercices.png
 create mode 100755 images/accounting/fournisseur_compte.png
 create mode 100755 images/accounting/fournisseur_facture.png
 create mode 100755 images/accounting/fournisseur_payer.png
 create mode 100755 images/accounting/gestion_lots.png
 create mode 100644 images/accounting/iu-bilan.jpg
 create mode 100644 images/accounting/iu-budget.jpg
 create mode 100644 images/accounting/iu-copro.jpg
 create mode 100644 images/accounting/iu-coproprietaire.jpg
 create mode 100644 images/accounting/iu-exercice.jpg
 create mode 100644 images/accounting/iu-fournisseur.jpg
 create mode 100644 images/accounting/iu-journaux.jpg
 create mode 100644 images/accounting/iu-plan-comptable.jpg
 create mode 100644 images/accounting/iu-syndic.jpg
 create mode 100755 images/accounting/journaux.png
 create mode 100755 images/accounting/journaux_menu.png
 create mode 100755 images/accounting/menu_coprorpiete.png
 create mode 100755 images/accounting/payer_facture.png
 create mode 100755 images/accounting/plan_compte.png
 create mode 100755 images/accounting/plan_menu.png
 create mode 100755 images/accounting/poste_charge_affecter.png
 create mode 100755 images/accounting/saisie_facture.png
 create mode 100755 images/accounting/syndic-header-n.png
 create mode 100755 images/accounting/syndic-logo.png
 create mode 100644 images/button-dessin.svg
 create mode 100644 images/icons/news.svg
 create mode 100644 images/icons/style.svg
 create mode 100644 images/icons/summary.svg
 create mode 100644 images/icons/title.svg
 create mode 100644 images/template-trinity.svg
 create mode 100644 images/template.svg
 create mode 100644 images/test-box3D.svg
 create mode 100644 images/test-clock.svg
 create mode 100644 images/x-click-butcc-donate.gif
 create mode 100644 index.php
 create mode 100644 js/NameValuePairCollection.js
 create mode 100644 js/Tree-optimized.js
 create mode 100644 js/Tree.js
 create mode 100644 js/cstutils.js
 create mode 100644 js/custom-elements-es5-adapter.js
 create mode 100644 js/custom-elements-es5-adapter.min.js
 create mode 100644 js/drawing.js
 create mode 100644 js/email.js
 create mode 100644 js/index.html
 create mode 100755 js/jsmin
 create mode 100644 js/jsmin.c
 create mode 100644 js/json2.js
 create mode 100644 js/lightbox.js
 create mode 100644 js/load_request.js
 create mode 100644 js/login.js
 create mode 100644 js/md5.js
 create mode 100644 js/mydate.js
 create mode 100644 js/mymenu.js
 create mode 100644 js/request.js
 create mode 100644 js/require-min.js
 create mode 100644 js/require.js
 create mode 100644 js/scriptaculus/builder.js
 create mode 100644 js/scriptaculus/controls.js
 create mode 100644 js/scriptaculus/dragdrop.js
 create mode 100644 js/scriptaculus/effects.js
 create mode 100644 js/scriptaculus/proto.menu.0.6.js
 create mode 100644 js/scriptaculus/prototype.js
 create mode 100644 js/scriptaculus/scriptaculous.js
 create mode 100644 js/scriptaculus/slider.js
 create mode 100644 js/scriptaculus/sound.js
 create mode 100644 js/scriptaculus/unittest.js
 create mode 100644 js/slidemenu.js
 create mode 100644 js/styleswitcher.js
 create mode 100644 js/syntaxhighlight/shBrushBash.js
 create mode 100644 js/syntaxhighlight/shBrushCSharp.js
 create mode 100644 js/syntaxhighlight/shBrushCpp.js
 create mode 100644 js/syntaxhighlight/shBrushCss.js
 create mode 100644 js/syntaxhighlight/shBrushDelphi.js
 create mode 100644 js/syntaxhighlight/shBrushGroovy.js
 create mode 100644 js/syntaxhighlight/shBrushJScript.js
 create mode 100644 js/syntaxhighlight/shBrushJava.js
 create mode 100644 js/syntaxhighlight/shBrushPhp.js
 create mode 100644 js/syntaxhighlight/shBrushPython.js
 create mode 100644 js/syntaxhighlight/shBrushRuby.js
 create mode 100644 js/syntaxhighlight/shBrushScala.js
 create mode 100644 js/syntaxhighlight/shBrushSql.js
 create mode 100644 js/syntaxhighlight/shBrushVb.js
 create mode 100644 js/syntaxhighlight/shBrushXml.js
 create mode 100644 js/syntaxhighlight/shCore.js
 create mode 100644 js/tslib.js
 create mode 100644 js/urlparams.js
 create mode 100644 js/webcomponentsjs/custom-elements-es5-adapter.js
 create mode 100644 js/webcomponentsjs/package.json
 create mode 100644 js/webcomponentsjs/webcomponents-bundle.js
 create mode 100644 js/webcomponentsjs/webcomponents-loader.js
 create mode 100644 js/xgui/CtrlDialogbox.js
 create mode 100644 js/xgui/Entry.js
 create mode 100644 js/xgui/Table.js
 create mode 100644 js/xgui/Xgui.js
 create mode 100644 js/xgui/aebw.bat
 create mode 100644 js/xgui/aebw.js
 create mode 100755 js/xgui/aebw.sh
 create mode 100644 js/xgui/index.js
 create mode 100644 js/xgui/torm/Entry.js
 create mode 100644 js/xgui/torm/Table.js
 create mode 100644 js/xgui/torm/Xgui.js
 create mode 100644 js/xgui/torm/index.js
 create mode 100644 js/xgui/xgui.js
 create mode 100644 js/xgui/xgui_asn1.js
 create mode 100644 js/xgui/xgui_base64.js
 create mode 100644 js/xgui/xgui_button.js
 create mode 100644 js/xgui/xgui_calendar.js
 create mode 100644 js/xgui/xgui_combobox.js
 create mode 100644 js/xgui/xgui_corba.js
 create mode 100644 js/xgui/xgui_dialogbox.js
 create mode 100644 js/xgui/xgui_hex.js
 create mode 100644 js/xgui/xgui_json.js
 create mode 100644 js/xgui/xgui_jsonrpc.js
 create mode 100644 js/xgui/xgui_menu.js
 create mode 100644 js/xgui/xgui_stream.js
 create mode 100644 js/xgui/xgui_tab.js
 create mode 100644 js/xgui/xgui_table.js
 create mode 100644 js/xgui/xgui_wizard.js
 create mode 100644 liens.xml
 create mode 100644 liens_php.xml
 create mode 100644 locale/de_DE/LC_MESSAGES/fr_FR.UTF-8.mo
 create mode 100644 locale/default.mo
 create mode 100644 locale/default.po
 create mode 100644 locale/fr_FR.UTF-8.mo
 create mode 100644 locale/fr_FR.UTF-8.po
 create mode 100644 locale/fr_FR/LC_MESSAGES/syndic.mo
 create mode 100644 locale/syndic_fr_FR.UTF-8.mo
 create mode 100644 locale/syndic_fr_FR.UTF-8.po
 create mode 100644 menu.xml
 create mode 100644 menu_andre.xml
 create mode 100644 messages.po
 create mode 100644 messages.pot
 create mode 100644 news.xml
 create mode 160000 phplib
 create mode 100644 robots.txt
 create mode 100644 site/article.xsl
 create mode 100644 site/cv.xsl
 create mode 100644 site/footer.xsl
 create mode 100644 site/generate_header.xsl
 create mode 100644 site/generate_html.xsl
 create mode 100644 site/menuh.xsl
 create mode 100644 site/menuv.xsl
 create mode 100644 site/news.xsl
 create mode 100644 site/page.xsl
 create mode 100644 site/root.xsl
 create mode 100644 site/test.xsl
 create mode 100644 sitemap.php
 create mode 100644 src/app/compta/.@__thumb/adefaultcopro.ts
 create mode 100644 src/app/compta/.@__thumb/adefaultcoprote.ts
 create mode 100644 src/app/compta/.@__thumb/adefaultjournaux.ts
 create mode 100644 src/app/compta/.@__thumb/adefaultpcmn.ts
 create mode 100644 src/app/compta/.@__thumb/adefaultservices.ts
 create mode 100644 src/app/compta/.@__thumb/adefaultsupplier.ts
 create mode 100644 src/app/compta/.@__thumb/adefaulttransaction.ts
 create mode 100644 src/app/compta/.@__thumb/s100copro.ts
 create mode 100644 src/app/compta/.@__thumb/s100coprote.ts
 create mode 100644 src/app/compta/.@__thumb/s100journaux.ts
 create mode 100644 src/app/compta/.@__thumb/s100pcmn.ts
 create mode 100644 src/app/compta/.@__thumb/s100services.ts
 create mode 100644 src/app/compta/.@__thumb/s100supplier.ts
 create mode 100644 src/app/compta/.@__thumb/s100transaction.ts
 create mode 100644 src/app/compta/.@__thumb/s800copro.ts
 create mode 100644 src/app/compta/.@__thumb/s800coprote.ts
 create mode 100644 src/app/compta/.@__thumb/s800journaux.ts
 create mode 100644 src/app/compta/.@__thumb/s800pcmn.ts
 create mode 100644 src/app/compta/.@__thumb/s800services.ts
 create mode 100644 src/app/compta/.@__thumb/s800supplier.ts
 create mode 100644 src/app/compta/.@__thumb/s800transaction.ts
 create mode 100644 src/app/compta/Dialog.ts
 create mode 100644 src/app/compta/bilan.ts
 create mode 100644 src/app/compta/budget.ts
 create mode 100644 src/app/compta/copro.ts
 create mode 100644 src/app/compta/coprote.ts
 create mode 100644 src/app/compta/entretien.ts
 create mode 100644 src/app/compta/exercice.ts
 create mode 100644 src/app/compta/journaux.ts
 create mode 100644 src/app/compta/lots.ts
 create mode 100644 src/app/compta/pcmn.ts
 create mode 100644 src/app/compta/services.ts
 create mode 100644 src/app/compta/supplier.ts
 create mode 100644 src/app/compta/supplierBootstrap.ts
 create mode 100644 src/app/compta/transaction.ts
 create mode 100644 src/js/xgui/.@__thumb/adefaultEntry.ts
 create mode 100644 src/js/xgui/.@__thumb/adefaultTable.ts
 create mode 100644 src/js/xgui/.@__thumb/adefaultXgui.ts
 create mode 100644 src/js/xgui/.@__thumb/adefaultindex.ts
 create mode 100644 src/js/xgui/.@__thumb/s100Entry.ts
 create mode 100644 src/js/xgui/.@__thumb/s100Table.ts
 create mode 100644 src/js/xgui/.@__thumb/s100Xgui.ts
 create mode 100644 src/js/xgui/.@__thumb/s100index.ts
 create mode 100644 src/js/xgui/.@__thumb/s800Entry.ts
 create mode 100644 src/js/xgui/.@__thumb/s800Table.ts
 create mode 100644 src/js/xgui/.@__thumb/s800Xgui.ts
 create mode 100644 src/js/xgui/.@__thumb/s800index.ts
 create mode 100644 src/js/xgui/CtrlDialogbox.ts
 create mode 100644 src/js/xgui/Entry.ts
 create mode 100644 src/js/xgui/Table.ts
 create mode 100644 src/js/xgui/Xgui.ts
 create mode 100644 src/js/xgui/index.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/CHANGELOG.md
 create mode 100644 src/node_modules/@webcomponents/custom-elements/LICENSE.md
 create mode 100644 src/node_modules/@webcomponents/custom-elements/README.md
 create mode 100644 src/node_modules/@webcomponents/custom-elements/custom-elements.min.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/custom-elements.min.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/externs/custom-elements.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/package.json
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultAlreadyConstructedMarker.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultCustomElementInternals.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultCustomElementRegistry.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultCustomElementState.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultDeferred.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultDocumentConstructionObserver.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultExterns.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultUtilities.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultcustom-elements.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/adefaultnative-shim.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100AlreadyConstructedMarker.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100CustomElementInternals.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100CustomElementRegistry.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100CustomElementState.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100Deferred.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100DocumentConstructionObserver.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100Externs.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100Utilities.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100custom-elements.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s100native-shim.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800AlreadyConstructedMarker.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800CustomElementInternals.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800CustomElementRegistry.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800CustomElementState.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800Deferred.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800DocumentConstructionObserver.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800Externs.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800Utilities.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800custom-elements.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/.@__thumb/s800native-shim.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/AlreadyConstructedMarker.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/AlreadyConstructedMarker.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/AlreadyConstructedMarker.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementInternals.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementInternals.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementInternals.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementRegistry.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementRegistry.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementRegistry.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementState.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementState.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/CustomElementState.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Deferred.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Deferred.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Deferred.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/DocumentConstructionObserver.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/DocumentConstructionObserver.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/DocumentConstructionObserver.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Externs.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Externs.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Externs.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/adefaultDocument.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/adefaultDocumentFragment.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/adefaultElement.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/adefaultHTMLElement.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/adefaultNative.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/adefaultNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s100Document.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s100DocumentFragment.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s100Element.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s100HTMLElement.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s100Native.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s100Node.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s800Document.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s800DocumentFragment.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s800Element.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s800HTMLElement.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s800Native.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/.@__thumb/s800Node.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Document.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Document.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Document.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/DocumentFragment.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/DocumentFragment.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/DocumentFragment.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Element.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Element.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Element.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/HTMLElement.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/HTMLElement.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/HTMLElement.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/.@__thumb/adefaultChildNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/.@__thumb/adefaultParentNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/.@__thumb/s100ChildNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/.@__thumb/s100ParentNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/.@__thumb/s800ChildNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/.@__thumb/s800ParentNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/ChildNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/ChildNode.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/ChildNode.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/ParentNode.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/ParentNode.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Interface/ParentNode.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Native.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Native.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Native.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Node.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Node.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Patch/Node.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Utilities.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Utilities.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/Utilities.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/custom-elements.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/custom-elements.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/custom-elements.js.map
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/native-shim.d.ts
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/native-shim.js
 create mode 100644 src/node_modules/@webcomponents/custom-elements/src/native-shim.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/CHANGELOG.md
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/LICENSE.md
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/README.md
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_js.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_js.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/package.json
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-pf_js-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/flag-parser.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/baseuri.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/child-node/after.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/child-node/before.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/child-node/index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/child-node/remove.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/child-node/replace-with.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/custom-event.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/es6-misc.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/get-attribute-names.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/matches.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/parent-node/append.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/parent-node/index.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/parent-node/prepend.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/parent-node/replace-children.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/promise.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/svg-element-class-list.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/platform/symbol.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/src/unresolved.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js.map
 create mode 100644 src/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js
 create mode 100644 src/node_modules/tslib/.@__thumb/adefaulttslib.d.ts
 create mode 100644 src/node_modules/tslib/.@__thumb/s100tslib.d.ts
 create mode 100644 src/node_modules/tslib/.@__thumb/s800tslib.d.ts
 create mode 100644 src/node_modules/tslib/CopyrightNotice.txt
 create mode 100644 src/node_modules/tslib/LICENSE.txt
 create mode 100644 src/node_modules/tslib/README.md
 create mode 100644 src/node_modules/tslib/modules/index.js
 create mode 100644 src/node_modules/tslib/modules/package.json
 create mode 100644 src/node_modules/tslib/package.json
 create mode 100644 src/node_modules/tslib/tslib.d.ts
 create mode 100644 src/node_modules/tslib/tslib.es6.html
 create mode 100644 src/node_modules/tslib/tslib.es6.js
 create mode 100644 src/node_modules/tslib/tslib.html
 create mode 100644 src/node_modules/tslib/tslib.js
 create mode 100644 src/package-lock.json
 create mode 100644 src/package.json
 create mode 100644 src/tsconfig.json
 create mode 100644 src/tsconfig.xgui.json
 create mode 100644 src/types/aebw/.@__thumb/adefaultindex.d.ts
 create mode 100644 src/types/aebw/.@__thumb/s100index.d.ts
 create mode 100644 src/types/aebw/.@__thumb/s800index.d.ts
 create mode 100644 src/types/aebw/index.d.ts
 create mode 100644 src/types/prototypejs/index.d.ts
 create mode 100644 src/types/require.d.ts
 create mode 100644 src/types/require1.d.ts
 create mode 100644 src/types/requirejs.d.ts
 create mode 100644 src/types/requirejs/index.d.ts
 create mode 100644 syndic.pot
 create mode 100644 syndic_file_list.txt
 create mode 160000 tiers/tcpdf
 create mode 100644 tools/gen_tex.bat
 create mode 100644 tools/generate.bat
 create mode 100644 tools/generate.sh
 create mode 100644 tools/generate.wsf
 create mode 100644 tools/generate1.bat
 create mode 100644 update.php
 create mode 100644 web.xml
 create mode 100644 webfonts/fa-brands-400.eot
 create mode 100644 webfonts/fa-brands-400.svg
 create mode 100644 webfonts/fa-brands-400.ttf
 create mode 100644 webfonts/fa-brands-400.woff
 create mode 100644 webfonts/fa-brands-400.woff2
 create mode 100644 webfonts/fa-regular-400.eot
 create mode 100644 webfonts/fa-regular-400.svg
 create mode 100644 webfonts/fa-regular-400.ttf
 create mode 100644 webfonts/fa-regular-400.woff
 create mode 100644 webfonts/fa-regular-400.woff2
 create mode 100644 webfonts/fa-solid-900.eot
 create mode 100644 webfonts/fa-solid-900.svg
 create mode 100644 webfonts/fa-solid-900.ttf
 create mode 100644 webfonts/fa-solid-900.woff
 create mode 100644 webfonts/fa-solid-900.woff2
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..1ee8a78
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,12 @@
+[submodule "app/xsl"]
+	path = app/xsl
+	url = https://git.ebersold.fr/repos/www/app/xsl
+[submodule "app/member"]
+	path = app/member
+	url = https://git.ebersold.fr/repos/www/app/user.git
+[submodule "phplib"]
+	path = phplib
+	url = https://git.ebersold.fr/repos/www/common/phplib.git
+[submodule "tiers/tcpdf"]
+	path = tiers/tcpdf
+	url = https://git.ebersold.fr/repos/www/tiers/tcpdf.git
diff --git a/accounting/accueil.en_US.UTF-8.xml b/accounting/accueil.en_US.UTF-8.xml
new file mode 100644
index 0000000..43fdd45
--- /dev/null
+++ b/accounting/accueil.en_US.UTF-8.xml
@@ -0,0 +1,72 @@
+
+
+    
+    Welcome page of Aeb 
+    Welcome page to aeb website. You can find a porto folio of our realizations.
C++,CV,Linux,Development 
+    $Date: 2010/08/25 15:10:02 $ 
+    $Id: accueil.en_US.UTF-8.xml,v 1.4 2010/08/25 15:10:02 aebersol Exp $ 
+     
+      
+
+
+
+
Who I am 
+
+Senior Software Engineer39 years old 
+Company : Alcatel Lucent
+ 
+Specialized in C/C++ development
+ 
+
+
+
Studies / Projects 
+
 
+
+Flash driver enhancement 
+Web reverse proxy comparison 
+Encapsulation of binary flow in http chucks 
+OmniPCX Office feature improvements 
+Porting Linux 2.4 drivers to kernel 2.6 Migration of x86 application to powerpc 
+ 
+ 
+
+
+
+
+
+
News Events  
+
 
+
+I work for Alcatel Lucent  
+I maintain a remote server (from dedibox) for an association 
+Accounting software  
+ 
+
+
+
Activities  
+
 
+
+I work for Alcatel Lucent as a sub-contractor 
+I remotely maintain a server (from dedibox) for an association 
+ 
+ 
+
+
+
 
+		
+ 
diff --git a/accounting/accueil.fr_FR.UTF-8.xml b/accounting/accueil.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..f0ddfb6
--- /dev/null
+++ b/accounting/accueil.fr_FR.UTF-8.xml
@@ -0,0 +1,75 @@
+
+
+    
+    La page d'accueil de la gestion de copropriete en ligne. 
+    En tant que syndics bénévoles, nous sommes fièrs de vous présenter notre solution de gestion pour le syndic bénévole. Cette application, simple d'utilisation, réponds précisément au besoin des syndics bénévoles qui gèrent de petite copropriété. Tous les services de comptabilités sont facile d'accès et vous permettent de gagner un temps précieux. 
+    $Date: 2010/08/25 15:10:02 $ 
+    $Id: accueil.fr_FR.UTF-8.xml,v 1.3 2010/08/25 15:10:02 aebersol Exp $ 
+    SYNDIC,Bénévole,STRASBOURG,ANDRE,EBERSOLD,COMPTABILITE,CLOUD, syndic bénévole, le syndic bénévole, les syndics bénévoles, syndic bénévole compta, compta petite copropriété 
+    
+        
+	    
+
+
Bookkeeping for trustee 
+
GCopro une solution de gestion comptable 
+pour les Syndics non professionnel 
+
+
Expérimentez la  comptabilité pour le syndic  en toute simplicité. Une nouvelle manière de gérer votre bâtiment et vos copropriétaires.  
+
+
+
Services 
+
+
+Disponible en tout temps 
+Détail des comptes 
+Gestion de lots 
+Gestion des fournisseurs 
+Gestion des copropriétaires 
+Synthèse à la cloture conforme aux exigences de la loi 
+ 
+
+
+
+
+
Syndic bénévole 
+
+
+
+
+
+
+
+
En toute Simplicité 
+
+
+Des fenêtres de saisies adaptées 
+Pour lancer les appels de fonds 
+Enregistrer les factures 
+Enregistrer les payements 
+Enregistrer les versements des corpropriértaires 
+Gérer les lots de la copropriété 
+Toutes les annexes comptable à la cloture conformes aux exigences de la loi 
+ 
+
+
+
 
+   
+
+ 
diff --git a/accounting/bilan.fr_FR.UTF-8.xml b/accounting/bilan.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..457f479
--- /dev/null
+++ b/accounting/bilan.fr_FR.UTF-8.xml
@@ -0,0 +1,7 @@
+
+accounting/bilan gestion, syndic bénévole bilan, logiciel comptabilité, synthèse des comptes Description de la fenêtre de synthèse bilan. Cette onglet permet d'avoir une vue d'ensemble de la comptabilité sur une période. 
+Bilan 
+Comme son nom l'indique, cette fenêtre permet au syndic bénévole d'avoir un accès rapide au bilan d'un exercice. Elle donne aussi une synthèse de l'ensemble des comptes. Un moyen simple pour vérifier le montant disponible en banque, les factures qui doivent encore être réglé.
+Enfin, pour facilité la préparation de l'assemblée générale, un bouton de téléchargement permet d'avoir en un seul clic les annexes comptables qui doivent être jointes à la convocation.
+
+Comme le montre la figure ci-dessus, les options qui sont disponibles sont trivials et suffisantes pour le syndic bénévole. Ce qui l'intéresse c'est d'avoir un synthèse des comptes et pourvoir joindre les annexes à la convocation de l'assemblée générale.
 accounting/budget Liens,SYNDIC,Budget,gestion Gestion du budget de la copropriété. 
+L'onglet Budget 
+
+Il permet au syndic de préparer les budgets prévisionnels pour les années à venirs. Ces budgets sont automatiquement intégré dans les annexes comptable en fin d'exercice.
+Cet espace de travail fournit deux service. La liste des budgets, la création d'un nouveau budget. Le logiciel se base sur le plan comptable pour créer les lignes qui doivent être budgété.
+Liste des budgets 
+C'est un simple tableau qui affiche la liste de tous les budgets qui ont été créé. Le syndic peut supprimer un budget en cliquant sur le croix d'une ligne, ou il peut simplement selection un budget pour passer en mode édition.
+
+Edition d'un budget 
+L'édition du budget est enfantine. Il suffit de selectionner un celulle dans la colonne "N". Le champ se met alors en mode édition et vous pouvez saisir la montant que vous souhaiter budgéter pour le poste en question. Il vous suffit de valider la saisie en appuyant sur entré. La celulle change de nouveau d'état et votre montant est enregistré. Le Total est égalelement mis à jour.
+
+
 
+    Hobbies 
+    $Date: 2008/03/06 18:11:29 $ 
+    $Id: loisirs_music.xml,v 1.5 2008/03/06 18:11:29 aebersol Exp $ 
+    
+    
+        
+            Useful Links 
+            
+     
+
+
+    
+    
+     
+ 
diff --git a/accounting/contact.en_US.UTF-8.xml b/accounting/contact.en_US.UTF-8.xml
new file mode 100644
index 0000000..dbcae01
--- /dev/null
+++ b/accounting/contact.en_US.UTF-8.xml
@@ -0,0 +1,34 @@
+
+
+    Contact 
+    Contact 
+    Willkommen 
+    $Date: 2009/04/27 06:38:44 $ 
+    $Id: contact.xml,v 1.6 2009/04/27 06:38:44 aeb Exp $ 
+    
+        Contact 
+Feel free to leave a message or comments.
+
+ 
+ 
+
diff --git a/accounting/contact.fr_FR.UTF-8.xml b/accounting/contact.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..cfd961c
--- /dev/null
+++ b/accounting/contact.fr_FR.UTF-8.xml
@@ -0,0 +1,34 @@
+
+
+    Contact 
+    Contact 
+    Willkommen 
+    $Date: 2009/04/27 06:38:44 $ 
+    $Id: contact.xml,v 1.6 2009/04/27 06:38:44 aeb Exp $ 
+    
+        Contact 
+          Laissez nous votre message.
+
+ 
+ 
+
diff --git a/accounting/copro_exercice.fr_FR.UTF-8.xml b/accounting/copro_exercice.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..f593189
--- /dev/null
+++ b/accounting/copro_exercice.fr_FR.UTF-8.xml
@@ -0,0 +1,7 @@
+
+accounting/copro_exercice syndic bénévole,gestion copropriété, créer comptabilité, exercice comptable,gestion de lots,gestion des postes de charge Description de la partie configuration. Cette oglet permet de gérer les exercices comptables. 
+Copropriété / section exercice 
+Cette section du logiciel en ligne de comptabilité permet de gérer les exercices. La création d'un nouvelle exercice est relativement simple. Il suffit de renseigner les trois champs de la figure ci-dessous.
+Les périodes sont à entrer sous la forme : 'AAAA-MM-JJ'
+
+La suppression d'un exercice est réalisée en cliquant sur la croix rouge de la ligne correspondante.
 accounting/copro_lots syndic bénévole,gestion copropriété, créer comptabilité, exercice comptable,gestion de lots,gestion des postes de charge Description de la partie configuration. Cette oglet permet de gérer les lots. 
+Gestion des lots 
+La gestion des lots est importante pour le calcul de la réparition des charges. A chaque lot est associer une valeur de tantieme par poste de charge. C'est cette valeur qui sera utilisée pour calculer la part de charge pour une facture donnée.
+
+Cette section permet simplement de créer et gérer les lots d'une copropriété. Ultérieuement, ces lots seront affectés à des coprorpriétaires. Il faudra aussi, via un autre menu affecter les tantièmes suivant les postes de charges.
 accounting/copro_lots_attribuer syndic bénévole,gestion copropriété, créer comptabilité, exercice comptable,gestion de lots,gestion des postes de charge Description de la partie configuration. Cette oglet permet de gérer les lots. 
+Attribuer des lots 
+Une fois les lots créés, il faut les attribuer aux différents copropriétaires. Cette opération est faite une fois pour toute tant qu'il n'y a pas d'achat/vente en jeu.
 accounting/coproriete syndic bénévole,gestion copropriété, créer comptabilité, exercice comptable,gestion de lots,gestion des postes de charge Déscription générale des fonctions qui sont offert par la solution de gestion en ligne. 
+L'onglet Copropriété 
+
+Un premier groupe permet de voir la liste des copropriétés dont vous faites partie. Il vous est possible de créer un nouvel environnement de gestion à l'aide du lien Nouvelle Organisation.
+Un second groupe permet de gérer les exercices  des périodes comptable.
+Un troisième groupe permet de gérer les lots  et d'attribuer des lots  aux copropriétaires.
+Et enfin un dernier groupe permet de gérer l'attribution des cotes part suivant le poste de charge.
 Faites un dont pour nous soutenir SYNDIC,bénévoles,dons,comptabilité,STRASBOURG,gestion,fonds,andré ebersold Faire des dons pour l'utilisation de l'application 
+Faire Un don 
+Vous aimez la solution de ce site et vous souhaitez qu'elle vive parce qu'elle vous rend un service incommensurable par rapport à la gestion traditionnelle, alors, n'hésitez pas à faire un don annuel en fonction de la taille de votre copropriété.
+Les fonds vont servir à financer le fournisseur de service qui héberge le site
+
+
+
+
+Pour une copropriété de 1 à 20 lots Faites un don de 5 euros/mois  
+
+Pour une copropriété de plus de 20 lots 
+Il vos mieux nous contacter 
+ 
+ 
+ 
+
+
+ La mise en place des moyens de donations est en cours.
+         Vous pouvez malgré tout utiliser le service. 
+
+ 
+accounting/fournisseur Liens,SYNDIC Description générale des fonctions qui sont offert par la solution de gestion en ligne pour géré les aspects comptable liés aux fournisseurs..  
+L'onglet fournisseur. 
+Enregistrement des factures 
+Ci-dessous, un aperçu de la fenêtre de saisie d'une facture.
+
+Après avoir sélectionné l'onglet Fournisseurs, puis l'entrée Nouvelle facture dans le menu gauche, le syndic peu commencer à faire la saisie. Il choisira un intitulé approprié, ensuite il selectionnera le fournisseur dans la liste déroulante aussi que le compte de charge à débiter. Bien sûr il ne faut pas oublier la date de la facture, son montant ainsi que sa référence. Avant d'enregistrer le tout, si le syndic dispose d'un scanner, il peut joindre à l'enregistrement une version électronique de la facture via l'entrée Fichier. Ce document pourra être consulté ultérieument sous plusieurs vue.
+Une fois que tous les champs sont saisis (sans oublier la clé de charge), le syndic peu en toute tranquilité enregistrer la facture. Cette dernière sera automatiquement répartie au prorata des cotes parts des lots sur l'ensemble des propriétaires.
+La saisie du payement d'une facture. 
+
+L'état des comptes d'un fournisseur 
+Ci-dessous, un aperçu des informations auquelles on peut rapidement avoir accès sans se casser la tête. En quatres clics vous avez accès au détail du compte d'un fournisseur.
+ accounting/journaux Liens,SYNDIC,syndic,bénévoles,journaux,comptabilité,consulter,strasbourg,compte,gestion Déscription générale des fonctions qui sont offert par la solution de gestion en ligne.
+Les Journaux 
+
+Le journal 
+Un journal répertorie toutes les opérations qui se sont déroulé durant un exercice donnée. La solution de gestion propose 7 types de journaux comme on peu le voir dans la figure ci-dessous.
+Le premier type, appelé "Banque" répertorie toutes les opérations bancaires. Le syndic bénévole peut ainsi facilement controler les transactions enregistrées par la banque et celle qu'il a enregistré dans la comptabilité en ligne.
+Le second type: "Ventes" ne devrait à priori pas être utilisé.
+Le troisième type: "Achats et frais" concerne répertorie toutes les opérations d'achat. En principe on devrait y voir apparaître les mouvements entre des comptes de fournisseurs et des comptes de charges.
+Le quatrième type: "Opération divers" sera utilisé pour toutes les opérations qui ne rentre dans aucun type prédéfini.
+Le cinquième type: "Appels de fonds" répertorie toutes les opérations d'appels de fonds. C'est à dire les mouvements entre les comptes de la classe 7 et celle des copropriétaires qui devront régler l'appel de fonds.
+La sixième catégorie:"Remboursement appels de fonds" est utilisé à la cloture des comptes où le syndic rembourse tous les appels de fonds. Après de remboursement des appels de fonds, le syndic vera apparaître sur les comptes des copropriétaires le trop percu ou le reste à percevoir.
+La septième catégorie:"Report à nouveau" est utilisée pour l'enregistrement des mouvements en début d'exercice. Il s'agit de reporter les soldes créditeurs et débiteurs de l'exercice clos sur le nouvel exercice.
+
+
+Détail d'un compte  
+    Hobbies 
+    $Date: 2008/03/06 18:11:29 $ 
+    $Id: loisirs_music.xml,v 1.5 2008/03/06 18:11:29 aebersol Exp $ 
+    
+    
+        
+            Useful Links 
+            
+     
+     
+    
+     
+ 
diff --git a/accounting/liens_syndic.fr_FR.UTF-8.xml b/accounting/liens_syndic.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..159f500
--- /dev/null
+++ b/accounting/liens_syndic.fr_FR.UTF-8.xml
@@ -0,0 +1,30 @@
+
+
+    Liens vers d'autre site relatif a la gestion de copropriete 
+    $Date: 2020/12/26 18:11:29 $ 
+    $Id: liens_syndic.xml,v 1.5 2008/03/06 18:11:29 aebersol Exp $ 
+    
+    Liens,SYNDIC,strasbourg,bénévoles,conseil,loi,copropriété,conseil Liens utiles pour le syndic bénévole. 
+
+Les Associations de syndic bénévoles 
+UNARC, l'assocation des résponsables de copropriété. 
+ASIB, l'association des syndics d'immeuble bénévoles. 
+Conseil syndical de Besançon. 
+Ce que dit la loi 
+JPM-COPRO Droit et pratique de la copropriété de Jean-Pierre MANTELET  une source d'information bien utile que vous pouvez consulter.
+La répartition des charges 
+Loi N° 65-557 du 10 juillet 1965  fixant le status de la copropriété des immeubles bâtis.
+Décret n°67-223 du 17 mars 1967  pris pour l'application de la loi n° 65-557 du 10 juillet 1965 fixant le statut de la copropriété des immeubles bâtis
+Taux d'intéret légaux  en cas de retard de versement des appels de fonds.
+Quelques définitions utiles 
+Le conseil syndical  Il a pour rôle d'assister le syndic dans ses décisions.
+La répartition des charges 
+Un autre article de l'ANIL  donne une définition similaire.
+Une description exhaustive des types de charges  sur le site de syneval.
 
+ 
+
+ 
+
+ 
diff --git a/accounting/plan_comptable.fr_FR.UTF-8.xml b/accounting/plan_comptable.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..c604e79
--- /dev/null
+++ b/accounting/plan_comptable.fr_FR.UTF-8.xml
@@ -0,0 +1,10 @@
+
+accounting/plan_comptable SYNDIC,logiciel,cloud,syndic bénévole édition du plan comptable,plan comptable,plan comptable,comptabilité,gestion,syndic Logiciel de gestion comptable en ligne: La gestion du plan comptable. C'est une interface simple et intuitive. 
+Le Plan comptable 
+Un plan comptable est créé automatiquement lors de la création d'un compte.
+Le menu relatif au plan comptable 
+
+Cette sélection étant effectué le syndic peut maintenant aisément ajouter ou supprimer un comptes.
+
+L'ajout d'un compte se fait en choisissant un numéro de compte, un libellé, puis on selectionne le bouton ajouter.
+La suppression de compte est tout aussi simple. Il suffit de cliquer sur "delete" pour supprimer un compte. (Attention aux conséquences de la suppression d'un compte. Toutes les opérations qui sont associées à ce compte seront supprimés. Le logiciel ne supprime pas le compte si celui-ci n'est pas soldé).
 
+    Mes activités privées 
+    Activities 
+    Willkommen 
+    Activity 
+    Description des mes activités de développement personnel 
+    $Date: 2010/08/25 15:10:02 $ 
+    $Id: activite.en_US.UTF-8.xml,v 1.3 2010/08/25 15:10:02 aebersol Exp $ 
+    
+        
+      
+
+
+
Bookkeeping for trustee 
+
+
Bookkeeping for trustees. 
+Experiment the  
Bookkeeping for trustee.  A new way to   to manage your building and deal with your part owners.  
 Join the great community of online accounting managers.
+
+
+
Bookkeeping for churches 
+
+
Bookkeeping for churches. 
+Experiment the  
Bookkeeping for churches.  A new way to   to manage the finances of the church and your members.
+
+
 
+            
+     
+
+ 
+
diff --git a/accounting/products.fr_FR.UTF-8.xml b/accounting/products.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..f695123
--- /dev/null
+++ b/accounting/products.fr_FR.UTF-8.xml
@@ -0,0 +1,42 @@
+
+
+    Les solutions de gestion en ligne 
+    SYNDIC,Comptabilité, Copropriété,Gestion 
+    Description des mes activités de développement personnel 
+    $Date: 2010/08/25 15:10:02 $ 
+    $Id: activite.fr_FR.UTF-8.xml,v 1.2 2010/08/25 15:10:02 aebersol Exp $ 
+    
+        
+        
+
+
+
Bookkeeping for trustee 
+
+
Comptabilité pour le syndic 
+Experimentez la  
comptabilité pour le syndic  Une nouvelle manière de gérer votre batiment et vos copropriétaires.  
 Joignez la communauté en ligne des syndics qui ont choisis la comptabilité en ligne.
+
+
+
Comptabilité pour les associations cultuelles 
+
+
Comptabilité pour les associations cultuelles. 
+Créé votre comptabilité en ligne pour  associations cultuelles. Une façon simple pour maintenir les comptes de votre association.
+
+
  
+              
+            
+     
+
+ 
+
diff --git a/accounting/services.en_US.UTF-8.xml b/accounting/services.en_US.UTF-8.xml
new file mode 100644
index 0000000..1fa14dd
--- /dev/null
+++ b/accounting/services.en_US.UTF-8.xml
@@ -0,0 +1,21 @@
+
+
+    Hobbies 
+    $Date: 2008/03/06 18:11:29 $ 
+    $Id: loisirs_music.xml,v 1.5 2008/03/06 18:11:29 aebersol Exp $ 
+    
+    
+        
+            Useful Links 
+            
+     
+     
+    
+     
+ 
diff --git a/accounting/services.fr_FR.UTF-8.xml b/accounting/services.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..89af823
--- /dev/null
+++ b/accounting/services.fr_FR.UTF-8.xml
@@ -0,0 +1,34 @@
+
+
+    Documentation, les généralités
$Date: 2008/03/06 18:11:29 $ 
+    $Id: loisirs_music.xml,v 1.5 2008/03/06 18:11:29 aebersol Exp $ 
+    
+    Liens,SYNDIC Déscription générale des fonctions qui sont offert par la solution de gestion en ligne. 
+
+Services 
+L'ensemble des services que vous offre une gestion comptable d'une copropriété en ligne est sans égale par rapport aux solutions habituelles.
+Disponible en toutes circonstances 
+Avec une gestion en ligne, plus de crainte à avoir pour changer de syndic. Toutes les données restent disponibles quelque soit le gestionnaire.
+Un geste écologique puisque tous les documents sont conservés sur un support numérique.
+Les copropriétaires peuvent à tout moment consulter les documents relatifs à la copropriété. Le carnet d'entretien, le détail des comptes, les factures des fournisseurs, les comptes rendus d'assemblées générales.
+Réalisation des tâches courantes en toute simplicité et transparence 
+Les pricipales rubriques sont accessibles au travers d'une barre de menus.
+
+
+ Copropriété :Dans cet espace, le syndic gère la configuration de la copropriété.   
+Plan:  C'est un espace qui permet de gérer le plan comptable de la copropriété. Dans le cas de base, le syndic n'aura pas besoin de créer de compte directement. Les comptes des fournisseurs et des copropriétaire sont automatiquement crééer lors de l'ajout d'un nouveau copropriétaire où d'un nouveau fournisseur.   Fournisseurs :Cet espace permet de gérer les fournisseurs.   
+Copropriétaires: Cet espace est dédié aux opérations relatifs aux copropriétaires. On y retrouve principalement, le moyen d'enregistrer les versements des copropriétaires, le décompte des charges, la possibilité de lancer un appel de fonds.  Journaux:  Cet espace offre une vue de toutes les opérations sur une période comptable. C'est très utile pour vérifier les comptes. Bilan :  Cet section donne une vue synthétique de tous les comptes. Le syndic pourra entre autre y retrouver les annexes comptable à joindre à la convocation de l'assemblée générale. Cette synthèse représente un gain de temps non négligable.  Budget:  Gérez vos budget au travers de cet espace de travail.   
+  
+ 
+
+ 
+
+ 
diff --git a/accueil.en_US.UTF-8.xml b/accueil.en_US.UTF-8.xml
new file mode 100644
index 0000000..7d14cd2
--- /dev/null
+++ b/accueil.en_US.UTF-8.xml
@@ -0,0 +1,73 @@
+
+
+    
+    Welcome page of Aeb 
+    Welcome page to aeb website. You can find a porto folio of our realizations.
C++,CV,Linux,Development 
+    $Date: 2010/08/25 15:10:02 $ 
+    $Id: accueil.en_US.UTF-8.xml,v 1.4 2010/08/25 15:10:02 aebersol Exp $ 
+     
+      
+
+
+
+
Who I am 
+
+Senior Software Engineer39 years old 
+Company : Alcatel Lucent
+ 
+Specialized in C/C++ development
+ 
+
+
+
Studies / Projects 
+
 
+
+Flash driver enhancement 
+Web reverse proxy comparison 
+Encapsulation of binary flow in http chucks 
+OmniPCX Office feature improvements 
+Porting Linux 2.4 drivers to kernel 2.6 Migration of x86 application to powerpc 
+ 
+ 
+
+
+
+
+
+
+
Activities  
+
 
+
+I work for Alcatel Lucent as a sub-contractor 
+I remotely maintain a server (from dedibox) for an association 
+ 
+ 
+
+
+
 
+		
+ 
diff --git a/accueil.fr_FR.UTF-8.xml b/accueil.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..a5b50eb
--- /dev/null
+++ b/accueil.fr_FR.UTF-8.xml
@@ -0,0 +1,71 @@
+
+
+    
+    La page d'accueil d'Andre EBERSOLD 
+    About 
+    Willkommen 
+    Toutes nos realisation et savoir faire en matière de service informatique. Développement de serveur pour des systèmes embarquées.
$Date: 2010/08/25 15:10:02 $ 
+    $Id: accueil.fr_FR.UTF-8.xml,v 1.3 2010/08/25 15:10:02 aebersol Exp $ 
+    C++,Ingénieur,Linux 
+    
+        
+	    
+
+
+
Profile 
+
+
Ingénieur Informatique 
+
Société : Adival Services 
+
Spécialisé dans le développement C/C++ 
+
+
+
+
Projet et études 
+
+
+Amélioration d'un driver flash 
+Comparaison de diférent reverse proxy 
+Encapsulation d'un flux binaire dans des chunks http 
+OmniPCX Office feature improvement 
+Porting Linux 2.4 drivers to kernel 2.6 Migration of x86 application to powerpc 
+ 
+
+
+
+
+
+
+
Activités  
+
+
+Je travaille en tant que consultant pour Alcatel-Lucent 
+Pour le compte d'une association, je maintiens une dedibox 
+Source formating 
+ 
+
+
+
+
 
+
+ 
diff --git a/accueil.xml b/accueil.xml
new file mode 100644
index 0000000..50b696c
--- /dev/null
+++ b/accueil.xml
@@ -0,0 +1,98 @@
+
+
+    
+    La page d'accueil d'Andre EBERSOLD 
+    About 
+    Willkommen 
+    $Date: 2010/04/21 17:10:20 $ 
+    $Id: accueil.xml,v 1.25 2010/04/21 17:10:20 aebersol Exp $ 
+        
+        Accueil 
+        About 
+        Introduction 
+        Introduction 
+        Introduction 
+            
+                This site  intends to help creating 
+                relations, by showing my  
+            
+                Bienvenu sur ce site dont le but premier est de me faire connaitre au travers
+                des différentes activités et de mes centres d'intérets. 
+             
+            
+                faire connaître / créer de nouveaux contactes /  Promouvoir mon savoir faire (compétences) et
+                les projets personnels que j'ai développé.
+              
+            
+                De plus en plus, Internet devient un moyen pour
+                échanger, trouver du travail, créer de nouveaux contacts.
+                C'est le but de ce site qui présente mon cursus  
+                professionnel au travers du   
+            Compétences 
+            
+                Mon activité principale est le développement en C et C++. Ceci aussi
+                bien sous Windows que sous Unix. Dans ce context rentre également la
+                gestion des sources, la mise en place de procedures de fabrications
+                de programmes.  
+				 
+				
+	    
+		    Who I am 
+             Senior Software Engineer 
+             
+	    
+		    Studies / Projects 
+		    
+			    
+				    Flash driver enhancement 
+				    Web reverse proxy comparison 
+				    Encapsulation of binary flow in http chucks 
+						OmniPCX Office feature improvements 
+						Porting Linux 2.4 drivers to kernel 2.6 
+						Migration of x86 application to powerpc 
+			     
+		     
+ 
+
+										
+							News Events  
+							
+											
+															Studied packagers for embedded systems (rpm, opkg/ipkg, npm,...) 
+															Wrote distro, a small distribution builder 
+							   
+			         
+             
+						
+							Activities  
+								
+									
+										I work for Alcatel Lucent as contracting 
+										I maintain remotly a remote server (from dedibox) for an association 
+									 
+								 
+             
+						
+						
 
+
+ 
diff --git a/app/admin/crontab.php b/app/admin/crontab.php
new file mode 100644
index 0000000..2748962
--- /dev/null
+++ b/app/admin/crontab.php
@@ -0,0 +1,28 @@
+
+
diff --git a/app/admin/index.js b/app/admin/index.js
new file mode 100644
index 0000000..6022623
--- /dev/null
+++ b/app/admin/index.js
@@ -0,0 +1,141 @@
+/**
+ * This is my first try to associate javascript code with the user interface.
+ * It's still under work.
+ * First, I should remove prototype dependances here. I do have all I need.
+ */
+
+AEBW.declare("Admin",AEBW.JsonRpc, {
+   listSection:function(section) {
+     this.handle({onSuccess: function(res) {
+         try {
+           $("dist-section").childElements().each (function (e) {e.remove();});
+           var dists= $("dist-section");
+           res.each(function(e) {dists.insert(""+e.nv+"  ");});
+         } catch (e)
+         {
+           alert("Yes got Exception: "+e+"it:"+res);
+         }
+       }
+       ,onFailure:function(res) {alert("Finally failed:"+res);}},
+       "listSection",{'section':section}) ;
+   },
+   listDistributions:function(distId) {
+     this.handle( {
+         onSuccess:function(res) {
+           var cb=$("cbDists");
+           cb.childElements().each(function(e) {e.remove();});
+           res.each(function(e) {
+           if (e.id == distId) {
+               cb.insert(""+e.name+"-"+e.version+" ");
+               $("enDistVersion").value = e.version;
+               $("enDistBoard").value = e.board_name;
+           } else {
+               cb.insert(""+e.name+"-"+e.version+" ");
+           }
+           cb.childElements().each(function(e) {if (e.value==distId) e.selected=true;});
+             });
+         },
+         onFailure:function(res) {
+           alert("Failed load Distributions:"+res);
+         }
+       },
+       "listDistributions",{}
+       );
+   },
+   DistPackageList:function(d_id) {
+     this.handle( {
+         onSuccess:function(res) {
+           var selDist = $("dist-packages");
+           selDist.childElements().each(function(e) {e.remove();});
+           res.each( function(e) {
+             selDist.insert(""+e.name+" "+e.version+"("+e.pv_id+") ");
+             });
+         },
+         onFailure:function(res) {
+           alert("Failed Get Packages:"+res);
+           var selDist = $("dist-packages");
+           selDist.childElements().each(function(e) {e.remove();});
+         }
+       },
+       "DistPackageList",{"dist": d_id}
+     );
+   },
+   newDistribution:function() {
+     this.handle( {
+         onSuccess:function(res) {
+         },
+         onFailure:function(res) {
+         }
+       },
+       "newDistribution",{}
+     );
+   },
+   addPackage:function(DistId,PkgId) {
+     this.handle( {
+         onSuccess:function(res) {
+         },
+         onFailure:function(res) {
+          alert('addPackage Failed'+res);
+         }
+       },
+       "addPackage",Array([ DistId ,  PkgId])
+     );
+   },
+   rmPackage:function(PkgId) {
+     this.handle( {
+         onSuccess:function(res) {
+         },
+         onFailure:function(res) {
+          alert("Failed remove Package and do not know why"+res);
+         }
+       },
+       "rmPackage",Array([PkgId])
+     );
+   }
+
+});
+
+AEBW.declare("Admin.Pages",AEBW.JsonRpc, {
+		});
+
+if (!AEBW.admin) {}
+
+var d = new Admin(alias+"/app/admin/Admin.php");
+
+
+Event.observe('btNewPage','click',function (evt) {
+  alert("Call 1");
+  var form =$("createPage");
+  var str=form.serialize();
+  alert("Call "+alias+" "+str);
+   new Ajax.Request(alias+"/update.php",
+	   {
+              method:"post",
+	      postBody:str
+	  
+      });
+  });
+/*
+var pkgs   = new AEBW.distro.packages;
+Event.observe('btSearchPackage','click',function (evt) {
+	pkgs.search($('ipPackage').value);
+		});
+
+Event.observe('cbDists','change',function (e) {
+	  d.listDistributions(e.element().value);
+		d.DistPackageList(e.element().value);
+    });
+
+Event.observe('btDistAdd','click',function(e) {
+      var sel = $('dist-section');
+      var e = Element.extend(sel.options[sel.selectedIndex]);
+      d.addPackage($('cbDists').value,e.value);
+	    d.DistPackageList($('cbDists').value);
+    });
+Event.observe('btDistRemove','click',function(e) {
+      var sel = $('dist-packages');
+      var e = Element.extend(sel.options[sel.selectedIndex]);
+      d.rmPackage(e.value);
+	    d.DistPackageList($('cbDists').value);
+    });
+*/
diff --git a/app/admin/patch_db.php b/app/admin/patch_db.php
new file mode 100644
index 0000000..c5851ba
--- /dev/null
+++ b/app/admin/patch_db.php
@@ -0,0 +1,65 @@
+
+ -p [patch file] -d database 
+setStartPoint($from);
+    $schema->updateCompta($orgid);
+  
+  }
+?>
diff --git a/app/admin/view/index.fr_FR.UTF-8.xml b/app/admin/view/index.fr_FR.UTF-8.xml
new file mode 100644
index 0000000..8719e6b
--- /dev/null
+++ b/app/admin/view/index.fr_FR.UTF-8.xml
@@ -0,0 +1,351 @@
+
+
+
+
+
+  Distro 
+  
+    
+
+    Administration  
+    
+          sa chaine de compilation, les paquets logiciels devant se trouver dans la distribution
+          final.
+    
 
+
+      
+    
+      
+        Utilisateur 
+        
+                
+                    Hardware 
+                    
+                      Board : 
+                      
+                         Architecture : 
+                      
+                         
+                     
+                 
+              
+          
+            binutils 
+            
+                display boxes : enable 
+             
+           
+         
+          
+            Utilisateur 
+            
+                Liste des utilisateurs
+                
+                  List des utilisateurs 
+                  
+                    
+                      Utilisateur 
+                      Nom Real 
+                      Email 
+                      Groupe 
+                     
+                   
+                  
+                    
+                      
+                        Effacer 
+                        Clean 
+                        
+                        Début 
+                        << 
+                        >> 
+                        Fin 
+                       
+                     
+                   
+                    
+                      
+                        Search 
+                         
+                      
+                        
+                           
+                        add   
+                      
+                          
+                        d1 
+                        d1 
+                        d1 
+                        d5 
+                       
+                      
+                        2 
+                        rm 
+                        2 
+                        2 
+                      
+                     
+                   
+                
+                End Table
+             
+           
+           
+         
+              
+                
+          
+		  Groupes 
+        
+          
+            Distribution 
+            
+                
+			    Nom: 
+          
+             
+          Version: 
+			    
+            
+              Board: 
+              
+             
+           
+		  
+        
+      
+            
+                    Catégories 
+                
+                    Base 
+                    
+                    Core 
+                     
+                    
+                    Shell 
+                     
+                    
+                    Kernel 
+                     
+                 
+                
+                    Librarie 
+                 
+              
+                
+             
+        
+        
+          
+           
+        
+       
+        
+
+     
+
+           
+           
+
+          
+          
+            Menu 
+            
+              Gestion des Menus
 
+              
+                Les Menus 
+                
+                  
+                    
+                      
+                        ID 
+                        Name 
+                        Lien 
+                        Langue 
+                        Direction 
+                        Style 
+                         
+                      
+                        
+                      
+                         
+                         
+                        
+                      
+                         
+                         
+                        Ajouter  
+                     
+                    
+                      
+                         
+                     
+                    
+                      1 HMenu /fr/accueil.html fr HORIZONTAL 
+                        menu1 
+                        Upd Del  
+                  
+                 
+               
+
+           
+         
+        
+            Style 
+            
+                Test Table Stuff
+                
+                    Titre du tableau 
+                    
+                        r1 r2  
+                    
+                        Un test pour voir d1 Un bouton add 
+                        Un test pour voir d1 Un bouton rm 
+                         
+                
+                End Table
+             
+         
+          
+      
+        Pages 
+        
+          Find existing pages or create new once.
+          
+            Pages 
+            
+              
+              
+                Titre du tableau 
+                
+                  Title Type Status  
+                
+                  
+                     
+                 
+                
+                      accueil d2 Un bouton add 
+                      Un test pour voir d1 Un bouton rm 
+                       
+              
+              
+              Search 
+             
+           
+          
+            Add Page 
+            
+              
+             
+           
+           
+         
+       
+     
+    
+   
+ 
diff --git a/app/basic.php b/app/basic.php
new file mode 100644
index 0000000..0b34a2e
--- /dev/null
+++ b/app/basic.php
@@ -0,0 +1,222 @@
+xp = new XsltProcessor();
+       $xsl = new DomDocument;
+       $xsl->load('xsl/gui.xsl');
+       $this->xp->importStylesheet($xsl);
+       $params['site']= "_xgui";
+       //$params["langue"] = "fr";
+       if ($this->lang == "en_US.UTF-8"  ) {
+               $params["lang"] = "en";
+       } else {
+               $params["lang"] = "fr";
+       }
+       $params["mode"] = 'standalone';
+       $params["alias"] = $this->alias;
+       $this->xp->setParameter($namespace,$params);
+       $this->check_access();
+    }
+    /*
+     * @brief compute complete 
+     * html output based on xsl and xml
+     */
+    function showXML ($file)  {
+       $xml = new DomDocument();
+       $xml->load($file);
+       if ($html = $this->xp->transformToXML($xml) ) {
+           echo $html;
+       } else {
+           echo "Failed Transform XML\n";
+       }
+    }
+    /*
+     * @brief compute embedded 
+     * html output based on xsl and xml.
+     * unlike complete page, only the content
+     * is computed. header and footer are left
+     * to php script
+     */
+    function showEmbeddedXML ($file)  {
+       $namespace= "";
+       $xml = new DomDocument();
+       $xml->load($file);
+       $params["mode"] = 'embedded';
+       $this->xp->setParameter($namespace,$params);   
+       if ($html = $this->xp->transformToXML($xml) ) {
+           echo $html;
+       } else {
+           echo "Failed Transform XML\n";
+       }
+    }
+
+    /**
+     *
+     */
+    function compta($form)
+    {
+	switch ($form)
+	{
+	case "pcmn":
+		$this->file = "compta/pcmn.xml";
+	       break;
+	case "syndic":
+		$this->file = "compta/ledger_syndic.xml";
+	       break;
+	case "eglise":
+		$this->file = "compta/ledger_church.xml";
+	       break;
+	case "idx":
+		$this->file = "compta/index.xml";
+	       break;
+	case "jrnx":
+		$this->file ="compta/journaux.xml";
+	       break;
+	default:
+		$this->file = "compta/index.xml";
+	}
+    }
+    function admin($form)
+    {
+	switch ($form)
+	{
+	case "user":
+		$this->file = "admin/view/index.fr_FR.UTF-8.xml";
+	       break;
+	default:
+		$this->file = "compta/index.xml";
+	}
+    }
+    /**
+     *
+     */
+    function distro($form)
+    {
+	switch ($form)
+	{
+	case "prod":
+		$this->showXML("distro/view/pcmn.xml");
+	       break;
+	case "distribution":
+		$this->showXML("distro/view/.xml");
+	       break;
+	case "tc":
+		$this->showXML("distro/view/tc.xml");
+	       break;
+	default:
+		$this->file = "distro/view/index.fr_FR.UTF8.xml";
+	}
+    }
+
+    function xsd2cpp($form) 
+    {
+	$this->file= "xsd2cpp/view/main.fr_FR.UTF8.xml";
+    }
+    #    function generate_links() {
+        #   }
+        
+    function showHTML() {
+       echo "PHP Applications "; 
+       $arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
+
+       echo <<Applications
+       
+END;
+
+     }
+    
+    function main() {
+	if ($this->file == "") {
+		$this->showHTML();
+	} else {
+		$this->showEmbeddedXML($this->file);
+	}
+    }    
+    
+}
+/**
+if (!defined($page) ) {
+} else {
+    echo "Page already defined \n";
+    }
+*/
+$page = new Basic();
+if (isset($page) ) {
+        if (isset($_GET['form']) &&  isset($_GET['app'])) {
+            $form = $_GET['form'];
+            switch($_GET['app']) {
+                case 'compta':
+                $page->compta($_GET["form"]);
+                    $page->show();
+                break;
+                case 'distro':
+                $page->distro($_GET["app"]);
+                    $page->show();
+                break;
+                case 'xsd2cpp':
+                $page->xsd2cpp($_GET["app"]);
+                    $page->show();
+                break;
+                case 'admin':
+                $page->admin($_GET["app"]);
+                    $page->show();
+                break;
+                default:
+                $page->showXML('index.xml');
+
+            } 
+        } elseif (isset($_GET['app']) && isset($_GET['panel'])) {
+            $app = $_GET['app'];
+            $panel = $_GET['panel'];
+            if (isset($frame[$app][$panel])) {
+		    	$page->showEmbeddedXML($frame[$app][$panel]);
+            } else 
+		    	$page->showXML('index.xml');
+        } else {
+            $page->show();
+        }  
+} else {
+    echo "Page not set !!!! ";
+}
+?>
diff --git a/app/common.php b/app/common.php
new file mode 100644
index 0000000..9bcbd2d
--- /dev/null
+++ b/app/common.php
@@ -0,0 +1,138 @@
+$value)
+        {
+            if (isset($GLOBALS[$key]))
+                unset($GLOBALS[$key]);
+        }
+}
+/**
+ * $Id: common.php,v 1.11 2010/08/25 16:15:24 aebersol Exp $
+ *
+ * I do not know how things will work out. But session must be managed
+ *
+ */
+if (!defined('SYNDIC_DOMAIN'))      define('SYNDIC_DOMAIN','syndic.ebersold.fr');
+if (!defined('WEB_ADMIN'))          define('WEB_ADMIN','andre.ebersold@free.fr');
+
+/* Every thing related to FEEBF can be erased. It's over */
+if (!defined('FEEBF_SECRETARIAT'))  define('FEEBF_SECRETARIAT','Secretariat');
+
+/* For Accounting application */
+if (!defined('COMPTA_SYNDIC')) define('COMPTA_SYNDIC','Syndic');
+if (!defined('COMPTA_COPRO')) define('COMPTA_COPRO','Coproprietaire');
+
+/**
+ * config entry contants
+ */
+if (!defined('SQL_USER'))   define('SQL_USER','user');
+if (!defined('SQL_SERVER')) define('SQL_SERVER','host');
+if (!defined('SQL_PASSWD')) define('SQL_PASSWD','password');
+if (!defined('SQL_DB'))     define('SQL_DB','database');
+
+define ('AEB_DEBUG',false);
+define ('AEB_DEBUG_DISPLAY',false);
+define ('AEB_DEBUG_LEVEL','INFO');
+
+class AEB 
+{
+	/**
+	 * The installation path for my apps on the server (e.g. /var/www/syndic)
+	 */
+    public static $SERVERROOT = '';
+
+    public static  $REQUEST    = null;
+
+    public static function getDataDir()
+    {
+        global $conf;
+        return $conf['datadir'];
+    }
+    /**
+     * @brief initialize session
+     */
+    private static function initSession()
+    {
+        if (isset($_SESSION['last_location'])) {
+          $last_location= $_SESSION['last_location'];
+        }
+      
+        if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { 
+             $_SESSION['last_location']  = "https://".AEB::$REQUEST->getServerHost().$_SERVER['REQUEST_URI'];
+         } else {
+             $_SESSION['last_location']  = "http://".AEB::$REQUEST->getServerHost().$_SERVER['REQUEST_URI'];
+         }
+    }
+
+    /**
+     * @brief initialize global $action variable.
+     * @todo: Verify if global login is used somewhere or else remove
+     */
+    private static function initAction()
+    {
+        if (isset($_GET['action']) && $_GET['action'] == "LOGOUT") {
+            #   echo "unset login\n";
+           unset($_SESSION['login']);
+           session_unset();
+           session_destroy();
+        }
+        if (isset($_POST['action'])) {
+           $action=$_POST['action'];
+        }
+        if (isset($_GET['action'])) {
+           $action=$_GET['action'];
+        }
+
+        if (isset($_SESSION['login']) ) {
+            global $login;
+            $login=$_SESSION['login'];
+        }
+    }
+
+    /**
+     * @brief Include required configs 
+     */
+    private static function initConfig()
+    {
+        if(file_exists(dirname(__FILE__)."/config/mysql.conf.php"))
+        {
+            require_once(dirname(__FILE__)."/config/mysql.conf.php");
+        }
+        /**
+         * @brief config contains the main class AppPage for all
+         * apps. Now I'm not sure anymore if it's the right place.
+         * It's like a base presentation framwork
+         */
+        require_once(dirname(__FILE__)."/config/config.php");
+
+    }
+    /**
+     * @brief main entry point 
+     */
+    public static function init()
+    {
+        $_p = Array();
+        parse_str($_SERVER['QUERY_STRING'],$_p);
+        AEB::$REQUEST = new Request(
+            Array('urlParams' => $_p
+                  ,'post' => $_POST
+                  ,'get'  => $_GET) );
+
+        AEB::initSession();
+        
+        AEB::initAction();
+
+        AEB::initConfig();
+    }
+}
+
+AEB::init();
+?>
diff --git a/app/compta/Accounting.mysql.keep b/app/compta/Accounting.mysql.keep
new file mode 100644
index 0000000..cbc72ea
--- /dev/null
+++ b/app/compta/Accounting.mysql.keep
@@ -0,0 +1,2414 @@
+-- set @@binlog_format=mixed;
+-- 
+-- Account information stuff
+--
+DROP TABLE IF EXISTS AccountInfo;
+
+DROP TABLE IF EXISTS Account;
+CREATE TABLE IF NOT EXISTS Account (
+  acc_id	VARCHAR(32) PRIMARY KEY,
+  acc_info_id	INTEGER,
+  acc_name      VARCHAR(64) COLLATE utf8_general_ci,
+  acc_desc      VARCHAR(255),
+  acc_balance	REAL, -- Could be computed dynamically
+  INDEX USING BTREE(acc_id)
+) CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+--
+-- Budget tables. Not sur I I did it right.
+--
+
+DROP TABLE IF EXISTS Budget;
+CREATE TABLe IF NOT EXISTS Budget (
+    bu_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+    bu_period_id    INTEGER,
+    bu_desc         VARCHAR(64) DEFAULT ""
+);
+
+DROP TABLE IF EXISTS BudgetEntry;
+
+CREATE TABLE IF NOT EXISTS BudgetEntry (
+  buet_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+  buet_budget_id    INTEGER,
+  buet_acc_id       VARCHAR(32),
+  buet_amount      DOUBLE DEFAULT 0.0,
+  buet_debit_credit ENUM('d','c') DEFAULT 'c',
+  buet_pc_id        INTEGER DEFAULT 1
+);
+--
+--
+-- Transaction stuff
+--
+DROP TABLE IF EXISTS Transactions;
+CREATE TABLE IF NOT EXISTS Transactions (
+  trans_id		INTEGER AUTO_INCREMENT PRIMARY KEY,
+  voucher_ref		VARCHAR(255),
+  voucher_date		DATE,
+  act_trans_date	DATE,
+  trans_label  		VARCHAR(255),
+  trans_file		VARCHAR(255)
+);
+
+DROP TABLE  IF EXISTS Period;
+CREATE TABLE IF NOT EXISTS Period (
+  per_id		INTEGER AUTO_INCREMENT PRIMARY KEY,
+  per_begin		DATE,
+  per_end		DATE,
+  per_string		VARCHAR(32) -- Example Q1_2012
+);
+
+DROP TABLE IF EXISTS       TransactionEntry;
+CREATE TABLE IF NOT EXISTS TransactionEntry (
+  trans_entry_id 	INTEGER AUTO_INCREMENT PRIMARY KEY,
+  trans_id		INTEGER,
+  entry_date		DATE,
+  entry_type		VARCHAR(2),
+  acc_id		VARCHAR(32),
+  orig_amount		REAL,
+  amount		DOUBLE PRECISION,
+  debit_credit  	enum  ('d','c'),
+  description   	VARCHAR(255),
+  voucher_ref   	VARCHAR(255),
+  tret_key_id		INTEGER DEFAULT 0 -- Cle de charge pour le decompte de charge
+);
+
+-- Example Journal debit
+DROP TABLE IF EXISTS       TransactionEntryType;
+CREATE TABLE IF NOT EXISTS TransactionEntryType (
+  type_id 	INTEGER AUTO_INCREMENT PRIMARY KEY,
+  type_code VARCHAR(2), -- BQ, VT, OD 
+  type_desc	VARCHAR(255)
+);
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('BQ','Banque');
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('VT','Ventes');
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('HA','Achats et frais');
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('OD','Operation divers');
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('AF','Appels de fonds');
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('RF','Remboursement appels de fonds');
+INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('AN','Report a nouveau');
+
+DROP TABLE IF EXISTS       Identity;
+CREATE TABLE IF NOT EXISTS Identity (
+  ident_id		INTEGER AUTO_INCREMENT PRIMARY KEY,
+  ident_type		INTEGER DEFAULT 2,
+  ident_name 		VARCHAR(32),
+  ident_firstname	VARCHAR(32),
+  ident_address		VARCHAR(64),
+  ident_postalcode	VARCHAR(16),
+  ident_city		VARCHAR(32),
+  ident_country		VARCHAR(32),
+  ident_mobile		VARCHAR(32),
+  ident_phone		VARCHAR(32),
+  ident_email1		VARCHAR(32),
+  ident_email2		VARCHAR(32)
+);
+
+DROP TABLE IF EXISTS       JoinIdentityAccount;
+CREATE TABLE IF NOT EXISTS JoinIdentityAccount (
+  jia_id    INTEGER AUTO_INCREMENT PRIMARY KEY,
+  jia_ident INTEGER,
+  jia_acc   INTEGER
+);
+
+DROP TABLE IF EXISTS IdentityType;
+
+CREATE TABLE IF NOT EXISTS IdentityType (
+  idtp_id	INTEGER AUTO_INCREMENT PRIMARY KEY,
+  idtp_name	VARCHAR(32)
+);
+INSERT INTO IdentityType (idtp_id,idtp_name) VALUES( 1,"Fournisseur");
+INSERT INTO IdentityType (idtp_id,idtp_name) VALUES( 2,"Coproprietaire");
+INSERT INTO IdentityType (idtp_id,idtp_name) VALUES( 3,"Batiment");
+INSERT INTO IdentityType (idtp_id,idtp_name) VALUES( 4,"Organisation");
+
+CREATE OR REPLACE  VIEW  OldOwners AS select * 
+       FROM Identity as i
+       JOIN IdentityType as it on (i.ident_type = it.idtp_id )
+       WHERE it.idtp_name = "Coproprietaire"
+;
+
+CREATE OR REPLACE VIEW Owners AS SELECT ident_id,ident_name,ident_firstname, ident_address, ident_postalcode,
+       ident_city,ident_country,ident_mobile,ident_phone,ident_email1,
+       ident_email2, ir.idr_name FROM users.Users as u
+                 JOIN users.UserRoles as ur on ur.ur_user_id = u.ident_id
+                 JOIN users.IdentityRole as ir on ur.ur_role_id =ir.idr_id
+                 WHERE ur.ur_org_id = 11 and ir.idr_name = "Coproprietaire";
+
+CREATE OR REPLACE VIEW  OldSuppliers AS select * 
+       FROM Identity as i
+       JOIN IdentityType as it on i.ident_type = it.idtp_id 
+       WHERE it.idtp_name = "Fournisseur"
+;
+
+CREATE OR REPLACE VIEW Suppliers AS select ident_id,ident_name,ident_firstname,ident_address,
+      ident_postalcode,ident_city,ident_country,ident_mobile,ident_phone,
+      ident_email1,ident_email2 FROM users.Identity as i
+                     JOIN users.IdentityType as it on (i.ident_type = it.idtp_id)
+                     JOIN users.UserRoles as ur on (ur.ur_user_id = i.ident_id)
+                     JOIN users.IdentityRole as ir on (ir.idr_id = ur.ur_role_id )
+                     WHERE ur.ur_org_id = 11 and ir.idr_name ="Fournisseur";
+
+
+-- Building stuff
+DROP TABLE IF EXISTS Lot;
+
+CREATE TABLE IF NOT EXISTS Lot (
+  lot_id 	    INTEGER AUTO_INCREMENT PRIMARY KEY,
+  lot_num 	    INTEGER UNIQUE,
+  lot_floor     VARCHAR(32) DEFAULT "RDC",
+  lot_area      INTEGER DEFAULT 0,
+  lot_room      INTEGER DEFAULT 0,
+  lot_name 	    VARCHAR(32),
+  lot_type      VARCHAR(32),
+  lot_building  VARCHAR(32),
+  lot_door      VARCHAR(32),
+  lot_description   VARCHAR(256)
+);
+
+DROP TABLE IF EXISTS PosteCharge;
+CREATE TABLE IF NOT EXISTS PosteCharge (
+  pc_id    INTEGER AUTO_INCREMENT PRIMARY KEY,
+  pc_sz    INTEGER DEFAULT 0,
+  pc_name  VARCHAR(64),
+  pc_comment   VARCHAR(256)
+);
+
+INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC1","Charges Générales");
+INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC2","Charges Exceptionnelles");
+INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC3","Non Utilise");
+INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC4","Charges Chauffage");
+INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("EAU","Charges Eau");
+
+DROP TABLE IF EXISTS Tantieme;
+CREATE TABLE IF NOT EXISTS Tantieme (
+  tant_id INTEGER  AUTO_INCREMENT PRIMARY KEY,
+  tant_pc_id     INTEGER,
+  tant_lot_num    INTEGER,
+  tant_lot_size  REAL
+);
+
+-- PC1 
+
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,1,319);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,2,319);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,3,119);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,4,4);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,5,112);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,6,43);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,7,35);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,102,32);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (1,103,17);
+
+
+-- PC2 
+
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,1,335);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,2,335);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,3,125);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,4,5);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,5,118);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,6,45);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,7,37);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,102,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (2,103,0);
+
+-- PC4 
+
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,1,339);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,2,339);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,3,156);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,4,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,5,151);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,6,9);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,7,6);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,102,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (4,103,0);
+
+-- EAU 
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,1,3/9*1000);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,2,3/9*1000);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,3,2/9*1000);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,4,1/9*1000);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,5,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,6,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,7,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,102,0);
+INSERT INTO Tantieme (tant_pc_id,tant_lot_num,tant_lot_size) VALUES (5,103,0);
+
+--
+-- A Lot is necessarely assign to an Owner
+--
+DROP TABLE IF EXISTS LotsOwners;
+CREATE TABLE LotsOwners (
+  lo_id 	INTEGER AUTO_INCREMENT PRIMARY KEY,
+  lo_owner_id 	INTEGER,
+  lo_lot_id 	INTEGER
+);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 3,1);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 2,2);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 1,3);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 4,4);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 4,5);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 2,6);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 3,7);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 4,8);
+INSERT INTO LotsOwners (lo_owner_id,lo_lot_id) VALUES( 3,9);
+
+--
+--  Carnet d'entretien
+--
+
+DROP TABLE IF EXISTS Entretien;
+CREATE TABLE Entretien (
+  entr_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+  entr_date         DATE,
+  entr_title        VARCHAR(64),
+  entr_description  TEXT
+);
+
+
+INSERT INTO Entretien (entr_date,entr_title,entr_description) VALUES
+           ("2012-07-08","Chagement eclairage entree","Afin d'assurer l'eclairage de l'allee de l'entree. Un eclairage a ete installe au coin du batiment. Le projecteur noir a egalement ete remplace par la meme occasion.");
+INSERT INTO Entretien (entr_date,entr_title,entr_description) VALUES
+           ("2013-01-08","Chagement lampe local chauffage","Lors du passage de Savelys pour l'entretien de la chaudiere, on s'est apercu qu'il n'y avait plus d'eclairage. L'ampoule a ete remplacee.");
+
+
+--
+--
+--
+
+DROP VIEW IF EXISTS  view_pc1;
+
+DROP VIEW IF EXISTS  view_pc2;
+
+DROP VIEW IF EXISTS  view_pc4;
+
+DROP VIEW IF EXISTS  view_eau;
+
+DROP VIEW IF EXISTS  view_avance;
+
+DROP VIEW IF EXISTS  view_paye;
+
+DROP VIEW IF EXISTS  view_facture;
+
+delimiter //
+
+DROP TRIGGER IF EXISTS insert_view_avance//
+
+DROP PROCEDURE IF EXISTS insert_view_avance//
+CREATE PROCEDURE insert_view_avance(IN tid INTEGER,
+                 IN ed DATE,
+                 IN bqaid VARCHAR(32),
+                 IN aid VARCHAR(32),
+                 IN am REAL, 
+		IN des VARCHAR(256))
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES 
+     (tid,ed,"BQ",aid,am,'c',des);
+  INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES 
+     (tid,ed,"BQ",bqaid,am,'d',des);
+END//
+
+DROP PROCEDURE IF EXISTS insert_avance//
+CREATE PROCEDURE insert_avance(
+                 IN ed DATE,
+                 IN vouch VARCHAR(32),
+                 IN bqaid VARCHAR(32),
+                 IN aid VARCHAR(32),
+                 IN am REAL, 
+		IN des VARCHAR(256))
+BEGIN
+  INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                          ( ed,ed,vouch,des);
+  SET @last_id = LAST_INSERT_ID();
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,entry_type,acc_id,amount,debit_credit,description) VALUES 
+     (@last_id,ed,vouch,"BQ",aid,am,'c',des);
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,entry_type,acc_id,amount,debit_credit,description) VALUES 
+     (@last_id,ed,vouch,"BQ",bqaid,am,'d',des);
+END//
+
+
+DROP PROCEDURE IF EXISTS insert_view_pc1//
+
+CREATE PROCEDURE insert_view_pc1 (IN tid INTEGER,IN ed DATE,IN vouch VARCHAR(32),
+        IN chaci INTEGER,
+        IN aci INTEGER,
+	IN am REAL,IN des VARCHAR(256))
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450001",am*119.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450002",am*362.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450003",am*371.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450004",am*148.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,chaci,am,'c',des);
+--  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+--   (tid,ed,vouch,'701000',am,'c',des);
+END//
+
+DROP PROCEDURE IF EXISTS insert_view_pc2//
+CREATE PROCEDURE insert_view_pc2 (IN tid INTEGER,IN ed DATE,IN vouch VARCHAR(32),
+                 IN chaci INTEGER,
+                 IN aci INTEGER,
+                 IN am REAL,IN des VARCHAR(256))
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450001",am*125.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450002",am*380.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450003",am*372.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450004",am*123.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,chaci,am,'c',des);
+--  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+--   (tid,ed,vouch,'701000',am,'c',des);
+END//
+
+
+DROP PROCEDURE IF EXISTS insert_view_pc4//
+CREATE PROCEDURE insert_view_pc4 (IN tid INTEGER,IN ed DATE,IN vouch VARCHAR(32),
+           IN chaci INTEGER,
+           IN aci INTEGER,
+           IN am REAL,IN des VARCHAR(256))
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450001",am*156.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450002",am*348.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450003",am*345.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,"450004",am*151.0/1000.0,'d',des);
+  INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+   (tid,"OD",ed,vouch,chaci,am,'c',des);
+--  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+--   (tid,ed,vouch,'701000',am,'c',des);
+END//
+
+DROP PROCEDURE IF EXISTS insert_view_eau//
+
+
+DROP PROCEDURE IF EXISTS insert_view_facture//
+
+CREATE PROCEDURE insert_view_facture(IN tid INTEGER,IN ed DATE,IN vouch VARCHAR(32),IN chaci INTEGER ,IN aci INTEGER,IN am REAL,IN des VARCHAR(256))
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES
+     (tid,ed,vouch,chaci,am,'d',des,'HA'); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (tid,ed,vouch,aci,am,'c',des,'HA'); 
+END//
+
+DROP PROCEDURE IF EXISTS insert_facture//
+
+CREATE PROCEDURE insert_facture(IN tid INTEGER,
+                                IN ed DATE,
+                                IN vouch VARCHAR(32),
+                                IN chaci INTEGER ,
+                                IN aci INTEGER,
+                                IN am REAL,
+                                IN des VARCHAR(256),
+                                IN key_id INTEGER
+                               )
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES
+     (tid,ed,vouch,chaci,am,'d',des,'HA',key_id); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES 
+     (tid,ed,vouch,aci,am,'c',des,'HA',key_id); 
+END//
+
+DROP PROCEDURE IF EXISTS insert_trans_facture//
+
+CREATE PROCEDURE insert_trans_facture(IN er_date DATE,
+                                IN ed DATE,
+                                IN vouch VARCHAR(32),
+                                IN chaci INTEGER ,
+                                IN aci INTEGER,
+                                IN am REAL,
+                                IN des VARCHAR(256),
+                                IN key_id INTEGER
+                               )
+BEGIN
+   INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         (ed,er_date,vouch,des);
+  SET @last_id = LAST_INSERT_ID();
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES
+     (@last_id,ed,vouch,chaci,am,'d',des,'HA',key_id); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES 
+     (@last_id,ed,vouch,aci,am,'c',des,'HA',key_id); 
+END//
+
+
+
+DROP PROCEDURE IF EXISTS insert_view_paye//
+CREATE PROCEDURE insert_view_paye(IN tid INTEGER,IN ed DATE,IN vouch VARCHAR(32),
+                 IN bqaci INTEGER ,
+                 IN aci INTEGER,IN am REAL,IN des VARCHAR(256))
+BEGIN
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (tid,ed,vouch,bqaci,am,'c',des,'BQ'); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (tid,ed,vouch,aci,am,'d',des,'BQ'); 
+END//
+
+DROP PROCEDURE IF EXISTS insert_trans_paye//
+CREATE PROCEDURE insert_trans_paye(IN tid DATE,IN ed DATE,IN vouch VARCHAR(32),
+                 IN bqaci INTEGER ,
+                 IN aci INTEGER,IN am REAL,IN des VARCHAR(256))
+BEGIN
+   INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         (ed,tid,vouch,des);
+  SET @last_id = LAST_INSERT_ID();
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,vouch,bqaci,am,'c',des,'BQ'); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,vouch,aci,am,'d',des,'BQ'); 
+END//
+
+DROP PROCEDURE IF EXISTS appel_fonds//
+CREATE PROCEDURE appel_fonds(
+                 IN ed DATE,
+                 IN copro_aid INTEGER ,
+                 IN prod_aid INTEGER,
+                 IN am REAL,
+                 IN des VARCHAR(256))
+BEGIN
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         (ed,ed,"",des);
+SET @last_id = LAST_INSERT_ID();
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,"",prod_aid,am,'c',des,'AF'); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,"",copro_aid,am,'d',des,'AF'); 
+END//
+
+--
+-- 
+--
+
+DROP PROCEDURE IF EXISTS rembourse_appel_fonds//
+CREATE PROCEDURE rembourse_appel_fonds(
+                 IN ed DATE,
+                 IN period  VARCHAR(32),
+                 IN prod_aid INTEGER,
+                 IN des VARCHAR(256))
+BEGIN
+--  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+--     (@last_id,ed,"",prod_aid,am,'d',des,'AF'); 
+--  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+--     (@last_id,ed,"",corpo_aid,am,'c',des,'AF'); 
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE am DOUBLE;
+    -- DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantieme(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE cur1 CURSOR FOR SELECT acc_id,sum(amount) as am  FROM TransactionEntry as te  
+        JOIN  Period as p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string =period	
+                        where entry_type = "AF" and acc_id like '450%' GROUP BY acc_id;
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+    
+    INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         (ed,ed,"",des);
+    SET @last_id = LAST_INSERT_ID();
+
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, am;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF am > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"RF",ed,"",prod_aid,am,'d',des);
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"RF",ed,"",a,am,'c',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END//
+
+
+
+DROP PROCEDURE IF EXISTS detail_compte//
+CREATE PROCEDURE detail_compte(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+--  select "Compte" ;
+  select entry_date as Date , 
+       voucher_ref as Ref,
+       description , 
+       CASE WHEN debit_credit='d' THEN ROUND(amount,2) ELSE 0 END as Debit, 
+       CASE WHEN debit_credit='c' THEN ROUND(amount,2) ELSE 0 END as Credit 
+         from TransactionEntry as t
+        join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date;
+
+select "" , "","Total ", 
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END	 as Solde
+       	from TransactionEntry as t
+        join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date;
+
+END//
+
+DROP PROCEDURE IF EXISTS detail_compte_sans_solde//
+CREATE PROCEDURE detail_compte_sans_solde(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+--  select "Compte" ;
+  select entry_date as Date , 
+       voucher_ref as Ref,
+       description , 
+       CASE WHEN debit_credit='d' THEN ROUND(amount,2) ELSE 0 END as Debit, 
+       CASE WHEN debit_credit='c' THEN ROUND(amount,2) ELSE 0 END as Credit 
+         from TransactionEntry as t
+        join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date;
+END//
+
+DROP PROCEDURE IF EXISTS solde_compte//
+CREATE PROCEDURE solde_compte(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+
+select  
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END	 as Solde
+       	from TransactionEntry as t
+        join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date;
+
+END//
+
+DROP PROCEDURE IF EXISTS solde_compte_where//
+CREATE PROCEDURE solde_compte_where(IN period VARCHAR(32),  IN crit VARCHAR(128))
+BEGIN
+  SET @Stm = CONCAT("
+select  
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2),0) as Debit, 
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+           COALESCE(
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0)
+             ELSE
+             COALESCE(
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) , 0)
+        END	 as Solde
+        
+       	from TransactionEntry as t
+        join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string = '",period,"'	
+	 WHERE ", crit," ORDER BY entry_date;");
+     PREPARE q FROM @Stm;
+     EXECUTE q;
+     DEALLOCATE PREPARE q;
+
+END//
+
+
+DROP PROCEDURE IF EXISTS bilan//
+CREATE PROCEDURE bilan(IN period VARCHAR(32) )
+BEGIN
+select j.acc_id as Compte ,j.acc_name as Description
+                        ,ROUND(sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2) as Debit ,
+                        ROUND(sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)  as Credit ,
+                      CASE 
+		WHEN sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) > 0 THEN	
+		 	ROUND( sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)
+		ELSE
+		 	ROUND( sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2)
+		END	
+		      	as Solde
+from  Account as j 
+  JOIN TransactionEntry AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on r.entry_date > p.per_begin and r.entry_date < p.per_end and p.per_string = period
+GROUP BY j.acc_id ;
+END//
+
+DROP PROCEDURE IF EXISTS journal//
+CREATE PROCEDURE journal(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER )
+BEGIN
+select j.entry_date as Date, j.acc_id as Compte  , j.voucher_ref as Ref ,j.description as Libelle
+                        ,ROUND((CASE WHEN j.debit_credit ='d' THEN j.amount ELSE 0 END), preci) as Debit ,
+                        ROUND((CASE WHEN j.debit_credit ='c' THEN j.amount ELSE 0 END), preci)  as Credit 
+from  TransactionEntry as j 
+  JOIN Account AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on j.entry_date > p.per_begin and j.entry_date < p.per_end and p.per_string = period
+  WHERE j.entry_type = jrn
+;
+-- GROUP BY j.acc_id ;
+END//
+
+DROP PROCEDURE IF EXISTS journal_solde//
+CREATE PROCEDURE journal_solde(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER )
+BEGIN
+select ROUND(sum(CASE WHEN j.debit_credit ='d' THEN j.amount ELSE 0 END), preci) as Debit ,
+                        ROUND(sum(CASE WHEN j.debit_credit ='c' THEN j.amount ELSE 0 END), preci)  as Credit 
+from  TransactionEntry as j 
+  JOIN Account AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on j.entry_date > p.per_begin and j.entry_date < p.per_end and p.per_string = period
+  WHERE j.entry_type = jrn
+;
+-- GROUP BY j.acc_id ;
+END//
+
+DROP PROCEDURE IF EXISTS tantieme//
+
+CREATE PROCEDURE tantieme(IN owner_id INTEGER,
+                          IN charge_id INTEGER,
+                          IN preci INTEGER)
+BEGIN
+select  ROUND(sum(tant_lot_size) ,preci) as Tant FROM Tantieme  as t
+                                 JOIN LotsOwners as lo 
+                                 JOIN Lot as l on ( lo.lo_lot_id = l.lot_id and  l.lot_num = t.tant_lot_num)
+                                 WHERE lo_owner_id = owner_id and t.tant_pc_id = charge_id;
+END//
+
+DROP FUNCTION IF EXISTS FctTantieme//
+
+CREATE FUNCTION FctTantieme( acc_id VARCHAR(32),
+                             charge_key INTEGER) 
+  RETURNS DOUBLE
+  NOT DETERMINISTIC
+  READS SQL DATA
+BEGIN
+ DECLARE select_var DOUBLE;
+ SET select_var =(SELECT sum(tant_lot_size) FROM Tantieme as tant
+         JOIN Lot        as l  on l.lot_num = tant.tant_lot_num
+         JOIN LotsOwners as lo on lo.lo_lot_id = l.lot_id
+         JOIN Account    as a  on a.acc_id = acc_id
+         JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id and jia_ident = lo.lo_owner_id
+      WHERE tant_pc_id =charge_key); 
+      IF (select_var IS NULL) THEN
+        RETURN 0.0 ;
+      ELSE 
+        RETURN select_var ;
+      END IF;
+END//
+
+--
+-- Nouvell procedure de repartition des charges
+--
+
+DROP PROCEDURE IF EXISTS repartir_charge//
+CREATE PROCEDURE repartir_charge( IN trans_id INTEGER,
+                           IN chrg     VARCHAR(32),
+                           IN ed       DATE,
+                           IN vouch    VARCHAR(32),
+                           in am       DOUBLE,
+                           in cle      INTEGER,
+                           in des      VARCHAR(256)
+                         )
+
+BEGIN
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE tant DOUBLE;
+    DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantieme(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+    INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (trans_id,"OD",ed,vouch,chrg,am,'c',des);
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, tant;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (trans_id,"OD",ed,vouch,a,am*tant/1000.0,'d',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END//
+
+DROP PROCEDURE IF EXISTS repartir_trans_charge//
+CREATE PROCEDURE repartir_trans_charge(IN trs_dt DATE ,
+                           IN ed       DATE,
+                           IN chrg     VARCHAR(32),
+                           IN vouch    VARCHAR(32),
+                           in am       DOUBLE,
+                           in cle      INTEGER,
+                           in des      VARCHAR(256)
+                         )
+
+BEGIN
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE tant DOUBLE;
+    DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantieme(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+    INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( ed,trs_dt,vouch,des);
+    SET @last_id = LAST_INSERT_ID();
+    INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'c',des);
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, tant;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant/1000.0,'d',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END//
+
+DROP PROCEDURE IF EXISTS appel_fonds_sur_facture//
+CREATE PROCEDURE appel_fonds_sur_facture(IN trs_dt DATE ,
+                           IN ed       DATE,
+                           IN chrg     VARCHAR(32),
+                           IN vouch    VARCHAR(32),
+                           in am       DOUBLE,
+                           in cle      INTEGER,
+                           in des      VARCHAR(256)
+                         )
+
+BEGIN
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE tant DOUBLE;
+    DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantieme(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+    INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( ed,trs_dt,vouch,des);
+    SET @last_id = LAST_INSERT_ID();
+    INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"AF",ed,vouch,chrg,am,'c',des);
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, tant;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"AF",ed,vouch,a,am*tant/1000.0,'d',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END//
+
+
+
+
+DROP PROCEDURE IF EXISTS detail_decompte_charge//
+
+CREATE PROCEDURE detail_decompte_charge(
+                                         IN user_id INTEGER,
+					 IN poste_charge_id INTEGER,
+                                         IN period VARCHAR(32),
+                                         IN preci INTEGER)
+BEGIN
+select  te.`entry_date` as Date,
+        te.acc_id as Compte,
+        ac.`acc_name`,
+        te.description,
+        amount  as MontantTotal,
+ ROUND((select  sum(t1.tant_lot_size) FROM Tantieme  as t1
+                                 JOIN LotsOwners as lo1 
+                                 JOIN Lot as l1 on ( lo1.lo_lot_id = l1.lot_id and  l1.`lot_num` = t1.`tant_lot_num`)
+                                 WHERE lo_owner_id = user_id and t1.tant_pc_id = te.tret_key_id) ,preci)
+
+ as Tan,
+        ROUND( (amount /1000.0 * (
+                select  sum(t.tant_lot_size) FROM Tantieme  as t
+                                 JOIN LotsOwners as lo 
+                                 JOIN Lot as l on ( lo.lo_lot_id = l.lot_id and  l.`lot_num` = t.`tant_lot_num`)
+                                 WHERE lo_owner_id = user_id and t.tant_pc_id = te.tret_key_id)) ,preci
+        )  as Montant,
+   pc.pc_name as Cle from TransactionEntry as te
+   JOIN Account as ac on (ac.acc_id = te.acc_id)
+   JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+   JOIN Period AS p on te.entry_date > p.per_begin and te.entry_date < p.per_end and p.per_string = period
+   where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+   ORDER BY te.entry_date;                        
+
+END//
+
+DROP PROCEDURE IF EXISTS detail_decompte_charge_par_lot//
+
+CREATE PROCEDURE detail_decompte_charge_par_lot(
+                                         IN user_id INTEGER,
+					 IN poste_charge_id INTEGER,
+                                         IN period VARCHAR(32),
+                                         IN preci INTEGER)
+BEGIN
+select  te.`entry_date` as Date, te.acc_id as Compte,
+        ac.`acc_name` as Intitule,
+        te.description,
+        lot.lot_name as Lot,
+        amount  as MontantTotal,
+        lot.tant_lot_size as tanti,
+        ROUND( (amount /1000.0 * lot.tant_lot_size) ,preci)  as Montant,
+
+        pc.pc_name as Cle from TransactionEntry as te
+   JOIN Account as ac on (ac.acc_id = te.acc_id)
+   JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+   JOIN (select  * FROM Tantieme  as t
+                                 JOIN LotsOwners as lo 
+                                 JOIN Lot as l on ( lo.lo_lot_id = l.lot_id and  l.`lot_num` = t.`tant_lot_num`)
+                                 WHERE lo_owner_id = user_id) as lot on (lot.tant_pc_id = te.tret_key_id)
+   
+   JOIN Period AS p on te.entry_date > p.per_begin and te.entry_date < p.per_end and p.per_string = period 
+   where    te.acc_id like '6%' and te.debit_credit  = 'd' and IF(poste_charge_id != 0, te.tret_key_id = poste_charge_id,'1')
+   ORDER BY lot.lot_name,te.entry_date,te.acc_id;                        
+
+END//
+
+DROP PROCEDURE IF EXISTS detail_decompte_solde//
+
+CREATE PROCEDURE detail_decompte_solde(
+                                         IN user_id INTEGER,
+					 IN poste_charge_id INTEGER,
+                                         IN period VARCHAR(32),
+                                         IN preci INTEGER)
+BEGIN
+
+select  
+        sum(amount)  as MontantTotal,
+        ROUND( sum((amount /1000.0 * (
+                select  sum(t.tant_lot_size) FROM Tantieme  as t
+                                 JOIN LotsOwners as lo
+                                 JOIN Lot as l on ( lo.lo_lot_id = l.lot_id and  l.`lot_num` = t.`tant_lot_num`)
+                                 WHERE lo_owner_id = user_id and t.tant_pc_id = te.tret_key_id))) ,preci
+        )  as Montant
+         from TransactionEntry as te
+   JOIN Account as ac on (ac.acc_id = te.acc_id)
+   JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+   JOIN Period AS p on te.entry_date > p.per_begin and te.entry_date < p.per_end and p.per_string = period
+   where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+   ORDER BY te.entry_date;      
+
+END//
+
+delimiter ;
+
+-- Ok, fill in data
+--
+
+INSERT INTO Identity (ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_email2,ident_phone) VALUES
+ ("CORDIER","Philippe","2 RUE DES ROSSIGNOLS","67114","ECHAU","ma.cordier@orange.fr","philippe.cordier@douane.finances.gouv.fr","");
+INSERT INTO JoinIdentityAccount (jia_ident,jia_acc) VALUE
+ (1,450001);
+INSERT INTO Identity (ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone,ident_mobile) VALUES
+ ("EBERSOLD","Andre","25 rue Pfeffinger","67100","STRASBOURG","andre.ebersold@gmail.com","0388","0670437380");
+INSERT INTO JoinIdentityAccount (jia_ident,jia_acc) VALUE
+ (2,450002);
+
+INSERT INTO Identity (ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone) VALUES
+ ("FLEURY","Annabelle","25 rue Pfeffinger","67100","STRASBOURG","fleury1@gmail.com","");
+INSERT INTO JoinIdentityAccount (jia_ident,jia_acc) VALUE
+ (3,450003);
+
+INSERT INTO Identity (ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_email2,ident_phone,ident_mobile) VALUES
+ ("Immoval","Leila Elaillaji","4 rue  de l'eglise","67000","STRASBOURG","leila.elailaji@immoval.com","info@immoval.com","0388228822","06");
+INSERT INTO JoinIdentityAccount (jia_ident,jia_acc) VALUE
+ (4,450004);
+
+-- Les Forunisseurs
+INSERT INTO Identity (ident_type,ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone,ident_mobile) VALUES
+ (1,"BOLLOREE","Energie","25 rue Pfeffinger","67100","STRASBOURG","","0388","");
+
+INSERT INTO Identity (ident_type,ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone,ident_mobile) VALUES
+ (1,"Savelys","Energie","","67100","STRASBOURG","","0388","");
+
+INSERT INTO Identity (ident_type,ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone,ident_mobile) VALUES
+ (1,"EDF","Strasbourg","","67100","STRASBOURG","","0388","");
+
+INSERT INTO Identity (ident_type,ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone,ident_mobile) VALUES
+ (1,"Eau","Strasbourg","","67000","STRASBOURG","","0388","");
+
+INSERT INTO Identity (ident_type,ident_name,ident_firstname,ident_address,ident_postalcode,ident_city,ident_email1,ident_phone,ident_mobile) VALUES
+ (1,"Eau","Strasbourg","","67000","STRASBOURG","","0388","");
+ 
+--
+-- Insert Lots
+-- 
+--  lot_floor     VARCHAR(8) DEFAULT "RDC",
+--  lot_area      INTEGER DEFAULT 0,
+--  lot_room      INTEGER DEFAULT 0,
+--  lot_name 	    VARCHAR(32),
+--  lot_type      VARCHAR(32),
+--  lot_building  VARCHAR(32),
+--  lot_door      VARCHAR(32),
+--  lot_description   VARCHAR(256)
+
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type,lot_area) VALUES
+  ("RDC",1,"Lot N1","","Appartement",97.7);
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type,lot_area) VALUES
+  ("1er Etage",2,"Lot N2","Appartement","Appartement",97.7);
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type,lot_area) VALUES
+  ("COMBLES",3,"Lot N3","","Appartement",30);
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type) VALUES
+  ("COMBLES",4,"Lot N4","","Grenier");
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type) VALUES
+  ("Sous sol",5,"Lot N5","","Appartement");
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type) VALUES
+  ("Sous sol",6,"Lot N6","","Garage");
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type) VALUES
+  ("Sous sol",7,"Lot N7","","Garage");
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type) VALUES
+  ("exterieur",102,"Lot N102","Jardinet 1","Jardinet");
+INSERT INTO Lot (lot_floor, lot_num,lot_name,lot_description,lot_type) VALUES
+  ("exterieur",103,"Lot N103","Jardinet 2","Jardinet");
+
+-- Insert periods 
+--  per_begin		DATE,
+--  per_end		DATE,
+--  per_string		VARCHAR(16) -- Example Q1_2012
+
+INSERT INTO Period (per_begin,per_end,per_string) VALUES ("2011-01-01","2011-12-31","2011");
+INSERT INTO Period (per_begin,per_end,per_string) VALUES ("2012-01-01","2012-12-31","2012");
+INSERT INTO Period (per_begin,per_end,per_string) VALUES ("2013-01-01","2013-12-31","2013");
+INSERT INTO Period (per_begin,per_end,per_string) VALUES ("2014-01-01","2014-12-31","2014");
+INSERT INTO Period (per_begin,per_end,per_string) VALUES ("2015-01-01","2015-12-31","2015");
+
+--
+-- Create the  account info and accounts
+--
+
+--
+
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("103000",103000, 0.0,"Avances","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("103100",103100, 0.0,"Avances de trésorerie","");
+
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("450000",450000, 0.0,"Collectivité des Copropriétaire","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("450001",450001, 0.0,"Cordier","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("450002",450002, 0.0,"Ebersold","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("450003",450003, 0.0,"Hentschel","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("450004",450004, 0.0,"Immoval","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("450005",450005, 0.0,"Ancien Cordier - Nouv Ebersold","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("400000",400000, 0.0,"","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401002",401002, 0.0,"BOLLORE","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401003",401003, 0.0,"VEOLIA","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401004",401004, 0.0,"SAVELYS","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401005",401005, 0.0,"EDF","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401006",401006, 0.0,"POSTE","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401007",401007, 0.0,"ASSURANCE","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401008",401008, 0.0,"RAMONAGE","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401009",401009, 0.0,"EAU","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401010",401010, 0.0,"LEROY MERLIN","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401011",401011, 0.0,"LIDL meinau","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("401012",401012, 0.0,"Mustchler Bischoff","");
+
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("461000",461000, 0.0,"Débiteur Divers","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("462000",462000, 0.0,"Crédit Divers","");
+
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("512001",512001, 0.0,"BANQUE","La Banque Postale");
+--
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("601000",601000, 0.0,"Eau","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("602000",602000, 0.0,"Eléctricité","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("603000",603000, 0.0,"Chauffage,énergie et combustible","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("604000",604000, 0.0,"Achat produits d'entretien","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("605000",605000, 0.0,"Matériel","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("606000",606000, 0.0,"Fourniture","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("611000",611000, 0.0,"Nettoyage des locaux","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("614000",614000, 0.0,"Control de maintenance","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("615000",615000, 0.0,"Entretien et petites réparations","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("616000",616000, 0.0,"Prime d'assurance","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("620000",620000, 0.0,"Frais d'administration","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("621300",621300, 0.0,"Frais postaux","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("671000",671000, 0.0,"Travaux decides par assemblée générale","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("672000",672000, 0.0,"Travaux urgents","");
+
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("700000",700000, 0.0,"Appels de fond","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("701000",701000, 0.0,"Provision sur opérations courantes","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("702000",702000, 0.0,"Provision sur travaux de l'article 14.2","");
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc) VALUES ("703000",703000, 0.0,"Avances","");
+--
+-- Transactions ....
+--
+
+
+--  trans_entry_id 	INTEGER PRIMARY KEY,
+--  trans_id		INTEGER,
+--  entry_date		DATE,
+--  entry_type		VARCHAR(32),
+--  acc_id		INTEGER,
+--  orig_amount		REAL,
+--  amount		REAL,
+--  debit_credit  	CHARACTER CONSTRAINT IN ('d','c'),
+--  description   	VARCHAR(255),
+--  voucher_ref   	VARCHAR(255)
+
+--
+-- Saisie 2011
+--
+
+-- MATMUT Jan
+
+CALL insert_trans_facture
+                          ("2011-01-02","2011-01-02","029","616000","401007",165.54,"Facture  MatMut ",1);
+CALL repartir_trans_charge("2011-01-02","2011-01-02","616000","029",165.54,1,"Repartition Charges Assurance PC1");
+
+CALL appel_fonds_sur_facture("2011-01-02","2011-01-02","701000","029",165.54,1,"Appel de fonds Charges Assurance 1er T");
+
+CALL insert_trans_paye
+                         ("2011-01-02","2011-01-03","Payement direct","512001","401007",165.54,"Payer Matmut 1er tier");
+-- SAVELYS ENTRETIEN CHAUDIER
+
+CALL insert_trans_facture
+                          ("2011-01-02","2011-01-02","5KI12135952","614000","401004",158.43,"Facture  Savelys ",4);
+CALL repartir_trans_charge("2011-01-02","2011-01-02","614000","5KI12135952",158.43,4,"Repartition Charges Savelys PC4");
+
+CALL appel_fonds_sur_facture("2011-01-02","2011-01-02","701000","5KI12135952",158.43,4,"Appel de fonds Savelys");
+
+CALL insert_trans_paye
+                         ("2011-01-02","2011-01-03","Payement direct","512001","401004",158.43,"Payer  Savelys");
+
+-- Fioul
+CALL insert_trans_facture
+                         ("2011-01-10","2011-01-10","330904","603000","401002",780,"Facture Fioul ",4);
+
+CALL repartir_trans_charge( "2011-01-10","2011-01-10","603000","330904",780,4,"Repartition Charges Fioul PC4");
+
+CALL appel_fonds_sur_facture( "2011-01-10","2011-01-10","701000","330904",780,4,"Appel de fonds Fioul 1000L");
+
+CALL insert_trans_paye
+                         ("2011-01-11","2011-01-11","Payement direct","512001","401002",780,"Payer Fioul 1000L janv");
+-- VEOLIA PROXI SERV
+
+CALL insert_trans_facture
+                          ("2011-02-01","2011-02-01","11009226","603000","401003",200.99,"Facture VEOLIA ",4);
+CALL repartir_trans_charge("2011-02-10","2011-02-10","603000","11009226",200.99,4,"Repartition Charges VEOLIA PC4")
+;
+CALL appel_fonds_sur_facture("2011-02-10","2011-02-10","701000","11009226",200.99,4,"Appel de fonds VEOLIA PC4");
+
+CALL insert_trans_paye
+                         ("2011-02-15","2011-02-15","Payement direct","512001","401003",200.99,"Payer VEOLIA fev");
+
+-- EDF
+
+CALL insert_trans_facture
+                          ("2011-02-10","2011-02-10","3438875S","602000","401005",30.63,"Facture EDF ",2);
+CALL repartir_trans_charge("2011-02-10","2011-02-10","602000","3438875S",30.63,2,"Repartition Charges EDF PC2");
+CALL appel_fonds_sur_facture("2011-02-10","2011-02-10","701000","3438875S",30.63,2,"Appel de fonds EDF PC2");
+CALL insert_trans_paye
+                         ("2011-02-15","2011-02-15","Payement direct","512001","401005",30.63,"Payer EDF fev");
+-- Fioul
+
+CALL insert_trans_facture
+                          ("2011-02-21","2011-02-21","335763","603000","401002",805.80,"Facture Fioul ",4);
+CALL repartir_trans_charge("2011-02-21","2011-02-21","603000","336763",805.80,4,"Repartition Charges Fioul PC4");
+CALL appel_fonds_sur_facture("2011-02-21","2011-02-21","701000","336763",805.80,4,"Appel de fonds Fioul PC4");
+
+CALL insert_trans_paye
+                         ("2011-02-22","2011-02-22","Payement direct","512001","401002",805.80,"Payer Fioul 1000L fev");
+
+-- EDF
+
+CALL insert_trans_facture
+                          ("2011-04-10","2011-04-08","3749680S","602000","401005",28.01,"Facture EDF ",2);
+CALL repartir_trans_charge("2011-04-10","2011-04-08","602000","3749680S",28.01,2,"Repartition Charges EDF PC2");
+CALL appel_fonds_sur_facture("2011-04-10","2011-04-08","701000","3749680S",28.01,2,"Appel de fonds EDF PC2");
+CALL insert_trans_paye
+                         ("2011-04-15","2011-04-15","Payement direct","512001","401005",28.01,"Payer EDF avril");
+
+-- EAU 
+CALL insert_trans_facture
+                          ("2011-04-21","2011-04-21","0333011301573L","601000","401009",335.37,"Facture EAU ",5);
+CALL repartir_trans_charge("2011-04-21","2011-04-21","601000","0333011301573L",335.37,5,"Repartition Charges EAU");
+CALL appel_fonds_sur_facture("2011-04-21","2011-04-21","701000","0333011301573L",335.37,5,"Appel de fonds EAU");
+CALL insert_trans_paye
+                         ("2011-04-22","2011-04-22","Payement direct","512001","401009",335.37,"Payer EAU");
+
+-- EDF Juin
+
+CALL insert_trans_facture
+                          ("2011-06-10","2011-06-08","4114080S","602000","401005",24.94,"Facture EDF ",2);
+CALL repartir_trans_charge("2011-06-10","2011-06-08","602000","4114080S",24.94,2,"Repartition Charges EDF PC2");
+CALL appel_fonds_sur_facture("2011-06-10","2011-06-08","701000","4114080S",24.94,2,"Appel de fonds EDF PC2");
+CALL insert_trans_paye
+                         ("2011-06-15","2011-06-15","Payement direct","512001","401005",24.94,"Payer EDF juin");
+
+-- MATMUT Juin
+
+CALL insert_trans_facture
+                          ("2011-06-10","2011-06-08","030","616000","401007",156.24,"Facture  MatMut ",1);
+CALL repartir_trans_charge("2011-06-10","2011-06-08","616000","030",156.24,1,"Repartition Charges Assurance PC1");
+CALL appel_fonds_sur_facture("2011-06-10","2011-06-08","701000","030",156.24,1,"Appel de fonds Assurance PC1");
+
+CALL insert_trans_paye
+                         ("2011-06-11","2011-06-11","Payement direct","512001","401007",156.24,"Payer Matmut 2ieme tier");
+
+-- Ramonage 
+CALL insert_trans_facture
+                          ("2011-07-01","2011-07-01","5810","603000","401008",35.60,"Facture Ramonage ",4);
+CALL repartir_trans_charge("2011-07-01","2011-07-01","603000","5810",35.60,4,"Repartition Charges Ramonage PC4");
+CALL appel_fonds_sur_facture("2011-07-01","2011-07-01","701000","5810",35.60,4,"Appel de fonds Ramonage PC4");
+CALL insert_trans_paye
+                          ("2011-07-02","2011-07-02","Payement direct","512001","401008",35.60,"Payer Ramonage ");
+
+-- Fioul
+
+CALL insert_trans_facture
+                          ("2011-07-21","2011-07-21","347597","603000","401002",855.00,"Facture Fioul ",4);
+CALL repartir_trans_charge("2011-07-21","2011-07-21","603000","347597",855.00,4,"Repartition Charges Fioul PC4");
+CALL appel_fonds_sur_facture("2011-07-21","2011-07-21","701000","347597",855.00,4,"Appel de fonds Fioul PC4");
+CALL insert_trans_paye
+                         ("2011-07-22","2011-07-22","Payement direct","512001","401002",855.00,"Payer Fioul 1000L juillet");
+
+-- EDF Aout 
+
+CALL insert_trans_facture
+                          ("2011-08-10","2011-08-08","4471779S","602000","401005",11.62,"Facture EDF ",2);
+CALL repartir_trans_charge("2011-08-10","2011-08-08","602000","4471779S",11.62,2,"Repartition Charges EDF PC2");
+CALL appel_fonds_sur_facture("2011-08-10","2011-08-08","701000","4471779S",11.62,2,"Appel de fonds EDF PC2");
+CALL insert_trans_paye
+                         ("2011-08-15","2011-08-15","Payement direct","512001","401005",11.62,"Payer EDF aout");
+
+-- EDF Octo 
+
+CALL insert_trans_facture
+                          ("2011-10-10","2011-10-08","4790007S","602000","401005",24.61,"Facture EDF ",2);
+CALL repartir_trans_charge("2011-10-10","2011-10-08","602000","4790007S",24.61,2,"Repartition Charges EDF PC2");
+CALL appel_fonds_sur_facture("2011-10-10","2011-10-08","701000","4790007S",24.61,2,"Appel de fonds EDF PC2");
+CALL insert_trans_paye
+                         ("2011-10-15","2011-10-15","Payement direct","512001","401005",24.61,"Payer EDF oct");
+
+-- EAU 
+CALL insert_trans_facture
+                          ("2011-11-15","2011-11-15","0333011900860Q","601000","401009",324.60,"Facture EAU ",5);
+CALL repartir_trans_charge("2011-11-15","2011-11-15","601000","0333011900860Q",324.60,5,"Repartition Charges EAU");
+CALL appel_fonds_sur_facture("2011-11-15","2011-11-15","701000","0333011900860Q",324.60,5,"Appel de fonds  EAU");
+CALL insert_trans_paye
+                         ("2011-11-22","2011-11-22","Payement direct","512001","401009",324.60,"Payer EAU");
+
+-- Fioul
+
+CALL insert_trans_facture
+                          ("2011-11-17","2011-11-17","358343","603000","401002",940.00,"Facture Fioul ",4);
+CALL repartir_trans_charge("2011-11-17","2011-11-17","603000","358343",940.00,4,"Repartition Charges Fioul PC4");
+CALL appel_fonds_sur_facture("2011-11-17","2011-11-17","701000","358343",940.00,4,"Appel de fonds Fioul PC4");
+CALL insert_trans_paye
+                         ("2011-11-22","2011-11-22","Payement direct","512001","401002",940,"Payer Fioul 1000L nov");
+
+-- EDF Dec 
+
+CALL insert_trans_facture
+                          ("2011-12-10","2011-12-09","5139892SS","602000","401005",25.98,"Facture EDF ",2);
+CALL repartir_trans_charge("2011-12-10","2011-12-09","602000","5139892S",25.98,2,"Repartition Charges EDF PC2");
+CALL appel_fonds_sur_facture("2011-12-10","2011-12-09","701000","5139892S",25.98,2,"Appel de fonds EDF PC2");
+CALL insert_trans_paye
+                         ("2011-12-15","2011-12-15","Payement direct","512001","401005",25.98,"Payer EDF dec");
+
+-- Ramonage 
+CALL insert_trans_facture
+                          ("2011-12-10","2011-12-09","6348","603000","401008",35.60,"Facture Ramonage ",4);
+CALL repartir_trans_charge("2011-12-10","2011-12-09","603000","6348",35.60,4,"Repartition Charges Ramonage PC4");
+CALL appel_fonds_sur_facture("2011-12-10","2011-12-09","701000","6348",35.60,4,"Appel de fonds Ramonage PC4");
+CALL insert_trans_paye
+                          ("2011-12-10","2011-12-10","Payement direct","512001","401008",35.60,"Payer Ramonage ");
+
+-- Fioul
+
+CALL insert_trans_facture
+                         ("2011-12-29","2011-12-29","361276","603000","401002",880.00,"Facture Fioul ",4);
+CALL repartir_trans_charge("2011-12-29","2011-12-29","603000","361276",880.00,4,"Repartition Charges Fioul PC4");
+CALL appel_fonds_sur_facture("2011-12-29","2011-12-29","701000","361276",880.00,4,"Appel de fonds Fioul PC4");
+CALL insert_trans_paye
+                         ("2011-12-30","2011-12-30","Payement direct","512001","401002",880.00,"Payer Fioul 1000L dec");
+
+CALL rembourse_appel_fonds("2011-12-30","2011","701000","Remboursement appels de fonds");
+
+--
+-- Saisie 2012
+--
+
+UPDATE Tantieme SET tant_lot_size= 2/9*1000 WHERE tant_pc_id=5 AND tant_lot_num  = 1;
+UPDATE Tantieme SET tant_lot_size= 3/9*1000 WHERE tant_pc_id=5 AND tant_lot_num  = 2;
+UPDATE Tantieme SET tant_lot_size= 2/9*1000 WHERE tant_pc_id=5 AND tant_lot_num  = 3;
+UPDATE Tantieme SET tant_lot_size= 2/9*1000 WHERE tant_pc_id=5 AND tant_lot_num  = 4;
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+ ( "2012-02-15","2012-02-01","364381","Facture Fioul BOLLORE 1000L");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture (@last_id,"2012-02-02","364381","603000","401002",961.92,"Facture Bollore Fioul PC4",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+    ( "2012-02-15","2012-02-01","364381","Répartition Charges Fioul PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 (@last_id,"2012-02-02","364381","603000","401002",961.92,"Appel de fonds  Bollore Fioul PC4");
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+   ( "2012-02-15","2012-02-01","Direct via cheque copro","Payer BOLLORE Fioul");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2012-02-02","Payement direct","512001","401002",961.92,"Payer Bollore ");
+--
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+     ( "2012-02-14","2012-02-01","","Avance pour Fioul");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+ (@last_id,"2012-02-02","512001","450001",150.06,"Virement Cordier Fioul");
+
+CALL insert_view_avance
+    (@last_id,"2012-02-02","512001","450002",480.00,"Virement Ebersold Fioul + part Immoval");
+
+CALL insert_view_avance
+    (@last_id,"2012-02-02","512001","450003",331.86,"Virement Henschel Fioul");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+  ( "2012-02-13","2012-02-01","5485019S","Facture ES ");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture (@last_id,"2012-02-13","5485019S","602000","401005",31.72,"Facture EDF PC1",1);
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+  ( "2012-02-13","2012-02-01","5485019S","Répartition Charges  ES PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1 (@last_id,"2012-02-13","5485019S","602000","401005",31.72,"Appel de fonds EDF PC1");
+
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-02-02","","401005",31.72,'d',"Payement EDF");
+-- Un credit sur les comptes de coproprite induit un debit en banque.
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+             ( "2012-02-13","2012-02-01","","Cordier Payer EDF");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+      (@last_id,"2012-02-02","512001","450001",31.72,"Cordier a Paye EDF");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-02-02","","512001",31.72,'c',"Cordier a Paye EDF");
+
+--
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+    ( "2012-02-02","2012-02-01","","Cordier paye Matmut");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+(@last_id,"2012-02-02","512001","450001",173.35,"Cordier Payement assurance ");
+-- Un credit sur les comptes de coproprite induit un debit en banque.
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-02-02","","512001",173.35,'c',"Cordier Payement Assurance par cordier");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-02-02","2012-02-01","31","Facture Matmut 1T 2012");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture (@last_id,"2012-02-02","31","616000","401007",173.35,"Facture Assurance PC1",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-02-02","2012-02-01","31","Répartition Charges Matmut 1T 2012");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1 (@last_id,"2012-02-02","31","616000","401007",173.35,"Appel de fonds Assurance PC1");
+
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES
+             (@last_id,"2012-02-02","OD","401007",173.35,'d',"Payement Assurance par cordier");
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-02-29","2012-02-01","","Versement Fév");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+     (@last_id,"2012-02-29","512001","450004",210.25,"Virement Immoval");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+             ( "2012-03-03","2012-02-01","","Versement mars");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+     (@last_id,"2012-03-02","512001","450001",65.00,"Virement Cordier");
+CALL insert_view_avance
+     (@last_id,"2012-03-02","512001","450003",150.00,"Virement Hentschel");
+CALL insert_view_avance
+     (@last_id,"2012-03-02","512001","450002",150.00,"Virement Ebersold");
+CALL insert_view_avance
+     (@last_id,"2012-03-02","512001","450002",307.80,"Ebersold");
+CALL insert_view_avance
+     (@last_id,"2012-03-07","512001","450003",155.15,"Remise Cheque Hentschel");
+
+-- Veolia compteur
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-03-07","2012-03-07","12013768","Facture Veolia PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                      (@last_id,"2012-02-02","12013768","603000","401003",211.17,"Facture Veolia PC4",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-03-07","2012-03-07","12013768","Répartition Charges Veolia PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                      (@last_id,"2012-02-02","","603000","401003",211.17,"Appel de  fonds Veolia PC4");
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-03-07","2012-03-14","CHEQUE 2452001","Payer Veolio");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                      (@last_id,"2012-03-14","CHEQUE 2452001","512001","401003",211.17,"Payer Veolia ");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+             ( "2012-03-06","2012-03-06","367096","Facture BOLLORE 500L Filoul");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                     (@last_id,"2012-03-04","367096","603000","401002",501.00,"Facture Bollore PC4",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-03-06","2012-03-06","367096","Répartition Charge BOLLORE 500L PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                     (@last_id,"2012-03-06","367096","603000","401002",501.00,"Appel de fonds Bollore");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+ ( "2012-03-06","2012-03-07","CHEQUE 2452002","Payer BOLLORE");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                     (@last_id,"2012-03-07","CHEQUE 2452002","512001","401002",501.00,"Payer facture Bollore ");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+               ( "2012-04-16","2012-02-01","369631","Facture BOLLORE 500L");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                     (@last_id,"2012-04-14","369631","603000","401002",490.98,"Facture Bollore PC4",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+               ( "2012-04-17","2012-04-01","369631","Répartitions Charges BOLLORE 500L PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                     (@last_id,"2012-04-17","369631","603000","401002",490.98,"Appel de fonds Bollore");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+               ( "2012-04-16","2012-02-01","CHEQUE 2452003","Payer BOLLORE 500L");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                     (@last_id,"2012-04-08","CHEQUE 2452003","512001","401002",490.98,"Payer Bollore ");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+         ( "2012-04-02","2012-04-01","","Versement avril");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+ (@last_id,"2012-04-02","512001","450003",150.00,"Virement Hentschel");
+
+CALL insert_view_avance
+ (@last_id,"2012-04-10","512001","450001",65.00,"Virement Cordier");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+         ( "2012-04-30","2012-02-01","5812179S","Facture ES avril");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+                     (@last_id,"2012-04-10","5812179S","602000","401005",26.77,"Facture EDF PC1",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+         ( "2012-04-30","2012-02-01","5812179S","Répartition Charges ES PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1 
+                     (@last_id,"2012-04-10","5812179S","602000","401005",26.77,"Appel de fonds EDF PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-04-30","2012-02-01","CHEQUE 2452005","Payer ES");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2012-04-30","CHEQUE 2452005","512001","401005",26.77,"Payer EDF PC1 ");
+
+-- Savelys retard de payement
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-04-10","2012-02-01","5KI13684246","Facture Savelys");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+                     (@last_id,"2012-04-01","5KI13684246","614000","401004",165.51,"Facture SAVELYS Entretien ",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+      ( "2012-04-10","2012-02-01","5KI13684246","Répartition Charges Savelys PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                      (@last_id,"2012-04-08","","614000","401003",165.51,"Appel de fonds Savelys PC4");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+       ( "2012-04-10","2012-02-01","CHEQUE 2452004","Payer Savelys");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                      (@last_id,"2012-04-08","CHEQUE 2452004","512001","401004",165.51,"Payer Savelys GDF Suez");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-05-10","2012-05-01","","Versement Mai");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+ (@last_id,"2012-05-03","512001","450003",150.00,"Virement Hentschel");
+CALL insert_view_avance
+ (@last_id,"2012-05-03","512001","450001",65.00,"Cordier");
+CALL insert_view_avance
+ (@last_id,"2012-05-03","512001","450002",150.00,"Ebersold");
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-06-10","2012-06-01","","Versement juin");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+ (@last_id,"2012-06-03","512001","450003",150.00,"Hentschel");
+CALL insert_view_avance
+ (@last_id,"2012-06-03","512001","450001",65.00,"Cordier");
+CALL insert_view_avance
+ (@last_id,"2012-06-20","512001","450002",4.75,"Virement Ebersold");
+CALL insert_view_avance
+ (@last_id,"2012-06-13","512001","450004",260.00,"Immoval");
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-06-16","2012-02-01","","Lettre recommandée");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-06-06","OD","401006",4.78,'c',"Poste Lettre recommand Immoval");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,tret_key_id) VALUES (@last_id,"2012-06-06","OD","620000",4.78,'d',"Poste Lettre recommand Immoval",2);
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-06-03","OD","450004",4.78,'d',"Lettre recommande AR Immoval");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,tret_key_id) VALUES (@last_id,"2012-06-03","OD","620000",4.78,'c',"Fonds Lettre recommande AR Immoval",2);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-06-16","2012-02-01","CHEQUE 2452006","Payer Lettre recommandée ");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2012-07-13","CHEQUE 2452006","512001","401006",4.78,"Payer lettre recommande Immoval");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-06-13","2012-06-01","6187827S","Facture ES juin");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+                             (@last_id,"2012-06-12","6187827S","602000","401005",24.85,"Facture EDF PC1",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-06-13","2012-06-01","6187827S","Répartition des charges ES Juin");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1
+                             (@last_id,"2012-06-12","6187827S","602000","401005",24.85,"Appel de fonds EDF PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+     ( "2012-06-13","2012-02-01","CHEQUE 2452007","Payer ES");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2012-06-22","CHEQUE 2452007","512001","401005",24.85,"Payement EDF");
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-06-09","2012-06-06","7275","Facture Ramonage");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,voucher_ref,description) VALUES 
+  (@last_id,"2012-06-09","HA","401008",61.95,'c',"7175","Ramonage");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,voucher_ref,description) VALUES 
+  (@last_id,"2012-06-09","HA","603000",61.95,'d',"7175","Entretien Ramonage");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                          ( "2012-06-06","2012-06-06","7275","Répartition des charges ramonage PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4
+                             (@last_id,"2012-06-09","7175","603000","401008",39.27,"Appel de fonds Ramonage");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+  (@last_id,"OD","2012-06-09","7175","450005",22.68,'d',"Appel de fonds Ramonage Cordier");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+  (@last_id,"OD","2012-06-09","7175","603000",22.68,'c',"Appel de fonds Ramonage Cordier");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-06-06","2012-06-06","CHEQUE 2452009","Payer Ramonage");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES
+  (@last_id,"2012-06-09","BQ","401008",61.95,'d',"Payement Ramonage",'CHEQUE 2452009');
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-08-03","BQ","512001",61.95,'c',"Payement Ramonage","CHEQUE 2452009");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-06-16","2012-06-01","","Versement Copropriétaires Juillet");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2012-07-03","512001","450001",65.00,"Virement Cordier");
+
+CALL insert_view_avance
+(@last_id,"2012-07-30","512001","450002",150.00,"Virement Ebersold");
+
+CALL insert_view_avance
+(@last_id,"2012-07-03","512001","450003",150.00,"Virement Hentschel");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-09","2012-07-01","","Facture EAU");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+ (@last_id,"2012-07-31","---","601000","401009",377.89,"Facture  Eau",5);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-09","2012-02-01","---","Répartition Charges EAU");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge( @last_id,"601000","2012-07-31","---",377.89,5,"Repartition Charges EAU");
+
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-07-31","OD","450005",73.48,'d',"Prorata eau 2011");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-07-31","OD","450002",73.48,'c',"Prorata eau 2011");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-09","2012-02-01","CHEQUE 2452010","Payer EAU");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-07-31","BQ","401009",377.89,'d',"Payement Eau","CHEQUE 2452010");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-08-03","BQ","512001",377.89,'c',"Payement Eau","CHEQUE 2452010");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-28","2012-02-01","","Frais bancaires");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture    
+  (@last_id,"2012-07-17","xx","620000","401006",2.60,"Banque Frais",2);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-28","2012-02-01","","Répartition Frais bancaires");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc2    
+  (@last_id,"2012-07-17","xx","620000","401006",2.60,"Appel de fonds Banque Frais");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-28","2012-02-01","","Prélèvement banque");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-07-17","BQ","401006",2.60,'d',"Payement Banque Frais");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-07-17","BQ","512001",2.60,'c',"Payement Banque Frais");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-15","2012-02-01","6562864S","Facture ES Juillet");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                     (@last_id,"2012-08-18","6562864S","602000","401005",28.10,"Facture EDF PC1",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-15","2012-02-01","6562864S","Répartition des charges ES PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1 
+                     (@last_id,"2012-08-18","6562864S","602000","401005",28.10,"Appel de fonds EDF PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-15","2012-08-21","CHEQUE 2452011","Payer ES");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES
+  (@last_id,"2012-08-18","BQ","401005",28.10,'d',"Payement EDF","CHEQUE 2452011");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-08-21","BQ","512001",28.10,'c',"Payement EDF","CHEQUE 2452011");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-07-31","2012-02-01","","Versement Juillet");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+(@last_id,"2012-08-03","512001","450001",65.00,"Cordier");
+
+CALL insert_view_avance
+(@last_id,"2012-08-27","512001","450002",150.00,"Ebersold");
+
+CALL insert_view_avance
+(@last_id,"2012-08-03","512001","450003",150.00,"Virement Hentschel");
+
+CALL insert_view_avance
+  (@last_id,"2012-08-18","512001","450004",130.00,"Immoval");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-08-18","2012-02-01","033","Facture Matmut Assurance");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+                             (@last_id,"2012-08-23","033","616000","401007",164.05,"Facture Assurance",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-08-18","2012-02-01","033","Répartition Charges Matmut PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1
+                             (@last_id,"2012-08-23","033","616000","401007",164.05,"Appel de fonds Assurance");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-08-18","2012-02-01","CHEQUE 2452012","Payer Assurance");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-08-23","BQ","401007",164.05,'d',"Payement Assurance","CHEQUE 2452012");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-08-23","BQ","512001",164.05,'c',"Payement Assurance","CHEQUE 2452012");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-08-18","2012-02-01","","Versement Copropriétaires");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2012-09-03","512001","450003",150.00,"Virement Hentschel");
+
+CALL insert_view_avance
+  (@last_id,"2012-09-03","512001","450001",65.00,"Cordier");
+
+CALL insert_view_avance
+  (@last_id, "2012-09-06","512001","450002",150.00,"Ebersold");
+
+CALL insert_view_avance
+  (@last_id,"2012-09-18","512001","450004",65.00,"Immoval");
+
+CALL insert_view_avance
+  (@last_id,"2012-10-02","512001","450001",65.00,"Cordier");
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-09-05","2012-02-01","xxx","Facture Divers lampe");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+ (@last_id,"2012-10-02","xxx","605000","401010",70.10,"Facture Divers lampe PC2",2);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-09-05","2012-02-01","","Répartition Charges Divers lampe ");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc2
+ (@last_id,"2012-10-02","xxx","605000","401010",70.10,"Appel de Divers lampe PC2");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-09-05","2012-02-01","CHEQUE 2452014","Payer Divers lampe");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES 
+  (@last_id,"2012-10-02","BQ","401010",70.10,'d',"Payement Divers lampe");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-10-02","BQ","512001",70.10,'c',"Payement Divers lampe","CHEQUE 2452014");
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-09-17","2012-02-01","","Virement Septembre");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2012-10-03","512001","450003",150.00,"Virement Hentschel");
+CALL insert_view_avance
+  (@last_id,"2012-10-09","512001","450002",150.00,"Ebersold");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-02","2012-02-01","379180","Facture de FIOUL 1000L");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                      (@last_id,"2012-09-06","379180","603000","401002",996,"Facture Bollore PC4",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-02","2012-02-01","379180","Répartition Charges Fioul 1000L PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                      (@last_id,"2012-09-06","379180","603000","401002",996,"Appel de fonds Bollore PC4");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-02","2012-02-01","CHEQUE 2452013","Payer BOLLORE 1000L Fioul");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+   (@last_id,"2012-09-25","BQ","401002",996,'d',"Payement Bollore","CHEQUE 2452013");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES
+  (@last_id,"2012-09-25","BQ","512001",996,'c',"Payement Bollore","CHEQUE 2452013");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-03","2012-02-01","","Versement IMMOVAL");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2012-10-18","512001","450004",65.00,"Immoval");
+
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-09","2012-02-01","Relevé","Facture Banque Frais");
+SET @last_id = LAST_INSERT_ID();
+CALL  insert_facture 
+  (@last_id,"2012-10-16","xxx","620000","401006",2.60,"Facture Banque Frais",2);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-09","2012-02-01","Relevé","Répartition Frais banquaires");
+SET @last_id = LAST_INSERT_ID();
+CALL  insert_view_pc2 
+  (@last_id,"2012-10-16","xxx","620000","401006",2.60,"Appel de fonds Banque Frais");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-11","2012-02-01","Releve banque","Prélèvment Frais bancaires");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-10-16","BQ","401006",2.60,'d',"Payement Banque Frais");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-10-16","BQ","512001",2.60,'c',"Payement Banque Frais");
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-16","2012-02-01","","Versement Ebersold");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+(@last_id,"2012-11-05","512001","450002",150.00,"Ebersold");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-10-16","2012-10-01","6881712S","Facture ES Octobre");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                     (@last_id,"2012-10-02","6881712S","602000","401005",27.0,"Facture EDF PC1",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                        ( "2012-11-05","2012-11-01","6881712S","Répartition Charges ES PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1 
+                     (@last_id,"2012-10-08","6881712S","602000","401005",27.0,"Appel de fonds EDF PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-11-02","2012-11-01","TIP","Payement ES Nov");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-11-02","BQ","401005",27.0,'d',"Payement EDF");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-11-02","BQ","512001",27.0,'c',"Payement TIP EDF");
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-11-03","2012-11-01","","Versement de Nov");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2012-11-03","512001","450003",150.00,"Virement Hentschel");
+
+CALL insert_view_avance
+  (@last_id,"2012-11-03","512001","450001",65.00,"Cordier");
+
+CALL insert_view_avance
+  (@last_id,"2012-11-18","512001","450004",65.00,"Immoval");
+
+--
+--
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-11-15","2012-11-01","xxx","Facture EAU");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+  (@last_id,"2012-11-15","xxx","601000","401009",325.20,"Facture  Eau",5);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-11-15","2012-11-01","xxx","Répartition Charges EAU");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge( @last_id,"601000","2012-11-15","xxx",325.20,5,"Repartition Charges EAU");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-11-15","2012-11-01","CHEQUE 2452015","Payer EAU");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES 
+  (@last_id,"2012-11-15","BQ","401009",325.20,'d',"Payement Eau");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+  (@last_id,"2012-11-15","BQ","512001",325.20,'c',"Payement Eau","CHEQUE 2452015");
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-05","2012-02-01","384886","Facture BOLLERE FIOUL 1000L");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                     (@last_id,"2012-11-29","384886","603000","401002",950.95,"Facture Bollore PC4",4);
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-05","2012-02-01","384886","Répartition Charges Fioul 1000L");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                     (@last_id,"2012-11-29","384886","603000","401002",950.95,"Appel de fonds Bollore PC4");
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-05","2012-02-01","CHEQUE 2452016","Payer BOLLORE FIOUL 1000L Déc");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+              (@last_id,"2012-12-05","BQ","401002",950.95,'d',"Payement Bollore",'CHEQUE 2452016');
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+              (@last_id,"2012-12-05","BQ","512001",950.95,'c',"Payement Bollore","CHEQUE 2452016");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-05","2012-02-01","","Avance Décembre ");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2012-12-05","512001","450003",150.00,"Virement Hentschel");
+
+CALL insert_view_avance
+  (@last_id,"2012-12-05","512001","450002",150.00,"Ebersold");
+
+CALL insert_view_avance
+  (@last_id,"2012-12-19","512001","450004",65.00,"Immoval");
+
+CALL insert_view_avance
+  (@last_id,"2012-12-15","512001","450001",65.00,"Cordier");
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-12-20","2012-02-01","7244392S","Facture ES Décembre");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture 
+                     (@last_id,"2012-12-20","7244392S","602000","401005",28.85,"Facture EDF PC1",1);
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-12-20","2012-02-01","7244392S","Répartition Charges ES Décembre PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc1 
+                     (@last_id,"2012-12-20","7244392S","602000","401005",28.85,"Appel de fonds EDF PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2012-12-20","2012-02-01","CHEQUE 2452017","Payer EDF");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2012-12-20","CHEQUE 2452017","512001","401005",28.85,"Payer EDF");
+
+--
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                        ( "2012-12-20","2012-02-01","7784","Facture Ramonage");
+SET @last_id = LAST_INSERT_ID();
+
+CALL insert_facture 
+                     (@last_id,"2012-11-29","7784","603000","401008",39.27,"Facture Ramonage PC4",4);
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-20","2012-02-01","7784","Répartitions de charges Ramonage PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_pc4 
+                     (@last_id,"2012-11-29","7784","603000","401008",39.27,"Appel de fonds  Ramonage PC4");
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-20","2012-02-01","CHEQUE 2452018","Payer Ramoneur");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES 
+                   (@last_id,"2012-12-20","BQ","401008",39.27,'d',"Payement Ramonage");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description,voucher_ref) VALUES 
+                   (@last_id,"2012-12-20","BQ","512001",39.27,'c',"Payement Ramonage","CHEQUE 2452018");
+
+-- Repartiteur
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-20","2012-02-01","","Repartiteur");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","OD","450001",372.59,'d',"Repartiteur Veolia Cordier");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","OD","450002",244.66,'c',"Repartiteur Veolia Ebersold");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","OD","450003",91.22,'c',"Repartiteur Veolia Hentschel");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","OD","450004",15.59,'d',"Repartiteur Veolia Immoval");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","OD","450005",52.30,'c',"Repartiteur Veolia Ancien Cordier");
+
+
+-- Appels de fonds
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-28","2012-12-28","","Appels de fond + remboursement");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","450001",1005.13,'d',"Appels Cordier");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","701000",1005.13,'c',"Appels Cordier");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","450002",1992.55,'d',"Appels Ebersold");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","701000",1992.55,'c',"Appels Ebersold");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","450003",1987.01,'d',"Appels Hentschel");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","701000",1987.01,'c',"Appels Hentschel");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","450004",860.25,'d',"Appels Immoval");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","AF","701000",860.25,'c',"Appels Immoval");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2012-12-28","2012-12-28","","Appels de fond + remboursement");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","450001",1005.13,'c',"Remb Appels Cordier");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","701000",1005.13,'d',"Remb Appels Cordier");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","450002",1992.55,'c',"Remb Appels Ebersold");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","701000",1992.55,'d',"Remb Appels Ebersold");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","450003",1987.01,'c',"Remb Appels Hentschel");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","701000",1987.01,'d',"Remb Appels Hentschel");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","450004",860.25,'c',"Remb Appels Immoval");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2012-12-30","RF","701000",860.25,'d',"Remb Appels Immoval");
+
+
+-- Cloture des comptes  sur 2013
+-- INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+--                          ( "2012-12-30","2012-12-30","","Cloture des comptes 2012");
+-- SET @last_id = LAST_INSERT_ID();
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--             (@last_id,"OD","2012-12-30","450001",272.73,'c',"Report solde debiteur 2012");
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (@last_id,"OD","2012-12-30","701000",272.73,'d',"Report solde debiteur 2012");
+--
+
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--             (@last_id,"OD","2012-12-30","450002",349.10,'d',"Report solde crediteur 2012");
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (@last_id,"OD","2012-12-30","701000",349.10,'c',"Report solde crediteur 2012");
+--
+
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (@last_id,"OD","2012-12-30","450003",203.89,'d',"Report solde crediteur 2012");
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (@last_id,"OD","2012-12-30","701000",203.89,'c',"Report solde crediteur 2012");
+--
+
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--             (@last_id,"OD","2012-12-30","450004",58.08,'c',"Report solde debiteur 2012");
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (@last_id,"OD","2012-12-30","701000",58.08,'d',"Report solde debiteur 2012");
+--
+
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--             (@last_id,"OD","2012-12-30","450005",43.86,'c',"Report solde debiteur 2012");
+-- INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (@last_id,"OD","2012-12-30","701000",43.86,'d',"Report solde debiteur 2012");
+--
+-- INSERT INTO TransactionEntry (trans_id,entry_date,acc_id,amount,debit_credit,description) VALUES 
+--            (69,"2012-12-30","512001",178.33,'d',"Report solde debiteur 2012");
+
+--
+-- Debut 2013
+--
+
+-- Report 2012
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2013-01-02","2013-01-02","Report de soldes","A NOUVEAU");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+            (@last_id,"AN","2013-01-02","450001",272.73,'d',"Report solde debiteur 2012");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+            (@last_id,"AN","2013-01-02","450002",349.10,'c',"Report solde crediteur 2012");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+            (@last_id,"AN","2013-01-02","450003",203.89,'c',"Report solde crediteur 2012");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+            (@last_id,"AN","2013-01-02","450004",58.08,'d',"Report solde debiteur 2012");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+            (@last_id,"AN","2013-01-02","450001",43.86,'d',"Report solde debiteur 2012 Ancien C");
+INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,acc_id,amount,debit_credit,description) VALUES 
+            (@last_id,"AN","2013-01-02","512001",178.33,'d',"Report solde debiteur 2012");
+
+-- Versement 
+
+CALL appel_fonds("2013-01-02","450001","701000",372.59,"Appel de fonds Suite au decompte de charge");
+CALL appel_fonds("2013-01-02","450002","701000",170.00,"Appel de fonds janv");
+CALL appel_fonds("2013-01-02","450003","701000",150.00,"Appel de fonds janv");
+CALL appel_fonds("2013-01-02","450004","701000",129.09,"Appel de fonds Suite au decompte de charge");
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-02","","Virement Janvier 2013");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-01-02","512001","450003",150.00,"Virement Hentschel");
+CALL insert_view_avance
+  (@last_id,"2013-01-05","512001","450002",170.00,"Virement Ebersold");
+CALL insert_view_avance
+  (@last_id,"2013-01-05","512001","450001",372.59,"Virement Cordier");
+CALL insert_view_avance
+  (@last_id,"2013-01-15","512001","450004",129.09,"Virement Immoval");
+-- Matmut payer 
+
+CALL insert_trans_facture
+                         ("2013-01-02","2013-01-03","Releve 35","616000","401007",177.41,"Matmut 1T 2013",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-03","Releve 35","Repartition Charges Assurance PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge
+     ( @last_id,"616000","2013-01-02","035",177.41,1,"Repartition Charges Assurance PC1");
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-03","CHEQUE 2452019","Payer Matmut 1T 2013");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-01-03","CHEQUE 2452019","512001","401007",177.41,"Payer Matmut 1T 2013");
+
+-- Ampoule Leroy
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-03","0153280","Achat d'ampoules Leroy Merlin" );
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+                         (@last_id,"2013-01-03","0153280","604000","401010",25.89,"Achat Leroy Merling ampoule",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-03","Repartion Charge Leroy Merlin ampoules PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge( @last_id,"604000","2013-01-07","0153280",25.89,1,"Repartition Charges Leroy ampoules PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-03","CHEQUE 2452020","Payer Achat Leroy Merlin");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-01-03","CHEQUE 2452020","512001","401010",25.89,"Payer Achat Leroy Merling ampoule");
+
+-- Savelys
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-02","2013-01-03","5KI15289850","Facture Savelys Suez entretien");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_facture
+                         (@last_id,"2013-01-08","5KI15289850","614000","401004",170.48,"Savely Suez entretien",4);
+
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                         ( "2013-01-02","2013-01-03","KI15289850","Repartition Charges Savelys PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge
+     ( @last_id,"614000","2013-01-07","5KI15289850",170.48,4,"Repartition Charges Savelys PC4");
+
+-- Commande de fioul 2012-01-08 
+CALL insert_trans_facture
+                         ("2013-01-09","2013-01-10","258850","603000","401002",940,"Fioul Janv 1000L PC4",4);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-09","2013-01-15","258850","Répartition Charges Fioul 1000L PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge
+     (@last_id,"603000","2013-01-27","258850",940,4,"Repartition Charges Fioul 1000L PC4");
+
+-- CALL appel_fonds_sur_facture("2013-01-10","2013-01-10","701000","258850",940,4,"Appel de fonds Fioul 1000L PC4");
+
+-- Elagage de l'arbre
+
+CALL insert_trans_facture
+                         ("2013-01-09","2013-01-20","xxx","615000","450002",50,"Elagage PC1",1);
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-09","2013-01-15","","Elagage arbre");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge
+     ( @last_id,"615000","2013-01-27","xxx",50.00,1,"Repartition Charges Elagage arbre PC1");
+
+-- CALL appel_fonds_sur_facture("2013-01-27","2013-01-27","701000","xxx",50,1,"Appel de fonds Elagage");
+
+CALL appel_fonds("2013-01-02","450004","701000",150,"Appel de fonds 1T");
+-- Virement Immmoval
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2013-01-09","2013-01-29","","Versement Exceptionnel 1T Immoval");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-01-29","512001","450004",150.00,"Virement Immoval");
+
+-- Payement Fioul 
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                         ( "2013-01-09","2013-01-30","CHEQUE 2452021","Payer Fioul BOLLERE Janv");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-01-30","CHEQUE 2452021","512001","401002",940.00,"Payer Fioul Bollore");
+-- Virement  Cordier Janvier 2013 
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+            ( "2013-01-09","2013-01-29","","Virement Régulier Jan Corider 03/01/2013");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-01-29","512001","450001",65.00,"Virement Regulier Jan 03/01/2013");
+
+-- Frais Banquaire
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                         ( "2013-01-17","2013-01-17","","Frais bancaires");
+SET @last_id = LAST_INSERT_ID();
+CALL  insert_facture 
+  (@last_id,"2013-01-17","xxx","620000","401006",2.60,"Facture Banque Frais",1);
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-17","2013-01-17","","Répartition Charges Frais Banque PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge( @last_id,"620000","2013-01-17","Releve 1",2.60,1,"Repartition Charges Frais Banque PC1");
+
+-- CALL appel_fonds_sur_facture("2013-01-17","2013-01-17","701000","Releve 1",2.60,1,"Appel de fonds Banque PC1");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,trans_label) VALUES
+                         ( "2013-01-17","2013-01-17","Prélèvement de la Banque");
+SET @last_id = LAST_INSERT_ID();
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2013-01-17","BQ","401006",2.60,'d',"Payement Baque Frais");
+INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES (@last_id,"2013-01-17","BQ","512001",2.60,'c',"Payement Baque Frais");
+
+-- Appel de fonds Fev
+CALL appel_fonds("2013-02-02","450001","701000",100.00,"Appel de fonds fev");
+CALL appel_fonds("2013-02-02","450002","701000",170.00,"Appel de fonds fev");
+CALL appel_fonds("2013-02-02","450003","701000",150.00,"Appel de fonds fev");
+-- Virement Fevrier
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ("2013-02-09","2013-02-05","","Virement régulier Fév");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-02-05","512001","450001",100.00,"Virement Regulier Fev 03/02/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-02-20","512001","450002",370.00,"Virement Regulier Fev 20/02/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-02-05","512001","450003",150.00,"Virement Regulier Fev 03/02/2013");
+
+-- Fioul Pour fevrier
+CALL insert_trans_facture
+                         ("2013-02-14","2013-02-14","387771","603000","401002",1261.05,"Fioul Fev 1200L PC4",4);
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-02-14","2013-02-14","387771","Répartition Charge Fioul 1200L Fév PC4");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge( @last_id,"603000","2013-02-14","387771",1261.05,4,"Repartition Charges Fioul 1200L Fev PC4");
+
+-- CALL appel_fonds_sur_facture("2013-02-14","2013-02-14","701000","387771",1261.05,4,"Appel de fonds Fioul 1200L Fev PC4");
+
+-- Achat Sel
+CALL insert_trans_facture
+                         ("2013-02-16","2013-02-16","0218001160213000156","604000","401011",3.99,"Sel pour neige PC1",1);
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                         ( "2013-02-16","2013-02-16","0218001160213000156","Répartition Charge Sel Fév PC1");
+SET @last_id = LAST_INSERT_ID();
+CALL repartir_charge( @last_id,"604000","2013-02-16","0218001160213000156",3.99,1,"Repartition Charges Sel Fev PC1");
+
+-- CALL appel_fonds_sur_facture("2013-02-16","2013-02-16","701000","0218001160213000156",3.99,1,"Appel de fonds Sel");
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                         ( "2013-02-16","2013-02-16","CHEQUE 2452022","Payer Achat LIDL Sel");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-02-16","CHEQUE 2452022","512001","401011",3.99,"Payer Achat LIDL Sel");
+
+-- Facture EDF
+-- jm.hentschel@gmail.com
+CALL insert_trans_facture
+                         ("2013-02-12","2013-02-16","7604369S","602000","401005",30.54,"Facture EDF Fev ",2);
+
+CALL repartir_trans_charge( "2013-02-16","2013-02-16","602000","7604369S",30.54,2,"Repartition Charges EDF Fev PC2");
+
+-- CALL appel_fonds_sur_facture("2013-02-12","2013-02-16","701000","7604369S",30.54,2,"Appel de fonds EDF Fev PC2");
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                         ("2013-02-12","2013-02-16","CHEQUE 2452023","Payer ES Fév");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-02-16","CHEQUE 2452023","512001","401005",30.54,"Payer Electricite Fév");
+
+-- Appel de fonds Exceptionnel
+CALL appel_fonds("2013-02-19","450001","701000",201.00,"Appel de fonds excep fev");
+CALL appel_fonds("2013-02-19","450002","701000",200.00,"Appel de fonds excep fev");
+CALL appel_fonds("2013-02-19","450003","701000",625.48,"Appel de fonds excep fev");
+-- Virement exception Jean Matthieu
+
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-02-18","2013-02-18","","Virement exceptionnel Hentschel");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-02-19","512001","450003",625.48,"Virement exceptionel Fioul Fev 19/02/2013");
+-- Cheque exceptionnel Cordier
+
+-- INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+--                          ( "2013-02-18","2013-02-18","CHEQUE 0381071","Versement Avance CHEQUE Cordier");
+-- SET @last_id = LAST_INSERT_ID();
+CALL insert_avance
+  ("2013-02-19","CHEQUE 0381071","512001","450001",201.01,"Versement Cheque Cordier,exceptionel Fioul Fev 19/02/2013");
+
+-- Payer Savelys 
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-25","2013-02-25","CHEQUE 2452024","Payer Savelys");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-02-25","CHEQUE 2452024","512001","401004",170.48,"Payer Savelys Fév");
+
+-- Payer Bollore Fioul
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( "2013-01-25","2013-02-25","CHEQUE 2452025","Payer BOLLERE Fév");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_paye
+                         (@last_id,"2013-02-25","CHEQUE 2452025","512001","401002",1261.05,"Payer Bollore 1200L");
+
+
+-- Appel de fonds Mars 
+CALL appel_fonds("2013-03-02","450001","701000",100,"Appel de fonds Mensuel mars");
+CALL appel_fonds("2013-03-02","450002","701000",150,"Appel de fonds Mensuel mars 100+50 arbre");
+CALL appel_fonds("2013-03-02","450003","701000",150,"Appel de fonds Mensuel mars");
+-- Avances mars 
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ("2013-03-09","2013-03-05","","Virement régulier Fév");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-02-09","512001","450001",100.00,"Virement Regulier mars 03/03/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-02-20","512001","450002",100.00,"Virement Regulier mars 25/03/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-03-05","512001","450003",150.00,"Virement Regulier mars 03/03/2013");
+
+-- Appel de fonds Avril
+CALL appel_fonds("2013-04-02","450001","701000",100,"Appel de fonds Mensuel avril");
+CALL appel_fonds("2013-04-02","450002","701000",170,"Appel de fonds Mensuel avril");
+CALL appel_fonds("2013-04-02","450003","701000",150,"Appel de fonds Mensuel avril");
+CALL appel_fonds("2013-04-02","450004","701000",225,"Appel de fonds 2T");
+-- Avances avril 
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ("2013-04-09","2013-04-05","","Virement régulieravril");
+SET @last_id = LAST_INSERT_ID();
+CALL insert_view_avance
+  (@last_id,"2013-04-09","512001","450001",100.00,"Virement Regulier avril 03/04/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-04-09","512001","450002",170.00,"Virement Regulier avril 25/04/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-04-09","512001","450003",150.00,"Virement Regulier avril 03/04/2013");
+
+CALL insert_view_avance
+  (@last_id,"2013-04-09","512001","450004",225.00,"Virement 2ieme semestre avril 03/04/2013");
+
+-- Fioul
+CALL insert_trans_facture
+                          ("2013-04-06","2013-04-06","493890","603000","401012",933,"Facture Fioul Avril PC4",4);
+
+CALL repartir_trans_charge("2013-04-06","2013-04-06","603000","493890",933.00,4,"Repartition Charges Fioul PC4");
+-- CALL appel_fonds_sur_facture("2013-04-06","2013-04-06","701000","493890",933.00,4,"Appel de fonds Fioul PC4");
+
+CALL insert_trans_paye
+                         ("2013-04-06","2013-04-09","CHEQUE 2452026","512001","401012",933.00,"Payer Mutschler 1000L");
+
+
+
+
+CALL insert_avance
+  ("2013-04-11","VIREMENT","512001","450002",170.00,"Versement avance mai Fioul avril 06/04/2013");
+
+-- Timbres poste
+CALL insert_trans_facture
+                          ("2013-04-13","2013-04-13","51679260130004666","620000","401006",13.92,"2 Carnets de timbre PC1",1);
+
+CALL repartir_trans_charge("2013-04-13","2013-04-13","620000","51679260130004666",13.92,1,"2 Carnets de timbre PC1");
+
+CALL insert_trans_paye
+                         ("2013-04-13","2013-04-13","CHEQUE 2452027","512001","401006",13.92,"Payer timbres");
+
+
+-- VEOLIA
+CALL insert_trans_facture("2013-04-29","2013-02-11","13019808","603000","401003",216.67,"Facture veolia proxiserve",4);
+
+CALL repartir_trans_charge("2013-04-29","2013-02-11","603000","13019808",216.67,4,"Veolia proxiserve PC4");
+
+CALL insert_trans_paye("2013-04-29","2013-02-11","CHEQUE 2452028","512001","401003",216.67,"Payer VEOLIA");
+
+-- ES
+CALL insert_trans_facture("2013-04-29","2013-04-10","7925086S","602000","401005",31.18,"Facture ES",2);
+
+CALL repartir_trans_charge("2013-04-29","2013-04-10","602000","7925086S",31.18,2,"ES PC2");
+
+CALL insert_trans_paye("2013-04-29","2013-04-29","CHEQUE 2452029","512001","401005",31.18,"Payer ES");
+
+-- EAU Facture
+CALL insert_trans_facture("2013-05-06","2013-05-06","233813200026Y","601000","401009",226.26,"Facture EAU",5);
+
+CALL repartir_trans_charge("2013-05-06","2013-05-06","601000","233813200026Y",226.26,5,"Charge EAU");
+-- Frais Bancaires 
+
+CALL insert_trans_facture("2013-05-06","2013-04-11","Releve CCP N 4","620000","401006",2.60,"Frais bancaires",1);
+CALL repartir_trans_charge("2013-05-06","2013-04-11","620000","Releve CCP N 4",2.60,1,"Frais bancaires PC1");
+
+CALL insert_trans_paye("2013-05-06","2013-04-11","Prelevement","512001","401006",2.60,"Prelevement CCP N4");
+
+-- Appel de fonds mai
+CALL appel_fonds("2013-04-30","450001","701000",100,"Appel de fonds Mensuel mai");
+CALL appel_fonds("2013-04-30","450002","701000",170,"Appel de fonds Mensuel mai");
+CALL appel_fonds("2013-04-30","450003","701000",150,"Appel de fonds Mensuel mai");
+
+-- Avance programme
+CALL insert_avance
+  ("2013-05-06","VIREMENT","512001","450001",100.00,"Versement Cordier  mai ");
+CALL insert_avance
+  ("2013-05-06","VIREMENT","512001","450002",170.00,"Versement Ebersold mai ");
+CALL insert_avance
+  ("2013-05-06","VIREMENT","512001","450003",150.00,"Versement Hentschel mai ");
+
+-- Payement eau
+CALL insert_trans_paye("2013-05-06","2013-05-10","CHEQUE N 2452030","512001","401009",226.26,"Payement EAU");
+CALL insert_avance
+  ("2013-06-06","VIREMENT","512001","450001",100.00,"Versement Cordier  juin ");
+CALL insert_avance
+  ("2013-06-06","VIREMENT","512001","450002",170.00,"Versement Ebersold juin ");
+CALL insert_avance
+  ("2013-06-06","VIREMENT","512001","450003",150.00,"Versement Hentschel juin ");
+
+-- Avance Moi de Juin
+
+-- Facture Ramonge
+CALL insert_trans_facture
+                          ("2013-06-07","2013-06-06","8651","603000","401008",40.50,"Facture Ramonage ",4);
+CALL repartir_trans_charge("2013-06-07","2013-06-06","603000","8651",40.50,4,"Frais Ramonage");
+
+CALL insert_trans_paye("2013-06-06","2013-06-08","CHEQUE N 2452031","512001","401008",40.50,"Payement Ramoneur");
+-- Bilan sythese des comptes
+select j.acc_id as Compte ,j.acc_name as Description
+                        ,ROUND(sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2) as Debit ,
+                        ROUND(sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)  as Credit ,
+                      CASE 
+		WHEN sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) > 0 THEN	
+		 	ROUND( sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)
+		ELSE
+		 	ROUND( sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2)
+		END	
+		      	as Solde
+from  Account as j 
+  JOIN TransactionEntry AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on r.entry_date > p.per_begin and r.entry_date < p.per_end and p.per_string ="2012"
+GROUP BY j.acc_id ;
+
+select "Charges 6" ;
+select "" , "Total ", ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+            ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit 
+	from TransactionEntry as t 
+	join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string = "2012"
+	where t.acc_id like "6%" ORDER BY entry_date;
+
+
+select j.acc_id as Compte ,j.acc_name as Description
+                        ,ROUND(sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2) as Debit ,
+                        ROUND(sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)  as Credit ,
+                      CASE 
+		WHEN sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) > 0 THEN	
+		 -1 *	ROUND( sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)
+		ELSE
+		 	ROUND( sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2)
+		END	
+		      	as Solde
+from  Account as j 
+  JOIN TransactionEntry AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on r.entry_date > p.per_begin and r.entry_date < p.per_end and p.per_string ="2013"
+GROUP BY j.acc_id ;
+-- Bilan sythese des comptes
+select j.acc_id as Compte ,j.acc_name as Description
+                        ,ROUND(sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2) as Debit ,
+                        ROUND(sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)  as Credit ,
+                      CASE 
+		WHEN sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) > 0 THEN	
+		 	ROUND( sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)
+		ELSE
+		 	ROUND( sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2)
+		END	
+		      	as Solde
+from  Account as j 
+  JOIN TransactionEntry AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on r.entry_date > p.per_begin and r.entry_date < p.per_end and p.per_string ="2012"
+GROUP BY j.acc_id ;
+
+select "Charges 6" ;
+select "" , "Total ", ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+            ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit 
+	from TransactionEntry as t 
+	join Period as p on t.entry_date > p.per_begin and t.entry_date < p.per_end and p.per_string = "2012"
+	where t.acc_id like "6%" ORDER BY entry_date;
+
+
+select j.acc_id as Compte ,j.acc_name as Description
+                        ,ROUND(sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2) as Debit ,
+                        ROUND(sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)  as Credit ,
+                      CASE 
+		WHEN sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) > 0 THEN	
+		 -1 *	ROUND( sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)
+		ELSE
+		 	ROUND( sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2)
+		END	
+		      	as Solde
+from  Account as j 
+  JOIN TransactionEntry AS r on j.acc_id = r.acc_id 
+  JOIN Period AS p on r.entry_date > p.per_begin and r.entry_date < p.per_end and p.per_string ="2013"
+GROUP BY j.acc_id ;
+
+CALL detail_compte("2013","450001");
+CALL detail_compte("2013","450002");
+CALL detail_compte("2013","450003");
+CALL detail_compte("2013","450004");
+select "Banque account" ;
+CALL detail_compte("2013","512001");
+-- Detail Hentschel 2013
+	
+
diff --git a/app/compta/Dialog.js b/app/compta/Dialog.js
new file mode 100644
index 0000000..66a2c52
--- /dev/null
+++ b/app/compta/Dialog.js
@@ -0,0 +1,83 @@
+define(["require", "exports", "../../js/xgui/CtrlDialogbox", "./services"], function (require, exports, CtrlDialogbox_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    class ComptaDialog extends CtrlDialogbox_1.Dialogbox {
+        constructor(id, uipath, jurl) {
+            super(id);
+            super.load(uipath);
+            this._url = jurl;
+            var req = new AEBW.Json(jurl);
+            this._lots = new services_1.Services.Lots(req);
+            this._pcmn = new services_1.Services.PlanComptable(req);
+        }
+        Url() {
+            return this._url;
+        }
+        getFournisseur(onSuccessCb, onFailureCb) {
+            var params = {
+                categorie: '401',
+                like: "lik"
+            };
+            var url = this.Url();
+            var SupplReq = new AEBW.Json(url);
+            var supp = this;
+            SupplReq.handlefct('pcmn', 'getFournisseur', params, function (res) {
+                onSuccessCb(res);
+            }, function () {
+                alert("Failed getFournisseur");
+            });
+        }
+        getExercices(onSuccessCb, onFailureCb) {
+            console.log("ComptaDialog::getExercices");
+            var params = { none: "" };
+            var url = this.Url();
+            var SupplReq = new AEBW.Json(url);
+            SupplReq.handlefct('exercice', 'getAll', params, function (response) { onSuccessCb(response); }, function () { onFailureCb("getExercices RequestFailed"); });
+        }
+        getCharge(onSuccessCb, onFailureCb) {
+            var _param = new services_1.Services.AccountListReqParams('6');
+            this._pcmn.getAccountList(_param, onSuccessCb, onFailureCb);
+        }
+        getBanks(onSuccessCb, onFailureCb) {
+            var _param = new services_1.Services.AccountListReqParams('512');
+            this._pcmn.getAccountList(_param, onSuccessCb, onFailureCb);
+        }
+        getCoproAccounts(onSuccessCb, onFailureCb, _acc = '450') {
+            var _param = new services_1.Services.AccountListReqParams(_acc);
+            this._pcmn.getAccountList(_param, onSuccessCb, onFailureCb);
+        }
+        getKeysCharge(onSuccessCb, onFailureCb) {
+            var params = {};
+            var url = this.Url();
+            var SupplReq = new AEBW.Json(url);
+            SupplReq.handlefct('syndic', 'getKeysCharge', params, function (response) {
+                try {
+                    onSuccessCb(response);
+                }
+                catch (e) {
+                    onFailureCb("Dialog::getKeysCharge Exception " + e.message);
+                }
+            }, function () {
+                onFailureCb("Dialog::getKeysCharge:: Failed getKeysCharge");
+            });
+        }
+        getLots(onSuccessCb, onFailureCb) {
+            var _param = new services_1.Services.DummyReqParams();
+            this._lots.list(_param, onSuccessCb, onFailureCb);
+        }
+        fillCombo(combo, result) {
+            combo.options.length = 0;
+            console.log("ComptaDialog::fillCombo");
+            for (var i = 0; i < result.length; i++) {
+                var item = result[i];
+                combo.options[combo.options.length] = new Option(item['acc_id'] + "-" + item['acc_desc'], item['acc_id']);
+            }
+        }
+        cleanTable(tb, sz) {
+            for (var i = 0; i < sz; i++) {
+                tb.delRow(0);
+            }
+        }
+    }
+    exports.ComptaDialog = ComptaDialog;
+});
diff --git a/app/compta/api/bank.php b/app/compta/api/bank.php
new file mode 100644
index 0000000..9a50292
--- /dev/null
+++ b/app/compta/api/bank.php
@@ -0,0 +1,55 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+require_once(dirname(__FILE__)."/../../common.php");
+require_once(dirname(__FILE__)."/../api_base.php");
+
+/**
+ * Api to retrieve information from the ledger books
+ * @package Compta
+ * @subpackage class
+ */
+class Bank extends Api {
+    private $precision = 2;
+    /**
+     * Default constructor
+     * @param Session $_session 
+     * @param Array   $_auth_cfg  Authentication parameter required to connect to the database
+     * @param string  $_db        Name of the database 
+     *
+     */
+    function __construct($_session,$auth_cfg,$db) {
+      parent::__construct($_session,$auth_cfg,$db);
+    }
+
+    /**
+     * \brief compute Solde of all bank accounts
+     * Also Débit and Crédit
+     */
+    public function getSolde()
+    {
+        $period = $this->getCurrentExercice();
+        $q = 'call solde_bank("'.$period.'");';
+        try 
+        {
+            $res = $this->doQueryI($q);
+        } catch (Exception $e)
+        {
+         error_log("Bank::getSolde Failed ".$period." ".$e->getMessage());       
+        }
+        return $res['records'];
+    }
+}
+
+?>
diff --git a/app/compta/api_base.php b/app/compta/api_base.php
new file mode 100644
index 0000000..e80df61
--- /dev/null
+++ b/app/compta/api_base.php
@@ -0,0 +1,153 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+require_once(dirname(__FILE__)."/../common.php");
+require_once(dirname(__FILE__)."/logging.php");
+require_once(dirname(__FILE__)."/../../phplib/class.db.php");
+require_once(dirname(__FILE__)."/../../phplib/class.validator.php");
+require_once(dirname(__FILE__)."/session.php");
+
+if (!defined('BASE_TYPE'))          define('BASE_TYPE','accounting_type');
+if (!defined('BASE_VERSION'))       define('BASE_VERSION','version');
+if (!defined('BASE_COUNTER'))       define('BASE_COUNTER','stmt_counter');
+if (!defined('BASE_PLAN'))          define('BASE_PLAN','pcg');
+if (!defined('BASE_TVA'))           define('BASE_TVA','tax_tva');
+
+/**
+ * API to record transaction. Maybe I'm missing some operations
+ * in the booking.
+ *
+ * - postTransation
+ * - newBill
+ * - payBill
+ * - Versement
+ * - appelFonds
+ * @package    Compta
+ * @subpackage classes
+ */ 
+class Api extends Db {
+    private $session = null;
+    private $log     = null;
+    /**
+     * Default contructor 
+     * @param Session $_session 
+     * @param Array   $_auth_cfg  Authentication parameter required to connect to the database
+     * @param string  $_db        Name of the database 
+     */
+    function __construct($_session,$auth_cfg,$db)  {
+        parent::__construct($auth_cfg[SQL_SERVER],$auth_cfg[SQL_USER],$auth_cfg[SQL_PASSWD],$db);
+        $this->session = $_session;
+        $this->log = Logging::getLogger("dbReq".$db.".txt");
+    }
+
+    /**
+     *
+     */
+    private function getConfig($field) {
+      $q = "SELECT cfg_value FROM Config WHERE  cfg_id = '".$field."';";
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Retrieve::getAccount ".$id." Failed ".$e->getMessage());
+      }
+      if (isset($res['records'][0]))
+      {
+          if (isset($res['records'][0][0]))
+          {
+              return $res['records'][0][0];
+          } else
+              error_log("getConfig: field ".$field." not set in database");
+      } else
+      {
+          error_log("getConfig: wierd field ".$field." not set in database");
+      }
+    }
+    /**
+     * get accounting base type
+     * either syndic,tpe,pme,church
+     */
+    function baseType() {
+      return $this->getConfig(BASE_TYPE);
+    }
+    /**
+     * get accounting base type
+     * either syndic,tpe,pme,church
+     */
+    function baseVersion() {
+      return $this->getConfig(BASE_VERSION);
+    }
+    /**
+     * get accounting base type
+     * either syndic,tpe,pme,church
+     */
+    function baseCounter() {
+      return $this->getConfig(BASE_COUNTER);
+    }
+
+    /**
+     * log API Information 
+     */
+    protected function logDebug($msg) {
+      $this->log->logDebug($msg);
+    }
+
+    /**
+     * log API Information 
+     */
+    protected function logInfo($msg) {
+      $this->log->logInfo($msg);
+    }
+    /**
+     * logging API transactions
+     */
+    protected function logTransaction($title,$msg) {
+      $this->log->logTransaction($title,$msg);
+    }
+
+    /**
+     * check wether or not the current user is part of
+     * the group SYNDIC,COPROPRIETAITE,LOCATAIRE, COMPTABLE, VENDEUR
+     * TRESORIER....
+     */
+    protected function in_groupe($grp) {
+      return $this->session->in_groupe($grp);
+    }
+    /**
+     * get Current Exercice period from session
+     */
+    protected function getCurrentExercice() {
+      return $this->session->getCurrentExercice();
+    }
+    /**
+     * set Current Exercice period from session
+     */
+    protected function setCurrentExercice($ex) {
+      return $this->session->setCurrentExercice($ex);
+    }
+    /**
+     * get Current Exercice period from session
+     */
+    protected function getId() {
+      return $this->session->id();
+    }
+    /**
+     * get Session 
+     */
+    protected function getSession() {
+      return $this->session;
+    }
+}
+?>
diff --git a/app/compta/api_booking.php b/app/compta/api_booking.php
new file mode 100644
index 0000000..a715c0c
--- /dev/null
+++ b/app/compta/api_booking.php
@@ -0,0 +1,365 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+require_once(dirname(__FILE__)."/api_base.php");
+
+
+/**
+ * API to record transaction. Maybe I'm missing some operations
+ * in the booking.
+ *
+ * - postTransation
+ * - newBill
+ * - payBill
+ * - Versement
+ * - appelFonds
+ * @package    Compta
+ * @subpackage classes
+ */ 
+class Booking extends Api {
+    /**
+     * Default contructor 
+     * @param Session $_session 
+     * @param Array   $_auth_cfg  Authentication parameter required to connect to the database
+     * @param string  $_db        Name of the database 
+     */
+    function __construct($_session,$auth_cfg,$db)  {
+        //parent::__construct($auth_cfg[SQL_SERVER],$auth_cfg[SQL_USER],$auth_cfg[SQL_PASSWD],$db);
+        parent::__construct($_session,$auth_cfg,$db);
+    }
+
+    /**
+     * This function is a copy of api_exercice Exercice::getDetails
+     * to retreive the details of an exercice
+     * @ref See api_execice
+     */
+    function getDetails($_ex) {
+      // period_id | per_begin  | per_end    | per_string
+      try {
+        $q = <<doQueryI($q);
+        $entries = $res['records'];
+        if (count($entries) == 0 ) {
+          error_log("Booking::getDetails Failed number of elements is 0");
+        }
+        return $entries;
+      } catch (Exception $e) {
+        error_log("Booking::getDetails Exception : ".$e->getMessage());
+        return Array("");
+      }
+    }
+
+    /**
+     * Verify the content of a transaction before processing it.
+     * - Transaction should be in the current exercice
+     * - Tranaction should not overlap exercices (except for the report a nouveau)
+     * - Validator  should be able to check date formats
+     * Validator will throw an exception !
+     * @param  objet   $trans The transaction
+     * @return boolean        True if all tests pass
+     */
+    private function verifyTransaction($trans) {
+      $period = $this->getCurrentExercice();
+      $detail = $this->getDetails($period);
+      // Validate date field
+      $v = new Validator();
+      $v->str_date($trans['act_trans_date'],_(" transaction date"));
+      $v->str_date($trans['voucher_date'],_(" voucher date"));
+      // than period
+      $year     = date("Y",strtotime($trans['act_trans_date']));
+      $current  = date("Y-m-d");
+      // TODO Must be improved to check the begin and end of period
+      if ($year != $period)
+      {
+        $this->logInfo("trans wrong period");
+        return false;
+      }
+
+      // Log a warning if the act_trans_date is not the current date
+      return true;
+    }
+    /**
+     *
+     */
+    private function deleteEntry($trans_id,$entry)
+    {
+      $entry_id = $entry['entry_id'];
+      $qe =<<<_EOF
+DELETE FROM  TransactionEntry
+WHERE trans_entry_id = {$entry_id};
+_EOF;
+      $this->logTransaction("Delete Transaction Entry",$qe);
+      $res = $this->doQueryI($qe);
+    }
+    /**
+     *
+     */
+    private function newEntry($trans_id,$entry,$act_date)
+    {
+      if ( isset($entry['key_charge']) ) 
+      {
+        $qe =<<<_EOF
+SET sql_mode="NO_ENGINE_SUBSTITUTION";
+INSERT INTO TransactionEntry(trans_id,acc_id,amount,debit_credit,entry_type,tret_key_id,entry_date) 
+VALUES ('{$trans_id}','{$entry['acc_id']}',{$entry['amount']},'{$entry['dc']}'
+       ,'{$entry['entry_type']}',{$entry['key_charge']},'{$act_date}');
+_EOF;
+        $this->logTransaction("New Transaction Entry",$qe);
+        $res = $this->doQueryI($qe);
+      } else {
+        $qe =<<<_EOF
+SET sql_mode="NO_ENGINE_SUBSTITUTION";
+INSERT INTO TransactionEntry(trans_id,acc_id,amount,debit_credit,entry_type,tret_key_id,entry_date) 
+VALUES ({$trans_id},{$entry['acc_id']},{$entry['amount']},'{$entry['dc']}'
+       ,'{$entry['entry_type']}',0,'{$act_date}');
+_EOF;
+        $this->logTransaction("New Transaction Entry",$qe);
+        $res = $this->doQueryI($qe);
+      }
+    }
+    /**
+     *
+     */
+    private function updateEntry($trans_id,$entry)
+    {
+      $entry_id = $entry['entry_id'];
+      if ( isset($entry['key_charge']) ) 
+      {
+        $qe =<<<_EOF
+SET sql_mode="NO_ENGINE_SUBSTITUTION";
+UPDATE TransactionEntry
+SET trans_id= '{$trans_id}'
+    ,acc_id= '{$entry['acc_id']}'
+    ,amount= {$entry['amount']}
+    ,debit_credit= '{$entry['dc']}'
+   ,entry_type= '{$entry['entry_type']}'
+   ,tret_key_id= {$entry['key_charge']}
+WHERE trans_entry_id = {$entry_id};
+_EOF;
+        $this->logTransaction("Update Transaction Entry",$qe);
+        $res = $this->doQueryI($qe);
+      } else {
+        $qe =<<<_EOF
+SET sql_mode="NO_ENGINE_SUBSTITUTION";
+UPDATE TransactionEntry
+SET trans_id= '{$trans_id}'
+    ,acc_id= '{$entry['acc_id']}'
+    ,amount= {$entry['amount']}
+    ,debit_credit= '{$entry['dc']}'
+   ,entry_type= '{$entry['entry_type']}'
+WHERE trans_entry_id = {$entry_id};
+_EOF;
+        $this->logTransaction("Update Transaction Entry",$qe);
+        $res = $this->doQueryI($qe);
+      }
+    }
+    /**
+     *
+     */
+    private function newTransaction($transi,$entries)
+    {
+	    $q =<<<_EOF
+SET sql_mode="NO_ENGINE_SUBSTITUTION";
+INSERT INTO Transactions (voucher_date,act_trans_date,trans_label) 
+VALUES ('{$transi['voucher_date']}','{$transi['act_trans_date']}','{$transi['trans_label']}');
+_EOF;
+      $this->logTransaction("New Transaction ",$q);
+      $res = $this->doQueryI($q);
+      $qlid= "select LAST_INSERT_ID();";
+      $res = $this->doQueryI($qlid);
+      $trans_id = $res['records'][0]['0'];
+
+      foreach($entries as  $entry) {
+        $this->newEntry($trans_id,$entry,$transi['act_trans_date']);
+      }
+      return $trans_id;
+    }
+    /**
+     * Update an existing transation.
+     * TODO: For security, I should provide a key a kind of hash that can attest that I'm modifying an existing transaction.
+     * I should not be able to modify a transation older than a month 
+     * @param integer $_id The id of the transaction to be updated
+     * @param Array   $_entries 
+     */
+    private function updateTransaction($transi,$entries)
+    {
+      $trans_id = $transi['trans_id'];
+      $q =<<<_EOF
+UPDATE Transactions 
+SET voucher_date='{$transi['voucher_date']}'
+   ,act_trans_date='{$transi['act_trans_date']}'
+   ,trans_label= '{$transi['trans_label']}'
+WHERE  trans_id= {$transi['trans_id']} ;
+_EOF;
+      $this->logTransaction("Update Transaction ",$q);
+      $res = $this->doQueryI($q);
+
+      foreach($entries as  $entry) {
+        if ($entry['entry_id'] == -1) {
+          $this->newEntry($trans_id,$entry,$transi['act_trans_date']);
+        } else if ( $entry['entry_id'] > 0) {
+          if ($entry['amount'] > 0.0)
+          {
+            $this->updateEntry($trans_id,$entry);
+          } else 
+          {
+            $this->deleteEntry($trans_id,$entry);
+          }
+        }
+      }
+      return $trans_id;
+    }
+
+    /**
+     * Create a new transation in the booking systems.
+     * TODO: There is a lack of verification in that function. 
+     * @param Array $transi   Transaction information
+     * @param Array $entries  Transaction entries
+     */
+    function postTransaction($transi,$entries)
+    {
+        $this->logInfo("Pre Booking postTransation : ");
+        if (! $this->in_groupe(COMPTA_SYNDIC) ) {
+           throw new Exception(_("Only syndic can post a transation in the organisation"));
+        }
+        if ( ! $this->verifyTransaction($transi) ) {
+           throw new Exception(_("Transaction belongs to another exercice. Wrong transaction date"));
+        }
+        $this->logInfo("Booking postTransation : ");
+        if (isset($transi['trans_id']))
+        {
+          $trans_id = $this->updateTransaction($transi,$entries);
+        } else {
+          $this->logInfo("new no Booking postTransation : ");
+          $trans_id = $this->newTransaction($transi,$entries);
+        } 
+        return Array('trans_id' => $trans_id);
+        // INSERT INTO TransactionEntry (trans_id,entry_date,entry_type,acc_id,amount,debit_credit,description) VALUES 
+        // (28,"2012-06-06","","620000",4.78,'d',"Poste Lettre recommand Immoval");
+    }
+
+    /**
+     *
+     *
+     * @param Array $transi   Transaction information
+     * @param Array $entries  Transaction entries
+     */
+    function newBill($transi,$entries) {
+        if (! $this->in_groupe(COMPTA_SYNDIC) ) {
+           throw new Exception(_("Only syndic can post a transation in the organisation"));
+        }
+        if ( ! $this->verifyTransaction($transi) ) {
+           throw new Exception(_("Transaction belongs to another exercice. Wrong transaction date"));
+        }
+         // Example of bill
+         // CALL insert_trans_facture
+         //                  ("2014-01-10","2014-01-10","Releve 37","616000","401007",182.46,"Matmut 1T 2014",1);
+         $qe = <<doQueryI($qe);
+        $this->logTransaction("Facture",$qe);
+        return Array('trans_id' => null);
+    }
+
+
+    /**
+     *
+     *
+     * @param Array $transi   Transaction information
+     * @param Array $entries  Transaction entries
+     */
+    function payBill($transi,$entries) {
+        if (! $this->in_groupe(COMPTA_SYNDIC) ) {
+           throw new Exception(_("Only syndic can post a transation in the organisation"));
+        }
+        if ( ! $this->verifyTransaction($transi) ) {
+           throw new Exception(_("Transaction belongs to another exercice. Wrong transaction date"));
+        }
+         // Example of bill
+         // CALL insert_trans_paye("2014-01-18","2014-01-18","CHEQUE 3472001","512001","401007",182.46,"Payer Matmut 1T 2014");
+         $qe = <<doQueryI($qe);
+        $this->logTransaction("Facture",$qe);
+        return Array('trans_id' => null);
+    }
+
+    /**
+     *
+     * @param Array $transi   Transaction information
+     * @param Array $entries  Transaction entries
+     */
+    function appelFonds($transi,$entries) {
+        if (! $this->in_groupe(COMPTA_SYNDIC) ) {
+           throw new Exception(_("Only syndic can post a transation in the organisation"));
+        }
+        if ( ! $this->verifyTransaction($transi) ) {
+           throw new Exception(_("Transaction belongs to another exercice. Wrong transaction date"));
+        }
+         // Example of Appel de fond
+         // CALL appel_fonds("2013-04-02","450001","701000",100,"Appel de fonds Mensuel avril");
+         $qe = <<doQueryI($qe);
+        $this->logTransaction("Appel de fonds",$qe);
+        return Array('trans_id' => null);
+    }
+    /**
+     *
+     * @param Array $transi   Transaction information
+     * @param Array $entries  Transaction entries
+     */
+    function Versement($transi,$entries) {
+        if (! $this->in_groupe(COMPTA_SYNDIC) ) {
+           throw new Exception(_("Only syndic can post a transation in the organisation"));
+        }
+        if ( ! $this->verifyTransaction($transi) ) {
+           throw new Exception(_("Transaction belongs to another exercice. Wrong transaction date"));
+        }
+         // Example of Appel de fond
+         //CALL insert_avance
+         //("2013-12-03","VIREMENT","512001","450003",150.00,"Versement Hentschel décembre");
+         error_log("Versement: Amount=".$transi->amount);      
+         $qe = <<doQueryI($qe);
+        $this->logTransaction("Versement copropriétaire ",$qe);
+        return Array('trans_id' => null);
+    }
+}
+
+/*
+ * vim: list et sw=4 ts=4:
+ */
+
+?>
diff --git a/app/compta/api_budget.php b/app/compta/api_budget.php
new file mode 100644
index 0000000..0f4ca6f
--- /dev/null
+++ b/app/compta/api_budget.php
@@ -0,0 +1,157 @@
+doQueryI($q);
+      error_log("getBudgets ".$this->db." Calls ".$res["total_matches"]);
+      return $res['records'];
+    }
+/**
+  trans_id		INTEGER AUTO_INCREMENT PRIMARY KEY,
+  voucher_ref		VARCHAR(255),
+  voucher_date		DATE,
+  act_trans_date	DATE,
+  per_id		INTEGER
+
+Transaction Entry
+  trans_entry_id 	INTEGER AUTO_INCREMENT PRIMARY KEY,
+  trans_id		INTEGER,
+  entry_date		DATE,
+  entry_type		VARCHAR(2),
+  acc_id		VARCHAR(32),
+  orig_amount		REAL,
+  amount		DOUBLE PRECISION,
+  debit_credit  	enum  ('d','c'),
+  description   	VARCHAR(255),
+  voucher_ref   	VARCHAR(255)
+  */
+    function getTransaction($id) {
+       $q ='select trans_id,voucher_ref,voucher_date from  Transaction where trans_id ='.$id.';';
+       $transaction = $this->doQueryI($q);
+       $q ='select trans_entry_id,acc_id,voucher_ref,description,debit_credit,amount from  TransactionEntry where trans_id ='.$id.';';
+       $entries = $this->doQueryI($q);
+        return array( 'transaction' => $transaction['records'], 'entries' => $entries['records']);
+    }
+
+
+
+    /**
+     * @brief 
+     */
+    function getBudgetEntries($cls,$anne) {
+        $q=<<doQueryI($q);
+        
+        return $res['records'];
+        //return array( 'records' => $res['records'] );
+
+    }
+
+    /**
+     * @brief 
+     */
+    function getEntriesByAccount($period,$acc) {
+        $q = 'call detail_compte_sans_solde("'.$period.'",'.$acc.');';
+        $res = $this->doQueryI($q);
+        if ($res['total_matches'] == 0) {
+            return array('entries'=> array(array(0,0,0,0,0)),'solde' =>array(0,0,0));
+        } 
+       // return $res['records'];
+       $q = 'CALL solde_compte("'.$period.'","'.$acc.'");';
+        $res1 = $this->doQueryI($q);
+       return array('entries' => $res['records'], 'solde' => $res1['records'][0]);
+    }
+
+    /**
+     * @brief 
+     */
+    function getSoldeAccount($period,$acc) {
+       $q = 'CALL solde_compte("'.$period.'","'.$acc.'");';
+       $res = $this->doQueryI($q);
+       return $res['records'][0];
+    }
+
+    /**
+     * @brief I should probably check if the period exists.
+     * If yes, I can add a new entry. Otherwise, may be ask the user to create
+     * the period first
+     */
+    function addBudget($anne,$desc) {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can add a new Budget"));
+      }
+      error_log("Buget::addBudget ".$anne." desc=".$desc);
+        $q = 'select per_id from Period where per_string = "'.$anne.'";';
+        $res = $this->doQueryI($q);
+        error_log("addBudget ".$anne." Called res= ".$res["records"][0][0]);
+        if ($res['records'][0][0] > 0) {
+            $pid   = $res['records'][0][0];
+            $q     = 'INSERT INTO  Budget (bu_period_id,bu_desc) VALUES('.$pid.',"'.$desc.'");';
+            $res   = $this->doQueryI($q);
+            $this->logTransaction("Budget Create",$q);
+            return $res;
+        } else {
+            // Return failure
+            error_log("addBudget Failed Exercice ".$anne." does not exists");
+            throw  new Exception(_("Exercice does not exists"));
+        }
+    }
+    /**
+     * @brief 
+     */
+    function removeBudget($id) {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can remove Budget"));
+      }
+        $q = 'DELETE FROM Budget WHERE bu_id = '.$id.';';
+        $q .= 'DELETE FROM BudgetEntry WHERE buet_budget_id = '.$id.';';
+        $res = $this->doQueryI($q);
+        $this->logTransaction("Budget Destroy",$q);
+        return array("");
+    }
+    /**
+     * @brief 
+     */
+    function addBudgetEntry($buet_id,$bu_id,$acc,$amount,$chrg) {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can add or replace a Budget entry"));
+      }
+        $q = "REPLACE INTO BudgetEntry (buet_id,buet_budget_id,buet_acc_id,buet_amount,buet_pc_id) VALUES (".$buet_id.",".$bu_id.",'".$acc."',".$amount.",".$chrg.");";
+        $res = $this->doQueryI($q);
+        $this->logTransaction("Budget Add Entry",$q);
+        return array("");
+    }
+}
+
+
+?>
diff --git a/app/compta/api_entretien.php b/app/compta/api_entretien.php
new file mode 100644
index 0000000..ae754a4
--- /dev/null
+++ b/app/compta/api_entretien.php
@@ -0,0 +1,90 @@
+session = $_session;
+    }
+
+    /**
+     * @bried Function related to maintenance
+     */ 
+    function get($period) {
+        $q = "SELECT entr_date,entr_title,entr_description,entr_id FROM Entretien as e ";
+        $j = "JOIN Period as p on p.per_string ='".$period."'";
+        $w = " WHERE entr_date BETWEEN p.per_begin and p.per_end;";
+        error_log("Entretien::get : ".$q.$j.$w);
+        $keys = $this->doQueryI($q.$j.$w);
+        if (count($keys['records']) == 0 ) {
+           return array("");
+        }
+          return $keys['records'];
+    }
+    /**
+     * @brief Create a new entretien entry in the database.
+     */
+    function create($dt,$title,$description) {
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can add or update an maintainence entry"));
+      }
+        $des = $this->escape($description);
+        $t = $this->escape($title);
+        $q  = "INSERT INTO Entretien (entr_date,entr_title,entr_description) VALUES (";
+        $qv = '"'.$dt.'",'.$t.','.$des.');';
+        $keys = $this->doQueryI($q.$qv);
+        if (count($keys['records']) == 0 ) {
+           return array("");
+        }
+          return $keys['records'];
+    }
+    /**
+     * @brief update en entry with maybe better title, better description
+     * and so on.
+     */
+    function update($id,$title,$description) {
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can add or update an maintainence entry"));
+      }
+        $des = $this->escape($description);
+        $t = $this->escape($title);
+        $q  = 'UPDATE Entretien SET entr_title='.$t.' ,entr_description = '.$des.'  WHERE ';
+        $qv = 'entr_id = '.$id.';';
+        $keys = $this->doQueryI($q.$qv);
+        if (count($keys['records']) == 0 ) {
+           return array("");
+        }
+          return $keys['records'];
+    }
+    /**
+     * @brief figure out under which circumstences this can be achieved
+     */
+    function remove($id) {
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can remove  an maintainence entry"));
+      }
+        $des = $this->escape($description);
+        $t = $this->escape($title);
+        $q  = 'DELETE FROM Entretien  WHERE ';
+        $qv = 'entr_id = '.$id.';';
+        $keys = $this->doQueryI($q.$qv);
+        if (count($keys['records']) == 0 ) {
+           return array("");
+        }
+          return $keys['records'];
+    }
+
+}
+?>
diff --git a/app/compta/api_exercice.php b/app/compta/api_exercice.php
new file mode 100644
index 0000000..f4017be
--- /dev/null
+++ b/app/compta/api_exercice.php
@@ -0,0 +1,224 @@
+ Is it required to have an open session for this request ?
+     * TODO: Check return code for proper error handling
+     */
+    function getAll($rien) {
+        // period_id | per_begin  | per_end    | per_string
+      try {
+        $q = "select per_id,per_begin,per_end,per_string,per_repart_charge_end,per_closed,per_approved from Period order by per_string; ";
+        $res = $this->doQueryI($q);
+        $entries = $res['records'];
+        if (count($entries) == 0 ) {
+          error_log("Exercice::getAll number of elements is 0");
+          return Array();
+        }
+        return $entries;
+      } catch (Exception $e) {
+        error_log("getExercices Exception : ".$e->getMessage());
+        return Array("");
+      }
+    }
+
+    function getDetails($_ex) {
+      // period_id | per_begin  | per_end    | per_string
+      try {
+        $q = <<doQueryI($q);
+        $entries = $res['records'];
+        if (count($entries) == 0 ) {
+          error_log("Exercice::getDetails Failed number of elements is 0");
+        }
+        return $entries;
+      } catch (Exception $e) {
+        error_log("Exercices::getDetails Exception : ".$e->getMessage());
+        return "";
+      }
+    }
+
+    /**
+     * @brief list exercices for current session.
+     * -> Is it required to have an open session for this request ?
+     * TODO: Check return code for proper error handling
+     */
+    function getClosed($_last) {
+        // period_id | per_begin  | per_end    | per_string
+      try {
+        if ($_last) {
+          $q=<<<_EOF
+SELECT per_id,per_begin,per_end,per_string,per_repart_charge_end,per_closed,per_approved 
+FROM   Period WHERE per_closed = 1 ORDER BY  per_string DESC LIMIT 1;
+_EOF;
+        } else {
+          $q=<<<_EOF
+SELECT per_id,per_begin,per_end,per_string,per_repart_charge_end,per_closed,per_approved 
+FROM   Period WHERE per_closed = 1 ORDER BY per_string;
+_EOF;
+        }
+        $this->logDebug("Exercice::getClosed q=".$q);
+        $res = $this->doQueryI($q);
+        $entries = $res['records'];
+        if (count($entries) == 0 ) {
+          $this->logDebug("Exercice::getClosed number of elements is 0");
+          return Array("");
+        }
+        return $entries;
+      } catch (Exception $e) {
+        throw new Exception("getExercices Exception : ".$e->getMessage());
+      }
+    }
+
+    /**
+     * @brief Add a new exercice in Period Table
+     * The action should be logged
+     */
+    function create($desc,$begin,$end) {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can add an exercice"));
+      }
+        $q = "INSERT INTO Period (per_string,per_begin,per_end) VALUES( ";
+        $qv= '"'.$desc.'","'.$begin.'","'.$end.'");';
+        $res = $this->doQueryI($q.$qv);
+        $entries = $res['records'];
+        $this->logTransaction("Exercice Create",$q.$qv);
+        if (count($entries) == 0 ) {
+          $this->logDebug(_("Exercice::create insert returns 0 elements"));
+          return Array("");
+        }
+        return $entries;
+    }
+
+    /**
+     * @brief this function removes the entry from Period table.
+     * All associated data in that period should also be dropped !!!!
+     *
+     * The action should be logged
+     */
+    function remove($_exercice) {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can remove an exercice"));
+      }
+        error_log("Exercice::removeExercice ".$_exercice);
+        $q = "DELETE FROM Period WHERE per_string = ";
+        $qv= '"'.$_exercice.'";';
+        $this->logTransaction("Exercice Remove",$q.$qv);
+        $res = $this->doQueryI($q.$qv);
+        $entries = $res['records'];
+        if (count($entries) == 0 ) {
+          error_log("removeExercice Failed number of elements is 0");
+        }
+        return Array("");
+    }
+  
+    /**
+     * @brief
+     * - Only syndic can close and open an exercice.
+     * - The exercice must be in state open.
+     * 
+     *   Action : Calls are reemboursed.
+     */
+    function closing($ex,$cpt="701000") {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can close an exercice"));
+      }
+      // Get current exerice details to work properly
+      $details = $this->getDetails($ex);
+      $exbegin = $details[1];
+      $exend   = $details[2];
+      $nex     = date("Y-m-d",strtotime("+367 days $exbegin"));
+      $d = date("Y-m-d");
+
+      $q=<<doQueryI($q);
+        // Now, closed the Period
+        $this->logTransaction("Exercice Closing Started",$q);
+    }
+
+    /**
+     * travail sur l'exerice courant. Soit sure qu'il n'est pas clos.
+     *
+     * TODO: verify the date af the exercice and the date of the 
+     * operation. We don't want any overlap
+     */
+    function repartirCharges() {
+      if (!$this->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can distribute charges in exercice"));
+      }
+      $ex = $this->getCurrentExercice();
+      // Get current exerice details to work properly
+      $details = $this->getDetails($ex);
+      $d = date("Y-m-d");
+      $q=<<<__EOF
+call repartir_charge_global("${d}","{$ex}");
+__EOF;
+        $keys = $this->doQueryI($q);
+        // Now the Transaction
+        $this->logTransaction("Exercice ".$ex." repartir Charge",$q);
+        return 0;
+    }
+    /**
+     * @brief update Session with new exercice.
+     *  -> exercice must exist !!!
+     *  -> ex parameter must be valide !
+     */
+    function  setCurrent($ex) {
+      $res = Array("");
+      error_log("Exercice:setCurrent enter "+$ex);
+      if ($ex != "" )
+      {
+        error_log("Exercice:setCurrent "+$ex);
+        /* Maybe call getDetails ... et check if I get a value */
+        $this->setCurrentExercice($ex);
+        $res = Array("exercice" => $ex);
+      }
+      return $res;
+    }
+
+}
+
+?>
diff --git a/app/compta/api_identity.php b/app/compta/api_identity.php
new file mode 100644
index 0000000..d984546
--- /dev/null
+++ b/app/compta/api_identity.php
@@ -0,0 +1,335 @@
+conf = $_auth_cfg;
+    }
+
+    /**
+     * Throw an exception if a field in not valide
+     */
+    protected function validate($var,$filter,$msg="",$reg="/[A-Za-z0-9\-].*/") {
+      if ($filter == FILTER_VALIDATE_EMAIL) {
+        if (!filter_var($var,$filter)) {
+                throw new Exception(_("Field validation failed ").$msg);
+        }
+      }
+      if ($filter == FILTER_VALIDATE_REGEXP) {
+        $opts=array("options" => array("regexp" => $reg));
+        if (!filter_var($var,$filter,$opts)) {
+                throw new Exception(_("Field validation does not match ").$msg);
+        }
+      }
+
+    }
+    /**
+     * @brief Parameters coming from user need to be validated or
+     * else I can be in trouble
+     *
+     */
+    protected function verifyInput($ident) {
+      // sanitize email first
+      $ident['email1'] = filter_var($ident['email1'],FILTER_SANITIZE_EMAIL);
+      $this->validate($ident['email1'],FILTER_VALIDATE_EMAIL," email 1 invalide");
+      if ($ident['email2'] != "") {
+        $ident['email2'] = filter_var($ident['email2'],FILTER_SANITIZE_EMAIL);
+        $this->validate($ident['email2'],FILTER_VALIDATE_EMAIL,"email 2 invalide");
+      }
+      $this->validate($ident['name'],FILTER_VALIDATE_REGEXP,"name invalide");
+      $this->validate($ident['firstname'],FILTER_VALIDATE_REGEXP,"fistname invalide");
+    }
+   /**
+    * Check if the organisation exists if not create it.
+    * Add the current user in the organization as admin or syndic ?
+    */
+   function createOrg( $ident) {
+       // Check if exists
+        $qorg=<<doQueryI($qorg);
+       if ($res['total_matches'] != 0 ) {
+         throw new Exception(_("create organisation failed. The entry already exists."));
+         error_log("Identity::createOrg org does not exists"); 
+       }
+       // Create new entry
+       $q=<<doQueryI($q);
+     $orgid  = $this->insert_id();
+     $id     = $this->session->id();
+     $dbname = "SYNDIC_".$orgid;
+     /* Initial setup set Database name, make use syndic of it and create database */
+     $q1  =<<doQueryI($q1);
+     /* Check if OK */
+     error_log("Identity::CreateOrg TODO Check if Ok");
+     $this->switchOrg($orgid);
+     $this->createDatabase($dbname,$orgid);
+     $this->createPcmn($dbname,$orgid);
+     return array("org_id" => $orgid);
+  }
+  
+
+  function createDatabase($ndb,$orgid) {
+    GLOBAL $Xml_Compta_Schema;
+    require_once(dirname(__FILE__)."/schema_mysql.php");
+    require_once(dirname(__FILE__)."/class.schema.php");
+    $schema = new Schema($this->conf,$ndb,$Xml_Compta_Schema);
+    $schema->recreateCompta($orgid);
+  }
+
+  function createPcmn($ndb,$orgid) {
+    GLOBAL $Xml_Pcmn_Compta ;
+    require_once(dirname(__FILE__)."/schema_pcmn_syndic_mysql.php");
+    require_once(dirname(__FILE__)."/class.schema.php");
+    $schema = new Schema($this->conf,$ndb,$Xml_Pcmn_Compta);
+    $schema->recreateCompta($orgid);
+  }
+  /* 
+   * @brief Basic function that allows the user to work on several accounting systems
+   */
+  function switchOrg( $org) {
+    // Check if the organisation exists and that I'm part of it.
+    $dbs = $this->getApplicationDbs();
+    for ($i = 0 ; $i < count($dbs) ; $i++) {
+      if ($dbs[$i][0] == $org) {
+        $this->session->setOrganizationId($dbs[$i][0]);
+        // Found switch and exit
+        $_SESSION["compta_org"] = $dbs[$i][0];
+        $_SESSION["compta_name"] = $dbs[$i][1];
+        error_log("switchOrg: Org id :".$dbs[$i][0]." Name=".$dbs[$i][1]." Db Name=".$dbs[$i][2]);
+        $roles  = $this->getUserRolesInOrg( $this->session->id(),$_SESSION['compta_org']);
+        return $dbs[$i];
+      }
+    }
+    throw new Exception(_("Unkown organisation for user"));
+  }
+
+  /**
+   *
+   */
+  function currentOrg () {
+   if (isset($_SESSION["compta_org"]) ){
+     return array($_SESSION["compta_org"],$_SESSION['compta_name']);
+   } else {
+     throw new Exception(_("No organisation defined for you"));
+   }
+  }
+
+  /**
+   * @brief check id user Exists. If so, set second parameter with $user_id
+   * This function should not be called 
+   */
+  protected function existsUser($ident, &$id) {
+      $_ret = false;
+      error_log("exists::User");
+      if (! (isset($ident['name']) &&  $ident['name'] != "")  ) {
+        error_log("exists::User name is empty or unset");
+        return false;
+      }
+      if (! (isset($ident['firstname']) &&  $ident['firstname'] != "")  ) {
+        error_log("exists::User firstname is empty or unset");
+        return false;
+      }
+      if (! (isset($ident['email1']) &&  $ident['email1'] != "")  ) {
+        error_log("exists::User email is empty or unset");
+        return false;
+      } else {
+        $this->validate($ident['email1'],FILTER_VALIDATE_EMAIL,"email1");
+      }
+      $checkQuery=<<<__EOF
+SELECT COALESCE(ident_id,0) FROM Identity WHERE ident_type=1 AND
+  (ident_name="{$ident['name']}" AND ident_firstname="{$ident['firstname']}"
+   OR ident_email1 = "{$ident['email1']}"
+  );
+__EOF;
+       $res = $this->doQueryI($checkQuery);
+       if ($res['records'][0][0] != 0 ) {
+           $id = $res['records'][0][0];
+           $_ret = true;
+       }
+       return $_ret;
+  }
+
+  /**
+   * @brief Is $org_id required ? I this yes. However,
+   * be sure, it's equal to current session of
+    */
+  function addUserInOrg($org_id,$ident,$_update) {
+    $_ret = "";
+    $org  = $org_id;
+    error_log("Identity::addUserInOrg ... org=".$org_id." name=".$ident['name']." email=".$ident['email1'] );
+    $this->verifyInput($ident);
+    if (! $this->session->in_groupe(COMPTA_SYNDIC) ) {
+       error_log("Identity::addUserInOrg User is not syndic !!!");
+       throw new Exception(_("Only syndic can add a user in organisation"));
+    }
+    if ($org == 0 ) {
+       // Check if there is an org in session if not, die 
+       if (isset($_SESSION['compta_org'])) {
+         $org = $_SESSION['compta_org'];
+       } else {
+         error_log("FAILED compta_org is not defined");
+         throw new Exception(_("ORGANISATION NOT DEFINED"));
+       } 
+    }
+    error_log("Identity::addUserInOrg check organization ");
+    // Check that $org == currentOrg from session
+    if ($this->session->getOrganizationId() != $org_id ) {
+      error_log("Identity::addUserInOrg wrong org=".$org_id." update=".$_update);
+      throw new Exception(_("Wrong organisation nice try"));
+    }
+    // Check if User exists
+    $id = 0; 
+    if (! $this->existsUser($ident , $id) ) {
+        error_log("Identity::addUserInOrg ... org=".$org_id." update=".$_update);
+        // User Does not exists ! create it 	
+        $q=<<doQueryI($q);
+        $id  = $this->insert_id();
+    } else {
+        // User exists Should I replace or investage ?
+        // throw new Exception(_("User creation failed. The entry already exists."));
+        error_log("Identity::addUserInOrg ... user exists id=".$id." update=".$_update);
+        $_ret = _("User already registered");
+        if ($_update)
+        {
+          $q=<<doQueryI($q);
+         }
+    }
+    error_log("Alright Update userRole for uid ".$id);
+    // Attach right role to user if not update
+    if ( ! $_update) {
+      $q1  =<<doQueryI($q1);
+    }
+    return array("");
+  }
+
+  /**
+   * @brief user must exists. remove all roles first,
+   * the remove identity. Only the user itself can remove
+   * the data or ?
+   * The syndic can only remove the the user from the 
+   * organisation. Not the identity.
+   */  
+  function removeUserFromOrg($uid,$with_ident= false) {
+    if (! $this->session->in_groupe(COMPTA_SYNDIC) ) {
+       throw new Exception(_("Only syndic can add a user in organisation"));
+    }
+    // Attach right role to user
+    $q1  =<<doQueryI($q1);
+
+   }
+
+   /**
+    *
+    */
+   function getUsersRole($role) {
+     $q =<<org} 
+  LEFT JOIN UserRoles as ur on u.ident_id = ur.ur_user_id and ur.ur_role_id = {$role} and ur.ur_org_id ={$this->org}
+   GROUP BY u.ident_id ;
+EOF;
+      $res = $this->doQueryI($q);
+      return $res["records"];
+   }
+
+   function setUserRole($oid,$uid,$role) {
+     if (! $this->session->in_groupe(COMPTA_SYNDIC) ) {
+       throw new Exception(_("Only syndic can change role in organisation"));
+     }
+     if (isset($_SESSION['compta_org'])) {
+         $org = $_SESSION['compta_org'];
+     } else {
+         error_log("FAILED compta_org is not defined");
+         throw new Exception(_("ORGANISATION NOT DEFINED TO SET ROLE"));
+     } 
+     if ($uid == 0) {
+         error_log("FAILED setUserRole : uid is 0");
+         throw new Exception(_("Cannot Set role for uid 0"));
+     }
+     $q=<<doQueryI($q);
+      return array("");
+   }
+   /**
+    * @brief By doing this
+    */
+   function resetUserRole($oid,$uid,$role) {
+     if (! $this->session->in_groupe(COMPTA_SYNDIC) ) {
+       throw new Exception(_("Only syndic can change role in organisation"));
+     }
+     if (isset($_SESSION['compta_org'])) {
+         $org = $_SESSION['compta_org'];
+     } else {
+         error_log("FAILED compta_org is not defined");
+         throw new Exception(_("ORGANISATION NOT DEFINED TO SET ROLE"));
+     } 
+     if ($uid == 0) {
+         error_log("FAILED setUserRole : uid is 0");
+         throw new Exception(_("Cannot Set role for uid 0"));
+     }
+     $q=<<doQueryI($q);
+      return array("");
+   }
+}
+
+?>
diff --git a/app/compta/api_loan.php b/app/compta/api_loan.php
new file mode 100644
index 0000000..661e1e1
--- /dev/null
+++ b/app/compta/api_loan.php
@@ -0,0 +1,138 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+require_once(dirname(__FILE__)."/../common.php");
+require_once(dirname(__FILE__)."/api_base.php");
+
+/**
+ * Api to retrieve information from the ledger books
+ * @package Compta
+ * @subpackage class
+ */
+class Loan extends Api {
+    private $precision = 2;
+    /**
+     * Default constructor
+     * @param Session $_session 
+     * @param Array   $_auth_cfg  Authentication parameter required to connect to the database
+     * @param string  $_db        Name of the database 
+     *
+     */
+    function __construct($_session,$auth_cfg,$db) {
+      parent::__construct($_session,$auth_cfg,$db);
+    }
+
+    /**
+     * \brief, return the list of loans
+     * TODO: Not sure if it's the right place
+     */
+    function getList()
+    {
+      $q =<<<_EOF
+SELECT ln_id,ln_date,ln_amount,ln_rate,ln_duree,ln_desc from `Loan` as l
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Pret::get ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'];
+    }
+
+    /**
+     *
+     * TODO: Not sure if it's the right place
+     * @return Array(date,amount,rate
+     *               ,duration,description,total interest
+     *               ,interest left,month left,next payment
+     *               ,capital)
+     */
+    function getSummary($loanId)
+    {
+      // Get the loan general info
+      $q =<<<_EOF
+SELECT ln_date as d 
+      ,ln_amount as amount 
+      ,ROUND(ln_rate * 100,3)
+      ,ln_duree
+      ,ln_desc
+      ,ROUND(SUM(le1.le_interest),2) as interet
+      ,ROUND(SUM(CASE WHEN (le1.le_date) > DATE(NOW()) THEN le1.le_interest ELSE 0.0 END),2) as restant 
+      ,( ln_duree - (MONTH( DATE(NOW()) - DATE(ln_date)  ) ) ) as mr
+      , le2.le_date
+      , le2.le_value
+FROM `Loan`  AS l
+JOIN LoanEntry AS le1 ON l.ln_id = le1.le_loan_id
+LEFT JOIN LoanEntry as le2 ON (l.ln_id = le2.le_loan_id) AND le2.le_date = DATE_ADD(ln_date,INTERVAL ( MONTH(DATE(NOW()) - ln_date  )  ) MONTH)
+WHERE ln_id = {$loanId} ORDER BY le1.le_date;
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Pret::getSummary ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'][0];
+    }
+
+    /**
+     * mark the loan entry as booked eg payed.
+     *
+     * @return TODO
+     */
+    function markBooked($leid)
+    {
+        $q =<<<_EOF
+UPDATE LoanEntry SET le_booked = 1 WHERE le_id = {$leid} ;
+_EOF;
+        try {
+            $res = $this->doQueryI($q);
+        } catch (Exception $e) {
+            error_log("Pret::markBooked ".$id." Failed ".$e->getMessage());
+        }
+    }
+
+    /**
+     * retrieve the next non payed entry for the loan.
+     *
+     */
+    function getNextPayement($loanId)
+    {
+      $q =<<<_EOF
+SELECT ln_date as d 
+      ,ln_desc
+      ,ln_acc_bank as acc_bank
+      ,ln_acc_charge as acc_charge
+      ,ln_acc_capital as acc_capital
+      ,le1.le_id
+      ,le1.le_date
+      ,le1.le_annuite
+      ,le1.le_interest
+      ,le1.le_ammorti
+      ,le1.le_value
+FROM `Loan`  AS l
+JOIN LoanEntry AS le1 ON l.ln_id = le1.le_loan_id
+WHERE ln_id = {$loanId} AND le1.le_booked = 0 ORDER BY le1.le_date LIMIT 1;
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Pret::getSummary ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'][0];
+
+    }
+}
+
+?>
diff --git a/app/compta/api_pcmn.php b/app/compta/api_pcmn.php
new file mode 100644
index 0000000..158452a
--- /dev/null
+++ b/app/compta/api_pcmn.php
@@ -0,0 +1,220 @@
+auth_conf = $auth_cfg;
+    parent::__construct($_session,$auth_cfg,$db);
+  }
+  /**
+   *
+   */
+  protected function accExists($acc) {
+    $qe =<<<__EOF
+select acc_id from Account where acc_id = "{$acc}";
+__EOF;
+    $res    = $this->doQueryI($qe);
+    return $res['total_matches'] > 0;
+  }
+  /**
+   * @brief add an account in the book.
+   * -> The account must not exists.
+   * -> I need to know if the new account is added beside or below an
+   *    existing account.
+   * -> The request needs to be logged 
+   */
+  function addAccount($num,$libelle,$parent,$_under = 1) {
+    $v = new Validator();
+    $v->str($libelle,_(" account description"));
+    $v->num_int($num,_(" new account number"));
+    $v->num_int($parent,_(" parent account number"));
+    error_log("Pcmn::addAccount TODO needs to be coded ".$num." p=".$parent);
+    $q= "";
+    if ( $_under == 1) {
+    $q =<<<__EOF
+call account_insert_below("","{$parent}","{$num}","{$libelle}");
+__EOF;
+    } else {
+    $q =<<<__EOF
+call account_insert_beside("","{$parent}","{$num}","{$libelle}");
+__EOF;
+    }
+    /* Check if account exists */
+    if ($this->accExists($num) ) {
+      error_log("Account exists Aii");
+      throw new Exception("Le compte ".$num." Existe deja");
+    }
+    $this->logTransaction("Pcmn add account ",$q);
+    $res    = $this->doQueryI($q);
+    return 0;
+  }
+
+  function updateAccountName($acc_id,$_name) {
+    $v = new Validator();
+    $v->str($_name,_(" account description"));
+    $v->num_int($acc_id,_(" account number must be a number"));
+
+    $q =<<<__EOF
+UPDATE Account set acc_name= "{$_name}" WHERE acc_id = "{$acc_id}";
+__EOF;
+    $this->logTransaction("Pcmn update account ",$q);
+    $res    = $this->doQueryI($q);
+    return 0;
+
+  }
+  /**
+   *
+   */
+  function getAccount() {
+    error_log("Pcmn::getAccount TODO needs to be coded");
+      return array(
+          'acc_id' => '401001',
+          'acc_desc'   => 'test',
+          'acc_type'     => 'Charge',
+    );
+  }
+  /**
+   * @brief only delete an account that's closed !! and that's not used
+   * by any exercice !!
+   */
+  function deleteAccount($num) {
+    error_log("Pcmn::deleteAccount TODO needs to be coded");
+    $q = 'call account_delete("'.$num.'");';
+    $this->logTransaction("Pcmn delete account ",$q);
+    $res    = $this->doQueryI($q);
+    $ident = $res['records'];
+    return  array('acc_id' => $num,'acc_desc' =>'Deleted ');
+  }
+  /**
+   *
+   */
+  function getAccountInfo($identity) {
+    global $conf;
+    $_cfg = $conf['auth']['mysql'];
+    if (isset($_SESSION['compta_org'])) {
+      require_once(dirname(__FILE__)."/../member/class.json_db_user.php");
+      $u = new JsonUser($this->getSession(), $this->auth_conf);
+      $res = $u->getOrg($_SESSION["compta_org"]);
+      $q = $res[0]; 
+      return array('act' => $q[0] ,
+        'addr'   => $q[1],
+        'cp'     => $q[2],
+        'ville'  => $q[3] ,
+        'region' => '',
+        'pays'   => '',
+        'siret'  => '0',
+        'ape'    => '0',
+        'actv'    => 'SYNDIC 25 RUE PFEFFINFER'
+        );
+    } else 
+      return array('act' => 'Not Found',
+        'addr'   => 'Not Defined',
+        'cp'     => '',
+        'ville'  => '',
+        'region' => '',
+        'pays'   => '',
+        'siret'  => '0',
+        'ape'    => '0',
+        'actv'    => ''
+    );
+  }
+  /**
+   * @brief returns the leaf accounts if 
+   * $tree is set to 0. or else return
+   * the whole tree
+   * Wow, if user is not SYNDIC, only return the accounts 
+   * belonging to the user!
+   */
+  function getAccountList($category, $tree=0) {
+    $v = new Validator();
+    $this->logDebug("Pcmn::GetAccountList Start ".$category);
+    if (strlen($category) > 0) {
+      $v->num_int($category,_(" category must be a number or empty"));
+    }
+    //$v->num_int($tree,_(" tree must be 0 or 1 (".$tree.")"));
+    /* Missing period in query */
+    if (!$this->in_groupe(COMPTA_SYNDIC)) {
+      $q=<<<__EOF
+SELECT acc_id,acc_name FROM Account as a
+  JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id where jia_ident = {$this->getId()};
+__EOF;
+    } else {
+      if ($tree != 0 ){
+        $q = 'call account_get_tree("'.$category.'");';
+      } else {
+        $q = 'call account_get_leafs("","'.$category.'%");';
+      }
+    }
+    $this->logDebug("Pcmn::GetAccountList Query:".$q);
+    $res    = $this->doQueryI($q);
+    $ident = $res['records'];
+    $arr = array();
+    foreach ($ident as $row)
+    {
+      if ($tree != 0 ) {
+        array_push($arr,array('acc_id' => $row[0]
+          , 'acc_desc'  => $row[1]
+          , 'acc_level' => $row[2])
+        );
+      } else {
+        array_push($arr,array('acc_id' => $row[0]
+          , 'acc_desc' => $row[1])
+        );
+      }
+    }
+    return $arr;
+  }
+
+  function getFournisseur($opt)
+  {
+     $q1=<<<_EOF
+SELECT res.Compte,res.Description,res.Debit, res.Credit, res.Debit - res.Credit as Solde 
+FROM (SELECT a.acc_id as Compte ,a.acc_name as Description 
+      , ROUND (SUM(CASE WHEN te.debit_credit = 'd' THEN te.amount ELSE 0.0 END),2) As Debit 
+      , ROUND(SUM(CASE WHEN te.debit_credit = 'c' THEN te.amount ELSE 0.0 END),2) As Credit 
+      FROM Account as a JOIN Period as p on p.per_string = "2021" 
+      LEFT JOIN Transactions as t on t.act_trans_date BETWEEN p.per_begin and p.per_end 
+      LEFT JOIN TransactionEntry as te ON te.trans_id = t.trans_id AND te.acc_id = a.acc_id 
+      WHERE a.acc_id like "401%" or a.acc_id like "460%" and te.entry_type != 'AN' 
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end GROUP BY a.acc_id) as res;
+_EOF;
+
+      $res    = $this->doQueryI($q1);
+      $ident = $res['records'];
+      $arr = array();
+      foreach ($ident as $row)
+      {
+        array_push($arr,array('acc_id' => $row[0], 'acc_desc' => $row[1],'solde' =>$row[4]));
+      }
+      return $arr;
+  }
+  /**
+   *
+   */
+  function getBilan($period) {
+      $q="CALL bilan('".$period."');";
+      $res    = $this->doQueryI($q);
+      return $res['records'];
+
+  }
+  /**
+   *
+   */
+  function initDatabase() {
+  }
+}
+?>
diff --git a/app/compta/api_recurrent.php b/app/compta/api_recurrent.php
new file mode 100644
index 0000000..481588e
--- /dev/null
+++ b/app/compta/api_recurrent.php
@@ -0,0 +1,145 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+require_once(dirname(__FILE__)."/../common.php");
+require_once(dirname(__FILE__)."/api_base.php");
+
+/**
+ * Api to retrieve information from the ledger books
+ * @package Compta
+ * @subpackage class
+ */
+class Recurrent extends Api {
+    private $precision = 2;
+    /**
+     * Default constructor
+     * @param Session $_session 
+     * @param Array   $_auth_cfg  Authentication parameter required to connect to the database
+     * @param string  $_db        Name of the database 
+     *
+     */
+    function __construct($_session,$auth_cfg,$db) {
+      parent::__construct($_session,$auth_cfg,$db);
+    }
+
+    /**
+     * \brief, return the list of loans
+     * TODO: Not sure if it's the right place
+     */
+    function getList()
+    {
+      $q =<<<_EOF
+SELECT r_id,r_date,r_amount,r_desc,r_next,r_end from `Recurrent` as l
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Recurrent::getList ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'];
+    }
+
+    /**
+     * \brief, return the list of loans
+     * TODO: Not sure if it's the right place
+     */
+    function get($rid)
+    {
+      $q =<<<_EOF
+SELECT r_id,r_date,r_amount,r_desc,r_next,r_end from `Recurrent` as l WHERE r_id = {$rid}
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Recurrent::get ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'][0];
+    }
+    /**
+     *
+     * TODO: Not sure if it's the right place
+     * @return Array(date,amount,rate
+     *               ,duration,description,total interest
+     *               ,interest left,month left,next payment
+     *               ,capital)
+     */
+    function getSummary($recId)
+    {
+      // Get the loan general info
+      $q =<<<_EOF
+SELECT  re_id
+      , re.re_entry_type
+      , re.re_acc
+      , re.re_amount
+      , re.re_debit_credit
+      , a.acc_name
+FROM `RecurrentEntry`  AS re
+JOIN Account as a ON re.re_acc = a.acc_id
+WHERE re_rec_id = {$recId};
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Recurrent::getSummary ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'];
+    }
+
+    /**
+     * mark the loan entry as booked eg payed.
+     *
+     * @return TODO
+     */
+    function markBooked($recId)
+    {
+        $q =<<<_EOF
+UPDATE Recurrent SET r_next = DATE_ADD(r_next,INTERVAL r_period MONTH ) WHERE r_id = {$recId} ;
+_EOF;
+        try {
+            $res = $this->doQueryI($q);
+        } catch (Exception $e) {
+            error_log("Recurrent::markBooked ".$id." Failed ".$e->getMessage());
+        }
+    }
+
+    /**
+     * retrieve the next non payed entry for the loan.
+     *
+     */
+    function getNextPayement($recId)
+    {
+      $q =<<<_EOF
+SELECT r.r_date as d
+      ,r.r_next as next
+      ,r.r_desc 
+      ,re.re_entry_type
+      ,re.re_debit_credit
+      ,re.re_acc
+      ,re.re_amount
+FROM `Recurrent`  AS r
+JOIN RecurrentEntry AS re ON r.r_id = re.re_rec_id
+WHERE r.r_id = {$recId};
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Recurrent::getNextPayement ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'];
+
+    }
+}
+
+?>
diff --git a/app/compta/api_retrieve.php b/app/compta/api_retrieve.php
new file mode 100644
index 0000000..b9cad96
--- /dev/null
+++ b/app/compta/api_retrieve.php
@@ -0,0 +1,319 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+require_once(dirname(__FILE__)."/../common.php");
+require_once(dirname(__FILE__)."/api_base.php");
+
+/**
+ * Api to retrieve information from the ledger books
+ * @package Compta
+ * @subpackage class
+ */
+class Retrieve extends Api {
+    private $precision = 2;
+    /**
+     * Default constructor
+     * @param Session $_session 
+     * @param Array   $_auth_cfg  Authentication parameter required to connect to the database
+     * @param string  $_db        Name of the database 
+     *
+     */
+    function __construct($_session,$auth_cfg,$db) {
+      parent::__construct($_session,$auth_cfg,$db);
+    }
+
+    /**
+     *
+     * TODO: Not sure if it's the right place
+     */
+    function getAllAccounts($transInfo,$entries) {
+    }
+
+    /**
+     * @brief returns an array index 0 is account index 1 is user_id
+     */
+    function getAccount($id) {
+      $q =<<<_EOF
+SELECT acc_id ,jia.`jia_ident` from `Account` as a
+  JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id where jia.`jia_ident`={$id};
+_EOF;
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+        error_log("Retrieve::getAccount ".$id." Failed ".$e->getMessage());
+      }
+      return $res['records'][0];
+    }
+
+    /**
+      trans_id		INTEGER AUTO_INCREMENT PRIMARY KEY,
+      voucher_ref		VARCHAR(255),
+      voucher_date		DATE,
+      act_trans_date	DATE,
+      per_id		INTEGER
+
+    Transaction Entry
+      trans_entry_id 	INTEGER AUTO_INCREMENT PRIMARY KEY,
+      trans_id		INTEGER,
+      entry_date		DATE,
+      entry_type		VARCHAR(2),
+      acc_id		VARCHAR(32),
+      orig_amount		REAL,
+      amount		DOUBLE PRECISION,
+      debit_credit  	enum  ('d','c'),
+      description   	VARCHAR(255),
+      voucher_ref   	VARCHAR(255)
+      */
+    function getTransaction($id) {
+      $period = $this->getCurrentExercice();
+      $q =<<<_EOF
+SELECT trans_id,voucher_ref,voucher_date,act_trans_date,trans_label  
+  FROM Transactions 
+  WHERE trans_id ='{$id}';
+_EOF;
+      $transaction = $this->doQueryI($q);
+      $q =<<<_EOF
+SELECT trans_entry_id,entry_date,te.acc_id,acc.acc_name,debit_credit,amount 
+  FROM TransactionEntry AS te 
+  JOIN Account          AS acc ON  acc.acc_id = te.acc_id 
+  WHERE trans_id ='{$id};'
+_EOF;
+      $entries = $this->doQueryI($q);
+      return array( 'transaction' => $transaction['records'][0], 'entries' => $entries['records']);
+    }
+
+    /**
+     * TODO: Clarify the Purpose of this function
+     *
+     */
+    function getTransactionSummary($_amount,$_offset) {
+      $period = $this->getCurrentExercice();
+      return array( 'transaction' => $transaction['records'], 'entries' => $entries['records']);
+    }
+
+    /**
+     * @brief get transacations by type. Should the result be limited ?
+     * returns an array of entries
+     *   trans_id,act_trans_date,trans_label,Debit,Credit,Solde
+     */
+    function getTransactionByType($_ttype,$_amount,$_offset = 0) {
+      $period = $this->getCurrentExercice();
+      $this->logDebug("getTransactionByType enter ".$_ttype." amount ".$_amount);
+      $q=<<<_EOF
+SELECT t.trans_id, t.act_trans_date, trans_label ,
+        ROUND(sum(CASE WHEN ti.debit_credit='d' THEN ti.amount ELSE 0 END),{$this->precision}) AS Debit, 
+        ROUND(sum(CASE WHEN ti.debit_credit='c' THEN ti.amount ELSE 0 END),{$this->precision}) AS Credit,
+        CASE WHEN
+           sum(CASE WHEN ti.debit_credit='d' THEN ti.amount ELSE 0 END) > sum(CASE WHEN ti.debit_credit='c' THEN ti.amount ELSE 0 END) > 0
+         THEN
+           -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),{$this->precision})
+             ELSE
+           ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),{$this->precision}) 
+        END             AS Solde
+        
+  FROM Transactions     AS t
+  JOIN Period           AS p  ON t.voucher_date between p.per_begin AND  p.per_end 
+  JOIN TransactionEntry AS ti ON t.trans_id = ti.trans_id 
+ WHERE ti.`entry_type`= '{$_ttype}' and p.`per_string` ="{$period}" group by trans_id order by t.act_trans_date DESC
+ LIMIT {$_amount} OFFSET {$_offset}
+  ;  
+_EOF;
+      $entries = $this->doQueryI($q);
+      // Compute total
+      $q=<<<_EOF
+SELECT COUNT(*) FROM (SELECT t.trans_id
+  FROM Transactions as t
+  JOIN Period as p on t.`voucher_date` between p.per_begin AND  p.per_end 
+  JOIN TransactionEntry as ti on t.trans_id = ti.trans_id where ti.`entry_type`= '{$_ttype}' and p.`per_string` ="{$period}" group by trans_label order by voucher_date
+  ) sub;  
+_EOF;
+      $total = $this->doQueryI($q);
+      foreach ($entries['records'] as $row) {
+        $t[] = array('id'=>$row[0] , 'date'=> $row[1],'label' => $row[2],'debit' => $row[3]);
+      }
+      return array( 'transaction' => $t, 'total' => $total['records'][0][0]);
+    }
+
+    /**
+     * Retrieve the transactions of the specific date
+     * @param string $date Should be a valide date
+     * TODO: There is a bug in the second request. $id is undefined
+     */
+    function getTransactionsByDate($date) {
+      $q ='SELECT trans_id,voucher_ref,voucher_date,act_trans_date,trans_label FROM  Transaction where act_trans_date ='.$date.';';
+      $transaction = $this->doQueryI($q);
+      $q ='SELECT trans_entry_id,acc_id,voucher_ref,description,debit_credit,amount FROM  TransactionEntry where trans_id ='.$id.' ;';
+      $entries = $this->doQueryI($q);
+      return array( 'transaction' => $transaction['records'], 'entries' => $entries['records']);
+    }
+
+    /**
+     * TODO This function does not work
+     * @param string $period The year we want to get the transactions from
+     *
+     */
+    function getTransactionsByIds() {
+      $period = $this->getCurrentExercice();
+      $q = 'call journal("'.$period.'","'.$type.'",'.$this->precision.');';
+    }
+
+    /**
+     * 
+     * TODO does not work if user does not have Lots assigned. 
+     * This causes a probleme when two users share the same account !
+     * that's certainly why I removed it.
+     */
+    function getSoldeCharge() {
+      $period = $this->getCurrentExercice();
+      $q =<<getId()},0,"{$period}",2);
+EOF;
+      $this->logDebug("getSoldeCharge req : ".$q);
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+         error_log("Retrieve::getSoldeCharge Failed ".$period." ".$e->getMessage());       
+      } 
+      return $res['records'][0];	
+    }
+
+    /**
+     * @brief called by page_ledger first
+     */
+    function getSoldeBank() {
+      $this->logDebug("retrive::getSoldBank  " );
+      $period = $this->getCurrentExercice();
+      $q =<<doQueryI($q);
+      } catch (Exception $e) {
+         error_log("Retrieve::getSoldeBank Failed call journal".$period." ".$e->getMessage());       
+      } 
+      $this->logDebug("retrive::getSoldBank  ".$period." total m=".$res['total_matches'] );
+      return $res['records'];	
+    }
+
+    /**
+     * Return all entries of the specific type. Eg all account operations
+     * TODO: review this function. It seems to crash when the number of rows is too big.
+     * I notices that is fails 
+     * @param string $period
+     * @param string $type    One of the types returned by getEntryTypes
+     * @param array  $opt    Option array like limit, offset
+     */
+    function getEntriesByType($period,$type,$opt) {
+	    
+      $q = 'call journal("'.$period.'","'.$type.'",'.$this->precision.','.$opt['offset'].','.$opt['limit'].');';
+      try {
+        $res = $this->doQueryI($q);
+      } catch (Exception $e) {
+         error_log("Called getEntriesByType Failed call journal".$period." type=".$type." ".$res." ".$res_solde);       
+      }  
+      $q = 'call journal_solde("'.$period.'","'.$type.'",2);';
+      try {
+          $res_solde = $this->doQueryI($q);
+      } catch (Exception $e) {
+         error_log("Called getEntriesByType Failed call journal_sold ".$period." type=".$type." ".$res." ".$res_solde);       
+      }  
+      return array( 'records' => $res['records'], 'solde' => $res_solde['records']);
+
+    }
+
+    /**
+     *
+     * @param array $opt    Option array like limit, offset
+     */
+    function getEntriesByAccount($period,$acc,$opt) {
+      $q = 'call detail_compte_sans_solde("'.$period.'",'.$acc.');';
+      $res = $this->doQueryI($q);
+      if ($res['total_matches'] == 0) {
+            return array('entries'=> array(array(0,0,0,0,0)),'solde' =>array(0,0,0));
+      } 
+      // return $res['records'];
+      $q = 'CALL solde_compte("'.$period.'","'.$acc.'");';
+      $res1 = $this->doQueryI($q);
+      return array('entries' => $res['records'], 'solde' => $res1['records'][0]);
+    }
+
+    /**
+     *
+     * @param string $period The period we want to retrieve the information
+     * @param string $acc    The account number
+     * @param array  $opt    Option array like limit, offset
+     */
+    function getSoldeAccount($period,$acc, $opt) {
+      $q = 'CALL solde_compte("'.$period.'","'.$acc.'");';
+      $res = $this->doQueryI($q);
+      // Get Total Appel de fonds :
+      $q=<<doQueryI($q);
+      // Get detail Total Charge
+      //( case WHEN te.debit_credit = 'c' then 1 else -1 end ) *
+      $q=<<precision}) as charge_total
+  ,  ROUND(SUM(
+ ( case WHEN te.debit_credit = 'd' then 1 else -1 end ) *
+   amount*FctTantiemeFrac("{$acc}",tret_key_id)),{$this->precision}) as charge_latente
+ FROM TransactionEntry as te
+ JOIN Period as p on p.per_string = "${period}" AND te.entry_date BETWEEN p.per_begin and p.per_end
+ JOIN PosteCharge as pc on pc.pc_id = te.tret_key_id
+WHERE (te.entry_type = "HA" or te.entry_type = "OD")and te.acc_id like("6%") and te.tret_key_id > 0 
+GROUP BY tret_key_id;
+EOF;
+       $dc = $this->doQueryI($q);
+       // Total Charge
+       $q=<<precision}) as charge_total 
+ , ROUND( SUM(
+ ( case WHEN te.debit_credit = 'd' then 1 else -1 end ) *
+amount*FctTantiemeFrac("{$acc}",tret_key_id)),{$this->precision}) as charge_latente 
+      FROM TransactionEntry as te
+      JOIN Period as p on p.per_string = "{$period}" AND te.entry_date BETWEEN p.per_begin and p.per_end
+      WHERE (te.entry_type = "HA"or te.entry_type= "OD") and te.acc_id like("6%") and te.tret_key_id > 0 
+     ;
+EOF;
+       $tc = $this->doQueryI($q);
+       $result = array( 'solde' => $res['records'][0],
+         'detail_charge' => $dc['records'],
+         'total_charge'  => $tc['records'][0][0],
+         'total_appel'  => $af['records'][0][0],
+         'total_latente'  => $tc['records'][0][1],
+       );
+       return $result;
+    }
+
+    // CREATE TABLE IF NOT EXISTS TransactionEntryType (
+    // type_id 	INTEGER AUTO_INCREMENT PRIMARY KEY,
+    // type_code VARCHAR(2), -- BQ, VT, OD 
+    // type_desc	VARCHAR(255)
+    function getEntryTypes() {
+      $q =<<<_EOF
+SELECT type_code,type_desc FROM TransactionEntryType ; 
+_EOF;
+      $r = $this->doQueryI($q);
+      return $r['records'];
+    }
+}
+
+?>
diff --git a/app/compta/api_syndic.php b/app/compta/api_syndic.php
new file mode 100644
index 0000000..36c46ec
--- /dev/null
+++ b/app/compta/api_syndic.php
@@ -0,0 +1,295 @@
+session = $_session;
+    }
+
+    /**
+     * @brief associate / dissociate user and pcmn account
+     */
+    function associateUserAccount($_uid,$_acc,$_assoc)
+    {
+      $q ="";
+      error_log("Syndic::associateUserAccount...".$_uid." ".$_acc);
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+        throw new Exception(_("Only Syndic can associate user and Account"));
+      }
+      $v = new Validator();
+      $v->num_int($_uid,_("_uid must be a number"));
+      $v->num_int($_acc,_("_acc must be a number"));
+      $v->num_int($_assoc,_("_assoc must be a number"));
+      if ($_assoc) {
+        $q =<<<__EOF
+INSERT INTO JoinIdentityAccount (jia_ident,jia_acc) VALUES( "{$_uid}","{$_acc}");
+__EOF;
+      } else {
+        $q =<<<__EOF
+DELETE FROM JoinIdentityAccount where jia_ident = {$_uid};
+__EOF;
+      }
+      $res = $this->doQueryI($q);
+      return $res['total_matches'] == 0;
+    }
+/**
+--  lot_floor     VARCHAR(8) DEFAULT "RDC",
+--  lot_area      INTEGER DEFAULT 0,
+--  lot_room      INTEGER DEFAULT 0,
+--  lot_name 	    VARCHAR(32),
+--  lot_type      VARCHAR(32),
+--  lot_building  VARCHAR(32),
+--  lot_door      VARCHAR(32),
+--  lot_description   VARCHAR(256)
+ */
+    function getLots() {
+        $q = "select lot_num,lot_floor,lot_area,lot_room,lot_name,lot_type,lot_building,lot_door,lot_description,lot_id from Lot; ";
+        $res = $this->doQueryI($q.$qv);
+        $entries = $res['records'];
+        if (count($entries) == 0 ) {
+          error_log("Syndic::getLots Failed number of elements is 0");
+          return Array("");
+        }
+        return $entries;
+    }
+    /**
+     * @brief 
+     * @return despite the fact the function does not return
+     * a value. I still need to differentiate sql errors and
+     * sql request return
+     */
+    function addLot($number,$tp,$building,$floor,$door,$size,$name,$desc) {
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+        throw new Exception(_("Only Syndic can add lots"));
+      }
+      $v = new Validator();
+      $v->num_int($number,_(" Lot number must be a number"));
+      $v->num_int($size,_(" Lot size must be a number"));
+      $v->str($building,_(" Lot building must be a string"));
+      $v->str($name,_(" Lot name must be a string"));
+      $v->str($desc,_(" Lot description must be a string"));
+      $q = "INSERT INTO Lot (lot_num,lot_name,lot_description,lot_floor,lot_area,lot_building,lot_door,lot_type) VALUES( ";
+      $qv= $number.',"'.$name.'","'.$desc.'","'.$floor.'",'.$size.',"'.$building.'","'.$door.'","'.$tp.'");';
+      $res = $this->doQueryI($q.$qv);
+      return Array("");
+    }
+
+    function removeLot($number)
+    {
+        if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+          throw  new Exception(_("Only Syndic can remove lots"));
+        }
+        $v = new Validator();
+        $v->num_int($number,_(" lot number must be a number"));
+        error_log("Syndic::removeLot: ".$number);
+        $q =<<<__EOF
+DELETE FROM LotsOwners WHERE lot_number = "{$nuymber}";
+DELETE FROM Lot WHERE lot_num = "{$number}";
+__EOF;
+        $res = $this->doQueryI($q);
+        return Array("");
+    }
+
+    function getLotsUser($uid) {
+      $v = new Validator();
+      $v->num_int($uid,_(" User id must be a number"));
+      $q =<<doQueryI($q);
+      if (count($res['records'] )== 0) {
+        error_log("getLotsUser: no record found");
+        throw new Exception(_("No records found for this user"));
+        return array("");
+      } else
+        return $res['records'];
+    }
+
+    /**
+     * @brief update lots owner. If lo_id is 0 it means that
+     * no entry exists ! Therefore, I should create a new
+     * entry and not call replace ! 
+     *
+     * Don't forget to check the input paramters. I don't
+     * want the database to be corrupted
+     */
+    function assignLotToUser($lo_id,$lot_id,$uid,$toggle) {
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+          throw new Exception(_("Only Syndic can assign lots"));
+      }
+      error_log("Syndic::assignLotToUser:".$lo_id." lot=".$lot_id." user=".$uid." t=".$toggle);
+      $q = "";
+      if ($lo_id == 0 ) {
+        $q =<<session->in_groupe(COMPTA_SYNDIC)) {
+        //error_log("Syndic::getCorproprietaires not syndic");
+        $q =<<<__EOF
+SELECT ident_id,ident_name,ident_firstname,ident_address,`ident_postalcode`
+      , ident_city
+      , ident_mobile, ident_email1
+      , case when joa.jia_acc != 'NULL' then joa.jia_acc else 0 end as compte
+FROM Owners as o
+LEFT JOIN JoinIdentityAccount as joa on joa.jia_ident = o.ident_id where o.ident_id = {$this->session->id()};
+__EOF;
+      } else {
+        //error_log("Syndic::getCorproprietaires syndic ".$_uid);
+        if ($_uid != "") {
+          $v = new Validator();
+          $v->num_int($_uid,"_uid must be a number");
+          $q =<<<__EOF
+SELECT ident_id, ident_name, ident_firstname, ident_address, `ident_postalcode`
+      , ident_city
+      , ident_mobile, ident_email1
+      , case when joa.jia_acc != 'NULL' then joa.jia_acc else 0 end as compte
+FROM Owners as o
+LEFT JOIN JoinIdentityAccount as joa on joa.jia_ident = o.ident_id where o.ident_id = {$_uid};
+__EOF;
+        } else {
+          $q =<<<__EOF
+SELECT ident_id, ident_name, ident_firstname, ident_address, ident_postalcode
+      , ident_city
+      , ident_mobile, ident_email1
+      , case when joa.jia_acc != 'NULL' then joa.jia_acc else 0 end as compte
+FROM   Owners as o
+LEFT JOIN JoinIdentityAccount as joa on joa.jia_ident = o.ident_id;
+__EOF;
+        }
+      }
+      $res = $this->doQueryI($q);
+      //error_log("Syndic::getCoproprietaires nb results=".$res['total_matches']);
+      return $res['records'];
+
+    }
+    function getKeysCharge() {
+      $q = "select pc_id,pc_name,pc_comment FROM PosteCharge;";
+      $keys = $this->doQueryI($q);
+      return $keys['records'];
+    }
+    function updateKeyCharge($id,$name,$desc) {
+      $q=<<doQueryI($q);
+      return array("");
+    }
+
+    /**
+     * @brief return an array tant_id, tant_lot, tant_size for all lots
+     */
+    function getTantieme($charge_id) {
+    //    $q = "select tant_pc_id, tant_lot_num, tant_lot_size FROM Tantieme where tant_pc_id=".$charge_id.";";
+        $q=<<doQueryI($q);
+      if (count($keys['records']) == 0 ) {
+        return array("");
+      }
+      return $keys['records'];
+    }
+
+    /**
+     *
+     */
+    function setTantieme($t_id,$charge_id,$lot,$tant) {
+      if (!$this->session->in_groupe(COMPTA_SYNDIC)) {
+          throw  new Exception(_("Only Syndic can set tantieme"));
+      }
+        $q=<<doQueryI($q);
+        return array("");
+    }
+
+}
+
+
+?>
diff --git a/app/compta/bilan.js b/app/compta/bilan.js
new file mode 100644
index 0000000..728388a
--- /dev/null
+++ b/app/compta/bilan.js
@@ -0,0 +1,69 @@
+define(["require", "exports", "../../js/xgui/CtrlDialogbox", "./services"], function (require, exports, CtrlDialogbox_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Bilan;
+    (function (Bilan_1) {
+        class DlgBilan extends CtrlDialogbox_1.Dialogbox {
+            constructor(_id, jurl) {
+                console.log("DlgBilan constructor");
+                super(_id);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                var myBilan = new AEBW.control.table('bilan');
+                this.TableBilan = function () { return myBilan; };
+            }
+            onDummy(response) {
+                alert("DlgPaye::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgPaye::Dummy Error");
+            }
+            cleanTable(tb, sz) {
+                for (var i = 0; i < sz; i++) {
+                    tb.delRow(0);
+                }
+            }
+            getBilan() {
+                var _param = new services_1.Services.DummyReqParams();
+                _param.dummy = gState.Exercice;
+                let bindOnGetBilan = this.onGetBilan.bind(this);
+                this._pcmn.getBilan(_param, bindOnGetBilan, this.onDummyFail);
+            }
+            onGetBilan(response) {
+                var tb = this.TableBilan();
+                this.cleanTable(tb, tb._NbRows);
+                for (var i = 0; i < response.result.length; i++) {
+                    var it = response.result[i];
+                    var row = tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = it[0];
+                    tb.getCell(tb._NbRows - 1, 1).innerHTML = it[1];
+                    tb.getCell(tb._NbRows - 1, 2).innerHTML = it[2];
+                    row.cells[2].style.textAlign = "right";
+                    tb.getCell(tb._NbRows - 1, 3).innerHTML = it[3];
+                    row.cells[3].style.textAlign = "right";
+                    tb.getCell(tb._NbRows - 1, 4).innerHTML = it[4];
+                    row.cells[4].style.textAlign = "right";
+                    if (parseFloat(it[2]) > parseFloat(it[3])) {
+                        row.cells[4].style.color = "red";
+                    }
+                    else {
+                        row.cells[4].style.color = "black";
+                    }
+                }
+                $('panelBilan').innerHTML = 'Exercice ' + gState.Exercice + "
";
+            }
+            onLoaded(html) {
+                console.log("DlgBilan Loaded");
+            }
+            onShow() {
+                this.getBilan();
+            }
+        }
+        Bilan_1.DlgBilan = DlgBilan;
+        Bilan_1.Bilan = new DlgBilan("gBilan", '/app/compta/index.php');
+        Bilan_1.Bilan.getBilan();
+        Prototype.Event.observe($('btBilanDownload'), "click", function () {
+            window.open("/app/compta/reports/syndic_builder_annexe.php?period=" + gState.Exercice);
+        });
+    })(Bilan = exports.Bilan || (exports.Bilan = {}));
+});
diff --git a/app/compta/bilanBootstrap.js b/app/compta/bilanBootstrap.js
new file mode 100644
index 0000000..a0af7bf
--- /dev/null
+++ b/app/compta/bilanBootstrap.js
@@ -0,0 +1,41 @@
+requirejs.config({
+    baseUrl: '../..',
+    paths: {
+        "cpt": "/app/compta",
+        "xgui": "/js/xgui",
+        "tslib": "/js/tslib",
+        "" : ""
+    },
+    shim: {
+        "bilan": {
+            deps: ['aebw','xgui_dialogbox','xgui/xgui_json', 'cpt/Dialog','js/scriptaculus/prototype'],
+            exports: 'Bilan',
+            init: function (x) {
+            }
+        },
+        "Dialog": {
+            deps: ['xgui/xgui_dialogbox'],
+            exports: ''
+        },
+        "xgui_dialogbox": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        },
+        "xgui_json": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        }
+    }
+});
+requirejs(["require", "exports"
+           ,"tslib"
+           ,"xgui/xgui_json"
+           , "xgui/xgui_dialogbox"
+           , "cpt/Dialog"
+           , "cpt/services"
+           , "cpt/bilan"], function (req,exp,ts,json,dialog,dlg,srv,myApp) {
+    console.log("starting Bilan application...");
+    var b = myApp.Bilan.Bilan;
+    // Already done in bilan app
+    //b.getBilan();
+});
diff --git a/app/compta/budget.js b/app/compta/budget.js
new file mode 100644
index 0000000..4fac3b0
--- /dev/null
+++ b/app/compta/budget.js
@@ -0,0 +1,257 @@
+define(["require", "exports", "./Dialog", "./services"], function (require, exports, Dialog_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Budget;
+    (function (Budget) {
+        class DlgBudget extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgBudget constructor");
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                this._user = new services_1.Services.Users(req);
+                this._budget = new services_1.Services.Budget(req);
+                this._tbe = null;
+                this.tableExercices = function () {
+                    if (!this._tbe) {
+                        this._tbe = new AEBW.control.table('table_budgets');
+                    }
+                    return this._tbe;
+                };
+                this.Url = function () { return jurl; };
+                this._content = $(_id).innerHTML;
+            }
+            onDummy(response) {
+                alert("DlgBudget::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgBudget::Dummy Error");
+            }
+            getBudgets() {
+                var params = new services_1.Services.EmptyReqParams();
+                var bindFct = this.onGetBudgets.bind(this);
+                this._budget.list(params, bindFct, this.onDummyFail);
+            }
+            onGetBudgets(response) {
+                var tb = this.tableExercices();
+                var Ex = this;
+                tb.eraseAllRows();
+                for (var i = 0; i < response.result.length; i++) {
+                    var it = response.result[i];
+                    var row = tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = '
+    User Managment 
+    
+        
+
+        
+
+  
+     
+      Selection de la classe 
+      
+          
+              Comptes : 
+                  Année:  
+       
+     
+         
+        
+          
+          
+            
+              
+                Compte 
+                Libellé 
+                N-1 
+                N  
+          
+         
+              
+         
+             
+             Total: 0.0 0.0  
+	  
+         
+	        
+
+     
+ 
diff --git a/app/compta/class.schema.php b/app/compta/class.schema.php
new file mode 100644
index 0000000..ad3c70f
--- /dev/null
+++ b/app/compta/class.schema.php
@@ -0,0 +1,119 @@
+xml  = simplexml_load_string($XmlString);
+    } catch (Exception $e) {
+      error_log("Schema::_ctor failed ".$e->getMessage());
+    }
+  }
+
+  /**
+   *
+   */
+  function __destructor() {
+  }
+
+  /**
+   *
+   *
+   */
+  private function process_statement($attrs,$child) {
+    $q = "";
+    if (isset($attrs['set_org']) ) {
+      $patt = "/{org_id}/";
+      $repl = $this->org_id;
+
+      $q = preg_replace($patt,$repl,$child->__toString());
+    } else {
+      $q = $child->__toString();
+    }
+    $this->doQueryI($q);
+  }
+  /**
+   *
+   *
+   */
+  function setStartPoint($from) {
+    $this->update_from = $from;
+  }
+  /**
+   *
+   *
+   */
+  function createCompta($org_id) {
+    $this->org_id = $org_id;
+    if ($this->xml != null)
+    {
+      $req = $this->xml->xpath("//sql/statement[@mode='update']");
+      foreach ($req as $child ) {
+        $attrs = $child->attributes();
+        $this->process_stratement($attrs,$child);
+      }
+    }
+  }
+  /**
+   *
+   *
+   */
+  function recreateCompta($org_id) {
+    $this->org_id = $org_id;
+    error_log("Schema::recreateCompta: ".$org_id);
+    if ($this->xml != null)
+    {
+      $q = "";
+      $req = $this->xml->xpath("//sql/statement");
+      foreach ($req as $child ) {
+        error_log("Schema::recreateCompta: in child");
+        $attrs = $child->attributes();
+        $this->process_statement($attrs,$child);
+      }
+    } else {
+      error_log("Schema::recreateCompta: xml is null ".$org_id);
+    }
+  }
+  /**
+   *
+   *
+   */
+  function updateCompta($org_id) {
+    $this->org_id = $org_id;
+    error_log("Schema::updateCompta: ".$org_id);
+    if ($this->xml != null)
+    {
+      $req = $this->xml->xpath("//sql/statement");
+      foreach ($req as $child ) {
+        $attrs = $child->attributes();
+        if (isset($attrs['count']) && ($attrs['count'] >= $this->update_from) ) {
+          error_log("Schema::update Compta Yes: ".$attrs['count']." ".$this->update_from);
+          $this->process_statement($attrs,$child);
+        }
+      }
+    } else {
+      error_log("Schema::updateCompta: xml is null ".$org_id);
+    }
+  }
+}
+/**
+ * Test
+ */
+// $schema = new Schema($conf['auth']['mysql'],'demo');
+
+// $schema->recreateCompta();
+?>
diff --git a/app/compta/controler_base.php b/app/compta/controler_base.php
new file mode 100644
index 0000000..c588b9e
--- /dev/null
+++ b/app/compta/controler_base.php
@@ -0,0 +1,59 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+
+/**
+ *
+ */
+class controler
+{
+    /// Controler base dir
+    public static $basedir = "";
+    ///
+    public static $viewdir = "";
+    ///
+    public static $modeldir = "";
+    ///
+    protected $_session     = null;
+    ///
+    protected $_auth_cfg    = null;
+   
+    ///
+    public function __construct()
+    {
+        GLOBAL $conf;
+        $conf_auth       = $conf['auth']['mysql'];
+        $this->_session  = new \SessionCompta($conf_auth,$conf_auth['req_file']);
+        $this->_auth_cfg = $conf['auth']['mysql'];
+    }
+
+    public function getSession()
+    {
+        return $this->_session;
+    }
+
+    public function getAuthConfig()
+    {
+        return $this->_auth_cfg;
+    }
+    static function init()
+    {
+        controler::$basedir  = dirname(__FILE__);
+        controler::$viewdir  = dirname(__FILE__)."/views/";
+        controler::$modeldir = dirname(__FILE__)."/models/";
+    }
+}
+/// Initialize static variables
+controler::init();
+
+?>
diff --git a/app/compta/controlers/account.php b/app/compta/controlers/account.php
new file mode 100644
index 0000000..0f8848a
--- /dev/null
+++ b/app/compta/controlers/account.php
@@ -0,0 +1,75 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+require_once(controler::$modeldir."/account.php");
+
+/**
+ *
+ *
+ */
+class Account extends controler
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->_model = new \compta\models\account\Model(
+             $this->getSession(),$this->getAuthConfig());
+    }
+
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        //require_once(controler::$basedir."/view_bank_index.php");
+        //$page = new \compta\views\account\Index();
+        return new \HtmlResult("Account to be coded");
+        //return $page;
+    }
+
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function upload() : \IActionResult
+    {
+        //require_once(controler::$basedir."/view_bank_upload.php");
+        //$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+
+    public function account($_account_id)
+    {
+        return new \HtmlResult("Bank account ".$_account_id);
+    }
+    
+    public function detail($_id)
+    {
+        require_once(controler::$viewdir."/account_detail.php");
+        $this->_model->getDetails($_id);
+        $page = new \compta\views\account\Detail($this->_model);
+        return $page;
+        // return new \HtmlResult("Account  ".$_id);
+    }
+
+}
+
diff --git a/app/compta/controlers/admin.php b/app/compta/controlers/admin.php
new file mode 100644
index 0000000..07ac578
--- /dev/null
+++ b/app/compta/controlers/admin.php
@@ -0,0 +1,44 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Admin 
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/admin_index.php");
+        $page = new \compta\views\admin\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/bank.php b/app/compta/controlers/bank.php
new file mode 100644
index 0000000..c93a2bd
--- /dev/null
+++ b/app/compta/controlers/bank.php
@@ -0,0 +1,90 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+require_once(controler::$basedir."/models/bank.php");
+
+/**
+ *
+ *
+ */
+class Bank
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        GLOBAL $conf;
+        $conf_auth       = $conf['auth']['mysql'];
+        $this->_session  = new \SessionCompta($conf_auth,$conf_auth['req_file']);
+        $this->_auth_cfg = $conf['auth']['mysql'];
+        $this->_model    = new \compta\models\bank\Model($this->_session,$this->_auth_cfg);
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/bank_index.php");
+        $page = new \compta\views\bank\Index($this->_model);
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function upload() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/bank_upload.php");
+        $page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    public function account($_account_id)
+    {
+        return new \HtmlResult("Bank account ".$_account_id);
+    }
+    
+    public function add()
+    {
+        return new \HtmlResult("Bank add");
+    }
+
+    /**
+     * @brief post uploadOFX
+     * 
+     */
+    public function uploadOFX()
+    {
+        $arr_file_type = ['text/ofx','text/csv'];
+        if ( ! in_array($_FILES['file']['type'],$arr_file_type))
+        {
+        }
+        if ( ! file_exists('uploads'))
+        {
+            mkdir('uploads',0777);
+        }
+        $filename=time().'_'.$_FILES['file']['name'];
+        move_uploaded_file($_FILES['file']['tmp_name'],'uploads/'.$filename);
+        $this->_model->parse('uploads/'.$filename);
+        // Process ofx and return
+        return new \HtmlResult("Uploaded");
+    }
+}
+
+?>
diff --git a/app/compta/controlers/bilan.php b/app/compta/controlers/bilan.php
new file mode 100644
index 0000000..499eea6
--- /dev/null
+++ b/app/compta/controlers/bilan.php
@@ -0,0 +1,44 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Bilan
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/bilan_index.php");
+	$page = new \compta\views\bilan\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/bill.php b/app/compta/controlers/bill.php
new file mode 100644
index 0000000..e69de29
diff --git a/app/compta/controlers/budget.php b/app/compta/controlers/budget.php
new file mode 100644
index 0000000..0399c02
--- /dev/null
+++ b/app/compta/controlers/budget.php
@@ -0,0 +1,74 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/session.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+require_once(controler::$basedir."/models/budget.php");
+
+/**
+ *
+ *
+ */
+class Budget 
+{
+
+    private $_session = null;
+    private $_auth_cfg;
+    private $_model   = null;
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        GLOBAL $conf;
+        $conf_auth       = $conf['auth']['mysql'];
+        $this->_session  = new \SessionCompta($conf_auth,$conf_auth['req_file']);
+        $this->_auth_cfg = $conf['auth']['mysql'];
+        $this->_model    = new \compta\models\budget\Model($this->_session,$this->_auth_cfg);
+    }
+    /**
+     * Get default budget main page.
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/budget_index.php");
+        $page = new \compta\views\budget\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function detail($_id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/budget_detail.php");
+        $page = new \compta\views\budget\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function nouveau() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/budget_nouveau.php");
+        $page = new \compta\views\budget\Nouveau();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/chart.php b/app/compta/controlers/chart.php
new file mode 100644
index 0000000..d08b31a
--- /dev/null
+++ b/app/compta/controlers/chart.php
@@ -0,0 +1,44 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Chart 
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/chart_index.php");
+        $page = new \compta\views\chart\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/compta.php b/app/compta/controlers/compta.php
new file mode 100644
index 0000000..939efb9
--- /dev/null
+++ b/app/compta/controlers/compta.php
@@ -0,0 +1,137 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Compta
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/compta_index.php");
+	$page = new \compta\views\compta\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function organisation() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/bank_upload.php");
+	$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    /**
+     * Get the details of plan comptable.
+     * @param string $_accout_id  the supplier account
+     */
+    public function pcmn() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/bank_upload.php");
+	$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function exercice() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/bank_upload.php");
+	$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function supplier() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/supplier_index.php");
+	$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function tiers() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/supplier_index.php");
+	$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    /**
+     * Get the details of the books. (livres ou journaux)
+     * @param string $_accout_id  the supplier account
+     */
+    public function book() : \IActionResult
+    {
+	require_once(controler::$basedir."/views/supplier_index.php");
+	$page = new \compta\views\bank\Upload();
+        return $page;
+    }
+    /**
+     *
+     */
+    public function bilan($_account_id)
+    {
+	return new \HtmlResult("Bank account ".$_account_id);
+    }
+    
+    public function budget()
+    {
+	return new \HtmlResult("Bank add");
+    }
+
+    /**
+     * @brief post uploadOFX
+     * 
+     */
+    public function uploadOFX()
+    {
+	$arr_file_type = ['text/ofx','text/csv'];
+	if ( ! in_array($_FILES['file']['type'],$arr_file_type))
+	{
+	}
+	if ( ! file_exists('uploads'))
+	{
+            mkdir('uploads',0777);
+	}
+	$filename=time().'_'.$_FILES['file']['name'];
+	move_uploaded_file($_FILES['file']['tmp_name'],'uploads/'.$filename);
+	// Process ofx and return
+	return new \HtmlResult("Uploaded");
+    }
+}
+
+
+?>
diff --git a/app/compta/controlers/exercice.php b/app/compta/controlers/exercice.php
new file mode 100644
index 0000000..a37a019
--- /dev/null
+++ b/app/compta/controlers/exercice.php
@@ -0,0 +1,93 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Exercice 
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/exercice_index.php");
+        $page = new \compta\views\exercice\Index();
+        return $page;
+    }
+
+    /**
+     * @brief show details of an exercice. If it's closed
+     * maybe a summary of a year to year comparison
+     *
+     */
+    public function detail($id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/exercice_detail.php");
+        $page = new \compta\views\exercice\Detail();
+        return $page;
+    }
+
+    public function select($id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/exercice_select.php");
+        $page = new \compta\views\exercice\Index();
+        return $page;
+    }
+
+    /**
+     * @brief show a small window to add a new exercice
+     */
+    public function cloture() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/exercice_cloture.php");
+        $page = new \compta\views\exercice\Index();
+        return $page;
+    }
+
+    /**
+     * @brief show a small window to add a new exercice
+     */
+    public function add() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/exercice_add.php");
+        $page = new \compta\views\exercice\Index();
+        return $page;
+    }
+    
+    /**
+     * @brief show a small window to add a new exercice
+     */
+    public function addPost() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/exercice_select.php");
+        $page = new \compta\views\exercice\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/jrnx.php b/app/compta/controlers/jrnx.php
new file mode 100644
index 0000000..c42e11d
--- /dev/null
+++ b/app/compta/controlers/jrnx.php
@@ -0,0 +1,44 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Jrnx 
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/jrnx_index.php");
+        $page = new \compta\views\jrnx\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/loan.php b/app/compta/controlers/loan.php
new file mode 100644
index 0000000..a33c042
--- /dev/null
+++ b/app/compta/controlers/loan.php
@@ -0,0 +1,105 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+require_once(controler::$modeldir."/loan.php");
+
+/**
+ *
+ *
+ */
+class Loan  extends controler
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->_model = new \compta\models\loan\Model(
+                $this->getSession()
+                ,$this->getAuthConfig());
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/loan_index.php");
+        $page = new \compta\views\loan\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function detail($id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/loan_detail.php");
+        // Be sure to know what we are working on
+        $this->_model->id = $id;
+        $page = new \compta\views\loan\Detail($this->_model);
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function nouveau() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/loan_nouveau.php");
+        $page = new \compta\views\loan\Nouveau($this->_model);
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_id  the loan id
+     * TODO to be finalized !
+     */
+    public function payer($id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/loan_payer.php");
+        $page = new \compta\views\loan\Index();
+        return $page;
+    }
+    /**
+     * Paye the loan for the current month
+     * @param string $_id  the supplier account
+     */
+    public function payerPost() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/loan_payer.php");
+        $this->_model->payer(\AEB::$REQUEST['li'],\AEB::$REQUEST['lei']);
+        $page = new \compta\views\loan\Payer($this->model);
+        return $page;
+    }
+    /**
+     * Update the loan. Not sure  if this is smart once we
+     * started to paye. Should only be possible id the start date
+     * is after the current date.
+     * @param string $_id  the loan id
+     */
+    public function update() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/loan_update.php");
+        $page = new \compta\views\loan\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/lot.php b/app/compta/controlers/lot.php
new file mode 100644
index 0000000..53ba08d
--- /dev/null
+++ b/app/compta/controlers/lot.php
@@ -0,0 +1,81 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+require_once(controler::$basedir."/session.php");
+require_once(controler::$basedir."/models/lot.php");
+
+/**
+ *
+ *
+ */
+class Lot
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        GLOBAL $conf;
+        $conf_auth       = $conf['auth']['mysql'];
+        $this->_session  = new \SessionCompta($conf_auth,$conf_auth['req_file']);
+        $this->_auth_cfg = $conf['auth']['mysql'];
+        $this->_model    = new \compta\models\lot\Model($this->_session,$this->_auth_cfg);
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/lot_index.php");
+        $page = new \compta\views\lot\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function attribuer() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/lot_attribuer.php");
+        $page = new \compta\views\lot\Attribuer();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function nouveau() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/lot_nouveau.php");
+        $page = new \compta\views\lot\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function update($id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/lot_update.php");
+        $page = new \compta\views\lot\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/org.php b/app/compta/controlers/org.php
new file mode 100644
index 0000000..f118440
--- /dev/null
+++ b/app/compta/controlers/org.php
@@ -0,0 +1,44 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+
+/**
+ *
+ *
+ */
+class Org 
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/org_index.php");
+        $page = new \compta\views\org\Index();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/recurrent.php b/app/compta/controlers/recurrent.php
new file mode 100644
index 0000000..06d54e4
--- /dev/null
+++ b/app/compta/controlers/recurrent.php
@@ -0,0 +1,106 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+require_once(controler::$basedir."/../../phplib/iface.ActionResult.php");
+require_once(controler::$basedir."/../../phplib/class.ActionResults.php");
+require_once(controler::$basedir."/session.php");
+require_once(controler::$basedir."/models/recurrent.php");
+
+/**
+ *
+ *
+ */
+class Recurrent
+{
+    private $_model    = null;
+    private $_session  = null;
+    private $_auth_cfg = null;
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        GLOBAL $conf;
+        $conf_auth       = $conf['auth']['mysql'];
+        $this->_session  = new \SessionCompta($conf_auth,$conf_auth['req_file']);
+        $this->_auth_cfg = $conf['auth']['mysql'];
+        $this->_model    = new \compta\models\recurrent\Model($this->_session,$this->_auth_cfg);
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function index() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/recurrent_index.php");
+        $page = new \compta\views\recurrent\Index();
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function detail($_id) : \IActionResult
+    {
+       require_once(controler::$basedir."/views/recurrent_detail.php");
+        $this->_model->get($_id);
+        $page = new \compta\views\recurrent\Detail($this->_model);
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function update($_id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/recurrent_update.php");
+        $this->_model->get($_id);
+        $page = new \compta\views\recurrent\Update($this->_model);
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function payer($_id) : \IActionResult
+    {
+        require_once(controler::$basedir."/views/recurrent_payer.php");
+        $this->_model->payer($_id);
+        $page = new \compta\views\recurrent\Payer($this->_model);
+        return $page;
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function nouveau() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/recurrent_nouveau.php");
+        $page = new \compta\views\recurrent\Nouveau();
+        return $page;
+    }
+    /**
+     * Handle post of new recurrent operation
+     * @param string $_accout_id  the supplier account
+     */
+    public function nouveauPost() : \IActionResult
+    {
+        require_once(controler::$basedir."/views/recurrent_nouveau.php");
+        $page = new \compta\views\recurrent\Nouveau();
+        return $page;
+    }
+}
+
+?>
diff --git a/app/compta/controlers/supplier.php b/app/compta/controlers/supplier.php
new file mode 100644
index 0000000..9f79f83
--- /dev/null
+++ b/app/compta/controlers/supplier.php
@@ -0,0 +1,47 @@
+
+ * @version 1.0
+ * @package Compta
+ */
+
+namespace compta\controlers; 
+require_once(dirname(__FILE__)."/../controler_base.php");
+
+class Supplier
+{
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+    }
+    /**
+     * Get the details of the supplier account.
+     * @param string $_accout_id  the supplier account
+     */
+    public function account($_account_id)
+    {
+    }
+    
+    public function details()
+    {
+    }
+
+    public function pay()
+    {
+    }
+    
+    public function bill()
+    {
+    }
+}
+
+?>
diff --git a/app/compta/controlers/transaction.php b/app/compta/controlers/transaction.php
new file mode 100644
index 0000000..689e8c8
--- /dev/null
+++ b/app/compta/controlers/transaction.php
@@ -0,0 +1,41 @@
+
diff --git a/app/compta/copro.js b/app/compta/copro.js
new file mode 100644
index 0000000..f7a40ca
--- /dev/null
+++ b/app/compta/copro.js
@@ -0,0 +1,787 @@
+define(["require", "exports", "./Dialog", "./transaction", "./services"], function (require, exports, Dialog_1, transaction_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Coproprieraite;
+    (function (Coproprieraite) {
+        class Roll {
+            constructor(_role_id, _uid, _role) {
+                var obj = this;
+                this.role_id = _role_id;
+                this.uid = _uid;
+                this.role = _role;
+                this.json = function () {
+                    return { "role_id": obj.role_id,
+                        "uid": obj.uid,
+                        "role": obj.role
+                    };
+                };
+            }
+        }
+        class TransactionInfoAppel {
+            constructor() {
+                var obj = this;
+                this.voucher_date = new Date($('tfDate').value);
+                this.act_trans_date = new Date($('tfDate').value);
+                this.trans_label = $('tfTitle').value;
+                this.amount = $('tfMontant').value;
+                this.voucher_ref = "";
+                this.acc_id = $('cbCoproAppel').value;
+                this.json = function () {
+                    return { "amount": obj.amount,
+                        "voucher_date": obj.voucher_date,
+                        "act_trans_date": obj.act_trans_date,
+                        "trans_label": obj.trans_label,
+                        "acc_id": obj.acc_id,
+                        "voucher_ref": obj.voucher_ref
+                    };
+                };
+            }
+        }
+        Coproprieraite.TransactionInfoAppel = TransactionInfoAppel;
+        class TransactionAppel extends transaction_1.Ledger.Transaction {
+            constructor(_tp) {
+                super(_tp, "copro");
+            }
+            getInfo(pref) {
+                var info = new TransactionInfoAppel();
+                console.log("TransactionAppel::getInfo");
+                return info;
+            }
+            commit(_Req, _param, _onSuccess, _onFailure) {
+                console.log("TransactionBill::commit _Req('booking','appelFonds',_param,_onSuccess,_onFailure)");
+                _onSuccess("Not sure");
+            }
+        }
+        class TransactionPaye extends transaction_1.Ledger.Transaction {
+            constructor(_tp) {
+                super(_tp, "copro");
+            }
+            getInfo(pref) {
+                var info = new transaction_1.Ledger.TransactionInfoVersement(pref);
+                console.log("TransactionPaye::getInfo");
+                return info;
+            }
+            commit(_Req, _param, _onSuccess, _onFailure) {
+                console.log("TransactionPaye::commit _Req('booking','Versement',_param,_onSuccess,_onFailure)");
+                _onSuccess("Success pay");
+            }
+        }
+        class DlgPaye extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                this.onGetKeysCharge = function (resp) {
+                    alert("onGetKeysCharge");
+                };
+                var req = new AEBW.Json(jurl);
+                this._booking = new services_1.Services.Booking(req);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+            }
+            onDummy(response) {
+                alert("DlgPaye::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgPaye::Dummy Error");
+            }
+            getCoproPaye() {
+                var bindFct = this.onGetCoproPaye.bind(this);
+                super.getCoproAccounts(bindFct, this.onDummyFail);
+            }
+            onGetBanks(response) {
+                var cb = $('copro_banque');
+                console.log("DlgPaye::onGetBanks ");
+                if (Array.isArray(response.result)) {
+                    super.fillCombo(cb, response.result);
+                }
+                else if (AEBW.isNumber(response.result)) {
+                    cb.options.length = 0;
+                    console.log("DlgMapy::onGetBanks...int " + response.result);
+                }
+                else {
+                    console.log("DlgMapy::onGetBanks... un handled " + response.result);
+                }
+            }
+            onGetCoproPaye(response) {
+                var cb = $('copro_id');
+                console.log("DlgPaye::onGetCoproPaye");
+                super.fillCombo(cb, response.result);
+            }
+            getCoproAppel() {
+                var bindFct = this.onGetCoproAppel.bind(this);
+                super.getCoproAccounts(bindFct, this.onDummyFail);
+            }
+            onGetCoproAppel(response) {
+                var cb = $('cbCoproAppel');
+                console.log("DlgPaye::onGetCoproAppel");
+                super.fillCombo(cb, response.result);
+            }
+            doRecord(tp) {
+                var t = new TransactionPaye(tp);
+                console.log("Coproprietaire::DlgPaye doRecord to be coded");
+                try {
+                    var bindOnRecord = this.onRecord.bind(this);
+                    this._booking.Versement(t, bindOnRecord, this.onDummyFail);
+                    console.log('DlgPaye::doRecord done : ');
+                }
+                catch (e) {
+                    alert("doRecord toJson failed" + e.message);
+                }
+            }
+            onRecord(_resp) {
+                console.log("Coproprietaire::onRecord to be coded");
+                CoproUsers.showList();
+            }
+            doAppel() {
+                var t = new TransactionAppel('BQ');
+                console.log("Coproprietaire::DlgPaye doAppel to be coded");
+                try {
+                    var json = AEBW.toJson(t);
+                    var req = new AEBW.Json(this.Url());
+                    t.commit(req, json, this.onAppel, this.onDummyFail);
+                    console.log('Coproprietaire::DlgPaye::doAppel done : ');
+                }
+                catch (e) {
+                    alert("doRecord toJson failed" + e.message);
+                    CoproUsers.showList();
+                }
+            }
+            onAppel() {
+                $('copro_result').innerHTML = "L'appel de fond a été enregistre.
";
+            }
+            showPay() {
+                this.show();
+                try {
+                    $('copro_appel').addClassName("hidden");
+                }
+                catch (e) {
+                    console.log("CoproPay::showPay error on $('copro_appel')");
+                }
+                this.getCoproPaye();
+                var bindFct = this.onGetBanks.bind(this);
+                super.getBanks(bindFct, this.onDummyFail);
+                var o = this;
+                var d = new Date();
+                var m = d.getMonth() + 1;
+                var day = d.getDate();
+                $('copro_date').value = d.getFullYear() + '-' + ('0' + m).slice(-2) + '-' + ('0' + day).slice(-2);
+                Prototype.Event.observe($('btFPCancel'), "click", function (evt) {
+                    CoproUsers.showList();
+                });
+                Prototype.Event.observe($('btCoproPayeRecord'), "click", function () {
+                    if (!AEBW.isDate($('copro_date').value)) {
+                        alert('Validation mauvais format de date');
+                        $('copro_date').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('copro_date').style.border = '1px solid green';
+                    }
+                    if (!AEBW.isDate($('copro_voucher_date').value)) {
+                        alert('Validation mauvais format de la date de facturation');
+                        $('copro_voucher_date').style.border = '1px solid red';
+                        $('copro_voucher_date').value = 'AAAA-MM-DD';
+                        return;
+                    }
+                    else {
+                        $('copro_voucher_date').style.border = '1px solid green';
+                    }
+                    var check_amount = $('copro_amount').value;
+                    if (!AEBW.isNumber(check_amount)) {
+                        alert('Validation mauvais format du montant. Peut-etre un probleme de point ou de virgule ' + check_amount);
+                        $('copro_amount').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('copro_amount').style.border = '1px solid green';
+                    }
+                    o.doRecord('BQ');
+                });
+                $('copro_result').innerHTML = "";
+            }
+            showAppel() {
+                this.show();
+                this.getCoproAppel();
+                var o = this;
+                var d = new Date();
+                var m = d.getMonth() + 1;
+                var day = d.getDate();
+                $('tfDate').value = d.getFullYear() + '-' + ('0' + m).slice(-2) + '-' + ('0' + day).slice(-2);
+                $('copro_payement').addClassName("hidden");
+                Prototype.Event.observe($('btAppelRecord'), "click", function () {
+                    var check_amount = $('tfMontant').value;
+                    if (!AEBW.isNumber(check_amount)) {
+                        alert('Validation mauvais format du montant. Peut-etre un probleme de point ou de virgule ' + check_amount);
+                        $('tfMontant').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('tfMontant').style.border = '1px solid green';
+                    }
+                    o.doAppel();
+                });
+                $('copro_result').innerHTML = "";
+            }
+            onLoaded(html) {
+                console.log("DlgPaye::onLoaded call showPay");
+            }
+        }
+        Coproprieraite.DlgPaye = DlgPaye;
+        class DlgDecompte extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                this._retrieve = new services_1.Services.Retrieve(req);
+                this._exercice = new services_1.Services.Exercice(req);
+                this._acc = "450";
+            }
+            onDummy(response) {
+                alert("DlgDecompte::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgDecompte::Dummy Error");
+            }
+            cleanTable(tb, sz) {
+                for (var i = 0; i < sz; i++) {
+                    tb.delRow(0);
+                }
+            }
+            getCopro() {
+                var _param = new services_1.Services.AccountListReqParams(this._acc);
+                let bindFct = this.onGetCopro.bind(this);
+                this._pcmn.getAccountList(_param, bindFct, this.onDummyFail);
+            }
+            onGetCopro(response) {
+                var result = response.result;
+                if (result.length > 1) {
+                    console.log("onGetCopro response too long " + result.length);
+                }
+                console.log("onGetCopro " + result[0]);
+                var item = result[0];
+                try {
+                    $('pAccount').innerHTML = "Compte " + item['acc_id'] + " - " + item['acc_desc'];
+                    $('pAccount').setAttribute('account', item['acc_id']);
+                    this._acc = item['acc_id'];
+                    console.log("assign Event Handler");
+                    Prototype.Event.observe($('btCoproDownload'), "click", function () {
+                        console.log("Download decompte " + this._acc);
+                        window.open("/app/compta/reports/syndic_builder_decompte.php?period=" + gState.Exercice + "&compte=" + $('pAccount').getAttribute('account'));
+                    });
+                }
+                catch (e) {
+                    console.log("onGetCopro Error " + e.message);
+                }
+                if (gState.Mode != 'S') {
+                    this.getDecompte();
+                }
+            }
+            getExercice(exer) {
+                var _param = new services_1.Services.DummyReqParams();
+                _param.dummy = exer;
+                let bindOnGetExercice = this.onGetExercice.bind(this);
+                this._exercice.details(_param, bindOnGetExercice, this.onDummyFail);
+            }
+            onGetExercice(response) {
+                var result = response.result;
+                var ex = result[0];
+                if (result.length > 1) {
+                    console.log("onGetExercice Old way. More than one should not happen");
+                }
+                this._exApproved = ex[6];
+                this._exClosed = ex[5];
+                this._exChargeEnd = ex[4];
+                $('exercice').innerHTML = gState.Exercice;
+            }
+            getDecompte() {
+                console.log("getDecompte acc=" + this._acc);
+                var _param = new services_1.Services.EntriesReqParams(gState.Exercice, this._acc);
+                let bindOnGetDecompte = this.onGetDecompte.bind(this);
+                this._retrieve.getEntriesByAccount(_param, bindOnGetDecompte, this.onDummyFail);
+            }
+            onGetDecompte(response) {
+                var tb = new AEBW.control.table('copro_table_decompte');
+                try {
+                    this.cleanTable(tb, tb._NbRows);
+                }
+                catch (e) {
+                    console.log("onGetDecompte unable to call cleanTable:" + e.message);
+                    for (var i = 0; i < tb._NbRows; i++) {
+                        tb.delRow(0);
+                    }
+                }
+                var entries = response.result.entries;
+                for (var i = 0; i < entries.length; i++) {
+                    var it = entries[i];
+                    var row = tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = it[0];
+                    tb.getCell(tb._NbRows - 1, 1).innerHTML = it[1];
+                    tb.getCell(tb._NbRows - 1, 2).innerHTML = it[2];
+                    row.cells[2].style.textAlign = "right";
+                    if (it[3] != 0.0) {
+                        tb.getCell(tb._NbRows - 1, 3).innerHTML = it[3];
+                        row.cells[3].style.textAlign = "right";
+                    }
+                    if (it[4] != 0.0) {
+                        tb.getCell(tb._NbRows - 1, 4).innerHTML = it[4];
+                        row.cells[4].style.textAlign = "right";
+                    }
+                    if (it[2] > it[3]) {
+                        row.cells[4].style.color = "red";
+                    }
+                }
+                var res = response.result.solde;
+                $('coproSoldeDebit').innerHTML = parseFloat(res[0]).toFixed(2);
+                $('coproSoldeCredit').innerHTML = parseFloat(res[1]).toFixed(2);
+                $('coproSoldeDecompte').innerHTML = "Solde : " + res[2];
+                if (parseFloat(res[2]) < 0.0) {
+                    $('coproSoldeDecompte').setStyle({ color: "#FF0000" });
+                }
+                else {
+                    $('coproSoldeDecompte').setStyle({ color: "#000000" });
+                }
+                this.getSoldeDecompte();
+            }
+            addCharge(charge) {
+                var tb = new AEBW.control.table('copro_table_decompte');
+                var row = tb.addRow();
+                tb.getCell(tb._NbRows - 1, 1).innerHTML = "CHARGES";
+                tb.getCell(tb._NbRows - 1, 2).innerHTML = "Charges courrantes latentes";
+                row.cells[2].style.textAlign = "right";
+                tb.getCell(tb._NbRows - 1, 3).innerHTML = charge;
+                row.cells[3].style.textAlign = "right";
+            }
+            getSoldeDecompte() {
+                var obj = this;
+                var _param = new services_1.Services.EntriesReqParams(gState.Exercice, this._acc);
+                let bindOnGetSoldeDecompte = this.onGetSoldeDecompte.bind(this);
+                this._retrieve.getSoldeAccount(_param, bindOnGetSoldeDecompte, this.onDummyFail);
+            }
+            onGetSoldeDecompte(response) {
+                var bilan = "";
+                var result = response.result;
+                var res = response.result.solde;
+                console.log("onGetSoldeDecompte: total_charge=" + result.total_charge + " appel=" + result.total_appel);
+                var detail_charge = response.result.detail_charge;
+                var total_charge = parseFloat(response.result.total_charge).toFixed(2);
+                var charges_laten = parseFloat(response.result.total_latente).toFixed(2);
+                var total_appel = parseFloat(response.result.total_appel).toFixed(2);
+                var total_ss_af = 0;
+                var charge_end = parseInt(this._exChargeEnd);
+                var closed = parseInt(this._exClosed);
+                if (parseFloat(res[2]) < 0.0) {
+                    total_ss_af = parseFloat(res[2]) + parseFloat(total_appel);
+                }
+                else
+                    total_ss_af = parseFloat(res[2]) - parseFloat(total_appel);
+                if (charge_end == 1) {
+                    var debit = parseFloat(res[0]);
+                    var solde = parseFloat(res[2]);
+                    var solde_total = solde;
+                    var debit_total = debit;
+                    if (closed == 0) {
+                        solde_total = solde_total - parseFloat(charges_laten);
+                        debit_total = debit_total + parseFloat(charges_laten);
+                    }
+                    if (solde_total < 0.0) {
+                        total_ss_af = solde_total + parseFloat(total_appel);
+                    }
+                    else
+                        total_ss_af = solde_total + parseFloat(total_appel);
+                    if (closed == 0)
+                        this.addCharge(parseFloat(charges_laten));
+                    $('coproSoldeDebit').innerHTML = debit_total.toFixed(2);
+                    $('coproSoldeCredit').innerHTML = parseFloat(res[1]).toFixed(2);
+                    if (closed == 1) {
+                        $('coproSoldeDecompte').innerHTML = "Solde : " + solde_total.toFixed(2) + " euros";
+                    }
+                    else {
+                        $('coproSoldeDecompte').innerHTML = "Solde : " + solde_total.toFixed(2) + " euros, (Solde sans appel de fonds:" + total_ss_af.toFixed(2) + " euros si non clos)";
+                    }
+                    if (solde_total < 0.0) {
+                        $('coproSoldeDecompte').setStyle({ color: "#FF0000" });
+                    }
+                    else {
+                        $('coproSoldeDecompte').setStyle({ color: "#000000" });
+                    }
+                }
+                else {
+                    $('coproSoldeDebit').innerHTML = res[0];
+                    $('coproSoldeCredit').innerHTML = res[1];
+                    if (closed == 1) {
+                        $('coproSoldeDecompte').innerHTML = "Solde : " + res[2] + " euros.";
+                    }
+                    else
+                        $('coproSoldeDecompte').innerHTML = "Solde : " + res[2] + " euros, (Solde sans appel de fonds:" + total_ss_af.toFixed(2) + " euros si non clos)";
+                    if (parseFloat(res[2]) < 0.0) {
+                        $('coproSoldeDecompte').setStyle({ color: "#FF0000" });
+                    }
+                    else {
+                        $('coproSoldeDecompte').setStyle({ color: "#000000" });
+                    }
+                }
+                try {
+                    bilan += "Total appel de fonds : " + total_appel + " €
Total charges         : " + total_charge + " €
";
+                    for (var c = 0; c < detail_charge.length; c++) {
+                        var i = detail_charge[c];
+                        bilan += "" + i[0] + "  " + i[1] + " €
";
+                    }
+                    $('copro_detail').innerHTML = bilan;
+                }
+                catch (e) {
+                    alert("Bilan Failed = " + e.message);
+                }
+            }
+            onLoaded(html) {
+                console.log("DlgDecompte::onLoaded call show");
+                if (gState.Mode != "S")
+                    this.show();
+            }
+            showDecompte(_acc) {
+                this._acc = _acc;
+                this.show();
+                console.log("showDecompte " + _acc);
+            }
+            onShow() {
+                this.getCopro();
+                this.getExercice(gState.Exercice);
+                if (gState.Mode == 'S') {
+                    this.getDecompte();
+                }
+            }
+        }
+        Coproprieraite.DlgDecompte = DlgDecompte;
+        class DlgUsers extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._users = new services_1.Services.Users(req);
+            }
+            onDummy(response) {
+                alert("DlgUsers::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgUsers::Dummy Error");
+            }
+            addCopro(i) {
+                console.log("TODO call Users addUserInOrg " + gState.Organization);
+                var _param = new services_1.Services.UserReqParams(gState.Organization, i);
+                let bindFct = this.onAddCopro.bind(this);
+                this._users.addInOrg(_param, bindFct, this.onDummyFail);
+            }
+            updateCopro(i) {
+                console.log("TODO call Users addUserInOrg update " + gState.Organization);
+                var _param = new services_1.Services.UserReqParams(gState.Organization, i, true);
+                let bindFct = this.onAddCopro.bind(this);
+                this._users.addInOrg(_param, bindFct, this.onDummyFail);
+            }
+            onAddCopro(response) {
+                console.log("DlgUser::onAddCopro ");
+                this.showList();
+            }
+            getUsers() {
+                console.log("DlgUsers::getUsers maybe I should be able to decide which user");
+                var _param = new services_1.Services.DummyReqParams();
+                let bindOnGetUsers = this.onGetUsers.bind(this);
+                this._users.getCoproprietaires(_param, bindOnGetUsers, this.onDummyFail);
+            }
+            prepareUpdateUser(_uid) {
+                console.log("DlgUsers::prepareUpdateUser " + _uid);
+                var _param = new services_1.Services.DummyReqParams(_uid);
+                let bindFct = this.onPrepareUpdateUser.bind(this);
+                this._users.getCoproprietaires(_param, bindFct, this.onDummyFail);
+            }
+            onPrepareUpdateUser(response) {
+                try {
+                    var it = response.result[0];
+                    if (!Array.isArray(it)) {
+                        console.log("DlgUser::onPrepareUpdateUser result not an aray aieee");
+                    }
+                    $('copro_name').value = it[1];
+                    $('copro_firstname').value = it[2];
+                    $('copro_address').value = it[3];
+                    $('copro_code').value = it[4];
+                    $('copro_ville').value = it[5];
+                    $('copro_email1').value = it[7];
+                    $('copro_mobile').value = it[6];
+                    this.toogleView(true);
+                }
+                catch (e) {
+                    console.log("onPrepareUpdateUser " + e.message);
+                }
+            }
+            toogleView(_bool) {
+                if (_bool) {
+                    $('copro-users-edit').removeClassName("hidden");
+                    $('copro-user-list').addClassName("hidden");
+                    $('copro-user-list').removeClassName("dcol-container");
+                }
+                else {
+                    $('copro-users-edit').addClassName("hidden");
+                    $('copro-user-list').addClassName("dcol-container");
+                    $('copro-user-list').removeClassName("hidden");
+                }
+            }
+            onGetUsers(response) {
+                var entries = response.result;
+                this.fillUsers(entries);
+            }
+            associateAccount(_uid, _acc, _ass = 1) {
+                var _param = new services_1.Services.ReqThreeParams(_uid, _acc, _ass.toString());
+                let bindFct = this.onAssociate.bind(this);
+                this._users.associateAccount(_param, bindFct, this.onDummyFail);
+            }
+            onAssociate(response) {
+                this.showList();
+            }
+            getAccounts() {
+                let bindFct = this.onGetAccounts.bind(this);
+                super.getCoproAccounts(bindFct, this.onDummyFail);
+            }
+            onGetAccounts(response) {
+                var result = response.result;
+                var _s = super.fillCombo;
+                var _obj = this;
+                var _NullA = { 'acc_id': 0, 'acc_desc': 'No Account' };
+                result.splice(0, 0, _NullA);
+                console.log("DlgUser::onGetAccounts length =" + result.length);
+                $$("select[id='user-account']").each(function (elt) {
+                    _s(elt, result);
+                    elt.on("change", function (evt) {
+                        var uid = elt.getAttribute('uid');
+                        evt.stopImmediatePropagation();
+                        evt.preventDefault();
+                        console.log("Account Changed  user : " + uid + " value=" + elt.value);
+                        _obj.associateAccount(uid, elt.value, 1);
+                    });
+                });
+            }
+            fillUsers(entries) {
+                var _obj = this;
+                var cl = 'copro-user-list';
+                var c1 = $(cl + '-c1');
+                var c2 = $(cl + '-c2');
+                var ng = $(cl + '');
+                c1.innerHTML = "";
+                c2.innerHTML = "";
+                for (var i = 0; i < entries.length; i++) {
+                    var it = entries[i];
+                    if (i < entries.length / 2) {
+                        this.fillUser2c(c1, it);
+                    }
+                    else {
+                        this.fillUser2c(c2, it);
+                    }
+                }
+                if (gState.Mode == 'S') {
+                    this.getAccounts();
+                }
+                $$("a[id='user-modifier']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("Modifier user : " + uid);
+                        CoproUsers.prepareUpdateUser(uid);
+                    });
+                });
+                $$("a[id='user-paye']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        var compte = elt.getAttribute('compte');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgUser:: a paye user : " + uid);
+                        CoproPay.showPay();
+                    });
+                });
+                $$("a[id='user-decompte']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        var compte = elt.getAttribute('compte');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgUser:: a decompte user : " + uid);
+                        Copropriete.showDecompte(compte);
+                    });
+                });
+                $$("a[id='user-dissocier']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgUser:: dissocier user : " + uid);
+                        _obj.associateAccount(uid, "0", 0);
+                    });
+                });
+            }
+            fillUser2c(row, it) {
+                var d = " " + it[1] + " " + it[2];
+                d += "Dissocier 
";
+                    }
+                    else {
+                        d += "Pas de compte associé :                                
";
+                    }
+                }
+                d += "";
+                if (it[8] != 0) {
+                    d += "";
+                    d += "   ";
+                    d += "";
+                    d += " ";
+                }
+                d += " ";
+                d += "
+    User Managment 
+    
+        
+
+        
+        Décompte de charges  
+         
+        
+
+        
+          
+            Information Générales 
+              
+                Télécharger   
+           
+        
+         
+          
+            
+                Compte 
+                
+                    
+                        Date 
+                        Réf 
+                        Désignaion 
+                        Débit 
+                        Crédit  
+                 
+                
+                    02/01/2013 12435 Facture fioul 100 05/01/2013 98547 Charge Assurance 
+                        87 
+                    06/01/2013 d1 Virement 211 10/01/2013 xc1234 Charge EDF PC2  178 
+                     
+         
+             Solde: 0.0 0.0  
+            
+         
+            
+         
+     
+ 
diff --git a/app/compta/copro_entretien.xml b/app/compta/copro_entretien.xml
new file mode 100644
index 0000000..8da2716
--- /dev/null
+++ b/app/compta/copro_entretien.xml
@@ -0,0 +1,47 @@
+
+
+
+
+  Carnet d'entretien 
+  
+    
+        
+    
+       
+        Période d'entretien  
+        
+          
+              Exercice 
+                   
+         
+       
+      
+      Saisir 
+      
+        
+               Date   Titre   Détail   
+        
+          
+          Enregistrer 
+                
+       
+       
+      
+       
+            
+   
+ 
+
diff --git a/app/compta/copro_pay.xml b/app/compta/copro_pay.xml
new file mode 100644
index 0000000..ad91088
--- /dev/null
+++ b/app/compta/copro_pay.xml
@@ -0,0 +1,68 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+        
+          Enregistré un payment 
+           
+Versement  
+
+          
+              Intitule Coproprietaire 
+                   Date Saisie Banque 
+                   Date Facture Reference  Montant  
+        
+          Enregistrer 
+          Annuler 
+	     
+ 
+ 
+     
+    
+    
+          Enregistré un appel de fond 
+           
+            Appel de fond 
+            
+                
+                      Intitule Coproprietaire 
+                          Date Saisie: Montant: Envoyer un email:  
+                
+                  Enregistrer 
+                        
+             
+             
+
+     
+    
+     
+     
+ 
diff --git a/app/compta/copro_role.xml b/app/compta/copro_role.xml
new file mode 100644
index 0000000..468be6e
--- /dev/null
+++ b/app/compta/copro_role.xml
@@ -0,0 +1,54 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+  
+     
+      Selection Role 
+      
+          
+              Roles : 
+                   
+       
+     
+         
+        
+          
+          
+            
+              
+                Nom 
+                Prénom 
+                Sel  
+          
+         
+              
+         
+             
+          
+	  
+         
+	        
+
+     
+ 
diff --git a/app/compta/copro_users.xml b/app/compta/copro_users.xml
new file mode 100644
index 0000000..b0e837f
--- /dev/null
+++ b/app/compta/copro_users.xml
@@ -0,0 +1,44 @@
+
+
+
+
+  User Managment 
+  
+    
+    
+    
+      Copropriétaires 
+      
+         
+          Information Copropriétaire 
+          
+            
+              Nom Prénom Adresse Email 1 Code Postal Email 2 Ville Mobile  
+            
+              Modifier 
+              Nouveau 
+             
+           
+         
+        
+      
+        
+         
+        
+         
+       
+      
+   
+ 
diff --git a/app/compta/coprote.js b/app/compta/coprote.js
new file mode 100644
index 0000000..9367d34
--- /dev/null
+++ b/app/compta/coprote.js
@@ -0,0 +1,193 @@
+define(["require", "exports", "../../js/xgui/CtrlDialogbox", "./services"], function (require, exports, CtrlDialogbox_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Copropriete;
+    (function (Copropriete) {
+        class DlgParameter extends CtrlDialogbox_1.Dialogbox {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgParameter constructor");
+                super(_id);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                this._user = new services_1.Services.Users(req);
+                this.Current = 0;
+                super.load(uipath);
+            }
+            onDummy(response) {
+                alert("DlgParameter::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgParameter::Dummy Error");
+            }
+            getAccountInfo() {
+                var _param = new services_1.Services.DummyReqParams();
+                _param.dummy = "";
+                let bindFct = this.ongetAccountInfo.bind(this);
+                this._pcmn.getAccountInfo(_param, bindFct, this.onDummyFail);
+            }
+            ongetAccountInfo(response) {
+                var result = response.result;
+                $('addr').value = result.addr;
+                $('act').value = result.act;
+                $('ville').value = result.ville;
+                $('cp').value = result.cp;
+            }
+            getDossiers() {
+                var _param = new services_1.Services.DummyReqParams();
+                _param.dummy = "";
+                let bindFct = this.ongetDossiers.bind(this);
+                this._user.Organisations(_param, bindFct, this.onDummyFail);
+            }
+            ongetDossiers(response) {
+                var res = response.result;
+                var sum = "";
+                try {
+                    for (var i = 0; i < res.length; i++) {
+                        var row = res[i];
+                        if (this.Current == row[0]) {
+                            sum += "En cours d'utilisation " + row[1] + " voir (";
+                            sum += "detail )";
+                            sum += " ";
+                        }
+                        else {
+                            sum += "" + row[1] + " ";
+                            sum += "Nouvelle Organisation ";
+                    sum += " ";
+                    $('parameters-list').innerHTML = sum;
+                }
+                catch (e) {
+                    alert("ongetDossiers Failed " + e.message);
+                }
+            }
+            switchDossier(dossier) {
+                var _param = new services_1.Services.DummyReqParams();
+                _param.dummy = dossier;
+                let bindFct = this.onswitchDossier.bind(this);
+                this._user.switchOrg(_param, bindFct, this.onDummyFail);
+            }
+            onswitchDossier(response) {
+                console.log("Switched dossier go back to main");
+                this.Current = response.result[0];
+                $('gestion-compta').innerHTML = response.result[1];
+                window.location.href = "/app/compta/services.php/";
+            }
+            getCurrentOrg() {
+                var _param = new services_1.Services.DummyReqParams();
+                _param.dummy = "";
+                let bindFct = this.ongetCurrentOrg.bind(this);
+                this._user.currentOrg(_param, bindFct, this.onDummyFail);
+            }
+            ongetCurrentOrg(response) {
+                this.Current = response.result[0];
+                try {
+                    $('gestion-compta').innerHTML = response.result[1];
+                }
+                catch (e) {
+                    alert("ongetCurrentOrg Failed " + e.message);
+                }
+            }
+            showList() {
+                this.show();
+                try {
+                    var p = $("parameters");
+                    if (p != null)
+                        $("parameters").addClassName("hidden");
+                }
+                catch (e) {
+                    alert("showList Failed " + e.message);
+                }
+                this.getCurrentOrg();
+                this.getDossiers();
+            }
+            showDetail() {
+                this.show();
+                $("parameters-summary").addClassName("hidden");
+                this.getAccountInfo();
+            }
+            onShow() {
+            }
+            onLoaded(ht) {
+                this.showList();
+            }
+        }
+        Copropriete.DlgParameter = DlgParameter;
+        class DlgWizard extends CtrlDialogbox_1.Dialogbox {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgWizard constructor");
+                super(_id);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                this._user = new services_1.Services.Users(req);
+                super.load(uipath);
+            }
+            onDummy(response) {
+                alert("DlgWizard::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgWizard::Dummy Error");
+            }
+            onShow() {
+                console.log("DlgWizard::onShow, create Wizard object");
+                this._wizard = new AEBW.control.Wizard('wizard', ['wp1', 'wp2', 'wp3', 'wp4', 'wp6']);
+                AEBW.mixin(this._wizard, this);
+            }
+            onNext(curr_id) {
+                var _ret = false;
+                switch (curr_id) {
+                    case "wp1":
+                        _ret = this.createOrg();
+                        break;
+                    case "wp2":
+                        _ret = true;
+                        break;
+                    case "wp3":
+                        _ret = true;
+                        break;
+                    case "wp4":
+                        _ret = true;
+                        break;
+                }
+                return _ret;
+            }
+            onPrev(curr_id) {
+                console.log("DlgWizard::onPrev");
+            }
+            uploadCsv(name, obj) {
+                var req = AEBW.HTTPRequest();
+                try {
+                    var data = new FormData();
+                    data.append(name, obj);
+                    req.open("POST", "/app/compta/upload.php", true);
+                    req.send(data);
+                }
+                catch (e) {
+                    alert("uploadCsv Failed:" + e.message);
+                }
+            }
+            createOrg() {
+                var _org = new services_1.Services.Organisation($('act').value, $('addr').value, $('cp').value, $('ville').value);
+                var _param = new services_1.Services.CreateOrgReqParams(_org);
+                let bindFct = this.onCreateOrg.bind(this);
+                if (_org.isValid()) {
+                    this._user.createOrg(_param, bindFct, this.onDummyFail);
+                    return true;
+                }
+                else {
+                    return false;
+                }
+            }
+            onCreateOrg(response) {
+                if (response.error != null) {
+                }
+                else {
+                    var _r = response.result;
+                    console.log("onCreateOf:: success rid=" + _r.id + " new Org=" + _r.org_id);
+                }
+            }
+        }
+        Copropriete.DlgWizard = DlgWizard;
+    })(Copropriete = exports.Copropriete || (exports.Copropriete = {}));
+});
diff --git a/app/compta/coproteBootstrap.js b/app/compta/coproteBootstrap.js
new file mode 100644
index 0000000..9d5dba9
--- /dev/null
+++ b/app/compta/coproteBootstrap.js
@@ -0,0 +1,71 @@
+requirejs.config({
+    baseUrl: '../..',
+    paths: {
+        "cpt": "/app/compta",
+        "xgui": "/js/xgui",
+        "tslib": "/js/tslib",
+        "" : ""
+    },
+    shim: {
+        "coprote": {
+            deps: [ 'aebw'
+		  , 'xgui_dialogbox'
+		  , 'xgui/xgui_json'
+		  , 'xgui/xgui_wizard'
+		  , 'cpt/Dialog'
+		  , 'js/scriptaculus/prototype'],
+            exports: 'Copropriete',
+            init: function (x) {
+            }
+        },
+        "Dialog": {
+            deps: ['xgui/xgui_dialogbox'],
+            exports: ''
+        },
+        "lots": {
+            deps: [ 'xgui/xgui_dialogbox'
+		  , 'cpt/Dialog'
+                  , 'cpt/services'
+	    ],
+            exports: ''
+        },
+        "xgui_dialogbox": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        },
+        "xgui_wizard": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        },
+        "xgui_json": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        }
+/*
+           , "xgui/xgui_wizard"
+
+ */
+    }
+});
+requirejs(["require", "exports"
+           , "tslib"
+           , "xgui/xgui_json"
+           , "xgui/xgui_dialogbox"
+           , "xgui/xgui_wizard"
+           , "cpt/transaction"
+           , "cpt/services"
+           , "cpt/lots"
+           , "cpt/coprote"], function (req,exp,ts,xj,xd,xw,trs,srv,Lots,myApp) {
+    console.log("starting Copropriete  application..");
+    var Params = myApp.Copropriete.Params;
+    //CoproPay.showPay();
+    // To allow access in web page.
+    window.Params = Params;
+    if (gState.Mode != 'S') {
+      console.log("Copropriete disable some menues   application..");
+      $('smCoproteLots').parentElement.style.display = 'none';
+      $('smCoprotePostes').parentElement.style.display = 'none';
+      $('smCoproteOrg').parentElement.style.display = 'none';
+    } else {
+    }
+});
diff --git a/app/compta/entretien.js b/app/compta/entretien.js
new file mode 100644
index 0000000..ec29456
--- /dev/null
+++ b/app/compta/entretien.js
@@ -0,0 +1,71 @@
+define(["require", "exports", "../../js/xgui/CtrlDialogbox", "./services"], function (require, exports, CtrlDialogbox_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Coprorietaire;
+    (function (Coprorietaire) {
+        class DlgEntretien extends CtrlDialogbox_1.Dialogbox {
+            constructor(_id, jurl) {
+                console.log("DlgEntretien constructor");
+                super(_id);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+            }
+            onDummy(response) {
+                alert("DlgEntretien::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgEntretien::Dummy Error");
+            }
+            ongetExercices(response) {
+                var d = new Date();
+                var cb = $('cbCoproExercices');
+                cb.options.length = 0;
+                for (var i = 0; i < response.result.length; i++) {
+                    var item = response.result[i];
+                    cb.options[cb.options.length] = new Option(item[3], item[3]);
+                    if (d.getFullYear() == item[3])
+                        cb.selectedIndex = i;
+                }
+                var obj = this;
+                Prototype.Event.observe($('cbCoproExercices'), "change", function () {
+                    obj.getEntretien();
+                });
+                this.getEntretien();
+            }
+            updateEntretien(id, title, content) {
+                var params = { 'id': id,
+                    'title': title,
+                    'content': content
+                };
+                var obj = this;
+            }
+            onupdateEntretien(response) {
+            }
+            newEntretien(dt, title, desc) {
+                var d = new Date();
+                var m = d.getMonth() + 1;
+                var day = d.getDate();
+                var params = { 'date': dt,
+                    'title': title,
+                    'content': desc
+                };
+            }
+            getEntretien() {
+                var params = { 'period': $("cbCoproExercices").value };
+                var obj = this;
+            }
+            ongetEntretien(response) {
+                var obj = this;
+                var details = $('copro_entretien_details');
+                details.innerHTML = "";
+            }
+            onShow() {
+                var obj = this;
+                Prototype.Event.observe($("btEntretienRecord"), "click", function () {
+                    obj.newEntretien($('entretien_date').getValue(), $('entretien_title').getValue(), $('entretien_content').getValue());
+                });
+            }
+        }
+        Coprorietaire.DlgEntretien = DlgEntretien;
+    })(Coprorietaire = exports.Coprorietaire || (exports.Coprorietaire = {}));
+});
diff --git a/app/compta/exercice.js b/app/compta/exercice.js
new file mode 100644
index 0000000..0c31790
--- /dev/null
+++ b/app/compta/exercice.js
@@ -0,0 +1,204 @@
+define(["require", "exports", "./Dialog", "./services"], function (require, exports, Dialog_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Exercice;
+    (function (Exercice_1) {
+        class DlgExercice extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._exercice = new services_1.Services.Exercice(req);
+                this.tableExercices = function () {
+                    return new AEBW.control.table('table_exercice');
+                };
+            }
+            onDummy(response) {
+                alert("DlgPaye::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgPaye::Dummy Error");
+            }
+            getExercices() {
+                var _param = new services_1.Services.DummyReqParams();
+                let bindOnGetExercice = this.onGetExercices.bind(this);
+                this._exercice.list(_param, bindOnGetExercice, this.onDummyFail);
+            }
+            onGetExercices(response) {
+                var tb = this.tableExercices();
+                var Ex = this;
+                var bindSetCurrent = this.setCurrent.bind(this);
+                try {
+                    this.cleanTable(tb, tb._NbRows);
+                }
+                catch (e) {
+                    console.log("onGetExercices Failed:" + e.message);
+                }
+                if (response.result == null || response.result == 0) {
+                    console.log("DlgExercice::onGetExercices ... result == null no exercices");
+                    return;
+                }
+                for (var i = 0; i < response.result.length; i++) {
+                    var it = response.result[i];
+                    var act = '
+    Exercice Managment 
+    
+        
+
+        
+
+         
+           
+Nouvel Exercice  
+
+          
+              Label Début Période Fin de Période  
+        
+          
+          Ajouter 
+ 
+                
+ 
+ 
+        
+          Les exerices 
+          
+          
+            
+              
+                Exercice 
+                Date de Début 
+                Date de Fin 
+              
+          
+         
+              
+	  
+         
+        
+          Cloture de compte 
+         
+
+	        
+
+     
+ 
+
diff --git a/app/compta/exerciceBootstrap.js b/app/compta/exerciceBootstrap.js
new file mode 100644
index 0000000..eb0e00d
--- /dev/null
+++ b/app/compta/exerciceBootstrap.js
@@ -0,0 +1,63 @@
+requirejs.config({
+    baseUrl: '../..',
+    urlArgs: "v=" + (new Date()).getTime() , /* For debug*/	
+    paths: {
+        "cpt": "/app/compta",
+        "xgui": "/js/xgui",
+        "tslib": "/js/tslib",
+        "" : ""
+    },
+    shim: {
+        "exercice": {
+            deps: [ 'aebw'
+		  , 'xgui_dialogbox'
+		  , 'xgui_json'
+		  , 'cpt/transaction'
+		  , 'cpt/Dialog'
+		  , 'js/scriptaculus/prototype'],
+            exports: 'Exercice',
+            init: function (x) {
+            }
+        },
+        "copro-ng": {
+            deps: ['aebw'
+                   , 'xgui_dialogbox'
+                   , 'xgui/xgui_json'
+                   , 'cpt/Dialog'
+                   , 'services'
+                   ,'js/scriptaculus/prototype'],
+            exports: 'copro',
+            init: function (x) {
+            }
+        },
+        "Dialog": {
+            deps: ['xgui/xgui_dialogbox'],
+            exports: ''
+        },
+        "xgui_dialogbox": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        },
+        "xgui_json": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        }
+    }
+});
+requirejs(["require", "exports"
+           , "tslib"
+           , "xgui/xgui_json"
+           , "xgui/xgui_dialogbox"
+           , "cpt/Dialog"
+           , "cpt/services"
+           , "cpt/exercice"], function (req,exp,ts,a,b,dlg,serv,Ex) {
+    console.log("starting Exercice application...");
+    $('exercice-new').addClassName('hidden');
+    $('exercice-close').addClassName('hidden');
+    try {
+        Ex.Exercice.Exercice.getExercices();
+    } catch (e) {
+        console.log("Bootstrap getExercice faild:"+e.message);
+    }
+    //Ex.Exercice.Exercice.show();
+});
diff --git a/app/compta/forms.php b/app/compta/forms.php
new file mode 100644
index 0000000..b9cfbca
--- /dev/null
+++ b/app/compta/forms.php
@@ -0,0 +1,197 @@
+siteScheme().$_SERVER['SERVER_NAME'];
+        $this->panel = $_panel;
+        $this->retrieve = new Retrieve($this->getSession(),$this->conf_auth, $this->getSession()->getDb());
+    }
+    /*
+     * @brief compute complete 
+     * html output based on xsl and xml
+     */
+    function showXML ($file)  {
+       $xml = new DomDocument();
+       $xml->load($file);
+       if ($html = $this->xp->transformToXML($xml) ) {
+           echo $html;
+       } else {
+           echo "Failed Transform XML\n";
+       }
+    }
+    /*
+     * @brief compute embedded 
+     * html output based on xsl and xml.
+     * unlike complete page, only the content
+     * is computed. header and footer are left
+     * to php script
+     * Compared to parent class that also performs script injection
+     * and script update.
+     */
+    function showEmbeddedXML ($file)  {
+       //$_books         = array('jrnx','jrnx_record',',jrnx_transactions');
+       $_books         = array('jrnx_record','jrnx_transactions');
+       $namespace      = "";
+       $params["mode"] = 'embedded-panel';
+       $xml            = new DomDocument();
+       $xml->validateOnParse = true;
+       $xml->load($file);
+       if (in_array($this->panel,$_books)) {
+         $this->updateJrnxBookInXml($xml);
+       }
+       $this->xp->setParameter($namespace,$params);   
+       if ($html = $this->xp->transformToXML($xml) ) {
+           echo $html;
+       } else {
+           echo "Failed Transform XML\n";
+       }
+    }
+    function updateJrnxBookInXml($xml) {
+        $book = $this->getElementById($xml,"jrnxBook");
+        // Remove all children
+        if ($book == null)
+        {
+          error_log("updateJrnxBookInXml book is null not good");
+          return;
+        }
+        try {
+          //while ( $element = $book->item(0)) {
+          //error_log("updateJrnxBookInXml book rm");
+          // $element->parentNode->removeChild($element);
+          //}
+        } catch  (Exception $e) {
+        }
+        // Request all JrnxTypes through api_retrieve
+        $jrnxType = $this->retrieve->getEntryTypes();
+        foreach ($jrnxType as $type) {
+          $entry = $xml->createElement('Entry');
+          $key   = $xml->createAttribute('key');
+          $key->value   = $type[1];
+          $value = $xml->createAttribute('value');
+          $value->value = $type[0];
+          $entry->appendChild($key);
+          $entry->appendChild($value);
+          $book->appendChild($entry);
+        }
+    }
+    /**
+     * @brief TO REMOVE
+     */
+    function compta($form)
+    {
+        switch ($form)
+        {
+        case "pcmn":
+            $this->file = "compta/pcmn.xml";
+             break;
+        case "syndic":
+            $this->file = "compta/ledger_syndic.xml";
+             break;
+        case "eglise":
+            $this->file = "compta/ledger_church.xml";
+             break;
+        case "idx":
+            $this->file = "compta/index.xml";
+             break;
+        case "jrnx":
+            $this->file ="compta/journaux.xml";
+             break;
+        default:
+            $this->file = "compta/index.xml";
+        }
+    }
+    function admin($form)
+    {
+        switch ($form)
+        {
+            case "user":
+                $this->file = "admin/view/index.fr_FR.UTF-8.xml";
+                break;
+            default:
+                $this->file = "compta/index.xml";
+        }
+    }
+
+    function showHTML() {
+       echo "PHP Applications "; 
+       $arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
+
+       echo <<Applications
+       
+END;
+
+     }
+    
+    function main() {
+        if ($this->file == "") {
+            $this->showHTML();
+        } else {
+            $this->showEmbeddedXML($this->file);
+        }
+    }    
+    
+}
+/**
+ * Main entry point for Forms. Return a tranformed 
+ * xml file. The file is selected according to the panel
+ * name.
+ */
+if (isset($_GET['form']) ) {
+    $form = $_GET['form'];
+    error_log("forms.php $_GET[form] should not be called");
+} elseif (isset($_GET['panel'])) {
+    $panel = $_GET['panel'];
+    $page = new Forms($frame['compta'][$panel],$panel);
+    if (isset($frame['compta'][$panel])) {
+        $page->showEmbeddedXML($frame['compta'][$panel]);
+    } else 
+        $page->showXML('index.xml');
+} else {
+    error_log("forms.php GET['panel'] not set AIE");
+}  
+?>
diff --git a/app/compta/index.php b/app/compta/index.php
new file mode 100644
index 0000000..cf661f8
--- /dev/null
+++ b/app/compta/index.php
@@ -0,0 +1,117 @@
+conf_auth = $conf['auth']['mysql'];
+    $this->session   = $_session;
+  }
+  /**
+   *
+   */
+  function getDb() {
+    return $this->session->getDb();
+  }
+
+  /**
+   *
+   */
+  function Service($request) {
+      return $request['service'];
+  }
+  /**
+   *
+   */
+  private function getObjectInstance($request)
+  {
+    $conf_auth = $this->conf_auth;
+    $s = $this->session;
+    $pcmn = null;
+    switch ($this->Service($request))
+    {
+      case "pcmn":
+        require_once(dirname(__FILE__)."/api_pcmn.php");
+        $pcmn = new Pcmn($s,$conf_auth, $this->getDb());
+        break;
+      case "ident":
+        require_once(dirname(__FILE__)."/api_identity.php");
+        $pcmn = new Identity($s, $conf_auth);
+     break;
+      case "retrieve":
+        require_once(dirname(__FILE__)."/api_retrieve.php");
+        $pcmn = new Retrieve($s,$conf_auth, $this->getDb());
+      break;
+      case "booking":
+        require_once(dirname(__FILE__)."/api_booking.php");
+        $pcmn = new Booking($s,$conf_auth, $this->getDb());
+      break;
+      case "budget":
+        require_once(dirname(__FILE__)."/api_budget.php");
+        $pcmn = new Budget($s,$conf_auth, $this->getDb());
+      break;
+      case "syndic":
+        require_once(dirname(__FILE__)."/api_syndic.php");
+        $pcmn = new Syndic($s,$conf_auth, $this->getDb());
+      break;
+      case "entretien":
+        require_once(dirname(__FILE__)."/api_entretien.php");
+        $pcmn = new Entretien($s,$conf_auth, $this->getDb());
+      break;
+      case "exercice":
+        require_once(dirname(__FILE__)."/api_exercice.php");
+        $pcmn = new Exercice($s,$conf_auth, $this->getDb());
+        break;
+    }
+    return $pcmn;
+  }
+  /**
+   *
+   */
+  function processRequest($request) {
+    $pcmn = $this->getObjectInstance($request);
+    if ($pcmn != null)
+    {
+      if ( ! JsonRPCServer::handle($pcmn,$request) ) {
+        log_error("Request is not Json.". " Content Meth:".$_SERVER['REQUEST_METHOD']." Content Type:".$_SERVER['CONTENT_TYPE']);
+      }
+    } else {
+      $res = array('id' => '1','result' => 'failed', 'error' => 'Unkonwn service');
+      header('X-JSON: '.json_encode($res));
+    }
+  }
+}
+
+/**
+ * @brief Main entry
+ */
+GLOBAL $conf;
+$conf_auth = $conf['auth']['mysql'];
+$s = new SessionCompta($conf_auth,$conf_auth['req_file']);
+if ($s->is_logged_in() ) {
+  $p = New Compta($s,"/sql-requests.xml");
+  if ($_SERVER['REQUEST_METHOD'] == "POST") {
+    $request = $p->getContent();
+    $p->processRequest($request);
+  } else  {
+    $res = array('id' => "1",'result' => 'failed', 'error' => 'Unkonwn service wrong');
+    header('X-JSON: '.json_encode($res));
+  }
+} else {
+  $res = array('result' => 'failed', 'reason' => 'User not authenticated');
+  header('X-JSON: '.json_encode($res));
+}
+
+
+/*
+  :vim:et:ts=2:sw=2:encoding=utf-8
+ */
+?>
diff --git a/app/compta/index.xml b/app/compta/index.xml
new file mode 100644
index 0000000..284419e
--- /dev/null
+++ b/app/compta/index.xml
@@ -0,0 +1,240 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+        Administration des utilisateurs  
+        
+        
+        
+        
+                
+          
+              Utilisateur 
+          
+		  
+			  Her
+                  
+	    
+            
+                    Plan Comptable 
+                
+                    1 Comptes de capitaux 
+                 
+                
+                    2 Comptes d immobilisation 
+                 
+                
+                    3 Stock et Command 
+                 
+                
+                    4 Comptes Tiers 
+                 
+                
+                    5 Comptes Financiers 
+                 
+                
+                    6 Comptes Charges 
+                 
+                
+                    7 Comptes Produits 
+                 
+                
+                    8 Hors Comptabilite 
+                 
+                
+                    9 Comptes Analytiques 
+                 
+             
+        
+        
+            
Test What happens here
+            
+             System 
+             
+              
+      
+     
+           
+          
+              Groupes 
+              
+                simpe test
+               
+           
+          
+              Frogs 
+              
+                Ok, 
+            
+             Info Gen 
+	     
+		     Une info:
+              
+            
+               
+           
+            
+
+      
+        
 
+           
+
+
+          
+          
+              Groupes 
+              
+ Strange
+                
+                    authentication 
+                    
+                        Test Content 
+                        do_invoke 
+                     
+                 
+                
+                    alias 
+                    
+                        display boxes : enable 
+                     
+                 
+                
+                    ssl 
+                    
+                        display boxes: 
+                            enable 
+                            disable 
+                         
+                     
+                 
+                
+                
+             
+           
+              
+          
+              Eglise 
+            
+                Page de debug pour web_server.
+                
+                    Yes 
+                    Vide
+   
+   
+             
+         
+        
+            T table 
+            
+                Test Table Stuff
+                
+                    Titre du tableau 
+                    
+                        r1 r2  
+                    
+                        Un test pour voir d1 Un bouton add 
+                        Un test pour voir d1 Un bouton rm 
+                         
+                
+                End Table
+                
+             
+         
+            
+                Calendar 
+                
+                    Test12
+                    
+                    
+                 
+             
+         
+
+     
+ 
diff --git a/app/compta/journaux.js b/app/compta/journaux.js
new file mode 100644
index 0000000..546bc49
--- /dev/null
+++ b/app/compta/journaux.js
@@ -0,0 +1,764 @@
+define(["require", "exports", "../../js/xgui/Xgui", "./Dialog", "./transaction", "./services"], function (require, exports, Xgui_1, Dialog_1, transaction_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Journaux;
+    (function (Journaux) {
+        class DlgJrnxBase extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgJrnxBase constructor");
+                super(_id, uipath, jurl);
+                this._bookcb = "jrnxBook";
+                var req = new AEBW.Json(jurl);
+                this._retrieve = new services_1.Services.Retrieve(req);
+            }
+            setSelectedIndex(s, v) {
+                try {
+                    console.log("Try to set option on jrnxBook :" + s.options.length + " " + v);
+                    for (var i = 0; i < s.options.length; i++) {
+                        if (s.options[i].text == v) {
+                            s.options[i].selected = true;
+                            return;
+                        }
+                    }
+                }
+                catch (e) {
+                    console.log("Failed set index " + e.message);
+                }
+                s.value = v;
+            }
+            getJrnxType() {
+                var params = new services_1.Services.EmptyReqParams();
+                var bindFct = this.onGetJrnxType.bind(this);
+                this._retrieve.getEntryTypes(params, bindFct, this.onDummyFail);
+            }
+            onDummyFail() {
+                alert("DlgParameter::Dummy Error");
+            }
+            onGetJrnxType(response) {
+                var obj = this;
+                try {
+                    var cb = $(this._bookcb);
+                    if (cb == null) {
+                        alert('onGetJrnxType failed cb is NULL: ');
+                    }
+                    cb.options.length = 0;
+                    for (var i = 0; i < response.result.length; i++) {
+                        var item = response.result[i];
+                        cb.options[cb.options.length] = new Option(item[1], item[0]);
+                    }
+                    console.log("DlgJrnxBase::onGetJrnxType:" + cb.options.length);
+                }
+                catch (e) {
+                    console.log("Failed :" + e.message);
+                }
+            }
+        }
+        class DlgJrnx extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgJrnx constructor");
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._retrieve = new services_1.Services.Retrieve(req);
+                this._load_jrnx = true;
+                this.table = null;
+                customElements.whenDefined('xgui-entry').then(() => {
+                    console.log("xgui-entry defined");
+                });
+            }
+            onDummy(response) {
+                alert("DlgParameter::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgParameter::Dummy Error");
+            }
+            getJrnxType() {
+                var params = new services_1.Services.EmptyReqParams();
+                var bindFct = this.onGetJrnxType.bind(this);
+                this._retrieve.getEntryTypes(params, bindFct, this.onDummyFail);
+            }
+            onGetJrnxType(response) {
+                var obj = this;
+                try {
+                    var cb = $('jrnxBook');
+                    if (cb == null) {
+                        alert('onGetJrnxType failed cb is NULL: ');
+                    }
+                    cb.options.length = 0;
+                    for (var i = 0; i < response.result.length; i++) {
+                        var item = response.result[i];
+                        cb.options[cb.options.length] = new Option(item[1], item[0]);
+                    }
+                }
+                catch (e) {
+                    console.log("Failed :" + e.message);
+                }
+            }
+            updateJrnx() {
+                console.log("updateJrnx " + $('jrnxBook').value);
+                this.table.getJrnx(gState.Exercice, $('jrnxBook').value);
+            }
+            onShow() {
+                console.log("DlgJrnx::onShow");
+                var obj = this;
+                this._load_jrnx = true;
+                this.getJrnxType();
+                if ($('jrnxBook') != null) {
+                    Prototype.Event.observe("jrnxBook", 'change', function () {
+                        obj.updateJrnx();
+                    });
+                }
+                try {
+                    $("iExercice").innerHTML = gState.Exercice;
+                    this.table = new TableJournal('table_jrnx', this.Url());
+                    this.table.eraseAllRows();
+                    this.updateJrnx();
+                }
+                catch (e) {
+                    console.log("onShow something went wrong :" + e.message);
+                }
+            }
+            onLoaded(ht) {
+                console.log("DlgJrnx::onLoad " + this.declaredClass + "\n");
+                this.show();
+            }
+        }
+        Journaux.DlgJrnx = DlgJrnx;
+        class TableJournal extends Xgui_1.Xgui.Table {
+            constructor(_id, _jurl) {
+                super(_id);
+                console.log("TableJournal::ctor");
+                var req = new AEBW.Json(_jurl);
+                this._retrieve = new services_1.Services.Retrieve(req);
+                this._prop = { _limit: 12, _offset: 0, _max: 12 };
+                try {
+                    this.addFixedFooter();
+                }
+                catch (e) {
+                    console.log("TableRow::ctor " + e.message);
+                }
+            }
+            onDummyFail() {
+                alert("TableJournal::Dummy Error");
+            }
+            onLeft() {
+                if (super.onLeft()) {
+                    this.getJrnx(gState.Exercice, $('jrnxBook').value);
+                }
+                return false;
+            }
+            onRight() {
+                if (super.onRight()) {
+                    this.getJrnx(gState.Exercice, $('jrnxBook').value);
+                }
+                return false;
+            }
+            getJrnx(period, jr) {
+                var params = new services_1.Services.EntriesReqParams(period, jr);
+                params.options.limit = this._prop._limit;
+                params.options.offset = this._prop._offset;
+                var bindFct = this.onGetJrnx.bind(this);
+                this._retrieve.getEntriesByType(params, bindFct, this.onDummyFail);
+            }
+            onGetJrnx(response) {
+                var tb = this;
+                this.eraseAllRows();
+                for (var i = 0; i < response.result.records.length; i++) {
+                    var it = response.result.records[i];
+                    var row = tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = it['0'];
+                    tb.getCell(tb._NbRows - 1, 1).innerHTML = it['1'];
+                    tb.getCell(tb._NbRows - 1, 2).innerHTML = it['2'];
+                    tb.getCell(tb._NbRows - 1, 3).innerHTML = it['3'];
+                    if (it[4] > 0.0) {
+                        tb.getCell(tb._NbRows - 1, 4).innerHTML = it['4'];
+                        row.cells[4].style.textAlign = "right";
+                    }
+                    else {
+                        tb.getCell(tb._NbRows - 1, 4).innerHTML = "";
+                    }
+                    if (it[5] > 0.0) {
+                        tb.getCell(tb._NbRows - 1, 5).innerHTML = it['5'];
+                        row.cells[5].style.textAlign = "right";
+                    }
+                    else {
+                        tb.getCell(tb._NbRows - 1, 5).innerHTML = "";
+                    }
+                }
+                $('jrnxSoldeDebit').innerHTML = response.result.solde[0][0];
+                $('jrnxSoldeCredit').innerHTML = response.result.solde[0][1];
+                this._prop._max = response.result.solde[0][2];
+                this.updateCounter("" + this._prop._offset + " / " + this._prop._max + " ");
+            }
+        }
+        class TableTransactions extends Xgui_1.Xgui.Table {
+            constructor(_id, _jurl) {
+                super(_id);
+                var req = new AEBW.Json(_jurl);
+                this._retrieve = new services_1.Services.Retrieve(req);
+                this._prop = { _limit: 13, _max: 13, _offset: 0 };
+                try {
+                    this.addFixedFooter();
+                }
+                catch (e) {
+                    console.log("TableRow::ctor " + e.message);
+                }
+            }
+            onLeft() {
+                if (super.onLeft()) {
+                    this.loadTransactions($('jrnxBook').value);
+                }
+                return false;
+            }
+            onRight() {
+                if (super.onRight()) {
+                    this.loadTransactions($('jrnxBook').value);
+                }
+                return false;
+            }
+            onSelectCell(cell, row, col) {
+            }
+            onDummyFail() {
+                alert("TableTransctions::Dummy Error");
+            }
+            onTransLoaded(resp) {
+                var self = this;
+                try {
+                    if (resp.hasOwnProperty('error') && resp.error != null) {
+                        console.log("onTransLoaded Got Error:" + resp.error);
+                    }
+                    var trans = resp.result.transaction;
+                    this.eraseAllRows();
+                    for (var i = 0; i < trans.length; i++) {
+                        var item = trans[i];
+                        var trans_id = item['id'];
+                        var trans_date = item['date'];
+                        var trans_desc = item['label'];
+                        var trans_total = item['debit'];
+                        var a = document.createElement("a");
+                        a.setAttribute("id", "trans-" + trans_id);
+                        a.setAttribute("trans", trans_id);
+                        a.setAttribute("desc", trans_desc);
+                        a.innerHTML = trans_desc;
+                        a.onclick = function (e) {
+                            var evt = (e || window.event);
+                            var el = evt.target;
+                            var acc = el.getAttribute("trans");
+                            var desc = el.getAttribute("desc");
+                            var book = $('jrnxBook').value;
+                            Journaux.JrnxRecord.show();
+                            Journaux.JrnxRecord.update(acc, book);
+                        };
+                        var row = this.addRow();
+                        row.cells[0].innerHTML = trans_date;
+                        row.cells[1].appendChild(a);
+                        row.cells[2].innerHTML = trans_total;
+                    }
+                }
+                catch (e) {
+                    console.log("onTransLoaded exp:" + e.message);
+                }
+                this._prop._max = resp.result.total;
+                this.updateCounter("" + this._prop._offset + " / " + this._prop._max + " ");
+            }
+            loadTransactions(_ttype) {
+                var params = new services_1.Services.TransactionsReqParams(_ttype, this._prop._limit, this._prop._offset);
+                var bindFct = this.onTransLoaded.bind(this);
+                this._retrieve.getTransactionByType(params, bindFct, this.onDummyFail);
+            }
+        }
+        class TableRecord extends Xgui_1.Xgui.Table {
+            constructor(_id, _drop) {
+                super(_id);
+                this._droplist = _drop;
+            }
+            onSelectCell(cell, row, col) {
+            }
+            totalDebitCredit() {
+                $("jrnxSoldeCredit").innerHTML = this._totalofCollection("credit").toFixed(2);
+                $("jrnxSoldeDebit").innerHTML = this._totalofCollection("debit").toFixed(2);
+            }
+            _getEntryId(cell) {
+                var entry_id = cell.getAttribute("entry_id");
+                if (entry_id == null || entry_id == "") {
+                    return -1;
+                }
+                else {
+                    return entry_id;
+                }
+            }
+            bookingEntries() {
+                var rows = this.getRows();
+                var entries = new Array();
+                for (var i = 0; i < rows.length; i++) {
+                    var row = rows[i];
+                    var cells = row.cells;
+                    var id = cells[0];
+                    var acc = cells[1];
+                    var deb = cells[3];
+                    var cre = cells[4];
+                    if (parseFloat(deb.innerHTML) > 0.0) {
+                        var entry = new transaction_1.Ledger.TransactionEntry('d', $('jrnxBook').value);
+                        entry.setAccount(acc.innerHTML);
+                        entry.amount = parseFloat(deb.innerHTML);
+                        entry.entry_id = this._getEntryId(id);
+                        entries.push(entry);
+                    }
+                    else if (parseFloat(cre.innerHTML) > 0.0) {
+                        var entry = new transaction_1.Ledger.TransactionEntry('c', $('jrnxBook').value);
+                        entry.setAccount(acc.innerHTML);
+                        entry.amount = parseFloat(cre.innerHTML);
+                        entry.entry_id = this._getEntryId(id);
+                        entries.push(entry);
+                    }
+                    else {
+                        var entry = new transaction_1.Ledger.TransactionEntry('c', $('jrnxBook').value);
+                        entry.setAccount(acc.innerHTML);
+                        entry.amount = 0;
+                        entry.entry_id = this._getEntryId(id);
+                        entries.push(entry);
+                    }
+                }
+                return entries;
+            }
+            _totalofCollection(collId) {
+                var table = this._table;
+                var coll = table.getElementsByClassName(collId);
+                var total = 0.0;
+                console.log("Compute Solde on collection " + coll.length);
+                for (var i = 0; i < coll.length; i++) {
+                    var cell = coll[i];
+                    if (cell.isActive()) {
+                        cell.toggleState();
+                    }
+                    var val = parseFloat(coll[i].innerHTML);
+                    total = total + val;
+                }
+                return total;
+            }
+            addDropdown() {
+                this._droplist.accountDropFragment();
+            }
+            cellGotDigit(cell, val) {
+                console.log("TableRecord : cellGotDigit :" + val);
+                this._droplist.onTableCell(this, cell);
+                this._droplist.getAccounts(val);
+            }
+            fillToReadWriteAccount(cell) {
+                var self_table = this;
+                cell._toWrite = function (e) {
+                    e.save = e.innerHTML;
+                    var edit = document.createElement('input', { is: "xgui-entry" });
+                    e.innerHTML = "";
+                    edit.value = e.save;
+                    var holder = document.createElement('div');
+                    holder.classList.add("holder");
+                    holder.setAttribute("id", "holder");
+                    e.appendChild(holder);
+                    holder.appendChild(edit);
+                    edit.onReturn = function (val) { e.toggleState(); };
+                    edit.onDigit = function (val) {
+                        self_table.cellGotDigit(e, val);
+                    };
+                    self_table.addDropdown();
+                };
+                cell._toRead = function (e) {
+                    e.innerHTML = e.firstChild.firstChild.value;
+                    self_table.totalDebitCredit();
+                };
+            }
+            fillToReadWriteDC(cell) {
+                var self_table = this;
+                cell._toWrite = function (e) {
+                    e.save = e.innerHTML;
+                    var edit = document.createElement('input', { is: "xgui-entry" });
+                    e.innerHTML = "";
+                    edit.value = e.save;
+                    e.appendChild(edit);
+                    edit.onReturn = function (val) { e.toggleState(); };
+                };
+                cell._toRead = function (e) {
+                    e.innerHTML = e.firstChild.value;
+                    if (!AEBW.isNumber(e.innerHTML)) {
+                        alert('Validation mauvais format du montant. Peut-etre un probleme de point ou de virgule');
+                        e.style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        e.style.border = '1px solid green';
+                    }
+                    self_table.totalDebitCredit();
+                };
+            }
+            updateEntries(entries) {
+                this.eraseAllRows();
+                for (var i = 0; i < entries.length; i++) {
+                    var item = entries[i];
+                    var row = this.addRow();
+                    var cells = row.cells;
+                    cells[0].setAttribute("entry_id", item[0]);
+                    cells[0].setAttribute("trans_id", item[1]);
+                    cells[1].innerHTML = item[2];
+                    cells[2].innerHTML = item[3];
+                    if (item[4] == 'd') {
+                        cells[3].innerHTML = item[5];
+                    }
+                    else {
+                        cells[4].innerHTML = item[5];
+                    }
+                }
+                this.totalDebitCredit();
+            }
+            addRow() {
+                var self_table = this;
+                var row = super.addRow();
+                var cells = row.cells;
+                cells[0].innerHTML = "4001 4002 ";
+                $(this._idTo).appendChild(div);
+                div.style.display = "block";
+            }
+        }
+        class DlgJrnxRecord extends DlgJrnxBase {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgJrnxRecord constructor");
+                super(_id, uipath, jurl);
+                this.table = null;
+                this._dropdown = new DroplistAccount("holder", jurl);
+                var req = new AEBW.Json(jurl);
+                this._booking = new services_1.Services.Booking(req);
+                this._retrieve = new services_1.Services.Retrieve(req);
+            }
+            onDummy(response) {
+                alert("DlgParameter::Dummy Error" + response);
+                if (response.error !== 'undefined' && response.errorr != null) {
+                }
+                else {
+                    var _r = response.result;
+                    console.log("onDummy:: success ");
+                }
+            }
+            onDummyFail() {
+                alert("DlgParameter::Dummy Error");
+            }
+            submit() {
+                var t = new transaction_1.Ledger.Transaction($("jrnxBook").value, "tiJrnx");
+                console.log('DlgJrnxRescord::submit enter');
+                if ($('jrnxBook').value != "AN") {
+                    if (parseFloat($("jrnxSoldeCredit").innerHTML).toFixed(2)
+                        != parseFloat($("jrnxSoldeDebit").innerHTML).toFixed(2)) {
+                        alert("Transaction incomplete balance non ");
+                        return;
+                    }
+                }
+                t.entries = this.table.bookingEntries();
+                console.log(t.json());
+                try {
+                    var bindOnSubmit = this.onSubmit.bind(this);
+                    this._booking.postTransaction(t, bindOnSubmit, this.onDummyFail);
+                }
+                catch (e) {
+                }
+            }
+            onSubmit(resp) {
+                console.log('DlgJrnxRescord onSubmit');
+                if (resp.error !== 'undefined' && resp.errorr != null) {
+                }
+                else {
+                    var _r = resp.result;
+                    console.log("onSubmit:: success ");
+                    this.table.eraseAllRows();
+                    this.table.addRow();
+                }
+            }
+            onGetTransaction(resp) {
+                console.log('DlgJrnxRescord onGetTransaction %o', resp);
+                if (resp.result.entries) {
+                    this.table.updateEntries(resp.result.entries);
+                }
+                if (resp.result.transaction) {
+                    var pref = 'tiJrnx';
+                    var items = resp.result.transaction;
+                    console.log("Ok, fill transatction %o", items);
+                    $(pref + '_voucher_ref').value = items[1];
+                    $(pref + '_voucher_date').value = items[2];
+                    $(pref + '_date').value = items[3];
+                    $(pref + '_desc').value = items[4];
+                }
+            }
+            update(_trans_id, _ttype) {
+                var t = new services_1.Services.DummyReqParams(_trans_id);
+                var bindFct = this.onGetTransaction.bind(this);
+                $('tiJrnx_trans_id').setAttribute('trans_id', _trans_id);
+                console.log("try set jrnxBook tp:" + _ttype);
+                this.setSelectedIndex($("jrnxBook"), _ttype);
+                this._retrieve.getTransaction(t, bindFct, this.onDummyFail);
+            }
+            onShow() {
+                console.log("DlgJrnxRecord::onShow");
+                var obj = this;
+                var d = new Date();
+                var m = d.getMonth() + 1;
+                var day = d.getDate();
+                this._load_jrnx = true;
+                this.table = new TableRecord('table_jrnx_record', this._dropdown);
+                this.table.eraseAllRows();
+                this.table.addRow();
+                $('tiJrnx_voucher_date').placeholder = 'AAAA-MM-DD';
+                $('tiJrnx_date').value = d.getFullYear() + '-' + ('0' + m).slice(-2) + '-' + ('0' + day).slice(-2);
+                Prototype.Event.observe($("btJrnxSave"), "click", function () {
+                    obj.submit();
+                });
+                console.log("DlgJrnxRecord::onShow done");
+            }
+            onLoaded(html) {
+                console.log("DlgJrnxRecod::onLoaded");
+            }
+        }
+        Journaux.DlgJrnxRecord = DlgJrnxRecord;
+        class DlgJrnxTransactions extends DlgJrnxBase {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgJrnxTransaction constructor");
+                super(_id, uipath, jurl);
+                this.table = null;
+            }
+            onDummy(response) {
+                alert("DlgJrnxTransaction::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgJrnxTransaction::Dummy Error");
+            }
+            onLoaded(html) {
+                console.log("DlgJrnxTransaction::onLoaded");
+            }
+            onShow() {
+                var self = this;
+                console.log("DlgJrnxTransaction::onShow");
+                this.table = new TableTransactions('table_jrnx_transaction', this.Url());
+                this.table.loadTransactions($('jrnxBook').value);
+                Prototype.Event.observe("jrnxBook", 'change', function () {
+                    self.table.loadTransactions($('jrnxBook').value);
+                });
+            }
+        }
+        Journaux.DlgJrnxTransactions = DlgJrnxTransactions;
+        class DlgJrnxCompte extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgJrnxCompte constructor");
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._retrieve = new services_1.Services.Retrieve(req);
+                this.table = function () {
+                    return new AEBW.control.table('table_jrnx');
+                };
+            }
+            onDummy(response) {
+                alert("DlgJrnxCompte::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgJrnxCompte::Dummy Error");
+            }
+            ongetExercices(response) {
+            }
+            getListeComptes(c) {
+                var params = new services_1.Services.AccountListReqParams(c);
+                var bindFct = this.ongetListeComptes.bind(this);
+                this._pcmn.getAccountList(params, bindFct, this.onDummyFail);
+            }
+            getExercices() {
+                console.log("DlgJrnxCompte::getExercices, simply update Ui with current Exercice");
+            }
+            getEntriesByAccount(period, jr) {
+                var params = new services_1.Services.EntriesReqParams(period, jr);
+                var bindFct = this.ongetEntriesByAccount.bind(this);
+                this._retrieve.getEntriesByAccount(params, bindFct, this.onDummyFail);
+            }
+            ongetEntriesByAccount(response) {
+                var tb = new AEBW.control.table('jrnx_table_compte');
+                super.cleanTable(tb, tb._NbRows);
+                var entries = response.result.entries;
+                for (var i = 0; i < entries.length; i++) {
+                    var it = entries[i];
+                    var row = tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = it[0];
+                    tb.getCell(tb._NbRows - 1, 1).innerHTML = it[1];
+                    tb.getCell(tb._NbRows - 1, 2).innerHTML = it[2];
+                    row.cells[2].style.textAlign = "right";
+                    if (it[3] != 0.0) {
+                        tb.getCell(tb._NbRows - 1, 3).innerHTML = it[3];
+                        row.cells[3].style.textAlign = "right";
+                    }
+                    if (it[4] != 0.0) {
+                        tb.getCell(tb._NbRows - 1, 4).innerHTML = it[4];
+                        row.cells[4].style.textAlign = "right";
+                    }
+                    if (it[2] > it[3]) {
+                        row.cells[4].style.color = "red";
+                    }
+                }
+                var res = response.result.solde;
+                $('jrnxSoldeDebit').innerHTML = res[0];
+                $('jrnxSoldeCredit').innerHTML = res[1];
+                $('jrnxSoldeDecompte').innerHTML = "Solde : " + res[2];
+                if (parseFloat(res[2]) < 0.0) {
+                    $('jrnxSoldeDecompte').setStyle({ color: "#FF0000" });
+                }
+                else {
+                    $('jrnxSoldeDecompte').setStyle({ color: "#000000" });
+                }
+            }
+            ongetListeComptes(response) {
+                var cb = $('cbJrnxCompte');
+                cb.options.length = 0;
+                for (var i = 0; i < response.result.length; i++) {
+                    var item = response.result[i];
+                    cb.options[cb.options.length] = new Option(item['acc_id'] + "-" + item['acc_desc'], item['acc_id']);
+                }
+                var obj = this;
+                Prototype.Event.observe("cbJrnxCompte", 'change', function () {
+                    obj.getEntriesByAccount(gState.Exercice, $('cbJrnxCompte').value);
+                });
+                obj.getEntriesByAccount(gState.Exercice, $('cbJrnxCompte').value);
+            }
+            onLoaded(ht) {
+                console.log("DlgJrnxCompte::onLoad " + this.declaredClass);
+            }
+            onShow() {
+                $("iExercice").innerHTML = gState.Exercice;
+            }
+        }
+        Journaux.DlgJrnxCompte = DlgJrnxCompte;
+        Journaux.Jrnx = new DlgJrnx("pJournaux", "/app/compta/forms.php?panel=jrnx", "/app/compta/index.php");
+        Journaux.JrnxCompte = new DlgJrnxCompte("pJournaux", "/app/compta/forms.php?panel=jrnx_detail", "/app/compta/index.php");
+        Journaux.JrnxRecord = new DlgJrnxRecord("pJournaux", "/app/compta/forms.php?panel=jrnx_record", "/app/compta/index.php");
+        Journaux.JrnxTransactions = new DlgJrnxTransactions("pJournaux", "/app/compta/forms.php?panel=jrnx_transactions", "/app/compta/index.php");
+        if ($("btJnxConsulter") != null) {
+            Prototype.Event.observe($("btJnxConsulter"), "click", function () {
+                Journaux.Jrnx.show();
+                Prototype.Event.observe("jrnxBook", 'change', function () {
+                    Journaux.Jrnx.updateJrnx();
+                });
+                Journaux.Jrnx.updateJrnx();
+            });
+        }
+        Prototype.Event.observe($("btJnxTransactions"), "click", function () {
+            console.log("Presse btJnxTransactions");
+            Journaux.JrnxTransactions.show();
+        });
+        if ($("btJnxSaisir") != null) {
+            Prototype.Event.observe($("btJnxSaisir"), "click", function () {
+                Journaux.JrnxRecord.show();
+            });
+        }
+        Prototype.Event.observe($("btJrnxC1"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(1);
+        });
+        Prototype.Event.observe($("btJrnxC2"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(2);
+        });
+        Prototype.Event.observe($("btJrnxC3"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(3);
+        });
+        Prototype.Event.observe($("btJrnxC4"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(4);
+        });
+        Prototype.Event.observe($("btJrnxC5"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(5);
+        });
+        Prototype.Event.observe($("btJrnxC6"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(6);
+        });
+        Prototype.Event.observe($("btJrnxC7"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(7);
+        });
+        Prototype.Event.observe($("btJrnxC8"), "click", function () {
+            Journaux.JrnxCompte.show();
+            Journaux.JrnxCompte.getListeComptes(8);
+        });
+    })(Journaux = exports.Journaux || (exports.Journaux = {}));
+});
diff --git a/app/compta/journaux.xml b/app/compta/journaux.xml
new file mode 100644
index 0000000..284419e
--- /dev/null
+++ b/app/compta/journaux.xml
@@ -0,0 +1,240 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+        Administration des utilisateurs  
+        
+        
+        
+        
+                
+          
+              Utilisateur 
+          
+		  
+			  Her
+                  
+	    
+            
+                    Plan Comptable 
+                
+                    1 Comptes de capitaux 
+                 
+                
+                    2 Comptes d immobilisation 
+                 
+                
+                    3 Stock et Command 
+                 
+                
+                    4 Comptes Tiers 
+                 
+                
+                    5 Comptes Financiers 
+                 
+                
+                    6 Comptes Charges 
+                 
+                
+                    7 Comptes Produits 
+                 
+                
+                    8 Hors Comptabilite 
+                 
+                
+                    9 Comptes Analytiques 
+                 
+             
+        
+        
+            
Test What happens here
+            
+             System 
+             
+              
+      
+     
+           
+          
+              Groupes 
+              
+                simpe test
+               
+           
+          
+              Frogs 
+              
+                Ok, 
+            
+             Info Gen 
+	     
+		     Une info:
+              
+            
+               
+           
+            
+
+      
+        
 
+           
+
+
+          
+          
+              Groupes 
+              
+ Strange
+                
+                    authentication 
+                    
+                        Test Content 
+                        do_invoke 
+                     
+                 
+                
+                    alias 
+                    
+                        display boxes : enable 
+                     
+                 
+                
+                    ssl 
+                    
+                        display boxes: 
+                            enable 
+                            disable 
+                         
+                     
+                 
+                
+                
+             
+           
+              
+          
+              Eglise 
+            
+                Page de debug pour web_server.
+                
+                    Yes 
+                    Vide
+   
+   
+             
+         
+        
+            T table 
+            
+                Test Table Stuff
+                
+                    Titre du tableau 
+                    
+                        r1 r2  
+                    
+                        Un test pour voir d1 Un bouton add 
+                        Un test pour voir d1 Un bouton rm 
+                         
+                
+                End Table
+                
+             
+         
+            
+                Calendar 
+                
+                    Test12
+                    
+                    
+                 
+             
+         
+
+     
+ 
diff --git a/app/compta/jrnx.xml b/app/compta/jrnx.xml
new file mode 100644
index 0000000..a393577
--- /dev/null
+++ b/app/compta/jrnx.xml
@@ -0,0 +1,62 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+  
+    Exerice :  
+     
+      Selection du journal 
+      
+          
+              Journal : 
+                   
+       
+     
+         
+        
+          
+          
+            
+              
+                Date 
+                N° Compte 
+                Réf 
+                Libellé 
+                Débit 
+                Crédit  
+             
+            
+              
+                 
+             
+            
+             Solde: 0.0 0.0  
+          
+         
+          
+
+     
+ 
diff --git a/app/compta/jrnxBootstrap.js b/app/compta/jrnxBootstrap.js
new file mode 100644
index 0000000..1deccc2
--- /dev/null
+++ b/app/compta/jrnxBootstrap.js
@@ -0,0 +1,51 @@
+require.config({
+    baseUrl: '../..',
+    urlArgs: "v=" + (new Date()).getTime() , /* For debug*/	
+    paths: {
+        "cpt"  : "/app/compta",
+        "xgui" : "/js/xgui",
+        "tslib": "/js/tslib",
+        "proto": "/js/scriptaculus/prototype",
+        "" : ""
+    }
+    ,
+    shim: {
+        "journaux": {
+            deps: [  'cpt/Dialog'
+                   , 'xgui/xgui_json'
+                   , 'cpt/services'],
+            exports: 'Jour'
+        },
+        "Dialog": {
+            deps: [  'xgui/CtrlDialogbox'
+                   , 'cpt/services'
+                   ],
+            exports: 'Jour'
+        },
+        "services": {
+            deps: [  'xgui/xgui_json'
+                   , 'proto'],
+            exports: 'Jour'
+        },
+        "CtrlDialogbox": {
+            deps: [  'proto' ],
+            exports: 'Jour'
+        }
+    }
+});
+
+require(["require", "exports"
+          , "tslib"
+          , "xgui/CtrlDialogbox"
+          , "cpt/services"
+          , "xgui/xgui_json"
+          , "cpt/Dialog"
+          , "cpt/journaux"
+    ], function (req,exp,ts,jso,cdlg,dlg,s,myApp) {
+    console.log("starting new Journaux application...");
+    try {
+        var Jrnx = myApp.Journaux.Jrnx;
+    } catch (e) {
+        console.log("Journal Failed load ..."+e.message);
+    }
+});
diff --git a/app/compta/jrnx_detail.xml b/app/compta/jrnx_detail.xml
new file mode 100644
index 0000000..ed6556b
--- /dev/null
+++ b/app/compta/jrnx_detail.xml
@@ -0,0 +1,62 @@
+
+
+
+
+    Détail de compte. 
+    
+        
+
+        
+	Détail de compte   
+         
+        
+
+        
+            
+              Compte / Exercice 
+              
+                 
+                 Compte 
+                   
+               
+           
+          
+            
+                Compte 
+                
+                    
+                        Date 
+                        Réf 
+                        Désignaion 
+                        Débit 
+                        Crédit  
+                 
+                
+                    02/01/2013 12435 Facture fioul 100 05/01/2013 98547 Charge Assurance 
+                        87 
+                    06/01/2013 d1 Virement 211 10/01/2013 xc1234 Charge EDF PC2  178 
+                     
+         
+             Solde: 0.0 0.0  
+            
+         
+            
+         
+     
+ 
diff --git a/app/compta/jrnx_record.xml b/app/compta/jrnx_record.xml
new file mode 100644
index 0000000..c397395
--- /dev/null
+++ b/app/compta/jrnx_record.xml
@@ -0,0 +1,80 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+  
+    
+      
+          Transaction enregistré   
+          Continuer 
+       	     
+      
+      
+        Transaction
+          
+            Date :  Journal : 
+             
+            Libellé :   
+          Référence
+          
+            Date     Libéllé   
+       
+
+          
+      
+            
+              
+                Ajouter 
+                Compte 
+                Intitulé 
+                Débit 
+                Crédit  
+          
+         
+                 
+                         0.0 
+                         0.0 
+                  
+          
+         
+             Solde: 0.0 0.0  
+	  
+     
+    
+          Enregistrer 
+          Annuler 
+     
+          
+
+     
+ 
diff --git a/app/compta/jrnx_trans.xml b/app/compta/jrnx_trans.xml
new file mode 100644
index 0000000..8252d37
--- /dev/null
+++ b/app/compta/jrnx_trans.xml
@@ -0,0 +1,60 @@
+
+
+
+
+  User Managment 
+  
+    
+
+        
+
+    
+      
+        
+          Transation info 
+          
+            
+              Date :  Journal : 
+                  
+               
+           
+         
+        
+        
+          
+            
+              Date 
+              Intitulé 
+              Montant 
+             
+           
+          
+            
+              0.0 
+             
+           
+            
+        
+       
+        
+     
+   
+ 
diff --git a/app/compta/ledger_church.xml b/app/compta/ledger_church.xml
new file mode 100644
index 0000000..29fc2e6
--- /dev/null
+++ b/app/compta/ledger_church.xml
@@ -0,0 +1,396 @@
+
+
+
+
+    Gestion comptable 
+    
+        
+
+        
+        Gestion Comptable  
+        
+        
+        
+        
+          
+              Organisation 
+              
+                  
+                      
+                
+                    Organisation 
+                    
+                        Liste 
+                        Nouvelle Organisation 
+                     
+                 
+                
+                    Exercice 
+                    
+                        Liste Exercice 
+                        Nouvel Exercice 
+                        Cloture Exercice 
+                     
+                 
+                
+                    Type de compte 
+                    
+                        Creer Poste Charge 
+                        Supprimer Poste Charge 
+                     
+                 
+                      
+                       
+                 
+             
+           
+              
+                
+          
+              Plan 
+          
+            
+                  
+                      
+            
+                Type de comptes 
+                
+            1 Comptes de capitaux 
+            2 Comptes d'immobilisation 
+            3 Stock et command 
+            4 Comptes de Tiers 
+            5 Comptes Financiers 
+            6 Comptes Charges 
+            7 Comptes Produits 
+            8 Hors Comptabilite 
+            9 Comptes Analytiques 
+             
+           
+         
+        
+            Plan comptable 
+                
+                    Titre du tableau 
+                    
+          
+            class 
+            Libellé 
+            Type 
+             
+          
+          
+            
+          Actif 
+          Passif 
+          Produit 
+          Charge 
+          Banque 
+             
+           
+          
+                        Ajouter 
+        
+           
+                     
+                    
+        
+          1 
+          Compte de test 
+          Actif 
+          
+                        Delete 
+        
+       
+                     
+                
+      
+     
+       
+         
+           
+           
+
+          
+              Fournisseurs 
+              
+                  
+                      
+                          
+                              Facture 
+                              
+				Nouvelle facture 
+				Payer facture 
+                               
+                           
+                          
+                              Gestion 
+                              
+				Nouveau Fournisseur 
+				Etat Fournisseur 
+				Compte Fournisseur 
+				Gerer Fournisseur 
+                               
+                           
+                       
+                      
+
+           
+Nouvelle Facture 
+
+          
+              Intitule Fournisseur 
+                   Date Saisie Charge 
+                   Date Facture Reference  Montant  
+        
+          
+          Enregistrer 
+        Annuler 
+	        
+ 
+ 
+                       
+                   
+           
+           
+
+          
+              Membres 
+              
+                  
+                      
+                          
+                              Don 
+                              
+                                Faire un don 
+                               
+                           
+                          
+                              Gestion 
+                              
+				Profile 
+				Ajouter 
+				Lancer Appel de fonds 
+				Voir les dons 
+                               
+                           
+                       
+                      
+           
+Don 
+
+          
+              Intitule Donateur 
+                   Date Saisie Banque 
+                   Date Facture Reference  Montant  
+        
+          
+          Enregistrer 
+        Annuler 
+	        
+ 
+ 
+                       
+                   
+           
+           
+
+          
+              Eglise 
+              
+              
+                  
+                    
+                    Membres 
+                    
+                        Dons 
+                        Recu Taxe 
+                     
+                     
+                    
+                    Gestion 
+                    
+                        Ajouter Membre 
+                        Supprimer Membre 
+                     
+                     
+                 
+                
+              Status
+                 
+            
+             
+         
+        
+            Bilan 
+            
+                
+                
+                  Exercice 
+                  
+                    Exercice : Appliquer 
+                   
+                 
+                
+                    Bilan de L'exercice 
+                    
+                        Compte Libelle Debit Credit Solde  
+                    
+                        10 Immoblisation 0 0 0  
+                
+                 
+                
+             
+         
+            
+                Trésorier 
+                
+                
+                    Information Générales sur le trésorier 
+                    
+                    
+                        General  
+                        
+                    
+                        Nom Prenom Adresse Email 1 Code Postal Email 2 Ville Mobile N°  
+                    
+                      
+                      appliquer 
+                      Nouveau 
+                     
+
+                 
+             
+                 
+
+               
+             
+         
+	
+	
+	
+	
+	
+	
+     
+ 
diff --git a/app/compta/ledger_create.xml b/app/compta/ledger_create.xml
new file mode 100644
index 0000000..c429238
--- /dev/null
+++ b/app/compta/ledger_create.xml
@@ -0,0 +1,179 @@
+
+
+
+
+
+   Wizard pour la creation d'un environnement de compta 
+   
+           
+
+    
+     Création  
+     
+     
+     
+     
+                
+       
+         Organisation 
+         
+           
+             
+     
+              
+             
+               Information sur l'organisation 
+               
+         
+           Organisation 
+           
+            
+              Raison Sociale: Adresse: C.P./Ville: Region/Pays: N° Siret N° APE:  
+             
+                       
+                   
+                
+  
+         
+           
+          
+        
+
+
+            
+       
+                Plan Comptable 
+                
+                  
+                      Organisation 
+                      
+                          Creation de l'organisation... 
+                       
+                   
+                  
+                      Base de donnée 
+                      
+                          Creation de la base de donnée 
+                       
+                   
+                  
+                      Plan comptable 
+                      
+                          Creation du plan comptable initiale 
+                       
+                   
+		   
+        
+                
+       
+         Poste charges creation 
+         
+               Creation des postes charges 
+
+                 
+          
+        
+       
+         Import des lots 
+         
+           Importation des lots au format csv 
+           Nom du Lot; superficie; PC1 ; PC2 ; PC 3; PC4;
+           
+             Yes 
+             Vide
+              
+            
+          
+        
+
+       
+         Calendar 
+         
+           Test12
+           
+           
+          
+        
+      
+     
+
+   
+    
+ 
diff --git a/app/compta/ledger_syndic.xml b/app/compta/ledger_syndic.xml
new file mode 100644
index 0000000..9a6a835
--- /dev/null
+++ b/app/compta/ledger_syndic.xml
@@ -0,0 +1,538 @@
+
+
+
+
+    Gestion comptable 
+    
+        
+
+        
+        Gestion Comptable :  
+        
+
+        
+          
+              Copropriété 
+              
+                  
+                      
+                
+                    Organisation 
+                    
+                        Liste 
+                        Nouvelle Organisation 
+                     
+                 
+                
+                    Exercice 
+                    
+                        Liste Exercice 
+                        Nouvel Exercice 
+                        Cloture Exercice 
+                     
+                 
+                
+                    Lots 
+                    
+                          Gestion Lots 
+                          Attribuer Lots 
+                     
+                 
+                
+                    Clé de charges 
+                    
+                        Creer Poste Charge 
+                        Attribuer Poste Charge 
+                        Supprimer Poste Charge 
+                     
+                 
+                      
+                       
+
+                
+                   
+                    
+		    
+		       Les organisations dont vous faites partie 
+		       
+		     
+                 
+             
+             
+           
+              
+                
+          
+              Plan 
+          
+            
+                  
+            
+                Type de comptes 
+                
+            1 Comptes de capitaux 
+            
+            4 Comptes de Tiers 
+            5 Comptes Financiers 
+            6 Comptes Charges 
+            7 Comptes Produits 
+            
+             
+           
+         
+        
+            Plan comptable 
+	    
+                    Titre du tableau 
+                    
+          
+            class 
+            Libellé 
+            Type 
+             
+          
+          
+            
+          Actif 
+          Passif 
+          Produit 
+          Charge 
+          Banque 
+             
+           
+          
+                        Ajouter 
+        
+           
+                     
+                    
+        
+          1 
+          Compte de test 
+          Actif 
+          
+                        Delete 
+        
+       
+                     
+                
+      
+     
+       
+         
+           
+           
+
+          
+              Fournisseurs 
+              
+
+
+                  
+                      
+                          
+                              Facture 
+                              
+				Nouvelle facture 
+				Payer facture 
+                               
+                           
+                          
+                              Gestion 
+                              
+				Nouveau Fournisseur 
+				Etat Fournisseur 
+				Compte Fournisseur 
+				Gérer Fournisseur 
+                               
+                           
+                       
+                      
+
+
+         
+           
+            Nouvelle Facture 
+            
+              
+                Intitule Fournisseur 
+                   Date Saisie Charge 
+                   Date Facture Reference  Montant  
+          
+            
+            Enregistrer 
+            Annuler 
+	          
+	 
+	 
+
+	        
+	        
+                   
+           
+           
+
+          
+              Coproprietaires 
+              
+                  
+                      
+                          
+                              Fonds 
+                              
+                                Virement 
+                                Carnet d'entretien 
+                                Nouvel entretien 
+                               
+                           
+                          
+                              Gestion des Tiers 
+                              
+                                Gérer 
+                                Ajouter 
+                                Role 
+                                Lancer Appel de fonds 
+                                Decompte de charge 
+                               
+                           
+                       
+                      
+         
+           
+Versement  
+
+          
+              Intitule Coproprietaire 
+                   Date Saisie Banque 
+                   Date Facture Reference  Montant  
+        
+          
+          Enregistrer 
+        Annuler 
+	        
+           
+           
+
+	        
+
+
+                       
+                   
+           
+           
+
+          
+              Journaux 
+              
+              
+                  
+                    
+                    journaux 
+                    
+                        Consulter 
+                        Saisir Transaction 
+                     
+                     
+                    
+                      Détail Comptes 
+                      
+                        1 Comptes de capitaux 
+                        4 Comptes de Tiers 
+                        5 Comptes Financiers 
+                        6 Comptes Charges 
+                        7 Comptes Produits 
+                       
+                     
+                   
+                  
+      
+     
+      Selection du journal 
+      
+          
+              Journal : 
+                  Period : 
+                   
+       
+     
+         
+        
+          
+          
+            
+              
+                Date 
+                N° Compte 
+                Réf 
+                Libellé 
+                Débit 
+                Crédit 
+              
+          
+         
+              
+         
+             Solde: 0.0 0.0  
+	  
+         
+	        
+
+                 
+            
+             
+         
+        
+            Bilan 
+            
+                
+                
+                  Exercice 
+                  
+                    
+                      Exercice : 
+                       Télécharger  
+                     
+                   
+                   
+                 
+                
+                    Bilan de L'exercice 
+                    
+                        Compte Libelle Debit Credit Solde  
+                    
+                        10 Immoblisation 0 0 0  
+                
+                 
+                
+             
+         
+        
+           
+           
+               Budget 
+               
+                    
+                       
+                          
+                              Budget 
+                              
+                                Liste 
+                                Nouveau 
+                               
+                           
+                        
+                       
+                          
+                              Nouveau 
+                              
+                                
+                                    Année: Désignation:  
+
+                                    
+                                      
+                                      Nouveau 
+                                      Annuler 
+                                     
+                               
+                           
+          
+          
+            
+                
+                Année 
+                Libellé 
+              
+          
+         
+              
+         
+          
+	  
+           
+
+                        
+                    
+                
+            
+    
+    
+	
+	
+	
+	
+	
+	
+	
+	
+     
+ 
diff --git a/app/compta/logging.php b/app/compta/logging.php
new file mode 100644
index 0000000..33fc8ee
--- /dev/null
+++ b/app/compta/logging.php
@@ -0,0 +1,120 @@
+log_file	= $path;
+          $this->lopen();
+        }
+    }
+    /**
+     *
+     */
+    function __destruct() {
+        if (  is_resource($this->fp) ) {
+          $this->lclose();
+        }
+    }
+
+    /**
+     * @brief computer the right file name for logging.
+     * Mainly databaseName should be used 
+     *
+     */
+    static function &getLogger($_log_file ) {
+        if (Logging::$logger == null) {
+            global $conf;
+            if ( isset($conf['datadir']) )
+            {
+                $default_path = $conf['datadir'];
+            } else
+                $default_path = dirname(__FILE__)."/logs/";
+            Logging::$logger = new Logging($default_path.$_log_file);
+        }
+        return Logging::$logger;
+    }
+
+    /**
+     *
+     */
+    public function logDebug($message) {
+    }
+    /**
+     *
+     */
+    public function logError($message) {
+        // Log an error somewhere else then apache log file
+        if ( ! is_resource($this->fp) ) {
+          $this->lopen();
+        }
+        $script_name = pathinfo($_SERVER['PHP_SELF'],PATHINFO_FILENAME);
+        $time        = @date('[d/M/Y:H:i:s]');
+        fwrite($this->fp,"".$time." (".$script_name.") ".$message.PHP_EOL);
+    }
+    /**
+     *
+     */
+    public function logInfo($message) {
+        // Log information
+        if ( ! is_resource($this->fp) ) {
+          $this->lopen();
+        }
+        $script_name	= pathinfo($_SERVER['PHP_SELF'],PATHINFO_FILENAME);
+        $time		= @date('[d/M/Y:H:i:s]');
+        fwrite($this->fp,"".$time." (".$script_name.") ".$message.PHP_EOL);
+    }
+
+    /**
+     *
+     */
+    public function logTransaction($title,$message) {
+        // Log financial transaction
+        if ( ! is_resource($this->fp)  ) {
+          $this->lopen();
+        }
+
+        $script_name	= pathinfo($_SERVER['PHP_SELF'],PATHINFO_FILENAME);
+        $time		= @date('[d/M/Y:H:i:s]');
+        fwrite($this->fp,"-- ".$time." (".$script_name.") ".$title.PHP_EOL);
+        fwrite($this->fp," ".$message.PHP_EOL);
+    }
+
+    /**
+     *
+     */
+    private function lopen() {
+        if (strtoupper(substr(PHP_OS,0,3)) === 'WIN') {
+          $log_file_default = 'c://tmp/aebwww.log';
+        } else {
+          $log_file_default = '/tmp/aebwww.log';
+        }
+        $lfile = $this->log_file ? $this->log_file : $log_file_default;
+
+        $this->fp	= fopen($lfile,'a') or error_log("Logging can't open file : ".$this->log_file);
+
+    }
+
+    /**
+     *
+     */
+    public function lclose() {
+        fclose($this->fp);
+    }
+
+}
+?>
diff --git a/app/compta/lot.xml b/app/compta/lot.xml
new file mode 100644
index 0000000..1a6cfd2
--- /dev/null
+++ b/app/compta/lot.xml
@@ -0,0 +1,121 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+     
+        
+        Nouveau Lot  
+         
+          
+              Nom N° Type 
+                  Batiment Etage Porte Surface Description  
+          
+              
+          Ajouter 
+        Annuler 
+	        
+ 
+ 
+        
+          
+          
+            
+              
+                N° 
+                Name 
+                Bat 
+                Etg 
+                Porte 
+                Type 
+                Surf. 
+              
+          
+         
+              
+	  
+         
+	        
+
+     
+ 
diff --git a/app/compta/lot_attribuer.xml b/app/compta/lot_attribuer.xml
new file mode 100644
index 0000000..a57d4fa
--- /dev/null
+++ b/app/compta/lot_attribuer.xml
@@ -0,0 +1,51 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+  
+     
+      Selection Copropriétaire 
+      
+          
+              Copropriétaire : 
+                   
+       
+     
+         
+        
+          
+          
+            
+              
+                Numéro 
+                Nom du lot 
+                Sel  
+          
+         
+              
+         
+             
+          
+	  
+         
+	        
+
+     
+ 
diff --git a/app/compta/lot_charge.xml b/app/compta/lot_charge.xml
new file mode 100644
index 0000000..7044fc6
--- /dev/null
+++ b/app/compta/lot_charge.xml
@@ -0,0 +1,125 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+  
+   
+    Création d'un nouveau type de charges 
+     
+      Nouveau  Poste de Charge 
+      
+          
+              Label Déscription  
+        
+          Ajouter 
+          Annuler 
+	            
+       
+     
+    
+   
+    Selection du Poste de Charge pour affectation des Tantiemes 
+     
+      Selection Poste pour affecation 
+      
+          
+              Poste de Charge: 
+                   
+       
+     
+          
+        
+        Affectation Tantieme 
+          
+          
+            
+              
+                N° Lot 
+                Tantieme 
+              
+          
+         
+              
+            
+             Total:  
+	  
+         
+	        
+
+     
+ 
diff --git a/app/compta/lots.js b/app/compta/lots.js
new file mode 100644
index 0000000..1def011
--- /dev/null
+++ b/app/compta/lots.js
@@ -0,0 +1,334 @@
+define(["require", "exports", "./Dialog", "./services"], function (require, exports, Dialog_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Copropriete;
+    (function (Copropriete) {
+        class DlgLot extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                console.log("DlgLot constructor");
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                this._user = new services_1.Services.Users(req);
+                this._lots = new services_1.Services.Lots(req);
+                this.tableLots = function () {
+                    return new AEBW.control.table('table_lots');
+                };
+            }
+            onDummy(response) {
+                alert("DlgLot::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgLot::Dummy Error");
+            }
+            getLots() {
+                var bindFct = this.ongetLots.bind(this);
+                super.getLots(bindFct, this.onDummyFail);
+            }
+            ongetLots(response) {
+                console.log("DlgLot::ongetLots");
+                var tb = this.tableLots();
+                var obj = this;
+                super.cleanTable(tb, tb._NbRows);
+                for (var i = 0; i < response.result.length; i++) {
+                    var it = response.result[i];
+                    tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = "'; 
+        echo '
';
+        echo "
".$title." \n"; 
+        echo '
';
+        echo '
';
+        echo "
";
+        $c=<<
+     et encore da tatrtre ertr rete
+     Il reste a comprendre la position de l'image
+EOF;
+        if ($_content !="") {
+          echo $_content;
+        } else
+          echo $c;
+        echo ' ';
+        echo '
Sur l'exerice {$this->session->getCurrentExercice()}, vous disposez en banque de {$solde} €
+_EOF;
+        echo $_text;
+      } else {
+        echo " Vous disposez en banque de xxxx.€
";
+      }
+    }
+
+    /**
+     * 
+     */
+    private function plan_comptable() {
+      $_content =<<
+Selectionner le plan comptablesession->getCurrentExercice()} 
+les factures,prêts, opération recurrentes 
+Saisir des transactions
+Créer un budgetProcès verbal de la dernière AG 
+__EOF;
+        } else if (!is_array($last_closed[0] ))
+        {
+            $_content =<<<__EOF
+Pas d'exerice clos pour l'instant Procès verbal de la dernière AG 
+__EOF;
+        } else{
+            $_content =<<<__EOF
+Procès verbal de la dernière AG 
+__EOF;
+        }
+        $this->article(_("Bilan"),"iu-bilan.jpg",$_content);
+        
+    }
+
+    private function decompte($title)
+    {
+        $retrieve = $this->_retrieve;
+        $res      = $retrieve->getSoldeCharge();
+        $compte   = $retrieve->getAccount($this->session->id());
+        $_content =<<<_EOF
+Les charges latentes: {$res[1]} € ';
+        if ($compta == "tpe")
+        {
+            $this->main_tpe();
+        }
+        else 
+        { // Default is always syndic
+            $this->main_syndic();
+        }
+        echo '
';
+    }
+}
+
+$page = new Compta();
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+/*
+ *  vim:et:sw=2:list:
+ */
+?>
diff --git a/app/compta/page_ledger_coproprietaire.php b/app/compta/page_ledger_coproprietaire.php
new file mode 100644
index 0000000..969fb25
--- /dev/null
+++ b/app/compta/page_ledger_coproprietaire.php
@@ -0,0 +1,129 @@
+
+
+
+
+Gestion comptable 
+
+  
+
+  
+  
+
+
+
+  +
+    +
+
+
 
+  
+    +
+
+
 
+ 
+
+
+
+     
+    Chargement ... 
+      
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief
+ */
+class PageJournaux extends PageCompta
+{
+    function __construct()
+    {
+        parent::__construct("",true);
+    }
+
+    public function main()
+    {
+    }
+};
+
+/* Main entry point */
+$page = new PageCompta($XmlComptaBudget,true);
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_entretien.php b/app/compta/page_ledger_entretien.php
new file mode 100644
index 0000000..26aeb3e
--- /dev/null
+++ b/app/compta/page_ledger_entretien.php
@@ -0,0 +1,84 @@
+
+
+
+
+Gestion comptable 
+
+  
+
+
+
++
+
+
 
+
+  
+    
+      Nouveau 
+      
+        
+          Année: Désignation:  
+
+      
+
+Nouveau 
+Annuler 
+ 
+ 
+ 
+
+
+
+  
+    Année 
+    Libellé 
+       
+     
+    
+        
+    
+     
+  
+ 
+ 
+ 
+
+
+
+
+ 
+ 
+XML;
+
+$_default_file = "ledger_syndic.xml";
+$page = new PageCompta($XmlComptaBudget,true);
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_exercice.php b/app/compta/page_ledger_exercice.php
new file mode 100644
index 0000000..05a8b4a
--- /dev/null
+++ b/app/compta/page_ledger_exercice.php
@@ -0,0 +1,85 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+
+  +
+
+
+
 
+
+     Gestion Des Exercices :  
+     
+       
+          
+           Nouvel Exercice  
+             
+               
+                 Label Début Période Fin de Période  
+               
+                 
+                   Ajouter 
+                       
+              
+          
+         
+           Les exerices 
+           
+           
+             
+               
+                Status 
+                Exercice 
+                Date de Début 
+                Date de Fin 
+                Action 
+                
+              
+             
+                
+	   
+          
+        
+          Cloture de compte 
+         
+
+         
+       
+
+
+    
+   
+ 
+XML;
+
+$_default_file = "ledger_syndic.xml";
+$page = new PageCompta($XmlComptaExercice,true);
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_fournisseur.php b/app/compta/page_ledger_fournisseur.php
new file mode 100644
index 0000000..3250501
--- /dev/null
+++ b/app/compta/page_ledger_fournisseur.php
@@ -0,0 +1,53 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
++  
+
+    +
+
+
 
+ 
+
+
+   
+   Loading... 
+     
+
+
+    
+   
+ 
+XML;
+
+$_default_file = "ledger_syndic.xml";
+$page = new PageCompta($XmlComptaBudget,true);
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_journaux.php b/app/compta/page_ledger_journaux.php
new file mode 100644
index 0000000..54edffc
--- /dev/null
+++ b/app/compta/page_ledger_journaux.php
@@ -0,0 +1,85 @@
+
+
+
+
+  Gestion comptable 
+  
+    
+    
+    
+      +
+
+
+
+        +
+
+
+
+
+
+
+
 
+
+     
+
+    
+      
+         
+          Sélection du journal 
+          
+            
+              Journal : 
+                 
+           
+         
+
+        
+          
+          
+            
+              
+                Date 
+                N° Compte 
+                Réf 
+                Libellé 
+                Débit 
+                Crédit 
+               
+             
+            
+               
+            
+              Solde: 0.0 0.0  
+          
+         
+       
+     
+
+
+   
+ 
+XML;
+
+$page = new PageCompta($XmlComptaBudget,true);
+$page->setTitle("Journal");
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_mes_documents.php b/app/compta/page_ledger_mes_documents.php
new file mode 100644
index 0000000..6c5ed07
--- /dev/null
+++ b/app/compta/page_ledger_mes_documents.php
@@ -0,0 +1,94 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+
+  +
 
+
+
+
+     
+    Chargement ... 
+      
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class PageMesDocuments extends PageCompta {
+
+  function __construct($s,$b)
+  {
+        parent::__construct($s,$b);
+  }
+
+  private function decompte($period)
+  {
+    $_scheme = $this->request->getScheme();
+    $root    = $_scheme."".$this->request->getServerHost()."/".$this->alias."/app/compta/reports/decompte_charge.php?period=";
+    echo 'Décompte de charge '.$period.' ";
+    foreach ($p as $doc)
+    {
+      $this->decompte($doc[3]);
+    } 
+    echo " ";
+  }
+
+  /**
+   * @brief Display The articles in flex mode
+   * Also revise menu
+   */
+  function main() {
+      echo '';
+      echo "
Vos décomptes de charge ";
+      $this->documents();
+      echo '';
+  }
+}
+
+$page = new PageMesDocuments($XmlComptaDocuments,true);
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_plan_comptable.php b/app/compta/page_ledger_plan_comptable.php
new file mode 100644
index 0000000..edec8ea
--- /dev/null
+++ b/app/compta/page_ledger_plan_comptable.php
@@ -0,0 +1,111 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+  +
+    +
+
+
+
+
+
+
+
 
+  +
 
+
+  
+    Plan comptable 
+    
+      Titre du tableau 
+        
+          
+            class 
+            Libellé 
+            Type 
+             
+          
+          
+           
+          
+             Ajouter 
+            
+           
+         
+        
+          
+            1 
+            Compte de test 
+            Actif 
+            
+              Delete 
+              
+           
+          
+    
+     
+  
+   
+
+   
+ 
+XML;
+
+$_default_file = "ledger_syndic.xml";
+$page = new PageCompta($XmlComptaBudget,true);
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+$page->show();
+
+?>
diff --git a/app/compta/page_ledger_syndic.php b/app/compta/page_ledger_syndic.php
new file mode 100644
index 0000000..7db6859
--- /dev/null
+++ b/app/compta/page_ledger_syndic.php
@@ -0,0 +1,26 @@
+showEmbeddedXML($frame[$app][$panel]);
+    } 
+} else {
+    $page->show();
+}
+
+?>
diff --git a/app/compta/pages.php b/app/compta/pages.php
new file mode 100644
index 0000000..292d471
--- /dev/null
+++ b/app/compta/pages.php
@@ -0,0 +1,127 @@
+conf_auth = $conf_auth;
+        $s = new SessionCompta($conf_auth,$conf_auth['req_file']);
+        parent::__construct($s);
+        $namespace        = "";
+        $this->file       = $_file;
+        $this->use_string = $_from_string;
+        $this->xp         = new XsltProcessor();
+        $xsl              = new DomDocument;
+        $xsl->load(dirname(__FILE__).'/../xsl/gui.xsl');
+        $this->xp->importStylesheet($xsl);
+        $params['site']   = "_xgui";
+        $params["lang"]   = "fr";
+        $params["mode"]   = 'standalone';
+        $params["alias"]  = $this->alias;
+        $params['server_base']  = $this->request->getScheme().$this->request->getServerHost();
+        $this->xp->setParameter($namespace,$params);
+        $this->check_access();
+    }
+
+    /*
+     * @brief I think main entry point:
+     *
+     */
+    function showEmbeddedXML ($file)  {
+       $namespace= "";
+       $xml = new DomDocument();
+       if ($this->use_string == true) {
+         $xml->loadXML($file);
+       } else
+         $xml->load($file);
+       $params["mode"] = 'embedded';
+       $this->xp->setParameter($namespace,$params);
+       $this->_injectJS($xml);
+       $this->_updateXML($xml);
+       if ($html = $this->xp->transformToXML($xml) ) {
+           echo $html;
+       } else {
+           echo "Failed Transform XML\n";
+       }
+    }
+
+    /**
+     *
+     */
+    function getElementById($xml,$id)
+    {
+      $xpath = new DOMXPath($xml);
+      return $xpath->query("//*[@id='$id']")->item(0);
+    }
+
+    /**
+     *
+     */
+    function admin($form)
+    {
+        switch ($form)
+        {
+            case "user":
+                $this->file = "admin/view/index.fr_FR.UTF-8.xml";
+            break;
+            default:
+                $this->file = "compta/index.xml";
+        }
+    }
+    /**
+     * @brief Only display embedded content for the accounting
+     * application
+     */
+    function main() {
+      $this->showEmbeddedXML($this->file);
+    }    
+
+    /**
+     * @brief the purpose of the function is to inject
+     * TODO Update Level accordinf to session. Still Missing the Organization Name 
+     * and the users ledger account! would be helpfull for the other requests
+     */
+    protected function _injectJS(&$xml)
+    {
+        $scripts = $xml->getElementsByTagName('script');
+        $f       = $scripts->item(0);
+        $level   = "P"; // (S)yndic (P)roprietaire (L)ocataire (F)ournisseur
+        if ( $this->session->in_groupe(COMPTA_SYNDIC) ) { $level ="S"; }
+        $nscript = <<session->getOrganizationId()}"
+                ,Exercice     : "{$this->session->getCurrentExercice()}"
+                ,Mode         : "{$level}"
+};
+  }
+  (function() {
+    var mh1a = $('mh1').firstChild;
+    mh1a.href = "/fr/app/compta/services.php/";
+  })(); 
+EOF;
+        $nel     = $xml->createTextNode($nscript);
+        $f->appendChild($nel);
+    }
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml) { }
+}
+
+?>
diff --git a/app/compta/parametre.js b/app/compta/parametre.js
new file mode 100644
index 0000000..8622bde
--- /dev/null
+++ b/app/compta/parametre.js
@@ -0,0 +1,204 @@
+
+AEBW.declare("DlgParameter",AEBW.control.dialogbox ,{
+  constructor : function(div_id,uipath,jurl ) {
+                    AEBW.control.dialogbox(div_id);
+                    this._uipath = uipath;
+                    this.Current = 0;
+                    this.load(uipath);
+                    this.Url = function() {return jurl;};
+                },
+  getAccountInfo: function () {
+    var  params= {
+        identity : ""
+    };
+    var obj = this;
+    var url = this.Url();
+    var SupplReq = new AEBW.Json(url);
+    SupplReq.handlefct('pcmn','getAccountInfo',params,
+        function(response) {obj.ongetAccountInfo(response);}, 
+        function() { alert("Failed getAccountInfo");}
+        );
+  },
+  ongetAccountInfo: function(response) {
+     var result = response.result;
+     //alert("Ok, got Answer :"+result);
+     $('addr').value = result.addr;
+     $('act').value = result.act;
+     $('ville').value = result.ville;
+     $('cp').value = result.cp;
+  },
+  getDossiers : function() {
+    var  params= {
+        identity : ""
+    };
+    var obj = this;
+    var url = this.Url();
+    var SupplReq = new AEBW.Json(url);
+    SupplReq.handlefct('ident','getApplicationDbs',params,
+      function(response) {obj.ongetDossiers(response);}, 
+      function() { alert("Failed getDossiers");}
+    );
+  },
+  ongetDossiers : function(response) {
+    var res = response.result;
+    var sum ="";
+    try {
+      for (var i = 0 ; i < res.length ; i++) {
+        var row = res[i];
+        // if (this.Current ==0 ) this.Current = row[0];
+        if (this.Current == row[0]) {
+          sum += "En cours d'utilisation "+row[1]+" voir (";
+          sum += "detail )";
+          sum +=" ";
+        } else {
+          sum += ""+row[1]+" ";
+          sum +=" ";
+      $('parameters-list').innerHTML = sum;
+    } catch (e) {
+      alert("ongetDossiers Failed "+e.message);
+    }
+  },
+
+  switchDossier: function(dossier) {
+    var  params= {
+        "org" : dossier
+    };
+    var obj = this;
+    var url = this.Url();
+    var SupplReq = new AEBW.Json(url);
+    SupplReq.handlefct('ident','switchOrg',params,
+      function(response) {obj.onswitchDossier(response);}, 
+      function() { alert("Failed getDossiers");}
+    );
+  },
+  onswitchDossier: function(response) {
+    this.Current = response.result[0];
+    $('gestion-compta').innerHTML = response.result[1];
+    this.getDossiers();
+  },
+  getCurrentOrg : function() {
+    var  params= {
+    };
+    var obj = this;
+    var url = this.Url();
+    var SupplReq = new AEBW.Json(url);
+    SupplReq.handlefct('ident','currentOrg',params,
+      function(response) {obj.ongetCurrentOrg(response);}, 
+      function() { alert("Failed getCurrentOrg");}
+    );
+  },
+  ongetCurrentOrg: function(response) {
+    this.Current = response.result[0];
+    try {
+      $('gestion-compta').innerHTML = response.result[1];
+    } catch (e) {
+      alert("ongetCurrentOrg Failed "+e.message);
+    }
+  },
+  showList:function() {
+     this.show();
+     try {
+       p = $("parameters");
+       if ( p != null)
+         $("parameters").addClassName("hidden");
+     } catch (e) {
+      alert("showList Failed "+e.message);
+     }
+     this.getCurrentOrg();
+     this.getDossiers();
+  },
+  showDetail:function() {
+    this.show();
+    $("parameters-summary").addClassName("hidden");
+    this.getAccountInfo();
+  },
+  onShow : function () {
+//    if (this.Current == 0 ) this.getCurrentOrg();
+  },
+  onLoaded: function (ht) {
+    this.showList();
+  }
+
+});
+
+AEBW.declare("DlgWizard",AEBW.control.dialogbox, {
+constructor:  function (div_id,uipath,jurl) {
+                    AEBW.control.dialogbox(div_id);
+                    this.load(uipath);
+                    this._wizard = null;
+                    this.Url = function() {return jurl;};
+            } ,
+  onShow : function() {
+              this._wizard = new AEBW.control.Wizard('wizard',['wp1','wp2','wp3','wp4','wp6']);
+       AEBW.mixin(this._wizard,this);
+  },
+  onNext : function(curr_id) {
+    switch(curr_id) {
+      case "wp1" :  /*Register Organisation  then Create DB then Add User in ORG */
+        this.createOrg();
+       break;
+      case "wp2" : 
+       break;
+      case "wp3" : 
+       break;
+      case "wp4" : 
+       break;
+    }
+  },
+  onPrev: function(curr_id) {
+  },
+  uploadCsv: function (name, obj) {
+    var req = AEBW.HTTPRequest();
+    try {
+       var data = new FormData();
+       data.append(name,obj); // The file to be uploadrd  and add some aditionnal attributes
+        req.open("POST",alias+"/app/compta/upload.php",true);
+        req.send(data);
+    } catch (e) {
+      alert("uploadCsv Failed:"+e.message);
+    }
+  },
+  createOrg : function() {
+    alert("Launch create Org");
+  },
+  onCreateOrg : function(response) {
+  }
+});
+
+var Params = new DlgParameter("parameter",
+        "./forms.php?panel=parameter",
+        alias+"/app/compta/index.php");
+Params.getCurrentOrg();
+
+var Wizard = new DlgWizard("parameter",
+                "./forms.php?panel=wizard",
+                alias+"/app/compta/index.php");
+
+
+if ($('btOrgList') != null) {
+Event.observe($("btOrgList"),"click", function () {
+        Params.showList();
+        });
+
+}
+
+var myWizard = null;
+
+Event.observe($("btOrgNew"),"click", function () {
+            Wizard.show();
+        });
+
+
+
+/*
+setTimeout(function() {
+    Params.show();
+    Params.showList();
+    if ($("btNewIdentity") != null)
+      Event.observe($("btNewIdentity"),"click", function () {alert("to be coded 2");});
+
+},2000);
+*/
diff --git a/app/compta/parametre.xml b/app/compta/parametre.xml
new file mode 100644
index 0000000..d8fcf83
--- /dev/null
+++ b/app/compta/parametre.xml
@@ -0,0 +1,71 @@
+
+
+
+
+  Exercice Managment 
+  
+    
+
+        
+
+     
+     Information Générales 
+       
+         Idendité 
+         
+          
+            Activité: Adresse: C.P./Ville: Region/Pays: N° Siret N° APE:  
+        
+          appliquer 
+          Nouveau 
+         
+                     
+                 
+
+                
+                    Copropriété Lots 
+                    
+                      
+                        Base de répartition :  
+                     
+                 
+
+            
+    
+     Vos Organisations 
+     
+     
+   
+ 
diff --git a/app/compta/patchs/00_missing_solde_compte_out.xml b/app/compta/patchs/00_missing_solde_compte_out.xml
new file mode 100644
index 0000000..4936858
--- /dev/null
+++ b/app/compta/patchs/00_missing_solde_compte_out.xml
@@ -0,0 +1,41 @@
+ 
+
+  
+  
+DROP PROCEDURE IF EXISTS solde_compte_out;
+   
+  
+CREATE PROCEDURE solde_compte_out(IN period VARCHAR(32), IN acc VARCHAR(32), OUT Debit_ DOUBLE , INOUT Credit_ DOUBLE , INOUT Solde_ DOUBLE,INOUT Pc_ INT)
+BEGIN
+
+select  
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END	 as Solde , t.tret_key_id INTO Debit_, Credit_, Solde_,Pc_
+       	from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date LIMIT 1;
+
+END;
+   
+
+
+ 
+XML;
+?>
diff --git a/app/compta/patchs/01_patch_tantieme.xml b/app/compta/patchs/01_patch_tantieme.xml
new file mode 100644
index 0000000..b829a3d
--- /dev/null
+++ b/app/compta/patchs/01_patch_tantieme.xml
@@ -0,0 +1,251 @@
+ 
+
+  
+
+
+  
+    DROP PROCEDURE IF EXISTS rembourse_trans_chauffage;
+   
+  
+    CREATE PROCEDURE rembourse_trans_chauffage( IN trs_dt DATE ,
+                   IN ed       DATE,
+                   IN chrg     VARCHAR(32),
+                   IN vouch    VARCHAR(32),
+                   in am       DOUBLE,
+                   in cle      INTEGER,
+                   in des      VARCHAR(256)
+                 )
+
+    BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE tant DOUBLE;
+        DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantiemeFrac(acc_id,cle)  FROM Account where acc_id like '450%';
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 ( ed,trs_dt,vouch,des);
+        SET @last_id = LAST_INSERT_ID();
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'d',des);
+        OPEN cur1;
+
+        read_loop: LOOP
+        FETCH cur1 INTO a, tant;
+        IF done THEN
+          LEAVE read_loop;
+        END IF;
+          IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant,'c',des);
+          END IF;
+        END LOOP;
+
+        CLOSE cur1;
+    END;
+   
+
+
+  
+DROP FUNCTION IF EXISTS FctTantiemeFrac;
+   
+  
+  
+CREATE FUNCTION FctTantiemeFrac( acc_id VARCHAR(32),
+                             charge_key INTEGER) 
+  RETURNS DOUBLE
+  NOT DETERMINISTIC
+  READS SQL DATA
+BEGIN
+ DECLARE select_var DOUBLE;
+ SET @tantTotal := (SELECT  COALESCE(sum(tant_lot_size),1.0)  FROM  Tantieme WHERE tant_pc_id = charge_key);
+ SET select_var =(SELECT sum(tant_lot_size) FROM Tantieme as tant
+         JOIN Lot        as l  on l.lot_num = tant.tant_lot_num
+         JOIN LotsOwners as lo on lo.lo_lot_id = l.lot_id
+         JOIN Account    as a  on a.acc_id = acc_id
+         JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id and jia_ident = lo.lo_owner_id
+      WHERE tant_pc_id =charge_key); 
+      IF (select_var IS NULL) THEN
+        RETURN 0.0 ;
+      ELSE 
+        RETURN select_var / @tantTotal;
+      END IF;
+END;
+   
+  
+  
+DROP PROCEDURE IF EXISTS repartir_trans_charge;
+   
+
+  
+CREATE PROCEDURE repartir_trans_charge(IN trs_dt DATE ,
+                           IN ed       DATE,
+                           IN chrg     VARCHAR(32),
+                           IN vouch    VARCHAR(32),
+                           in am       DOUBLE,
+                           in cle      INTEGER,
+                           in des      VARCHAR(256)
+                         )
+
+BEGIN
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE tant DOUBLE;
+    DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantiemeFrac(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+    INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( ed,trs_dt,vouch,des);
+    SET @last_id = LAST_INSERT_ID();
+    INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description,tret_key_id) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'c',des,cle);
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, tant;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant,'d',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS detail_decompte_charge;
+   
+
+  
+    CREATE PROCEDURE detail_decompte_charge(
+                         IN user_id INTEGER,
+                         IN poste_charge_id INTEGER,
+                         IN period VARCHAR(32),
+                         IN preci INTEGER)
+    BEGIN
+  SET @myAccount := (SELECT acc_id FROM Account
+      JOIN JoinIdentityAccount as jia on jia.jia_acc = acc_id  
+      WHERE user_id = jia.jia_ident);
+  SELECT  te.`entry_date` as Date,
+        te.acc_id as Compte,
+        ac.`acc_name`,
+        te.description,
+        amount  as MontantTotal,
+	ROUND( FctTantieme(@myAccount,poste_charge_id)
+		     ,preci)
+
+     as Tan,
+        ROUND( (amount * FctTantiemeFrac(@myAccount,poste_charge_id) )
+		     ,preci
+        )  as Montant,
+       pc.pc_name as Cle from TransactionEntry as te
+       JOIN Account as ac on (ac.acc_id = te.acc_id)
+       JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+       JOIN Period AS p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+       where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+       ORDER BY te.entry_date;
+    END;
+   
+
+  
+DROP PROCEDURE IF EXISTS detail_decompte_solde;
+   
+  
+CREATE PROCEDURE detail_decompte_solde(
+                                         IN user_id INTEGER,
+					 IN poste_charge_id INTEGER,
+                                         IN period VARCHAR(32),
+                                         IN preci INTEGER)
+BEGIN
+
+  SET @myAccount := (SELECT acc_id FROM Account
+      JOIN JoinIdentityAccount as jia on jia.jia_acc = acc_id  
+      WHERE user_id = jia.jia_ident);
+  SELECT  
+        sum(amount)  as MontantTotal,
+        ROUND( sum((amount * (FctTantiemeFrac(@myAccount,pc.pc_id)
+                                  ))) ,preci
+        )  as Montant
+         from TransactionEntry as te
+   JOIN Account as ac on (ac.acc_id = te.acc_id)
+   JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+   JOIN Period AS p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+   where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+   ORDER BY te.entry_date;      
+
+END;
+
+   
+  
+  
+    DROP PROCEDURE IF EXISTS repartir_charge_global;
+   
+  
+  
+    CREATE PROCEDURE  repartir_charge_global(IN dt DATE,in period TEXT)
+    BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE deb DOUBLE;
+        DECLARE cre DOUBLE;
+        DECLARE sol DOUBLE;
+        DECLARE pc INT;
+        DECLARE cur2 CURSOR FOR SELECT acc_id  FROM Account where acc_id like "6%";
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        SET @enabled = TRUE;
+       OPEN cur2;
+       read_loop_rg : LOOP
+       FETCH cur2 INTO a;
+         IF done THEN
+           LEAVE read_loop_rg;
+         END IF;
+         CALL solde_compte_out(period,a,deb,cre,sol,pc);
+         CALL debug_msg(@enabled,CONCAT(" Process account ",a," debit=",deb," cre=",cre," solde=",sol," pc=",pc," done=",done));
+         IF   sol < -0.01 THEN
+           CALL debug_msg(@enabled,CONCAT(" Process account repartir ",deb));
+           CALL repartir_trans_charge(dt,dt,a,"",ABS(sol),pc,CONCAT("Répartion ",ROUND(ABS(sol),2),"€  du compte ",a," Clé ",pc));
+         END IF;
+       END LOOP read_loop_rg;
+       CLOSE cur2;
+    END;
+   
+
+  
+DROP PROCEDURE IF EXISTS debug_msg;
+CREATE PROCEDURE debug_msg (IN enabled INTEGER,IN msg VARCHAR(256))
+BEGIN
+  IF enabled THEN BEGIN
+    SELECT CONCAT("**",msg) AS '** DEBUG:';
+  END;
+  END IF;
+END;
+   
+
+ 
+
+XML;
+
+?>
diff --git a/app/compta/patchs/02_create_pcg.txt b/app/compta/patchs/02_create_pcg.txt
new file mode 100644
index 0000000..1638aeb
--- /dev/null
+++ b/app/compta/patchs/02_create_pcg.txt
@@ -0,0 +1,11 @@
+
+DROP TABLE IF EXISTS Pcg;
+
+CREATE TABLE IF NOT EXISTS Pcg (
+      pcg_id            INTEGER AUTO_INCREMENT PRIMARY KEY,
+      pcg_acc           VARCHAR(16)  DEFAULT "",
+      pcg_acc_name      VARCHAR(255) DEFAULT "",
+      pcg_acc_type      VARCHAR(1)   DEFAULT ""
+) CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+
diff --git a/app/compta/patchs/02_next.xml b/app/compta/patchs/02_next.xml
new file mode 100644
index 0000000..a515bb5
--- /dev/null
+++ b/app/compta/patchs/02_next.xml
@@ -0,0 +1,263 @@
+ 
+
+  
+  
+      
+
+	
+  
+    DROP TABLE IF EXISTS Pcg;
+   
+  
+CREATE TABLE IF NOT EXISTS Pcg (
+      pcg_id            INTEGER AUTO_INCREMENT PRIMARY KEY,
+      pcg_acc           VARCHAR(16)  DEFAULT "",
+      pcg_acc_name      VARCHAR(255) DEFAULT "",
+      pcg_acc_type      VARCHAR(1)   DEFAULT ""
+) CHARACTER SET utf8 COLLATE utf8_general_ci;
+   
+  
+  
+    DROP PROCEDURE IF EXISTS journal;
+   
+  
+    CREATE PROCEDURE journal(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER,IN _offs INTEGER ,IN _limit INTEGER)
+    BEGIN
+    set @valPeriod= period;
+    set @valJrnx  = jrn;
+    SET @valFrom  = _offs;
+    SET @valLimit = _limit;
+    SET @v_query = CONCAT("SELECT t.act_trans_date AS Date, j.acc_id AS Compte, r.acc_name AS Ref, t.trans_label AS Libelle,",
+    "ROUND( ( CASE WHEN j.debit_credit = 'd' THEN j.amount ELSE 0 END), ",preci," ) AS Debit,",
+    "ROUND( ( CASE WHEN j.debit_credit = 'c' THEN j.amount ELSE 0 END), ",preci," ) AS Credit,",
+    " t.act_trans_date
+FROM TransactionEntry AS j
+JOIN Transactions AS t ON j.trans_id = t.trans_id
+JOIN Account AS r ON j.acc_id = r.acc_id
+JOIN Period AS p ON t.act_trans_date
+BETWEEN p.per_begin
+AND p.per_end
+AND p.per_string ='", @valPeriod ,
+"' WHERE j.entry_type ='",@valJrnx ,
+"' ORDER BY t.act_trans_date DESC, t.trans_label
+    LIMIT ", @valFrom, ",",@valLimit,";");
+    PREPARE q FROM @v_query;
+    EXECUTE q;
+    END;
+   
+  
+
+  
+    DROP PROCEDURE IF EXISTS journal_solde;
+   
+  
+    CREATE PROCEDURE journal_solde(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER )
+    BEGIN
+    SELECT ROUND(sum(CASE WHEN j.debit_credit ='d' THEN j.amount ELSE 0 END), preci) as Debit ,
+	   ROUND(sum(CASE WHEN j.debit_credit ='c' THEN j.amount ELSE 0 END), preci)  as Credit,
+           COUNT(*) as nbr
+    FROM  TransactionEntry as j 
+      JOIN Transactions as t ON j.trans_id = t.trans_id	  
+      JOIN Account AS r on j.acc_id = r.acc_id 
+      JOIN Period AS p on t.act_trans_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+      WHERE j.entry_type = jrn
+    ;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS detail_compte_sans_solde;
+   
+  
+CREATE  PROCEDURE detail_compte_sans_solde(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+  SELECT t.act_trans_date as Date , 
+         t.voucher_ref as Ref,
+         t.trans_label , 
+         CASE WHEN debit_credit='d' THEN ROUND(amount,2) ELSE 0 END as Debit, 
+         CASE WHEN debit_credit='c' THEN ROUND(amount,2) ELSE 0 END as Credit 
+  FROM TransactionEntry as te
+  JOIN Transactions as t ON te.trans_id = t.trans_id
+  JOIN Period as p on t.act_trans_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+  WHERE   te.acc_id=acc ORDER BY t.act_trans_date ASC;
+END;
+   
+
+
+  
+    DROP TABLE IF EXISTS Recurrent;
+    DROP TABLE IF EXISTS RecurrentEntry;
+   
+
+  
+CREATE TABLE IF NOT EXISTS Recurrent (
+      rec_id            INTEGER AUTO_INCREMENT PRIMARY KEY,
+      rec_reference     VARCHAR(64)  DEFAULT "",
+      rec_start_date    DATE         DEFAULT(CURRENT_DATE),
+      rec_end_date      DATE         DEFAULT(CURRENT_DATE),
+      rec_next_date     DATE         DEFAULT(CURRENT_DATE)
+) ;
+	  
+CREATE TABLE IF NOT EXISTS RecurrentEntry (
+      rece_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+      rece_rec_id       INTEGER,
+      rece_debit_credit ENUM('c','d'),
+      rece_amount       DECIMAL(13,3),
+      FOREIGN       KEY(rece_rec_id)
+                    REFERENCES Recurrent(rec_id)
+                    ON DELETE CASCADE
+) ;
+   
+  
+  
+  
+  
+  
+    DROP PROCEDURE IF EXISTS bilan;
+   
+
+  
+CREATE PROCEDURE bilan(IN period VARCHAR(32))
+BEGIN
+SELECT  m.acc_id As Compte,m.acc_name AS Description, m.Debit,m.Credit,TRUNCATE(m.Debit-m.Credit,2) as sold FROM (SELECT c.acc_id, c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       , MONTHNAME(t.act_trans_date) as Month
+FROM Account AS c
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right
+WHERE p.per_string = period
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+     
+GROUP BY c.acc_id
+ORDER BY c.acc_left ) AS m;
+END;
+   
+  
+  
+    DROP VIEW IF EXISTS vSolde;
+    DROP FUNCTION IF EXISTS fPeriod;
+   
+  
+    CREATE function fPeriod() returns VARCHAR(32) DETERMINISTIC NO SQL return @fPeriod;
+CREATE VIEW vSolde AS
+SELECT   c.acc_id
+       , c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       , c.acc_left
+       , c.acc_right 
+FROM   Account      AS c
+JOIN   Transactions AS t 
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND c.acc_id = te.acc_id
+JOIN   Period       AS p 
+WHERE  t.act_trans_date BETWEEN p.per_begin AND p.per_end 
+       AND p.per_string = fPeriod()
+       GROUP BY c.acc_id
+UNION
+
+SELECT c.acc_id, c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       ,  c.acc_left,c.acc_right
+FROM Account AS c 
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t 
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left < pc.acc_left AND c.acc_right > pc.acc_right
+WHERE p.per_string = fPeriod()
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+      AND c.acc_right > c.acc_left + 1
+GROUP BY c.acc_id
+ORDER BY acc_left
+   
+
+  
+  
+    DROP PROCEDURE IF EXISTS solde_compte_per_month;
+   
+  
+    CREATE PROCEDURE solde_compte_per_month(IN period VARCHAR(32),IN acc VARCHAR(32))
+    BEGIN
+SELECT m.Month, m.acc_id As Account, m.Debit,m.Credit,(m.Debit-m.Credit) as sold FROM (SELECT c.acc_id, c.acc_name
+       , TRUNCATE(SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END),2) as Debit
+       , TRUNCATE(SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END),2) as Credit
+       , MONTH(t.act_trans_date) as Month
+FROM Account AS c
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right
+WHERE p.per_string = period
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+      AND c.acc_id = acc
+GROUP BY MONTH(t.act_trans_date)
+ORDER BY c.acc_left , MONTH(t.act_trans_date) ) AS m;
+    END
+   
+  
+  
+  
+    DROP PROCEDURE IF EXISTS detail_compte; 
+   
+  
+    CREATE PROCEDURE detail_compte(IN period VARCHAR(32),IN acc VARCHAR(32))
+    BEGIN
+SELECT Date
+      ,CASE WHEN trans_id IS NULL THEN "TOTAL" ELSE Ref END AS ref
+      ,CASE WHEN trans_id IS NULL THEN "TOTAL" ELSE description END AS description
+      ,CASE WHEN trans_id IS NULL THEN Sd ELSE Debit END AS Debit
+      ,CASE WHEN trans_id IS NULL THEN Sc ELSE Credit END AS Credit
+      
+FROM (SELECT t.act_trans_date as Date , 
+         t.voucher_ref  as Ref,
+         t.trans_label  AS description , 
+         CASE WHEN debit_credit='d' THEN ROUND(amount,2) ELSE 0 END as Debit, 
+         CASE WHEN debit_credit='c' THEN ROUND(amount,2) ELSE 0 END as Credit
+         , SUM(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) AS Sd
+         , SUM(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) AS Sc        
+         , t.trans_id
+  FROM TransactionEntry as te
+  JOIN Transactions as t ON te.trans_id = t.trans_id
+  JOIN Period as p on t.act_trans_date BETWEEN p.per_begin and  p.per_end and p.per_string = period    
+  WHERE   te.acc_id= acc 
+  GROUP BY t.trans_id WITH ROLLUP ) AS Sub
+  ORDER BY trans_id,Date ASC ;
+    END
+   
+
+  
+  
+    DROP PROCEDURE IF EXISTS solde_bank; 
+   
+  
+    CREATE PROCEDURE solde_bank(IN period VARCHAR(32))
+
+BEGIN
+SELECT m.acc_id As Compte,m.acc_name AS Description, ROUND(m.Debit,2) As Debit ,ROUND(m.Credit,2) AS Credit ,ROUND(m.Debit-m.Credit,2) as sold FROM (SELECT c.acc_id, c.acc_name , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit , MONTHNAME(t.act_trans_date) as Month FROM Account AS c JOIN Account pc JOIN Period AS p JOIN Transactions AS t JOIN TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right WHERE p.per_string = period AND t.act_trans_date BETWEEN p.per_begin AND p.per_end AND c.acc_id like "51%" GROUP BY c.acc_id ORDER BY c.acc_id ) AS m;
+END
+
+   
+
+ 
+XML;
+
+?>
+
diff --git a/app/compta/patchs/03_pcg_abegre.txt b/app/compta/patchs/03_pcg_abegre.txt
new file mode 100644
index 0000000..141777b
--- /dev/null
+++ b/app/compta/patchs/03_pcg_abegre.txt
@@ -0,0 +1,112 @@
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1","COMPTES DE CAPITAUX","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("101","Capital","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("105","Ecarts de réévaluation","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1061","Réserve légale","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1062","Réserves indisponible","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1063","Réserves statutaires ou contractuelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1064","Réserves réglementées","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1068","Autres réserves","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("11","REPORT A NOUVEAU","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("12","RESULTAT NET DE L EXERCICE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("145","Amortissements dérogatories","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("146","Provision spéciale de réévaluation","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("147","Plus-values réinvesties","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("148","Autres provisions réglementées","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("15","PROVISIONS POUR RISQUES ET CHARGES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("16","EMPRUNTS ET DETTES ASSIMILEES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("2","COMPTES D'IMMOBILISATIONS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("201","Frais d'établissement","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("206","Droit au bail","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("207","Fonds commercial","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("208","Autres immobilisations incorporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("21","IMMOBILISATIONS CORPORELLES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("23","IMMOBILISATIONS EN COURS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("27","AUTRES IMMOBILISATIONS FINANCIERES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("280","Amortissements des immobilisations incorporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("281","Amortissements des immobilisations corporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("290","Provisions pour dépréciation des immobilisations incorporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("291","Provisions pour dépréciation des immobilisations corporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("297","Provisions pour dépréciation des autres immobilisations financières","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("3","COMPTES DE STOCKS ET D'EN-COURS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("31","MATIERES PREMIERES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("32","AUTRES APPROVISIONNEMENTS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("33","EN-COURS DE PRODUCTION DE BIENS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("34","EN-COURS DE PRODUCTION DE SERVICES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("35","STOCKS DE PRODUITS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("37","STOCKS DE MARCHANDISES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("391","Provisions pour dépréciation des matières premières","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("392","Provisions pour dépréciation des autres approvisionnements","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("393","Provisions pour dépréciation des en-cours de production des biens","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("394","Provisions pour dépréciation des en-cours de production de services","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("395","Provisions pour dépréciation des stocks de produits","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("397","Provisions pour dépréciation des stocks de marchandises","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("4","COMPTES DE TIERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("400","Fournisseurs et Comptes rattachés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("409","Fournisseurs débiteurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("410","Clients et Comptes rattachés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("419","Clients débiteurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("421","Personnel - Rémunérations dues","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("428","Personnel - Charges à payer et produits à recevoir","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("43","SECURITE SOCIALE ET AUTRES ORGANISMES SOCIAUX","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("444","Etat - Impôts sur les bénéfices","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("445","Etat - Taxes sur le chiffre d'affaires","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("447","Autres impôts, taxes et versements assimilés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("455","Associés - Comptes courants","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("46","DEBITEURS ET CREDITEURS DIVERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("47","COMPTES TRANSITOIRES OU D'ATTENTE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("481","Charges à répartir sur plusieurs exercices","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("486","Charges constatées d'avance","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("487","Produits constatés d'avance","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("491","Provisions pour dépréciation des comptes de clients","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("496","Provisions pour dépréciation des débiteurs divers","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("5","COMPTES FINANCIERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("50","VALEURS MOBILIERES DE PLACEMENT","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("51","BANQUES ETABLISSEMENTS FINANCIERS ET ASSIMILES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("53","CAISSE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("54","REGIS D'AVANCES ET ACCREDITIFS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("58","VIREMENTS INTERNES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("590","Provisions pour dépréciation des valeurs mobilières de placement","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("6","COMPTES DE CHARGES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("60","ACHATS (saufs 603)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("603","VARIATION DES STOCKS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("61","Services Exterieurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("62","Autres services extérieurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("63","IMPôTS TAXES ET VERSEMENT ASSIMILES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("641","Rémunération du personnel","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("644","Rémunération du travail de l'exploitant","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("645","Charges de sécurité sociale et de prévoyance","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("646","Cotisations sociales personnelles de l'exploitant","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("65","AUTRES CHARGES DE GESTIONS COURANTE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("66","CHARGES FINANCIERES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("67","CHARGES EXCEPTIONNELLES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("681","Dotations aux amortissements et aux provisions - Charges d'exploitation","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("686","Dotations aux amortissements et aux provisions - Charges financières","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("687","Dotations aux amortissements et aux provisions - Charges exceptionnelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("691","Participation des salariés aux fruits de l'expansion","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("695","Impôts sur les bénéfices","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("697","Imposition forfaitaire annuelle des sociétés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("699","Produits - Reports en arrière des déficits","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("7","COMPTES DE PRODUITS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("701","Ventes de produits finis","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("706","Prestations de services","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("707","Ventes de marchandises","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("708","Produits des activités annexes","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("709","Rabais, remises et ristournes accordés par l'entreprise","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("713","VARIATION DES STOCKS (en-cours de production)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("72","PRODUCTION IMMOBILISEE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("74","SUBVENTIONS D'EXPLOITATION","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("75","AUTRES PRODUITS DE GESTION COURANTE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("76","PRODUITS FINANCIERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("77","PRODUITS EXCEPTIONNELS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("781","Reprises sur amortissements et provisions (à inscrire dans les produits d'exploitation)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("786","Reprises sur provisions (à inscrire dans les produits fianciers)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("787","Reprises sur provisions (à inscrire dans les produits exceptionnels)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("79","TRANSFERTS DE CHARGES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("8","COMPTES SCPECIAUX","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("80","ENGAGEMENTS HORS BILAN","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("801","Engagements donnés par l'entreprise","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("802","Engagements reçus par l'entreprise","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("809","Contrepartie des engagements","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("88","RESULTAT EN INSTANCE D'AFFECTATION","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("89","BILAN","");
+
diff --git a/app/compta/patchs/03_pcg_syndic.txt b/app/compta/patchs/03_pcg_syndic.txt
new file mode 100644
index 0000000..3068f62
--- /dev/null
+++ b/app/compta/patchs/03_pcg_syndic.txt
@@ -0,0 +1,44 @@
+
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","102","Provisions pour travaux");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","103","Avances");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","1031","Avances de trésorerie");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","1032","Avances travaux");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","1033","Autres avances");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","131","Subventions et instance d'affectation");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","12","Solde en attente sur travaux ou opération exceptionnel");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","40","Fournisseurs");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","42","Autres");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","43","Autres");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","44","Autres");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","45","Collectivite des Coproprietaires");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","460","DEBITEURS ET CREDITEURS DIVERS");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","461","Debiteur Divers");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","462","Credit Divers");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","47","Comptes d'attente");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","48","Comptes de régularisation");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","49","Dépréciation des comptes de tiers"); 
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","50","Fonds placés");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","51","Banques ou fonds disponible ne banque");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","53","Caisse");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","601","Eau");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","602","Electricite");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","603","Chauffage, energie et combustible");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","604","Achat produits d'entretien");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","605","Materiel");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","606","Fourniture");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","611","Nettoyage des locaux");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","614","Control de maintenance");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","615","Entretien et petites reparations");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","616","Prime d'assurance");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","620","Frais d'administration");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","6213","Frais postaux");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","6222","Prestation particulière");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","6223","Autres honoraires");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","671","Travaux decides par assemblee generale");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","672","Travaux urgents");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","700","Appels de fonds");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","701","Provision sur operations courantes");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","702","Provision sur travaux de l'article 14.2");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","703","Avances");
+INSERT INTO Pcg(pcg_acc_type,pcg_acc,pcg_acc_name) VALUE("","714","Produits divers");
+  
diff --git a/app/compta/patchs/04_account.txt b/app/compta/patchs/04_account.txt
new file mode 100644
index 0000000..e9c6653
--- /dev/null
+++ b/app/compta/patchs/04_account.txt
@@ -0,0 +1,260 @@
+--
+-- 09/02/2021
+-- Add account_get_sub procedure
+--  cls     Account Id
+--  _depth  Subtree depth to retrieve
+-- HAVING level ... equal 1 if we don't wont the parent
+
+DROP PROCEDURE IF EXISTS account_get_sub;
+CREATE PROCEDURE account_get_sub(IN cls VARCHAR(32) , IN _depth INTEGER)
+BEGIN
+SELECT node.acc_id, node.acc_name AS acc_name , (COUNT(parent.acc_name) -1 ) AS _level
+FROM Account AS node,
+     Account AS parent,
+     Account AS sub_parent,
+     (
+       SELECT node.acc_id , ( COUNT(parent.acc_id) - 1) AS depth
+       FROM Account AS node,
+            Account AS parent
+       WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right
+                            AND node.acc_id = cls
+       GROUP BY node.acc_id
+       ORDER BY node.acc_left 
+     ) AS sub_tree
+WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right 
+           AND node.acc_left BETWEEN sub_parent.acc_left AND sub_parent.acc_right
+           AND sub_parent.acc_id = sub_tree.acc_id 
+GROUP BY node.acc_id
+HAVING _level <= _depth 
+ORDER BY node.acc_left;
+END;
+
+call account_get_sub("70",3);
+
+--
+-- Hack to create parameterized views
+--
+DROP FUNCTION IF EXISTS fPeriod;
+create function fPeriod() returns VARCHAR(32) DETERMINISTIC NO SQL return @fPeriod;
+
+--
+-- Create the view using fPeriod
+--
+
+-- select s.* from (select @fPeriod="2021") param , vSolds as s; 
+
+--
+-- Try solde of tree
+--
+SELECT node.acc_id, node.acc_name AS acc_name 
+       , (COUNT(parent.acc_name) -1 ) AS _level
+       ,dc.Debit
+       ,dc.Credit
+FROM Account AS node,
+     Account AS parent,
+     Account AS sub_parent,
+     (
+       SELECT node.acc_id , ( COUNT(parent.acc_id) - 1) AS depth
+
+       FROM Account AS node,
+            Account AS parent 
+       WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right
+                            AND node.acc_id = "600000"
+       GROUP BY node.acc_id
+       ORDER BY node.acc_left 
+     ) AS sub_tree,
+     (
+       SELECT  t.acc_id
+             , SUM(CASE WHEN t.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+             , SUM(CASE WHEN t.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       FROM TransactionEntry as t,
+            Period as p   
+       WHERE 
+           p.per_string = "2021"
+           AND t.entry_date BETWEEN p.per_begin and p.per_end
+       GROUP BY t.acc_id
+
+       UNION
+
+	SELECT c.acc_id, 0, 0
+	FROM Account AS c
+	WHERE c.acc_id NOT
+	IN (
+
+	SELECT t.acc_id
+	FROM Account AS c
+	JOIN Period AS p
+	LEFT OUTER JOIN TransactionEntry AS t ON c.acc_id = t.acc_id
+	WHERE p.per_string = "2021"
+	AND t.entry_date
+	BETWEEN p.per_begin
+	AND p.per_end
+	GROUP BY c.acc_id
+	)
+     ) AS dc
+
+WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right 
+           AND node.acc_left BETWEEN sub_parent.acc_left AND sub_parent.acc_right
+           AND sub_parent.acc_id = sub_tree.acc_id
+           AND dc.acc_id = node.acc_id
+GROUP BY node.acc_id
+HAVING _level <= _depth 
+ORDER BY node.acc_left;
+
+
+--
+-- Accounts that don't have debit or credit
+--
+SELECT c.acc_id, 0, 0
+FROM Account AS c
+WHERE c.acc_id NOT
+IN (
+
+SELECT t.acc_id
+FROM Account AS c
+JOIN Period AS p
+LEFT OUTER JOIN TransactionEntry AS t ON c.acc_id = t.acc_id
+WHERE p.per_string = "2021"
+AND t.entry_date
+BETWEEN p.per_begin
+AND p.per_end
+GROUP BY c.acc_id
+)
+
+
+-- No leaf account (for those I need to compute the Debit Credit)
+SELECT *
+FROM Account AS c
+WHERE c.acc_right > c.acc_left +1
+ORDER BY acc_left
+
+
+--
+-- Solde des comptes non leaf
+--
+SELECT c . * , SUM( s.Debit ) , SUM( s.Credit )
+FROM (
+
+SELECT @fPeriod := "2021" h
+) AS hParam, Account AS c
+JOIN vSolde AS s ON s.acc_left > c.acc_left
+AND s.acc_right < c.acc_right
+WHERE c.acc_right > c.acc_left +1
+GROUP BY acc_id
+ORDER BY acc_left
+
+
+
+--
+-- Solde All accounts in period
+--  should be based on transaction and TransactionEntry ...
+--
+DROP VIEW IF EXISTS vSolde; 
+CREATE VIEW vSolde AS
+SELECT   c.acc_id
+       , c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       , c.acc_left
+       , c.acc_right 
+FROM   Account      AS c
+JOIN   Transactions AS t 
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND c.acc_id = te.acc_id
+JOIN   Period       AS p 
+WHERE  t.act_trans_date BETWEEN p.per_begin AND p.per_end 
+       AND p.per_string = fPeriod()
+       GROUP BY c.acc_id
+UNION
+
+SELECT c.acc_id, c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       ,  c.acc_left,c.acc_right
+FROM Account AS c 
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t 
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left < pc.acc_left AND c.acc_right > pc.acc_right
+WHERE p.per_string = fPeriod()
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+      AND c.acc_right > c.acc_left + 1
+GROUP BY c.acc_id
+ORDER BY acc_left
+
+-- vSolde 2021
+SELECT c.* FROM (SELECT @fPeriod:="2021") AS hParam, vSolde AS c;
+-- vSolde without the leafs Could be call bilan
+SELECT c.acc_id,c.acc_name,c.Debit,c.Credit  , (c.Debit - c.Credit) as Solde FROM (SELECT @fPeriod:="2021") AS hParam, vSolde AS c where acc_left + 1  != acc_right 
+
+
+--
+-- Solde compte per month
+--  Result example 
+-- Month 	Account 	Debit 	Credit 	sold
+-- February 	401004 	390.13 	252.64 	137.49
+-- January 	401004 	366.6 	504.09 	-137.49
+SELECT m.Month, m.acc_id As Account, m.Debit,m.Credit,(m.Debit-m.Credit) as sold FROM (SELECT c.acc_id, c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       , MONTHNAME(t.act_trans_date) as Month
+FROM Account AS c
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right
+WHERE p.per_string = "2021"
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+      AND c.acc_id = 401004
+GROUP BY MONTH(t.act_trans_date)
+ORDER BY c.acc_left ) AS m
+
+
+--
+-- New Bilan
+--
+DROP PROCEDURE bilan//
+CREATE PROCEDURE bilan(IN period VARCHAR(32))
+BEGIN
+SELECT  m.acc_id As Compte,m.acc_name AS Description, m.Debit,m.Credit,TRUNCATE(m.Debit-m.Credit,2) as sold FROM (SELECT c.acc_id, c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       , MONTHNAME(t.act_trans_date) as Month
+FROM Account AS c
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right
+WHERE p.per_string = period
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+     
+GROUP BY c.acc_id
+ORDER BY c.acc_left ) AS m
+END//
+
+--
+-- Tree View for Soldes of accounts with Hierachie and and Sum on parent nodes.
+--
+SELECT node.acc_id, node.acc_name, node.Debit, node.Credit, node.Debit - node.Credit AS Solde, COUNT( parent.acc_id ) -1 AS _level
+FROM ( SELECT @fPeriod := "2021") AS hParam
+     , vSolde AS node
+     , vSolde AS parent
+     , vSolde AS sub_parent, (
+	SELECT node.acc_id, ( COUNT( parent.acc_id ) -1) AS depth
+	FROM ( SELECT @fPeriod := "2021" as  p) AS hParam, vSolde AS node, vSolde AS parent
+	WHERE node.acc_left
+	BETWEEN parent.acc_left
+	AND parent.acc_right
+	AND node.acc_id = "600000"
+	GROUP BY node.acc_id
+	ORDER BY node.acc_left
+    ) AS sub_tree
+WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right
+      AND node.acc_left BETWEEN sub_parent.acc_left AND sub_parent.acc_right
+      AND sub_parent.acc_id = sub_tree.acc_id
+GROUP BY node.acc_id
+HAVING _level <=3
+ORDER BY node.acc_left
+
diff --git a/app/compta/patchs/05_calo.txt b/app/compta/patchs/05_calo.txt
new file mode 100644
index 0000000..2919c72
--- /dev/null
+++ b/app/compta/patchs/05_calo.txt
@@ -0,0 +1,23 @@
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+--
+-- Base de donn├®es: `test`
+--
+														
+-- --------------------------------------------------------
+--
+-- Structure de la table `CompteurCalorimetrique`
+-- 
+ 
+
+CREATE TABLE IF NOT EXISTS `CompteurCalorimetrique` (                                                                       
+`ccal_id` int(11) NOT NULL AUTO_INCREMENT,                                                                                
+`ccal_emplacement` varchar(2) DEFAULT NULL,                                                                               
+`ccal_num` int(11) DEFAULT NULL,                                                                                          
+`ccal_lot_id` int(11) DEFAULT NULL,                                                                                       
+`ccal_coef` double DEFAULT NULL,                                                                                          
+PRIMARY KEY (`ccal_id`)                                                                                                 
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ;                                                                                                                                                                                           
+-
+[B[B
diff --git a/app/compta/patchs/backup_20210731.txt b/app/compta/patchs/backup_20210731.txt
new file mode 100644
index 0000000..c72490d
--- /dev/null
+++ b/app/compta/patchs/backup_20210731.txt
@@ -0,0 +1,1653 @@
+-- MySQL dump 10.16  Distrib 10.1.48-MariaDB, for debian-linux-gnu (i686)
+--
+-- Host: localhost    Database: SYNDIC_26
+-- ------------------------------------------------------
+-- Server version	10.1.48-MariaDB-0ubuntu0.18.04.1
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `Account`
+--
+
+DROP TABLE IF EXISTS `Account`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Account` (
+  `acc_id` varchar(32) NOT NULL,
+  `acc_info_id` int(11) DEFAULT NULL,
+  `acc_name` varchar(64) DEFAULT NULL,
+  `acc_desc` varchar(255) DEFAULT '',
+  `acc_balance` double DEFAULT '0',
+  `acc_left` int(11) DEFAULT NULL,
+  `acc_right` int(11) DEFAULT NULL,
+  PRIMARY KEY (`acc_id`),
+  KEY `acc_id` (`acc_id`) USING BTREE
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Account`
+--
+
+LOCK TABLES `Account` WRITE;
+/*!40000 ALTER TABLE `Account` DISABLE KEYS */;
+INSERT INTO `Account` VALUES ('100000',100000,'COMPTES DE CAPITAUX','',0,1,20),('400000',400000,'COMPTES DE TIERS','',0,43,102),('500000',500000,'COMPTES FINANCIERS','',0,103,124),('600000',600000,'COMPTES DE CHARGES','',0,125,178),('70',70,'COMPTES DE PROVISION','',0,179,192),('401000',401000,'Fournisseurs','',0,48,87),('103000',103000,'Avances','',0,16,19),('103100',103100,'Avances de tresorerie','',0,17,18),('450000',450000,'Collectivite des Coproprietaires','',0,88,95),('460000',460000,'DEBITEURS ET CREDITEURS DIVERS','',0,96,101),('461000',461000,'Debiteur Divers','',0,97,98),('462000',462000,'Credit Divers','',0,99,100),('512000',512000,'BANQUES','',0,110,123),('601000',601000,'Eau','',0,148,149),('602000',602000,'Electricite','',0,150,151),('603000',603000,'Chauffage, energie et combustible','',0,152,153),('604000',604000,'Achat produits d\'entretien','',0,154,155),('605000',605000,'Materiel','',0,156,157),('606000',606000,'Fourniture','',0,158,165),('611000',611000,'Frais scolaire','',0,133,134),('615000',615000,'Entretien et petites réparations','',0,129,130),('616000',616000,'Prime d\'assurance','',0,127,128),('620000',620000,'Frais d\'administration','',0,166,167),('621300',621300,'Frais postaux','',0,168,169),('622200',622200,'Prestation particulière','',0,170,171),('622300',622300,'Autres honoraires','',0,172,173),('671000',671000,'Travaux decides par assemblee generale','',0,174,175),('672000',672000,'Travaux urgents','',0,176,177),('700000',700000,'Appels de fonds','',0,182,183),('701000',701000,'Provision sur operations courantes','',0,184,185),('702000',702000,'Provision sur travaux de l\'article 14.2','',0,186,187),('703000',703000,'Avances','',0,188,189),('714000',714000,'Produits divers','',0,190,191),('450001',450001,'Ebersold Andre','',0,93,94),('450002',450002,'Ebersold Eloise','',0,91,92),('512001',512001,'Banque Postale CCP Andre','',0,121,122),('450003',450003,'Ebersold Marc','',0,89,90),('401001',401001,'EDF ES','',0,85,86),('401002',401002,'EAU','',0,83,84),('607000',607000,'Achats de marchandises','',0,146,147),('401004',401004,'LIDL','',0,81,82),('401005',401005,'AUCHAN','',0,79,80),('401006',401006,'Jet-Tankstelle','',0,77,78),('512002',512002,'Banque Postale M et Mme','',0,119,120),('512003',512003,'LCL M et Mme','',0,117,118),('401007',401007,'Groupama','',0,75,76),('401008',401008,'Matmut','',0,73,74),('626000',626000,'Frais postaux et frais de télécom','',0,144,145),('401009',401009,'Numericable','',0,71,72),('401010',401010,'OneAndOne','',0,69,70),('606101',606101,'Fourniture Carburant voiture','',0,163,164),('401011',401011,'GEMO','',0,67,68),('200000',200000,'COMPTES IMMOBILISATIONS','',0,21,42),('210000',210000,'IMMOBILISATIONS CORPORELLES','',0,34,41),('230000',230000,'IMMOBILISATIONS EN COURS','',0,32,33),('270000',270000,'AUTRES IMMOBILISATIONS FINANCIERES','',0,24,31),('280000',280000,'AMORTISSEMENTS DES IMMOBILISATIONS','',0,22,23),('512004',512004,'LCL Visa Mr','',0,115,116),('101000',101000,'Capital','',0,14,15),('110000',110000,'REPORT A NOUVEAU','',0,12,13),('160000',160000,'EMPRUNTS ET DETTES ASSIMILEES','',0,2,11),('627000',627000,'Services bancaires et assimilés','',0,142,143),('660000',660000,'CHARGES FINANCIERES','',0,140,141),('512005',512005,'Banque Postale LA','',0,113,114),('512006',512006,'Banque Postale CEL','',0,111,112),('630000',630000,'IMPOTS, TAXES ET VERSEMENT ASSIMILES','',0,138,139),('410000',410000,'Clients et comptes rattachés','',0,44,47),('410001',410001,'SIEMENS','',0,45,46),('271001',271001,'AMUNDI-EE PEE','',0,29,30),('271002',271002,'AMUNDI-EE PERCO','',0,27,28),('271003',271003,'NATIXIS PEE','',0,25,26),('614000',614000,'Charges de copropriété','',0,131,132),('401012',401012,'FREE','',0,65,66),('760000',760000,'PRODUITS FIANCIERS','',0,203,204),('213100',213100,'Bâtiments','',0,35,40),('213101',213101,'appartements','',0,38,39),('401013',401013,'Amazon','',0,63,64),('401014',401014,'Pharmacie','',0,61,62),('606102',606102,'Fourniture Santé','',0,161,162),('606103',606103,'Fourniture divers','',0,159,160),('623800',623800,'Divers (pourboires, dons courant...)','',0,136,137),('610000',610000,'Services extérieurs','',0,126,135),('8',8,'COMPTES SPECIAUX','',0,193,202),('89',89,'BILAN','',0,196,197),('88',88,'RESULTAT EN INTANCE D AFFECTATION','',0,198,199),('80',80,'ENGAGEMENTS HORS BILAN','',0,200,201),('401015',401015,'BIGMAT','',0,59,60),('401016',401016,'Aliexpress','',0,55,56),('701001',701001,'Provision sur opération Eloise','',0,180,181),('401017',401017,'Restaurant loisirs','',0,57,58),('164000',164000,'Emprunts auprès des établissements de crédit','',0,3,10),('164001',164001,'Emprunts LCL appartement principal','',0,8,9),('164002',164002,'Emprunts LPB appartement comble','',0,6,7),('213102',213102,'appartement comble','',0,36,37),('164003',164003,'Emprunt LBP voiture','',0,4,5),('401018',401018,'IKEA','',0,53,54),('530000',530000,'CAISSE','',0,104,109),('530001',530001,'Cash Andre','',0,107,108),('530002',530002,'Cash Eloise','',0,105,106),('401029',401029,'Divers vacances','',0,51,52),('401019',401019,'EDF ES appartement combles','',0,49,50);
+/*!40000 ALTER TABLE `Account` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Budget`
+--
+
+DROP TABLE IF EXISTS `Budget`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Budget` (
+  `bu_id` int(11) NOT NULL AUTO_INCREMENT,
+  `bu_period_id` int(11) DEFAULT NULL,
+  `bu_desc` varchar(64) DEFAULT '',
+  PRIMARY KEY (`bu_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Budget`
+--
+
+LOCK TABLES `Budget` WRITE;
+/*!40000 ALTER TABLE `Budget` DISABLE KEYS */;
+INSERT INTO `Budget` VALUES (1,4,'Budget 2020'),(2,1,'Budget 2019'),(3,5,'Budget 2021'),(5,6,'Budget 2022');
+/*!40000 ALTER TABLE `Budget` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `BudgetEntry`
+--
+
+DROP TABLE IF EXISTS `BudgetEntry`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `BudgetEntry` (
+  `buet_id` int(11) NOT NULL AUTO_INCREMENT,
+  `buet_budget_id` int(11) DEFAULT NULL,
+  `buet_acc_id` varchar(32) DEFAULT NULL,
+  `buet_amount` decimal(13,3) DEFAULT '0.000',
+  `buet_debit_credit` enum('d','c') DEFAULT 'c',
+  `buet_pc_id` int(11) DEFAULT '1',
+  PRIMARY KEY (`buet_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `BudgetEntry`
+--
+
+LOCK TABLES `BudgetEntry` WRITE;
+/*!40000 ALTER TABLE `BudgetEntry` DISABLE KEYS */;
+INSERT INTO `BudgetEntry` VALUES (1,2,'601000',700.000,'c',1),(2,2,'602000',100.000,'c',1),(3,2,'603000',4000.000,'c',1),(4,2,'604000',50.000,'c',1),(5,2,'620000',100.000,'c',1),(6,2,'616000',250.000,'c',1),(7,2,'615000',10.000,'c',1),(8,3,'607000',6000.000,'c',1),(9,3,'614000',2160.000,'c',1),(10,3,'627000',160.000,'c',1),(11,3,'626000',288.000,'c',1),(12,3,'616000',1400.000,'c',1),(13,3,'672000',300.000,'c',1),(14,3,'602000',840.000,'c',1),(15,3,'606101',700.000,'c',1),(16,3,'630000',2800.000,'c',1),(17,3,'660000',1580.000,'c',1),(18,3,'700000',40000.000,'c',1);
+/*!40000 ALTER TABLE `BudgetEntry` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Config`
+--
+
+DROP TABLE IF EXISTS `Config`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Config` (
+  `cfg_id` varchar(32) NOT NULL,
+  `cfg_type` int(11) DEFAULT NULL,
+  `cfg_value` varchar(255) DEFAULT '',
+  PRIMARY KEY (`cfg_id`),
+  KEY `cfg_id` (`cfg_id`) USING BTREE
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Config`
+--
+
+LOCK TABLES `Config` WRITE;
+/*!40000 ALTER TABLE `Config` DISABLE KEYS */;
+INSERT INTO `Config` VALUES ('version',1,'1.0.0'),('stmt_counter',2,'41'),('state',1,'ready'),('accounting_type',1,'tpe'),('taxe_tva',2,'0'),('pcg',1,'abrege');
+/*!40000 ALTER TABLE `Config` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `JoinIdentityAccount`
+--
+
+DROP TABLE IF EXISTS `JoinIdentityAccount`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `JoinIdentityAccount` (
+  `jia_id` int(11) NOT NULL AUTO_INCREMENT,
+  `jia_ident` int(11) DEFAULT NULL,
+  `jia_acc` int(11) DEFAULT NULL,
+  PRIMARY KEY (`jia_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `JoinIdentityAccount`
+--
+
+LOCK TABLES `JoinIdentityAccount` WRITE;
+/*!40000 ALTER TABLE `JoinIdentityAccount` DISABLE KEYS */;
+INSERT INTO `JoinIdentityAccount` VALUES (1,2,450001),(3,20,450002),(4,25,450003);
+/*!40000 ALTER TABLE `JoinIdentityAccount` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Loan`
+--
+
+DROP TABLE IF EXISTS `Loan`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Loan` (
+  `ln_id` int(11) NOT NULL AUTO_INCREMENT,
+  `ln_date` date DEFAULT NULL COMMENT 'Date du pret',
+  `ln_amount` double DEFAULT '0' COMMENT 'Montant emprunte',
+  `ln_rate` double DEFAULT '0.01' COMMENT 'taux du pret par an',
+  `ln_duree` int(11) DEFAULT NULL COMMENT 'Duree du pret en mois',
+  `ln_desc` varchar(255) DEFAULT '',
+  `ln_acc_bank` varchar(9) DEFAULT NULL COMMENT 'Bank account',
+  `ln_acc_charge` varchar(9) NOT NULL DEFAULT '660000',
+  `ln_acc_capital` varchar(9) NOT NULL DEFAULT '160000',
+  PRIMARY KEY (`ln_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Loan`
+--
+
+LOCK TABLES `Loan` WRITE;
+/*!40000 ALTER TABLE `Loan` DISABLE KEYS */;
+INSERT INTO `Loan` VALUES (1,'2021-02-10',86133.34,0.0185,106,'Prêt appartement résidence principale','512003','660000','160000'),(2,'2021-07-10',90000,0.009,240,'Prêt appart sous les combre','512002','660000','160000');
+/*!40000 ALTER TABLE `Loan` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `LoanEntry`
+--
+
+DROP TABLE IF EXISTS `LoanEntry`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `LoanEntry` (
+  `le_id` int(11) NOT NULL AUTO_INCREMENT,
+  `le_loan_id` int(11) DEFAULT NULL,
+  `le_date` date DEFAULT NULL COMMENT 'Echéance de remboursement',
+  `le_interest` decimal(13,3) DEFAULT '0.000' COMMENT 'Interet restant du',
+  `le_annuite` decimal(13,3) DEFAULT '0.000' COMMENT 'Annuité mensuelle',
+  `le_ammorti` decimal(13,3) DEFAULT '0.000' COMMENT 'Montant ammorti',
+  `le_booked` tinyint(1) DEFAULT '0',
+  `le_value` decimal(13,3) DEFAULT '0.000',
+  PRIMARY KEY (`le_id`),
+  KEY `loan_id` (`le_loan_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `LoanEntry`
+--
+
+LOCK TABLES `LoanEntry` WRITE;
+/*!40000 ALTER TABLE `LoanEntry` DISABLE KEYS */;
+INSERT INTO `LoanEntry` VALUES (1,1,'2021-02-10',132.790,881.400,748.610,1,85384.730),(2,1,'2021-03-10',131.630,881.400,749.770,1,84634.960),(3,1,'2021-04-10',130.480,881.400,750.920,1,83884.040),(4,1,'2021-05-10',129.320,881.400,752.080,1,83131.960),(5,1,'2021-06-10',128.160,881.400,753.240,1,82378.720),(6,1,'2021-07-10',127.000,881.400,754.400,1,81624.320),(7,1,'2021-08-10',125.840,881.400,755.560,0,80868.760),(8,1,'2021-09-10',124.670,881.400,756.730,0,80112.030),(9,1,'2021-10-10',123.510,881.400,757.890,0,79354.140),(10,1,'2021-11-10',122.340,881.400,759.060,0,78595.080),(11,1,'2021-12-10',121.170,881.400,760.230,0,77834.850),(12,1,'2022-01-10',120.000,881.400,761.400,0,77073.450),(13,1,'2022-02-10',118.820,881.400,762.580,0,76310.870),(14,1,'2022-03-10',117.650,881.400,763.750,0,75547.120),(15,1,'2022-04-10',116.470,881.400,764.930,0,74782.190),(16,1,'2022-05-10',115.290,881.400,766.110,0,74016.080),(17,1,'2022-06-10',114.110,881.400,767.290,0,73248.790),(18,1,'2022-07-10',112.930,881.400,768.470,0,72480.320),(19,1,'2022-08-10',111.740,881.400,769.660,0,71710.660),(20,1,'2022-09-10',110.550,881.400,770.850,0,70939.810),(21,1,'2022-10-10',109.370,881.400,772.030,0,70167.780),(22,1,'2022-11-10',108.180,881.400,773.220,0,69394.560),(23,1,'2022-12-10',106.980,881.400,774.420,0,68620.140),(24,1,'2023-01-10',105.790,881.400,775.610,0,67844.530),(25,1,'2023-02-10',104.590,881.400,776.810,0,67067.720),(26,1,'2023-03-10',103.400,881.400,778.000,0,66289.720),(27,1,'2023-04-10',102.200,881.400,779.200,0,65510.520),(28,1,'2023-05-10',101.000,881.400,780.400,0,64730.120),(29,1,'2023-06-10',99.790,881.400,781.610,0,63948.510),(30,1,'2023-07-10',98.590,881.400,782.810,0,63165.700),(31,1,'2023-08-10',97.380,881.400,784.020,0,62381.680),(32,1,'2023-09-10',96.170,881.400,785.230,0,61596.450),(33,1,'2023-10-10',94.960,881.400,786.440,0,60810.010),(34,1,'2023-11-10',93.750,881.400,787.650,0,60022.360),(35,1,'2023-12-10',92.530,881.400,788.870,0,59233.490),(36,1,'2024-01-10',91.320,881.400,790.080,0,58443.410),(37,1,'2024-02-10',90.100,881.400,791.300,0,57652.110),(38,1,'2024-03-10',88.880,881.400,792.520,0,56859.590),(39,1,'2024-04-10',87.660,881.400,793.740,0,56065.850),(40,1,'2024-05-10',86.430,881.400,794.970,0,55270.880),(41,1,'2024-06-10',85.210,881.400,796.190,0,54474.690),(42,1,'2024-07-10',83.980,881.400,797.420,0,53677.270),(43,1,'2024-08-10',82.750,881.400,798.650,0,52878.620),(44,1,'2024-09-10',81.520,881.400,799.880,0,52078.740),(45,1,'2024-10-10',80.290,881.400,801.110,0,51277.630),(46,1,'2024-11-10',79.050,881.400,802.350,0,50475.280),(47,1,'2024-12-10',77.820,881.400,803.580,0,49671.700),(48,1,'2025-01-10',76.580,881.400,804.820,0,48866.880),(49,1,'2025-02-10',75.340,881.400,806.060,0,48060.820),(50,1,'2025-03-10',74.090,881.400,807.310,0,47253.510),(51,1,'2025-04-10',72.850,881.400,808.550,0,46444.960),(52,1,'2025-05-10',71.600,881.400,809.800,0,45635.160),(53,1,'2025-06-10',70.350,881.400,811.050,0,44824.110),(54,1,'2025-07-10',69.100,881.400,812.300,0,44011.810),(55,1,'2025-08-10',67.850,881.400,813.550,0,43198.260),(56,1,'2025-09-10',66.600,881.400,814.800,0,42383.460),(57,1,'2025-10-10',65.340,881.400,816.060,0,41567.400),(58,1,'2025-11-10',64.080,881.400,817.320,0,40750.080),(59,1,'2025-12-10',62.820,881.400,818.580,0,39931.500),(60,1,'2026-01-10',61.560,881.400,819.840,0,39111.660),(61,1,'2026-02-10',60.300,881.400,821.100,0,38290.560),(62,1,'2026-03-10',59.030,881.400,822.370,0,37468.190),(63,1,'2026-04-10',57.760,881.400,823.640,0,36644.550),(64,1,'2026-05-10',56.490,881.400,824.910,0,35819.640),(65,1,'2026-06-10',55.220,881.400,826.180,0,34993.460),(66,1,'2026-07-10',53.950,881.400,827.450,0,34166.010),(67,1,'2026-08-10',52.670,881.400,828.730,0,33337.280),(68,1,'2026-09-10',51.390,881.400,830.010,0,32507.270),(69,1,'2026-10-10',50.120,881.400,831.280,0,31675.990),(70,1,'2026-11-10',48.830,881.400,832.570,0,30843.420),(71,1,'2026-12-10',47.550,881.400,833.850,0,30009.570),(72,1,'2027-01-10',46.260,881.400,835.140,0,29174.430),(73,1,'2027-02-10',44.980,881.400,836.420,0,28338.010),(74,1,'2027-03-10',43.690,881.400,837.710,0,27500.300),(75,1,'2027-04-10',42.400,881.400,839.000,0,26661.300),(76,1,'2027-05-10',41.100,881.400,840.300,0,25821.000),(77,1,'2027-06-10',39.810,881.400,841.590,0,24979.410),(78,1,'2027-07-10',38.510,881.400,842.890,0,24136.520),(79,1,'2027-08-10',37.210,881.400,844.190,0,23292.330),(80,1,'2027-09-10',35.910,881.400,845.490,0,22446.840),(81,1,'2027-10-10',34.610,881.400,846.790,0,21600.050),(82,1,'2027-11-10',33.300,881.400,848.100,0,20751.950),(83,1,'2027-12-10',31.990,881.400,849.410,0,19902.540),(84,1,'2028-01-10',30.680,881.400,850.720,0,19051.820),(85,1,'2028-02-10',29.370,881.400,852.030,0,18199.790),(86,1,'2028-03-10',28.060,881.400,853.340,0,17346.450),(87,1,'2028-04-10',26.740,881.400,854.660,0,16491.790),(88,1,'2028-05-10',25.420,881.400,855.980,0,15635.810),(89,1,'2028-06-10',24.110,881.400,857.290,0,14778.520),(90,1,'2028-07-10',22.780,881.400,858.620,0,13919.900),(91,1,'2028-08-10',21.460,881.400,859.940,0,13059.960),(92,1,'2028-09-10',20.130,881.400,861.270,0,12198.690),(93,1,'2028-10-10',18.810,881.400,862.590,0,11336.100),(94,1,'2028-11-10',17.480,881.400,863.920,0,10472.180),(95,1,'2028-12-10',16.140,881.400,865.260,0,9606.920),(96,1,'2029-01-10',14.810,881.400,866.590,0,8740.330),(97,1,'2029-02-10',13.470,881.400,867.930,0,7872.400),(98,1,'2029-03-10',12.140,881.400,869.260,0,7003.140),(99,1,'2029-04-10',10.800,881.400,870.600,0,6132.540),(100,1,'2029-05-10',9.450,881.400,871.950,0,5260.590),(101,1,'2029-06-10',8.110,881.400,873.290,0,4387.300),(102,1,'2029-07-10',6.760,881.400,874.640,0,3512.660),(103,1,'2029-08-10',5.420,881.400,875.980,0,2636.680),(104,1,'2029-09-10',4.060,881.400,877.340,0,1759.340),(105,1,'2029-10-10',2.710,881.400,878.690,0,880.650),(106,1,'2029-11-10',1.360,881.400,880.040,0,0.610);
+/*!40000 ALTER TABLE `LoanEntry` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Lot`
+--
+
+DROP TABLE IF EXISTS `Lot`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Lot` (
+  `lot_id` int(11) NOT NULL AUTO_INCREMENT,
+  `lot_num` int(11) DEFAULT NULL,
+  `lot_floor` varchar(32) DEFAULT 'RDC',
+  `lot_area` int(11) DEFAULT '0',
+  `lot_room` int(11) DEFAULT '0',
+  `lot_name` varchar(32) DEFAULT NULL,
+  `lot_type` varchar(32) DEFAULT NULL,
+  `lot_building` varchar(32) DEFAULT NULL,
+  `lot_door` varchar(32) DEFAULT NULL,
+  `lot_description` varchar(256) DEFAULT NULL,
+  PRIMARY KEY (`lot_id`),
+  UNIQUE KEY `lot_num` (`lot_num`)
+) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Lot`
+--
+
+LOCK TABLES `Lot` WRITE;
+/*!40000 ALTER TABLE `Lot` DISABLE KEYS */;
+INSERT INTO `Lot` VALUES (1,1,'1',98,0,'Lot1','Appartement','A','1','Appartement'),(2,2,'2',98,0,'Lot2','Appartement','A','1','Appartement'),(3,3,'2',15,0,'Lot3','Garage','A','1','garage'),(4,4,'1',0,0,'Lot4','Garage','A','','Garage a gauche'),(5,5,'1',0,0,'Lot 5','Jardinet','','','Garage a gauche'),(6,6,'1',5,0,'Lot 6','Appartement','A','1','Test');
+/*!40000 ALTER TABLE `Lot` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `LotsOwners`
+--
+
+DROP TABLE IF EXISTS `LotsOwners`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `LotsOwners` (
+  `lo_id` int(11) NOT NULL AUTO_INCREMENT,
+  `lo_owner_id` int(11) DEFAULT NULL,
+  `lo_lot_id` int(11) DEFAULT NULL,
+  PRIMARY KEY (`lo_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `LotsOwners`
+--
+
+LOCK TABLES `LotsOwners` WRITE;
+/*!40000 ALTER TABLE `LotsOwners` DISABLE KEYS */;
+INSERT INTO `LotsOwners` VALUES (1,25,3),(6,2,1),(4,25,5),(5,20,6);
+/*!40000 ALTER TABLE `LotsOwners` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Temporary table structure for view `Owners`
+--
+
+DROP TABLE IF EXISTS `Owners`;
+/*!50001 DROP VIEW IF EXISTS `Owners`*/;
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `Owners` (
+  `ident_id` tinyint NOT NULL,
+  `ident_name` tinyint NOT NULL,
+  `ident_firstname` tinyint NOT NULL,
+  `ident_address` tinyint NOT NULL,
+  `ident_postalcode` tinyint NOT NULL,
+  `ident_city` tinyint NOT NULL,
+  `ident_country` tinyint NOT NULL,
+  `ident_mobile` tinyint NOT NULL,
+  `ident_phone` tinyint NOT NULL,
+  `ident_email1` tinyint NOT NULL,
+  `ident_email2` tinyint NOT NULL,
+  `idr_name` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `Pcg`
+--
+
+DROP TABLE IF EXISTS `Pcg`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Pcg` (
+  `pcg_id` int(11) NOT NULL AUTO_INCREMENT,
+  `pcg_acc` varchar(16) DEFAULT '',
+  `pcg_acc_name` varchar(255) DEFAULT '',
+  `pcg_acc_type` varchar(1) DEFAULT '',
+  PRIMARY KEY (`pcg_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=112 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Pcg`
+--
+
+LOCK TABLES `Pcg` WRITE;
+/*!40000 ALTER TABLE `Pcg` DISABLE KEYS */;
+INSERT INTO `Pcg` VALUES (1,'1','COMPTES DE CAPITAUX',''),(2,'101','Capital',''),(3,'105','Ecarts de réévaluation',''),(4,'1061','Réserve légale',''),(5,'1062','Réserves indisponible',''),(6,'1063','Réserves statutaires ou contractuelles',''),(7,'1064','Réserves réglementées',''),(8,'1068','Autres réserves',''),(9,'11','REPORT A NOUVEAU',''),(10,'12','RESULTAT NET DE L EXERCICE',''),(11,'145','Amortissements dérogatories',''),(12,'146','Provision spéciale de réévaluation',''),(13,'147','Plus-values réinvesties',''),(14,'148','Autres provisions réglementées',''),(15,'15','PROVISIONS POUR RISQUES ET CHARGES',''),(16,'16','EMPRUNTS ET DETTES ASSIMILEES',''),(17,'2','COMPTES D\'IMMOBILISATIONS',''),(18,'201','Frais d\'établissement',''),(19,'206','Droit au bail',''),(20,'207','Fonds commercial',''),(21,'208','Autres immobilisations incorporelles',''),(22,'21','IMMOBILISATIONS CORPORELLES',''),(23,'23','IMMOBILISATIONS EN COURS',''),(24,'27','AUTRES IMMOBILISATIONS FINANCIERES',''),(25,'280','Amortissements des immobilisations incorporelles',''),(26,'281','Amortissements des immobilisations corporelles',''),(27,'290','Provisions pour dépréciation des immobilisations incorporelles',''),(28,'291','Provisions pour dépréciation des immobilisations corporelles',''),(29,'297','Provisions pour dépréciation des autres immobilisations financières',''),(30,'3','COMPTES DE STOCKS ET D\'EN-COURS',''),(31,'31','MATIERES PREMIERES',''),(32,'32','AUTRES APPROVISIONNEMENTS',''),(33,'33','EN-COURS DE PRODUCTION DE BIENS',''),(34,'34','EN-COURS DE PRODUCTION DE SERVICES',''),(35,'35','STOCKS DE PRODUITS',''),(36,'37','STOCKS DE MARCHANDISES',''),(37,'391','Provisions pour dépréciation des matières premières',''),(38,'392','Provisions pour dépréciation des autres approvisionnements',''),(39,'393','Provisions pour dépréciation des en-cours de production des biens',''),(40,'394','Provisions pour dépréciation des en-cours de production de services',''),(41,'395','Provisions pour dépréciation des stocks de produits',''),(42,'397','Provisions pour dépréciation des stocks de marchandises',''),(43,'4','COMPTES DE TIERS',''),(44,'400','Fournisseurs et Comptes rattachés',''),(45,'409','Fournisseurs débiteurs',''),(46,'410','Clients et Comptes rattachés',''),(47,'419','Clients débiteurs',''),(48,'421','Personnel - Rémunérations dues',''),(49,'428','Personnel - Charges à payer et produits à recevoir',''),(50,'43','SECURITE SOCIALE ET AUTRES ORGANISMES SOCIAUX',''),(51,'444','Etat - Impôts sur les bénéfices',''),(52,'445','Etat - Taxes sur le chiffre d\'affaires',''),(53,'447','Autres impôts, taxes et versements assimilés',''),(54,'455','Associés - Comptes courants',''),(55,'46','DEBITEURS ET CREDITEURS DIVERS',''),(56,'47','COMPTES TRANSITOIRES OU D\'ATTENTE',''),(57,'481','Charges à répartir sur plusieurs exercices',''),(58,'486','Charges constatées d\'avance',''),(59,'487','Produits constatés d\'avance',''),(60,'491','Provisions pour dépréciation des comptes de clients',''),(61,'496','Provisions pour dépréciation des débiteurs divers',''),(62,'5','COMPTES FINANCIERS',''),(63,'50','VALEURS MOBILIERES DE PLACEMENT',''),(64,'51','BANQUES ETABLISSEMENTS FINANCIERS ET ASSIMILES',''),(65,'53','CAISSE',''),(66,'54','REGIS D\'AVANCES ET ACCREDITIFS',''),(67,'58','VIREMENTS INTERNES',''),(68,'590','Provisions pour dépréciation des valeurs mobilières de placement',''),(69,'6','COMPTES DE CHARGES',''),(70,'60','ACHATS (saufs 603)',''),(71,'603','VARIATION DES STOCKS',''),(72,'61','Services Exterieurs',''),(73,'62','Autres services extérieurs',''),(74,'63','IMPôTS TAXES ET VERSEMENT ASSIMILES',''),(75,'641','Rémunération du personnel',''),(76,'644','Rémunération du travail de l\'exploitant',''),(77,'645','Charges de sécurité sociale et de prévoyance',''),(78,'646','Cotisations sociales personnelles de l\'exploitant',''),(79,'65','AUTRES CHARGES DE GESTIONS COURANTE',''),(80,'66','CHARGES FINANCIERES',''),(81,'67','CHARGES EXCEPTIONNELLES',''),(82,'681','Dotations aux amortissements et aux provisions - Charges d\'exploitation',''),(83,'686','Dotations aux amortissements et aux provisions - Charges financières',''),(84,'687','Dotations aux amortissements et aux provisions - Charges exceptionnelles',''),(85,'691','Participation des salariés aux fruits de l\'expansion',''),(86,'695','Impôts sur les bénéfices',''),(87,'697','Imposition forfaitaire annuelle des sociétés',''),(88,'699','Produits - Reports en arrière des déficits',''),(89,'7','COMPTES DE PRODUITS',''),(90,'701','Ventes de produits finis',''),(91,'706','Prestations de services',''),(92,'707','Ventes de marchandises',''),(93,'708','Produits des activités annexes',''),(94,'709','Rabais, remises et ristournes accordés par l\'entreprise',''),(95,'713','VARIATION DES STOCKS (en-cours de production)',''),(96,'72','PRODUCTION IMMOBILISEE',''),(97,'74','SUBVENTIONS D\'EXPLOITATION',''),(98,'75','AUTRES PRODUITS DE GESTION COURANTE',''),(99,'76','PRODUITS FINANCIERS',''),(100,'77','PRODUITS EXCEPTIONNELS',''),(101,'781','Reprises sur amortissements et provisions (à inscrire dans les produits d\'exploitation)',''),(102,'786','Reprises sur provisions (à inscrire dans les produits fianciers)',''),(103,'787','Reprises sur provisions (à inscrire dans les produits exceptionnels)',''),(104,'79','TRANSFERTS DE CHARGES',''),(105,'8','COMPTES SCPECIAUX',''),(106,'80','ENGAGEMENTS HORS BILAN',''),(107,'801','Engagements donnés par l\'entreprise',''),(108,'802','Engagements reçus par l\'entreprise',''),(109,'809','Contrepartie des engagements',''),(110,'88','RESULTAT EN INSTANCE D\'AFFECTATION',''),(111,'89','BILAN','');
+/*!40000 ALTER TABLE `Pcg` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Period`
+--
+
+DROP TABLE IF EXISTS `Period`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Period` (
+  `per_id` int(11) NOT NULL AUTO_INCREMENT,
+  `per_begin` date DEFAULT NULL,
+  `per_end` date DEFAULT NULL,
+  `per_string` varchar(32) DEFAULT NULL,
+  `per_repart_charge_end` tinyint(1) DEFAULT '1',
+  `per_closed` tinyint(1) DEFAULT '0',
+  `per_approved` tinyint(1) DEFAULT '0',
+  PRIMARY KEY (`per_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Period`
+--
+
+LOCK TABLES `Period` WRITE;
+/*!40000 ALTER TABLE `Period` DISABLE KEYS */;
+INSERT INTO `Period` VALUES (1,'2019-01-01','2019-12-31','2019',1,0,0),(5,'2021-01-01','2021-12-01','2021',1,0,0),(4,'2020-01-01','2020-12-31','2020',1,0,0),(6,'2022-01-04','2022-12-31','2022',1,0,0);
+/*!40000 ALTER TABLE `Period` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `PosteCharge`
+--
+
+DROP TABLE IF EXISTS `PosteCharge`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `PosteCharge` (
+  `pc_id` int(11) NOT NULL AUTO_INCREMENT,
+  `pc_sz` int(11) DEFAULT '0',
+  `pc_name` varchar(64) DEFAULT NULL,
+  `pc_comment` varchar(256) DEFAULT NULL,
+  PRIMARY KEY (`pc_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `PosteCharge`
+--
+
+LOCK TABLES `PosteCharge` WRITE;
+/*!40000 ALTER TABLE `PosteCharge` DISABLE KEYS */;
+INSERT INTO `PosteCharge` VALUES (1,0,'PC1','Charges Générales'),(2,0,'PC2','Charges Exceptionnelles'),(3,0,'PC3','Non Utilisé'),(4,0,'PC4','Charges Chauffage'),(5,0,'PC5','Charges Eau');
+/*!40000 ALTER TABLE `PosteCharge` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Recurrent`
+--
+
+DROP TABLE IF EXISTS `Recurrent`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Recurrent` (
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
+  `r_desc` varchar(64) NOT NULL DEFAULT '""',
+  `r_amount` decimal(13,2) NOT NULL DEFAULT '0.00',
+  `r_date` date NOT NULL,
+  `r_end` date NOT NULL,
+  `r_next` date NOT NULL,
+  `r_period` int(11) NOT NULL DEFAULT '1' COMMENT 'unit is month',
+  PRIMARY KEY (`r_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='Recurrent operations that can be handled wih cron';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Recurrent`
+--
+
+LOCK TABLES `Recurrent` WRITE;
+/*!40000 ALTER TABLE `Recurrent` DISABLE KEYS */;
+INSERT INTO `Recurrent` VALUES (1,'Free Mobile Andre',2.00,'2021-01-20','2022-12-20','2021-08-20',1),(2,'Free Mobile Eloise',2.00,'2021-01-20','2022-12-20','2021-08-20',1),(3,'SFR Mobile Eloise',5.00,'2021-01-10','2022-12-20','2021-08-10',1),(4,'SFR Mobile Andre',5.00,'2021-01-20','2022-12-20','2021-08-20',1),(5,'Bouygues Internet',16.98,'2021-01-20','2022-12-20','2021-06-10',1),(6,'LCL Frais bancaire ass moyen de payement',4.20,'2021-01-20','2022-12-20','2021-08-20',1),(7,'LCL Frais bancaire carte visa',11.90,'2021-01-20','2022-12-20','2021-08-20',1),(8,'LBP Frais bancaire M et Mme',41.10,'2021-01-20','2022-04-20','2021-10-20',3),(9,'Impot Taxe Habitation',161.00,'2021-01-15','2022-12-15','2021-08-15',1),(10,'Impot Taxe Foncière',141.00,'2021-01-15','2022-12-15','2021-08-15',1),(11,'Charges de copropriétés',180.00,'2021-01-15','2022-12-15','2021-08-15',1),(12,'Don église Epis',120.00,'2021-01-15','2022-12-15','2021-08-15',1),(13,'Assurance Gras Savoye',14.06,'2021-06-17','2022-12-15','2021-08-17',1);
+/*!40000 ALTER TABLE `Recurrent` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `RecurrentEntry`
+--
+
+DROP TABLE IF EXISTS `RecurrentEntry`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `RecurrentEntry` (
+  `re_id` int(11) NOT NULL AUTO_INCREMENT,
+  `re_rec_id` int(11) NOT NULL,
+  `re_entry_type` varchar(2) NOT NULL,
+  `re_debit_credit` enum('d','c') NOT NULL DEFAULT 'd',
+  `re_amount` decimal(13,3) NOT NULL DEFAULT '0.000',
+  `re_acc` varchar(16) NOT NULL,
+  PRIMARY KEY (`re_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `RecurrentEntry`
+--
+
+LOCK TABLES `RecurrentEntry` WRITE;
+/*!40000 ALTER TABLE `RecurrentEntry` DISABLE KEYS */;
+INSERT INTO `RecurrentEntry` VALUES (1,1,'HA','c',2.000,'401012'),(2,1,'HA','d',2.000,'626000'),(3,1,'BQ','d',2.000,'401012'),(4,1,'BQ','c',2.000,'512001'),(5,2,'HA','c',2.000,'401012'),(6,2,'HA','d',2.000,'626000'),(7,2,'BQ','d',2.000,'401012'),(8,2,'BQ','c',2.000,'512002'),(9,3,'HA','c',5.000,'401012'),(10,3,'HA','d',5.000,'626000'),(11,3,'BQ','d',5.000,'401012'),(12,3,'BQ','c',5.000,'512002'),(13,4,'HA','c',5.000,'401012'),(14,4,'HA','d',5.000,'626000'),(15,4,'BQ','d',5.000,'401012'),(16,4,'BQ','c',5.000,'512002'),(17,5,'HA','c',5.000,'401009'),(18,5,'HA','d',5.000,'626000'),(19,5,'BQ','d',5.000,'401009'),(20,5,'BQ','c',5.000,'512004'),(21,9,'BQ','d',161.000,'630000'),(22,9,'BQ','c',161.000,'512003'),(23,10,'BQ','d',141.000,'630000'),(24,10,'BQ','c',141.000,'512003'),(25,11,'BQ','d',180.000,'614000'),(26,11,'BQ','c',180.000,'512003'),(27,7,'BQ','c',11.900,'512003'),(28,7,'BQ','d',11.900,'627000'),(29,6,'BQ','c',4.200,'512003'),(30,6,'BQ','d',4.200,'627000'),(31,12,'BQ','d',120.000,'623800'),(32,12,'BQ','c',120.000,'512003'),(33,8,'BQ','c',41.100,'512002'),(34,8,'BQ','d',41.100,'627000'),(35,13,'BQ','c',14.060,'512002'),(36,13,'BQ','d',14.060,'616000');
+/*!40000 ALTER TABLE `RecurrentEntry` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Temporary table structure for view `Suppliers`
+--
+
+DROP TABLE IF EXISTS `Suppliers`;
+/*!50001 DROP VIEW IF EXISTS `Suppliers`*/;
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `Suppliers` (
+  `ident_id` tinyint NOT NULL,
+  `ident_name` tinyint NOT NULL,
+  `ident_firstname` tinyint NOT NULL,
+  `ident_address` tinyint NOT NULL,
+  `ident_postalcode` tinyint NOT NULL,
+  `ident_city` tinyint NOT NULL,
+  `ident_country` tinyint NOT NULL,
+  `ident_mobile` tinyint NOT NULL,
+  `ident_phone` tinyint NOT NULL,
+  `ident_email1` tinyint NOT NULL,
+  `ident_email2` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Table structure for table `Tantieme`
+--
+
+DROP TABLE IF EXISTS `Tantieme`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Tantieme` (
+  `tant_id` int(11) NOT NULL AUTO_INCREMENT,
+  `tant_pc_id` int(11) DEFAULT NULL,
+  `tant_lot_num` int(11) DEFAULT NULL,
+  `tant_lot_size` decimal(13,3) DEFAULT NULL,
+  PRIMARY KEY (`tant_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Tantieme`
+--
+
+LOCK TABLES `Tantieme` WRITE;
+/*!40000 ALTER TABLE `Tantieme` DISABLE KEYS */;
+INSERT INTO `Tantieme` VALUES (1,1,1,1000.000),(2,1,2,0.000),(3,1,3,0.000),(4,2,1,359.000),(5,2,2,241.000),(6,2,3,290.000),(7,4,1,240.000),(8,4,2,340.000),(9,4,3,40.000),(10,5,1,333.000),(11,5,2,666.000),(12,5,3,1.000),(13,1,5,0.000),(14,1,4,0.000),(15,2,4,100.000),(16,2,5,10.000),(17,5,4,0.000),(18,5,5,0.000),(19,4,4,380.000),(20,4,5,0.000),(21,1,6,0.000);
+/*!40000 ALTER TABLE `Tantieme` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `TransactionEntry`
+--
+
+DROP TABLE IF EXISTS `TransactionEntry`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `TransactionEntry` (
+  `trans_entry_id` int(11) NOT NULL AUTO_INCREMENT,
+  `trans_id` int(11) DEFAULT NULL,
+  `entry_date` date DEFAULT NULL,
+  `entry_type` varchar(2) DEFAULT NULL,
+  `acc_id` varchar(32) DEFAULT NULL,
+  `orig_amount` decimal(13,2) DEFAULT NULL,
+  `amount` decimal(13,3) DEFAULT NULL,
+  `debit_credit` enum('d','c') DEFAULT NULL,
+  `description` varchar(255) DEFAULT NULL,
+  `voucher_ref` varchar(255) DEFAULT NULL,
+  `tret_key_id` int(11) DEFAULT '0',
+  PRIMARY KEY (`trans_entry_id`),
+  KEY `FK_TransTransEntry` (`trans_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=885 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `TransactionEntry`
+--
+
+LOCK TABLES `TransactionEntry` WRITE;
+/*!40000 ALTER TABLE `TransactionEntry` DISABLE KEYS */;
+INSERT INTO `TransactionEntry` VALUES (1,1,'2019-06-04','BQ','450001',120.00,120.000,'c','versement test','VIREMENT ',0),(2,1,'2019-06-04','BQ','512001',120.00,120.000,'d','versement test','VIREMENT ',0),(3,2,'2019-06-04','HA','602000',34.00,34.000,'d','facture es juin','gdrcgh',1),(4,2,'2019-06-04','HA','401001',34.00,34.000,'c','facture es juin','gdrcgh',1),(14,6,'2019-06-08','OD','450001',199.80,199.800,'d','Repartion Charges compte 601000 Cle: 5','',0),(13,6,'2019-06-08','OD','601000',300.00,300.000,'c','Repartion Charges compte 601000 Cle: 5','',5),(9,4,'2019-06-08','HA','602000',30.00,30.000,'d','Test Charge Intermédiaire','',1),(10,4,'2019-06-08','HA','401001',30.00,30.000,'c','Test Charge Intermédiaire','',1),(15,6,'2019-06-08','OD','450002',99.90,99.900,'d','Repartion Charges compte 601000 Cle: 5','',0),(11,5,'2019-06-08','HA','601000',300.00,300.000,'d','Facture EAU','',5),(12,5,'2019-06-08','HA','401002',300.00,300.000,'c','Facture EAU','',5),(16,6,'2019-06-08','OD','450003',0.30,0.300,'d','Repartion Charges compte 601000 Cle: 5','',0),(17,7,'2019-06-08','OD','602000',64.00,64.000,'c','Repartion Charges compte 602000 Cle: 1','',1),(18,7,'2019-06-08','OD','450001',22.08,22.080,'d','Repartion Charges compte 602000 Cle: 1','',0),(19,7,'2019-06-08','OD','450002',22.08,22.080,'d','Repartion Charges compte 602000 Cle: 1','',0),(20,7,'2019-06-08','OD','450003',13.57,13.568,'d','Repartion Charges compte 602000 Cle: 1','',0),(21,8,'2019-06-08','HA','602000',34.50,34.500,'d','Last EDF to check','REFAK10_01',1),(22,8,'2019-06-08','HA','401001',34.50,34.500,'c','Last EDF to check','REFAK10_01',1),(23,9,'2019-06-08','OD','602000',34.50,34.500,'c','Répartion 34.50€  du compte 602000 Clé 1','',1),(24,9,'2019-06-08','OD','450001',11.90,11.903,'d','Répartion 34.50€  du compte 602000 Clé 1','',0),(25,9,'2019-06-08','OD','450002',11.90,11.903,'d','Répartion 34.50€  du compte 602000 Clé 1','',0),(26,9,'2019-06-08','OD','450003',7.31,7.314,'d','Répartion 34.50€  du compte 602000 Clé 1','',0),(27,10,'2019-06-10','BQ','450001',150.00,150.000,'c','Virement Mai 2019','VIREMENT',0),(28,10,'2019-06-10','BQ','512001',150.00,150.000,'d','Virement Mai 2019','VIREMENT',0),(29,11,'2019-06-10','BQ','450002',100.00,100.000,'c','Virement Mai 2019','VIREMENT',0),(30,11,'2019-06-10','BQ','512001',100.00,100.000,'d','Virement Mai 2019','VIREMENT',0),(31,12,'2019-06-10','BQ','512001',34.00,34.000,'c','Payer facture','CHEQUE N°xxx',0),(32,12,'2019-06-10','BQ','401001',34.00,34.000,'d','Payer facture','CHEQUE N°xxx',0),(33,13,'2019-06-10','BQ','512001',30.00,30.000,'c','payer es','CHEQUE N°563422',0),(34,13,'2019-06-10','BQ','401001',30.00,30.000,'d','payer es','CHEQUE N°563422',0),(35,14,'2021-01-02','HA','607000',96.97,96.970,'d','Courses pour la semaine','',1),(36,14,'2021-01-02','HA','401004',96.97,96.970,'c','Courses pour la semaine','',1),(37,15,'2021-01-09','HA','607000',92.00,92.000,'d','Course','',1),(38,15,'2021-01-09','HA','401004',92.00,92.000,'c','Course','',1),(39,16,'2021-01-14','HA','607000',44.31,44.310,'d','courses','',1),(40,16,'2021-01-14','HA','401004',44.31,44.310,'c','courses','',1),(41,17,'2021-01-16','HA','607000',9.03,9.030,'d','Luges enfants','',1),(42,17,'2021-01-16','HA','401005',9.03,9.030,'c','Luges enfants','',1),(43,18,'2021-01-05','HA','602000',129.96,129.960,'d','Es jan 2021','',1),(44,18,'2021-01-05','HA','401001',129.96,129.960,'c','Es jan 2021','',1),(45,19,'2021-01-07','HA','626000',16.98,16.980,'d','Internet  janv 2021','',1),(46,19,'2021-01-07','HA','401009',16.98,16.980,'c','Internet  janv 2021','',1),(47,20,'2021-01-08','HA','626000',11.99,11.990,'d','Domain DNS','',1),(48,20,'2021-01-08','HA','401010',11.99,11.990,'c','Domain DNS','',1),(49,21,'2021-01-10','HA','606101',22.30,22.300,'d','Essence mercedes','',1),(50,21,'2021-01-10','HA','401006',22.30,22.300,'c','Essence mercedes','',1),(51,22,'2021-01-16','HA','616000',162.88,162.880,'d','Assurance Habitation 1 semestre 2021','',1),(52,22,'2021-01-16','HA','401007',162.88,162.880,'c','Assurance Habitation 1 semestre 2021','',1),(53,23,'2021-01-21','HA','607000',133.32,133.320,'d','Course janv 3iem semaine','',1),(54,23,'2021-01-21','HA','401004',133.32,133.320,'c','Course janv 3iem semaine','',1),(55,24,'2021-01-21','HA','607000',5.99,5.990,'d','Masques covid','',1),(56,24,'2021-01-21','HA','401011',5.99,5.990,'c','Masques covid','',1),(57,25,'2021-01-02','AN','512003',12855.16,12855.160,'d',NULL,NULL,0),(59,25,'2021-01-02','AN','512001',8281.73,8281.730,'d',NULL,NULL,0),(65,27,'2021-01-29','FR','627000',11.90,11.900,'d',NULL,NULL,0),(64,26,'2021-01-29','FR','512003',4.20,4.200,'c',NULL,NULL,0),(63,26,'2021-01-29','FR','627000',4.20,4.200,'d',NULL,NULL,0),(66,27,'2021-01-29','FR','512003',11.90,11.900,'c',NULL,NULL,0),(73,25,'2021-01-02','AN','164001',86880.80,86880.800,'c',NULL,NULL,0),(67,28,'2021-01-10','BQ','512003',881.40,881.400,'c',NULL,NULL,0),(71,25,'2021-01-02','AN','512005',22864.37,22864.370,'d',NULL,NULL,0),(69,28,'2021-01-29','BQ','164001',747.46,747.460,'d',NULL,NULL,0),(70,28,'2021-01-29','BQ','660000',133.94,133.940,'d',NULL,NULL,0),(72,25,'2021-01-02','AN','512006',15333.22,15333.220,'d',NULL,NULL,0),(74,29,'2021-01-29','BQ','512004',129.96,129.960,'c','Payer ES via Internet','VISA',0),(75,29,'2021-01-29','BQ','401001',129.96,129.960,'d','Payer ES via Internet','VISA',0),(76,30,'2021-01-17','BQ','512004',9.03,9.030,'c','Payer luges','VISA',0),(77,30,'2021-01-17','BQ','401005',9.03,9.030,'d','Payer luges','VISA',0),(78,31,'2021-01-29','BQ','512004',22.30,22.300,'c','Payer essence M','VISA LCL',0),(79,31,'2021-01-29','BQ','401006',22.30,22.300,'d','Payer essence M','VISA LCL',0),(91,37,'2021-01-29','BQ','630000',161.00,161.000,'d',NULL,NULL,0),(90,37,'2021-01-29','BQ','512003',161.00,161.000,'c',NULL,NULL,0),(82,33,'2021-01-29','BQ','512004',16.98,16.980,'c','Payer Numericable Internet','VISA LCL',0),(83,33,'2021-01-29','BQ','401009',16.98,16.980,'d','Payer Numericable Internet','VISA LCL',0),(84,34,'2021-01-29','BQ','512004',5.99,5.990,'c','Payer masques','VISA LCL',0),(85,34,'2021-01-29','BQ','401011',5.99,5.990,'d','Payer masques','VISA LCL',0),(86,35,'2021-01-29','BQ','512004',366.60,366.600,'c','Payer LIDL 3 premières semaines','VISA LCL ',0),(87,35,'2021-01-29','BQ','401004',366.60,366.600,'d','Payer LIDL 3 premières semaines','VISA LCL ',0),(88,36,'2021-01-29','BQ','512004',11.99,11.990,'c','Payer domain internet','VISA LCL',0),(89,36,'2021-01-29','BQ','401010',11.99,11.990,'d','Payer domain internet','VISA LCL',0),(96,39,'2021-01-29','VT','410001',2884.31,2884.310,'d',NULL,NULL,0),(94,38,'2021-01-29','BQ','512003',141.00,141.000,'c',NULL,NULL,0),(95,38,'2021-01-29','BQ','630000',141.00,141.000,'d',NULL,NULL,0),(97,39,'2021-01-29','VT','701000',2884.31,2884.310,'c',NULL,NULL,0),(98,40,'2021-01-29','BQ','512003',2884.31,2884.310,'d',NULL,NULL,0),(99,40,'2021-01-29','BQ','410001',2884.31,2884.310,'c',NULL,NULL,0),(100,41,'2021-01-29','BQ','512003',26.82,26.820,'c',NULL,NULL,0),(101,41,'2021-01-29','BQ','616000',26.82,26.820,'d',NULL,NULL,0),(102,42,'2021-01-30','HA','607000',137.49,137.490,'d','LIDL COURSE 1 sem fev','Ticket de caisse',1),(103,42,'2021-01-30','HA','401004',137.49,137.490,'c','LIDL COURSE 1 sem fev','Ticket de caisse',1),(104,25,'2021-01-02','AN','271001',2013.06,2013.060,'d',NULL,NULL,0),(105,25,'2021-01-02','AN','271002',929.85,929.850,'d',NULL,NULL,0),(106,43,'2021-02-01','OD','410001',959.80,959.800,'c',NULL,NULL,0),(107,43,'2021-02-01','OD','271002',959.80,959.800,'d',NULL,NULL,0),(108,44,'2021-01-02','HA','626000',2.00,2.000,'d','Abonnement Free','CCP N°1',1),(109,44,'2021-01-02','HA','401012',2.00,2.000,'c','Abonnement Free','CCP N°1',1),(110,45,'2021-01-20','FR','512003',0.32,0.320,'d',NULL,NULL,0),(111,45,'2021-01-20','FR','627000',0.32,0.320,'c',NULL,NULL,0),(112,46,'2021-01-30','BQ','512004',562.85,562.850,'d',NULL,NULL,0),(113,46,'2021-01-30','BQ','512003',562.85,562.850,'c',NULL,NULL,0),(114,47,'2021-02-02','BQ','512004',137.49,137.490,'c','Payer LIDL 1 semaine fév 2021','VISA ',0),(115,47,'2021-02-02','BQ','401004',137.49,137.490,'d','Payer LIDL 1 semaine fév 2021','VISA ',0),(116,48,'2021-01-10','BQ','512001',2.00,2.000,'c','Payer free mobile','PRELEVEMENT',0),(117,48,'2021-01-10','BQ','401012',2.00,2.000,'d','Payer free mobile','PRELEVEMENT',0),(118,49,'2021-01-12','FR','512001',12.00,12.000,'c',NULL,NULL,0),(119,49,'2021-01-12','FR','627000',12.00,12.000,'d',NULL,NULL,0),(120,50,'2021-01-10','FR','512001',18.90,18.900,'c',NULL,NULL,0),(121,50,'2021-01-10','FR','627000',18.90,18.900,'d',NULL,NULL,0),(122,51,'2021-01-20','OD','512001',1388.00,1388.000,'d',NULL,NULL,0),(123,51,'2021-01-20','OD','630000',1388.00,1388.000,'c',NULL,NULL,0),(124,25,'2021-01-02','AN','213101',232000.00,232000.000,'d',NULL,NULL,0),(125,25,'2021-01-02','AN','271003',4516.57,4516.570,'d',NULL,NULL,0),(126,52,'2021-02-06','HA','626000',16.98,16.980,'d','Facture numericable fev 2021','',1),(127,52,'2021-02-06','HA','401009',16.98,16.980,'c','Facture numericable fev 2021','',1),(128,53,'2021-02-06','HA','626000',2.00,2.000,'d','Facture mobile fev 2021','',1),(129,53,'2021-02-06','HA','401012',2.00,2.000,'c','Facture mobile fev 2021','',1),(130,54,'2021-02-06','BQ','512004',162.88,162.880,'c','Payer groupama','Visa',0),(131,54,'2021-02-06','BQ','401007',162.88,162.880,'d','Payer groupama','Visa',0),(132,55,'2021-02-06','HA','606102',14.00,14.000,'d','Achat masque','Carte Visa',1),(133,55,'2021-02-06','HA','401014',14.00,14.000,'c','Achat masque','Carte Visa',1),(134,56,'2021-02-06','HA','607000',108.33,108.330,'d','Course LIDL pour seconde semaine fév','',1),(135,56,'2021-02-06','HA','401004',108.33,108.330,'c','Course LIDL pour seconde semaine fév','',1),(136,57,'2021-02-09','BQ','512003',26.82,26.820,'c',NULL,NULL,0),(137,57,'2021-02-09','BQ','616000',26.82,26.820,'d',NULL,NULL,0),(138,58,'2021-02-09','BQ','512004',108.33,108.330,'c','Payer LIDL','VISA',0),(139,58,'2021-02-09','BQ','401004',108.33,108.330,'d','Payer LIDL','VISA',0),(140,59,'2021-02-09','BQ','512004',14.00,14.000,'c','Paye masques ','VISA',0),(141,59,'2021-02-09','BQ','401014',14.00,14.000,'d','Paye masques ','VISA',0),(142,60,'2021-02-09','BQ','512004',16.98,16.980,'c','payer internet','VISA',0),(143,60,'2021-02-09','BQ','401009',16.98,16.980,'d','payer internet','VISA',0),(144,61,'2021-02-11','BQ','512003',881.40,881.400,'c',NULL,NULL,0),(145,61,'2021-02-11','BQ','660000',132.79,132.790,'d',NULL,NULL,0),(146,61,'2021-02-11','BQ','164001',748.61,748.610,'d',NULL,NULL,0),(147,62,'2021-02-11','HA','606103',74.50,74.500,'d','Sac cadeau eloise','',1),(148,62,'2021-02-11','HA','401013',74.50,74.500,'c','Sac cadeau eloise','',1),(151,64,'2021-02-11','BQ','512004',74.50,74.500,'c','Payer sac saint valentin','VISA',0),(152,64,'2021-02-11','BQ','401013',74.50,74.500,'d','Payer sac saint valentin','VISA',0),(153,65,'2021-02-13','HA','607000',144.31,144.310,'d','Lidl fev 2 sem','Ticket de caissd',1),(154,65,'2021-02-13','HA','401004',144.31,144.310,'c','Lidl fev 2 sem','Ticket de caissd',1),(155,66,'2021-02-13','BQ','512004',144.31,144.310,'c','Payer LIDL','VISA',0),(156,66,'2021-02-13','BQ','401004',144.31,144.310,'d','Payer LIDL','VISA',0),(157,67,'2021-02-13','FR','512003',4.20,4.200,'c',NULL,NULL,0),(158,67,'2021-02-13','FR','627000',4.20,4.200,'d',NULL,NULL,0),(159,68,'2021-02-13','BQ','512003',360.00,360.000,'c',NULL,NULL,0),(160,68,'2021-02-13','BQ','614000',360.00,360.000,'d',NULL,NULL,0),(161,25,'2021-01-02','AN','89',211913.16,247955.050,'c',NULL,NULL,0),(162,69,'2021-02-16','BQ','512003',161.00,161.000,'c',NULL,NULL,0),(163,69,'2021-02-16','BQ','630000',161.00,161.000,'d',NULL,NULL,0),(164,70,'2021-02-16','BQ','512003',141.00,141.000,'c',NULL,NULL,0),(165,70,'2021-02-16','BQ','630000',141.00,141.000,'d',NULL,NULL,0),(166,71,'2021-02-17','BQ','606101',69.09,69.090,'d',NULL,NULL,0),(167,71,'2021-02-17','BQ','512002',69.09,69.090,'c',NULL,NULL,0),(168,72,'2021-01-28','BQ','512002',19.16,19.160,'c',NULL,NULL,0),(169,72,'2021-01-28','BQ','607000',19.16,19.160,'d',NULL,NULL,0),(170,73,'2021-02-20','HA','607000',110.30,110.300,'d','Course LIDL 3 sem','Ticket de caisse',1),(171,73,'2021-02-20','HA','401004',110.30,110.300,'c','Course LIDL 3 sem','Ticket de caisse',1),(172,74,'2021-02-20','BQ','512004',110.30,110.300,'c','Payer lidl 3sem fév','Visa',0),(173,74,'2021-02-20','BQ','401004',110.30,110.300,'d','Payer lidl 3sem fév','Visa',0),(174,75,'2021-02-22','HA','602000',149.18,149.180,'d','ES Février 2021','21170826S',1),(175,75,'2021-02-22','HA','401001',149.18,149.180,'c','ES Février 2021','21170826S',1),(178,77,'2021-02-26','HA','672000',225.16,225.160,'d','Materiel pour mur salon','61195',1),(179,77,'2021-02-26','HA','401015',225.16,225.160,'c','Materiel pour mur salon','61195',1),(180,78,'2021-02-26','HA','605000',23.70,23.700,'d','Outils pour fixation placo','132674',1),(181,78,'2021-02-26','HA','401015',23.70,23.700,'c','Outils pour fixation placo','132674',1),(182,79,'2021-02-26','BQ','410001',3216.83,3216.830,'c',NULL,NULL,0),(183,79,'2021-02-26','BQ','512003',3216.83,3216.830,'d',NULL,NULL,0),(184,80,'2021-02-26','VT','410001',3216.83,3216.830,'d',NULL,NULL,0),(185,80,'2021-02-26','VT','701000',3216.83,3216.830,'c',NULL,NULL,0),(186,81,'2021-02-27','BQ','512004',768.79,768.790,'d',NULL,NULL,0),(187,81,'2021-02-27','BQ','512003',768.79,768.790,'c',NULL,NULL,0),(188,82,'2021-02-27','BQ','512001',2.00,2.000,'c','Payer Free fév','PRELEVEMENT  CCP N°2',0),(189,82,'2021-02-27','BQ','401012',2.00,2.000,'d','Payer Free fév','PRELEVEMENT  CCP N°2',0),(190,83,'2021-02-23','FR','627000',11.90,11.900,'d',NULL,NULL,0),(191,83,'2021-02-23','FR','512003',11.90,11.900,'c',NULL,NULL,0),(192,84,'2021-02-27','HA','607000',108.47,108.470,'d','LIDL 27 fév','Ticket de caisse',1),(193,84,'2021-02-27','HA','401004',108.47,108.470,'c','LIDL 27 fév','Ticket de caisse',1),(194,85,'2021-02-27','HA','606101',52.30,52.300,'d','Essence plein mercedes','Ticket de caisse',1),(195,85,'2021-02-27','HA','401006',52.30,52.300,'c','Essence plein mercedes','Ticket de caisse',1),(196,86,'2021-02-27','BQ','512004',225.16,225.160,'c','Payer BigMat cloison','VISA',0),(197,86,'2021-02-27','BQ','401015',225.16,225.160,'d','Payer BigMat cloison','VISA',0),(198,87,'2021-02-27','BQ','512004',23.70,23.700,'c','Payer petit matériel Bigmat','VISA',0),(199,87,'2021-02-27','BQ','401015',23.70,23.700,'d','Payer petit matériel Bigmat','VISA',0),(200,88,'2021-02-27','BQ','512004',108.47,108.470,'c','Payer courses 1 semaine mars','VISA',0),(201,88,'2021-02-27','BQ','401004',108.47,108.470,'d','Payer courses 1 semaine mars','VISA',0),(202,89,'2021-02-27','BQ','512004',149.18,149.180,'c','Payer ES fév','VISA',0),(203,89,'2021-02-27','BQ','401001',149.18,149.180,'d','Payer ES fév','VISA',0),(204,90,'2021-02-27','BQ','512004',52.30,52.300,'c','Payer essence','VISA',0),(205,90,'2021-02-27','BQ','401006',52.30,52.300,'d','Payer essence','VISA',0),(206,91,'2021-03-05','HA','626000',16.98,16.980,'d','Internet mars 2021','',1),(207,91,'2021-03-05','HA','401009',16.98,16.980,'c','Internet mars 2021','',1),(208,92,'2021-03-05','HA','626000',10.00,10.000,'d','Commmande carte SIM Red SFR','',1),(209,92,'2021-03-05','HA','401009',10.00,10.000,'c','Commmande carte SIM Red SFR','',1),(210,93,'2021-03-05','BQ','512003',120.00,120.000,'c',NULL,NULL,0),(211,93,'2021-03-05','BQ','623800',120.00,120.000,'d',NULL,NULL,0),(212,94,'2021-03-05','BQ','512003',180.00,180.000,'c',NULL,NULL,0),(213,94,'2021-03-05','BQ','614000',180.00,180.000,'d',NULL,NULL,0),(214,95,'2021-02-25','FR','512003',0.32,0.320,'d',NULL,NULL,0),(215,95,'2021-02-25','FR','627000',0.32,0.320,'c',NULL,NULL,0),(216,96,'2021-03-05','BQ','512004',10.00,10.000,'c','Payer carte SIM','VISA',0),(217,96,'2021-03-05','BQ','401009',10.00,10.000,'d','Payer carte SIM','VISA',0),(218,97,'2021-03-06','HA','607000',106.02,106.020,'d','LIDL course mars 1 semaine','Ticket de caisse',1),(219,97,'2021-03-06','HA','401004',106.02,106.020,'c','LIDL course mars 1 semaine','Ticket de caisse',1),(220,98,'2021-03-06','BQ','512004',106.02,106.020,'c','Payer courses 1er semaine mars','VISA',0),(221,98,'2021-03-06','BQ','401004',106.02,106.020,'d','Payer courses 1er semaine mars','VISA',0),(222,99,'2021-03-06','HA','512004',10.00,10.000,'c',NULL,NULL,0),(223,99,'2021-03-06','HA','606103',10.00,10.000,'d',NULL,NULL,0),(224,100,'2021-02-17','HA','512002',212.34,212.340,'c',NULL,NULL,0),(225,100,'2021-02-17','HA','611000',212.34,212.340,'d',NULL,NULL,0),(226,101,'2021-03-06','HA','512002',234.49,234.490,'c',NULL,NULL,0),(227,101,'2021-03-06','HA','611000',234.49,234.490,'d',NULL,NULL,0),(228,102,'2021-03-06','BQ','512004',16.98,16.980,'c','Payer Internet mars','VISA',0),(229,102,'2021-03-06','BQ','401009',16.98,16.980,'d','Payer Internet mars','VISA',0),(230,103,'2021-03-06','HA','512004',10.95,10.950,'c',NULL,NULL,0),(231,103,'2021-03-06','HA','606101',10.95,10.950,'d',NULL,NULL,0),(232,104,'2021-03-11','HA','512004',36.43,36.430,'c',NULL,NULL,0),(233,104,'2021-03-11','HA','672000',36.43,36.430,'d',NULL,NULL,0),(234,105,'2021-03-11','BQ','512003',26.82,26.820,'c',NULL,NULL,0),(235,105,'2021-03-11','BQ','616000',26.82,26.820,'d',NULL,NULL,0),(236,106,'2021-03-11','BQ','512003',881.40,881.400,'c',NULL,NULL,0),(237,106,'2021-03-11','BQ','660000',131.63,131.630,'d',NULL,NULL,0),(238,106,'2021-03-11','BQ','164001',749.77,749.770,'d',NULL,NULL,0),(239,107,'2021-03-13','HA','607000',111.49,111.490,'d','Achat lidl 2 SEM mars','Ticket de caisse',1),(240,107,'2021-03-13','HA','401004',111.49,111.490,'c','Achat lidl 2 SEM mars','Ticket de caisse',1),(241,108,'2021-03-13','BQ','512004',111.49,111.490,'c','Payer lidl','Visa',0),(242,108,'2021-03-13','BQ','401004',111.49,111.490,'d','Payer lidl','Visa',0),(243,109,'2021-03-19','HA','512004',43.30,43.300,'c',NULL,NULL,0),(244,109,'2021-03-19','HA','672000',43.30,43.300,'d',NULL,NULL,0),(245,110,'2021-03-19','BQ','512003',161.00,161.000,'c',NULL,NULL,0),(246,110,'2021-03-19','BQ','630000',161.00,161.000,'d',NULL,NULL,0),(247,111,'2021-03-19','BQ','512003',141.00,141.000,'c',NULL,NULL,0),(248,111,'2021-03-19','BQ','630000',141.00,141.000,'d',NULL,NULL,0),(249,112,'2021-03-19','FR','512003',4.20,4.200,'c',NULL,NULL,0),(250,112,'2021-03-19','FR','627000',4.20,4.200,'d',NULL,NULL,0),(251,113,'2021-03-27','HA','607000',14.01,14.010,'d','LIDL ','Ticket de caisse',1),(252,113,'2021-03-27','HA','401004',14.01,14.010,'c','LIDL ','Ticket de caisse',1),(253,114,'2021-03-27','HA','607000',91.99,91.990,'d','Achat course mars semaine 3','Ticket de caisse',1),(254,114,'2021-03-27','HA','401004',91.99,91.990,'c','Achat course mars semaine 3','Ticket de caisse',1),(255,115,'2021-03-27','HA','672000',12.13,12.130,'d','Brico depo','Ticket de caisse',1),(256,115,'2021-03-27','HA','401015',12.13,12.130,'c','Brico depo','Ticket de caisse',1),(257,116,'2021-03-27','BQ','512004',14.01,14.010,'c','Payer lidl ','VISA',0),(258,116,'2021-03-27','BQ','401004',14.01,14.010,'d','Payer lidl ','VISA',0),(259,117,'2021-03-27','BQ','512004',91.99,91.990,'c','Payer lidl mars 3ieme sem','VISA',0),(260,117,'2021-03-27','BQ','401004',91.99,91.990,'d','Payer lidl mars 3ieme sem','VISA',0),(261,118,'2021-03-27','BQ','512004',12.13,12.130,'c','Payer brico petite fourniture','VISA',0),(262,118,'2021-03-27','BQ','401015',12.13,12.130,'d','Payer brico petite fourniture','VISA',0),(263,119,'2021-03-10','HA','607000',2.97,2.970,'d','DD reste et cheque cadeau','',1),(264,119,'2021-03-10','HA','401013',2.97,2.970,'c','DD reste et cheque cadeau','',1),(265,120,'2021-03-27','BQ','512004',2.97,2.970,'c','Payer reste DD 2T 2 fois','VISA prélèvement',0),(266,120,'2021-03-27','BQ','401013',2.97,2.970,'d','Payer reste DD 2T 2 fois','VISA prélèvement',0),(267,121,'2021-03-27','FR','512003',11.90,11.900,'c',NULL,NULL,0),(268,121,'2021-03-27','FR','627000',11.90,11.900,'d',NULL,NULL,0),(273,124,'2021-03-29','HA','672000',9.02,9.020,'d','Achat vitre cave','Ticket de caisse',1),(271,123,'2021-03-27','HA','672000',39.70,39.700,'d','Peinture mûr','',1),(272,123,'2021-03-27','HA','401015',39.70,39.700,'c','Peinture mûr','',1),(274,124,'2021-03-29','HA','401015',9.02,9.020,'c','Achat vitre cave','Ticket de caisse',1),(275,125,'2021-03-27','BQ','512004',39.70,39.700,'c','Payer leroy','VISA',0),(276,125,'2021-03-27','BQ','401015',39.70,39.700,'d','Payer leroy','VISA',0),(277,126,'2021-03-29','BQ','512004',9.02,9.020,'c','Payer vitre leroy','VISA',0),(278,126,'2021-03-29','BQ','401015',9.02,9.020,'d','Payer vitre leroy','VISA',0),(281,128,'2021-03-30','HA','607000',108.07,108.070,'d','LIDL 4 sem mars','ticket de caisse',1),(282,128,'2021-03-30','HA','401004',108.07,108.070,'c','LIDL 4 sem mars','ticket de caisse',1),(283,129,'2021-03-30','BQ','512004',108.07,108.070,'c','Payer LIDL sem 4 mars','VISA',0),(284,129,'2021-03-30','BQ','401004',108.07,108.070,'d','Payer LIDL sem 4 mars','VISA',0),(285,130,'2021-03-30','FR','512003',0.32,0.320,'d',NULL,NULL,0),(286,130,'2021-03-30','FR','627000',0.32,0.320,'c',NULL,NULL,0),(287,131,'2021-03-30','VT','410001',2875.27,2875.270,'d',NULL,NULL,0),(288,131,'2021-03-30','VT','701000',2875.27,2875.270,'c',NULL,NULL,0),(289,132,'2021-03-30','BQ','410001',2875.27,2875.270,'c',NULL,NULL,0),(290,132,'2021-03-30','BQ','512003',2875.27,2875.270,'d',NULL,NULL,0),(291,133,'2021-03-30','BQ','512004',1181.87,1181.870,'d',NULL,NULL,0),(292,133,'2021-03-30','BQ','512003',1181.87,1181.870,'c',NULL,NULL,0),(293,134,'2021-03-20','HA','626000',2.00,2.000,'d','Facture free mars','',1),(294,134,'2021-03-20','HA','401012',2.00,2.000,'c','Facture free mars','',1),(295,135,'2021-04-03','HA','606101',50.00,50.000,'d','Le clerc diesel 308','Payer en visa',1),(296,135,'2021-04-03','HA','401006',50.00,50.000,'c','Le clerc diesel 308','Payer en visa',1),(297,136,'2021-04-03','HA','605000',81.91,81.910,'d','Achat Ali pour cnc et multi orise','',1),(298,136,'2021-04-03','HA','401016',81.91,81.910,'c','Achat Ali pour cnc et multi orise','',1),(299,137,'2021-04-03','BQ','512004',81.91,81.910,'c','Payer Ali express cnc','VISA',0),(300,137,'2021-04-03','BQ','401016',81.91,81.910,'d','Payer Ali express cnc','VISA',0),(301,138,'2021-04-03','HA','607000',93.59,93.590,'d','Lidl avril 1 sem','ticket de caisse.',1),(302,138,'2021-04-03','HA','401004',93.59,93.590,'c','Lidl avril 1 sem','ticket de caisse.',1),(303,139,'2021-04-04','HA','672000',22.70,22.700,'d','Achat plinthes leroy','Ticket de caisse',1),(304,139,'2021-04-04','HA','401015',22.70,22.700,'c','Achat plinthes leroy','Ticket de caisse',1),(305,140,'2021-04-10','HA','626000',48.00,48.000,'d','Boygue télé frais de mise en service fibre','',1),(306,140,'2021-04-10','HA','401009',48.00,48.000,'c','Boygue télé frais de mise en service fibre','',1),(307,141,'2021-04-10','HA','630000',25.00,25.000,'d','Frais de douane fedex','',1),(308,141,'2021-04-10','HA','401016',25.00,25.000,'c','Frais de douane fedex','',1),(309,142,'2021-04-10','BQ','512004',93.59,93.590,'c','Payer lidl','VISA',0),(310,142,'2021-04-10','BQ','401004',93.59,93.590,'d','Payer lidl','VISA',0),(311,143,'2021-04-10','HA','607000',117.06,117.060,'d','Lidl 10avril','',1),(312,143,'2021-04-10','HA','401004',117.06,117.060,'c','Lidl 10avril','',1),(313,144,'2021-04-10','BQ','512004',50.00,50.000,'c','Payer essence','Visa',0),(314,144,'2021-04-10','BQ','401006',50.00,50.000,'d','Payer essence','Visa',0),(315,145,'2021-04-10','BQ','512004',22.70,22.700,'c','Payer leroy','Visa',0),(316,145,'2021-04-10','BQ','401015',22.70,22.700,'d','Payer leroy','Visa',0),(317,146,'2021-04-10','HA','626000',16.98,16.980,'d','Facture avril','',1),(318,146,'2021-04-10','HA','401009',16.98,16.980,'c','Facture avril','',1),(319,147,'2021-04-10','BQ','512004',16.98,16.980,'c','Payer numericable avril','Visa',0),(320,147,'2021-04-10','BQ','401009',16.98,16.980,'d','Payer numericable avril','Visa',0),(321,148,'2021-04-10','BQ','512004',48.00,48.000,'c','Payer mise en service boygue','Visa',0),(322,148,'2021-04-10','BQ','401009',48.00,48.000,'d','Payer mise en service boygue','Visa',0),(323,149,'2021-04-10','BQ','512003',120.00,120.000,'c',NULL,NULL,0),(324,149,'2021-04-10','BQ','623800',120.00,120.000,'d',NULL,NULL,0),(325,150,'2021-04-10','BQ','512003',84.10,84.100,'c',NULL,NULL,0),(326,150,'2021-04-10','BQ','616000',84.10,84.100,'d',NULL,NULL,0),(327,151,'2021-04-10','BQ','512003',180.00,180.000,'c',NULL,NULL,0),(328,151,'2021-04-10','BQ','614000',180.00,180.000,'d',NULL,NULL,0),(329,152,'2021-04-17','HA','605000',26.72,26.720,'d','Câble eth prises','',1),(330,152,'2021-04-17','HA','401005',26.72,26.720,'c','Câble eth prises','',1),(331,153,'2021-04-17','BQ','512004',117.06,117.060,'c','Payer lidl','Visa',0),(332,153,'2021-04-17','BQ','401004',117.06,117.060,'d','Payer lidl','Visa',0),(333,154,'2021-04-17','HA','605000',12.80,12.800,'d','Achat leroy','',1),(334,154,'2021-04-17','HA','401015',12.80,12.800,'c','Achat leroy','',1),(335,155,'2021-04-17','BQ','512004',12.80,12.800,'c','payer leroy ','Visa',0),(336,155,'2021-04-17','BQ','401015',12.80,12.800,'d','payer leroy ','Visa',0),(337,156,'2021-04-17','BQ','512004',25.00,25.000,'c','Payer taxe fedex','Visa',0),(338,156,'2021-04-17','BQ','401016',25.00,25.000,'d','Payer taxe fedex','Visa',0),(339,157,'2021-04-20','HA','602000',148.97,148.970,'d','Facture ES Avril','25564790S',1),(340,157,'2021-04-20','HA','401001',148.97,148.970,'c','Facture ES Avril','25564790S',1),(341,158,'2021-04-23','BQ','512003',881.40,881.400,'c',NULL,NULL,0),(342,158,'2021-04-23','BQ','660000',130.48,130.480,'d',NULL,NULL,0),(343,158,'2021-04-23','BQ','164001',750.92,750.920,'d',NULL,NULL,0),(344,159,'2021-04-23','BQ','512003',161.00,161.000,'c',NULL,NULL,0),(345,159,'2021-04-23','BQ','630000',161.00,161.000,'d',NULL,NULL,0),(346,160,'2021-04-23','BQ','512003',141.00,141.000,'c',NULL,NULL,0),(347,160,'2021-04-23','BQ','630000',141.00,141.000,'d',NULL,NULL,0),(348,161,'2021-04-23','HA','607000',159.78,159.780,'d','Achat Lidl avril','Ticket de caisse.',1),(349,161,'2021-04-23','HA','401004',159.78,159.780,'c','Achat Lidl avril','Ticket de caisse.',1),(352,163,'2021-04-23','HA','607000',5.82,5.820,'d','Achat Lidl avril 3S','Ticket de caisse.',1),(353,163,'2021-04-23','HA','401004',5.82,5.820,'c','Achat Lidl avril 3S','Ticket de caisse.',1),(354,164,'2021-04-23','BQ','512004',26.72,26.720,'c','Payer auchan','VISA',0),(355,164,'2021-04-23','BQ','401005',26.72,26.720,'d','Payer auchan','VISA',0),(356,165,'2021-04-23','BQ','512004',159.78,159.780,'c','Payer LIDL 3S','VISA',0),(357,165,'2021-04-23','BQ','401004',159.78,159.780,'d','Payer LIDL 3S','VISA',0),(360,167,'2021-04-23','BQ','512004',5.82,5.820,'c','Payer LIDL ','VISA',0),(361,167,'2021-04-23','BQ','401004',5.82,5.820,'d','Payer LIDL ','VISA',0),(362,168,'2021-04-23','FR','512003',4.20,4.200,'c',NULL,NULL,0),(363,168,'2021-04-23','FR','627000',4.20,4.200,'d',NULL,NULL,0),(364,169,'2021-04-23','BQ','512004',148.97,148.970,'c','Payer ES avril','VISA',0),(365,169,'2021-04-23','BQ','401001',148.97,148.970,'d','Payer ES avril','VISA',0),(366,170,'2021-04-27','HA','626000',18.12,18.120,'d','Bouygues avril mai','En ligne',1),(367,170,'2021-04-27','HA','401009',18.12,18.120,'c','Bouygues avril mai','En ligne',1),(368,171,'2021-04-27','BQ','512004',18.12,18.120,'c','Payer bouygues','VISA',0),(369,171,'2021-04-27','BQ','401009',18.12,18.120,'d','Payer bouygues','VISA',0),(370,172,'2021-04-27','HA','605000',2.80,2.800,'d','Achat ali','Neant',1),(371,172,'2021-04-27','HA','401016',2.80,2.800,'c','Achat ali','Neant',1),(372,173,'2021-04-27','HA','607000',107.79,107.790,'d','Lidl achat','Ticket de caisse',1),(373,173,'2021-04-27','HA','401004',107.79,107.790,'c','Lidl achat','Ticket de caisse',1),(374,174,'2021-04-27','BQ','512004',107.79,107.790,'c','Payer course lidl','VISA',0),(375,174,'2021-04-27','BQ','401004',107.79,107.790,'d','Payer course lidl','VISA',0),(376,175,'2021-04-27','BQ','512004',2.80,2.800,'c','Payer Ali express','PayPal visa',0),(377,175,'2021-04-27','BQ','401016',2.80,2.800,'d','Payer Ali express','PayPal visa',0),(378,176,'2021-04-27','HA','626000',2.00,2.000,'d','Téléphone free avril','Compte lbp',1),(379,176,'2021-04-27','HA','401012',2.00,2.000,'c','Téléphone free avril','Compte lbp',1),(380,177,'2021-04-27','BQ','512003',11.90,11.900,'c',NULL,NULL,0),(381,177,'2021-04-27','BQ','627000',11.90,11.900,'d',NULL,NULL,0),(382,178,'2021-04-29','BQ','512003',2897.79,2897.790,'d',NULL,NULL,0),(383,178,'2021-04-29','BQ','410001',2897.79,2897.790,'c',NULL,NULL,0),(384,179,'2021-04-29','BQ','512003',0.32,0.320,'d',NULL,NULL,0),(385,179,'2021-04-29','BQ','627000',0.32,0.320,'c',NULL,NULL,0),(386,180,'2021-04-30','BQ','512003',938.04,938.040,'c',NULL,NULL,0),(387,180,'2021-04-30','BQ','512004',938.04,938.040,'d',NULL,NULL,0),(388,181,'2021-04-06','FR','512001',18.90,18.900,'c',NULL,NULL,0),(389,181,'2021-04-06','FR','627000',18.90,18.900,'d',NULL,NULL,0),(390,182,'2021-03-22','BQ','512001',2.00,2.000,'c','Payer FREE mobile mars','PRELEVEMENT CCP',0),(391,182,'2021-03-22','BQ','401012',2.00,2.000,'d','Payer FREE mobile mars','PRELEVEMENT CCP',0),(392,183,'2021-04-21','BQ','512001',2.00,2.000,'c','Payer free mobile avril','PRELEVEMENT CCP',0),(393,183,'2021-04-21','BQ','401012',2.00,2.000,'d','Payer free mobile avril','PRELEVEMENT CCP',0),(394,184,'2021-04-29','VT','410001',2897.79,2897.790,'d',NULL,NULL,0),(395,184,'2021-04-29','VT','701000',2897.79,2897.790,'c',NULL,NULL,0),(396,185,'2021-02-22','OD','410001',1186.00,1186.000,'c',NULL,NULL,0),(397,185,'2021-02-22','OD','271001',1186.00,1186.000,'d',NULL,NULL,0),(398,186,'2021-05-02','BQ','512002',230.00,230.000,'c',NULL,NULL,0),(399,186,'2021-05-02','BQ','623800',230.00,230.000,'d',NULL,NULL,0),(400,187,'2021-05-03','HA','607000',88.81,88.810,'d','Lidl mai 1 week','',1),(401,187,'2021-05-03','HA','401004',88.81,88.810,'c','Lidl mai 1 week','',1),(402,188,'2021-05-03','BQ','512004',88.81,88.810,'c','Payer Lidl','VISA',0),(403,188,'2021-05-03','BQ','401004',88.81,88.810,'d','Payer Lidl','VISA',0),(404,189,'2021-05-08','HA','606101',58.30,58.300,'d','Cora essence mercedes','',1),(405,189,'2021-05-08','HA','401006',58.30,58.300,'c','Cora essence mercedes','',1),(406,190,'2021-05-06','BQ','512003',24.24,24.240,'c',NULL,NULL,0),(407,190,'2021-05-06','BQ','616000',24.24,24.240,'d',NULL,NULL,0),(408,191,'2021-05-10','BQ','512003',180.00,180.000,'c',NULL,NULL,0),(409,191,'2021-05-10','BQ','614000',180.00,180.000,'d',NULL,NULL,0),(410,192,'2021-05-10','BQ','512003',90.00,90.000,'c',NULL,NULL,0),(411,192,'2021-05-10','BQ','623800',90.00,90.000,'d',NULL,NULL,0),(412,193,'2021-05-13','HA','607000',11.21,11.210,'d','Cadeau anniversaire Kevin','Ticket de caisse',1),(413,193,'2021-05-13','HA','401005',11.21,11.210,'c','Cadeau anniversaire Kevin','Ticket de caisse',1),(414,194,'2021-05-13','BQ','512004',11.21,11.210,'c','Payer auchan anniv kevin','VISA',0),(415,194,'2021-05-13','BQ','401005',11.21,11.210,'d','Payer auchan anniv kevin','VISA',0),(416,195,'2021-05-10','BQ','512003',881.40,881.400,'c',NULL,NULL,1),(417,195,'2021-05-10','BQ','660000',129.32,129.320,'d',NULL,NULL,1),(418,195,'2021-05-10','BQ','164001',752.08,752.080,'d',NULL,NULL,1),(419,196,'2021-05-13','BQ','512004',58.30,58.300,'c','Payer Essence mercedes cora','VISA',0),(420,196,'2021-05-13','BQ','401006',58.30,58.300,'d','Payer Essence mercedes cora','VISA',0),(421,197,'2021-05-13','HA','607000',120.96,120.960,'d','Achat LIDL mai semaine 2','Ticket de caisse',1),(422,197,'2021-05-13','HA','401004',120.96,120.960,'c','Achat LIDL mai semaine 2','Ticket de caisse',1),(423,198,'2021-05-13','BQ','512004',120.96,120.960,'c','Payer LIDL semaine 2 main','VISA',0),(424,198,'2021-05-13','BQ','401004',120.96,120.960,'d','Payer LIDL semaine 2 main','VISA',0),(425,199,'2021-05-13','FR','512003',4.20,4.200,'c',NULL,NULL,0),(426,199,'2021-05-13','FR','627000',4.20,4.200,'d',NULL,NULL,0),(427,200,'2021-01-29','HA','512002',184.34,184.340,'c',NULL,NULL,0),(428,200,'2021-01-29','HA','611000',184.34,184.340,'d',NULL,NULL,0),(429,201,'2021-04-13','BQ','512002',212.34,212.340,'c',NULL,NULL,0),(430,201,'2021-04-13','BQ','611000',212.34,212.340,'d',NULL,NULL,0),(431,202,'2021-05-09','HA','512002',103.66,103.660,'c',NULL,NULL,0),(432,202,'2021-05-09','HA','611000',103.66,103.660,'d',NULL,NULL,0),(433,203,'2021-05-16','HA','607000',NULL,100.430,'d','LDIL course ','Ticket de caisse',1),(434,203,'2021-05-16','HA','401004',NULL,100.430,'c','LDIL course ','Ticket de caisse',1),(435,204,'2021-05-19','HA','606101',NULL,64.000,'d','Gazole 308','Ticket de caisse',1),(436,204,'2021-05-19','HA','401006',NULL,64.000,'c','Gazole 308','Ticket de caisse',1),(437,205,'2021-05-21','HA','626000',NULL,17.220,'d','Facture Bouygues mai','',1),(438,205,'2021-05-21','HA','401009',NULL,17.220,'c','Facture Bouygues mai','',1),(441,207,'2021-05-22','HA','607000',NULL,112.910,'d','Lidl mai sem 3','Ticket de caisse',1),(442,207,'2021-05-22','HA','401004',NULL,112.910,'c','Lidl mai sem 3','Ticket de caisse',1),(443,208,'2021-05-28','HA','606103',NULL,35.580,'d','course fête des mere','',1),(444,208,'2021-05-28','HA','401005',NULL,35.580,'c','course fête des mere','',1),(445,209,'2021-05-28','HA','606103',NULL,53.980,'d','Maranaud gift eloise fête des meres','',1),(446,209,'2021-05-28','HA','401005',NULL,53.980,'c','Maranaud gift eloise fête des meres','',1),(447,210,'2021-05-29','BQ','512004',NULL,100.430,'c','courses LIDL semaine 2','VISA',0),(448,210,'2021-05-29','BQ','401004',NULL,100.430,'d','courses LIDL semaine 2','VISA',0),(449,211,'2021-05-29','BQ','512004',NULL,112.910,'c','Payer LIDL semaine 3','VISA',0),(450,211,'2021-05-29','BQ','401004',NULL,112.910,'d','Payer LIDL semaine 3','VISA',0),(451,212,'2021-05-29','BQ','512004',NULL,17.220,'c','Payer Bouygues','VISA',0),(452,212,'2021-05-29','BQ','401009',NULL,17.220,'d','Payer Bouygues','VISA',0),(453,213,'2021-05-29','BQ','512004',NULL,64.000,'c','Payer plein peugeot','VISA',0),(454,213,'2021-05-29','BQ','401006',NULL,64.000,'d','Payer plein peugeot','VISA',0),(455,214,'2021-05-15','BQ','630000',NULL,161.000,'d',NULL,NULL,1),(456,214,'2021-05-15','BQ','512003',NULL,161.000,'c',NULL,NULL,1),(457,215,'2021-05-15','BQ','630000',NULL,141.000,'d',NULL,NULL,1),(458,215,'2021-05-15','BQ','512003',NULL,141.000,'c',NULL,NULL,1),(459,216,'2021-03-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(460,216,'2021-03-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(461,216,'2021-03-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(462,216,'2021-03-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(463,217,'2021-04-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(464,217,'2021-04-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(465,217,'2021-04-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(466,217,'2021-04-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(467,218,'2021-05-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(468,218,'2021-05-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(469,218,'2021-05-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(470,218,'2021-05-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(471,219,'2021-03-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(472,219,'2021-03-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(473,219,'2021-03-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(474,219,'2021-03-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(475,220,'2021-04-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(476,220,'2021-04-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(477,220,'2021-04-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(478,220,'2021-04-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(479,221,'2021-05-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(480,221,'2021-05-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(481,221,'2021-05-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(482,221,'2021-05-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(483,222,'2021-05-29','VT','701000',NULL,2911.450,'c',NULL,NULL,0),(484,222,'2021-05-29','VT','410001',NULL,2911.450,'d',NULL,NULL,0),(485,223,'2021-05-29','BQ','512003',NULL,2911.450,'d',NULL,NULL,0),(486,223,'2021-05-29','BQ','410001',NULL,2911.450,'c',NULL,NULL,0),(487,224,'2021-05-29','HA','607000',NULL,96.290,'d','Lidl semaine 4 mai','Ticket de caisse',1),(488,224,'2021-05-29','HA','401004',NULL,96.290,'c','Lidl semaine 4 mai','Ticket de caisse',1),(489,225,'2021-06-01','HA','607000',NULL,104.400,'d','Au cheval noir hoenheim','Ticket de caisse',1),(490,225,'2021-06-01','HA','401017',NULL,104.400,'c','Au cheval noir hoenheim','Ticket de caisse',1),(491,226,'2021-05-31','BQ','512004',NULL,573.840,'d',NULL,NULL,0),(492,226,'2021-05-31','BQ','512003',NULL,573.840,'c',NULL,NULL,0),(493,227,'2021-05-26','FR','512003',NULL,11.900,'c',NULL,NULL,0),(494,227,'2021-05-26','FR','627000',NULL,11.900,'d',NULL,NULL,0),(495,228,'2021-05-28','FR','512003',NULL,0.320,'d',NULL,NULL,0),(496,228,'2021-05-28','FR','627000',NULL,0.320,'c',NULL,NULL,0),(497,229,'2021-06-05','HA','607000',NULL,83.900,'d','Lidl juin sem 1','Ticket de caisse',1),(498,229,'2021-06-05','HA','401004',NULL,83.900,'c','Lidl juin sem 1','Ticket de caisse',1),(499,230,'2021-06-05','BQ','512004',NULL,104.400,'c','Payer cheval noir','VISQ',0),(500,230,'2021-06-05','BQ','401017',NULL,104.400,'d','Payer cheval noir','VISQ',0),(501,231,'2021-06-05','BQ','512004',NULL,89.560,'c','Payer cadeau fête des meres','Visa',0),(502,231,'2021-06-05','BQ','401005',NULL,89.560,'d','Payer cadeau fête des meres','Visa',0),(503,232,'2021-06-05','BQ','512004',NULL,96.290,'c','Payer lidl','Visa',0),(504,232,'2021-06-05','BQ','401004',NULL,96.290,'d','Payer lidl','Visa',0),(505,233,'2021-06-12','HA','607000',NULL,84.600,'d','Course sem2','',1),(506,233,'2021-06-12','HA','401004',NULL,84.600,'c','Course sem2','',1),(507,234,'2021-06-12','HA','606103',NULL,69.000,'d','Décathlon casque sac vélo','',1),(508,234,'2021-06-12','HA','401017',NULL,69.000,'c','Décathlon casque sac vélo','',1),(509,235,'2021-06-13','BQ','512004',NULL,83.900,'c','Payer lidl','CHEQUE N°',0),(510,235,'2021-06-13','BQ','401004',NULL,83.900,'d','Payer lidl','CHEQUE N°',0),(511,236,'2021-06-10','BQ','512003',NULL,881.400,'c',NULL,NULL,1),(512,236,'2021-06-10','BQ','660000',NULL,128.160,'d',NULL,NULL,1),(513,236,'2021-06-10','BQ','164001',NULL,753.240,'d',NULL,NULL,1),(514,237,'2021-06-13','BQ','512003',NULL,24.240,'c',NULL,NULL,0),(515,237,'2021-06-13','BQ','616000',NULL,24.240,'d',NULL,NULL,0),(516,238,'2021-06-16','BQ','512004',NULL,69.000,'c','Payer DECATHLON','VISA',0),(517,238,'2021-06-16','BQ','401017',NULL,69.000,'d','Payer DECATHLON','VISA',0),(518,239,'2021-06-16','BQ','512004',NULL,84.600,'c','Payer LIDL','VISA',0),(519,239,'2021-06-16','BQ','401004',NULL,84.600,'d','Payer LIDL','VISA',0),(520,240,'2021-06-16','HA','606103',NULL,20.500,'d','Restaurant KFC','',1),(521,240,'2021-06-16','HA','401017',NULL,20.500,'c','Restaurant KFC','',1),(524,242,'2021-06-16','BQ','512004',NULL,20.500,'c','Payer KFC','VISA',0),(525,242,'2021-06-16','BQ','401017',NULL,20.500,'d','Payer KFC','VISA',0),(526,243,'2021-06-15','BQ','630000',NULL,161.000,'d',NULL,NULL,1),(527,243,'2021-06-15','BQ','512003',NULL,161.000,'c',NULL,NULL,1),(528,244,'2021-06-15','BQ','630000',NULL,141.000,'d',NULL,NULL,1),(529,244,'2021-06-15','BQ','512003',NULL,141.000,'c',NULL,NULL,1),(552,256,'2021-06-22','BQ','512004',NULL,8.050,'c',NULL,NULL,0),(553,256,'2021-06-22','BQ','626000',NULL,8.050,'d',NULL,NULL,0),(532,246,'2021-06-16','HA','616000',NULL,608.400,'d','Assurance Voitures','n017',1),(533,246,'2021-06-16','HA','401008',NULL,608.400,'c','Assurance Voitures','n017',1),(534,247,'2021-01-27','BQ','512002',NULL,2182.460,'d',NULL,NULL,0),(535,247,'2021-01-27','BQ','701001',NULL,2182.460,'c',NULL,NULL,0),(536,248,'2021-02-24','BQ','512002',NULL,2182.460,'d',NULL,NULL,0),(537,248,'2021-02-24','BQ','701001',NULL,2182.460,'c',NULL,NULL,0),(538,249,'2021-03-29','BQ','512002',NULL,2312.220,'d',NULL,NULL,0),(539,249,'2021-03-29','BQ','701001',NULL,2312.220,'c',NULL,NULL,0),(540,250,'2021-04-28','BQ','512002',NULL,2182.460,'d',NULL,NULL,0),(541,250,'2021-04-28','BQ','701001',NULL,2182.460,'c',NULL,NULL,0),(542,251,'2021-05-27','BQ','512002',NULL,2219.100,'d',NULL,NULL,0),(543,251,'2021-05-27','BQ','701001',NULL,2219.100,'c',NULL,NULL,0),(544,252,'2021-06-08','BQ','512001',NULL,250.000,'c',NULL,NULL,0),(545,252,'2021-06-08','BQ','512002',NULL,250.000,'d',NULL,NULL,0),(546,253,'2021-06-18','BQ','512001',NULL,6150.000,'c',NULL,NULL,0),(547,253,'2021-06-18','BQ','512002',NULL,6150.000,'d',NULL,NULL,0),(548,254,'2021-06-15','BQ','614000',NULL,180.000,'d',NULL,NULL,1),(549,254,'2021-06-15','BQ','512003',NULL,180.000,'c',NULL,NULL,1),(550,255,'2021-06-19','HA','607000',NULL,95.850,'d','Achat semaine 3 juin','Payer via visa',1),(551,255,'2021-06-19','HA','401004',NULL,95.850,'c','Achat semaine 3 juin','Payer via visa',1),(556,258,'2021-06-23','HA','606101',NULL,70.590,'d','Plein 308','',1),(557,258,'2021-06-23','HA','401006',NULL,70.590,'c','Plein 308','',1),(558,259,'2021-06-23','BQ','512002',NULL,70.590,'c','Payer gazole 308','Visa',0),(559,259,'2021-06-23','BQ','401006',NULL,70.590,'d','Payer gazole 308','Visa',0),(560,260,'2021-06-25','HA','606101',NULL,59.700,'d','Plein mercedes','',1),(561,260,'2021-06-25','HA','401006',NULL,59.700,'c','Plein mercedes','',1),(562,261,'2021-06-25','BQ','512004',NULL,59.700,'c','Payer essence','VISA',0),(563,261,'2021-06-25','BQ','401006',NULL,59.700,'d','Payer essence','VISA',0),(564,262,'2021-06-26','HA','607000',NULL,111.750,'d','Course semaine 4 juin','TICKET de caisse',1),(565,262,'2021-06-26','HA','401004',NULL,111.750,'c','Course semaine 4 juin','TICKET de caisse',1),(566,263,'2021-06-26','HA','671000',NULL,2299.330,'d','Changement porte d\'entree','Devis RENOV HABITAT',1),(567,263,'2021-06-26','HA','401015',NULL,2299.330,'c','Changement porte d\'entree','Devis RENOV HABITAT',1),(568,264,'2021-06-26','BQ','512003',NULL,600.000,'c','Acompte RENOV HABITA','VIREMENT',0),(569,264,'2021-06-26','BQ','401015',NULL,600.000,'d','Acompte RENOV HABITA','VIREMENT',0),(570,265,'2021-06-26','HA','602000',NULL,113.160,'d','Facture ES juin 2021','26023801S',1),(571,265,'2021-06-26','HA','401001',NULL,113.160,'c','Facture ES juin 2021','26023801S',1),(572,266,'2021-06-26','BQ','512004',NULL,95.850,'c','Payer LIDL','VIISA',0),(573,266,'2021-06-26','BQ','401004',NULL,95.850,'d','Payer LIDL','VIISA',0),(574,267,'2021-06-20','BQ','512003',NULL,4.200,'c',NULL,NULL,1),(575,267,'2021-06-20','BQ','627000',NULL,4.200,'d',NULL,NULL,1),(576,268,'2021-06-26','BQ','512003',NULL,608.400,'c','Payer assurance vioitures 2Sem','CHEQUE N°',0),(577,268,'2021-06-26','BQ','401008',NULL,608.400,'d','Payer assurance vioitures 2Sem','CHEQUE N°',0),(578,269,'2021-07-02','HA','606103',NULL,29.900,'d','Resto cheval blanc','',1),(579,269,'2021-07-02','HA','401017',NULL,29.900,'c','Resto cheval blanc','',1),(580,270,'2021-06-30','BQ','512004',NULL,113.160,'c','Payer es','Virement',0),(581,270,'2021-06-30','BQ','401001',NULL,113.160,'d','Payer es','Virement',0),(582,271,'2021-06-30','BQ','512004',NULL,111.750,'c','Payer lidl','VISA',0),(583,271,'2021-06-30','BQ','401004',NULL,111.750,'d','Payer lidl','VISA',0),(584,272,'2021-06-30','BQ','512003',NULL,936.760,'c',NULL,NULL,0),(585,272,'2021-06-30','BQ','512004',NULL,936.760,'d',NULL,NULL,0),(586,273,'2021-06-29','BQ','512003',NULL,4389.170,'d',NULL,NULL,0),(587,273,'2021-06-29','BQ','410001',NULL,4389.170,'c',NULL,NULL,0),(588,274,'2021-06-20','BQ','512003',NULL,11.900,'c',NULL,NULL,1),(589,274,'2021-06-20','BQ','627000',NULL,11.900,'d',NULL,NULL,1),(590,275,'2021-06-29','FR','512003',NULL,0.320,'d',NULL,NULL,0),(591,275,'2021-06-29','FR','627000',NULL,0.320,'c',NULL,NULL,0),(592,276,'2021-07-03','HA','607000',NULL,98.910,'d','Course 1sem juillet','Ticket de caisse',1),(593,276,'2021-07-03','HA','401004',NULL,98.910,'c','Course 1sem juillet','Ticket de caisse',1),(594,277,'2021-07-05','HA','616000',NULL,162.870,'d','Assurance Appart residence principale','',1),(595,277,'2021-07-05','HA','401007',NULL,162.870,'c','Assurance Appart residence principale','',1),(596,278,'2021-07-05','BQ','512004',NULL,29.900,'c','Payer assurance','VISA',0),(597,278,'2021-07-05','BQ','401017',NULL,29.900,'d','Payer assurance','VISA',0),(598,279,'2021-06-30','BQ','512002',NULL,90000.000,'d',NULL,NULL,0),(599,279,'2021-06-30','BQ','164002',NULL,90000.000,'c',NULL,NULL,0),(600,280,'2021-06-28','BQ','512002',NULL,47121.800,'c',NULL,NULL,0),(601,280,'2021-06-28','BQ','461000',NULL,47121.800,'d',NULL,NULL,0),(602,281,'2021-06-30','BQ','461000',NULL,90000.000,'d',NULL,NULL,0),(603,281,'2021-06-30','BQ','512002',NULL,90000.000,'c',NULL,NULL,0),(604,282,'2021-07-01','HA','461000',NULL,127500.000,'c',NULL,NULL,0),(605,282,'2021-07-01','HA','213102',NULL,127500.000,'d',NULL,NULL,0),(606,283,'2021-07-01','HA','461000',NULL,9621.800,'c',NULL,NULL,0),(607,283,'2021-07-01','HA','622200',NULL,2653.800,'d',NULL,NULL,0),(608,283,'2021-07-01','HA','630000',NULL,6968.000,'d',NULL,NULL,0),(609,25,'2021-01-02','AN','512002',NULL,41401.250,'d',NULL,NULL,0),(610,284,'2021-06-25','BQ','512002',NULL,184.340,'c',NULL,NULL,0),(611,284,'2021-06-25','BQ','611000',NULL,184.340,'d',NULL,NULL,0),(612,285,'2021-06-28','BQ','512002',NULL,2182.460,'d',NULL,NULL,0),(613,285,'2021-06-28','BQ','701001',NULL,2182.460,'c',NULL,NULL,0),(614,286,'2021-07-05','BQ','512002',NULL,132.080,'d',NULL,NULL,0),(615,286,'2021-07-05','BQ','701001',NULL,132.080,'c',NULL,NULL,0),(616,287,'2021-06-04','BQ','512002',NULL,132.080,'d',NULL,NULL,0),(617,287,'2021-06-04','BQ','701001',NULL,132.080,'c',NULL,NULL,0),(618,288,'2021-06-28','VT','410001',NULL,4389.170,'d',NULL,NULL,0),(619,288,'2021-06-28','VT','701000',NULL,4389.170,'c',NULL,NULL,0),(620,289,'2021-07-05','BQ','512002',NULL,48.620,'c',NULL,NULL,0),(621,289,'2021-07-05','BQ','616000',NULL,48.620,'d',NULL,NULL,0),(622,290,'2021-07-05','BQ','512002',NULL,41.420,'c',NULL,NULL,0),(623,290,'2021-07-05','BQ','616000',NULL,41.420,'d',NULL,NULL,0),(624,291,'2021-06-20','HA','401012',NULL,2.000,'c',NULL,NULL,1),(625,291,'2021-06-20','HA','626000',NULL,2.000,'d',NULL,NULL,1),(626,291,'2021-06-20','BQ','401012',NULL,2.000,'d',NULL,NULL,1),(627,291,'2021-06-20','BQ','512001',NULL,2.000,'c',NULL,NULL,1),(628,292,'2021-07-20','BQ','401012',NULL,2.000,'c',NULL,NULL,1),(629,292,'2021-07-20','BQ','626000',NULL,2.000,'d',NULL,NULL,1),(630,292,'2021-07-20','BQ','401012',NULL,2.000,'d',NULL,NULL,1),(631,292,'2021-07-20','BQ','512001',NULL,2.000,'c',NULL,NULL,1),(632,293,'2021-06-20','HA','401012',NULL,2.000,'c',NULL,NULL,1),(633,293,'2021-06-20','HA','626000',NULL,2.000,'d',NULL,NULL,1),(634,293,'2021-06-20','BQ','401012',NULL,2.000,'d',NULL,NULL,1),(635,293,'2021-06-20','BQ','512002',NULL,2.000,'c',NULL,NULL,1),(636,294,'2021-07-05','BQ','512002',NULL,1481.000,'c',NULL,NULL,0),(637,294,'2021-07-05','BQ','622200',NULL,1481.000,'d',NULL,NULL,0),(638,295,'2021-06-10','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(639,295,'2021-06-10','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(640,296,'2021-07-05','BQ','512002',NULL,104.300,'c',NULL,NULL,0),(641,296,'2021-07-05','BQ','606103',NULL,104.300,'d',NULL,NULL,0),(642,297,'2021-06-29','BQ','512002',NULL,3.800,'c',NULL,NULL,0),(643,297,'2021-06-29','BQ','627000',NULL,3.800,'d',NULL,NULL,0),(644,298,'2021-06-28','BQ','512002',NULL,48.970,'c',NULL,NULL,0),(645,298,'2021-06-28','BQ','606103',NULL,48.970,'d',NULL,NULL,0),(646,299,'2021-06-29','BQ','512002',NULL,25.760,'c',NULL,NULL,0),(647,299,'2021-06-29','BQ','606103',NULL,25.760,'d',NULL,NULL,0),(648,300,'2021-07-06','HA','671000',NULL,72.510,'d','Achat Leroy Disjonteur','Ticket de caisse',1),(649,300,'2021-07-06','HA','401015',NULL,72.510,'c','Achat Leroy Disjonteur','Ticket de caisse',1),(650,301,'2021-07-07','HA','671000',NULL,23.300,'d','Leroy Platine disjoncteur','',1),(651,301,'2021-07-07','HA','401015',NULL,23.300,'c','Leroy Platine disjoncteur','',1),(652,302,'2021-07-06','BQ','512004',NULL,72.510,'c','Payer leroy disjoncteur','VISA',0),(653,302,'2021-07-06','BQ','401015',NULL,72.510,'d','Payer leroy disjoncteur','VISA',0),(654,303,'2021-07-07','BQ','512004',NULL,23.300,'c','Payer leroy platine disjoncteur','VISA',0),(655,303,'2021-07-07','BQ','401015',NULL,23.300,'d','Payer leroy platine disjoncteur','VISA',0),(656,304,'2021-07-08','BQ','512004',NULL,162.870,'c','Payer assurance','VISA',0),(657,304,'2021-07-08','BQ','401007',NULL,162.870,'d','Payer assurance','VISA',0),(658,305,'2021-07-08','BQ','512004',NULL,98.910,'c','Payer LIDL','VISA',0),(659,305,'2021-07-08','BQ','401004',NULL,98.910,'d','Payer LIDL','VISA',0),(660,306,'2021-07-05','HA','607000',NULL,14.670,'d','Achat lidl anniversaire','LIDL CGE3946',1),(661,306,'2021-07-05','HA','401004',NULL,14.670,'c','Achat lidl anniversaire','LIDL CGE3946',1),(662,307,'2021-07-05','HA','607000',NULL,17.910,'d','Course LIDL anniversaire','LIDL CGE 3946',1),(663,307,'2021-07-05','HA','401004',NULL,17.910,'c','Course LIDL anniversaire','LIDL CGE 3946',1),(664,308,'2021-07-05','BQ','512004',NULL,14.670,'c','Payer LIDL anniversaire 1','VISA',0),(665,308,'2021-07-05','BQ','401004',NULL,14.670,'d','Payer LIDL anniversaire 1','VISA',0),(666,309,'2021-07-05','BQ','512004',NULL,17.910,'c','Payer course lidl anniversaire','VISA',0),(667,309,'2021-07-05','BQ','401004',NULL,17.910,'d','Payer course lidl anniversaire','VISA',0),(668,310,'2021-07-05','HA','626000',NULL,15.990,'d','Bouygues prelèvement SEPA ','PRELEVEMENT CCPP',1),(669,310,'2021-07-05','HA','401009',NULL,15.990,'c','Bouygues prelèvement SEPA ','PRELEVEMENT CCPP',1),(670,311,'2021-07-05','BQ','512003',NULL,15.990,'c','Prelevement bouygues juillet','PRELEVEMENT',0),(671,311,'2021-07-05','BQ','401009',NULL,15.990,'d','Prelevement bouygues juillet','PRELEVEMENT',0),(672,312,'2021-07-05','BQ','512003',NULL,24.240,'c',NULL,NULL,0),(673,312,'2021-07-05','BQ','616000',NULL,24.240,'d',NULL,NULL,0),(674,25,'2021-01-02','AN','164003',NULL,5359.360,'c',NULL,NULL,0),(675,313,'2021-05-10','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(676,313,'2021-05-10','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(677,314,'2021-04-12','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(678,314,'2021-04-12','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(679,315,'2021-07-07','BQ','512002',NULL,210.000,'c',NULL,NULL,0),(680,315,'2021-07-07','BQ','623800',NULL,210.000,'d',NULL,NULL,0),(681,316,'2021-06-15','BQ','623800',NULL,120.000,'d',NULL,NULL,1),(682,316,'2021-06-15','BQ','512003',NULL,120.000,'c',NULL,NULL,1),(683,317,'2021-05-05','BQ','512002',NULL,132.080,'d',NULL,NULL,0),(684,317,'2021-05-05','BQ','701001',NULL,132.080,'c',NULL,NULL,0),(685,318,'2021-06-15','BQ','512002',NULL,14.060,'c',NULL,NULL,0),(686,318,'2021-06-15','BQ','616000',NULL,14.060,'d',NULL,NULL,0),(687,319,'2021-05-15','BQ','512002',NULL,14.060,'c',NULL,NULL,0),(688,319,'2021-05-15','BQ','616000',NULL,14.060,'d',NULL,NULL,0),(689,321,'2021-07-11','HA','607000',NULL,80.480,'d','Course LIDL sem 2','',1),(690,321,'2021-07-11','HA','401004',NULL,80.480,'c','Course LIDL sem 2','',1),(691,322,'2021-07-11','BQ','512004',NULL,80.480,'c','Payer lidl sem 2','VISA',0),(692,322,'2021-07-11','BQ','401004',NULL,80.480,'d','Payer lidl sem 2','VISA',0),(693,323,'2021-05-31','BQ','512002',NULL,45.200,'c',NULL,NULL,0),(694,323,'2021-05-31','BQ','606102',NULL,45.200,'d',NULL,NULL,0),(695,324,'2021-05-31','BQ','512002',NULL,22.490,'c',NULL,NULL,0),(696,324,'2021-05-31','BQ','606102',NULL,22.490,'d',NULL,NULL,0),(697,325,'2021-05-25','HA','606103',NULL,104.010,'d','Achat eloise gemo','',1),(698,325,'2021-05-25','HA','401011',NULL,104.010,'c','Achat eloise gemo','',1),(699,326,'2021-05-25','BQ','512002',NULL,104.010,'c','Payer gemo','Visa',0),(700,326,'2021-05-25','BQ','401011',NULL,104.010,'d','Payer gemo','Visa',0),(701,327,'2021-04-27','BQ','512002',NULL,26.120,'c',NULL,NULL,0),(702,327,'2021-04-27','BQ','606102',NULL,26.120,'d',NULL,NULL,0),(703,328,'2021-07-15','HA','623800',NULL,10.000,'d','Piscine','',1),(704,328,'2021-07-15','HA','401017',NULL,10.000,'c','Piscine','',1),(705,329,'2021-07-16','HA','605000',NULL,24.990,'d','Achat Bibliothèque 60x20x180','',1),(706,329,'2021-07-16','HA','401018',NULL,24.990,'c','Achat Bibliothèque 60x20x180','',1),(707,330,'2021-07-16','HA','605000',NULL,99.950,'d','Bureau Blanc pour Eloise','Ticket de caisse',1),(708,330,'2021-07-16','HA','401018',NULL,99.950,'c','Bureau Blanc pour Eloise','Ticket de caisse',1),(709,331,'2021-07-16','BQ','512004',NULL,24.990,'c','Payer Bibliothèque','VISA',0),(710,331,'2021-07-16','BQ','401018',NULL,24.990,'d','Payer Bibliothèque','VISA',0),(711,332,'2021-07-16','BQ','512004',NULL,99.950,'c','Payer Bureau Eloise','VISA',0),(712,332,'2021-07-16','BQ','401018',NULL,99.950,'d','Payer Bureau Eloise','VISA',0),(713,333,'2021-07-16','HA','606101',NULL,64.000,'d','Carburant Mercedes 1,549x41,32l','Ticket de caisse',1),(714,333,'2021-07-16','HA','401006',NULL,64.000,'c','Carburant Mercedes 1,549x41,32l','Ticket de caisse',1),(715,334,'2021-07-16','BQ','512004',NULL,10.000,'c','Payer piscine','VISA',0),(716,334,'2021-07-16','BQ','401017',NULL,10.000,'d','Payer piscine','VISA',0),(717,335,'2021-07-16','BQ','512004',NULL,64.000,'c','Payer essence','VISA',0),(718,335,'2021-07-16','BQ','401006',NULL,64.000,'d','Payer essence','VISA',0),(878,406,'2021-07-20','BQ','627000',NULL,4.200,'d',NULL,NULL,1),(877,406,'2021-07-20','BQ','512003',NULL,4.200,'c',NULL,NULL,1),(721,337,'2021-07-15','BQ','614000',NULL,180.000,'d',NULL,NULL,1),(722,337,'2021-07-15','BQ','512003',NULL,180.000,'c',NULL,NULL,1),(723,338,'2021-07-15','BQ','630000',NULL,141.000,'d',NULL,NULL,1),(724,338,'2021-07-15','BQ','512003',NULL,141.000,'c',NULL,NULL,1),(725,339,'2021-07-15','BQ','630000',NULL,161.000,'d',NULL,NULL,1),(726,339,'2021-07-15','BQ','512003',NULL,161.000,'c',NULL,NULL,1),(727,340,'2021-07-10','BQ','512003',NULL,881.400,'c',NULL,NULL,1),(728,340,'2021-07-10','BQ','660000',NULL,127.000,'d',NULL,NULL,1),(729,340,'2021-07-10','BQ','164001',NULL,754.400,'d',NULL,NULL,1),(730,341,'2021-07-17','HA','606102',NULL,4.360,'d','Doliprantabs','Tichet de caisse',1),(731,341,'2021-07-17','HA','401014',NULL,4.360,'c','Doliprantabs','Tichet de caisse',1),(732,342,'2021-07-17','BQ','530001',NULL,4.360,'c','Payer Dolipranetab','VISA',0),(733,342,'2021-07-17','BQ','401014',NULL,4.360,'d','Payer Dolipranetab','VISA',0),(734,343,'2021-07-17','BQ','530001',NULL,2.300,'c',NULL,NULL,0),(735,343,'2021-07-17','BQ','606102',NULL,2.300,'d',NULL,NULL,0),(736,344,'2021-07-15','HA','607000',NULL,31.340,'d','course Eloise pour enfants','',1),(737,344,'2021-07-15','HA','401005',NULL,31.340,'c','course Eloise pour enfants','',1),(738,345,'2021-07-17','BQ','512002',NULL,31.340,'c','Payer courses auchan enfants','CB',0),(739,345,'2021-07-17','BQ','401005',NULL,31.340,'d','Payer courses auchan enfants','CB',0),(740,346,'2021-07-03','HA','607000',NULL,7.870,'d','Course préparation anniversaire','Ticket de caisse',1),(741,346,'2021-07-03','HA','401005',NULL,7.870,'c','Course préparation anniversaire','Ticket de caisse',1),(742,347,'2021-07-03','BQ','530001',NULL,7.870,'c','Payer auchan casch','CASH',0),(743,347,'2021-07-03','BQ','401005',NULL,7.870,'d','Payer auchan casch','CASH',0),(744,348,'2021-07-17','BQ','512002',NULL,184.340,'c',NULL,NULL,0),(745,348,'2021-07-17','BQ','611000',NULL,184.340,'d',NULL,NULL,0),(746,349,'2021-07-17','BQ','512002',NULL,56.000,'c',NULL,NULL,0),(747,349,'2021-07-17','BQ','611000',NULL,56.000,'d',NULL,NULL,0),(748,350,'2021-07-17','BQ','512002',NULL,875.690,'c',NULL,NULL,0),(749,350,'2021-07-17','BQ','660000',NULL,33.290,'d',NULL,NULL,0),(750,350,'2021-07-17','BQ','622200',NULL,500.000,'d',NULL,NULL,0),(751,350,'2021-07-17','BQ','164002',NULL,342.400,'d',NULL,NULL,0),(752,351,'2021-07-15','BQ','512001',NULL,2000.000,'c',NULL,NULL,0),(753,351,'2021-07-15','BQ','512002',NULL,2000.000,'d',NULL,NULL,0),(754,352,'2021-01-10','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(755,352,'2021-01-10','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(756,353,'2021-02-10','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(757,353,'2021-02-10','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(758,354,'2021-03-10','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(759,354,'2021-03-10','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(760,355,'2021-07-17','BQ','512002',NULL,669.920,'c',NULL,NULL,0),(761,355,'2021-07-17','BQ','164003',NULL,669.920,'d',NULL,NULL,0),(762,356,'2021-07-06','BQ','530001',NULL,3.000,'c',NULL,NULL,0),(763,356,'2021-07-06','BQ','606103',NULL,3.000,'d',NULL,NULL,0),(764,357,'2021-07-18','BQ','530001',NULL,5.800,'c',NULL,NULL,0),(765,357,'2021-07-18','BQ','607000',NULL,5.800,'d',NULL,NULL,0),(766,358,'2021-07-19','BQ','512003',NULL,520.000,'c',NULL,NULL,0),(767,358,'2021-07-19','BQ','622300',NULL,515.000,'d',NULL,NULL,0),(768,358,'2021-07-19','BQ','530001',NULL,5.000,'d',NULL,NULL,0),(769,359,'2021-07-21','HA','602000',NULL,37.980,'d','Frais de mise en service.','26196439S',1),(770,359,'2021-07-21','HA','401019',NULL,37.980,'c','Frais de mise en service.','26196439S',1),(771,360,'2021-07-21','BQ','512004',NULL,37.980,'c','Payer Facture ES','VISA',0),(772,360,'2021-07-21','BQ','401019',NULL,37.980,'d','Payer Facture ES','VISA',0),(773,361,'2021-07-11','BQ','512004',NULL,10.000,'c',NULL,NULL,0),(774,361,'2021-07-11','BQ','606101',NULL,10.000,'d',NULL,NULL,0),(775,362,'2021-07-22','HA','606101',NULL,40.100,'d','Essence auchan pour suisse 1,56x','',1),(776,362,'2021-07-22','HA','401006',NULL,40.100,'c','Essence auchan pour suisse 1,56x','',1),(777,363,'2021-07-23','HA','622300',NULL,281.030,'d','Hôtel malter deux nuit','',1),(778,363,'2021-07-23','HA','401029',NULL,281.030,'c','Hôtel malter deux nuit','',1),(779,364,'2021-07-22','HA','606103',NULL,110.800,'d','Diner Hôtel Malters','Vacances',1),(780,364,'2021-07-22','HA','401029',NULL,110.800,'c','Diner Hôtel Malters','Vacances',1),(781,365,'2021-07-23','HA','606103',NULL,8.830,'d','Suisse Ice cream 6.83 euros','Vacances',1),(782,365,'2021-07-23','HA','401029',NULL,8.830,'c','Suisse Ice cream 6.83 euros','Vacances',1),(783,366,'2021-07-23','HA','606103',NULL,145.710,'d','Suisse Remonte pente','VACANCES',1),(784,366,'2021-07-23','HA','401029',NULL,145.710,'c','Suisse Remonte pente','VACANCES',1),(785,367,'2021-07-22','HA','606103',NULL,16.910,'d','Suisse Train j1','VACANCES',1),(786,367,'2021-07-22','HA','401029',NULL,16.910,'c','Suisse Train j1','VACANCES',1),(787,368,'2021-07-23','HA','606103',NULL,16.420,'d','Suisse train j2','VACANCES',1),(788,368,'2021-07-23','HA','401029',NULL,16.420,'c','Suisse train j2','VACANCES',1),(789,369,'2021-07-21','HA','606103',NULL,40.000,'d','Vignette Suisse 2021','VACANCES',1),(790,369,'2021-07-21','HA','401029',NULL,40.000,'c','Vignette Suisse 2021','VACANCES',1),(791,370,'2021-07-21','BQ','512004',NULL,40.000,'c','Payer vignette suisse','VISA',0),(792,370,'2021-07-21','BQ','401029',NULL,40.000,'d','Payer vignette suisse','VISA',0),(793,371,'2021-07-23','BQ','512004',NULL,16.420,'c','Payer train j2','VISA',0),(794,371,'2021-07-23','BQ','401029',NULL,16.420,'d','Payer train j2','VISA',0),(795,372,'2021-07-22','BQ','512004',NULL,16.910,'c','Payer train j1','VISA',0),(796,372,'2021-07-22','BQ','401029',NULL,16.910,'d','Payer train j1','VISA',0),(797,373,'2021-07-23','BQ','512004',NULL,145.710,'c','Payer remonte pente','VISA',0),(798,373,'2021-07-23','BQ','401029',NULL,145.710,'d','Payer remonte pente','VISA',0),(799,374,'2021-07-23','BQ','512004',NULL,8.830,'c','Payer Glasse Suisse','VISA',0),(800,374,'2021-07-23','BQ','401029',NULL,8.830,'d','Payer Glasse Suisse','VISA',0),(801,375,'2021-07-23','BQ','512004',NULL,110.800,'c','Payer Diner Suisse 109.20','VISA',0),(802,375,'2021-07-23','BQ','401029',NULL,110.800,'d','Payer Diner Suisse 109.20','VISA',0),(803,376,'2021-07-16','BQ','512004',NULL,40.100,'c','Payer essence','VISA',0),(804,376,'2021-07-16','BQ','401006',NULL,40.100,'d','Payer essence','VISA',0),(805,377,'2021-07-21','HA','607000',NULL,25.870,'d','Courses Auchan','',1),(806,377,'2021-07-21','HA','401005',NULL,25.870,'c','Courses Auchan','',1),(807,378,'2021-07-21','BQ','512004',NULL,25.870,'c','Payer courses auchan','VISA',0),(808,378,'2021-07-21','BQ','401005',NULL,25.870,'d','Payer courses auchan','VISA',0),(809,379,'2021-07-24','HA','627000',NULL,1.110,'d','Commission bancaire','',1),(810,379,'2021-07-24','HA','401029',NULL,1.110,'c','Commission bancaire','',1),(811,380,'2021-07-24','HA','606103',NULL,48.050,'d','Suisse COOP chocolat souvenir','VACANCES',1),(812,380,'2021-07-24','HA','401029',NULL,48.050,'c','Suisse COOP chocolat souvenir','VACANCES',1),(813,381,'2021-07-22','HA','606103',NULL,136.030,'d','Suisse souvenir','VACANCES',1),(814,381,'2021-07-22','HA','401029',NULL,136.030,'c','Suisse souvenir','VACANCES',1),(815,382,'2021-07-22','HA','607000',NULL,62.470,'d','Suisse Diner','VACANCES',1),(816,382,'2021-07-22','HA','401029',NULL,62.470,'c','Suisse Diner','VACANCES',1),(817,383,'2021-07-24','BQ','512002',NULL,281.030,'c','Payer Hotel Kreutz suisse','VISA',0),(818,383,'2021-07-24','BQ','401029',NULL,281.030,'d','Payer Hotel Kreutz suisse','VISA',0),(819,384,'2021-07-24','BQ','512002',NULL,1.110,'c','Payer Commission','PRELEVEMENT',0),(820,384,'2021-07-24','BQ','401029',NULL,1.110,'d','Payer Commission','PRELEVEMENT',0),(821,385,'2021-07-24','BQ','512002',NULL,48.050,'c','Payer COOP suissse','VISA',0),(822,385,'2021-07-24','BQ','401029',NULL,48.050,'d','Payer COOP suissse','VISA',0),(823,386,'2021-07-22','BQ','512002',NULL,136.030,'c','Payer souvenir','VISA',0),(824,386,'2021-07-22','BQ','401029',NULL,136.030,'d','Payer souvenir','VISA',0),(825,387,'2021-07-22','BQ','512002',NULL,62.470,'c','Payer Diner','VISA',0),(826,387,'2021-07-22','BQ','401029',NULL,62.470,'d','Payer Diner','VISA',0),(827,388,'2021-06-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(828,388,'2021-06-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(829,388,'2021-06-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(830,388,'2021-06-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(831,389,'2021-06-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(832,389,'2021-06-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(833,389,'2021-06-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(834,389,'2021-06-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(835,390,'2021-07-20','BQ','512002',NULL,41.100,'c',NULL,NULL,1),(836,390,'2021-07-20','BQ','627000',NULL,41.100,'d',NULL,NULL,1),(837,391,'2021-07-20','HA','401012',NULL,5.000,'c',NULL,NULL,1),(838,391,'2021-07-20','HA','626000',NULL,5.000,'d',NULL,NULL,1),(839,391,'2021-07-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(840,391,'2021-07-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(864,399,'2021-07-31','HA','401004',NULL,135.540,'c','Courses sem 4','Ticket de caisse',1),(863,399,'2021-07-31','HA','607000',NULL,135.540,'d','Courses sem 4','Ticket de caisse',1),(845,393,'2021-08-20','BQ','401012',NULL,5.000,'c',NULL,NULL,1),(846,393,'2021-08-20','BQ','626000',NULL,5.000,'d',NULL,NULL,1),(847,393,'2021-08-20','BQ','401012',NULL,5.000,'d',NULL,NULL,1),(848,393,'2021-08-20','BQ','512002',NULL,5.000,'c',NULL,NULL,1),(849,394,'2021-07-20','HA','401012',NULL,2.000,'c',NULL,NULL,1),(850,394,'2021-07-20','HA','626000',NULL,2.000,'d',NULL,NULL,1),(851,394,'2021-07-20','BQ','401012',NULL,2.000,'d',NULL,NULL,1),(852,394,'2021-07-20','BQ','512002',NULL,2.000,'c',NULL,NULL,1),(853,395,'2021-08-20','BQ','401012',NULL,2.000,'c',NULL,NULL,1),(854,395,'2021-08-20','BQ','626000',NULL,2.000,'d',NULL,NULL,1),(855,395,'2021-08-20','BQ','401012',NULL,2.000,'d',NULL,NULL,1),(856,395,'2021-08-20','BQ','512002',NULL,2.000,'c',NULL,NULL,1),(857,396,'2021-07-17','BQ','512002',NULL,14.060,'c',NULL,NULL,1),(858,396,'2021-07-17','BQ','616000',NULL,14.060,'d',NULL,NULL,1),(859,397,'2021-07-10','HA','461000',NULL,249.000,'c',NULL,NULL,0),(860,397,'2021-07-10','HA','622200',NULL,249.000,'d',NULL,NULL,0),(861,398,'2021-07-26','BQ','461000',NULL,249.000,'d',NULL,NULL,0),(862,398,'2021-07-26','BQ','512002',NULL,249.000,'c',NULL,NULL,0),(865,400,'2021-07-31','HA','605000',NULL,111.920,'d','Chaise et bibliotheque','Ticket de caisse',1),(866,400,'2021-07-31','HA','401018',NULL,111.920,'c','Chaise et bibliotheque','Ticket de caisse',1),(867,401,'2021-07-31','HA','401018',NULL,5.980,'d',NULL,NULL,0),(868,401,'2021-07-31','HA','605000',NULL,5.980,'c',NULL,NULL,0),(869,402,'2021-07-29','BQ','512004',NULL,111.920,'c','Payer bibliotheque','Visa',0),(870,402,'2021-07-29','BQ','401018',NULL,111.920,'d','Payer bibliotheque','Visa',0),(871,403,'2021-07-29','VT','410001',NULL,2904.020,'d',NULL,NULL,0),(872,403,'2021-07-29','VT','701000',NULL,2904.020,'c',NULL,NULL,0),(873,404,'2021-07-29','BQ','512003',NULL,2904.020,'d',NULL,NULL,0),(874,404,'2021-07-29','BQ','410001',NULL,2904.020,'c',NULL,NULL,0),(875,405,'2021-07-29','BQ','512004',NULL,1264.030,'d',NULL,NULL,0),(876,405,'2021-07-29','BQ','512003',NULL,1264.030,'c',NULL,NULL,0),(879,407,'2021-07-20','BQ','512003',NULL,11.900,'c',NULL,NULL,1),(880,407,'2021-07-20','BQ','627000',NULL,11.900,'d',NULL,NULL,1),(881,408,'2021-07-29','FR','512003',NULL,0.320,'d',NULL,NULL,0),(882,408,'2021-07-29','FR','627000',NULL,0.320,'c',NULL,NULL,0),(883,409,'2021-09-29','BQ','401018',NULL,5.980,'c',NULL,NULL,0),(884,409,'2021-09-29','BQ','512004',NULL,5.980,'d',NULL,NULL,0);
+/*!40000 ALTER TABLE `TransactionEntry` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `TransactionEntryType`
+--
+
+DROP TABLE IF EXISTS `TransactionEntryType`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `TransactionEntryType` (
+  `type_id` int(11) NOT NULL AUTO_INCREMENT,
+  `type_code` varchar(2) DEFAULT NULL,
+  `type_desc` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`type_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `TransactionEntryType`
+--
+
+LOCK TABLES `TransactionEntryType` WRITE;
+/*!40000 ALTER TABLE `TransactionEntryType` DISABLE KEYS */;
+INSERT INTO `TransactionEntryType` VALUES (1,'BQ','Banque'),(2,'VT','Ventes'),(3,'HA','Achats et frais'),(4,'OD','Operation divers'),(5,'AF','Appels de fonds'),(6,'RF','Remboursement appels de fonds'),(7,'AN','Report a nouveau'),(8,'CL','Cloture'),(9,'FR','Frais Bancaires');
+/*!40000 ALTER TABLE `TransactionEntryType` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `Transactions`
+--
+
+DROP TABLE IF EXISTS `Transactions`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Transactions` (
+  `trans_id` int(11) NOT NULL AUTO_INCREMENT,
+  `voucher_ref` varchar(255) DEFAULT NULL,
+  `voucher_date` date DEFAULT NULL,
+  `act_trans_date` date DEFAULT NULL,
+  `trans_label` varchar(255) DEFAULT NULL,
+  `trans_file` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`trans_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=410 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `Transactions`
+--
+
+LOCK TABLES `Transactions` WRITE;
+/*!40000 ALTER TABLE `Transactions` DISABLE KEYS */;
+INSERT INTO `Transactions` VALUES (1,'VIREMENT ','2019-06-04','2019-06-04','versement test',NULL),(2,'gdrcgh','2019-06-04','2019-06-01','facture es juin',NULL),(6,'','2019-06-08','2019-06-08','Repartion Charges compte 601000 Cle: 5',NULL),(4,'','2019-06-08','2019-06-08','Test Charge Intermédiaire',NULL),(5,'','2019-06-08','2019-06-10','Facture EAU',NULL),(7,'','2019-06-08','2019-06-08','Repartion Charges compte 602000 Cle: 1',NULL),(8,'REFAK10_01','2019-06-08','2019-06-09','Last EDF to check',NULL),(9,'','2019-06-08','2019-06-08','Répartion 34.50€  du compte 602000 Clé 1',NULL),(10,'VIREMENT','2019-06-10','2019-06-10','Virement Mai 2019',NULL),(11,'VIREMENT','2019-06-10','2019-06-10','Virement Mai 2019',NULL),(12,'CHEQUE N°xxx','2019-05-10','2019-06-10','Payer facture',NULL),(13,'CHEQUE N°563422','2019-05-17','2019-06-10','payer es',NULL),(14,'','2021-01-02','2021-01-02','Courses pour la semaine',NULL),(15,'','2021-01-09','2021-01-09','Course',NULL),(16,'','2021-01-14','2021-01-14','courses',NULL),(17,'','2021-01-16','2021-01-16','Luges enfants',NULL),(18,'','2021-01-05','2021-01-05','Es jan 2021',NULL),(19,'','2021-01-07','2021-01-07','Internet  janv 2021',NULL),(20,'','2021-01-08','2021-01-08','Domain DNS',NULL),(21,'','2021-01-10','2021-01-10','Essence mercedes',NULL),(22,'','2021-01-16','2021-01-16','Assurance Habitation 1 semestre 2021',NULL),(23,'','2021-01-21','2021-01-20','Course janv 3iem semaine',NULL),(24,'','2021-01-21','2021-01-16','Masques covid',NULL),(25,NULL,'2021-01-02','2021-01-02','Initial Values',NULL),(26,NULL,'2021-01-11','2021-01-29','Assurance moyen de paiement',NULL),(27,NULL,'2021-01-26','2021-01-29','COTISATION MENSUELLE CARTE  2485',NULL),(28,NULL,'2021-01-10','2021-01-29','Remboursement pret',NULL),(29,'VISA','2021-01-10','2021-01-29','Payer ES via Internet',NULL),(30,'VISA','2021-01-16','2021-01-17','Payer luges',NULL),(31,'VISA LCL','2021-01-10','2021-01-29','Payer essence M',NULL),(37,NULL,'2021-01-10','2021-01-29','Impot Taxe habitation',NULL),(33,'VISA LCL','2021-01-07','2021-01-29','Payer Numericable Internet',NULL),(34,'VISA LCL','2021-01-21','2021-01-29','Payer masques',NULL),(35,'VISA LCL ','2021-01-21','2021-01-29','Payer LIDL 3 premières semaines',NULL),(36,'VISA LCL','2021-01-07','2021-01-29','Payer domain internet',NULL),(38,NULL,'2021-01-10','2021-01-29','Taxe foncière',NULL),(39,NULL,'2021-01-02','2021-01-29','Travail de Janvier',NULL),(40,NULL,'2021-01-28','2021-01-29','Paye de Janvier',NULL),(41,NULL,'2021-01-10','2021-01-29','Assurance Pret',NULL),(42,'Ticket de caisse','2021-01-30','2021-01-30','LIDL COURSE 1 sem fev',NULL),(43,NULL,'2021-02-01','2021-02-01','Prime interessement',NULL),(44,'CCP N°1','2021-01-02','2021-01-05','Abonnement Free',NULL),(45,NULL,'2021-01-20','2021-01-20','Remise Banque',NULL),(46,NULL,'2021-01-30','2021-01-30','Solde Visa Janvier 2021',NULL),(47,'VISA ','2021-01-30','2021-02-02','Payer LIDL 1 semaine fév 2021',NULL),(48,'PRELEVEMENT','2021-01-05','2021-01-10','Payer free mobile',NULL),(49,NULL,'2021-01-12','2021-01-12','Banque Postale Cotisation VISA',NULL),(50,NULL,'2021-01-10','2021-01-10','Banque Postale Cotisation Trimest',NULL),(51,NULL,'2021-01-20','2021-01-20','Avance Impot Centre des finances',NULL),(52,'','2021-02-06','2021-02-02','Facture numericable fev 2021',NULL),(53,'','2021-02-06','2021-02-02','Facture mobile fev 2021',NULL),(54,'Visa','2021-02-02','2021-02-06','Payer groupama',NULL),(55,'Carte Visa','2021-02-06','2021-02-06','Achat masque',NULL),(56,'','2021-02-06','2021-02-06','Course LIDL pour seconde semaine fév',NULL),(57,NULL,'2021-02-06','2021-02-09','Assurance pret fév',NULL),(58,'VISA','2021-02-08','2021-02-09','Payer LIDL',NULL),(59,'VISA','2021-02-09','2021-02-09','Paye masques ',NULL),(60,'VISA','2021-02-09','2021-02-09','payer internet',NULL),(61,NULL,'2021-02-11','2021-02-11','Remboursement pret',NULL),(62,'','2021-02-11','2021-02-10','Sac cadeau eloise',NULL),(64,'VISA','2021-02-10','2021-02-11','Payer sac saint valentin',NULL),(65,'Ticket de caissd','2021-02-13','2021-02-13','Lidl fev 2 sem',NULL),(66,'VISA','2021-02-13','2021-02-13','Payer LIDL',NULL),(67,NULL,'2021-02-10','2021-02-13','CCP N°2',NULL),(68,NULL,'2021-02-13','2021-02-13','Charges copro janv fév',NULL),(69,NULL,'2021-02-16','2021-02-16','Taxe habitation',NULL),(70,NULL,'2021-02-16','2021-02-16','Taxe foncière',NULL),(71,NULL,'2021-02-16','2021-02-17','Achat Carburant ESSO',NULL),(72,NULL,'2021-01-28','2021-01-28','Achat Auchan supermarche',NULL),(73,'Ticket de caisse','2021-02-20','2021-02-20','Course LIDL 3 sem',NULL),(74,'Visa','2021-02-20','2021-02-20','Payer lidl 3sem fév',NULL),(75,'21170826S','2021-02-22','2021-02-12','ES Février 2021',NULL),(76,'21170826S','2021-02-22','2021-02-12','ES Février 2021',NULL),(77,'61195','2021-02-26','2021-02-26','Materiel pour mur salon',NULL),(78,'132674','2021-02-26','2021-02-26','Outils pour fixation placo',NULL),(79,NULL,'2021-02-26','2021-02-26','Paye fév 2021',NULL),(80,NULL,'2021-02-26','2021-02-26','Service Siemens fév',NULL),(81,NULL,'2021-02-27','2021-02-27','Solde visa février',NULL),(82,'PRELEVEMENT  CCP N°2','2021-02-20','2021-02-27','Payer Free fév',NULL),(83,NULL,'2021-02-23','2021-02-23','COTISATION MENSUELLE CARTE 2485',NULL),(84,'Ticket de caisse','2021-02-27','2021-02-27','LIDL 27 fév',NULL),(85,'Ticket de caisse','2021-02-27','2021-02-27','Essence plein mercedes',NULL),(86,'VISA','2021-02-26','2021-02-27','Payer BigMat cloison',NULL),(87,'VISA','2021-02-26','2021-02-27','Payer petit matériel Bigmat',NULL),(88,'VISA','2021-02-27','2021-02-27','Payer courses 1 semaine mars',NULL),(89,'VISA','2021-02-27','2021-02-27','Payer ES fév',NULL),(90,'VISA','2021-02-27','2021-02-27','Payer essence',NULL),(91,'','2021-03-05','2021-03-05','Internet mars 2021',NULL),(92,'','2021-03-05','2021-03-05','Commmande carte SIM Red SFR',NULL),(93,NULL,'2021-03-05','2021-03-05','VIREMENT don épis',NULL),(94,NULL,'2021-03-05','2021-03-05','VIREMENT Charges mars 2021',NULL),(95,'VIREMENT INTERNE','2021-02-25','2021-02-25','Remise Banque février',NULL),(96,'VISA','2021-03-03','2021-03-05','Payer carte SIM',NULL),(97,'Ticket de caisse','2021-03-06','2021-03-06','LIDL course mars 1 semaine',NULL),(98,'VISA','2021-03-06','2021-03-06','Payer courses 1er semaine mars',NULL),(99,NULL,'2021-03-06','2021-03-06','6 Jetons pour laver voiture ',NULL),(100,NULL,'2021-02-17','2021-02-17','UFCV perisco janv',NULL),(101,NULL,'2021-03-06','2021-03-06','UFCV perisco fév',NULL),(102,'VISA','2021-02-06','2021-03-06','Payer Internet mars',NULL),(103,NULL,'2021-03-06','2021-03-06','Filter habitacle voiture peugeot',NULL),(104,NULL,'2021-03-10','2021-03-11','Brico depo pour mûr',NULL),(105,NULL,'2021-03-11','2021-03-11','Assurance prêt mars',NULL),(106,NULL,'2021-03-11','2021-03-11','remboursement pret mars',NULL),(107,'Ticket de caisse','2021-03-13','2021-03-13','Achat lidl 2 SEM mars',NULL),(108,'Visa','2021-03-13','2021-03-13','Payer lidl',NULL),(109,NULL,'2021-03-17','2021-03-19','Achat décot MURS papier peint',NULL),(110,NULL,'2021-03-16','2021-03-19','Taxe habitation',NULL),(111,NULL,'2021-03-16','2021-03-19','taxe foncière',NULL),(112,NULL,'2021-03-10','2021-03-19','assurance moyen de payement',NULL),(113,'Ticket de caisse','2021-03-27','2021-03-19','LIDL ',NULL),(114,'Ticket de caisse','2021-03-27','2021-03-20','Achat course mars semaine 3',NULL),(115,'Ticket de caisse','2021-03-27','2021-03-24','Brico depo',NULL),(116,'VISA','2021-03-19','2021-03-27','Payer lidl ',NULL),(117,'VISA','2021-03-20','2021-03-27','Payer lidl mars 3ieme sem',NULL),(118,'VISA','2021-03-24','2021-03-27','Payer brico petite fourniture',NULL),(119,'','2021-03-10','2021-03-10','DD reste et cheque cadeau',NULL),(120,'VISA prélèvement','2021-03-10','2021-03-27','Payer reste DD 2T 2 fois',NULL),(121,NULL,'2021-03-26','2021-03-27','Cotisation mensuelle carte',NULL),(123,'','2021-03-27','2021-03-27','Peinture mûr',NULL),(124,'Ticket de caisse','2021-03-29','2021-03-29','Achat vitre cave',NULL),(125,'VISA','2021-03-27','2021-03-27','Payer leroy',NULL),(126,'VISA','2021-03-29','2021-03-29','Payer vitre leroy',NULL),(135,'Payer en visa','2021-04-03','2021-04-02','Le clerc diesel 308',NULL),(128,'ticket de caisse','2021-03-30','2021-03-27','LIDL 4 sem mars',NULL),(129,'VISA','2021-03-27','2021-03-30','Payer LIDL sem 4 mars',NULL),(130,NULL,'2021-03-30','2021-03-30','Remise Banque mars',NULL),(131,NULL,'2021-03-30','2021-03-30','Salaire mars',NULL),(132,NULL,'2021-03-30','2021-03-30','Virement siemens sal mars',NULL),(133,NULL,'2021-03-30','2021-03-30','solde visa mars',NULL),(134,'','2021-03-20','2021-03-20','Facture free mars',NULL),(136,'','2021-04-03','2021-04-01','Achat Ali pour cnc et multi orise',NULL),(137,'VISA','2021-04-05','2021-04-03','Payer Ali express cnc',NULL),(138,'ticket de caisse.','2021-04-03','2021-04-03','Lidl avril 1 sem',NULL),(139,'Ticket de caisse','2021-04-04','2021-04-03','Achat plinthes leroy',NULL),(140,'','2021-04-10','2021-05-07','Boygue télé frais de mise en service fibre',NULL),(141,'','2021-04-10','2021-04-09','Frais de douane fedex',NULL),(142,'VISA','2021-04-01','2021-04-10','Payer lidl',NULL),(143,'','2021-04-10','2021-04-10','Lidl 10avril',NULL),(144,'Visa','2021-04-05','2021-04-10','Payer essence',NULL),(145,'Visa','2021-04-04','2021-04-10','Payer leroy',NULL),(146,'','2021-04-10','2021-04-06','Facture avril',NULL),(147,'Visa','2021-04-06','2021-04-10','Payer numericable avril',NULL),(148,'Visa','2021-04-09','2021-04-10','Payer mise en service boygue',NULL),(149,NULL,'2021-04-10','2021-04-10','Don Epis avril',NULL),(150,NULL,'2021-04-10','2021-04-10','Assurance oret',NULL),(151,NULL,'2021-04-10','2021-04-10','Virement charges avril',NULL),(152,'','2021-04-17','2021-04-16','Câble eth prises',NULL),(153,'Visa','2021-04-10','2021-04-17','Payer lidl',NULL),(154,'','2021-04-17','2021-04-12','Achat leroy',NULL),(155,'Visa','2021-04-14','2021-04-17','payer leroy ',NULL),(156,'Visa','2021-04-14','2021-04-17','Payer taxe fedex',NULL),(157,'25564790S','2021-04-20','2021-04-12','Facture ES Avril',NULL),(158,NULL,'2021-04-10','2021-04-23','Remboursement pret avril',NULL),(159,NULL,'2021-04-20','2021-04-23','Taxe habitation avril',NULL),(160,NULL,'2021-04-20','2021-04-23','Taxe foncière avril',NULL),(161,'Ticket de caisse.','2021-04-23','2021-04-17','Achat Lidl avril',NULL),(163,'Ticket de caisse.','2021-04-23','2021-04-17','Achat Lidl avril 3S',NULL),(164,'VISA','2021-04-17','2021-04-23','Payer auchan',NULL),(165,'VISA','2021-04-17','2021-04-23','Payer LIDL 3S',NULL),(167,'VISA','2021-04-17','2021-04-23','Payer LIDL ',NULL),(168,NULL,'2021-04-12','2021-04-23','Frais bancaires avril',NULL),(169,'VISA','2021-04-12','2021-04-23','Payer ES avril',NULL),(170,'En ligne','2021-04-27','2021-04-20','Bouygues avril mai',NULL),(171,'VISA','2021-04-20','2021-04-27','Payer bouygues',NULL),(172,'Neant','2021-04-27','2021-04-21','Achat ali',NULL),(173,'Ticket de caisse','2021-04-27','2021-04-24','Lidl achat',NULL),(174,'VISA','2021-04-24','2021-04-27','Payer course lidl',NULL),(175,'PayPal visa','2021-04-24','2021-04-27','Payer Ali express',NULL),(176,'Compte lbp','2021-04-27','2021-04-20','Téléphone free avril',NULL),(177,NULL,'2021-04-27','2021-04-27','LCL cotisation mensuelle carte ',NULL),(178,NULL,'2021-04-29','2021-04-29','Virement SIEMENS avril',NULL),(179,NULL,'2021-04-29','2021-04-29','LCL remise Carte avril',NULL),(180,NULL,'2021-04-30','2021-04-30','Solde LCL Visa avril',NULL),(181,NULL,'2021-04-06','2021-04-06','LPB cotisation trimestriel',NULL),(182,'PRELEVEMENT CCP','2021-03-22','2021-03-22','Payer FREE mobile mars',NULL),(183,'PRELEVEMENT CCP','2021-04-21','2021-04-21','Payer free mobile avril',NULL),(184,NULL,'2021-04-29','2021-04-29','Service SIEMENS avril',NULL),(185,NULL,'2021-02-22','2021-02-22','SIEMENS PRIME PEE',NULL),(186,NULL,'2021-05-02','2021-05-02','Don épis Eloise mai',NULL),(187,'','2021-05-03','2021-05-03','Lidl mai 1 week',NULL),(188,'VISA','2021-05-03','2021-05-03','Payer Lidl',NULL),(189,'','2021-05-08','2021-05-08','Cora essence mercedes',NULL),(190,NULL,'2021-05-06','2021-05-06','Assurance prêt mai',NULL),(191,NULL,'2021-05-10','2021-05-10','Charges mai',NULL),(192,NULL,'2021-05-10','2021-05-10','Don épis mai',NULL),(193,'Ticket de caisse','2021-05-13','2021-05-12','Cadeau anniversaire Kevin',NULL),(194,'VISA','2021-05-12','2021-05-13','Payer auchan anniv kevin',NULL),(195,NULL,'2021-05-10','2021-05-10','Remboursement pret N°1',NULL),(196,'VISA','2021-05-10','2021-05-13','Payer Essence mercedes cora',NULL),(197,'Ticket de caisse','2021-05-13','2021-05-08','Achat LIDL mai semaine 2',NULL),(198,'VISA','2021-05-13','2021-05-13','Payer LIDL semaine 2 main',NULL),(199,NULL,'2021-05-13','2021-05-13','Frais Assurance carte mai',NULL),(200,NULL,'2021-01-29','2021-01-29','UFCV  prériscolaire janvier',NULL),(201,NULL,'2021-04-13','2021-04-13','UFCV  prériscolaire avril',NULL),(202,NULL,'2021-05-09','2021-05-09','UFCV  prériscolaire mai',NULL),(203,'Ticket de caisse','2021-05-16','2021-05-15','LDIL course ',NULL),(204,'Ticket de caisse','2021-05-19','2021-05-19','Gazole 308',NULL),(205,'','2021-05-21','2021-05-21','Facture Bouygues mai',NULL),(206,'','2021-05-21','2021-05-21','Facture Bouygues mai',NULL),(207,'Ticket de caisse','2021-05-22','2021-05-22','Lidl mai sem 3',NULL),(208,'','2021-05-28','2021-05-28','course fête des mere',NULL),(209,'','2021-05-28','2021-05-28','Maranaud gift eloise fête des meres',NULL),(210,'VISA','2021-05-15','2021-05-29','courses LIDL semaine 2',NULL),(211,'VISA','2021-05-22','2021-05-29','Payer LIDL semaine 3',NULL),(212,'VISA','2021-05-22','2021-05-29','Payer Bouygues',NULL),(213,'VISA','2021-05-22','2021-05-29','Payer plein peugeot',NULL),(214,NULL,'2021-05-15','2021-05-15','Payement Impot Taxe Habitation',NULL),(215,NULL,'2021-05-15','2021-05-15','Payement Impot Taxe Foncière',NULL),(216,NULL,'2021-03-20','2021-03-20','Payement SFR Mobile Eloise',NULL),(217,NULL,'2021-04-20','2021-04-20','Payement SFR Mobile Eloise',NULL),(218,NULL,'2021-05-20','2021-05-20','Payement SFR Mobile Eloise',NULL),(219,NULL,'2021-03-20','2021-03-20','Payement SFR Mobile Andre',NULL),(220,NULL,'2021-04-20','2021-04-20','Payement SFR Mobile Andre',NULL),(221,NULL,'2021-05-20','2021-05-20','Payement SFR Mobile Andre',NULL),(222,NULL,'2021-05-28','2021-05-29','Service SIEMENS Mai',NULL),(223,NULL,'2021-05-29','2021-05-29','Virement SIEMENS mai',NULL),(224,'Ticket de caisse','2021-05-29','2021-05-29','Lidl semaine 4 mai',NULL),(225,'Ticket de caisse','2021-05-01','2021-05-29','Au cheval noir hoenheim',NULL),(226,NULL,'2021-05-31','2021-05-31','Solde visa mai',NULL),(227,NULL,'2021-05-26','2021-05-26','Frais carte visa LCL',NULL),(228,NULL,'2021-05-28','2021-05-28','Remise carte LCL',NULL),(229,'Ticket de caisse','2021-06-05','2021-06-05','Lidl juin sem 1',NULL),(230,'VISQ','2021-05-31','2021-06-05','Payer cheval noir',NULL),(231,'Visa','2021-05-29','2021-06-05','Payer cadeau fête des meres',NULL),(232,'Visa','2021-05-29','2021-06-05','Payer lidl',NULL),(233,'','2021-06-12','2021-06-12','Course sem2',NULL),(234,'','2021-06-12','2021-06-12','Décathlon casque sac vélo',NULL),(235,'CHEQUE N°','2021-06-07','2021-06-13','Payer lidl',NULL),(236,NULL,'2021-06-10','2021-06-10','Remboursement prêt N°1',NULL),(237,NULL,'2021-06-10','2021-06-13','Prime assurance prêt juin',NULL),(238,'VISA','2021-06-12','2021-06-16','Payer DECATHLON',NULL),(239,'VISA','2021-06-12','2021-06-16','Payer LIDL',NULL),(240,'','2021-06-16','2021-06-13','Restaurant KFC',NULL),(242,'VISA','2021-06-13','2021-06-16','Payer KFC',NULL),(243,NULL,'2021-06-15','2021-06-15','Payement Impot Taxe Habitation',NULL),(244,NULL,'2021-06-15','2021-06-15','Payement Impot Taxe Foncière',NULL),(256,NULL,'2021-06-21','2021-06-22','Lettre AR acceptation de prêt',NULL),(246,'n017','2021-06-16','2021-06-10','Assurance Voitures',NULL),(247,NULL,'2021-01-27','2021-01-27','Salaire Eloise janvier',NULL),(248,NULL,'2021-02-24','2021-02-24','Salaire Eloise février',NULL),(249,NULL,'2021-03-29','2021-03-29','Salaire Eloise mars',NULL),(250,NULL,'2021-04-28','2021-04-28','Salaire Eloise avril',NULL),(251,NULL,'2021-05-27','2021-05-27','Salaire Eloise mai',NULL),(252,NULL,'2021-06-08','2021-06-08','Transfert CCP eloise assurance',NULL),(253,NULL,'2021-06-18','2021-06-18','Virement Pour achat appart',NULL),(254,NULL,'2021-06-15','2021-06-15','Payement Charges de copropriétés',NULL),(255,'Payer via visa','2021-06-19','2021-06-19','Achat semaine 3 juin',NULL),(257,NULL,'2021-06-21','2021-06-22','Lettre AR acceptation de prêt',NULL),(258,'','2021-06-23','2021-06-21','Plein 308',NULL),(259,'Visa','2021-06-21','2021-06-23','Payer gazole 308',NULL),(260,'','2021-06-25','2021-06-23','Plein mercedes',NULL),(261,'VISA','2021-06-23','2021-06-25','Payer essence',NULL),(262,'TICKET de caisse','2021-06-26','2021-06-26','Course semaine 4 juin',NULL),(263,'Devis RENOV HABITAT','2021-06-26','2021-06-10','Changement porte d\'entree',NULL),(264,'VIREMENT','2021-06-23','2021-06-26','Acompte RENOV HABITA',NULL),(265,'26023801S','2021-06-26','2021-06-10','Facture ES juin 2021',NULL),(266,'VIISA','2021-06-19','2021-06-26','Payer LIDL',NULL),(267,NULL,'2021-06-20','2021-06-20','Payement LCL Frais bancaire ass moyen de payement',NULL),(268,'CHEQUE N°','2021-06-23','2021-06-26','Payer assurance vioitures 2Sem',NULL),(269,'','2021-07-02','2021-07-01','Resto cheval blanc',NULL),(270,'Virement','2021-06-26','2021-06-30','Payer es',NULL),(271,'VISA','2021-06-26','2021-06-30','Payer lidl',NULL),(272,NULL,'2021-06-30','2021-06-30','Remboursement visa',NULL),(273,NULL,'2021-06-29','2021-06-29','Salaire siemens juin',NULL),(274,NULL,'2021-06-20','2021-06-20','Payement LCL Frais bancaire carte visa',NULL),(275,NULL,'2021-06-29','2021-06-29','Remise carte',NULL),(276,'Ticket de caisse','2021-07-03','2021-07-03','Course 1sem juillet',NULL),(277,'','2021-07-05','2021-06-21','Assurance Appart residence principale',NULL),(278,'VISA','2021-07-05','2021-07-05','Payer resto cheval blanc schiltig',NULL),(279,NULL,'2021-06-30','2021-06-30','pret Bancaire  LBP appzrt',NULL),(280,NULL,'2021-06-28','2021-06-28','Virement notaire',NULL),(281,NULL,'2021-06-30','2021-06-30','Virement prêt apart',NULL),(282,NULL,'2021-07-01','2021-07-01','Achat Appatement',NULL),(283,NULL,'2021-07-01','2021-07-01','Frais achat appartement',NULL),(284,NULL,'2021-06-25','2021-06-25','UFCV periscolaire juin',NULL),(285,NULL,'2021-06-28','2021-06-28','Salaire juin Eloise',NULL),(286,NULL,'2021-07-05','2021-07-05','Versement CAF juillet',NULL),(287,NULL,'2021-06-04','2021-06-04','Versement CAF Juin Eloise',NULL),(288,NULL,'2021-06-28','2021-06-28','Service Siemens juin',NULL),(289,NULL,'2021-07-05','2021-07-05','MNCAP Pret Andre',NULL),(290,NULL,'2021-07-05','2021-07-05','MNCAP pret Eloise juillet',NULL),(291,NULL,'2021-06-20','2021-06-20','Payement Free Mobile Andre',NULL),(292,NULL,'2021-06-20','2021-06-20','Payement Free Mobile Andre',NULL),(293,NULL,'2021-06-20','2021-06-20','Payement Free Mobile Eloise',NULL),(294,NULL,'2021-07-05','2021-07-05','Frais de garanti pret',NULL),(295,NULL,'2021-06-10','2021-06-10','Prêt voiture juin',NULL),(296,NULL,'2021-07-05','2021-07-05','Cadeau anniversaire Andre',NULL),(297,NULL,'2021-06-29','2021-06-29','Frais virement bancaire',NULL),(298,NULL,'2021-06-28','2021-06-28','Course MULLER',NULL),(299,NULL,'2021-06-29','2021-06-29','Course KAUFLAND fleurs',NULL),(300,'Ticket de caisse','2021-07-06','2021-07-06','Achat Leroy Disjonteur',NULL),(301,'','2021-07-07','2021-07-07','Leroy Platine disjoncteur',NULL),(302,'VISA','2021-07-06','2021-07-06','Payer leroy disjoncteur',NULL),(303,'VISA','2021-07-07','2021-07-07','Payer leroy platine disjoncteur',NULL),(304,'VISA','2021-07-06','2021-07-08','Payer assurance',NULL),(305,'VISA','2021-07-05','2021-07-08','Payer LIDL',NULL),(306,'LIDL CGE3946','2021-07-05','2021-07-05','Achat lidl anniversaire',NULL),(307,'LIDL CGE 3946','2021-07-05','2021-07-05','Course LIDL anniversaire',NULL),(308,'VISA','2021-07-05','2021-07-05','Payer LIDL anniversaire 1',NULL),(309,'VISA','2021-07-05','2021-07-05','Payer course lidl anniversaire',NULL),(310,'PRELEVEMENT CCPP','2021-07-05','2021-07-05','Bouygues prelèvement SEPA ',NULL),(311,'PRELEVEMENT','2021-07-05','2021-07-05','Prelevement bouygues juillet',NULL),(312,NULL,'2021-07-05','2021-07-05','Assurance prêt juillet',NULL),(313,NULL,'2021-05-10','2021-05-10','Pret voiture mai',NULL),(314,NULL,'2021-04-12','2021-04-12','Pret voiture avril',NULL),(315,NULL,'2021-07-07','2021-07-07','don épis Eloise juillet',NULL),(316,NULL,'2021-07-09','2021-07-09','Payement Don église Epis',NULL),(317,NULL,'2021-05-05','2021-05-05','CAF Mai',NULL),(318,NULL,'2021-06-15','2021-06-15','GRASS SAVOI ',NULL),(319,NULL,'2021-05-15','2021-05-15','GRASS SAVOI mai',NULL),(320,NULL,'2021-05-15','2021-05-15','GRASS SAVOI mai',NULL),(321,'','2021-07-11','2021-07-10','Course LIDL sem 2',NULL),(322,'VISA','2021-07-10','2021-07-11','Payer lidl sem 2',NULL),(323,NULL,'2021-05-31','2021-05-31','Achat pharma 1',NULL),(324,NULL,'2021-05-31','2021-05-31','Achat pharma 2',NULL),(325,'','2021-05-25','2021-05-25','Achat eloise gemo',NULL),(326,'Visa','2021-05-25','2021-05-25','Payer gemo',NULL),(327,NULL,'2021-04-27','2021-04-27','Achat pharma',NULL),(328,'','2021-07-15','2021-07-14','Piscine',NULL),(329,'','2021-07-16','2021-07-13','Achat Bibliothèque 60x20x180',NULL),(330,'Ticket de caisse','2021-07-16','2021-07-15','Bureau Blanc pour Eloise',NULL),(331,'VISA','2021-07-13','2021-07-16','Payer Bibliothèque',NULL),(332,'VISA','2021-07-15','2021-07-16','Payer Bureau Eloise',NULL),(333,'Ticket de caisse','2021-07-16','2021-07-16','Carburant Mercedes 1,549x41,32l',NULL),(334,'VISA','2021-07-15','2021-07-16','Payer piscine',NULL),(335,'VISA','2021-07-16','2021-07-16','Payer essence',NULL),(336,NULL,'2021-07-15','2021-07-15','Payement Don église Epis',NULL),(337,NULL,'2021-07-15','2021-07-15','Payement Charges de copropriétés',NULL),(338,NULL,'2021-07-15','2021-07-15','Payement Impot Taxe Foncière',NULL),(339,NULL,'2021-07-15','2021-07-15','Payement Impot Taxe Habitation',NULL),(340,NULL,'2021-07-10','2021-07-10','Remboursement prêt N°1',NULL),(341,'Tichet de caisse','2021-07-17','2021-07-17','Doliprantabs',NULL),(342,'VISA','2021-07-17','2021-07-17','Payer Dolipranetab',NULL),(343,NULL,'2021-07-17','2021-07-17','Payer Densiste RiveEtoile',NULL),(344,'','2021-07-15','2021-07-15','course Eloise pour enfants',NULL),(345,'CB','2021-07-17','2021-07-17','Payer courses auchan enfants',NULL),(346,'Ticket de caisse','2021-07-03','2021-07-03','Course préparation anniversaire',NULL),(347,'CASH','2021-07-03','2021-07-03','Payer auchan casch',NULL),(348,NULL,'2021-06-17','2021-06-17','Frais scolaire juin',NULL),(349,NULL,'2021-06-17','2021-06-17','Frais scolaire extra covid',NULL),(350,NULL,'2021-07-15','2021-07-17','Remboursement prêt appart Eloise',NULL),(351,NULL,'2021-07-15','2021-07-15','Virement Pour Eloise',NULL),(352,NULL,'2021-01-10','2021-01-10','Prêt voiture janv',NULL),(353,NULL,'2021-02-10','2021-02-10','Pret voiture fev',NULL),(354,NULL,'2021-03-10','2021-03-10','Pret voiture mars',NULL),(355,NULL,'2021-07-12','2021-07-12','Prêt voiture juillet',NULL),(356,NULL,'2021-07-06','2021-07-06','Achat decathlon Kevin lunette piscine',NULL),(357,NULL,'2021-07-18','2021-07-18','Glace sortie',NULL),(358,NULL,'2021-07-19','2021-07-19','Vacances Christine Kevin',NULL),(359,'26196439S','2021-07-21','2021-07-06','Frais de mise en service.',NULL),(360,'VISA','2021-07-06','2021-07-21','Payer Facture ES',NULL),(361,NULL,'2021-07-11','2021-07-11','Payer Lave voiture',NULL),(362,'','2021-07-22','2021-07-22','Essence auchan pour suisse 1,56x',NULL),(363,'','2021-07-23','2021-07-23','Hôtel Malters deux nuits',NULL),(364,'Vacances','2021-07-22','2021-07-22','Diner Hôtel Malters',NULL),(365,'Vacances','2021-07-23','2021-07-23','Suisse Ice cream 6.83 euros',NULL),(366,'VACANCES','2021-07-23','2021-07-23','Suisse Remonte pente',NULL),(367,'VACANCES','2021-07-22','2021-07-22','Suisse Train j1',NULL),(368,'VACANCES','2021-07-23','2021-07-23','Suisse train j2',NULL),(369,'VACANCES','2021-07-21','2021-07-21','Vignette Suisse 2021',NULL),(370,'VISA','2021-07-21','2021-07-21','Payer vignette suisse',NULL),(371,'VISA','2021-07-23','2021-07-23','Payer train j2',NULL),(372,'VISA','2021-07-22','2021-07-22','Payer train j1',NULL),(373,'VISA','2021-07-23','2021-07-23','Payer remonte pente',NULL),(374,'VISA','2021-07-23','2021-07-23','Payer Glasse Suisse',NULL),(375,'VISA','2021-07-23','2021-07-23','Payer Diner Suisse 109.20',NULL),(376,'VISA','2021-04-16','2021-07-16','Payer essence',NULL),(377,'','2021-07-21','2021-04-21','Courses Auchan',NULL),(378,'VISA','2021-07-21','2021-07-21','Payer courses auchan',NULL),(379,'','2021-07-24','2021-07-24','Commission bancaire',NULL),(380,'VACANCES','2021-07-24','2021-07-24','Suisse COOP chocolat souvenir',NULL),(381,'VACANCES','2021-07-22','2021-07-22','Suisse souvenir',NULL),(382,'VACANCES','2021-07-22','2021-07-22','Suisse Diner',NULL),(383,'VISA','2021-07-24','2021-07-24','Payer Hotel Kreutz suisse',NULL),(384,'PRELEVEMENT','2021-07-24','2021-07-24','Payer Commission',NULL),(385,'VISA','2021-07-24','2021-07-24','Payer COOP suissse',NULL),(386,'VISA','2021-07-22','2021-07-22','Payer souvenir',NULL),(387,'VISA','2021-07-22','2021-07-22','Payer Diner',NULL),(388,NULL,'2021-06-20','2021-06-20','Payement SFR Mobile Eloise',NULL),(389,NULL,'2021-06-20','2021-06-20','Payement SFR Mobile Andre',NULL),(390,NULL,'2021-07-20','2021-07-20','Payement LBP Frais bancaire M et Mme',NULL),(391,NULL,'2021-07-20','2021-07-20','Payement SFR Mobile Andre',NULL),(392,NULL,'2021-07-20','2021-07-20','Payement SFR Mobile Eloise',NULL),(393,NULL,'2021-07-21','2021-07-21','Payement SFR Mobile Eloise',NULL),(394,NULL,'2021-07-20','2021-07-20','Payement Free Mobile Eloise bis',NULL),(395,NULL,'2021-07-21','2021-07-21','Payement Free Mobile Eloise',NULL),(396,NULL,'2021-07-17','2021-07-17','Payement Assurance Gras Savoye',NULL),(397,NULL,'2021-07-10','2021-07-10','Honoraire assurance MNCAP',NULL),(398,NULL,'2021-07-26','2021-07-26','Payer Honoraire assurance MNCAP',NULL),(399,'Ticket de caisse','2021-07-31','2021-07-31','Courses sem 4',NULL),(400,'Ticket de caisse','2021-07-31','2021-07-28','Chaise et bibliotheque',NULL),(401,NULL,'2021-07-29','2021-07-31','Retour marchandise',NULL),(402,'Visa','2021-07-28','2021-07-29','Payer bibliotheque',NULL),(403,NULL,'2021-07-29','2021-07-29','Service juillet siemens',NULL),(404,NULL,'2021-07-29','2021-07-29','Virement siemens juillet',NULL),(405,NULL,'2021-07-29','2021-07-29','Visa débit juillet',NULL),(406,NULL,'2021-07-20','2021-07-20','Payement LCL Frais bancaire ass moyen de payement',NULL),(407,NULL,'2021-07-20','2021-07-20','Payement LCL Frais bancaire carte visa',NULL),(408,NULL,'2021-07-29','2021-07-29','Remise LCL juillet',NULL),(409,NULL,'2021-07-29','2021-09-29','Remboursement retour IKEA',NULL);
+/*!40000 ALTER TABLE `Transactions` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Dumping routines for database 'SYNDIC_26'
+--
+/*!50003 DROP FUNCTION IF EXISTS `annuite_mensuelle` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` FUNCTION `annuite_mensuelle`( _loan_id INTEGER) RETURNS double
+    READS SQL DATA
+BEGIN
+       RETURN (SELECT TRUNCATE(( ln_amount * (ln_rate / 12.0 ) / ( 1.0 - ( 1.0 / POW(1.0 + ln_rate/12.0,ln_duree )) )),2) FROM Loan  WHERE ln_id = _loan_id);
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP FUNCTION IF EXISTS `FctTantieme` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` FUNCTION `FctTantieme`( acc_id VARCHAR(32),
+                     charge_key INTEGER) RETURNS double
+    READS SQL DATA
+BEGIN
+     DECLARE select_var DOUBLE;
+     SET select_var =(SELECT sum(tant_lot_size) FROM Tantieme as tant
+         JOIN Lot        as l  on l.lot_num = tant.tant_lot_num
+         JOIN LotsOwners as lo on lo.lo_lot_id = l.lot_id
+         JOIN Account    as a  on a.acc_id = acc_id
+         JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id and jia_ident = lo.lo_owner_id
+          WHERE tant_pc_id =charge_key); 
+          IF (select_var IS NULL) THEN
+        RETURN 0.0 ;
+          ELSE 
+        RETURN select_var ;
+          END IF;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP FUNCTION IF EXISTS `FctTantiemeFrac` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` FUNCTION `FctTantiemeFrac`( acc_id VARCHAR(32),
+                             charge_key INTEGER) RETURNS double
+    READS SQL DATA
+BEGIN
+ DECLARE select_var DOUBLE;
+ SET @tantTotal := (SELECT  COALESCE(sum(tant_lot_size),1.0)  FROM  Tantieme WHERE tant_pc_id = charge_key);
+ SET select_var =(SELECT sum(tant_lot_size) FROM Tantieme as tant
+         JOIN Lot        as l  on l.lot_num = tant.tant_lot_num
+         JOIN LotsOwners as lo on lo.lo_lot_id = l.lot_id
+         JOIN Account    as a  on a.acc_id = acc_id
+         JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id and jia_ident = lo.lo_owner_id
+      WHERE tant_pc_id =charge_key); 
+      IF (select_var IS NULL) THEN
+        RETURN 0.0 ;
+      ELSE 
+        RETURN select_var / @tantTotal;
+      END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP FUNCTION IF EXISTS `fPeriod` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` FUNCTION `fPeriod`() RETURNS varchar(32) CHARSET utf8
+    NO SQL
+    DETERMINISTIC
+return @fPeriod ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `account_delete` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `account_delete`( IN acc VARCHAR(32) )
+BEGIN
+SELECT @myLeft := acc_left, @myRight := acc_right, @myWidth := acc_right - acc_left + 1
+FROM Account WHERE acc_id = acc ;
+
+DELETE FROM Account WHERE acc_left BETWEEN @myLeft AND @myRight;
+
+UPDATE Account SET acc_right = acc_right - @myWidth WHERE acc_right > @myRight;
+UPDATE Account SET acc_left = acc_left - @myWidth WHERE acc_left > @myRight;
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `account_get_leafs` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `account_get_leafs`(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+      SELECT acc_id,acc_name from Account WHERE acc_left + 1 = acc_right and acc_id like acc;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `account_get_sub` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `account_get_sub`(IN cls VARCHAR(32) , IN _depth INTEGER)
+BEGIN
+SELECT node.acc_id, node.acc_name AS acc_name , (COUNT(parent.acc_name) -1 ) AS _level
+FROM Account AS node,
+     Account AS parent,
+     Account AS sub_parent,
+     (
+       SELECT node.acc_id , ( COUNT(parent.acc_id) - 1) AS depth
+       FROM Account AS node,
+            Account AS parent
+       WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right
+                            AND node.acc_id = cls
+       GROUP BY node.acc_id
+       ORDER BY node.acc_left 
+     ) AS sub_tree
+WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right 
+           AND node.acc_left BETWEEN sub_parent.acc_left AND sub_parent.acc_right
+           AND sub_parent.acc_id = sub_tree.acc_id
+GROUP BY node.acc_id
+HAVING _level <= _depth
+ORDER BY node.acc_left;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `account_get_tree` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `account_get_tree`( IN cls VARCHAR(32) )
+BEGIN
+  SELECT node.acc_id,CONCAT( REPEAT( '- ', (COUNT(parent.acc_name) - 1) ), node.acc_name) AS acc_name , (COUNT(parent.acc_name) -1 ) AS level
+  FROM Account AS node,
+	  Account AS parent
+  WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right and node.acc_id like CONCAT(cls,"%")
+  GROUP BY node.acc_id
+  ORDER BY node.acc_id;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `account_insert_below` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `account_insert_below`(IN period VARCHAR(32), IN parent_acc VARCHAR(32),IN acc VARCHAR(32) ,IN name VARCHAR(64) )
+BEGIN
+
+      SET @myLeft := (SELECT acc_left FROM Account WHERE acc_id = parent_acc);
+
+      UPDATE  Account SET acc_right = acc_right + 2 WHERE acc_right > @myLeft;
+      UPDATE  Account SET acc_left = acc_left + 2 WHERE acc_left > @myLeft;
+
+      INSERT INTO Account(acc_id,acc_info_id,acc_name, acc_left, acc_right) VALUES(acc,CONVERT(acc,UNSIGNED INTEGER ),name, @myLeft + 1, @myLeft + 2);
+
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `account_insert_beside` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `account_insert_beside`(IN period VARCHAR(32),IN left_acc VARCHAR(32),  IN acc VARCHAR(32) ,IN name VARCHAR(64) )
+BEGIN
+
+      SET @myRight := (SELECT acc_right FROM Account
+      WHERE acc_id = left_acc);
+
+      UPDATE Account SET acc_right = acc_right + 2 WHERE acc_right > @myRight;
+      UPDATE Account SET acc_left = acc_left + 2 WHERE acc_left > @myRight;
+
+      INSERT INTO Account(acc_id, acc_info_id,acc_name,acc_left,acc_right) VALUES(acc,CONVERT(acc,UNSIGNED INTEGER),name, @myRight + 1, @myRight + 2);
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `appel_fonds` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `appel_fonds`(
+                 IN ed DATE,
+                 IN copro_aid INTEGER ,
+                 IN prod_aid INTEGER,
+                 IN am REAL,
+                 IN des VARCHAR(256))
+BEGIN
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         (ed,ed,"",des);
+SET @last_id = LAST_INSERT_ID();
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,"",prod_aid,am,'c',des,'AF'); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,"",copro_aid,am,'d',des,'AF'); 
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `a_nouveau` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `a_nouveau`(IN dt DATE,in period TEXT)
+BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE deb DOUBLE;
+        DECLARE cre DOUBLE;
+        DECLARE sol DOUBLE;
+        DECLARE pc INT;
+        DECLARE cur2 CURSOR FOR SELECT acc_id  FROM Account ;
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        SET @enabled = TRUE;
+        -- Create Transation
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (dt,dt,"",CONCAT("Report a nouveau ",period))
+                 ;
+        SET @last_id = LAST_INSERT_ID();
+       OPEN cur2;
+       read_loop_rg : LOOP
+       FETCH cur2 INTO a;
+         IF done THEN
+           LEAVE read_loop_rg;
+         END IF;
+         CALL solde_compte_out(period,a,deb,cre,sol,pc);
+         CALL debug_msg(@enabled,CONCAT(" Process account ",a," debit=",deb," cre=",cre," solde=",sol," pc=",pc," done=",done));
+         IF   sol < -0.01 THEN 
+           CALL debug_msg(@enabled,CONCAT(" Process report débit ",deb));
+           INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"AN",dt,"",a,ABS(sol),'d',CONCAT("Report Solde ",period));
+         END IF;
+         IF   sol > 0.01 THEN 
+           CALL debug_msg(@enabled,CONCAT(" Process report positive ",deb));
+           INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"AN",dt,"",a,ABS(sol),'c',CONCAT("Report Solde ",period));
+         END IF;
+       END LOOP read_loop_rg;
+       CLOSE cur2;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `bilan` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection  = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `bilan`(IN `period` VARCHAR(32))
+BEGIN
+SELECT  m.acc_id As Compte,m.acc_name AS Description, ROUND(m.Debit,2),ROUND(m.Credit,2),ROUND(m.Debit-m.Credit,2) as sold FROM (SELECT c.acc_id, c.acc_name
+       , SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END) as Debit
+       , SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END) as Credit
+       , MONTHNAME(t.act_trans_date) as Month
+FROM Account AS c
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right
+WHERE p.per_string = period
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+
+GROUP BY c.acc_id
+ORDER BY c.acc_left ) AS m;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `debug_msg` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `debug_msg`(IN enabled INTEGER,IN msg VARCHAR(256))
+BEGIN
+  IF enabled THEN BEGIN
+    SELECT CONCAT("**",msg) AS '** DEBUG:';
+  END;
+  END IF;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `detail_compte_sans_solde` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `detail_compte_sans_solde`(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+  SELECT t.act_trans_date as Date , 
+         t.voucher_ref as Ref,
+         t.trans_label , 
+         CASE WHEN debit_credit='d' THEN ROUND(amount,2) ELSE 0 END as Debit, 
+         CASE WHEN debit_credit='c' THEN ROUND(amount,2) ELSE 0 END as Credit 
+  FROM TransactionEntry as te
+  JOIN Transactions as t ON te.trans_id = t.trans_id
+  JOIN Period as p on t.act_trans_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+  WHERE   te.acc_id=acc ORDER BY t.act_trans_date ASC;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `detail_decompte_charge` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `detail_decompte_charge`(
+                         IN user_id INTEGER,
+                         IN poste_charge_id INTEGER,
+                         IN period VARCHAR(32),
+                         IN preci INTEGER)
+BEGIN
+  SET @myAccount := (SELECT acc_id FROM Account
+      JOIN JoinIdentityAccount as jia on jia.jia_acc = acc_id  
+      WHERE user_id = jia.jia_ident);
+  SELECT  te.`entry_date` as Date,
+        te.acc_id as Compte,
+        ac.`acc_name`,
+        te.description,
+        amount  as MontantTotal,
+	ROUND( FctTantieme(@myAccount,poste_charge_id)
+		     ,preci)
+
+     as Tan,
+        ROUND( (amount * FctTantiemeFrac(@myAccount,poste_charge_id) )
+		     ,preci
+        )  as Montant,
+       pc.pc_name as Cle from TransactionEntry as te
+       JOIN Account as ac on (ac.acc_id = te.acc_id)
+       JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+       JOIN Period AS p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+       where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+       ORDER BY te.entry_date;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `detail_decompte_solde` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `detail_decompte_solde`(
+                                         IN user_id INTEGER,
+					 IN poste_charge_id INTEGER,
+                                         IN period VARCHAR(32),
+                                         IN preci INTEGER)
+BEGIN
+
+  SET @myAccount := (SELECT acc_id FROM Account
+      JOIN JoinIdentityAccount as jia on jia.jia_acc = acc_id  
+      WHERE user_id = jia.jia_ident);
+  SELECT  
+        sum(amount)  as MontantTotal,
+        ROUND( sum((amount * (FctTantiemeFrac(@myAccount,pc.pc_id)
+                                  ))) ,preci
+        )  as Montant
+         from TransactionEntry as te
+   JOIN Account as ac on (ac.acc_id = te.acc_id)
+   JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+   JOIN Period AS p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+   where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+   ORDER BY te.entry_date;      
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `fill_loanentry` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `fill_loanentry`(IN _loan INTEGER)
+BEGIN
+  DECLARE counter INT    DEFAULT 0;    
+  DECLARE interet DOUBLE DEFAULT 0.0;    
+  SET @ann     := (SELECT annuite_mensuelle(_loan));
+  SET @duree   := (SELECT ln_duree FROM Loan WHERE ln_id = _loan);
+  SET @_date   := (SELECT ln_date FROM Loan WHERE ln_id = _loan);
+  SET @capital := (SELECT ln_amount FROM Loan WHERE ln_id = _loan);
+  SET @taux    := (SELECT (ln_rate / 12.0) FROM Loan WHERE ln_id = _loan);
+  SET @counter = 0;
+  WHILE  (@counter < @duree) DO 
+  BEGIN
+    SET @interet = @capital * @taux;
+    INSERT INTO LoanEntry(le_loan_id,le_date,le_interest,le_annuite,le_ammorti,le_value)
+         VALUE(_loan, ADDDATE(@_date, INTERVAL @counter MONTH),
+               ROUND(@interet,2),
+               ROUND(@ann,2),
+               ROUND(@ann - @interet,2),
+               ROUND(@capital - (@ann - @interet),2));
+    SET @capital = ROUND(@capital - (@ann - @interet),2);
+    SET @counter = @Counter + 1;
+  END;
+  END WHILE ;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `insert_avance` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `insert_avance`(
+             IN ed DATE,
+             IN vouch VARCHAR(32),
+             IN bqaid VARCHAR(32),
+             IN aid VARCHAR(32),
+             IN am REAL, 
+            IN des VARCHAR(256))
+BEGIN
+      INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                  ( ed,ed,vouch,des);
+      SET @last_id = LAST_INSERT_ID();
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,entry_type,acc_id,amount,debit_credit,description) VALUES 
+         (@last_id,ed,vouch,"BQ",aid,am,'c',des);
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,entry_type,acc_id,amount,debit_credit,description) VALUES 
+         (@last_id,ed,vouch,"BQ",bqaid,am,'d',des);
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `insert_trans_facture` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `insert_trans_facture`(IN er_date DATE,
+                    IN ed DATE,
+                    IN vouch VARCHAR(32),
+                    IN chaci INTEGER ,
+                    IN aci INTEGER,
+                    IN am REAL,
+                    IN des VARCHAR(256),
+                    IN key_id INTEGER
+                       )
+BEGIN
+       INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (ed,er_date,vouch,des);
+      SET @last_id = LAST_INSERT_ID();
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES
+         (@last_id,ed,vouch,chaci,am,'d',des,'HA',key_id); 
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES 
+         (@last_id,ed,vouch,aci,am,'c',des,'HA',key_id); 
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `insert_trans_paye` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `insert_trans_paye`(IN tid DATE,IN ed DATE,IN vouch VARCHAR(32),
+             IN bqaci INTEGER ,
+             IN aci INTEGER,IN am REAL,IN des VARCHAR(256))
+BEGIN
+       INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (ed,tid,vouch,des);
+      SET @last_id = LAST_INSERT_ID();
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+         (@last_id,tid,vouch,bqaci,am,'c',des,'BQ'); 
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+         (@last_id,tid,vouch,aci,am,'d',des,'BQ'); 
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `journal` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `journal`(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER,IN _offs INTEGER ,IN _limit INTEGER)
+BEGIN
+    set @valPeriod= period;
+    set @valJrnx  = jrn;
+    SET @valFrom  = _offs;
+    SET @valLimit = _limit;
+    SET @v_query = CONCAT("SELECT t.act_trans_date AS Date, j.acc_id AS Compte, r.acc_name AS Ref, t.trans_label AS Libelle,",
+    "ROUND( ( CASE WHEN j.debit_credit = 'd' THEN j.amount ELSE 0 END), ",preci," ) AS Debit,",
+    "ROUND( ( CASE WHEN j.debit_credit = 'c' THEN j.amount ELSE 0 END), ",preci," ) AS Credit,",
+    " t.act_trans_date
+FROM TransactionEntry AS j
+JOIN Transactions AS t ON j.trans_id = t.trans_id
+JOIN Account AS r ON j.acc_id = r.acc_id
+JOIN Period AS p ON t.act_trans_date
+BETWEEN p.per_begin
+AND p.per_end
+AND p.per_string ='", @valPeriod ,
+"' WHERE j.entry_type ='",@valJrnx ,
+"' ORDER BY t.act_trans_date DESC, t.trans_label
+    LIMIT ", @valFrom, ",",@valLimit,";");
+    PREPARE q FROM @v_query;
+    EXECUTE q;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `journal_solde` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8mb4 */ ;
+/*!50003 SET character_set_results = utf8mb4 */ ;
+/*!50003 SET collation_connection  = utf8mb4_unicode_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `journal_solde`(IN `period` VARCHAR(32), IN `jrn` VARCHAR(2), IN `preci` INT)
+BEGIN
+    SELECT ROUND(sum(CASE WHEN j.debit_credit ='d' THEN j.amount ELSE 0 END), preci) as Debit ,
+	   ROUND(sum(CASE WHEN j.debit_credit ='c' THEN j.amount ELSE 0 END), preci)  as Credit,
+           COUNT(*) as Ro
+    FROM  TransactionEntry as j 
+      JOIN Transactions as t ON j.trans_id = t.trans_id	  
+      JOIN Account AS r on j.acc_id = r.acc_id 
+      JOIN Period AS p on t.act_trans_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+      WHERE j.entry_type = jrn
+    ;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `rembourse_appel_fonds` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `rembourse_appel_fonds`(
+             IN ed DATE,
+             IN period  VARCHAR(32),
+             IN prod_aid INTEGER,
+             IN des VARCHAR(256))
+BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE am DOUBLE;
+        -- DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantieme(acc_id,cle)  FROM Account where acc_id like '450%';
+        DECLARE cur1 CURSOR FOR SELECT acc_id,sum(amount) as am  FROM TransactionEntry as te  
+        JOIN  Period as p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+                where entry_type = "AF" and acc_id like '450%' GROUP BY acc_id;
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (ed,ed,"",des);
+        SET @last_id = LAST_INSERT_ID();
+
+        OPEN cur1;
+
+        read_loop: LOOP
+        FETCH cur1 INTO a, am;
+        IF done THEN
+          LEAVE read_loop;
+        END IF;
+          IF am > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"RF",ed,"",prod_aid,am,'d',des);
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"RF",ed,"",a,am,'c',des);
+          END IF;
+        END LOOP;
+
+        CLOSE cur1;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `rembourse_trans_chauffage` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `rembourse_trans_chauffage`( IN trs_dt DATE ,
+                   IN ed       DATE,
+                   IN chrg     VARCHAR(32),
+                   IN vouch    VARCHAR(32),
+                   in am       DOUBLE,
+                   in cle      INTEGER,
+                   in des      VARCHAR(256)
+                 )
+BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE tant DOUBLE;
+        DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantiemeFrac(acc_id,cle)  FROM Account where acc_id like '450%';
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 ( ed,trs_dt,vouch,des);
+        SET @last_id = LAST_INSERT_ID();
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'d',des);
+        OPEN cur1;
+
+        read_loop: LOOP
+        FETCH cur1 INTO a, tant;
+        IF done THEN
+          LEAVE read_loop;
+        END IF;
+          IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant,'c',des);
+          END IF;
+        END LOOP;
+
+        CLOSE cur1;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `repartir_charge_global` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `repartir_charge_global`(IN dt DATE,in period TEXT)
+BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE deb DOUBLE;
+        DECLARE cre DOUBLE;
+        DECLARE sol DOUBLE;
+        DECLARE pc INT;
+        DECLARE cur2 CURSOR FOR SELECT acc_id  FROM Account where acc_id like "6%";
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        SET @enabled = TRUE;
+       OPEN cur2;
+       read_loop_rg : LOOP
+       FETCH cur2 INTO a;
+         IF done THEN
+           LEAVE read_loop_rg;
+         END IF;
+         CALL solde_compte_out(period,a,deb,cre,sol,pc);
+         CALL debug_msg(@enabled,CONCAT(" Process account ",a," debit=",deb," cre=",cre," solde=",sol," pc=",pc," done=",done));
+         IF   sol < -0.01 THEN
+           CALL debug_msg(@enabled,CONCAT(" Process account repartir ",deb));
+           CALL repartir_trans_charge(dt,dt,a,"",ABS(sol),pc,CONCAT("Répartion ",ROUND(ABS(sol),2),"€  du compte ",a," Clé ",pc));
+         END IF;
+       END LOOP read_loop_rg;
+       CLOSE cur2;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `repartir_trans_charge` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `repartir_trans_charge`(IN trs_dt DATE ,
+                           IN ed       DATE,
+                           IN chrg     VARCHAR(32),
+                           IN vouch    VARCHAR(32),
+                           in am       DOUBLE,
+                           in cle      INTEGER,
+                           in des      VARCHAR(256)
+                         )
+BEGIN
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE tant DOUBLE;
+    DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantiemeFrac(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+    INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( ed,trs_dt,vouch,des);
+    SET @last_id = LAST_INSERT_ID();
+    INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description,tret_key_id) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'c',des,cle);
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, tant;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant,'d',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `solde_compte` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `solde_compte`(IN period VARCHAR(32), IN acc VARCHAR(32) )
+BEGIN
+
+    select  
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+               sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+             THEN
+               -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+               ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END     as Solde
+        from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+        where acc_id=acc ORDER BY entry_date;
+
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `solde_compte_out` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `solde_compte_out`(IN period VARCHAR(32), IN acc VARCHAR(32), OUT Debit_ DOUBLE , INOUT Credit_ DOUBLE , INOUT Solde_ DOUBLE,INOUT Pc_ INT)
+BEGIN
+
+select  
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END	 as Solde , t.tret_key_id INTO Debit_, Credit_, Solde_,Pc_
+       	from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date LIMIT 1;
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `solde_compte_per_month` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `solde_compte_per_month`(IN period VARCHAR(32),IN acc VARCHAR(32))
+BEGIN
+SELECT m.Month, m.acc_id As Account, m.Debit,m.Credit,(m.Debit-m.Credit) as sold FROM (SELECT c.acc_id, c.acc_name
+       , TRUNCATE(SUM(CASE WHEN te.debit_credit ='d' THEN amount ELSE 0 END),2) as Debit
+       , TRUNCATE(SUM(CASE WHEN te.debit_credit ='c' THEN amount ELSE 0 END),2) as Credit
+       , MONTH(t.act_trans_date) as Month
+FROM Account AS c
+JOIN Account pc
+JOIN Period AS p
+JOIN   Transactions AS t
+JOIN   TransactionEntry AS te ON te.trans_id = t.trans_id AND pc.acc_id = te.acc_id
+                            AND c.acc_left <= pc.acc_left AND c.acc_right >= pc.acc_right
+WHERE p.per_string = period
+      AND t.act_trans_date BETWEEN p.per_begin AND p.per_end
+      AND c.acc_id = acc
+GROUP BY MONTH(t.act_trans_date)
+ORDER BY c.acc_left , MONTH(t.act_trans_date) ) AS m;
+    END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+/*!50003 DROP PROCEDURE IF EXISTS `solde_compte_where` */;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`aeb`@`%` PROCEDURE `solde_compte_where`(IN period VARCHAR(32),  IN crit VARCHAR(128))
+BEGIN
+  SET @Stm = CONCAT("
+select
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2),0) as Debit,
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0) as Credit,
+        CASE WHEN
+                   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+             THEN
+           COALESCE(
+               -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0)
+             ELSE
+             COALESCE(
+                   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) , 0)
+        END      as Solde
+
+        from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = '",period,"'
+         WHERE ", crit," ORDER BY entry_date;");
+     PREPARE q FROM @Stm;
+     EXECUTE q;
+     DEALLOCATE PREPARE q;
+
+END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+
+--
+-- Final view structure for view `Owners`
+--
+
+/*!50001 DROP TABLE IF EXISTS `Owners`*/;
+/*!50001 DROP VIEW IF EXISTS `Owners`*/;
+/*!50001 SET @saved_cs_client          = @@character_set_client */;
+/*!50001 SET @saved_cs_results         = @@character_set_results */;
+/*!50001 SET @saved_col_connection     = @@collation_connection */;
+/*!50001 SET character_set_client      = utf8 */;
+/*!50001 SET character_set_results     = utf8 */;
+/*!50001 SET collation_connection      = utf8_general_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`aeb`@`%` SQL SECURITY DEFINER */
+/*!50001 VIEW `Owners` AS select `u`.`ident_id` AS `ident_id`,`u`.`ident_name` AS `ident_name`,`u`.`ident_firstname` AS `ident_firstname`,`u`.`ident_address` AS `ident_address`,`u`.`ident_postalcode` AS `ident_postalcode`,`u`.`ident_city` AS `ident_city`,`u`.`ident_country` AS `ident_country`,`u`.`ident_mobile` AS `ident_mobile`,`u`.`ident_phone` AS `ident_phone`,`u`.`ident_email1` AS `ident_email1`,`u`.`ident_email2` AS `ident_email2`,`ir`.`idr_name` AS `idr_name` from ((`users`.`Users` `u` join `users`.`UserRoles` `ur` on((`ur`.`ur_user_id` = `u`.`ident_id`))) join `users`.`IdentityRole` `ir` on((`ur`.`ur_role_id` = `ir`.`idr_id`))) where ((`ur`.`ur_org_id` = 26) and (`ir`.`idr_name` = 'Coproprietaire')) */;
+/*!50001 SET character_set_client      = @saved_cs_client */;
+/*!50001 SET character_set_results     = @saved_cs_results */;
+/*!50001 SET collation_connection      = @saved_col_connection */;
+
+--
+-- Final view structure for view `Suppliers`
+--
+
+/*!50001 DROP TABLE IF EXISTS `Suppliers`*/;
+/*!50001 DROP VIEW IF EXISTS `Suppliers`*/;
+/*!50001 SET @saved_cs_client          = @@character_set_client */;
+/*!50001 SET @saved_cs_results         = @@character_set_results */;
+/*!50001 SET @saved_col_connection     = @@collation_connection */;
+/*!50001 SET character_set_client      = utf8 */;
+/*!50001 SET character_set_results     = utf8 */;
+/*!50001 SET collation_connection      = utf8_general_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`aeb`@`%` SQL SECURITY DEFINER */
+/*!50001 VIEW `Suppliers` AS select `i`.`ident_id` AS `ident_id`,`i`.`ident_name` AS `ident_name`,`i`.`ident_firstname` AS `ident_firstname`,`i`.`ident_address` AS `ident_address`,`i`.`ident_postalcode` AS `ident_postalcode`,`i`.`ident_city` AS `ident_city`,`i`.`ident_country` AS `ident_country`,`i`.`ident_mobile` AS `ident_mobile`,`i`.`ident_phone` AS `ident_phone`,`i`.`ident_email1` AS `ident_email1`,`i`.`ident_email2` AS `ident_email2` from (((`users`.`Identity` `i` join `users`.`IdentityType` `it` on((`i`.`ident_type` = `it`.`idtp_id`))) join `users`.`UserRoles` `ur` on((`ur`.`ur_user_id` = `i`.`ident_id`))) join `users`.`IdentityRole` `ir` on((`ir`.`idr_id` = `ur`.`ur_role_id`))) where ((`ur`.`ur_org_id` = 26) and (`ir`.`idr_name` = 'Fournisseur')) */;
+/*!50001 SET character_set_client      = @saved_cs_client */;
+/*!50001 SET character_set_results     = @saved_cs_results */;
+/*!50001 SET collation_connection      = @saved_col_connection */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2021-08-01  0:49:42
diff --git a/app/compta/patchs/loan.txt b/app/compta/patchs/loan.txt
new file mode 100644
index 0000000..febc8c0
--- /dev/null
+++ b/app/compta/patchs/loan.txt
@@ -0,0 +1,77 @@
+
+DROP TABLE IF EXISTS Loan;
+
+CREATE TABLE IF NOT EXISTS Loan (
+      ln_id         INTEGER AUTO_INCREMENT PRIMARY KEY,
+      ln_date       DATE    COMMENT 'Date du pret',
+      ln_amount     DOUBLE  DEFAULT 0.0  COMMENT 'Montant emprunte',
+      ln_rate       DOUBLE  DEFAULT 0.01 COMMENT 'taux du pret par an',
+      ln_duree      INTEGER              COMMENT 'Duree du pret en mois',
+      ln_desc      VARCHAR(255) DEFAULT ""
+) CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+DROP TABLE IF EXISTS LoanEntry;
+
+CREATE TABLE IF NOT EXISTS LoanEntry (
+      le_id         INTEGER AUTO_INCREMENT PRIMARY KEY,
+      le_loan_id    INTEGER,
+      le_date       DATE    COMMENT 'Echéance de remboursement',
+      le_interest   DOUBLE  DEFAULT 0.0 COMMENT 'Interet restant du',
+      le_annuite    DOUBLE  DEFAULT 0.0 COMMENT 'Annuité mensuelle',
+      le_ammorti    DOUBLE  DEFAULT 0.0 COMMENT 'Montant ammorti',
+      le_booked     BOOLEAN DEFAULT FALSE,
+      le_value      DOUBLE DEFAULT  0.0 ,
+      INDEX         loan_id ( le_loan_id),
+      FOREIGN       KEY(le_loan_id)
+                    REFERENCES Loan(ln_id)
+                    ON DELETE CASCADE
+) CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+
+delimiter //
+DROP FUNCTION IF EXISTS annuite_mensuelle //
+CREATE FUNCTION annuite_mensuelle( _loan_id INTEGER)
+      RETURNS  DOUBLE
+      NOT DETERMINISTIC
+      READS SQL DATA
+BEGIN
+       RETURN (SELECT TRUNCATE(( ln_amount * (ln_rate / 12.0 ) / ( 1.0 - ( 1.0 / POW(1.0 + ln_rate/12.0,ln_duree )) )),2) FROM Loan  WHERE ln_id = _loan_id);
+END ; //
+ 
+
+DROP PROCEDURE IF EXISTS fill_loanentry //
+
+CREATE PROCEDURE fill_loanentry(IN _loan INTEGER)
+BEGIN
+  DECLARE counter INT    DEFAULT 0;    
+  DECLARE interet DOUBLE DEFAULT 0.0;    
+  SET @ann     := (SELECT annuite_mensuelle(_loan));
+  SET @duree   := (SELECT ln_duree FROM Loan WHERE ln_id = _loan);
+  SET @_date   := (SELECT ln_date FROM Loan WHERE ln_id = _loan);
+  SET @capital := (SELECT ln_amount FROM Loan WHERE ln_id = _loan);
+  SET @taux    := (SELECT (ln_rate / 12.0) FROM Loan WHERE ln_id = _loan);
+  SET @counter = 0;
+  WHILE  (@counter < @duree) DO 
+  BEGIN
+    SET @interet = @capital * @taux;
+    INSERT INTO LoanEntry(le_loan_id,le_date,le_interest,le_annuite,le_ammorti,le_value)
+         VALUE(_loan, ADDDATE(@_date, INTERVAL @counter MONTH),
+               ROUND(@interet,2),
+               ROUND(@ann,2),
+               ROUND(@ann - @interet,2),
+               ROUND(@capital - (@ann - @interet),2));
+    SET @capital = ROUND(@capital - (@ann - @interet),2);
+    SET @counter = @Counter + 1;
+  END;
+  END WHILE ;
+END //
+
+delimiter ;
+
+INSERT INTO Loan (ln_date,ln_amount,ln_rate,ln_duree) VALUES('2021-02-10',86133.34,0.0185,174 -68);
+call fill_loanentry(1);
+SELECT * FROM LoanEntry LIMIT 0,10;
+select SUM(le_interest),sum(le_annuite) FROM LoanEntry group by (le_booked);
+select YEAR(le_date) as Year,SUM(le_interest) as interet ,sum(le_annuite) as ann , sum(le_annuite) - sum(le_interest) as cap FROM LoanEntry group by YEAR(le_date);
+SELECT annuite_mensuelle(01) as annuite;
+
diff --git a/app/compta/patchs/procedures.txt b/app/compta/patchs/procedures.txt
new file mode 100644
index 0000000..da7744e
--- /dev/null
+++ b/app/compta/patchs/procedures.txt
@@ -0,0 +1,115 @@
+
+This document keeps track of all tables and procedures used
+in the accouting software.
+
+HISTORY
+version 0.1.0
+
+version 1.0.0
+
+version 1.1.0
+  depracated procedure
+version 1.2.0
+  new procedure annuite_mensuelle
+  new function fPeriod
+  new procedure fill_loanentry
+  update procedure bilan
+  update procedure journal (offset and limit parameter)
+  
+  new view 
+
+STORED PROCEDURES
+-
+PROCEDURE account_get_leafs
+ in use
+
+PROCEDURE account_get_tree
+ in use
+
+PROCEDURE account_insert_below
+ in use
+
+PROCEDURE account_insert_beside
+ in use
+
+PROCEDURE appel_fonds
+
+PROCEDURE appel_fonds_sur_facture
+
+PROCEDURE a_nouveau
+
+PROCEDURE bilan
+ in use
+
+PROCEDURE debug_msg
+
+PROCEDURE detail_compte
+
+PROCEDURE detail_compte_sans_solde
+
+PROCEDURE detail_decompte_charge
+
+PROCEDURE detail_decompte_charge_par_lot
+
+PROCEDURE detail_decompte_solde
+
+FUNCTION FctTantieme
+ in use
+
+FUNCTION FctTantiemeFrac
+ in use
+
+PROCEDURE insert_avance
+ in use
+
+PROCEDURE insert_facture
+ deprecated
+
+PROCEDURE insert_trans_facture
+ in use
+
+PROCEDURE insert_trans_paye
+ in use
+
+PROCEDURE insert_view_avance
+ deprecated
+
+PROCEDURE insert_view_facture
+ deprecated
+
+PROCEDURE insert_view_paye
+ deprecated
+
+PROCEDURE insert_view_pc1
+ used for 2012 and 2013
+ deprecated
+
+PROCEDURE insert_view_pc2
+ used for 2012 and 2013
+ deprecated
+
+PROCEDURE insert_view_pc4
+ used for 2012 and 2013
+ deprecated
+
+PROCEDURE journal
+
+PROCEDURE journal_solde
+
+PROCEDURE rembourse_appel_fonds
+
+PROCEDURE rembourse_trans_chauffage
+
+PROCEDURE repartir_charge
+
+PROCEDURE repartir_charge_global
+
+PROCEDURE repartir_trans_charge
+
+PROCEDURE solde_compte
+
+PROCEDURE solde_compte_out
+
+PROCEDURE solde_compte_where
+
+PROCEDURE tantieme
diff --git a/app/compta/patchs/recurrent.txt b/app/compta/patchs/recurrent.txt
new file mode 100644
index 0000000..2de72dc
--- /dev/null
+++ b/app/compta/patchs/recurrent.txt
@@ -0,0 +1,37 @@
+--
+-- Table structure for table `Recurrent`
+--
+
+DROP TABLE IF EXISTS `Recurrent`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `Recurrent` (
+  `r_id` int(11) NOT NULL AUTO_INCREMENT,
+  `r_desc` varchar(64) NOT NULL DEFAULT '""',
+  `r_amount` decimal(13,2) NOT NULL DEFAULT '0.00',
+  `r_date` date NOT NULL,
+  `r_end` date NOT NULL,
+  `r_next` date NOT NULL,
+  `r_period` int(11) NOT NULL DEFAULT '1' COMMENT 'unit is month',
+  PRIMARY KEY (`r_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='Recurrent operations that can be handled wih cron';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `RecurrentEntry`
+--
+
+DROP TABLE IF EXISTS `RecurrentEntry`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `RecurrentEntry` (
+  `re_id` int(11) NOT NULL AUTO_INCREMENT,
+  `re_rec_id` int(11) NOT NULL,
+  `re_entry_type` varchar(2) NOT NULL,
+  `re_debit_credit` enum('d','c') NOT NULL DEFAULT 'd',
+  `re_amount` decimal(13,2) NOT NULL DEFAULT '0.00',
+  `re_acc` varchar(16) NOT NULL,
+  PRIMARY KEY (`re_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
diff --git a/app/compta/patchs/requetes_utils.txt b/app/compta/patchs/requetes_utils.txt
new file mode 100644
index 0000000..4450785
--- /dev/null
+++ b/app/compta/patchs/requetes_utils.txt
@@ -0,0 +1,21 @@
+
+
+2021-07-31 find transaction that have no transaction_entry.
+-----------------------------------------------------------
+
+
+SELECT t.trans_id,t.trans_label FROM Transactions as t
+LEFT JOIN TransactionEntry as te on t.trans_id = te.trans_id
+WHERE act_trans_date between "2021-01-01" and "2021-12-31" and te.trans_id IS NULL
+GROUP BY t.trans_id
+ORDER BY t.act_trans_date
+
+
+2021-07-31 Delete transaction without transaction entry
+--------------------------------------------------------
+
+DELETE FROM Transactions WHERE trans_id IN ( SELECT * FROM (SELECT t.trans_id,t.trans_label FROM Transactions as t
+LEFT JOIN TransactionEntry as te on t.trans_id = te.trans_id
+WHERE act_trans_date between "2021-01-01" and "2021-12-31" and te.trans_id IS NULL
+GROUP BY t.trans_id
+ORDER BY t.act_trans_date ) AS X )
diff --git a/app/compta/patchs/solde_compte_per_month_per_year.txt b/app/compta/patchs/solde_compte_per_month_per_year.txt
new file mode 100644
index 0000000..de5f52a
--- /dev/null
+++ b/app/compta/patchs/solde_compte_per_month_per_year.txt
@@ -0,0 +1,9 @@
+select dat,Debit,Credit, Debit - Credit As Solde FROM 
+(select DATE_FORMAT(TransactionEntry.entry_date ,"%m:%Y") as dat, 
+  SUM(CASE WHEN TransactionEntry.debit_credit = 'd' THEN TransactionEntry.amount ELSE 0.0 END) as Debit 
+  ,SUM(case WHEN TransactionEntry.debit_credit ='c' THEN TransactionEntry.amount ELSE 0.0 END) AS
+  Credit
+FROM TransactionEntry
+where TransactionEntry.acc_id = "512003" and TransactionEntry.entry_date betWEEN "2021-01-01" and "2021-12-31"
+ and TransactionEntry.entry_type != "AN"
+group by dat WITH ROLLUP) AS son;
diff --git a/app/compta/patchs/tantieme_per_lot.sql b/app/compta/patchs/tantieme_per_lot.sql
new file mode 100644
index 0000000..03f6f28
--- /dev/null
+++ b/app/compta/patchs/tantieme_per_lot.sql
@@ -0,0 +1,9 @@
+
+CREATE PROCEDURE tantieme_per_lot(IN uid INT)
+BEGIN
+SELECT l.lot_name as Name ,pc.pc_name,t.tant_lot_size 
+FROM  LotsOwners as lo, PosteCharge as pc, Lot as l 
+JOIN  Tantieme as t on t.tant_lot_num = l.lot_num 
+WHERE lo.lo_lot_id = l.lot_id and
+      lo.lo_owner_id = uid and pc.pc_id=t.tant_pc_id order by Name,tant_pc_id;
+END
diff --git a/app/compta/patchs/update_transation_foreign_key.txt b/app/compta/patchs/update_transation_foreign_key.txt
new file mode 100644
index 0000000..1526fb0
--- /dev/null
+++ b/app/compta/patchs/update_transation_foreign_key.txt
@@ -0,0 +1,6 @@
+
+ALTER TABLE TransactionEntry 
+      ADD CONSTRAINT FK_TransTransEntry
+      FOREIGN KEY ( trans_id )
+      REFERENCES Transaction( trans_id ) ON DELETE CASCADE;
+
diff --git a/app/compta/pcmn.js b/app/compta/pcmn.js
new file mode 100644
index 0000000..04b993a
--- /dev/null
+++ b/app/compta/pcmn.js
@@ -0,0 +1,158 @@
+define(["require", "exports", "../../js/xgui/CtrlDialogbox", "./services"], function (require, exports, CtrlDialogbox_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var PlanComptable;
+    (function (PlanComptable) {
+        class DlgPcmn extends CtrlDialogbox_1.Dialogbox {
+            constructor(_id, jurl) {
+                console.log("DlgPcmn constructor");
+                super(_id);
+                var req = new AEBW.Json(jurl);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+                var myPcmn = new AEBW.control.table('pcmn');
+                this.TablePcmn = function () { return myPcmn; };
+                this._current_class = '4';
+                this.prepare(myPcmn);
+            }
+            onDummy(response) {
+                alert("DlgPcmn::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgPcmn::Dummy Error");
+            }
+            addAccount(parent_account) {
+                var t = new services_1.Services.AddAccountReqParams($('class').value, $('lib').value, parent_account);
+                console.log('DlgPcmn::addAccount enter');
+                try {
+                    var bindFct = this.onAddAccount.bind(this);
+                    this._pcmn.addAccount(t, bindFct, this.onDummyFail);
+                }
+                catch (e) {
+                    alert("DlbPcmn.addAccount Failed" + e.message);
+                }
+            }
+            onAddAccount(response) {
+                this.getAccountList(this._current_class);
+            }
+            _actionCell(cell, it, rowNb) {
+                var obj = this;
+                var i1 = document.createElement('i');
+                i1.setAttribute('class', 'fa fa-arrow-circle-down');
+                i1.setAttribute('acc_id', it['acc_id']);
+                i1.setAttribute('row', rowNb);
+                i1.style.cssFloat = "left";
+                i1.style.display = "inline-block";
+                i1.onclick = function (event) {
+                    console.log("DlgPcmn::on " + i1.getAttribute('acc_id') + " " + rowNb);
+                    obj.addAccount(i1.getAttribute('acc_id'));
+                };
+                var i3 = document.createElement('i');
+                i3.setAttribute('class', 'fa fa-times');
+                i3.setAttribute('acc_id', it['acc_id']);
+                i3.setAttribute('row', rowNb);
+                i3.style.cssFloat = "left";
+                i3.style.display = "inline-block";
+                i3.onclick = function (event) {
+                    console.log("DlgPcmn::on " + i3.getAttribute('acc_id'));
+                    obj.removeAccount(i3.getAttribute('acc_id'));
+                };
+                cell.innerHTML = "";
+                cell.appendChild(i1);
+                cell.appendChild(i3);
+            }
+            _typeCell(cell) {
+                cell.innerHTML = "Détail ";
+            }
+            getAccount() {
+            }
+            onGetAccount(response) {
+                alert('Yes ongetAccount');
+            }
+            updateAccountName(acc, nm) {
+                var _param = new services_1.Services.ReqTwoParams(acc, nm);
+                var bindFct = this.onUpdateAccountName.bind(this);
+                this._pcmn.updateAccountName(_param, bindFct, this.onDummyFail);
+                this._current_class = nm;
+            }
+            onUpdateAccountName(res) {
+            }
+            getAccountList(nm) {
+                var _param = new services_1.Services.AccountListReqParams(nm, 1);
+                var bindFct = this.onGetAccountList.bind(this);
+                this._pcmn.getAccountList(_param, bindFct, this.onDummyFail);
+                this._current_class = nm;
+            }
+            onGetAccountList(response) {
+                var tb = this.TablePcmn();
+                if (response.error !== 'undefined' && response.errorr != null) {
+                    console.log("onGetAccountList Aiie " + response.error);
+                }
+                else {
+                    console.log("onGetAccount List got:" + response.result.length);
+                }
+                this.cleanTable(tb, tb._NbRows);
+                for (var i = 0; i < response.result.length; i++) {
+                    var it = response.result[i];
+                    var row = tb.addRow();
+                    this.fillRow(row, it, tb, i);
+                }
+            }
+            fillRow(row, it, tb, rowNb) {
+                row.cells[0].innerHTML = it['acc_id'] + " ";
+                row.cells[1].setAttribute("acc", it['acc_id']);
+                row.cells[1].innerHTML = it['acc_desc'];
+                row.cells[3].innerHTML = " ";
+                this._typeCell(row.cells[2]);
+                this._actionCell(row.cells[3], it, rowNb);
+            }
+            insertNew(acc_id, _under, rowNb) {
+                console.log("insertNew " + acc_id + " under=" + _under + " rowNb=" + rowNb);
+            }
+            removeAccount(acc_id) {
+                console.log("removeAccount " + acc_id + " ");
+                var t = new services_1.Services.DummyReqParams(acc_id);
+                try {
+                    var bindFct = this.onAddAccount.bind(this);
+                    this._pcmn.deleteAccount(t, bindFct, this.onDummyFail);
+                }
+                catch (e) {
+                    alert("DlbPcmn.removeAccount Failed" + e.message);
+                }
+            }
+            cleanTable(tb, sz) {
+                for (var i = 0; i < sz; i++) {
+                    tb.delRow(0);
+                }
+            }
+            prepare(t) {
+                var _obj = this;
+                AEBW.mixin(t, {
+                    onSelectCell(elem, row, col) {
+                        if (col == 2 && (elem.getAttribute('state') == 'RD')) {
+                            elem.setAttribute('state', 'WR');
+                            var value = elem.innerHTML;
+                            var inp = document.createElement('input');
+                            inp.setAttribute('type', 'text');
+                            inp.setAttribute('value', value);
+                            inp.onkeypress = function (event) {
+                                console.log("DlgPcmn::prepare mixin onSelectCell onkeypress");
+                                var evt = (event || window.event);
+                                if (evt.keyCode == Prototype.Event.KEY_RETURN) {
+                                    var acc = elem.getAttribute('acc');
+                                    var amount = inp.value;
+                                    elem.innerHTML = inp.value;
+                                    elem.setAttribute('state', 'RD');
+                                    _obj.updateAccountName(acc, amount);
+                                }
+                            };
+                            elem.innerHTML = "";
+                            elem.appendChild(inp);
+                        }
+                    }
+                });
+            }
+        }
+        PlanComptable.DlgPcmn = DlgPcmn;
+        PlanComptable.Pcmn = new DlgPcmn('', "/app/compta/index.php");
+    })(PlanComptable = exports.PlanComptable || (exports.PlanComptable = {}));
+});
diff --git a/app/compta/pcmn.xml b/app/compta/pcmn.xml
new file mode 100644
index 0000000..8db16cb
--- /dev/null
+++ b/app/compta/pcmn.xml
@@ -0,0 +1,395 @@
+
+
+
+
+    Gestion comptable 
+    
+        
+
+        
+        Gestion Comptable  
+        
+        
+          
+              Société 
+              
+                  
+                      
+                
+                    Organisation 
+                    
+                        Liste 
+                        Nouvelle Organisation 
+                     
+                 
+                
+                    Exercice 
+                    
+                        Liste Exercice 
+                        Nouvel Exercice 
+                        Cloture Exercice 
+                     
+                 
+                
+                    Lots 
+                    
+                          Nouveau Lot 
+                          Attribuer 
+                          Supprimier 
+                         
+                 
+                
+                    Type de compte 
+                    
+                        Creer Poste Charge 
+                        Supprimer Poste Charge 
+                          appliquer 
+                         
+                 
+                      
+                       
+                          
+                          Information generales 
+ 
+             
+                 
+             
+           
+              
+                
+          
+              Plan 
+          
+            
+                  
+                      
+            
+                Type de comptes 
+                
+            1 Comptes de capitaux 
+            2 Comptes d'immobilisation 
+            3 Stock et command 
+            4 Comptes de Tiers 
+            5 Comptes Financiers 
+            6 Comptes Charges 
+            7 Comptes Produits 
+            8 Hors Comptabilite 
+            9 Comptes Analytiques 
+             
+           
+         
+        
+            Plan comptable 
+                
+                    Titre du tableau 
+                    
+          
+            class 
+            Libellé 
+            Type 
+             
+          
+          
+            
+          Actif 
+          Passif 
+          Produit 
+          Charge 
+          Banque 
+             
+           
+          
+                        Ajouter 
+        
+           
+                     
+                    
+        
+          1 
+          Compte de test 
+          Actif 
+          
+                        Delete 
+        
+       
+                     
+                
+      
+     
+       
+         
+           
+           
+
+          
+              Fournisseurs 
+              
+                  
+                      
+                          
+                              Facture 
+                              
+				Nouvelle facture 
+				Payer facture 
+                               
+                           
+                          
+                              Gestion 
+                              
+				Nouveau Fournisseur 
+				Etat Fournisseur 
+				Compte Fournisseur 
+				Gerer Fournisseur 
+                               
+                           
+                       
+                      
+                          
+                              Nouvelle Facture 
+                              
+                                  
+                                      Fournisseur 
+                                          Date Facture Date Saisie Montant  
+                               
+                           
+                       
+                   
+           
+           
+
+          
+              Coproprietaires 
+              
+                  
+                      
+                          
+                              Facture 
+                              
+				Virement 
+                               
+                           
+                          
+                              Gestion 
+                              
+				Gerer 
+				Ajouter 
+				Lancer Appel de fonds 
+				Decompte Charge 
+                               
+                           
+                       
+                      
+                      Vide
+                       
+                   
+           
+           
+
+          
+              Eglise 
+              
+              
+                  
+                    
+                    Membres 
+                    
+                        Dons 
+                        Recu Taxe 
+                     
+                     
+                    
+                    Gestion 
+                    
+                        Ajouter Membre 
+                        Supprimer Membre 
+                     
+                     
+                 
+                
+              Status
+                 
+            
+             
+         
+        
+            Bilan 
+            
+                
+                
+                  Exercice 
+                  
+                    Exercice : Appliquer 
+                   
+                 
+                
+                    Bilan de L'exercice 
+                    
+                        Compte Libelle Debit Credit Solde  
+                    
+                        10 Immoblisation 0 0 0  
+                
+                End Table
+                 
+                
+             
+         
+            
+                Syndic 
+                
+                
+                    Information General du syndic 
+                    
+                    
+                        General  
+                        
+                    
+                        Nom Prenom Adresse Code Postal Ville  
+                    
+                      
+                      appliquer 
+                      Nouveau 
+                     
+
+                 
+             
+                 
+                    
+                 
+             
+         
+	
+	
+	
+	
+	
+	
+     
+ 
diff --git a/app/compta/pcmnBootstrap.js b/app/compta/pcmnBootstrap.js
new file mode 100644
index 0000000..12ebe0a
--- /dev/null
+++ b/app/compta/pcmnBootstrap.js
@@ -0,0 +1,49 @@
+requirejs.config({
+    baseUrl: '../..',
+    urlArgs: "v=" + (new Date()).getTime() , /* For debug*/	
+    paths: {
+        "cpt": "/app/compta",
+        "xgui": "/js/xgui",
+        "tslib": "/js/tslib",
+        "" : ""
+    },
+    shim: {
+        "pcmn": {
+            deps: ['aebw'
+                   , 'xgui/xgui_dialogbox'
+                   , 'xgui/xgui_json'
+                   , 'cpt/Dialog'
+                   , 'cpt/services'
+                   ,'js/scriptaculus/prototype'],
+            exports: 'PlanComptable',
+            init: function (x) {
+              console.log("shim de requirejs plan comptable not called either");
+            }
+        },
+        "Dialog": {
+            deps: ['xgui/xgui_dialogbox'],
+            exports: ''
+        },
+        "xgui_dialogbox": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        },
+        "xgui_json": {
+            deps: ['xgui/aebw'],
+            exports: ''
+        }
+    }
+});
+requirejs(["require", "exports"
+          , "tslib"
+          , "xgui/xgui_json"
+          , "xgui/xgui_dialogbox"
+          , "cpt/Dialog"
+          , "cpt/services"
+          , "cpt/pcmn"], function (req,exp,ts,xj,xf,dlg,srv,myApp) {
+    console.log("starting Plan Comptable  application...");
+    var Pcmn = myApp.PlanComptable.Pcmn;
+    Pcmn.getAccountList('4');
+    // To allow access in web page.
+    window.Pcmn = Pcmn;
+});
diff --git a/app/compta/pcmn_syndic.txt b/app/compta/pcmn_syndic.txt
new file mode 100644
index 0000000..2d32be8
--- /dev/null
+++ b/app/compta/pcmn_syndic.txt
@@ -0,0 +1,120 @@
+Classe 1 Provisions, avances, subventions et emprunts
+10 Provisions et avances :
+102 Provisions pour travaux décidés
+103 Avances
+1031 Avances de trésorerie
+1032 Avances travaux au titre de l'article 18, 6e alinéa de la loi susvisée
+1033 Autres avances
+12 Solde en attente sur travaux et opérations exceptionnelles
+13 Subventions :
+131 Subventions accordées en instance de versement
+
+Classe 4 - Copropriétaires et tiers
+40 Fournisseurs :
+401 Factures parvenues
+408 Factures non parvenues
+409 Fournisseurs débiteurs
+42 Personnel :
+421 Rémunérations dues
+43 Sécurité sociale et autres organismes sociaux :
+431 Sécurité sociale
+432 Autres organismes sociaux
+44 Etat et collectivités territoriales :
+441 Etat et autres organismes - subventions à recevoir
+442 Etat - impôts et versements assimilés
+443 Collectivités territoriales - aides
+45 Collectivité des copropriétaires :
+450 Copropriétaire individualisé
+
+Si l'assemblée générale en décide la création, les sous-comptes suivants :
+
+450-1 Copropriétaire - budget prévisionnel
+450-2 Copropriétaire - travaux de l'article 14-2 de la loi susvisée et opérations exceptionnelles
+450-3 Copropriétaire - avances
+450-4 Copropriétaire - emprunts
+459 Copropriétaire - créances douteuses
+46 Débiteurs et créditeurs divers :
+461 Débiteurs divers
+462 Créditeurs divers
+47 Compte d'attente :
+471 Compte en attente d'imputation débiteur
+472 Compte en attente d'imputation créditeur
+48 Compte de régularisation :
+486 Charges payées d'avance
+487 Produits encaissés d'avance
+49 Dépréciation des comptes de tiers :
+491 Copropriétaires
+492 Personnes autres que les copropriétaires
+
+Classe 5 - Comptes financiers
+50 Fonds placés :
+501 Compte à terme
+502 Autre compte
+51 Banques, ou fonds disponibles en banque pour le syndicat :
+512 Banques
+514 Chèques postaux
+53 Caisse.
+
+Classe 6 - Comptes de charges
+60 Achats de matières et fournitures :
+601 Eau
+602 Electricité
+603 Chauffage, énergie et combustibles
+604 Achats produits d'entretien et petits équipements
+605 Matériel
+606 Fournitures
+61 Services extérieurs :
+611 Nettoyage des locaux
+612 Locations immobilières
+613 Locations mobilières
+614 Contrats de maintenance
+615 Entretien et petites réparations
+616 Primes d'assurances
+62 Frais d'administration et honoraires :
+621 Rémunérations du syndic sur gestion copropriété
+6211 Rémunération du syndic
+6212 Débours
+6213 Frais postaux
+622 Autres honoraires du syndic
+6221 Honoraires travaux
+6222 Prestations particulières
+6223 Autres honoraires
+623 Rémunérations de tiers intervenants
+624 Frais du conseil syndical
+63 Impôts - taxes et versements assimilés :
+632 Taxe de balayage
+633 Taxe foncière
+634 Autres impôts et taxes
+64 Frais de personnel :
+641 Salaires
+642 Charges sociales et organismes sociaux
+643 Taxe sur les salaires
+644 Autres (médecine du travail, mutuelles, etc.)
+66 Charges financières des emprunts, agios ou autres :
+661 Remboursement d'annuités d'emprunt
+662 Autres charges financières et agios
+67 Charges pour travaux et opérations exceptionnelles :
+671 Travaux décidés par l'assemblée générale
+672 Travaux urgents
+673 Etudes techniques, diagnostic, consultation
+677 Pertes sur créances irracouvrables
+678 Charges exceptionnelles
+68 Dotations aux dépréciations sur créances douteuses.
+
+
+Classe 7 - Comptes de produits
+70 Appels de fonds :
+701 Provisions sur opérations courantes
+702 Provisions sur travaux de l'article 14-2 et opérations exceptionnelles
+703 Avances
+704 Remboursements d'annuités d'emprunts
+71 Autres produits :
+711 Subventions
+712 Emprunts
+713 Indemnités d'assurances
+714 Produits divers (dont intérêts légaux dus par les copropriétaires)
+716 Produits financiers
+718 Produits exceptionnels
+
+78 Reprises de dépréciations sur créances douteuses.
+ 
diff --git a/app/compta/reports/decompte_charge.php b/app/compta/reports/decompte_charge.php
new file mode 100644
index 0000000..54e6d0e
--- /dev/null
+++ b/app/compta/reports/decompte_charge.php
@@ -0,0 +1,466 @@
+session   = $_session;
+      $this->auth_conf = $auth_cfg;
+      $this->_dbname   = $db;
+      parent::__construct($auth_cfg[SQL_SERVER],$auth_cfg[SQL_USER],$auth_cfg[SQL_PASSWD],$db);
+    }
+
+
+    function __destruct() {
+      parent::__destruct();
+    }
+
+    function Header() {
+      $this->SetFillColor(255);
+      $this->SetFont('Arial','',10);
+      $org = $this->session->getOrganization();
+      // set default header data
+      $this->Cell(50,5,$org[0]);
+      $this->Ln();
+      $this->Cell(50,5,$org[1]);
+      $this->Ln();
+      $addr = $org[2]." ".$org[3];
+      $this->Cell(50,5,$addr);
+      $this->Ln();
+      //$this->Cell(50,5,"Tel: 06 70 43 73 80");
+        
+      $this->SetFont('Arial','',14);
+      $this->SetFillColor(200);
+      $this->RoundedRect(120,10,75,10,5,"1234","DF");
+      $this->Text(125,17,"Decompte de Charges");
+    
+    }
+    private function Titre($libelle) {
+       $this->SetFont('Arial','',12);
+       $this->SetFillColor(200,200,255);
+       $this->Cell(0,6,$libelle,0,1,'L',true);
+       
+       $this->Ln(2);
+       $this->y0 = $this->GetY();
+    }
+
+    private function DetailLots($cpt)
+    {
+      $i = 0;
+      $ch =3;
+      $uid    = $this->UserIdFromAccount($cpt);
+      $w      = array(20,12,12,12,12);
+      $header = array('LOTS','PC1','PC2','PC4','EAU');
+      $q = 'select l.lot_name as Name ,pc.pc_name,t.tant_lot_size from LotsOwners as lo, PosteCharge as pc, Lot as l join Tantieme as t on t.tant_lot_num = l.lot_num where lo.lo_lot_id = l.lot_id and';
+      $q = $q.' lo.lo_owner_id ='.$uid. ' and pc.pc_id=t.tant_pc_id order by Name,tant_pc_id;';
+
+      $y = $this->GetY();
+      $this->setY(35);
+      $this->SetFont('Arial','',6);
+      // header
+      for($i=0;$iCell($w[$i],$ch,iconv('UTF-8','iso8859-1',$header[$i]),1,0,'C');
+         $header[$i] = 0.0;
+      }
+      $this->Ln();
+      $res    = $this->doQueryImpr($q);
+      // data
+      if ($res['records'] != "Failed") {
+        $i = 0;
+        $cols = count($res['records']);
+        foreach($res['records'] as $fields)
+        {
+           if ($i == 0) 
+           {
+             $this->Cell($w[$i],$ch,$fields[0],'LR',0,'L');
+             $header[$i] = 'Total';
+             $i++;
+           } 
+           $this->Cell($w[$i],$ch,number_format($fields[2],2),'LR',0,'R');
+           $header[$i] = $header[$i] + $fields[2];
+           $i++;
+           if ( !($i%5) ) {
+             $i = 0 ; 
+             $this->Ln();
+           }
+        }
+      } else {
+        $this->Cell($w[0],$ch,iconv('UTF-8','iso8859-1','Failed'),'LR',0,'C');
+        $this->Ln();
+      }
+      // bottom
+      for($i=0;$iCell($w[$i],$ch,iconv('UTF-8','iso8859-1',$header[$i]),1,0,'L');
+        } else {
+           $this->Cell($w[$i],$ch,number_format($header[$i],2),1,0,'R');
+        }
+      }
+      $this->Ln();
+      $this->setY($y);
+    }
+    // Better table
+    private function ImprovedTable($header, $data)
+    {
+       $i = 0;
+       $ch = 4;
+       // Column widths
+       $w = array(17, 45, 68, 30,30);
+      // Header
+       for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C');
+         $this->Cell($w[$i],7,iconv('UTF-8','iso8859-1',$header[$i]),1,0,'C');
+       $this->Ln();
+      // Data
+           $this->SetFont('Arial','',8);
+       foreach($data as $row)
+       {
+           $this->Cell($w[0],$ch,$row[0],'LR');
+           //$this->Cell($w[1],$ch,$row[1],'LR');
+           $this->Cell($w[1],$ch,iconv('UTF-8','iso8859-1',$row[1]),'LR');
+
+           $this->Cell($w[2],$ch,$row[2],'LR',0,'R');
+           if ($row[3] == 0.0 ) {
+               $this->Cell($w[3],$ch,'','LR',0,'R');
+           } else
+               $this->Cell($w[3],$ch,number_format($row[3],2),'LR',0,'R');
+           if ($row[4] == 0.0) {
+               $this->Cell($w[4],$ch,'','LR',0,'R');
+           } else
+               $this->Cell($w[4],$ch,number_format($row[4],2),'LR',0,'R');
+           $this->Ln();
+           if ($i++ > 50) 
+           {
+               $i = 0;
+               $this->AddPage();
+               $this->Ln();
+           }
+       }
+           $this->SetFont('Arial','',10);
+       // Closing line
+       $this->Cell(array_sum($w),0,'','T');
+    }
+    //
+
+    private function Solde($period,$compte) {
+       $w = array(130, 30,30);
+       $header = array('Solde','Debit','Credit');
+       $q = 'CALL solde_compte("'.$period.'","'.$compte.'");';
+       $this->Ln();
+      // Header
+       
+       $res    = $this->doQueryImpr($q);
+       if ($res['records'] != "Failed") {
+           $fields = $res['records'][0];
+           $this->Cell($w[0],6,'Total','LR');
+           $this->Cell($w[1],6,$fields[0],'LR',0,'R');
+           $this->Cell($w[2],6,$fields[1],'LR',0,'R');
+           $this->Ln();
+       }  else {
+           $this->Cell($w[0],6,'Total','LR');
+           $this->Cell($w[1],6,'0','LR',0,'R');
+           $this->Cell($w[2],6,'0','LR',0,'R');
+           $this->Ln();
+       }
+       $this->Cell(array_sum($w),0,'','T');
+       $this->Ln();
+       $this->Ln();
+       if ($res['records'][0][2] > 0.0) {
+         $str = "Votre compte présente un solde créditeur de ".$res['records'][0][2]." euros";
+         //$this->Cell(50,5,"Votre compte presente un solde crediteur de ".$res['records'][0][2]." euros");
+         $this->Cell(50,5,iconv('UTF-8','iso8859-1',$str));
+       } else {
+         $str = "Votre compte présente un solde débiteur de ".abs($res['records'][0][2])." euros";
+         //$this->Cell(50,5,"Votre compte presente un solde debiteur de ".abs($res['records'][0][2])." euros");
+         $this->Cell(50,5,iconv('UTF-8','iso8859-1',$str));
+       }
+    
+    }
+    /**
+     * @brief Initial implementation to display owner info based on account name. It's a bad strategy.
+     * The info's should be based on uid in case the request comes from the syndic. 
+     * The uid shall be the one from the session in the other case
+     * @deprecated
+     *
+     */
+    private function Copro($compte) {
+        $x = 120;
+        $q = 'select ident_name,ident_firstname,ident_address,ident_postalcode,ident_city from Owners as i ';
+        $qj= 'JOIN JoinIdentityAccount as j on j.jia_ident = i.ident_id and j.jia_acc ='.$compte.';';
+        $res    = $this->doQueryImpr($q.$qj);
+        $ident = $res['records'][0];
+        $this->Text($x,40,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,46,"".$ident[2]);
+        $this->Text($x,52,"".$ident[3]." ".$ident[4]);
+        $this->setY(60);
+    }
+
+    /**
+     * @brief retrieve information from owner. Name, adresse, etc
+     *
+     */
+    private function CoproUser($uid) {
+        $x = 120;
+        $q =<<<_EOF
+SELECT ident_name,ident_firstname,ident_address,ident_postalcode,ident_city FROM Owners as i
+WHERE ident_id = {$uid};
+_EOF;
+        $res    = $this->doQueryImpr($q);
+        $ident = $res['records'][0];
+        $this->Text($x,40,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,46,"".$ident[2]);
+        $this->Text($x,52,"".$ident[3]." ".$ident[4]);
+        $this->setY(60);
+    }
+
+    /**
+     * @brief Initial implementation. Does not work as expected because a owner can
+     * ownmultiple accounts
+     *
+     * @TODO revise so that this entry can handle multiple accounts
+     */
+    public function Decompte($period,$compte) {
+        $header = array('Date','Référence','Désignation','Débit','Crédit');
+        $q      = 'CALL detail_compte_sans_solde("'.$period.'","'.$compte.'");';
+        
+        $res    = $this->doQueryImpr($q);
+
+        //echo "".$q." ";
+        $this->SetFont('Arial','',10);
+        $this->AddPage();
+        
+        $this->Ln();
+        $this->Ln();
+        $this->Copro($compte);
+        $this->Ln();
+        $this->DetailLots($compte);
+        $this->Ln();
+        $this->Titre("Compte ".$compte);
+        $this->ImprovedTable( $header,$res['records']);
+        //
+        $this->Solde($period,$compte);
+        // For test pupose
+        $this->Ln();
+        try {
+            $exercice = $this->Exercice($period);
+            // Exercice Clos
+            if ($exercice[1] == 0) {
+                   $this->Ln();
+                  $this->Detail($period,$compte);
+            } else {
+                $this->Cell(50,5,"Exercice Clos.");
+                $this->Ln();
+                $this->Detail($period,$compte);
+            }
+        } catch (Exception $e) {
+            $this->Cell(50,5,"Failed :".$e->getMessage());
+        }
+        $this->Output();
+    }
+    function UserIdFromAccount($account) {
+       $q	= "select jia_ident from JoinIdentityAccount WHERE jia_acc = ".$account.";";
+       $res	= $this->doQueryImpr($q);
+       return   $res['records'][0][0];
+    }
+    /**
+     *
+     */
+    private function Detail($period,$compte) {
+        $opt = Array();
+        $retrieve = new Retrieve(
+                     $this->session,
+                     $this->auth_conf,
+                     $this->_dbname);
+
+
+        $result = $retrieve->getSoldeAccount($period,$compte,$opt);
+        $dt     = $result['detail_charge'];
+        
+        $exercice = $this->Exercice($period);
+        // Exercice Clos
+          if ($exercice[1] == 0) {
+            $this->Titre("Detail exercice en cours");
+          } else
+          {
+            $this->Titre("Detail exercice ");
+          }
+          $this->SetFont('Arial','',10);
+          $this->Ln();
+          foreach($dt as $row) {
+             $this->Cell(50,5,iconv('utf8','iso8859-1',$row[0]));
+             $this->Cell(40,5,$row[1]." euros",0,1,'R');
+             //$this->Ln();
+          }
+          $this->Titre("Total charges ".$result['total_charge']." euros");
+          $this->Titre("Total appels de fonds ".$result['total_appel']." euros");
+          // Detail postes charges
+          $this->AddPage();
+          $this->Ln();
+          $page_height = 286.93;
+          foreach (array(1,4,5) as $row)
+          {
+            $space_left = $page_height - ($this->getY());
+            if ( $space_left < 20)
+            {
+                $this->AddPage();
+                $this->Ln();
+            } else {
+                $this->Ln();
+            }
+            $this->DetailPc($period,$compte,$row);
+            $this->Ln(05);
+          }
+    }
+    /**
+     */
+    private function DetailPc($period,$cpt,$pcs) {
+       $uid	= $this->UserIdFromAccount($cpt);
+       $this->Titre("Poste Charge PC".$pcs);
+       $q	= "CALL detail_decompte_charge(".$uid.",".$pcs.",".$period.",2);";
+       $res	= $this->doQueryImpr($q);
+       $ch 	= 4;
+       $total	= 0.0;
+       $tot_fra = 0.0;
+    /* 
+     */
+       if ($res['records'] != "Failed") {
+               $header	= array('Date','Référence','Total','Tantième','Fraction');
+               $data 	= $res['records'];
+	       $i = 0;
+	       // Column widths
+	       $w = array(20, 70, 35, 30,30);
+	       $wt = array(90, 35, 30,30);
+	      // Header
+	       for($i=0;$iCell($w[$i],7,iconv('UTF-8','iso8859-1',$header[$i]),1,0,'C');
+	       
+               $this->Ln();
+	      // Data
+		   $this->SetFont('Arial','',8);
+	       foreach($data as $row)
+	       {
+		   $this->Cell($w[0],$ch,$row[0],'LR');
+                   $total = $total + $row[4];
+		   //$this->Cell($w[1],$ch,$row[3],'LR');
+		   $this->Cell($w[1],$ch,iconv('UTF-8','iso8859-1',$row[3]),'LR');
+
+		   $this->Cell($w[2],$ch,$row[4],'LR',0,'R');
+		   if ($row[5] == 0.0 ) {
+		       $this->Cell($w[3],$ch,'','LR',0,'R');
+		   } else
+		       $this->Cell($w[3],$ch,number_format($row[5],2),'LR',0,'R');
+		   if ($row[6] == 0.0) {
+		       $this->Cell($w[4],$ch,'','LR',0,'R');
+		   } else
+		       $this->Cell($w[4],$ch,number_format($row[6],2),'LR',0,'R');
+                   $tot_fra = $tot_fra + $row[6];
+		   $this->Ln();
+		   if ($i++ > 30) 
+		   {
+		       $i = 0;
+		       $this->AddPage();
+		       $this->Ln();
+		   }
+	       }
+	       $this->SetFont('Arial','',10);
+	       // Closing line
+	       $this->Cell(array_sum($w),0,'','T');
+	       $this->Ln();
+               // Write totals
+	       $this->Cell($wt[0],$ch,"Total",'LR',0,'L');
+	       $this->Cell($wt[1],$ch,number_format($total,2),'LR',0,'R');
+	       $this->Cell($wt[2],$ch,"-",'LR',0,'R');
+	       $this->Cell($wt[3],$ch,number_format($tot_fra,2),'LR',0,'R');
+	       $this->Ln();
+	       $this->Cell(array_sum($w),0,'','T');
+	       $this->Ln();
+         
+       }
+    }
+
+    /**
+     * This function returns the information related to the exercice
+     *  Return the state (how the charges are going to be dispatched
+     *   IF the exercice is closed
+     *   If the exercice has been approved.
+     */
+    private function Exercice ($dt)
+    {
+        $q = "select per_repart_charge_end,per_closed,per_approved from Period WHERE per_string = ".$dt.";";
+        $res = $this->doQueryImpr($q);
+        return $res['records'][0];
+    }
+
+    /**
+     * What the problem
+     */
+    function Footer() {
+       $this->SetY(-15);
+       $this->SetFont('Arial','I',8);
+       $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}','C');
+       $this->SetY(-15);
+       $this->SetX(90);
+       $this->Cell(0,10,'https://syndic.ebersold.fr/','C');
+       
+    }
+
+}
+
+/**
+ *
+ */
+GLOBAL $conf;
+$conf_auth = $conf['auth']['mysql'];
+$_session  = new SessionCompta($conf_auth,$conf_auth['req_file']);
+
+$_database = "";
+$period    = "";
+$_database = $_session->getDb(); 
+
+if (isset($_GET['period'])) { $period = $_GET['period'];} else { $period = Date('Y');};
+if ($_database == "") {
+  error_log("annexe.php no database in session too bad");
+  die();
+}
+
+if (isset($_SESSION['compta_db'])) {
+  $ldb =  $_SESSION["compta_db"] ;
+} else 
+   $ldb = 'test';
+$p = new DecompteCharge($_session,
+                        $conf_auth,
+                        $_database);
+
+if ($_session->is_logged_in() ) {
+  $p->AliasNbPages();
+  if (isset($_GET['compte']) &&  isset($_GET['period'])) {
+      $p->Decompte($_GET['period'],$_GET['compte']);
+  } else {
+      $p->Decompte($_session->getCurrentExercice(),"450001");
+  }
+
+ 
+} else {
+  // redirect to login
+  header("Location: /app/member/login.php");
+  die();
+}
+
+
+
+?>
+
diff --git a/app/compta/reports/recu_taxe.php b/app/compta/reports/recu_taxe.php
new file mode 100644
index 0000000..ff8827a
--- /dev/null
+++ b/app/compta/reports/recu_taxe.php
@@ -0,0 +1,195 @@
+SetFillColor(255);
+        $this->SetFont('Arial','',10);
+        $this->Cell(50,5,"CERFA N 11580*02 ");
+        $this->Text(140,14," Numéro d'ordre du reçu : ");
+        $this->Ln();
+        $this->Cell(50,5,"Assiciation TICOS");
+        $this->Ln();
+        $this->Cell(50,5,"16 rue St Louis ...");
+        $this->Ln();
+        $this->Cell(50,5,"60100 STRASBOURG");
+        $this->Ln();
+        $this->Ln();
+        $this->Ln();
+        
+        $this->SetFont('Arial','',14);
+        $this->SetFillColor(220);
+        $this->RoundedRect(80,20,95,20,5,"1234","DF");
+        $this->Text(85,27,"Reçu au titre de dons au oeuvres");
+        $this->SetFont('Arial','',10);
+        $this->Text(85,32,"(Article 200 et 238 bis du Code Général des impôts)");
+    
+    }
+
+    // Better table
+    function ImprovedTable($header, $data)
+    {
+       $i = 0;
+       // Column widths
+       $w = array(20, 35, 70, 30,30);
+      // Header
+       for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C');
+       $this->Ln();
+      // Data
+       foreach($data as $row)
+       {
+           $this->Cell($w[0],6,$row[0],'LR');
+           $this->Cell($w[1],6,$row[1],'LR');
+           $this->Cell($w[2],6,$row[2],'LR',0,'R');
+           if ($row[3] == 0.0 ) {
+               $this->Cell($w[3],6,'','LR',0,'R');
+           } else
+               $this->Cell($w[3],6,number_format($row[3],2),'LR',0,'R');
+           if ($row[4] == 0.0) {
+               $this->Cell($w[4],6,'','LR',0,'R');
+           } else
+               $this->Cell($w[4],6,number_format($row[4],2),'LR',0,'R');
+           $this->Ln();
+           if ($i++ > 30) 
+           {
+               $i = 0;
+               $this->AddPage();
+               $this->Ln();
+           }
+       }
+       // Closing line
+       $this->Cell(array_sum($w),0,'','T');
+    }
+    //
+
+    function Solde($period,$compte) {
+       $w = array(125, 30,30);
+       $header = array('Solde','Debit','Credit');
+       $q = 'CALL solde_compte("'.$period.'","'.$compte.'");';
+       $this->Ln();
+       
+       $res    = $this->doQueryImpr($q);
+       $this->Cell(array_sum($w),0,'','T');
+       $this->Ln();
+       $this->Ln();
+       $c = new chiffreEnLettre();
+         
+       $v = $res['records'][0][2];
+       $this->Cell(10,5,"Le bénéficiaire reconnait avoir reçu au titre des dons et versements ouvrant droit à réduction d'impôt,");
+       $this->Ln();
+       $this->Cell(10,5,"la somme de :".$res['records'][0][2]." euros");
+       $this->Ln();
+       $this->Cell(50,5,"Somme en toutes lettres:  ".$c->ConvNumberLetter($v,1,0));
+       $this->Ln();
+       $this->Cell(10,6,"Date du versement :");
+       $this->Ln();
+       $this->Cell(10,6,"Mode du versement :");
+    
+    }
+    function Beneficiaire($compte) {
+        $x = 10;
+        $this->SetFont('Arial','',12);
+        $this->Cell(10,6,"Bénéficiaire des dons");
+        $this->SetFont('Arial','',10);
+        $this->Ln();
+        $this->Ln();
+        $y = $this->getY();
+        $q = 'select ident_name,ident_firstname,ident_address,ident_postalcode,ident_city from Identity as i ';
+        $qj= 'JOIN JoinIdentityAccount as j on j.jia_ident = i.ident_id and j.jia_acc ='.$compte.';';
+        $res    = $this->doQueryImpr($q.$qj);
+        $ident = $res['records'][0];
+        $this->Text($x,$y    ,"Nom : ");
+        $this->Text($x+25,$y,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,$y+6  ,"Adresse : ");
+        $this->Text($x+25,$y+6,"".$ident[2]);
+        $this->Text($x,$y +12,"Code Postal : ");
+        $this->Text($x+25,$y +12,"".$ident[3]." ".$ident[4]);
+        $this->setY($y+18);
+    }
+
+
+    function Donateur($compte) {
+        $x = 10;
+        $this->SetFont('Arial','',12);
+        $this->Cell(10,6,"Donateur");
+        $this->SetFont('Arial','',10);
+        $this->Ln();
+        $this->Ln();
+        $y = $this->getY();
+        $q = 'select ident_name,ident_firstname,ident_address,ident_postalcode,ident_city from Identity as i ';
+        $qj= 'JOIN JoinIdentityAccount as j on j.jia_ident = i.ident_id and j.jia_acc ='.$compte.';';
+        $res    = $this->doQueryImpr($q.$qj);
+        $ident = $res['records'][0];
+        $this->Text($x,$y    ,"Nom : ");
+        $this->Text($x+25,$y,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,$y+6  ,"Adresse : ");
+        $this->Text($x+25,$y+6,"".$ident[2]);
+        $this->Text($x,$y +12,"Code Postal : ");
+        $this->Text($x+25,$y +12,"".$ident[3]." ".$ident[4]);
+        $this->setY($y+18);
+    }
+
+
+    function Copro($compte) {
+        $x = 120;
+        $y = 60;
+        $q = 'select ident_name,ident_firstname,ident_address,ident_postalcode,ident_city from Identity as i ';
+        $qj= 'JOIN JoinIdentityAccount as j on j.jia_ident = i.ident_id and j.jia_acc ='.$compte.';';
+        $res    = $this->doQueryImpr($q.$qj);
+        $ident = $res['records'][0];
+        $this->Text($x,$y,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,$y+6,"".$ident[2]);
+        $this->Text($x,$y +12,"".$ident[3]." ".$ident[4]);
+        $this->setY($y+18);
+    }
+
+    function Decompte($period,$compte) {
+        $header = array('Date','Reference','Designation','Debit','Credit');
+        $q = 'CALL detail_compte_sans_solde("'.$period.'","'.$compte.'");';
+        //$q = 'select * from TransactionEntry;';
+        $res    = $this->doQueryImpr($q);
+
+        //echo "".$q." ";
+        //print_r($res);
+        $this->SetFont('Arial','',10);
+        $this->AddPage();
+        //$this->Cell(40,10,$q." Size of records:".sizeof($res['total_matches']));
+        $this->Ln();
+        $this->Ln();
+        $this->Copro($compte);
+        $this->Ln();
+        $this->Beneficiaire($compte);
+        $this->Donateur($compte);
+        //$this->ImprovedTable( $header,$res['records']);
+        //$this->AddPage();
+        $this->Solde($period,$compte);
+        $this->Output();
+    }
+}
+
+//$p = new DecompteCharge('localhost','root','admin','test');
+$p = new DecompteCharge($conf['auth']['mysql']['host'],$conf['auth']['mysql']['user'],$conf['auth']['mysql']['password'],'test');
+
+if (isset($_GET['compte']) &&  isset($_GET['period'])) {
+    $p->Decompte($_GET['period'],$_GET['compte']);
+} else {
+    $p->Decompte("2013","450001");
+}
+
+?>
+
diff --git a/app/compta/reports/syndic_annexe1.php b/app/compta/reports/syndic_annexe1.php
new file mode 100644
index 0000000..15ffedb
--- /dev/null
+++ b/app/compta/reports/syndic_annexe1.php
@@ -0,0 +1,514 @@
+pdf    = new TCPDF('L',PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+        $this->pdf    = $pdf;
+        $this->period = $period; 
+        //$this->data   = new AnnexeData(null,$auth_cfg,$db);
+        $this->data   = $db;
+    }
+
+    function __destruct() {
+    }
+
+    function getAccountList($category)
+    {
+        return $this->data->getAccountList($category);
+    }
+
+    function getAccountListWhere($where)
+    {
+         return $this->data->getAccountListWhere($where);
+    }
+
+    private function fillTresorerie($period,&$res,&$total) 
+    { 
+        $res  = array();
+        $cpts = array('50','51','53');
+        $cpts_title= array('50' => "50 Fonds placés",'51' => "51 Banques ou fonds disponibles en banque" ,'53' => "53 Caisse");
+        // Retrieve banque accounts
+        $result = $this->data->getSoldCompte($cpts,$period,$total);
+        foreach ($cpts as $k )
+        {
+            $res[$k] = Array('title' => $cpts_title[$k], 'value' => $result[$k] * -1.0);
+        }
+        $str = ($result['50'])."
+  {$p1} 
+  {$p2} 
+  {$p3} 
+  {$p4} 
+  {$p5} 
+  {$p6} 
+ 
+_EOF;
+        return  $str;
+    }
+    
+    /**
+     *
+     *
+     */
+    private function row6Total($p1,$p2,$p3,$p4,$p5,$p6)
+    {
+        $str=<<<_EOF
+
+  {$p1} 
+  %.2f   
+  %.2f 
+  {$p4} 
+  %.2f 
+  %.2f 
+ 
+_EOF;
+        return  sprintf($str,$p2,$p3,$p5,$p6);
+    }
+    
+    /**
+     *
+     *
+     */
+    private function row6($p1,$p2,$p3,$p4,$p5,$p6)
+    {
+        $str=<<<_EOF
+{$p1} {$p2} {$p3}  {$p4} {$p5} {$p6} 
+
+_EOF;
+        $tplt =<<<_EOF
+%s 
+    %.2f   
+    %.2f   
+
";
+        return $html;
+    }
+
+    /**
+     *
+     *
+     */
+    private function tresorerie()
+    {
+        $tot_tres      = 0.0;
+        $tot_tres_clos = 0.0;
+        $res_n         = null;
+        $res_nm1       = null;
+        $tres          = $this->fillTresorerie($this->period-1,$res_nm1,$tot_tres);
+        $tres_clos     = $this->fillTresorerie($this->period  ,$res_n,$tot_tres_clos );
+        $html =<<<_EOF
+
+_EOF;
+        $tplt =<<<_EOF
+%s 
+    %.2f   
+    %.2f   
+
";
+        return $html;
+    }
+    /**
+     *
+     *
+     */
+    function tableau() {
+      $tiers = array("40" => array('acc_id' => 40),
+                     '42' => array('acc_id' => 42),
+                     '43' => array('acc_id' => 43),
+                     '44' => array('acc_id' => 44),
+                     '46' => array('acc_id' => 46),
+                     '47' => array('acc_id' => 47),
+                     '48' => array('acc_id' => 48),
+                     '49' => array('acc_id' => 49)
+                     );
+    $tplt_title = <<
+        
+      Exercice précédent approuvé Exercice Clos   
+      Exercice précédent approuvé Exercice Clos 
+  I- SITUATION FINANCIERE ET TRESORERIE '.$this->tresorerie();
+      $tbl.=" ".$this->provision()." II - CREANCES DETTES 
+EOF;
+      $tbl .= $tplt_title;
+      $tbl .= <<
+  
+        45 Coproriétaires - sommes exigibles restant à recevoir   
+      
+          
+      
+         
+      
+        
+        45 Copropriétaires - excédents versés  
+       
+      
+        
+        
+    Total II 
+    {$total_creance} 
+    {$total_creance_clos} 
+    Total II 
+    {$total_dette} 
+    {$total_dette_clos}  
+  
+    Total général (I) + (II) 
+    {$total_g_creance} 
+    {$total_g_creance_clos} 
+    Total général (I) + (II) 
+    {$tg2p4_str} 
+    {$tg2p4_clos_str}  
+    Emprunts: montant restant du 
+     Annexe N°1
+Etat financier après répartition au {$period['end']} 
+Annexe N°2
+  Comptes de gestion général de l'exercice clos réalisé (N) du {$period['begin']} au {$period['end']} 
+  et budget prévisionnel de l'exercice (N+2) du {$period2['begin']} au {$period2['end']} 
+
+ 
+     CHARGES POUR OPERATIONS COURANTES 
+         PRODUITS POUR OPERATIONS COURANTES 
+     
+     Pour Approbation des comptes Pour le vote du budget prévisonnel Pour Approbation des comptes Pour le vote du budget prévisonnel 
+         Exercice précédent Exercice clos Exercice Clos réalisé Budget prévisionnel Budget prévisionnel Exercice Exercice Exercice clos Budget prévisionnel Budget prévisionnel  
+     
+     
+        
+            
+             
+     
+     
+        Sous-total
+         
+        
+           {$st['charge']}
+           
+           {$budget_n_total}
+          
+           {$st['charge_clos']}
+         
+           {$budget_n1_total}
+         
+           {$budget_n2_total}
+         Sous-total  {$st['poc']}   {$st['poc_budget']}   {$st['poc_clos']}   {$st['poc_budget_n1']}   {$st['poc_budget_n2']}   
+     
+     
+        Solde(excédent s opérations courantes affecté au
+          coprorpiétaires)
+         
+        
+           N/C 
+         N/C N/C Solde(insuffisance s/opérations courantes affectée aux corpropriétaires) N/C N/C N/C  
+     
+     
+        Total I
+         
+        
+           {$st['charge']}
+           
+           {$budget_n_total}
+          
+           {$st['charge_clos']}
+         
+           {$budget_n1_total}
+         
+           {$budget_n2_total}
+         Total I  
+     
+     
+        
+           CHARGES POUR TRAVAUX ET AUTRES OPERATIONS EXCEPTIONNELLES
+         
+        
+         
+          PRODUITS POUR TRAVAUX ET AUTRES OPERATIONS EXCEPTIONNELLES
+          
+     
+     
+         
+     
+     
+        Solde(excédent)
+         
+        
+           
+          
+         Solde(insuffisant)  
+     
+     
+        Total II
+         
+        
+           {$st['chrg_exp']}
+           
+           {$st['chrg_exp_budget']}
+          
+           {$st['chrg_exp_clos']}
+         Total II  
+  
+    
+   
+ 
+EOF;
+   $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
+  }
+    /**
+     *
+     */ 
+    function generate() {
+      $pdf = $this->pdf;
+// Set font
+// dejavusans is a UTF-8 Unicode font, if you only need to
+// print standard ASCII chars, you can use core fonts like
+// helvetica or times to reduce file size.
+
+// Add a page
+// This method has several options, check the source code documentation for more information.
+      $pdf->AddPage('L','A4');
+      $html = <<setHeaderTemplateAutoreset(true);
+// Print text using writeHTMLCell()
+        $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
+        $pdf->SetFont('dejavusans', '', 8, '', true);
+        $this->annexe2()  ;
+    }
+    /**
+     *
+     */
+    function Output($fn,$m) {
+        $this->pdf->Output($fn,$m);
+    }
+}
+
+/**
+ * For test purpose
+ */
+$ldb ="";
+if (isset($_SESSION['compta_db'])) {
+  $ldb =  $_SESSION["compta_db"] ;
+} else 
+   $ldb = 'SYNDIC25RUEPFEFFINGER';
+
+//GLOBAL $conf;
+//$conf_auth = $conf['auth']['mysql'];
+
+//$t = new annexe2($conf_auth, $ldb);
+
+//$t->test();
+//$t->Output('annexe2.pdf', 'I');
+
+/**
+  vim:et:sw=2:ts=2:fileencoding=utf-8
+*/
+?>
diff --git a/app/compta/reports/syndic_annexe3.php b/app/compta/reports/syndic_annexe3.php
new file mode 100644
index 0000000..964b19b
--- /dev/null
+++ b/app/compta/reports/syndic_annexe3.php
@@ -0,0 +1,298 @@
+pdf    = $pdf; 
+      $this->data   = $data; 
+      $this->period = $period;
+  }
+  function __destruct() {
+  }
+  
+  function getPeriod($per) {
+    $q = "SELECT per_begin,per_end FROM Period where per_string ='".$per."';";
+    $r = $this->data->doQueryI($q);
+    $this->per_begin = $r['records'][0][0];
+    $this->per_end   = $r['records'][0][1];
+  }
+
+
+    public function generate()
+    {
+        $this->pdf->addPage('P','A4');
+        $period = $this->data->getPeriod($this->period);
+        $period2 = $this->data->getPeriod($this->period+2);
+        $html =<<Annexe N°3
+Comptes de gestion pour opérations courantes de l'exercice clos réalise (N {$this->period}) du {$period['begin']} au {$period['end']} 
+et budget previsionnel de l'exercice (N+2) du {$period2['begin']} au {$period2['end']} 
+
+__EOF;
+      $table_end=<<<__EOF
+          
+__EOF;
+     $table_begin.= $this->table_header();
+     $table_begin.= $this->table_row("TRAVAUX de L'ARTICLE 14-2"," "," "," "," ");
+     $table_begin.= $this->table_row("TOTAL TRAVAUX de L'ARTICLE 14-2"," "," "," "," ");
+     $table_begin.= $this->table_row("TOTAL OPERATIONS EXCEPTIONNELLES"," "," "," "," ");
+     $table_begin.= $table_end;
+     return $table_begin;
+  }
+  /**
+   *
+   *
+   */
+  private function table_row($p1,$p2,$p3,$p4,$p5)
+  {
+      $_row=<<<__EOF
+  
+{$p1} 
+{$p2} 
+{$p3} 
+{$p4} 
+{$p5} 
+ 
+__EOF;
+     return $_row;
+  }
+  /**
+   *
+   *
+   */
+  private function table_header()
+  {
+      $_row=<<<__EOF
+  Exercice clos dépenses votées(N) 
+Exercice clos réalisé à approuver (N) 
+
+DEPENSES 
+PROVISIONS APPELEES 
+SOLDE 
+ 
+__EOF;
+     return $_row;
+  }
+
+  /**
+   *
+   */
+    function generateNew() {
+        $digits = 2;
+        $q = "select pc_id,pc_name from PosteCharge;";
+        $pc = $this->data->doQueryI($q);
+        $st = array('exercice' => 0, 'exercice_nm1' => 0,'budget' => 0 , 'budgetn1' => 0,'budgetn2' => 0);
+        $entries = "";
+        $accounts = array();
+        $pdf = $this->pdf;
+        $this->data->fillAccountsWhere($accounts,$this->period,"a.acc_id REGEXP '(^6.*)'","amount");
+        $this->data->fillAccountsWhere($accounts,$this->period-1,"a.acc_id REGEXP '(^6.*)'","am1");
+        //$bu = $this->getBudgetListWhere($this->period,"a.acc_id REGEXP '(^6.*)'");
+        $this->data->fillBudgetListWhere($accounts,$this->period,"a.acc_id REGEXP '(^6.*)'","bu");
+        $this->data->fillBudgetListWhere($accounts,$this->period+1,"a.acc_id REGEXP '(^6.*)'","bu1");
+        $this->data->fillBudgetListWhere($accounts,$this->period+2,"a.acc_id REGEXP '(^6.*)'","bu2");
+        $bu1 = $this->data->getBudgetListWhere($this->period+1,"a.acc_id REGEXP '(^6.*)'");
+        $bu2 = $this->data->getBudgetListWhere($this->period+2,"a.acc_id REGEXP '(^6.*)'");
+
+        $pm1 = $this->period - 1;
+        foreach ($pc['records'] as $ch)
+        {
+            $entries.=''.$ch[1].' ";
+                    $entries.='';
+                    $entries.="".$k.' - '.$c['name']." ";
+                } else {
+                    continue;
+                }
+                // First Col  2
+                $entries.='';
+                if ( ($c[$this->period]['pc'] == $ch[0] )
+                   || ($c[$pm1]['pc'] == $ch[0] )
+                   || $c[$this->period-1]['pc'] == $ch[0] 
+                   || $c[$this->period]['bu_pc'] == $ch[0] 
+                   || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+                ) {
+                  if ($c[$pm1]['pc'] == $ch[0]) {
+                    $entries.="".number_format($c['am1'],$digits)."";
+                    $st['exercice_nm1'] += $c['am1'];
+                  } else
+                    $entries.="-";
+                }
+                $entries.=" ";
+                // First Col  3
+                $entries.='';
+                $e = $this->period.$ch[0]."bu";
+                if ($c[$this->period]['pc'] == $ch[0]
+                   || $c[$this->period-1]['pc'] == $ch[0] 
+                   || $c[$this->period]['bu_pc'] == $ch[0] 
+                   || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+                ) {
+                  if ($c[$this->period]['bu_pc'] == $ch[0] ) {
+                    $entries.=number_format($c[$e],$digits).""."";
+                    $st['budget'] += $c[$e];
+                  } else
+                    $entries.="-";
+                }
+                $entries.=" ";
+                // First Col  4
+                $entries.='';
+                if ($c[$this->period]['pc'] == $ch[0]
+                   || $c[$this->period-1]['pc'] == $ch[0] 
+                   || $c[$this->period]['bu_pc'] == $ch[0] 
+                   || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+                   ) {
+                     if ($c[$this->period]['pc'] == $ch[0]) {
+                       $entries.=number_format($c['amount'],$digits)."";
+                       $st['exercice'] += $c['amount'];
+                     } else
+                       $entries.="-";
+                   }
+                $entries.=" ";
+                // First Col  5
+                $entries.='';
+                $e = ($this->period+1).$ch[0]."bu1";
+                if ($c[$this->period]['pc'] == $ch[0]
+                   || $c[$this->period-1]['pc'] == $ch[0] 
+                   || $c[$this->period]['bu_pc'] == $ch[0] 
+                   || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+                ) {
+                  if ($c[$this->period+1]['bu1_pc'] == $ch[0] ) {
+                    $entries.=number_format($c[$e],$digits).""."";
+                    $st['budgetn1'] += $c[$e];
+                  } else
+                    $entries.="-";
+                }
+                $entries.=" ";
+                // First Col  6
+                $entries.='';
+                $e = ($this->period+2).$ch[0]."bu2";
+                if ($c[$this->period]['pc'] == $ch[0]
+                   || $c[$this->period-1]['pc'] == $ch[0] 
+                   || $c[$this->period]['bu_pc'] == $ch[0] 
+                   || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+                ) {
+                  if ($c[$this->period+2]['bu2_pc'] == $ch[0] ) {
+                    $entries.=number_format($c[$e],$digits).""."";
+                    $st['budgetn2'] += $c[$e];
+                  } else
+                    $entries.="-";
+                }
+                $entries.=" ";
+                $entries.=" ";
+            }
+            $entries.='
+.charge { border: 1px solid #000; }
+.num { border-top: 0px solid #FFF; border-bottom: 0px solid #FFF; border-left:1px solid #000; border-right:1px solid #000;}
+.num-last { border-top: 0px solid #FFF; border-bottom: 1px solid #000; border-left:1px solid #000; border-right:1px solid #000;}
+.ligne2 { border-bottom: 0px solid #FFF;}
+.ligne3 { border-top: 0px solid #FFF; border-bottom: 0px solid #FFF;}
+.ligne4 { border-top: 0px solid #FFF; }
+
+ 
+       
+         
+         CHARGES POUR OPERATIONS COURANTES   
+             Pour approbation des comptes 
+             Pour le vote du budget prévisionnel 
+         
+              Exercice précédent approuvé Exercice clos budget vote Exercice clos réalise à approuver Budget prévisionnel en cours Budget prévisionnel à voter  
+         
+        
+              
+            N-1 N N 
+            N+1  N+2 
+          
+         
+         {$entries}
+         
+         
+           TOTAL CHARGES NETTES 
+           {$st['exercice_nm1']} 
+           {$st['budget']} 
+           {$st['exercice']} 
+           {$st['budgetn1']} 
+           {$st['budgetn2']} 
+          
+         
+           Provision coproprietaires 
+            
+         
+           Solde (excedent ou insuffisance s/opérations courantes affecte aux copropriétaires  
+          
+        
+     
+
+EOF;
+   $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
+  }
+
+}
+
+
+?>
diff --git a/app/compta/reports/syndic_annexe4.php b/app/compta/reports/syndic_annexe4.php
new file mode 100644
index 0000000..b37c9a8
--- /dev/null
+++ b/app/compta/reports/syndic_annexe4.php
@@ -0,0 +1,97 @@
+pdf = $pdf; 
+      $this->db  = $data; 
+      $this->period = $period;
+  }
+  function __destruct() {
+  }
+
+  public function generate()
+  {
+      $this->pdf->addPage('L','A4');
+      $html =<<Annexe N°4
+  Comptes de gestion pour travaux  de l'article 14-2 et opérations exceptionnelles
+  hors budget prévisionnel de l'exercice clos réalisés (N {$this->period}) du {$this->per_begin} au {$this->per_end} 
+  
+__EOF;
+      $table_end=<<<__EOF
+          
+__EOF;
+     $table_begin.= $this->table_header();
+     $table_begin.= $this->table_row("TRAVAUX de L'ARTICLE 14-2"," "," "," "," ");
+     $table_begin.= $this->table_row("TOTAL TRAVAUX de L'ARTICLE 14-2"," "," "," "," ");
+     $table_begin.= $this->table_row("TOTAL OPERATIONS EXCEPTIONNELLES"," "," "," "," ");
+     $table_begin.= $table_end;
+     return $table_begin;
+  }
+  /**
+   *
+   *
+   */
+  private function table_row($p1,$p2,$p3,$p4,$p5)
+  {
+      $_row=<<<__EOF
+  
+{$p1} 
+{$p2} 
+{$p3} 
+{$p4} 
+{$p5} 
+ 
+__EOF;
+     return $_row;
+  }
+  /**
+   *
+   *
+   */
+  private function table_header()
+  {
+      $_row=<<<__EOF
+  Exercice clos dépenses votées(N) 
+Exercice clos réalisé à approuver (N) 
+
+DEPENSES 
+PROVISIONS APPELEES 
+SOLDE 
+ 
+__EOF;
+     return $_row;
+  }
+
+
+}
+
+
+?>
diff --git a/app/compta/reports/syndic_annexe_data.php b/app/compta/reports/syndic_annexe_data.php
new file mode 100644
index 0000000..7f10513
--- /dev/null
+++ b/app/compta/reports/syndic_annexe_data.php
@@ -0,0 +1,267 @@
+session   = $_session;
+        $this->auth_conf = $auth_cfg;
+        parent::__construct($auth_cfg[SQL_SERVER],$auth_cfg[SQL_USER],$auth_cfg[SQL_PASSWD],$db);
+        $this->period = date("Y");
+    }
+
+    /**
+     *
+     */
+    function __destruct() {
+    }
+
+    function getRetrieve() {
+            return new Retrieve(
+                     $this->session,
+                     $this->auth_conf,
+                     $this->session->getDb());
+
+    }
+    /**
+     *
+     */
+    function getPeriod($per)
+    {
+        $q = "SELECT per_begin,per_end FROM Period where per_string ='".$per."';";
+        $r = $this->doQueryI($q);
+        return array('begin' => $r['records'][0][0], 'end' => $r['records']['0']['1']);
+    }
+
+    /**
+     *
+     */
+    function getAccountList($category)
+    {
+        $q="select a.acc_id ,LEFT(a.acc_name,32) from  Account as a ";
+        $w=" WHERE a.acc_id LIKE '".$category."%' and not a.acc_id='450000';"; 
+        $res    = $this->doQueryI($q.$w);
+        $ident = $res['records'];
+        $arr = array();
+        foreach ($ident as $row)
+        {
+            array_push($arr,array('acc_id' => $row[0], 'acc_desc' => $row[1]));
+        }
+        return $arr;
+    }
+
+    /**
+     *
+     */
+    function getAccountListWhere($where)
+    {
+        $q="select a.acc_id ,SUBSTRING(a.acc_name,1,32) from  Account as a ";
+        $w=" WHERE ".$where.";"; 
+        $res    = $this->doQueryI($q.$w);
+        $ident = $res['records'];
+        $arr = array();
+        foreach ($ident as $row)
+        {
+            array_push($arr,array('acc_id' => $row[0], 'acc_desc' => $row[1]));
+        }
+        return $arr;
+    }
+
+    /**
+     *
+     */
+    function getBudgetListWhere($anne,$where)
+    {
+        $q=<<doQueryI($q);
+        
+        return $res['records'];
+    }
+    
+    function getSoldCompte($cpts,$period,&$total) 
+    { 
+      // Retrieve banque accounts
+      $result = array();
+       foreach($cpts as $compte) {
+           $q = "call solde_compte_where('".$period."','t.acc_id like \"".$compte."%\"');";
+           $res = $this->doQueryI($q);
+           $result[$compte] = $res['records'][0][2];
+           $total += ($result[$compte]*-1);
+       }
+      return $result;
+    }
+
+    /**
+     *
+     *
+     */
+    function fillAccountsType(&$cpts,$period,$key,$ot) {
+       foreach($cpts as $k => $compte) {
+           $q = "call solde_compte_where('".$period."',' t.entry_type = \"".$ot."\" and t.acc_id like \"".$compte['acc_id']."%\"');";
+           $res = $this->doQueryI($q);
+           $cpts[$k][$key] = $res['records'][0][2];
+           $cpts[$k][$key."_debit"] = $res['records'][0][0];
+           $cpts[$k][$key."_credit"] = $res['records'][0][1];
+       }
+    }
+
+    /**
+     *
+     *
+     */
+    function fillCopro(&$copro,$period,$key) {
+       foreach($copro as $k => $compte) {
+           $q = "call solde_compte_where('".$period."','t.acc_id like \"".$compte['acc_id']."%\"');";
+           $res = $this->doQueryI($q);
+           $copro[$k][$key] = $res['records'][0][2];
+       }
+    }
+
+    /**
+     *
+     *
+     */
+    function fillTier(&$cpts,$period,$key) {
+       foreach($cpts as $k => $compte) {
+           $q = "call solde_compte_where('".$period."','t.acc_id like \"".$k."%\"');";
+           $res = $this->doQueryI($q);
+           $cpts[$k][$key] = $res['records'][0][2];
+       }
+    }
+    /**
+     *
+     *
+     */
+    function fillAccounts(&$cpts,$period,$key)
+    {
+       foreach($cpts as $k => $compte) {
+           $q = "call solde_compte_where('".$period."','t.acc_id like \"".$compte['acc_id']."%\"');";
+           $res = $this->doQueryI($q);
+           $cpts[$k][$key] = $res['records'][0][2];
+           $cpts[$k][$key."_debit"] = $res['records'][0][0];
+           $cpts[$k][$key."_credit"] = $res['records'][0][1];
+       }
+    }
+    /**
+     *
+     *
+     */
+    function fillAccountsWhere (&$cpts,$period,$where,$res_key) {
+        $q =<<doQueryI($q);
+        foreach ($res['records'] as $line) {
+          $cpts[$line[0]][$res_key] = $line[2];
+          $cpts[$line[0]]['name'] = $line[1];
+          $cpts[$line[0]][$period]['name'] = $line[1];
+          $cpts[$line[0]][$period]['pc'] = $line[3];
+          $cpts[$line[0]][$period.$line[3].$res_key] = $line[2];
+        }
+    }
+    /**
+     *
+     *
+     */
+    function fillBudget(&$cpts,$period,$key)
+    {
+       foreach($cpts as $k => $compte) {
+        $q=<<doQueryI($q);
+           $cpts[$k][$key] = $res['records'][0][0];
+       }
+    }
+
+    /**
+     *
+     *
+     */
+    function fillBudgetListWhere(&$cpts,$period,$where,$key) {
+        $q=<<doQueryI($q);
+        
+        foreach ($res['records'] as  $b) {
+            $acc = $b[0];
+            $e   = $period.$b[3].$key;
+            //error_log("annexe::fillBudgetListWhere SET: ".$b[0]." ".$period.$b[3].$key." =".$b[2]);
+            $cpts[$acc][$e] = $b[2];
+            $cpts[$acc][$period][$key.'_pc'] = $b[3];
+        }
+    }
+
+    /**
+     *
+     */
+    function getUserIdFromAccount($account) {
+       $q	= "select jia_ident from JoinIdentityAccount WHERE jia_acc = ".$account.";";
+       $res	= $this->doQueryImpr($q);
+       return   $res['records'][0][0];
+    }
+    /**
+     *
+     */
+    function getAccountsFromUid($uid) {
+        $q =<<<_EOF
+SELECT jia_acc from JoinIdentityAccount 
+WHERE jia_ident = {$uid};
+_EOF;
+        $res   = $this->doQueryImpr($q);
+        return   $res['records'][0];
+    }
+}
+
+?>
diff --git a/app/compta/reports/syndic_annexes.php b/app/compta/reports/syndic_annexes.php
new file mode 100644
index 0000000..c9ce8eb
--- /dev/null
+++ b/app/compta/reports/syndic_annexes.php
@@ -0,0 +1,1161 @@
+session   = $_session;
+      $this->auth_conf = $auth_cfg;
+      parent::__construct($auth_cfg[SQL_SERVER],$auth_cfg[SQL_USER],$auth_cfg[SQL_PASSWD],$db);
+      $this->pdf = new TCPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+      $this->period = date("Y");
+  }
+  function __destruct() {
+  }
+   
+  function getPeriod($per) {
+    $q = "SELECT per_begin,per_end FROM Period where per_string ='".$per."';";
+    $r = $this->doQueryI($q.$w);
+    $this->per_begin = $r['records'][0][0];
+    $this->per_end   = $r['records'][0][1];
+  }
+
+  function getAccountList($category) {
+      $q="select a.acc_id ,a.acc_name from  Account as a ";
+      $w=" WHERE a.acc_id LIKE '".$category."%' and not a.acc_id='450000';"; 
+      $res    = $this->doQueryI($q.$w);
+      $ident = $res['records'];
+      $arr = array();
+      foreach ($ident as $row)
+      {
+        array_push($arr,array('acc_id' => $row[0], 'acc_desc' => $row[1]));
+      }
+      return $arr;
+  }
+  function getAccountListWhere($where) {
+      $q="select a.acc_id ,a.acc_name from  Account as a ";
+      $w=" WHERE ".$where.";"; 
+      $res    = $this->doQueryI($q.$w);
+      $ident = $res['records'];
+      $arr = array();
+      foreach ($ident as $row)
+      {
+        array_push($arr,array('acc_id' => $row[0], 'acc_desc' => $row[1]));
+      }
+      return $arr;
+  }
+  function getBudgetListWhere($anne,$where) {
+        $q=<<doQueryI($q);
+        
+        return $res['records'];
+  }
+
+  function fillTresorerie($period,&$total) 
+  { 
+      $cpts = array('50','51','53');
+      // Retrieve banque accounts
+      $result = array();
+       foreach($cpts as $compte) {
+           $q = "call solde_compte_where('".$period."','t.acc_id like \"".$compte."%\"');";
+           $res = $this->doQueryI($q);
+           $result[$compte] = $res['records'][0][2];
+           $total += ($result[$compte]*-1);
+       }
+      $str = ($result['50'])."doQueryI($q);
+    foreach ($res['records'] as $line) {
+      $cpts[$line[0]][$res_key] = $line[2];
+      $cpts[$line[0]]['name'] = $line[1];
+      $cpts[$line[0]][$period]['name'] = $line[1];
+      $cpts[$line[0]][$period]['pc'] = $line[3];
+      $cpts[$line[0]][$period.$line[3].$res_key] = $line[2];
+    }
+  //WHERE  a.acc_id REGEXP '(^6.*)'
+  }
+  function fillBudget(&$cpts,$period,$key) {
+       foreach($cpts as $k => $compte) {
+     //      $q = "call solde_compte_where('".$period."','t.acc_id like \"".$compte['acc_id']."%\"');";
+        $q=<<doQueryI($q);
+           $cpts[$k][$key] = $res['records'][0][0];
+       }
+  }
+  function fillBudgetListWhere(&$cpts,$period,$where,$key) {
+        $q=<<doQueryI($q);
+        
+        foreach ($res['records'] as  $b) {
+            $acc = $b[0];
+            $e   = $period.$b[3].$key;
+            error_log("annexe::fillBudgetListWhere SET: ".$b[0]." ".$period.$b[3].$key." =".$b[2]);
+            $cpts[$acc][$e] = $b[2];
+            $cpts[$acc][$period][$key.'_pc'] = $b[3];
+           // $cpts["".$b[0]][$period][$b[3]][$key] = $b[2];
+        }
+
+  }
+
+  function annexe1() {
+      $width = 420;
+      $tiers = array("40" => array('acc_id' => 40),
+                     "42" => array('acc_id' => 42),
+                     "43" => array('acc_id' => 43),
+                     "44" => array('acc_id' => 44),
+                     "46" => array('acc_id' => 46),
+                     "47" => array('acc_id' => 47),
+                     "48" => array('acc_id' => 48),
+                     "49" => array('acc_id' => 49)
+                     );
+      
+      $pdf = $this->pdf;
+      $total_tresorerie = 0.0;
+      $total_tresorerie_clos = 0.0;
+      $tresorerie = $this->fillTresorerie($this->period-1,$total_tresorerie);
+      $tresorerie_clos = $this->fillTresorerie($this->period,$total_tresorerie_clos );
+      $prov_total      = 0.0;
+      $prov_clos_total = 0.0;
+      $prov = $this->fillProvision($this->period-1,$prov_total);
+      $prov_clos = $this->fillProvision($this->period,$prov_clos_total);
+      $prov_total_str = number_format($prov_total,2);
+      $prov_clos_total_str = number_format($prov_clos_total,2);
+      $copro        = $this->getAccountList("45");
+      $this->fillCopro($copro,$this->period-1,"solde");
+      $this->fillCopro($copro,$this->period,"solde_clos");
+      $this->fillTier($tiers,$this->period-1,"solde");
+      $this->fillTier($tiers,$this->period,"solde_clos");
+      $copro_str    = "";
+      $copro_creance = "";
+      $copro_dette   = "";
+      $copro_creance_clos = "";
+      $copro_dette_clos   = "";
+      $tiers_creance        ="";
+      $tiers_creance_clos   ="";
+      $tiers_dette          ="";
+      $tiers_dette_clos     ="";
+      $total_creance  = 0.0;
+      $total_creance_clos  = 0.0;
+      $total_dette 		=0.0;
+      $total_dette_clos 	=0.0;
+      foreach($copro as $item) {
+          $copro_str = $copro_str.$item['acc_id']." ".$item['acc_desc']."
+  I- SITUATION FINANCIERE ET TRESORERIE  
+        50 Fonds places  
+          Exercice précédent approuvé Exercice Clos  
+  $tresorerie
+           
+         
+       
+       
+       
+      $tresorerie_clos
+        
+         
+          
+   Trésorerie disponible total {$total_tresorerie} {$total_tresorerie_clos}  
+        102 Provisions pour travaux  
+       
+          Exercice précédent approuvé Exercice Clos  
+         
+          {$prov} 
+       
+       
+         
+          {$prov_clos}   
+   Total II {$prov_total_str} {$prov_clos_total_str} II - CREANCES  
+45 Copropriétaires - sommes exigibles restant percevoir   
+       
+          Exercice précédent approuvé Exercice Clos 
+      
+        
+          
+      
+         
+         
+ 
+  Total III {$total_creance} {$total_creance_clos} 
+  
+  DETTES  
+  
+     
+       
+        45 Copropriétaires - éxcédents versés  
+       
+         Exercice précédent approuvé Exercice Clos  
+ 
+      
+        
+         
+  
+  Total IV 
+     {$total_dette} {$total_dette_clos} Total général (I) + (III) 
+      {$total_g_creance} {$total_g_creance_clos} Total général (II) + (IV) {$tg2p4_str} {$tg2p4_clos_str} Emprunt: montant restant du Annexe 2
+  Comptes de gestion général de l'exercice clos réalisé (N) du {$this->per_begin} au {$this->per_end} 
+  et budget previsionnel de l'exercice (N+2) du .... au .... 
+ 
+     
+     CHARGES POUR OPERATIONS COURANTES 
+         
+      
+     
+     Pour Approbation des comptes Pour le vote du budget prévisionnel 
+         Exercice précédent Exercice clos Exercice Clos réalisé Budget prévisionnel Budget prévisionnel  
+     
+     
+        
+            
+             
+     
+     
+        Sous-total
+         
+        
+           {$st['charge']}
+           
+          {$budget_n_total}
+          
+           {$st['charge_clos']}
+         
+          {$budget_n1_total}
+         
+          {$budget_n2_total}
+         
+     
+     
+        Solde(exécédent s opérations courantes affect au
+          copropriétaires)
+         
+        
+           N/C
+          
+         N/C N/C  
+     
+     
+        Total I
+         
+        
+           
+          
+          
+     
+     
+        
+           CHARGES POUR TRAVAUX ET AUTRES OPERATIONS EXCEPTIONNELLES
+         
+        
+          
+     
+     
+         
+     
+     
+        Solde(excedent)
+         
+        
+           
+          
+          
+     
+     
+        Total II
+         
+        
+           {$st['chrg_exp']}
+           
+           {$st['chrg_exp_budget']}
+          
+           {$st['chrg_exp_clos']}
+          
+  
+          
+       
+         PRODUITS POUR OPERATIONS COURANTES  
+          
+       
+         Pour Approbation des comptes Pour le vote du budget prévisionnel  
+          
+       
+         Exercice Exercice Exercice clos Budget Budget prévisionnel  
+          
+       
+         
+          
+       
+        Sous-total 
+           {$st['poc']}
+         
+           {$st['poc_budget']}
+         
+           {$st['poc_clos']}
+         
+           {$st['poc_budget_n1']}
+         
+           {$st['poc_budget_n2']}
+          
+          
+       
+        Solde(insuffisance s/oprations courantes affecté aux copropriétaires) N/C N/C N/C  
+          
+       
+        Total I  
+          
+       
+        
+          PRODUITS POUR TRAVAUX ET AUTRES OPERATIONS EXCEPTIONNELLES
+          
+          
+       
+         
+          
+       
+        Solde(insuffisant)  
+          
+       
+        Total II  
+    
+   
+EOF;
+   $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
+  }
+
+  /**
+   *
+   */
+  function annexe3() {
+    $digits = 2;
+    $q = "select pc_id,pc_name from PosteCharge;";
+    $pc = $this->doQueryI($q);
+    $st = array('exercice' => 0, 'exercice_nm1' => 0,'budget' => 0 , 'budgetn1' => 0,'budgetn2' => 0);
+    $entries = "";
+    $accounts = array();
+    $pdf = $this->pdf;
+    $this->fillAccountsWhere($accounts,$this->period,"a.acc_id REGEXP '(^6.*)'","amount");
+    $this->fillAccountsWhere($accounts,$this->period-1,"a.acc_id REGEXP '(^6.*)'","am1");
+    //$bu = $this->getBudgetListWhere($this->period,"a.acc_id REGEXP '(^6.*)'");
+    $this->fillBudgetListWhere($accounts,$this->period,"a.acc_id REGEXP '(^6.*)'","bu");
+    $this->fillBudgetListWhere($accounts,$this->period+1,"a.acc_id REGEXP '(^6.*)'","bu1");
+    $this->fillBudgetListWhere($accounts,$this->period+2,"a.acc_id REGEXP '(^6.*)'","bu2");
+    $bu1 = $this->getBudgetListWhere($this->period+1,"a.acc_id REGEXP '(^6.*)'");
+    $bu2 = $this->getBudgetListWhere($this->period+2,"a.acc_id REGEXP '(^6.*)'");
+
+    $pm1 = $this->period - 1;
+    foreach ($pc['records'] as $ch) {
+      $entries.="".$ch[1]." ";
+      // Handler Budget
+      // First Col  1
+      $entries.="";
+      foreach($accounts as $k => $c) {
+        if ( ($c[$this->period]['pc'] == $ch[0] )
+           ||( $c[$pm1]['pc'] == $ch[0] )
+           || $c[$this->period]['bu_pc'] == $ch[0] 
+           || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+        )
+        $entries.="".$k.' - '.$c['name']."  ";
+      // First Col  2
+      $entries.='';
+      foreach($accounts as $k => $c) {
+        if ( ($c[$this->period]['pc'] == $ch[0] )
+           || ($c[$pm1]['pc'] == $ch[0] )
+           || $c[$this->period-1]['pc'] == $ch[0] 
+           || $c[$this->period]['bu_pc'] == $ch[0] 
+           || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+        ) {
+          if ($c[$pm1]['pc'] == $ch[0]) {
+            $entries.="".number_format($c['am1'],$digits)." ";
+      // First Col  3
+      $entries.='';
+      foreach($accounts as $k => $c) {
+        $e = $this->period.$ch[0]."bu";
+        if ($c[$this->period]['pc'] == $ch[0]
+           || $c[$this->period-1]['pc'] == $ch[0] 
+           || $c[$this->period]['bu_pc'] == $ch[0] 
+           || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+        ) {
+          if ($c[$this->period]['bu_pc'] == $ch[0] ) {
+            $entries.=number_format($c[$e],$digits).""." ";
+      // First Col  4
+      $entries.='';
+      foreach($accounts as $k => $c) {
+        if ($c[$this->period]['pc'] == $ch[0]
+           || $c[$this->period-1]['pc'] == $ch[0] 
+           || $c[$this->period]['bu_pc'] == $ch[0] 
+           || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+           ) {
+             if ($c[$this->period]['pc'] == $ch[0]) {
+               $entries.=number_format($c['amount'],$digits)." ";
+      // First Col  5
+      $entries.='';
+      foreach($accounts as $k => $c) {
+        $e = ($this->period+1).$ch[0]."bu1";
+        if ($c[$this->period]['pc'] == $ch[0]
+           || $c[$this->period-1]['pc'] == $ch[0] 
+           || $c[$this->period]['bu_pc'] == $ch[0] 
+           || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+        ) {
+          if ($c[$this->period+1]['bu1_pc'] == $ch[0] ) {
+            $entries.=number_format($c[$e],$digits).""." ";
+      // First Col  6
+      $entries.='';
+      foreach($accounts as $k => $c) {
+        $e = ($this->period+2).$ch[0]."bu2";
+        if ($c[$this->period]['pc'] == $ch[0]
+           || $c[$this->period-1]['pc'] == $ch[0] 
+           || $c[$this->period]['bu_pc'] == $ch[0] 
+           || $c[$this->period+1]['bu1_pc'] == $ch[0] 
+        ) {
+          if ($c[$this->period+2]['bu2_pc'] == $ch[0] ) {
+            $entries.=number_format($c[$e],$digits).""." ";
+
+      $entries.=" ";
+    }
+    $html =<<Annexe 3
+  Comptes de gestion pour opérations courantes de l'exercice clos réalise (N {$this->period}) du {$this->per_begin} au {$this->per_end} 
+  et budget previsionnel de l'exercice (N+2) du .... au .... 
+  
+       
+         CHARGES POUR OPERATIONS COURANTES   
+             Pour approbation des comptes 
+             Pour le vote du budget prévisionnel 
+         
+            Exercice précédent approuvé Exercice clos budget vote Exercice clos réalise à approuver Budget prévisionnel en cours Budget prévisionnel à voter  
+        
+            N-1 N N 
+            N+1  N+2 
+          
+         
+         {$entries}
+         
+         
+           TOTAL CHARGES NETTES 
+           {$st['exercice_nm1']} 
+           {$st['budget']} 
+           {$st['exercice']} 
+           {$st['budgetn1']} 
+           {$st['budgetn2']} 
+          
+         
+           Provision coproprietaires 
+            
+         
+           Solde (excedent ou insuffisance s/opérations courantes affecte aux copropriétaires  
+          
+        
+     
+
+EOF;
+   $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
+  }
+  /**
+   *
+   */ 
+  function test( $p) {
+      $this->period = $p;
+      $this->getPeriod($p);
+      $pdf = $this->pdf;
+      $pdf->SetCreator(PDF_CREATOR);
+      $pdf->SetAuthor('EBERSOLD Andre');
+      $pdf->SetTitle('ANNEXE N');
+      $pdf->SetSubject('Etat Financier apres repartition au ');
+      $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
+      $org = $this->session->getOrganization();
+      // set default header data
+      $h   = $org[0]."\n".$org[1]."\n".$org[2]." ".$org[3];
+      $pdf->SetHeaderData(/*PDF_HEADER_LOGO*/"", 0, 'SYNDICAT DES COPROPRIETAIRES                        ANNEXES' , $h, array(64,64,64), array(0,64,128));
+      $pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));
+
+// set header and footer fonts
+      $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+      $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+// set default monospaced font
+      $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+//set margins
+      $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+      $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+      $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+//set auto page breaks
+      $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+//set image scale factor
+      $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+//set some language-dependent strings
+      //$pdf->setLanguageArray($l);
+
+// ---------------------------------------------------------
+
+// set default font subsetting mode
+      $pdf->setFontSubsetting(true);
+
+// Set font
+// dejavusans is a UTF-8 Unicode font, if you only need to
+// print standard ASCII chars, you can use core fonts like
+// helvetica or times to reduce file size.
+     $pdf->SetFont('dejavusans', '', 8, '', true);
+
+// Add a page
+// This method has several options, check the source code documentation for more information.
+      $pdf->AddPage();
+      $html = <<Annexe 1
+Etat financier après répartition du {$this->per_begin} au {$this->per_end} (Exercice {$this->period}) 
+EOD;
+   $pdf->setHeaderTemplateAutoreset(true);
+// Print text using writeHTMLCell()
+    $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
+     $pdf->SetFont('dejavusans', '', 8, '', true);
+    $this->annexe1()  ;
+      $pdf->AddPage();
+    $this->annexe2()  ;
+      $pdf->AddPage();
+    $this->annexe3()  ;
+  }
+
+  function Output($fn,$m) {
+      $this->pdf->Output($fn,$m);
+  }
+}
+/**
+ * Main entry 
+ * For test purpose
+ */
+GLOBAL $conf;
+$conf_auth = $conf['auth']['mysql'];
+$_session  = new SessionCompta($conf_auth,$conf_auth['req_file']);
+
+$_database = "";
+$period    = "";
+$_database = $_session->getDb(); 
+
+if (isset($_GET['period'])) { $period = $_GET['period'];} else { $period = Date('Y');};
+if ($_database == "") {
+  error_log("annexe.php no database in session too bad");
+  die();
+}
+
+$_annexe   = new annexe1($_session,
+                         $conf_auth,
+                         $_database);
+// Get Period from current exercice
+// Simply ignore parameters ...
+if ($_session->is_logged_in() ) {
+  $_annexe->test( $period);
+ 
+  $_annexe->Output('annexe1.pdf', 'I');
+} else {
+  // redirect to login
+  header("Location: /app/member/login.php");
+  die();
+}
+
+/**
+  vim:et:sw=2:ts=2:fileencoding=utf-8:encoding=utf-8
+*/
+?>
diff --git a/app/compta/reports/syndic_builder_annexe.php b/app/compta/reports/syndic_builder_annexe.php
new file mode 100644
index 0000000..54aaf05
--- /dev/null
+++ b/app/compta/reports/syndic_builder_annexe.php
@@ -0,0 +1,135 @@
+session = $_session;
+        //$this->pdf = new TCPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+        $this->pdf = new TCPDF('L',PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+        $this->db  = new AnnexeData($_session,$auth_cfg,$db);
+    }
+
+    function __destruct() {
+    }
+
+    /**
+     *
+     *
+     */
+    private function processParams()
+    {
+        $this->period = AEB::$REQUEST->getParam("period", $this->session->getCurrentExercice());
+        $this->compte = AEB::$REQUEST->getParam("compte", "450002");
+    }
+
+    public function generate()
+    {
+        $this->setModel();
+        if ($this->session->is_logged_in() )
+        {
+            $this->processParams();
+            $a1 = new annexe1($this->pdf,$this->db,$this->period);
+            $a2 = new annexe2($this->pdf,$this->db,$this->period);
+            $a3 = new annexe3($this->pdf,$this->db,$this->period);
+            $a4 = new annexe4($this->pdf,$this->db,$this->period);
+            $a1->generate();
+            $a2->generate();
+            $a3->generate();
+            $a4->generate();
+        }
+    }
+
+    public function Output($fn,$m) {
+        header("Content-Disposition: attachment; filename=".$fn);
+        header("Content-Type: application/pdf");
+        $this->pdf->Output($fn,$m);
+    }
+
+  private function setModel()
+  {
+      $pdf = $this->pdf;
+      $pdf->SetCreator(PDF_CREATOR);
+      $pdf->SetAuthor('EBERSOLD Andre');
+      $pdf->SetTitle('ANNEXE N');
+      $pdf->SetSubject('Etat Financier apres repartition au ');
+      $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
+      $org = $this->session->getOrganization();
+      // set default header data
+      $h   = $org[0]."\n".$org[1]."\n".$org[2]." ".$org[3];
+      //$h   = "Model \n"."25 rue pfeffinger\n"."67100 STRASBOURG";
+      $pdf->SetHeaderData(/*PDF_HEADER_LOGO*/"", 0, 'SYNDICAT DES COPROPRIETAIRES                        ANNEXES' , $h, array(64,64,64), array(0,64,128));
+      $pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));
+
+// set header and footer fonts
+      $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+      $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+// set default monospaced font
+      $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+//set margins
+      $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+      $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+      $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+//set auto page breaks
+      $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+//set image scale factor
+      $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+//set some language-dependent strings
+      //$pdf->setLanguageArray($l);
+
+// ---------------------------------------------------------
+
+// set default font subsetting mode
+      $pdf->setFontSubsetting(true);
+
+// Set font
+// dejavusans is a UTF-8 Unicode font, if you only need to
+// print standard ASCII chars, you can use core fonts like
+// helvetica or times to reduce file size.
+     $pdf->SetFont('dejavusans', '', 8, '', true);
+
+  }
+}
+
+/* Main entry point */
+$ldb ="";
+if (isset($_SESSION['compta_db'])) {
+  $ldb =  $_SESSION["compta_db"] ;
+} else 
+   $ldb = 'test';
+
+GLOBAL $conf;
+$conf_auth = $conf['auth']['mysql'];
+
+$s = new SessionCompta($conf_auth,$conf_auth['req_file']);
+$b = new AnnexeBuilder($s,$conf_auth,$ldb); 
+$b->generate();
+$b->Output("annexe-report","I");
+?>
+
diff --git a/app/compta/reports/syndic_builder_decompte.php b/app/compta/reports/syndic_builder_decompte.php
new file mode 100644
index 0000000..a81bde0
--- /dev/null
+++ b/app/compta/reports/syndic_builder_decompte.php
@@ -0,0 +1,217 @@
+period = $_p; 
+    }
+    /**
+     *
+     */
+    public function Header()
+    {
+        $this->SetFillColor(255);
+        //$this->SetFont('Arial','',10);
+        $org = $this->session->getOrganization();
+        // set default header data
+        $this->Cell(50,5,$org[0]);
+        $this->Ln();
+        $this->Cell(50,5,$org[1]);
+        $this->Ln();
+        $addr = $org[2]." ".$org[3];
+        $this->Cell(50,5,$addr);
+        $this->Ln();
+        //$this->Cell(50,5,"Tel: 06 70 43 73 80");
+
+        //$this->SetFont('Arial','',14);
+        $this->SetFillColor(200);
+        $this->RoundedRect(120,9,75,10,5,"1234","DF");
+        $this->Text(130,12,"Decompte de Charges ".$this->period);
+        $this->SetY(23); 
+
+        $this->SetLineStyle(array("cap" => 'butt', "join" => 'miter','dash' => 0, 'color' => array(100,100,200)));
+        if ($this->rtl)
+        {
+            $this->SetX($this->original_rMargin);
+        } else
+        {
+            $this->SetX($this->original_lMargin);
+        }
+        $this->Cell(($this->w- $this->original_lMargin - $this->original_rMargin),0,'','T',2,'M');
+    }
+    /**
+     *
+     */
+    public function Footer()
+    {
+       $this->SetY(-15);
+       //$this->SetFont('Arial','I',8);
+       $this->Cell(0,10,'Page '.$this->PageNo().'/'.$this->getAliasNbPages(),'C');
+       $this->SetY(-15);
+       $this->SetX(90);
+       $this->Cell(0,10,'https://gcopro.ebersold.fr/','C');
+       
+    }
+
+}
+
+/**
+ * \brief the aim of this class is to take care
+ * of the build dependencies of the annexes.
+ * I'll plan to separate the Database aspect from the
+ * presentation aspect.
+ */
+class BuilderDecompte
+{
+    private $pdf      = null;
+    private $db       = null;
+    private $session  = null;
+
+    function __construct($_session,$auth_cfg,$db)
+    {
+        $this->session = $_session;
+        //$this->pdf     = new TCPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+        $this->pdf     = new DecomptePDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'ISO-8859-1', false);
+        $this->pdf->session = $this->session;
+        $this->db      = new AnnexeData($_session,$auth_cfg,$db);
+    }
+
+    function __destruct() {
+    }
+
+    /**
+     *
+     *
+     */
+    private function processParams()
+    {
+        $this->period = AEB::$REQUEST->getParam("period", $this->session->getCurrentExercice());
+        $this->compte = AEB::$REQUEST->getParam("compte", "450002");
+        $this->pdf->setPeriod($this->period);
+    }
+
+    /**
+     *
+     *
+     */
+    public function generate()
+    {
+        $this->setModel();
+        $a4 = new DecompteComptes($this->session,$this->pdf,$this->db);
+        $a5 = new DecompteCharges($this->session,$this->pdf,$this->db);
+        if ($this->session->is_logged_in() ) {
+            $this->processParams();
+            $a4->Decompte($this->period,$this->compte);
+            $a5->Decompte($this->period,$this->compte);
+        }
+    }
+
+    public function Output($fn,$m) {
+        $mode   = AEB::$REQUEST->getParam("mode", $m);
+        if ($mode == "I" )
+        {
+            header("Content-Disposition: attachment; filename=".$fn);
+            header("Content-Type: application/pdf");
+            $this->pdf->Output($fn,$m);
+        } elseif ( $this->session->is_logged_in() )
+        {
+            $fulldir  = AEB::getDataDir().$this->session->getDb()."/Reports/".$this->period."/";
+            error_log("Mode=".$mode." Path=".$fulldir);
+            if (! file_exists($fulldir)) {
+                if ( mkdir($fulldir,0777,true) )
+                {
+                    error_log("Failed create directory ".$fulldir);
+                }
+            }
+            $filename = "decompte_".$this->period."_".$this->compte.".pdf";
+            $fullpath = $fulldir.$filename;
+            $this->pdf->Output($fullpath,"F");
+        }
+    }
+
+    private function setModel()
+    {
+        $pdf = $this->pdf;
+        $pdf->SetCreator(PDF_CREATOR);
+        $pdf->SetAuthor('EBERSOLD Andre');
+        $pdf->SetTitle('DECOMPTE');
+        $pdf->SetSubject('Etat Financier apres repartition au ');
+        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
+        //$org = $this->session->getOrganization();
+        // set default header data
+        //$h   = $org[0]."\n".$org[1]."\n".$org[2]." ".$org[3];
+        $h   = "Model \n"."25 rue pfeffinger\n"."67100 STRASBOURG";
+        $pdf->SetHeaderData(/*PDF_HEADER_LOGO*/"", 0, 'SYNDICAT DES COPROPRIETAIRES                        DECOMPTE DE CHARGES' , $h, array(64,64,64), array(0,64,128));
+        $pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));
+
+// set header and footer fonts
+        $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+        $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+// set default monospaced font
+        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+//set margins
+        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+//set auto page breaks
+        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+//set image scale factor
+        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+//set some language-dependent strings
+      //$pdf->setLanguageArray($l);
+
+// ---------------------------------------------------------
+
+// set default font subsetting mode
+        $pdf->setFontSubsetting(true);
+
+// Set font
+// dejavusans is a UTF-8 Unicode font, if you only need to
+// print standard ASCII chars, you can use core fonts like
+// helvetica or times to reduce file size.
+       $pdf->SetFont('dejavusans', '', 8, '', true);
+
+    }
+}
+
+/* Main entry point */
+$ldb ="";
+if (isset($_SESSION['compta_db'])) {
+  $ldb =  $_SESSION["compta_db"] ;
+} else 
+   $ldb = 'test';
+
+GLOBAL $conf;
+$conf_auth = $conf['auth']['mysql'];
+
+$s = new SessionCompta($conf_auth,$conf_auth['req_file']);
+$b = new BuilderDecompte($s,$conf_auth,$ldb); 
+$b->generate();
+$b->Output("test-report.pdf","I");
+?>
diff --git a/app/compta/reports/syndic_charges.php b/app/compta/reports/syndic_charges.php
new file mode 100644
index 0000000..15aa45f
--- /dev/null
+++ b/app/compta/reports/syndic_charges.php
@@ -0,0 +1,259 @@
+pdf     = $_pdf;
+        $this->data    = $_data;
+        $this->session = $_session;
+    }
+
+
+    function __destruct() {
+    }
+
+
+    private function Titre($libelle) {
+        $pdf = $this->pdf;
+        $html =<<<_EOF
+{$libelle} 
+_EOF;
+        $pdf->writeHTMLCell($w=0, $h=0, $x='', $y= '', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
+       
+        //$this->y0 = $this->GetY();
+    }
+
+    // Better table
+    private function ImprovedTable($header, $data)
+    {
+       $i = 0;
+       $ch = 4;
+       // Column widths
+       $w = array(17, 45, 68, 30,30);
+      // Header
+       for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C');
+         $this->Cell($w[$i],7,iconv('UTF-8','iso8859-1',$header[$i]),1,0,'C');
+       $this->Ln();
+      // Data
+           $this->SetFont('Arial','',8);
+       foreach($data as $row)
+       {
+           $this->Cell($w[0],$ch,$row[0],'LR');
+           //$this->Cell($w[1],$ch,$row[1],'LR');
+           $this->Cell($w[1],$ch,iconv('UTF-8','iso8859-1',$row[1]),'LR');
+
+           $this->Cell($w[2],$ch,$row[2],'LR',0,'R');
+           if ($row[3] == 0.0 ) {
+               $this->Cell($w[3],$ch,'','LR',0,'R');
+           } else
+               $this->Cell($w[3],$ch,number_format($row[3],2),'LR',0,'R');
+           if ($row[4] == 0.0) {
+               $this->Cell($w[4],$ch,'','LR',0,'R');
+           } else
+               $this->Cell($w[4],$ch,number_format($row[4],2),'LR',0,'R');
+           $this->Ln();
+           if ($i++ > 50) 
+           {
+               $i = 0;
+               $this->AddPage();
+               $this->Ln();
+           }
+       }
+           $this->SetFont('Arial','',10);
+       // Closing line
+       $this->Cell(array_sum($w),0,'','T');
+    }
+    //
+
+    private function Solde($period,$compte) {
+       $w = array(130, 30,30);
+       $header = array('Solde','Debit','Credit');
+       $q = 'CALL solde_compte("'.$period.'","'.$compte.'");';
+       $this->Ln();
+      // Header
+       
+       $res    = $this->doQueryImpr($q);
+       if ($res['records'] != "Failed") {
+           $fields = $res['records'][0];
+           $this->Cell($w[0],6,'Total','LR');
+           $this->Cell($w[1],6,$fields[0],'LR',0,'R');
+           $this->Cell($w[2],6,$fields[1],'LR',0,'R');
+           $this->Ln();
+       }  else {
+           $this->Cell($w[0],6,'Total','LR');
+           $this->Cell($w[1],6,'0','LR',0,'R');
+           $this->Cell($w[2],6,'0','LR',0,'R');
+           $this->Ln();
+       }
+       $this->Cell(array_sum($w),0,'','T');
+       $this->Ln();
+       $this->Ln();
+       if ($res['records'][0][2] > 0.0) {
+         $str = "Votre compte présente un solde créditeur de ".$res['records'][0][2]." euros";
+         //$this->Cell(50,5,"Votre compte presente un solde crediteur de ".$res['records'][0][2]." euros");
+         $this->Cell(50,5,iconv('UTF-8','iso8859-1',$str));
+       } else {
+         $str = "Votre compte présente un solde débiteur de ".abs($res['records'][0][2])." euros";
+         //$this->Cell(50,5,"Votre compte presente un solde debiteur de ".abs($res['records'][0][2])." euros");
+         $this->Cell(50,5,iconv('UTF-8','iso8859-1',$str));
+       }
+    
+    }
+    /**
+     * @brief Initial implementation to display owner info based on account name. It's a bad strategy.
+     * The info's should be based on uid in case the request comes from the syndic. 
+     * The uid shall be the one from the session in the other case
+     * @deprecated
+     *
+     */
+    private function Copro($compte) {
+        $x = 120;
+        $q = 'select ident_name,ident_firstname,ident_address,ident_postalcode,ident_city from Owners as i ';
+        $qj= 'JOIN JoinIdentityAccount as j on j.jia_ident = i.ident_id and j.jia_acc ='.$compte.';';
+        $res    = $this->doQueryImpr($q.$qj);
+        $ident = $res['records'][0];
+        $this->Text($x,40,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,46,"".$ident[2]);
+        $this->Text($x,52,"".$ident[3]." ".$ident[4]);
+        $this->setY(60);
+    }
+
+    /**
+     * @brief retrieve information from owner. Name, adresse, etc
+     *
+     */
+    private function CoproUser($uid) {
+        $x = 120;
+        $q =<<<_EOF
+SELECT ident_name,ident_firstname,ident_address,ident_postalcode,ident_city FROM Owners as i
+WHERE ident_id = {$uid};
+_EOF;
+        $res    = $this->doQueryImpr($q);
+        $ident = $res['records'][0];
+        $this->Text($x,40,"".$ident[0]." ".$ident[1] );
+        $this->Text($x,46,"".$ident[2]);
+        $this->Text($x,52,"".$ident[3]." ".$ident[4]);
+        $this->setY(60);
+    }
+
+    /**
+     * @brief Initial implementation. Does not work as expected because a owner can
+     * ownmultiple accounts
+     *
+     * @TODO revise so that this entry can handle multiple accounts
+     */
+    public function Decompte($period,$compte) {
+        
+        $this->pdf->AddPage();
+        
+        try {
+            $this->Detail($period,$compte);
+        } catch (Exception $e) {
+            $this->Cell(50,5,"Failed :".$e->getMessage());
+        }
+    }
+
+    function UserIdFromAccount($account) {
+       $q	= "select jia_ident from JoinIdentityAccount WHERE jia_acc = ".$account.";";
+       $res	= $this->data->doQueryI($q);
+       return   $res['records'][0][0];
+    }
+    /**
+     *
+     */
+    private function Detail($period,$compte) {
+        $opt = Array();
+        
+        // Exercice Clos
+          $page_height = 286.93;
+          foreach (array(1,4,5) as $row)
+          {
+            $space_left = $page_height - ($this->pdf->getY());
+            if ( $space_left < 20)
+            {
+                $this->pdf->AddPage();
+                $this->pdf->Ln();
+            } else {
+                //$this->pdf->Ln();
+            }
+            $this->DetailPc($period,$compte,$row);
+            $this->pdf->Ln(05);
+          }
+    }
+    /**
+     */
+    private function DetailPc($period,$cpt,$pcs) {
+       $uid     = $this->UserIdFromAccount($cpt);
+       $this->Titre("Poste Charge PC".$pcs);
+       $q       = "CALL detail_decompte_charge(".$uid.",".$pcs.",".$period.",2);";
+       $res     = $this->data->doQueryI($q);
+       $ch      = 4;
+       $total   = 0.0;
+       $tot_fra = 0.0;
+       $st_title= "border: 1px solid #000;";
+       $st_data = "border-left: 1px solid #000; border-right: 1px solid #000;";
+       $html    =<<<_EOF
+
+
+Date 
+    Référence 
+    Total 
+    Tantième 
+    Fraction '.$row[0].' ';
+            $html.=''.$row[3].' <';
+            $html.='td class="num">'.number_format($row[4],2).'';
+            // Handle Tantieme and fraction 
+            for ($i = 5 ; $i <= 6 ; $i++)
+            {
+                if ($row[$i] == 0.0 )
+                {
+                    $html.='  ';
+                } else
+                    $html.=''.number_format($row[$i],2).' ';
+            }
+            $html.='Total ';
+        $html.= ''.number_format($total,2).'   ';
+        $html.= ''.number_format($tot_fra,2).' 
';
+        $this->pdf->writeHTMLCell($w=0, $h=0, $x='', $y= '', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
+    }
+
+}
+
+
+
+?>
diff --git a/app/compta/reports/syndic_compte.php b/app/compta/reports/syndic_compte.php
new file mode 100644
index 0000000..662f655
--- /dev/null
+++ b/app/compta/reports/syndic_compte.php
@@ -0,0 +1,419 @@
+pdf     = $_pdf;
+        $this->data    = $_data;
+        $this->session = $_session;
+    }
+
+
+    function __destruct() {
+    }
+
+    private function Header() {
+        $pdf = $this->pdf;
+        $pdf->SetFillColor(255);
+        //$pdf->SetFont('Arial','',10);
+        $org = $this->session->getOrganization();
+        // set default header data
+        $pdf->Cell(50,5,$org[0]);
+        $pdf->Ln();
+        $pdf->Cell(50,5,$org[1]);
+        $pdf->Ln();
+        $addr = $org[2]." ".$org[3];
+        $pdf->Cell(50,5,$addr);
+        $pdf->Ln();
+        //$pdf->Cell(50,5,"Tel: 06 70 43 73 80");
+        
+        //$pdf->SetFont('Arial','',14);
+        $pdf->SetFillColor(200);
+        $pdf->RoundedRect(120,10,75,10,5,"1234","DF");
+        $pdf->Text(125,17,"Decompte de Charges");
+    
+    }
+    /**
+     *
+     */
+    private function Titre($libelle) {
+        $pdf = $this->pdf;
+        $html =<<<_EOF
+{$libelle} 
+_EOF;
+        $pdf->writeHTMLCell($w=0, $h=0, $x='', $y= '', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
+       
+        $pdf->Ln(2);
+    }
+    /**
+     *
+     */
+    private function DetailLots($cpt)
+    {
+        $pdf = $this->pdf;
+        $i = 0;
+        $_y = $pdf->GetY();
+        $pdf->setY(35);
+        $html=<<<_EOF
+
+
+LOTS PC1 PC2  PC4 EAU 
+ 
+%s
+
+_EOF;
+        $tplt   =<<<_EOF
+
+  %s 
+  %.2f 
+  %.2f 
+  %.2f 
+  %.2f  
+_EOF;
+        $uid    = $this->UserIdFromAccount($cpt);
+        $q      =<<<_EOF
+call tantieme_per_lot({$uid});
+_EOF;
+        $res    = $this->data->doQueryI($q);
+        $str    = "";
+        //
+        //
+        foreach($res['records'] as $fields)
+        {
+            if (isset($fields[0]) && isset($fields[1]))
+            {
+              $str .= sprintf($tplt,$fields[0],$fields[1],$fields[2],$fields[4],$fields[5]);
+            }
+        }
+        $str = sprintf($html,$str);
+        $pdf->writeHTMLCell($w=0, $h=0, $x='', $y= 35, $str, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
+        $pdf->setY($_y);
+    }
+
+    private function ImprovedTable($header,$data)
+    {
+        $pdf = $this->pdf;
+        $width = Array(70,170,210,90,90);
+        $total = [];
+        $html='';
+        // Ok Add header
+        for($i=0;$i'.$header[$i]."";
+        }
+        $html.= "  ";
+        foreach($data as $row)
+        {
+           if ( strtoupper(trim($row[2])) != "TOTAL")
+           {
+               $html.= "";
+               $html.= ''.$row[0]." ";
+               $html.= ''.$row[1]." ";
+               $html.= ''.$row[2]." ";
+               for($i=3;$i<5;$i++)
+               {
+                   if ($row[$i] == 0.0 )
+                   {
+                       $html.= '  ';
+                   } else
+                   {
+                       $html.=''.number_format($row[$i],2)." ";
+                   }
+               }
+               $html.= " ";
+           } else {
+               $total = $row;
+           }
+        }
+        // Now solde
+        $html.="";
+        $html.='TOTAL ';
+        $html.=''.number_format($total[3],2).' ';
+        $html.=''.number_format($total[4],2).' ';
+        $html.=" ";
+        $html.="
";
+        $pdf->writeHTMLCell($w=0, $h=0, $x='', $y= '', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
+    }
+    //
+
+    private function Solde($period,$compte) {
+        $pdf = $this->pdf;
+        $w = array(130, 30,30);
+        $header = array('Solde','Debit','Credit');
+        $q = 'CALL solde_compte("'.$period.'","'.$compte.'");';
+      // Header
+       
+        $res    = $this->data->doQueryI($q);
+        //$pdf->Ln();
+       if ($res['records'][0][2] > 0.0) {
+         $str = "Votre compte présente un solde créditeur de ".$res['records'][0][2]." euros
";
+         //$pdf->Cell(0,0,"Votre compte presente un solde crediteur de ".$res['records'][0][2]." euros");
+         $pdf->writeHTMLCell($w=0, $h=0, $x='', $y= '', $str, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
+         //$pdf->Cell(50,5,iconv('UTF-8','iso8859-1',$str));
+       } else {
+         $str = "".$q." ";
+        //$pdf->SetFont('Arial','',10);
+        $pdf->AddPage();
+        
+        $pdf->Ln();
+        $pdf->Ln();
+        $this->Copro($compte);
+        $pdf->Ln();
+        $this->DetailLots($compte);
+        $pdf->Ln();
+        $this->Titre("Compte ".$compte);
+        $this->ImprovedTable( $header,$res['records']);
+        //
+        $this->Solde($period,$compte);
+        // For test pupose
+        //$pdf->Ln();
+        try {
+            $exercice = $this->Exercice($period);
+            // Exercice Clos
+            if ($exercice[1] == 0) {
+                  $this->Detail($period,$compte);
+            } else {
+                $pdf->Cell(50,5,"Exercice Clos.");
+                $pdf->Ln();
+                $this->Detail($period,$compte);
+            }
+        } catch (Exception $e) {
+            $pdf->Cell(50,5,"Failed :".$e->getMessage());
+        }
+    }
+    /**
+     *
+     */
+    function UserIdFromAccount($account) {
+       $q	= "select jia_ident from JoinIdentityAccount WHERE jia_acc = ".$account.";";
+       $res	= $this->data->doQueryI($q);
+       return   $res['records'][0][0];
+    }
+    /**
+     *
+     */
+    private function Detail($period,$compte) {
+        $pdf = $this->pdf;
+        $opt = Array();
+        $retrieve = $this->data->getRetrieve();
+
+        $result = $retrieve->getSoldeAccount($period,$compte,$opt);
+        $dt     = $result['detail_charge'];
+        
+        $exercice = $this->Exercice($period);
+        // Exercice Clos
+        if ($exercice[1] == 0) 
+        {
+            $this->Titre("Détail exercice en cours");
+        } else
+        {
+            $this->Titre("Charges sur l'exercice ".$period);
+        }
+        foreach($dt as $row) {
+             $pdf->Cell(50,5,$row[0]);
+             $pdf->Cell(40,5,$row[1]." €",0,1,'R');
+        }
+        // Total Charge en gras
+        $tcharge =<<<_EOF
+
+Total charges {$result['total_charge']} €  
+
+
+Avance de trésorerie 0.00 € Avance de travaux art 14.2 0.00 € Avance fond de travaux 0.00 € 
+Total avance 0.0 €  
+
+Cell($w[$i],7,iconv('UTF-8','iso8859-1',$header[$i]),1,0,'C');
+	       
+               $this->Ln();
+	      // Data
+		   //$this->SetFont('Arial','',8);
+	       foreach($data as $row)
+	       {
+		   $this->Cell($w[0],$ch,$row[0],'LR');
+                   $total = $total + $row[4];
+		   $this->Cell($w[1],$ch,iconv('UTF-8','iso8859-1',$row[3]),'LR');
+
+		   $this->Cell($w[2],$ch,$row[4],'LR',0,'R');
+		   if ($row[5] == 0.0 ) {
+		       $this->Cell($w[3],$ch,'','LR',0,'R');
+		   } else
+		       $this->Cell($w[3],$ch,number_format($row[5],2),'LR',0,'R');
+		   if ($row[6] == 0.0) {
+		       $this->Cell($w[4],$ch,'','LR',0,'R');
+		   } else
+		       $this->Cell($w[4],$ch,number_format($row[6],2),'LR',0,'R');
+                   $tot_fra = $tot_fra + $row[6];
+		   $this->Ln();
+		   if ($i++ > 30) 
+		   {
+		       $i = 0;
+		       $this->AddPage();
+		       $this->Ln();
+		   }
+	       }
+	       //$this->SetFont('Arial','',10);
+	       // Closing line
+	       $this->Cell(array_sum($w),0,'','T');
+	       $this->Ln();
+               // Write totals
+	       $this->Cell($wt[0],$ch,"Total",'LR',0,'L');
+	       $this->Cell($wt[1],$ch,number_format($total,2),'LR',0,'R');
+	       $this->Cell($wt[2],$ch,"-",'LR',0,'R');
+	       $this->Cell($wt[3],$ch,number_format($tot_fra,2),'LR',0,'R');
+	       $this->Ln();
+	       $this->Cell(array_sum($w),0,'','T');
+	       $this->Ln();
+         
+       }
+    }
+
+    /**
+     * This function returns the information related to the exercice
+     *  Return the state (how the charges are going to be dispatched
+     *   IF the exercice is closed
+     *   If the exercice has been approved.
+     */
+    private function Exercice ($dt)
+    {
+        $q = "select per_repart_charge_end,per_closed,per_approved from Period WHERE per_string = ".$dt.";";
+        $res = $this->data->doQueryI($q);
+        return $res['records'][0];
+    }
+
+    /**
+     * What the problem
+     */
+    function Footer() {
+       $this->SetY(-15);
+       //$this->SetFont('Arial','I',8);
+       $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}','C');
+       $this->SetY(-15);
+       $this->SetX(90);
+       $this->Cell(0,10,'https://syndic.ebersold.fr/','C');
+       
+    }
+
+}
+
+
+
+?>
diff --git a/app/compta/schema_mysql.php b/app/compta/schema_mysql.php
new file mode 100644
index 0000000..8f3182f
--- /dev/null
+++ b/app/compta/schema_mysql.php
@@ -0,0 +1,988 @@
+ 
+
+  
+  
+    DROP TABLE IF EXISTS Config;
+   
+  
+    CREATE TABLE IF NOT EXISTS Config (
+      cfg_id    VARCHAR(32) PRIMARY KEY,
+      cfg_type       INTEGER ,
+      cfg_value      VARCHAR(255) DEFAULT "",
+      INDEX USING BTREE(cfg_id)
+    ) CHARACTER SET utf8 COLLATE utf8_general_ci;
+   
+
+  
+    DROP TABLE IF EXISTS Account;
+   
+  
+    CREATE TABLE IF NOT EXISTS Account (
+      acc_id    VARCHAR(32) PRIMARY KEY,
+      acc_info_id    INTEGER,
+      acc_name      VARCHAR(64) COLLATE utf8_general_ci,
+      acc_desc      VARCHAR(255) DEFAULT "",
+      acc_balance    REAL DEFAULT 0.0, -- Could be computed dynamically
+      acc_left      INTEGER, -- For node set handling left or opening edge
+      acc_right     INTEGER, -- For node set handling right or closing edge
+      INDEX USING BTREE(acc_id)
+    ) CHARACTER SET utf8 COLLATE utf8_general_ci;
+   
+   
+  
+    DROP PROCEDURE IF EXISTS account_get_leafs;
+   
+  
+    CREATE PROCEDURE account_get_leafs(IN period VARCHAR(32), IN acc VARCHAR(32) )
+    BEGIN
+      SELECT acc_id,acc_name from Account WHERE acc_left + 1 = acc_right and acc_id like acc;
+    END;
+     
+   
+
+  
+    DROP PROCEDURE IF EXISTS account_get_tree;
+   
+  
+    
+    CREATE PROCEDURE account_get_tree(IN cls VARCHAR(32) )
+    BEGIN
+      SELECT node.acc_id,CONCAT( REPEAT( '- ', (COUNT(parent.acc_name) - 1) ), node.acc_name) AS acc_name , (COUNT(parent.acc_name) -1 ) AS level
+      FROM Account AS node,
+          Account AS parent
+      WHERE node.acc_left BETWEEN parent.acc_left AND parent.acc_right and node.acc_id like CONCAT(cls,"%")
+      GROUP BY node.acc_id
+      ORDER BY node.acc_id;
+    END;
+     
+   
+  
+    DROP PROCEDURE IF EXISTS account_insert_beside;
+   
+  
+    
+    CREATE PROCEDURE account_insert_beside(IN period VARCHAR(32),IN left_acc VARCHAR(32),  IN acc VARCHAR(32) ,IN name VARCHAR(64) )
+    BEGIN
+
+      SET @myRight := (SELECT acc_right FROM Account
+      WHERE acc_id = left_acc);
+
+      UPDATE Account SET acc_right = acc_right + 2 WHERE acc_right > @myRight;
+      UPDATE Account SET acc_left = acc_left + 2 WHERE acc_left > @myRight;
+
+      INSERT INTO Account(acc_id, acc_info_id,acc_name,acc_left,acc_right) VALUES(acc,CONVERT(acc,UNSIGNED INTEGER),name, @myRight + 1, @myRight + 2);
+    END;
+     
+   
+
+  
+    DROP PROCEDURE IF EXISTS account_insert_below;
+   
+  
+    
+    CREATE PROCEDURE account_insert_below(IN period VARCHAR(32), IN parent_acc VARCHAR(32),IN acc VARCHAR(32) ,IN name VARCHAR(64) )
+    BEGIN
+
+      SET @myLeft := (SELECT acc_left FROM Account WHERE acc_id = parent_acc);
+
+      UPDATE  Account SET acc_right = acc_right + 2 WHERE acc_right > @myLeft;
+      UPDATE  Account SET acc_left = acc_left + 2 WHERE acc_left > @myLeft;
+
+      INSERT INTO Account(acc_id,acc_info_id,acc_name, acc_left, acc_right) VALUES(acc,CONVERT(acc,UNSIGNED INTEGER ),name, @myLeft + 1, @myLeft + 2);
+
+    END;
+     
+   
+
+
+
+  
+    DROP TABLE IF EXISTS Budget;
+   
+  
+    CREATE TABLe IF NOT EXISTS Budget (
+        bu_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+        bu_period_id    INTEGER,
+        bu_desc         VARCHAR(64) DEFAULT ""
+    );
+   
+  
+    DROP TABLE IF EXISTS BudgetEntry;
+   
+
+  
+    CREATE TABLE IF NOT EXISTS BudgetEntry (
+      buet_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+      buet_budget_id    INTEGER,
+      buet_acc_id       VARCHAR(32),
+      buet_amount       DECIMAL(13,3) DEFAULT 0.0,
+      buet_debit_credit ENUM('d','c') DEFAULT 'c',
+      buet_pc_id        INTEGER DEFAULT 1
+    );
+   
+
+  
+    DROP TABLE  IF EXISTS Period;
+   
+  
+    CREATE TABLE IF NOT EXISTS Period (
+      per_id        INTEGER AUTO_INCREMENT PRIMARY KEY,
+      per_begin        DATE,
+      per_end        DATE,
+      per_string        VARCHAR(32) ,-- Example Q1_2012,
+      per_repart_charge_end    BOOL    DEFAULT TRUE, -- Says when charges should be distributed. At the end of the period or after each bill if false
+      per_closed        BOOL    DEFAULT FALSE,
+      per_approved        BOOL    DEFAULT FALSE
+    );
+   
+
+
+  
+    DROP TABLE IF EXISTS Transactions;
+   
+  
+    CREATE TABLE IF NOT EXISTS Transactions (
+      trans_id        INTEGER AUTO_INCREMENT PRIMARY KEY,
+      voucher_ref        VARCHAR(255),
+      voucher_date        DATE,
+      act_trans_date    DATE,
+      trans_label          VARCHAR(255),
+      trans_file        VARCHAR(255)
+    );
+   
+
+  
+    DROP TABLE IF EXISTS       TransactionEntry;
+   
+  
+    CREATE TABLE IF NOT EXISTS TransactionEntry (
+      trans_entry_id     INTEGER AUTO_INCREMENT PRIMARY KEY,
+      trans_id        INTEGER,
+      entry_date        DATE,
+      entry_type        VARCHAR(2),
+      acc_id        VARCHAR(32),
+      orig_amount        REAL,
+      amount        DECIMAL(13,3) DEFAULT 0.0,
+      debit_credit      enum  ('d','c'),
+      description       VARCHAR(255),
+      voucher_ref       VARCHAR(255),
+      tret_key_id        INTEGER DEFAULT 0 -- Cle de charge pour le decompte de charge
+    );
+   
+
+  
+    DROP TABLE IF EXISTS       TransactionEntryType;
+   
+  
+    CREATE TABLE IF NOT EXISTS TransactionEntryType (
+      type_id     INTEGER AUTO_INCREMENT PRIMARY KEY,
+      type_code VARCHAR(2), -- BQ, VT, OD 
+      type_desc    VARCHAR(255)
+    );
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('BQ','Banque');
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('VT','Ventes');
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('HA','Achats et frais');
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('OD','Operation divers');
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('AF','Appels de fonds');
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('RF','Remboursement appels de fonds');
+   
+  
+    INSERT INTO TransactionEntryType (type_code,type_desc) VALUES ('AN','Report a nouveau');
+   
+  
+    DROP TABLE IF EXISTS       JoinIdentityAccount;
+   
+  
+    CREATE TABLE IF NOT EXISTS JoinIdentityAccount (
+      jia_id    INTEGER AUTO_INCREMENT PRIMARY KEY,
+      jia_ident INTEGER,
+      jia_acc   INTEGER
+    );
+   
+  
+  
+    CREATE OR REPLACE VIEW Owners AS SELECT ident_id,ident_name,ident_firstname, ident_address, ident_postalcode,
+           ident_city,ident_country,ident_mobile,ident_phone,ident_email1,
+           ident_email2, ir.idr_name FROM users.Users as u
+             JOIN users.UserRoles as ur on ur.ur_user_id = u.ident_id
+             JOIN users.IdentityRole as ir on ur.ur_role_id =ir.idr_id
+             WHERE ur.ur_org_id = {org_id}  and ir.idr_name = "Coproprietaire";
+   
+  
+  
+    CREATE OR REPLACE VIEW Suppliers AS select ident_id,ident_name,ident_firstname,ident_address,
+          ident_postalcode,ident_city,ident_country,ident_mobile,ident_phone,
+          ident_email1,ident_email2 FROM users.Identity as i
+                 JOIN users.IdentityType as it on (i.ident_type = it.idtp_id)
+                 JOIN users.UserRoles as ur on (ur.ur_user_id = i.ident_id)
+                 JOIN users.IdentityRole as ir on (ir.idr_id = ur.ur_role_id )
+                 WHERE ur.ur_org_id = {org_id} and ir.idr_name ="Fournisseur";
+   
+
+
+
+  
+    DROP TABLE IF EXISTS Lot;
+   
+
+  
+    CREATE TABLE IF NOT EXISTS Lot (
+      lot_id         INTEGER AUTO_INCREMENT PRIMARY KEY,
+      lot_num         INTEGER UNIQUE,
+      lot_floor     VARCHAR(32) DEFAULT "RDC",
+      lot_area      INTEGER DEFAULT 0,
+      lot_room      INTEGER DEFAULT 0,
+      lot_name         VARCHAR(32),
+      lot_type      VARCHAR(32),
+      lot_building  VARCHAR(32),
+      lot_door      VARCHAR(32),
+      lot_description   VARCHAR(256)
+    );
+   
+
+  
+    DROP TABLE IF EXISTS PosteCharge;
+   
+  
+    CREATE TABLE IF NOT EXISTS PosteCharge (
+      pc_id    INTEGER AUTO_INCREMENT PRIMARY KEY,
+      pc_sz    INTEGER DEFAULT 0,
+      pc_name  VARCHAR(64),
+      pc_comment   VARCHAR(256)
+    );
+   
+
+  
+    INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC1","Charges Générales");
+    INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC2","Charges Exceptionnelles");
+    INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC3","Non Utilisé");
+    INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC4","Charges Chauffage");
+    INSERT INTO PosteCharge (pc_name,pc_comment) VALUES ("PC5","Charges Eau");
+   
+
+  
+    DROP TABLE IF EXISTS Tantieme;
+   
+  
+    CREATE TABLE IF NOT EXISTS Tantieme (
+      tant_id INTEGER  AUTO_INCREMENT PRIMARY KEY,
+      tant_pc_id     INTEGER,
+      tant_lot_num    INTEGER,
+      tant_lot_size  REAL
+    );
+   
+
+
+  
+    DROP TABLE IF EXISTS LotsOwners;
+   
+  
+    CREATE TABLE LotsOwners (
+      lo_id     INTEGER AUTO_INCREMENT PRIMARY KEY,
+      lo_owner_id     INTEGER,
+      lo_lot_id     INTEGER
+    );
+   
+
+
+  
+    DROP PROCEDURE IF EXISTS insert_avance;
+   
+  
+    
+    CREATE PROCEDURE insert_avance(
+             IN ed DATE,
+             IN vouch VARCHAR(32),
+             IN bqaid VARCHAR(32),
+             IN aid VARCHAR(32),
+             IN am REAL, 
+            IN des VARCHAR(256))
+    BEGIN
+      INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES
+                  ( ed,ed,vouch,des);
+      SET @last_id = LAST_INSERT_ID();
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,entry_type,acc_id,amount,debit_credit,description) VALUES 
+         (@last_id,ed,vouch,"BQ",aid,am,'c',des);
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,entry_type,acc_id,amount,debit_credit,description) VALUES 
+         (@last_id,ed,vouch,"BQ",bqaid,am,'d',des);
+    END;
+     
+   
+
+  
+    DROP PROCEDURE IF EXISTS insert_trans_facture;
+   
+  
+     
+    CREATE PROCEDURE insert_trans_facture(IN er_date DATE,
+                    IN ed DATE,
+                    IN vouch VARCHAR(32),
+                    IN chaci INTEGER ,
+                    IN aci INTEGER,
+                    IN am REAL,
+                    IN des VARCHAR(256),
+                    IN key_id INTEGER
+                       )
+    BEGIN
+       INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (ed,er_date,vouch,des);
+      SET @last_id = LAST_INSERT_ID();
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES
+         (@last_id,ed,vouch,chaci,am,'d',des,'HA',key_id); 
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type,tret_key_id) VALUES 
+         (@last_id,ed,vouch,aci,am,'c',des,'HA',key_id); 
+    END;
+     
+   
+  
+    DROP PROCEDURE IF EXISTS insert_trans_paye;
+   
+  
+    CREATE PROCEDURE insert_trans_paye(IN tid DATE,IN ed DATE,IN vouch VARCHAR(32),
+             IN bqaci INTEGER ,
+             IN aci INTEGER,IN am REAL,IN des VARCHAR(256))
+    BEGIN
+       INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (ed,tid,vouch,des);
+      SET @last_id = LAST_INSERT_ID();
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+         (@last_id,tid,vouch,bqaci,am,'c',des,'BQ'); 
+      INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+         (@last_id,tid,vouch,aci,am,'d',des,'BQ'); 
+    END;
+     
+   
+
+  
+    DROP PROCEDURE IF EXISTS appel_fonds;
+   
+  
+CREATE PROCEDURE appel_fonds(
+                 IN ed DATE,
+                 IN copro_aid INTEGER ,
+                 IN prod_aid INTEGER,
+                 IN am REAL,
+                 IN des VARCHAR(256))
+BEGIN
+INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         (ed,ed,"",des);
+SET @last_id = LAST_INSERT_ID();
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,"",prod_aid,am,'c',des,'AF'); 
+  INSERT INTO TransactionEntry (trans_id,entry_date,voucher_ref,acc_id,amount,debit_credit,description,entry_type) VALUES 
+     (@last_id,ed,"",copro_aid,am,'d',des,'AF'); 
+END;
+     
+   
+
+
+  
+    DROP PROCEDURE IF EXISTS rembourse_appel_fonds;
+   
+  
+    CREATE PROCEDURE rembourse_appel_fonds(
+             IN ed DATE,
+             IN period  VARCHAR(32),
+             IN prod_aid INTEGER,
+             IN des VARCHAR(256))
+    BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE am DOUBLE;
+        DECLARE cur1 CURSOR FOR SELECT acc_id,sum(amount) as am  FROM TransactionEntry as te  
+        JOIN  Period as p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+                where entry_type = "AF" and acc_id like '450%' GROUP BY acc_id;
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (ed,ed,"",des);
+        SET @last_id = LAST_INSERT_ID();
+
+        OPEN cur1;
+
+        read_loop: LOOP
+        FETCH cur1 INTO a, am;
+        IF done THEN
+          LEAVE read_loop;
+        END IF;
+          IF am > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"RF",ed,"",prod_aid,am,'d',des);
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"RF",ed,"",a,am,'c',des);
+          END IF;
+        END LOOP;
+
+        CLOSE cur1;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS detail_compte_sans_solde;
+   
+  
+    CREATE PROCEDURE detail_compte_sans_solde(IN period VARCHAR(32), IN acc VARCHAR(32) )
+    BEGIN
+    --  select "Compte" ;
+      select entry_date as Date , 
+           voucher_ref as Ref,
+           description , 
+           CASE WHEN debit_credit='d' THEN ROUND(amount,2) ELSE 0 END as Debit, 
+           CASE WHEN debit_credit='c' THEN ROUND(amount,2) ELSE 0 END as Credit 
+         from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+        where acc_id=acc ORDER BY entry_date ASC;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS solde_compte;
+   
+  
+    CREATE PROCEDURE solde_compte(IN period VARCHAR(32), IN acc VARCHAR(32) )
+    BEGIN
+
+    select  
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+               sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+             THEN
+               -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+               ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END     as Solde
+        from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string =period    
+        where acc_id=acc ORDER BY entry_date;
+
+    END;
+   
+
+
+  
+    DROP PROCEDURE IF EXISTS bilan;
+   
+  
+    CREATE PROCEDURE bilan(IN period VARCHAR(32) )
+    BEGIN
+    select j.acc_id as Compte ,j.acc_name as Description
+                ,ROUND(sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2) as Debit ,
+                ROUND(sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)  as Credit ,
+                  CASE 
+            WHEN sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) > 0 THEN    
+                ROUND( sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END),2)
+            ELSE
+                ROUND( sum(CASE WHEN r.debit_credit ='c' THEN r.amount ELSE 0 END) - sum(CASE WHEN r.debit_credit ='d' THEN r.amount ELSE 0 END),2)
+            END    
+                as Solde
+    from  Account as j 
+      JOIN TransactionEntry AS r on j.acc_id = r.acc_id 
+      JOIN Period AS p on r.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+    GROUP BY j.acc_id ;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS journal;
+   
+  
+    CREATE PROCEDURE journal(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER )
+    BEGIN
+    select j.entry_date as Date, j.acc_id as Compte  , j.voucher_ref as Ref ,j.description as Libelle
+                ,ROUND((CASE WHEN j.debit_credit ='d' THEN j.amount ELSE 0 END), preci) as Debit ,
+                ROUND((CASE WHEN j.debit_credit ='c' THEN j.amount ELSE 0 END), preci)  as Credit 
+    from  TransactionEntry as j 
+      JOIN Account AS r on j.acc_id = r.acc_id 
+      JOIN Period AS p on j.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+      WHERE j.entry_type = jrn ORDER BY j.entry_date
+    ;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS journal_solde;
+   
+  
+    CREATE PROCEDURE journal_solde(IN period VARCHAR(32),IN jrn VARCHAR(2),IN preci INTEGER )
+    BEGIN
+    select ROUND(sum(CASE WHEN j.debit_credit ='d' THEN j.amount ELSE 0 END), preci) as Debit ,
+                ROUND(sum(CASE WHEN j.debit_credit ='c' THEN j.amount ELSE 0 END), preci)  as Credit 
+    from  TransactionEntry as j 
+      JOIN Account AS r on j.acc_id = r.acc_id 
+      JOIN Period AS p on j.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+      WHERE j.entry_type = jrn
+    ;
+    END;
+   
+
+
+  
+    DROP FUNCTION IF EXISTS FctTantieme;
+   
+
+  
+    CREATE FUNCTION FctTantieme( acc_id VARCHAR(32),
+                     charge_key INTEGER) 
+      RETURNS DOUBLE
+      NOT DETERMINISTIC
+      READS SQL DATA
+    BEGIN
+     DECLARE select_var DOUBLE;
+     SET select_var =(SELECT sum(tant_lot_size) FROM Tantieme as tant
+         JOIN Lot        as l  on l.lot_num = tant.tant_lot_num
+         JOIN LotsOwners as lo on lo.lo_lot_id = l.lot_id
+         JOIN Account    as a  on a.acc_id = acc_id
+         JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id and jia_ident = lo.lo_owner_id
+          WHERE tant_pc_id =charge_key); 
+          IF (select_var IS NULL) THEN
+        RETURN 0.0 ;
+          ELSE 
+        RETURN select_var ;
+          END IF;
+    END;
+   
+
+
+
+  
+    DROP PROCEDURE IF EXISTS repartir_charge_global;
+   
+  
+  
+    CREATE PROCEDURE  repartir_charge_global(IN dt DATE,in period TEXT)
+    BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE deb DOUBLE;
+        DECLARE cre DOUBLE;
+        DECLARE sol DOUBLE;
+        DECLARE pc INT;
+        DECLARE cur2 CURSOR FOR SELECT acc_id  FROM Account where acc_id like "6%";
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        SET @enabled = TRUE;
+       OPEN cur2;
+       read_loop_rg : LOOP
+       FETCH cur2 INTO a;
+         IF done THEN
+           LEAVE read_loop_rg;
+         END IF;
+         CALL solde_compte_out(period,a,deb,cre,sol,pc);
+         CALL debug_msg(@enabled,CONCAT(" Process account ",a," debit=",deb," cre=",cre," solde=",sol," pc=",pc," done=",done));
+         IF   sol < -0.01 THEN 
+           CALL debug_msg(@enabled,CONCAT(" Process account repartir ",deb));
+           CALL repartir_trans_charge(dt,dt,a,"",deb,pc,CONCAT("Repartion Charges compte ",a," Cle: ",pc));
+         END IF;
+       END LOOP read_loop_rg;
+       CLOSE cur2;
+    END;
+   
+
+
+
+  
+    DROP PROCEDURE IF EXISTS a_nouveau;
+   
+  
+    CREATE PROCEDURE  a_nouveau(IN dt DATE,in period TEXT)
+    BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE deb DOUBLE;
+        DECLARE cre DOUBLE;
+        DECLARE sol DOUBLE;
+        DECLARE pc INT;
+        DECLARE cur2 CURSOR FOR SELECT acc_id  FROM Account ;
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+        SET @enabled = TRUE;
+        -- Create Transation
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 (dt,dt,"",CONCAT("Report a nouveau ",period))
+                 ;
+        SET @last_id = LAST_INSERT_ID();
+       OPEN cur2;
+       read_loop_rg : LOOP
+       FETCH cur2 INTO a;
+         IF done THEN
+           LEAVE read_loop_rg;
+         END IF;
+         CALL solde_compte_out(period,a,deb,cre,sol,pc);
+         CALL debug_msg(@enabled,CONCAT(" Process account ",a," debit=",deb," cre=",cre," solde=",sol," pc=",pc," done=",done));
+         IF   sol < -0.01 THEN 
+           CALL debug_msg(@enabled,CONCAT(" Process report débit ",deb));
+           INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"AN",dt,"",a,ABS(sol),'d',CONCAT("Report Solde ",period));
+         END IF;
+         IF   sol > 0.01 THEN 
+           CALL debug_msg(@enabled,CONCAT(" Process report positive ",deb));
+           INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"AN",dt,"",a,ABS(sol),'c',CONCAT("Report Solde ",period));
+         END IF;
+       END LOOP read_loop_rg;
+       CLOSE cur2;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS rembourse_trans_chauffage;
+   
+  
+    CREATE PROCEDURE rembourse_trans_chauffage( IN trs_dt DATE ,
+                   IN ed       DATE,
+                   IN chrg     VARCHAR(32),
+                   IN vouch    VARCHAR(32),
+                   in am       DOUBLE,
+                   in cle      INTEGER,
+                   in des      VARCHAR(256)
+                 )
+
+    BEGIN
+        DECLARE done INT DEFAULT FALSE;
+        DECLARE a CHAR(16);
+        DECLARE tant DOUBLE;
+        DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantiemeFrac(acc_id,cle)  FROM Account where acc_id like '450%';
+        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+        INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                 ( ed,trs_dt,vouch,des);
+        SET @last_id = LAST_INSERT_ID();
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'d',des);
+        OPEN cur1;
+
+        read_loop: LOOP
+        FETCH cur1 INTO a, tant;
+        IF done THEN
+          LEAVE read_loop;
+        END IF;
+          IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant,'c',des);
+          END IF;
+        END LOOP;
+
+        CLOSE cur1;
+    END;
+   
+
+  
+    DROP PROCEDURE IF EXISTS detail_decompte_charge;
+   
+
+  
+    CREATE PROCEDURE detail_decompte_charge(
+                         IN user_id INTEGER,
+                         IN poste_charge_id INTEGER,
+                         IN period VARCHAR(32),
+                         IN preci INTEGER)
+    BEGIN
+  SET @myAccount := (SELECT acc_id FROM Account
+      JOIN JoinIdentityAccount as jia on jia.jia_acc = acc_id  
+      WHERE user_id = jia.jia_ident);
+  SELECT  te.`entry_date` as Date,
+        te.acc_id as Compte,
+        ac.`acc_name`,
+        te.description,
+        amount  as MontantTotal,
+	ROUND( FctTantieme(@myAccount,poste_charge_id)
+		     ,preci)
+
+     as Tan,
+        ROUND( (amount * FctTantiemeFrac(@myAccount,poste_charge_id) )
+		     ,preci
+        )  as Montant,
+       pc.pc_name as Cle from TransactionEntry as te
+       JOIN Account as ac on (ac.acc_id = te.acc_id)
+       JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+       JOIN Period AS p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+       where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+       ORDER BY te.entry_date;
+    END;
+   
+
+
+  
+DROP PROCEDURE IF EXISTS solde_compte_out;
+   
+  
+CREATE PROCEDURE solde_compte_out(IN period VARCHAR(32), IN acc VARCHAR(32), OUT Debit_ DOUBLE , INOUT Credit_ DOUBLE , INOUT Solde_ DOUBLE,INOUT Pc_ INT)
+BEGIN
+
+select  
+        ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) as Debit, 
+        ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2)
+             ELSE
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) 
+        END	 as Solde , t.tret_key_id INTO Debit_, Credit_, Solde_,Pc_
+       	from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and p.per_end and p.per_string =period	
+	where acc_id=acc ORDER BY entry_date LIMIT 1;
+
+END;
+   
+
+
+
+
+  
+DROP PROCEDURE IF EXISTS solde_compte_where;
+   
+  
+CREATE PROCEDURE solde_compte_where(IN period VARCHAR(32),  IN crit VARCHAR(128))
+BEGIN
+  SET @Stm = CONCAT("
+select  
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2),0) as Debit, 
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0) as Credit,
+        CASE WHEN
+		   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+	     THEN
+           COALESCE(
+	       -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0)
+             ELSE
+             COALESCE(
+		   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) , 0)
+        END	 as Solde
+        
+       	from TransactionEntry as t
+        join Period as p on t.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = '",period,"'	
+	 WHERE ", crit," ORDER BY entry_date;");
+     PREPARE q FROM @Stm;
+     EXECUTE q;
+     DEALLOCATE PREPARE q;
+
+END;
+   
+
+  
+  
+DROP PROCEDURE IF EXISTS pc_per_lot;
+   
+  
+    CREATE PROCEDURE pc_per_lot( )
+    BEGIN
+    SELECT
+      GROUP_CONCAT(DISTINCT
+        CONCAT('coalesce(sum(case when pc_name ="',pc_name,'" then tant_lot_size end),0)  as "',pc_name,'"')
+      )
+      INTO @sql
+    FROM PosteCharge;
+
+    SET @sql = CONCAT('select tant_lot_num, ',@sql, '
+      FROM Tantieme as t
+      JOIN PosteCharge as pc on t.tant_pc_id = pc.pc_id
+      GROUP BY tant_lot_num'
+     );
+
+    PREPARE Qstmt FROM @sql;
+    EXECUTE Qstmt;
+    DEALLOCATE PREPARE Qstmt;
+
+    END;
+   
+
+  
+DROP PROCEDURE IF EXISTS account_delete;
+   
+  
+    CREATE PROCEDURE account_delete( IN acc VARCHAR(32) )
+    BEGIN
+
+SELECT @myLeft := acc_left, @myRight := acc_right, @myWidth := acc_right - acc_left + 1
+FROM Account
+WHERE acc_id = acc;
+
+DELETE FROM Account WHERE acc_left BETWEEN @myLeft AND @myRight;
+
+UPDATE Account SET acc_right = acc_right - @myWidth WHERE acc_right > @myRight;
+UPDATE Account SET acc_left = acc_left - @myWidth WHERE acc_left > @myRight;
+
+    END;
+   
+
+  
+DROP PROCEDURE IF EXISTS detail_decompte_solde;
+   
+  
+CREATE PROCEDURE detail_decompte_solde(
+                                         IN user_id INTEGER,
+					 IN poste_charge_id INTEGER,
+                                         IN period VARCHAR(32),
+                                         IN preci INTEGER)
+BEGIN
+
+  SET @myAccount := (SELECT acc_id FROM Account
+      JOIN JoinIdentityAccount as jia on jia.jia_acc = acc_id  
+      WHERE user_id = jia.jia_ident);
+  SELECT  
+        sum(amount)  as MontantTotal,
+        ROUND( sum((amount  * (FctTantiemeFrac(@myAccount,pc.pc_id)
+                                  ))) ,preci
+        )  as Montant
+         from TransactionEntry as te
+   JOIN Account as ac on (ac.acc_id = te.acc_id)
+   JOIN PosteCharge as pc on (te.tret_key_id = pc.pc_id)
+   JOIN Period AS p on te.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = period
+   where    te.acc_id like '6%' and te.debit_credit  = 'd'  and IF (poste_charge_id != 0,te.tret_key_id = poste_charge_id,1)
+   ORDER BY te.entry_date;      
+
+END;
+
+   
+
+  
+DROP PROCEDURE IF EXISTS solde_compte_where;
+   
+  
+CREATE PROCEDURE solde_compte_where(IN period VARCHAR(32),  IN crit VARCHAR(128))
+BEGIN
+  SET @Stm = CONCAT("
+select
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2),0) as Debit,
+        COALESCE(ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0) as Credit,
+        CASE WHEN
+                   sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) > sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) > 0
+             THEN
+           COALESCE(
+               -1 * ROUND(sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END),2),0)
+             ELSE
+             COALESCE(
+                   ROUND(sum(CASE WHEN debit_credit='c' THEN amount ELSE 0 END) - sum(CASE WHEN debit_credit='d' THEN amount ELSE 0 END),2) , 0)
+        END      as Solde
+
+	        from TransactionEntry as t
+		        join Period as p on t.entry_date BETWEEN p.per_begin and  p.per_end and p.per_string = '",period,"'
+			         WHERE ", crit," ORDER BY entry_date;");
+     PREPARE q FROM @Stm;
+     EXECUTE q;
+          DEALLOCATE PREPARE q;
+
+END;
+   
+
+
+  
+DROP FUNCTION IF EXISTS FctTantiemeFrac;
+   
+  
+  
+CREATE FUNCTION FctTantiemeFrac( acc_id VARCHAR(32),
+                             charge_key INTEGER) 
+  RETURNS DOUBLE
+  NOT DETERMINISTIC
+  READS SQL DATA
+BEGIN
+ DECLARE select_var DOUBLE;
+ SET @tantTotal := (SELECT  COALESCE(sum(tant_lot_size),1.0)  FROM  Tantieme WHERE tant_pc_id = charge_key;
+ SET select_var =(SELECT sum(tant_lot_size) FROM Tantieme as tant
+         JOIN Lot        as l  on l.lot_num = tant.tant_lot_num
+         JOIN LotsOwners as lo on lo.lo_lot_id = l.lot_id
+         JOIN Account    as a  on a.acc_id = acc_id
+         JOIN JoinIdentityAccount as jia on jia.jia_acc = a.acc_id and jia_ident = lo.lo_owner_id
+      WHERE tant_pc_id =charge_key); 
+      IF (select_var IS NULL) THEN
+        RETURN 0.0 ;
+      ELSE 
+        RETURN select_var / @tantTotal;
+      END IF;
+END;
+   
+  
+  
+DROP PROCEDURE IF EXISTS repartir_trans_charge;
+   
+
+  
+CREATE PROCEDURE repartir_trans_charge(IN trs_dt DATE ,
+                           IN ed       DATE,
+                           IN chrg     VARCHAR(32),
+                           IN vouch    VARCHAR(32),
+                           in am       DOUBLE,
+                           in cle      INTEGER,
+                           in des      VARCHAR(256)
+                         )
+
+BEGIN
+    DECLARE done INT DEFAULT FALSE;
+    DECLARE a CHAR(16);
+    DECLARE tant DOUBLE;
+    DECLARE cur1 CURSOR FOR SELECT acc_id,FctTantiemeFrac(acc_id,cle)  FROM Account where acc_id like '450%';
+    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+
+    INSERT INTO Transactions (voucher_date,act_trans_date,voucher_ref,trans_label) VALUES 
+                         ( ed,trs_dt,vouch,des);
+    SET @last_id = LAST_INSERT_ID();
+    INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,chrg,am,'c',des);
+    OPEN cur1;
+
+    read_loop: LOOP
+    FETCH cur1 INTO a, tant;
+    IF done THEN
+      LEAVE read_loop;
+    END IF;
+      IF tant > 0  THEN
+        INSERT INTO TransactionEntry (trans_id,entry_type,entry_date,voucher_ref,acc_id,amount,debit_credit,description) VALUES 
+           (@last_id,"OD",ed,vouch,a,am*tant,'d',des);
+      END IF;
+    END LOOP;
+
+    CLOSE cur1;
+END;
+   
+
+
+ 
+XML;
+
+?>
diff --git a/app/compta/schema_pcmn_abrege_mysql.php b/app/compta/schema_pcmn_abrege_mysql.php
new file mode 100644
index 0000000..06b0b3c
--- /dev/null
+++ b/app/compta/schema_pcmn_abrege_mysql.php
@@ -0,0 +1,241 @@
+ 
+
+  
+  
+INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc,acc_left,acc_right) VALUES ("100000",100000, 0.0,"COMPTES DE CAPITAUX","",1,2);
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1","COMPTES DE CAPITAUX","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("101","Capital","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("105","Ecarts de réévaluation","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1061","Réserve légale","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1062","Réserves indisponible","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1063","Réserves statutaires ou contractuelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1064","Réserves réglementées","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("1068","Autres réserves","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("11","REPORT A NOUVEAU","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("12","RESULTAT NET DE L EXERCICE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("145","Amortissements dérogatories","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("146","Provision spéciale de réévaluation","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("147","Plus-values réinvesties","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("148","Autres provisions réglementées","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("15","PROVISIONS POUR RISQUES ET CHARGES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("16","EMPRUNTS ET DETTES ASSIMILEES","");
+   
+  
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("2","COMPTES D'IMMOBILISATIONS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("201","Frais d'établissement","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("206","Droit au bail","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("207","Fonds commercial","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("208","Autres immobilisations incorporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("21","IMMOBILISATIONS CORPORELLES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("23","IMMOBILISATIONS EN COURS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("27","AUTRES IMMOBILISATIONS FINANCIERES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("280","Amortissements des immobilisations incorporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("281","Amortissements des immobilisations corporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("290","Provisions pour dépréciation des immobilisations incorporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("291","Provisions pour dépréciation des immobilisations corporelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("297","Provisions pour dépréciation des autres immobilisations financières","");
+
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("3","COMPTES DE STOCKS ET D'EN-COURS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("31","MATIERES PREMIERES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("32","AUTRES APPROVISIONNEMENTS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("33","EN-COURS DE PRODUCTION DE BIENS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("34","EN-COURS DE PRODUCTION DE SERVICES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("35","STOCKS DE PRODUITS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("37","STOCKS DE MARCHANDISES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("391","Provisions pour dépréciation des matières premières","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("392","Provisions pour dépréciation des autres approvisionnements","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("393","Provisions pour dépréciation des en-cours de production des biens","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("394","Provisions pour dépréciation des en-cours de production de services","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("395","Provisions pour dépréciation des stocks de produits","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("397","Provisions pour dépréciation des stocks de marchandises","");
+
+
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("4","COMPTES DE TIERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("400","Fournisseurs et Comptes rattachés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("409","Fournisseurs débiteurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("410","Clients et Comptes rattachés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("419","Clients débiteurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("421","Personnel - Rémunérations dues","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("428","Personnel - Charges à payer et produits à recevoir","");
+
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("43","SECURITE SOCIALE ET AUTRES ORGANISMES SOCIAUX","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("444","Etat - Impôts sur les bénéfices","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("445","Etat - Taxes sur le chiffre d'affaires","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("447","Autres impôts, taxes et versements assimilés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("455","Associés - Comptes courants","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("46","DEBITEURS ET CREDITEURS DIVERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("47","COMPTES TRANSITOIRES OU D'ATTENTE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("481","Charges à répartir sur plusieurs exercices","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("486","Charges constatées d'avance","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("487","Produits constatés d'avance","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("491","Provisions pour dépréciation des comptes de clients","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("496","Provisions pour dépréciation des débiteurs divers","");
+CALL account_insert_beside("","100000","400000","COMPTES DE TIERS");
+   
+  
+CALL account_insert_beside("","400000","500000","COMPTES FINANCIERS");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("5","COMPTES FINANCIERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("50","VALEURS MOBILIERES DE PLACEMENT","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("51","BANQUES ETABLISSEMENTS FINANCIERS ET ASSIMILES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("53","CAISSE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("54","REGIS D'AVANCES ET ACCREDITIFS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("58","VIREMENTS INTERNES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("590","Provisions pour dépréciation des valeurs mobilières de placement","");
+   
+  
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("6","COMPTES DE CHARGES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("60","ACHATS (saufs 603)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("603","VARIATION DES STOCKS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("61","Services Exterieurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("62","Autres services extérieurs","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("63","IMPôTS TAXES ET VERSEMENT ASSIMILES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("641","Rémunération du personnel","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("644","Rémunération du travail de l'exploitant","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("645","Charges de sécurité sociale et de prévoyance","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("646","Cotisations sociales personnelles de l'exploitant","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("65","AUTRES CHARGES DE GESTIONS COURANTE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("66","CHARGES FINANCIERES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("67","CHARGES EXCEPTIONNELLES","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("681","Dotations aux amortissements et aux provisions - Charges d'exploitation","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("686","Dotations aux amortissements et aux provisions - Charges financières","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("687","Dotations aux amortissements et aux provisions - Charges exceptionnelles","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("691","Participation des salariés aux fruits de l'expansion","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("695","Impôts sur les bénéfices","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("697","Imposition forfaitaire annuelle des sociétés","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("699","Produits - Reports en arrière des déficits","");
+CALL account_insert_beside("","500000","600000","COMPTES DE CHARGES");
+   
+  
+CALL account_insert_beside("","600000","70","COMPTES DE PROVISION");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("7","COMPTES DE PRODUITS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("701","Ventes de produits finis","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("706","Prestations de services","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("707","Ventes de marchandises","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("708","Produits des activités annexes","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("709","Rabais, remises et ristournes accordés par l'entreprise","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("713","VARIATION DES STOCKS (en-cours de production)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("72","PRODUCTION IMMOBILISEE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("74","SUBVENTIONS D'EXPLOITATION","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("75","AUTRES PRODUITS DE GESTION COURANTE","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("76","PRODUITS FINANCIERS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("77","PRODUITS EXCEPTIONNELS","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("781","Reprises sur amortissements et provisions (à inscrire dans les produits d'exploitation)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("786","Reprises sur provisions (à inscrire dans les produits fianciers)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("787","Reprises sur provisions (à inscrire dans les produits exceptionnels)","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("79","TRANSFERTS DE CHARGES","");
+
+
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("8","COMPTES SCPECIAUX","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("80","ENGAGEMENTS HORS BILAN","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("801","Engagements donnés par l'entreprise","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("802","Engagements reçus par l'entreprise","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("809","Contrepartie des engagements","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("88","RESULTAT EN INSTANCE D'AFFECTATION","");
+INSERT INTO Pcg (pcg_acc,pcg_acc_name,pcg_acc_type) VALUES ("89","BILAN","");
+   
+
+  
+CALL account_insert_below("","400000","401000","Fournisseurs");
+   
+
+  
+CALL account_insert_below("","100000","103000","Avances");
+   
+  
+CALL account_insert_below("","103000","103100","Avances de tresorerie");
+   
+
+  
+CALL account_insert_beside("","401000","450000","Collectivite des Coproprietaires");
+   
+  
+CALL account_insert_beside("","450000","460000","DEBITEURS ET CREDITEURS DIVERS");
+   
+
+  
+CALL account_insert_below("","460000","461000","Debiteur Divers");
+   
+  
+CALL account_insert_beside("","461000","462000","Credit Divers");
+   
+
+  
+CALL account_insert_below("","500000","512000","BANQUES");
+   
+  
+CALL account_insert_below("","600000","601000","Eau");
+   
+  
+CALL account_insert_beside("","601000","602000","Electricite");
+   
+  
+CALL account_insert_beside("","602000","603000","Chauffage, energie et combustible");
+   
+  
+CALL account_insert_beside("","603000","604000","Achat produits d'entretien");
+   
+  
+CALL account_insert_beside("","604000","605000","Materiel");
+   
+  
+CALL account_insert_beside("","605000","606000","Fourniture");
+   
+  
+CALL account_insert_beside("","606000","611000","Nettoyage des locaux");
+   
+  
+CALL account_insert_beside("","611000","614000","Control de maintenance");
+   
+  
+CALL account_insert_beside("","614000","615000","Entretien et petites reparations");
+   
+  
+CALL account_insert_beside("","615000","616000","Prime d'assurance");
+   
+  
+CALL account_insert_beside("","616000","620000","Frais d'administration");
+   
+  
+CALL account_insert_beside("","620000","621300","Frais postaux");
+   
+  
+CALL account_insert_beside("","621300","622200","Prestation particulière");
+   
+  
+CALL account_insert_beside("","622200","622300","Autres honoraires");
+   
+  
+CALL account_insert_beside("","622300","671000","Travaux decides par assemblee generale");
+   
+  
+CALL account_insert_beside("","671000","672000","Travaux urgents");
+   
+  
+CALL account_insert_below("","70","700000","Appels de fonds");
+   
+
+  
+CALL account_insert_beside("","700000","701000","Provision sur operations courantes");
+   
+  
+CALL account_insert_beside("","701000","702000","Provision sur travaux de l'article 14.2");
+   
+  
+CALL account_insert_beside("","702000","703000","Avances");
+   
+  
+CALL account_insert_beside("","703000","714000","Produits divers");
+   
+ 
+XML;
+?>
diff --git a/app/compta/schema_pcmn_syndic_mysql.php b/app/compta/schema_pcmn_syndic_mysql.php
new file mode 100644
index 0000000..900021e
--- /dev/null
+++ b/app/compta/schema_pcmn_syndic_mysql.php
@@ -0,0 +1,124 @@
+ 
+
+  
+  
+        INSERT INTO Account (acc_id,acc_info_id,acc_balance,acc_name,acc_desc,acc_left,acc_right) VALUES ("100000",100000, 0.0,"COMPTES DE CAPITAUX","",1,2);
+   
+  
+CALL account_insert_beside("","100000","400000","COMPTES DE TIERS");
+   
+  
+CALL account_insert_beside("","400000","500000","COMPTES FINANCIERS");
+   
+  
+CALL account_insert_beside("","500000","600000","COMPTES DE CHARGES");
+   
+  
+CALL account_insert_beside("","600000","70","COMPTES DE PROVISION");
+   
+
+  
+CALL account_insert_below("","400000","401000","Fournisseurs");
+   
+
+  
+CALL account_insert_below("","100000","103000","Avances");
+   
+  
+CALL account_insert_below("","103000","103100","Avances de tresorerie");
+   
+
+  
+CALL account_insert_beside("","401000","450000","Collectivite des Coproprietaires");
+   
+  
+CALL account_insert_beside("","450000","460000","DEBITEURS ET CREDITEURS DIVERS");
+   
+
+  
+CALL account_insert_below("","460000","461000","Debiteur Divers");
+   
+  
+CALL account_insert_beside("","461000","462000","Credit Divers");
+   
+
+  
+CALL account_insert_below("","500000","512000","BANQUES");
+   
+  
+CALL account_insert_below("","600000","601000","Eau");
+   
+  
+CALL account_insert_beside("","601000","602000","Electricite");
+   
+  
+CALL account_insert_beside("","602000","603000","Chauffage, energie et combustible");
+   
+  
+CALL account_insert_beside("","603000","604000","Achat produits d'entretien");
+   
+  
+CALL account_insert_beside("","604000","605000","Materiel");
+   
+  
+CALL account_insert_beside("","605000","606000","Fourniture");
+   
+  
+CALL account_insert_beside("","606000","611000","Nettoyage des locaux");
+   
+  
+CALL account_insert_beside("","611000","614000","Control de maintenance");
+   
+  
+CALL account_insert_beside("","614000","615000","Entretien et petites reparations");
+   
+  
+CALL account_insert_beside("","615000","616000","Prime d'assurance");
+   
+  
+CALL account_insert_beside("","616000","620000","Frais d'administration");
+   
+  
+CALL account_insert_beside("","620000","621300","Frais postaux");
+   
+  
+CALL account_insert_beside("","621300","622200","Prestation particulière");
+   
+  
+CALL account_insert_beside("","622200","622300","Autres honoraires");
+   
+  
+CALL account_insert_beside("","622300","671000","Travaux decides par assemblee generale");
+   
+  
+CALL account_insert_beside("","671000","672000","Travaux urgents");
+   
+  
+CALL account_insert_below("","70","700000","Appels de fonds");
+   
+
+  
+CALL account_insert_beside("","700000","701000","Provision sur operations courantes");
+   
+  
+CALL account_insert_beside("","701000","702000","Provision sur travaux de l'article 14.2");
+   
+  
+CALL account_insert_beside("","702000","703000","Avances");
+   
+  
+CALL account_insert_beside("","703000","714000","Produits divers");
+   
+ 
+XML;
+?>
diff --git a/app/compta/services.js b/app/compta/services.js
new file mode 100644
index 0000000..d19132a
--- /dev/null
+++ b/app/compta/services.js
@@ -0,0 +1,524 @@
+define(["require", "exports"], function (require, exports) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Services;
+    (function (Services) {
+        class ReqOptions {
+            constructor() {
+                this.limit = 15;
+                this.offset = 0;
+            }
+        }
+        class EmptyReqParams {
+            constructor() {
+                this.json = () => { return {}; };
+            }
+        }
+        Services.EmptyReqParams = EmptyReqParams;
+        class DummyReqParams {
+            constructor(_p = "") {
+                this._dummy = _p;
+                console.log('DummyReqParams : ' + this._dummy);
+                this.json = () => {
+                    var res = { "dummy": "" };
+                    console.log('DummyReqParam.json : ');
+                    return res;
+                };
+            }
+            get dummy() { return this._dummy; }
+            set dummy(_v) { this._dummy = _v; }
+        }
+        Services.DummyReqParams = DummyReqParams;
+        class ReqTwoParams {
+            constructor(p1 = "", p2 = "") {
+                this._p1 = p1;
+                this._p2 = p2;
+                console.log('ReqTwoParams : p1=' + p1 + " p2=" + p2);
+                this.json = () => {
+                    console.log('ReqTwoParam.json : ');
+                    return {};
+                };
+            }
+            get p1() { return this._p1; }
+            set p1(_v) { this._p1 = _v; }
+            get p2() { return this._p2; }
+            set p2(_v) { this._p2 = _v; }
+        }
+        Services.ReqTwoParams = ReqTwoParams;
+        class ReqThreeParams extends ReqTwoParams {
+            constructor(p1 = "", p2 = "", p3 = "") {
+                super(p1, p2);
+                this._p3 = p3;
+                console.log('ReqThreeParams :' + " p3=" + p3);
+            }
+            get p3() { return this._p3; }
+            set p3(_v) { this._p3 = _v; }
+        }
+        Services.ReqThreeParams = ReqThreeParams;
+        class ReqFourParams extends ReqThreeParams {
+            constructor(p1 = "", p2 = "", p3 = "", p4 = "") {
+                super(p1, p2, p3);
+                this._p4 = p4;
+                console.log('ReqFourParams :' + " p4=" + p4);
+            }
+            get p4() { return this._p4; }
+            set p4(_v) { this._p4 = _v; }
+        }
+        Services.ReqFourParams = ReqFourParams;
+        class ReqFiveParams extends ReqFourParams {
+            constructor(p1 = "", p2 = "", p3 = "", p4 = "", p5 = "") {
+                super(p1, p2, p3, p4);
+                this._p5 = p5;
+                console.log('ReqFiveParams : p3=' + p3 + ' p4=' + p4 + " p5=" + p5);
+            }
+            get p5() { return this._p5; }
+            set p5(_v) { this._p5 = _v; }
+        }
+        Services.ReqFiveParams = ReqFiveParams;
+        class ReqSixParams extends ReqFiveParams {
+            constructor(p1 = "", p2 = "", p3 = "", p4 = "", p5 = "", p6 = "") {
+                super(p1, p2, p3, p4, p5);
+                this._p6 = p6;
+                console.log('ReqThreeParams :' + " p6=" + p6);
+            }
+            get p6() { return this._p6; }
+            set p6(_v) { this._p6 = _v; }
+        }
+        Services.ReqSixParams = ReqSixParams;
+        class ReqSevenParams extends ReqSixParams {
+            constructor(p1 = "", p2 = "", p3 = "", p4 = "", p5 = "", p6 = "", p7 = "") {
+                super(p1, p2, p3, p4, p5, p6);
+                this._p7 = p7;
+                console.log('ReqSevenParams :' + " p7=" + p7);
+            }
+            get p7() { return this._p7; }
+            set p7(_v) { this._p7 = _v; }
+        }
+        Services.ReqSevenParams = ReqSevenParams;
+        class ReqHeightParams extends ReqSevenParams {
+            constructor(p1 = "", p2 = "", p3 = "", p4 = "", p5 = "", p6 = "", p7 = "", p8 = "") {
+                super(p1, p2, p3, p4, p5, p6, p7);
+                this._p8 = p8;
+                console.log('ReqSevenParams :' + " p8=" + p8);
+            }
+            get p8() { return this._p8; }
+            set p8(_v) { this._p8 = _v; }
+        }
+        Services.ReqHeightParams = ReqHeightParams;
+        class TransactionsReqParams {
+            constructor(_type, _amount, _offset) {
+                this._type = _type;
+                this._amount = _amount;
+                this._offset = _offset;
+                console.log('TransactionsReqParams : ' + _type + " " + _amount + " " + _offset);
+                this.json = () => {
+                    var res = { "_type": _type, "_amount": _amount, "_offset": _offset };
+                    return res;
+                };
+            }
+        }
+        Services.TransactionsReqParams = TransactionsReqParams;
+        class UserRoleReqParams {
+            constructor(_id, _user, _role) {
+                this._id = _id;
+                this._user = _user;
+                this._role = _role;
+                console.log('UserRoleReqParams : ' + _id + " " + _user + " " + _role);
+                this.json = () => {
+                    var res = { "dummy": "" };
+                    return res;
+                };
+            }
+            get id() { return this._id; }
+            set id(_v) { this._id = _v; }
+            get user() { return this._user; }
+            set user(_v) { this._user = _v; }
+            get role() { return this._role; }
+            set role(_v) { this._role = _v; }
+        }
+        Services.UserRoleReqParams = UserRoleReqParams;
+        class AccountListReqParams {
+            constructor(_cat, _tree = 0) {
+                var obj = this;
+                console.log('AcountListReqParams : ' + _cat + " tree=" + _tree);
+                obj._categorie = _cat;
+                obj._tree = _tree;
+            }
+            get categorie() {
+                return this._categorie;
+            }
+            get tree() {
+                return this._tree;
+            }
+        }
+        Services.AccountListReqParams = AccountListReqParams;
+        class AddAccountReqParams {
+            constructor(_acc, _lib, _par) {
+                this._acc = _acc;
+                this._lib = _lib;
+                this._par = _par;
+                console.log('AddAccountReqParams : ' + _acc + " " + _lib);
+                this.json = () => {
+                    var res = { "dummy": "" };
+                    return res;
+                };
+            }
+            get acc() { return this._acc; }
+            set acc(_v) { this._acc = _v; }
+            get lib() { return this._lib; }
+            set lib(_v) { this._lib = _v; }
+        }
+        Services.AddAccountReqParams = AddAccountReqParams;
+        class EntriesReqParams {
+            constructor(_period, _acc) {
+                this._period = _period;
+                this._acc_id = _acc;
+                this.options = new ReqOptions();
+                this.options.limit = 15;
+                this.options.offset = 0;
+                var obj = this;
+                this.json = () => {
+                    var res = { "period": obj._period,
+                        "acc_id": obj._acc_id,
+                        "opt": obj.options
+                    };
+                    console.log('EntrieReqParam.json : ' + obj.acc_id + "%o", obj.options);
+                    return res;
+                };
+            }
+            get period() { return this._period; }
+            set period(_v) { this._period = _v; }
+            get acc_id() { return this._acc_id; }
+            set acc_id(_v) { this._acc_id = _v; }
+        }
+        Services.EntriesReqParams = EntriesReqParams;
+        class ExCreateReqParams extends EmptyReqParams {
+            constructor(_desc, _debut, _fin) {
+                super();
+                this._desc = _desc;
+                this._debut = _debut;
+                this._fin = _fin;
+            }
+            get desc() { return this._desc; }
+            set desc(_v) { this._desc = _v; }
+        }
+        Services.ExCreateReqParams = ExCreateReqParams;
+        class SetTantiemeReqParams {
+            constructor(_id, _chrg_id, _lot, _tant) {
+                this._id = _id;
+                this._charge_id = _chrg_id;
+                this._lot = _lot;
+                this._tant = _tant;
+                console.log('SetTantiemeReqParams : ' + _id + " " + _tant);
+                this.json = () => {
+                    var res = { "dummy": "" };
+                    return res;
+                };
+            }
+            get id() { return this._id; }
+            set id(_v) { this._id = _v; }
+            get charge_id() { return this._charge_id; }
+            set charge_id(_v) { this._charge_id = _v; }
+            get lot() { return this._lot; }
+            set lot(_v) { this._lot = _v; }
+            get tant() { return this._tant; }
+            set tant(_v) { this._tant = _v; }
+        }
+        Services.SetTantiemeReqParams = SetTantiemeReqParams;
+        class Organisation {
+            constructor(_title, _adress, _cp, _ville) {
+                this.title = _title;
+                this.cp = _cp;
+                this.ville = _ville;
+                this.adress = _adress;
+            }
+            isValid() {
+                return !(this.title == ""
+                    || this.adress == ""
+                    || this.cp == ""
+                    || this.ville == "");
+            }
+        }
+        Services.Organisation = Organisation;
+        ;
+        class CreateOrgReqParams {
+            constructor(_org) {
+                this._ident = _org;
+            }
+            get org() { return this._ident; }
+            set org(_v) { this._ident = _v; }
+        }
+        Services.CreateOrgReqParams = CreateOrgReqParams;
+        class structUser {
+            constructor(_name, _firstname, _address, _code, _ville, _email1) {
+                this.name = _name;
+                this.firstname = _firstname;
+                this.code = _code;
+                this.ville = _ville;
+                this.address = _address;
+                this.email1 = _email1;
+            }
+        }
+        Services.structUser = structUser;
+        ;
+        class UserReqParams {
+            constructor(_org, _ident, _update = false) {
+                this._org = _org;
+                this._ident = _ident;
+                this._update = _update;
+            }
+            get user() { return this._ident; }
+            set user(_v) { this._ident = _v; }
+            get update() { return this._update; }
+            set update(_v) { this._update = _v; }
+            get org() { return this._org; }
+            set org(_v) { this._org = _v; }
+        }
+        Services.UserReqParams = UserReqParams;
+        class PlanComptable {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "pcmn";
+            }
+            getAccountList(_param, _onSuccess, _onFailure) {
+                console.log(this._service + ":getAccountList :" + _param.categorie, _param.tree);
+                this._requester.handlefct(this._service, 'getAccountList', _param, _onSuccess, _onFailure);
+            }
+            getFournisseur(_param, _onSuccess, _onFailure) {
+                console.log("PlanComptable:getFournisseur");
+                this._requester.handlefct(this._service, 'getFournisseur', _param, _onSuccess, _onFailure);
+            }
+            getBilan(_param, _onSuccess, _onFailure) {
+                console.log("PlanComptable:getBilan " + _param.dummy);
+                this._requester.handlefct(this._service, 'getBilan', _param, _onSuccess, _onFailure);
+            }
+            getAccountInfo(_param, _onSuccess, _onFailure) {
+                console.log("PlanComptable:getAccountInfo " + _param.dummy);
+                this._requester.handlefct(this._service, 'getAccountInfo', _param, _onSuccess, _onFailure);
+            }
+            addAccount(_param, _onSuccess, _onFailure) {
+                console.log("PlanComptable:addAccount " + _param.acc);
+                this._requester.handlefct(this._service, 'addAccount', _param, _onSuccess, _onFailure);
+            }
+            updateAccountName(_param, _onSuccess, _onFailure) {
+                console.log("PlanComptable:updateAccountName " + _param.p1 + " " + _param.p2);
+                this._requester.handlefct(this._service, 'updateAccountName', _param, _onSuccess, _onFailure);
+            }
+            deleteAccount(_param, _onSuccess, _onFailure) {
+                console.log("PlanComptable:deleteAccount " + _param.dummy);
+                this._requester.handlefct(this._service, 'deleteAccount', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.PlanComptable = PlanComptable;
+        class Booking {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "booking";
+            }
+            postTransaction(_param, _onSuccess, _onFailure) {
+                console.log("Booking:postTransaction:");
+                this._requester.handlefct(this._service, 'postTransaction', _param, _onSuccess, _onFailure);
+            }
+            AppelFonds(_param, _onSuccess, _onFailure) {
+                console.log("Booking:AppelFonds: ");
+                this._requester.handlefct(this._service, 'appelFonds', _param, _onSuccess, _onFailure);
+            }
+            newBill(_param, _onSuccess, _onFailure) {
+                console.log("Booking:payeBill: " + _param.transi.amount);
+                this._requester.handlefct(this._service, 'newBill', _param, _onSuccess, _onFailure);
+            }
+            payBill(_param, _onSuccess, _onFailure) {
+                console.log("Booking:payBill: " + _param.transi.amount);
+                this._requester.handlefct(this._service, 'payBill', _param, _onSuccess, _onFailure);
+            }
+            Versement(_param, _onSuccess, _onFailure) {
+                console.log("VBooking:Versement: " + _param.transi.amount);
+                this._requester.handlefct(this._service, 'Versement', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.Booking = Booking;
+        class Retrieve {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "retrieve";
+            }
+            getTransaction(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getTransaction:");
+                this._requester.handlefct(this._service, 'getTransaction', _param, _onSuccess, _onFailure);
+            }
+            getTransactionByType(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getTransactionByType .. :" + " " + _param.json());
+                this._requester.handlefct(this._service, 'getTransactionByType', _param, _onSuccess, _onFailure);
+            }
+            getTransactionByDate(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getTransactionByDate:" + _param);
+                this._requester.handlefct(this._service, 'getTransactionByDate', _param, _onSuccess, _onFailure);
+            }
+            getEntriesByAccount(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getEntriesByAccount:" + _param.period + " " + _param.acc_id);
+                this._requester.handlefct(this._service, 'getEntriesByAccount', _param, _onSuccess, _onFailure);
+            }
+            getSoldeAccount(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getSoldeAccount:" + _param.period + " " + _param.acc_id);
+                this._requester.handlefct(this._service, 'getSoldeAccount', _param, _onSuccess, _onFailure);
+            }
+            getEntryTypes(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getEntryTypes: empty parameter");
+                this._requester.handlefct(this._service, 'getEntryTypes', _param, _onSuccess, _onFailure);
+            }
+            getEntriesByType(_param, _onSuccess, _onFailure) {
+                console.log("Retrieve:getEntriesByType:" + _param.period + " " + _param.acc_id + " limit:" + _param.options.limit);
+                this._requester.handlefct(this._service, 'getEntriesByType', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.Retrieve = Retrieve;
+        class Users {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "ident";
+            }
+            getCoproprietaires(_param, _onSuccess, _onFailure) {
+                console.log("USers:getCoproprietaire:" + _param);
+                this._requester.handlefct('syndic', 'getCoproprietaires', _param, _onSuccess, _onFailure);
+            }
+            associateAccount(_param, _onSuccess, _onFailure) {
+                console.log("Users:associateAccount : uid=" + _param.p1 + " acc=" + _param.p2 + " assoc=" + _param.p3);
+                this._requester.handlefct('syndic', 'associateUserAccount', _param, _onSuccess, _onFailure);
+            }
+            addInOrg(_param, _onSuccess, _onFailure) {
+                console.log("Users:addInOrg:" + _param.user.name);
+                this._requester.handlefct(this._service, 'addUserInOrg', _param, _onSuccess, _onFailure);
+            }
+            getByRole(_param, _onSuccess, _onFailure) {
+                console.log("Users:getByRole:" + _param.dummy);
+                this._requester.handlefct(this._service, 'getUsersRole', _param, _onSuccess, _onFailure);
+            }
+            setRole(_param, _onSuccess, _onFailure) {
+                console.log("Users:setRole:");
+                this._requester.handlefct(this._service, 'setUserRole', _param, _onSuccess, _onFailure);
+            }
+            resetRole(_param, _onSuccess, _onFailure) {
+                console.log("Users:setRole:");
+                this._requester.handlefct(this._service, 'resetUserRole', _param, _onSuccess, _onFailure);
+            }
+            Organisations(_param, _onSuccess, _onFailure) {
+                console.log("Users:Organisations:");
+                this._requester.handlefct(this._service, 'getApplicationDbs', _param, _onSuccess, _onFailure);
+            }
+            switchOrg(_param, _onSuccess, _onFailure) {
+                console.log("Users:switchOrg:" + _param.dummy);
+                this._requester.handlefct(this._service, 'switchOrg', _param, _onSuccess, _onFailure);
+            }
+            currentOrg(_param, _onSuccess, _onFailure) {
+                console.log("Users:currentOrg:" + _param.dummy);
+                this._requester.handlefct(this._service, 'currentOrg', _param, _onSuccess, _onFailure);
+            }
+            createOrg(_param, _onSuccess, _onFailure) {
+                console.log("Users:createOrg:");
+                this._requester.handlefct(this._service, 'createOrg', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.Users = Users;
+        class Exercice {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "exercice";
+            }
+            create(_param, _onSuccess, _onFailure) {
+                console.log("Exercice::create " + _param.desc);
+                this._requester.handlefct(this._service, 'create', _param, _onSuccess, _onFailure);
+            }
+            remove(_param, _onSuccess, _onFailure) {
+                console.log("Exercice:remove:" + _param);
+                this._requester.handlefct(this._service, 'remove', _param, _onSuccess, _onFailure);
+            }
+            list(_param, _onSuccess, _onFailure) {
+                console.log("Exercice::list " + _param.dummy);
+                this._requester.handlefct(this._service, 'getAll', _param, _onSuccess, _onFailure);
+            }
+            details(_param, _onSuccess, _onFailure) {
+                console.log("Exercice::details " + _param.dummy);
+                this._requester.handlefct(this._service, 'getDetails', _param, _onSuccess, _onFailure);
+            }
+            closing(_param, _onSuccess, _onFailure) {
+                console.log("Exercice:closing:" + _param.dummy);
+                this._requester.handlefct(this._service, 'closing', _param, _onSuccess, _onFailure);
+            }
+            setCurrent(_param, _onSuccess, _onFailure) {
+                console.log("Exercice:setCurrent:" + _param.dummy);
+                this._requester.handlefct(this._service, 'setCurrent', _param, _onSuccess, _onFailure);
+            }
+            repartirCharge(_param, _onSuccess, _onFailure) {
+                console.log("Exercice::repartirCharges");
+                this._requester.handlefct(this._service, 'repartirCharges', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.Exercice = Exercice;
+        class Lots {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "syndic";
+            }
+            list(_param, _onSuccess, _onFailure) {
+                console.log("Lots::list " + _param.dummy);
+                this._requester.handlefct(this._service, 'getLots', _param, _onSuccess, _onFailure);
+            }
+            add(_param, _onSuccess, _onFailure) {
+                console.log("Lots::add " + _param.p1 + " " + _param.p2);
+                this._requester.handlefct(this._service, 'addLot', _param, _onSuccess, _onFailure);
+            }
+            remove(_param, _onSuccess, _onFailure) {
+                console.log("Lots::remove" + _param.dummy);
+                this._requester.handlefct(this._service, 'removeLot', _param, _onSuccess, _onFailure);
+            }
+            fromUser(_param, _onSuccess, _onFailure) {
+                console.log("Lots:fromUser:" + _param.dummy);
+                this._requester.handlefct(this._service, 'getLotsUser', _param, _onSuccess, _onFailure);
+            }
+            assignToUser(_param, _onSuccess, _onFailure) {
+                console.log("Lots:assignToUser:" + _param);
+                this._requester.handlefct(this._service, 'assignLotToUser', _param, _onSuccess, _onFailure);
+            }
+            getKeysCharge(_param, _onSuccess, _onFailure) {
+                console.log("Lots:details:" + _param.dummy);
+                this._requester.handlefct(this._service, 'getKeysCharge', _param, _onSuccess, _onFailure);
+            }
+            getTantieme(_param, _onSuccess, _onFailure) {
+                console.log("Lots:getTantieme:" + _param.dummy);
+                this._requester.handlefct(this._service, 'getTantieme', _param, _onSuccess, _onFailure);
+            }
+            setTantieme(_param, _onSuccess, _onFailure) {
+                console.log("Lots:setTantieme:" + _param.tant);
+                this._requester.handlefct(this._service, 'setTantieme', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.Lots = Lots;
+        class Budget {
+            constructor(_req) {
+                this._requester = _req;
+                this._service = "budget";
+            }
+            list(_param, _onSuccess, _onFailure) {
+                console.log("Budget:list ");
+                this._requester.handlefct(this._service, 'getBudgets', _param, _onSuccess, _onFailure);
+            }
+            remove(_param, _onSuccess, _onFailure) {
+                console.log("Budget:remove ");
+                this._requester.handlefct(this._service, 'removeBudget', _param, _onSuccess, _onFailure);
+            }
+            add(_param, _onSuccess, _onFailure) {
+                console.log("Budget:remove ");
+                this._requester.handlefct(this._service, 'addBudget', _param, _onSuccess, _onFailure);
+            }
+            getEntries(_param, _onSuccess, _onFailure) {
+                console.log("Budget:getEntries p1=" + _param.p1 + " p2=" + _param.p2);
+                this._requester.handlefct(this._service, 'getBudgetEntries', _param, _onSuccess, _onFailure);
+            }
+            addEntry(_param, _onSuccess, _onFailure) {
+                console.log("Budget:addEntry p1=" + _param.p1 + " p2=" + _param.p2);
+                this._requester.handlefct(this._service, 'addBudgetEntry', _param, _onSuccess, _onFailure);
+            }
+        }
+        Services.Budget = Budget;
+    })(Services = exports.Services || (exports.Services = {}));
+});
diff --git a/app/compta/services.php b/app/compta/services.php
new file mode 100644
index 0000000..1e33372
--- /dev/null
+++ b/app/compta/services.php
@@ -0,0 +1,117 @@
+get('/',"compta#index")->setRoot($ctrl_dir);
+$r->get('/index',"compta#index")->setRoot($ctrl_dir);
+
+/* Organisation  */
+$r->get('/org',"org#index")->setRoot($ctrl_dir);
+$r->get('/org/index',"org#index")->setRoot($ctrl_dir);
+$r->get('/org/add',"org#add")->setRoot($ctrl_dir);
+$r->get('/org/users',"org#users")->setRoot($ctrl_dir);
+$r->post('/org/addPost',"org#addPost" ) ->setRoot($ctrl_dir);
+$r->post('/org/addCsv',"org#addCsv" ) ->setRoot($ctrl_dir);
+
+/* Lots  and postes charge */
+$r->get('/lot',"lot#index")->setRoot($ctrl_dir);
+$r->get('/lot/add',"lot#add")->setRoot($ctrl_dir);
+$r->post('/lot/addPost',"lot#addPost")->setRoot($ctrl_dir);
+$r->get('/lot/remove/?:id',"lot#remove")->setRoot($ctrl_dir);
+$r->get('/lot/attribuer/',"lot#attribuer")->setRoot($ctrl_dir);
+$r->get('/lot/associate/?:id/?:owner',"lot#index")->setRoot($ctrl_dir);
+$r->get('/lot/dissociate/?:id/?:owner',"lot#index")->setRoot($ctrl_dir);
+$r->get('/lot/update/?:id',"lot#update")->setRoot($ctrl_dir);
+$r->post('/lot/updatePost',"lot#updatePost")->setRoot($ctrl_dir);
+
+/* Bank services*/
+$r->get('/bank',"bank#index")->setRoot($ctrl_dir);
+$r->get('/bank/index',"bank#index")->setRoot($ctrl_dir);
+$r->get('/bank/add',"bank#add")->setRoot($ctrl_dir);
+$r->get('/bank/retour',"bank#index") ->setRoot($ctrl_dir);
+$r->get('/bank/upload',"bank#upload") ->setRoot($ctrl_dir);
+$r->post('/bank/uploadOFX',"bank#uploadOFX" ) ->setRoot($ctrl_dir);
+
+
+/* chart of Account services*/
+$r->get('/chart',"chart#index")->setRoot($ctrl_dir);
+$r->get('/chart/detail/?:id',"chart#detail")->setRoot($ctrl_dir);
+$r->get('/chart/classes/?:id',"chart#classes")->setRoot($ctrl_dir);
+$r->get('/chart/acount/?:id',"chart#account")->setRoot($ctrl_dir);
+
+/* Account services*/
+$r->get('/account',"account#index")->setRoot($ctrl_dir);
+$r->get('/account/detail/?:id',"account#detail")->setRoot($ctrl_dir);
+
+/* exercice */
+$r->get('/exercice',"exercice#index")->setRoot($ctrl_dir);
+$r->get('/exercice/',"exercice#index")->setRoot($ctrl_dir);
+$r->get('/exercice/select/?:id',"exercice#select")->setRoot($ctrl_dir);
+$r->get('/exercice/cloture/?:id',"exercice#cloture")->setRoot($ctrl_dir);
+$r->get('/exercice/add',"exercice#add")->setRoot($ctrl_dir);
+$r->post('/exercice/addPost',"exercice#Post")->setRoot($ctrl_dir);
+$r->get('/exercice/detail/?:id',"exercice#detail")->setRoot($ctrl_dir);
+
+
+/* Pret services*/
+$r->get('/loan',"loan#index")->setRoot($ctrl_dir);
+$r->get('/loan/index',"loan#index")->setRoot($ctrl_dir);
+$r->get('/loan/payer/?:id',"loan#payer")->setRoot($ctrl_dir);
+$r->post('/loan/payerPost',"loan#payerPost")->setRoot($ctrl_dir);
+$r->get('/loan/detail/?:id',"loan#detail")->setRoot($ctrl_dir);
+$r->get('/loan/nouveau',"loan#nouveau")->setRoot($ctrl_dir);
+
+/* Recurrent services*/
+$r->get('/recurrent',"recurrent#index")->setRoot($ctrl_dir);
+$r->get('/recurrent/index',"recurrent#index")->setRoot($ctrl_dir);
+$r->get('/recurrent/detail/?:id',"recurrent#detail")->setRoot($ctrl_dir);
+$r->get('/recurrent/update/?:id',"recurrent#update")->setRoot($ctrl_dir);
+$r->post('/recurrent/updatePost',"recurrent#updatePost" ) ->setRoot($ctrl_dir);
+$r->get('/recurrent/payer/?:id',"recurrent#payer")->setRoot($ctrl_dir);
+$r->get('/recurrent/nouveau',"recurrent#nouveau")->setRoot($ctrl_dir);
+$r->post('/recurrent/nouveauPost',"recurrent#nouveauPost" ) ->setRoot($ctrl_dir);
+
+/* journal  */
+$r->get('/jrnx',"jrnx#index")->setRoot($ctrl_dir);
+$r->get('/jrnx/',"jrnx#index")->setRoot($ctrl_dir);
+$r->get('/jrnx/list',"jrnx#list")->setRoot($ctrl_dir);
+$r->get('/jrnx/detail/?:id',"jrnx#detail")->setRoot($ctrl_dir);
+$r->get('/jrnx/detailMonth/?:id',"jrnx#detailMonth")->setRoot($ctrl_dir);
+
+/* transaction */
+$r->get('/transaction',"transaction#index")->setRoot($ctrl_dir);
+$r->get('/transaction/',"transaction#index")->setRoot($ctrl_dir);
+$r->get('/transaction/nouveau',"transaction#nouveau")->setRoot($ctrl_dir);
+$r->get('/transaction/detail',"transaction#detail")->setRoot($ctrl_dir);
+$r->get('/transaction/update/?:id',"transaction#update")->setRoot($ctrl_dir);
+$r->post('/transaction/updatePost',"transaction#updatePost")->setRoot($ctrl_dir);
+
+/* Bilan services*/
+$r->get('/bilan',"bilan#index")->setRoot($ctrl_dir);
+$r->get('/bilan/index',"bilan#index")->setRoot($ctrl_dir);
+$r->get('/bilan/synthese',"bilan#synthese")->setRoot($ctrl_dir);
+
+/* Budget services*/
+$r->get('/budget',"budget#index")->setRoot($ctrl_dir);
+$r->get('/budget/index',"budget#index")->setRoot($ctrl_dir);
+$r->get('/budget/detail/?:id',"budget#detail")->setRoot($ctrl_dir);
+$r->get('/budget/nouveau',"budget#nouveau")->setRoot($ctrl_dir);
+$r->get('/budget/update',"budget#update")->setRoot($ctrl_dir);
+$r->post('/budget/updatePost',"budget#updatePost")->setRoot($ctrl_dir);
+
+/* Admin services*/
+$r->get('/admin',"admin#index")->setRoot($ctrl_dir);
+$r->get('/admin/index',"admin#index")->setRoot($ctrl_dir);
+
+/**
+ * Run router
+ */
+ $r->run()->render();
+?>
diff --git a/app/compta/session.php b/app/compta/session.php
new file mode 100644
index 0000000..447d5f8
--- /dev/null
+++ b/app/compta/session.php
@@ -0,0 +1,137 @@
+conf_auth = $cfg;
+        $this->dbSession = new  DbSessions($this->conf_auth,$req_file);
+        parent::__construct($this->dbSession);
+        if ($this->is_logged_in()) {
+            $this->setCompta();
+        }
+    }
+
+    /**
+     * @brief return the appropriate service level
+     *   At least figure out if the user is authenticated or not.
+     *   Is he part of an accounting. What's his role in that accounting system.
+     *
+     */
+    function getServiceLevel() {
+        return SL_SYNDIC;
+    }
+
+    /**
+     * @brief set default compta parameters if not set
+     */
+    function setCompta() {
+       global $_SESSION;
+       if (! isset ($_SESSION['compta_db'])) {
+          $y = date('Y');
+          require_once(dirname(__FILE__)."/../member/class.json_db_user.php");
+          $u = new JsonUser($this, $this->conf_auth);
+          $dbs = $u->getApplicationDbs();
+          $this->compta_db   = $_SESSION["compta_db"]   = $dbs[0][2];
+          $this->compta_name = $_SESSION["compta_name"] = $dbs[0][1];
+          $this->compta_id   = $_SESSION["compta_org"]  = $dbs[0][0];
+          //error_log("SessionCompta:setCompta Org id :".$dbs[0][0]." Name=".$dbs[0][1]." Db Name=".$dbs[0][2]);
+          $this->roles  = $u->getUserRolesInOrg( $this->id(),$_SESSION['compta_org']);
+          try {
+              $this->org    = $u->getOrg($this->compta_id)[0];
+          } catch (Exception $e) {
+              $this->org = null;
+          }
+          // Update Session Db
+          $this->setCurrentExercice($y);
+          $this->setOrganizationId($dbs[0][0]);
+        } else {
+          /* Ok, refresh in case the user updated the configuration */
+          $cc = $this->dbSession->getOrganization($this->user_token);
+          if ( $cc[0] != 0) {
+              require_once(dirname(__FILE__)."/../member/class.json_db_user.php");
+              $u = new JsonUser($this, $this->conf_auth);
+              $o = $u->getOrg($cc[0]);
+              //error_log("SessionCompta:setCompta Org id :".$cc[0]." update" );
+              try {  
+                  $this->org         = $o[0];
+                  $this->compta_db   = $o[0][5];
+                  $this->compta_name = $o[0][0];
+                  $_SESSION["compta_db"]   = $o[0][5];
+                  $_SESSION["compta_name"] = $o[0][0];
+              } catch (Exception $e) {
+                  error_log("Session failed retrieve Org");
+                  $this->org         = null;
+                  $this->compta_db   = "";
+                  $this->compta_name = "";
+              }
+              $this->compta_id   = $cc[0];
+              $this->compta_exer = $cc[1];
+              $_SESSION["compta_org"]  = $cc[0];
+          }
+        }
+    }
+
+    /**
+     * @brief return database name 
+     */
+    function getDb() { return $this->compta_db ; }
+    
+    /**
+     * @brief return Organization Id 
+     */
+    function getOrganizationId() { return $this->compta_id ; }
+    
+    /**
+     * @brief return Organization Id 
+     */
+    function getOrganization() { return $this->org ; }
+    /**
+     * @brief Set Organization Id 
+     */
+    function setOrganizationId($id) {
+        $this->dbSession->updateSession($this->user_token,"organization",$id);
+        $this->compta_id =$id;
+    }
+    
+    /**
+     * @brief return Organization Id 
+     */
+    function getCurrentExercice() { return $this->compta_exer ; }
+    
+    /**
+     * @brief Update Exercice Id in session object
+     */
+    function setCurrentExercice( $n_exer) {
+        $this->dbSession->updateSession($this->user_token,"exercice",$n_exer);
+        $this->compta_exer = $n_exer;
+    }
+    function in_groupe($name) {
+        return in_array($name,$_SESSION['user_groupe_name']);
+    }
+}
+
+
+?>
diff --git a/app/compta/supplier.js b/app/compta/supplier.js
new file mode 100644
index 0000000..490176e
--- /dev/null
+++ b/app/compta/supplier.js
@@ -0,0 +1,479 @@
+define(["require", "exports", "./Dialog", "./transaction", "./services"], function (require, exports, Dialog_1, transaction_1, services_1) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Supplier;
+    (function (Supplier_1) {
+        class TransactionBill extends transaction_1.Ledger.Transaction {
+            constructor(_tp) {
+                super(_tp, "suppl");
+            }
+            getInfo(pref) {
+                var info = new transaction_1.Ledger.TransactionInfoBill(pref);
+                console.log("TransactionBill::getInfo");
+                return info;
+            }
+        }
+        class TransactionPaye extends transaction_1.Ledger.Transaction {
+            constructor(_tp) {
+                super(_tp, "suppl");
+            }
+            getInfo(pref) {
+                var info = new transaction_1.Ledger.TransactionInfoPaye(pref);
+                console.log("TransactionPaye::getInfo");
+                return info;
+            }
+        }
+        class DlgSupplier extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._booking = new services_1.Services.Booking(req);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+            }
+            onDummy(response) {
+                alert("DlgSupplier::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgSupplier::Dummy Error");
+            }
+            getFournisseur() {
+                let bindFct = this.onFournisseur.bind(this);
+                super.getFournisseur(bindFct, this.onDummy);
+            }
+            onFournisseur(response) {
+                try {
+                    console.log("DlgSupplier::onFournissuer");
+                    this.fillSupplier(response.result);
+                }
+                catch (e) {
+                    alert("Failed onFournisseur " + e.message);
+                }
+            }
+            fillSupplier(entries) {
+                var _obj = this;
+                var cl = 'supplier-list';
+                var c1 = $(cl + '-c1');
+                var c2 = $(cl + '-c2');
+                var ng = $(cl + '');
+                c1.innerHTML = "";
+                c2.innerHTML = "";
+                for (var i = 0; i < entries.length; i++) {
+                    var it = entries[i];
+                    if (i < entries.length / 2) {
+                        this.fillUser2c(c1, it);
+                    }
+                    else {
+                        this.fillUser2c(c2, it);
+                    }
+                }
+                if (gState.Mode == 'S') {
+                }
+                $$("a[id='supplier-modifier']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("Modifier Supplier : " + uid);
+                    });
+                });
+                $$("a[id='supplier-bill']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        var compte = elt.getAttribute('compte');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgSupplier:: a paye user : " + uid);
+                        Supplier_1.SupplierBill.show();
+                    });
+                });
+                $$("a[id='supplier-paye']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        var compte = elt.getAttribute('compte');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgSupplier:: a paye user : " + uid);
+                        Supplier_1.SupplierPayer.show();
+                    });
+                });
+                $$("a[id='supplier-decompte']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        var compte = elt.getAttribute('compte');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgSupplier: a decompte user : " + uid);
+                        Supplier_1.SupplierAccount.show();
+                    });
+                });
+                $$("a[id='supplier-dissocier']").each(function (elt) {
+                    elt.on("click", function (e) {
+                        var uid = elt.getAttribute('uid');
+                        e.stopImmediatePropagation();
+                        e.preventDefault();
+                        console.log("DlgSupplier:: dissocier user : " + uid);
+                    });
+                });
+            }
+            fillUser2c(row, it) {
+                var d = " ";
+                d += "" + it['acc_id'] + " " + it["acc_desc"];
+                d += " Solde " + it['solde'] + "  
";
+                d += "";
+                if (it['acc_id'] != 0) {
+                    d += "";
+                    d += "   ";
+                    d += "";
+                    d += "  ";
+                    d += "";
+                    d += " ";
+                }
+                d += " ";
+                d += " ";
+                row.innerHTML += d;
+            }
+            onShow() {
+                $("supplier-add").addClassName("hidden");
+                this.getFournisseur();
+            }
+            onLoaded(html) {
+                console.log("DlgSupplier::onLoaded Fournisseur");
+                this.show();
+            }
+        }
+        Supplier_1.DlgSupplier = DlgSupplier;
+        class DlgBill extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                this.onGetKeysCharge = function (resp) {
+                    alert("onGetKeysCharge");
+                };
+                var req = new AEBW.Json(jurl);
+                this._booking = new services_1.Services.Booking(req);
+                this._pcmn = new services_1.Services.PlanComptable(req);
+            }
+            onDummy(response) {
+                alert("DlgBill::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgBill::Dummy Error");
+            }
+            getKeysCharge() {
+                super.getKeysCharge(this.ongetKeysCharge, this.onDummy);
+            }
+            ongetKeysCharge(response) {
+                try {
+                    var cb = $('suppl_charge_key');
+                    var i = 0;
+                    cb.options.length = 0;
+                    for (i = 0; i < response.result.length; i++) {
+                        var item = response.result[i];
+                        cb.options[cb.options.length] = new Option(item[1] + "-" + item[2], item[0]);
+                    }
+                }
+                catch (e) {
+                    alert("ongetKeysCharge " + e.message);
+                }
+            }
+            getFournisseur() {
+                super.getFournisseur(this.onFournisseur, this.onDummy);
+            }
+            onFournisseur(response) {
+                try {
+                    var cb = $('suppl_id');
+                    cb.options.length = 0;
+                    var i = 0;
+                    for (i = 0; i < response.result.length; i++) {
+                        var item = response.result[i];
+                        cb.options[cb.options.length] = new Option(item['acc_id'] + "-" + item['acc_desc'], item['acc_id']);
+                    }
+                }
+                catch (e) {
+                    alert("Failed onFournisseur " + e.message);
+                }
+            }
+            getCharge() {
+                super.getCharge(this.onCharge, this.onDummyFail);
+            }
+            onCharge(response) {
+                try {
+                    var cb = $('suppl_charge');
+                    cb.options.length = 0;
+                    var i = 0;
+                    for (i = 0; i < response.result.length; i++) {
+                        var item = response.result[i];
+                        cb.options[cb.options.length] = new Option(item['acc_id'] + "-" + item['acc_desc'], item['acc_id']);
+                    }
+                }
+                catch (e) {
+                    alert("Failed onCharge " + e.message);
+                }
+            }
+            onLoaded(html) {
+                console.log("DlgBill Fourniseur onLoaded ...");
+            }
+            doRecord(tp) {
+                var t = new TransactionBill(tp);
+                console.log('DlgBill:doRecord enter');
+                try {
+                    var bindOnRecord = this.onRecord.bind(this);
+                    this._booking.newBill(t, bindOnRecord, this.onDummyFail);
+                    console.log('DlgBill::doRecord done : ');
+                }
+                catch (e) {
+                    alert("doRecord toJson failed" + e.message);
+                }
+            }
+            onRecord(tp) {
+                console.log("DlgBill::onRecord to be coded");
+                $('supplier_result').innerHTML = "Enregistrement Effectue La facture a été enregistré
";
+                Supplier_1.Supplier.show();
+            }
+            show() {
+                super.show();
+            }
+            onShow() {
+                var obj = this;
+                this.getKeysCharge();
+                var d = new Date();
+                var m = d.getMonth() + 1;
+                var day = d.getDate();
+                try {
+                    $('suppl_date').value = d.getFullYear() + '-' + ('0' + m).slice(-2) + '-' + ('0' + day).slice(-2);
+                }
+                catch (e) {
+                    alert("onShow: " + e.message);
+                }
+                this.getFournisseur();
+                this.getCharge();
+                Prototype.Event.observe($("btFFCancel"), "click", function () {
+                    Supplier_1.Supplier.show();
+                });
+                Prototype.Event.observe($('btFFRecord'), "click", function () {
+                    if (!AEBW.isDate($('suppl_date').value)) {
+                        alert('Validation mauvais format de date');
+                        $('suppl_date').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('suppl_date').style.border = '1px solid green';
+                    }
+                    if (!AEBW.isDate($('suppl_voucher_date').value)) {
+                        alert('Validation mauvais format de la date de facturation');
+                        $('suppl_voucher_date').style.border = '1px solid red';
+                        $('suppl_voucher_date').value = 'AAAA-MM-DD';
+                        return;
+                    }
+                    else {
+                        $('suppl_voucher_date').style.border = '1px solid green';
+                    }
+                    if (!AEBW.isNumber($('suppl_amount').value)) {
+                        alert('Validation mauvais format du montant. Peut-etre un probleme de point ou de virgule');
+                        $('suppl_amount').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('suppl_amount').style.border = '1px solid green';
+                    }
+                    obj.doRecord("HA");
+                });
+            }
+        }
+        Supplier_1.DlgBill = DlgBill;
+        class DlgPay extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._booking = new services_1.Services.Booking(req);
+            }
+            onDummy(response) {
+                alert("DlgPay::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgPay::Dummy Error");
+            }
+            doRecord(tp) {
+                var t = new TransactionPaye(tp);
+                console.log('Start doRecord');
+                try {
+                    var bindOnRecord = this.onRecord.bind(this);
+                    this._booking.payBill(t, bindOnRecord, this.onDummyFail);
+                }
+                catch (e) {
+                    alert("doRecord toJson failed" + e.message);
+                }
+            }
+            onRecord(response) {
+                $('supplier_result').innerHTML = "Enregistrement Effectue Le payement a été enregistré.
";
+                Supplier_1.Supplier.show();
+            }
+            getFournisseur() {
+                var bindFct = this.onFournisseur.bind(this);
+                super.getFournisseur(bindFct, this.onDummy);
+            }
+            onFournisseur(response) {
+                var cb = $('suppl_id');
+                super.fillCombo(cb, response.result);
+            }
+            onGetBanks(response) {
+                var cb = $('suppl_banque');
+                console.log("DlgPaye::onGetBanks ");
+                if (Array.isArray(response.result)) {
+                    super.fillCombo(cb, response.result);
+                }
+                else if (AEBW.isNumber(response.result)) {
+                    cb.options.length = 0;
+                    console.log("DlgPay::onGetBanks...int " + response.result);
+                }
+                else {
+                    console.log("DlgPay::onGetBanks... un handled " + response.result);
+                }
+            }
+            onShow() {
+                var obj = this;
+                var d = new Date();
+                var m = d.getMonth() + 1;
+                var day = d.getDate();
+                var bindFct = this.onGetBanks.bind(this);
+                super.getBanks(bindFct, this.onDummyFail);
+                this.getFournisseur();
+                $('suppl_voucher_date').placeholder = 'AAAA-MM-DD';
+                $('suppl_date').value = d.getFullYear() + '-' + ('0' + m).slice(-2) + '-' + ('0' + day).slice(-2);
+                Prototype.Event.observe($("btFPCancel"), "click", function () {
+                    Supplier_1.Supplier.show();
+                });
+                Prototype.Event.observe($('btFPRecord'), "click", function () {
+                    if (!AEBW.isDate($('suppl_date').value)) {
+                        alert('Validation mauvais format de date');
+                        $('suppl_date').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('suppl_date').style.border = '1px solid green';
+                    }
+                    if (!AEBW.isDate($('suppl_voucher_date').value)) {
+                        alert('Validation mauvais format de la date de facturation');
+                        $('suppl_voucher_date').style.border = '1px solid red';
+                        $('suppl_voucher_date').value = 'AAAA-MM-DD';
+                        return;
+                    }
+                    else {
+                        $('suppl_voucher_date').style.border = '1px solid green';
+                    }
+                    if (!AEBW.isNumber($('suppl_amount').value)) {
+                        alert('Validation mauvais format du montant. Peut-etre un probleme de point ou de virgule');
+                        $('suppl_amount').style.border = '1px solid red';
+                        return;
+                    }
+                    else {
+                        $('suppl_amount').style.border = '1px solid green';
+                    }
+                    obj.doRecord('BQ');
+                });
+            }
+            onLoaded(html) {
+                console.log("DlgPay::onLoaded Fournisseur");
+            }
+        }
+        class DlgAccount extends Dialog_1.ComptaDialog {
+            constructor(_id, uipath, jurl) {
+                super(_id, uipath, jurl);
+                var req = new AEBW.Json(jurl);
+                this._retrieve = new services_1.Services.Retrieve(req);
+            }
+            onDummy(response) {
+                alert("DlgAccount::Dummy Error" + response);
+            }
+            onDummyFail() {
+                alert("DlgAccount::DummyFail Error");
+            }
+            ongetExercices(response) {
+            }
+            getFournisseur() {
+                super.getFournisseur(this.onGetFournisseur, this.onDummy);
+            }
+            onGetFournisseur(response) {
+                var cb = $('cbSupplierAccount');
+                cb.options.length = 0;
+                for (var i = 0; i < response.result.length; i++) {
+                    var item = response.result[i];
+                    cb.options[cb.options.length] = new Option(item['acc_id'] + "-" + item['acc_desc'], item['acc_id']);
+                }
+            }
+            getAccount() {
+                var _params = new services_1.Services.EntriesReqParams(gState.Exercice, $('cbSupplierAccount').value);
+                var bindFct = this.onGetAccount.bind(this);
+                this._retrieve.getEntriesByAccount(_params, bindFct, this.onDummyFail);
+            }
+            onGetAccount(response) {
+                var tb = new AEBW.control.table('supplier_table_account');
+                super.cleanTable(tb, tb._NbRows);
+                var entries = response.result.entries;
+                for (var i = 0; i < entries.length; i++) {
+                    var it = entries[i];
+                    var row = tb.addRow();
+                    tb.getCell(tb._NbRows - 1, 0).innerHTML = it[0];
+                    tb.getCell(tb._NbRows - 1, 1).innerHTML = it[1];
+                    tb.getCell(tb._NbRows - 1, 2).innerHTML = it[2];
+                    row.cells[2].style.textAlign = "right";
+                    if (it[3] != 0.0) {
+                        tb.getCell(tb._NbRows - 1, 3).innerHTML = it[3];
+                        row.cells[3].style.textAlign = "right";
+                    }
+                    if (it[4] != 0.0) {
+                        tb.getCell(tb._NbRows - 1, 4).innerHTML = it[4];
+                        row.cells[4].style.textAlign = "right";
+                    }
+                    if (it[2] > it[3]) {
+                        row.cells[4].style.color = "red";
+                    }
+                }
+                var solde = response.result.solde;
+                $('supplierSoldeDebit').innerHTML = solde[0];
+                $('supplierSoldeCredit').innerHTML = solde[1];
+                $('supplierSoldeCompte').innerHTML = 'Solde : ' + solde[2];
+            }
+            onShow() {
+                this.getFournisseur();
+                var obj = this;
+                try {
+                    Prototype.Event.observe($('btSupplierVoir'), "click", function () {
+                        obj.getAccount();
+                    });
+                }
+                catch (e) {
+                    console.log("DlgAccount::onShow btSupplierVoir not available");
+                }
+                Prototype.Event.observe($('cbSupplierAccount'), "change", function () {
+                    obj.getAccount();
+                });
+                obj.getAccount();
+                setTimeout(function () {
+                }, 500);
+                $("iExercice").innerHTML = gState.Exercice;
+            }
+            onLoaded(html) {
+                console.log("DlgAcount::onLoaded ");
+            }
+        }
+        Supplier_1.Supplier = new DlgSupplier("supplier", "./forms.php?panel=supplier_add", "/app/compta/index.php");
+        Supplier_1.SupplierBill = new DlgBill("supplier", "./forms.php?panel=supplier_bill", "/app/compta/index.php");
+        Supplier_1.SupplierPayer = new DlgPay("supplier", "./forms.php?panel=supplier_pay", "/app/compta/index.php");
+        Supplier_1.SupplierAccount = new DlgAccount("supplier", "./forms.php?panel=supplier_account", "/app/compta/index.php");
+        Prototype.Event.observe($("btFFNew"), "click", function () {
+            Supplier_1.SupplierBill.show();
+        });
+        Prototype.Event.observe($("btFFPayer"), "click", function () {
+            Supplier_1.SupplierPayer.show();
+        });
+        Prototype.Event.observe($("btFGCompte"), "click", function () {
+            Supplier_1.SupplierAccount.show();
+        });
+        Prototype.Event.observe($("btFGNew"), "click", function () {
+            Supplier_1.Supplier.show();
+        });
+    })(Supplier || (Supplier = {}));
+});
diff --git a/app/compta/supplierBootstrap.js b/app/compta/supplierBootstrap.js
new file mode 100644
index 0000000..462282b
--- /dev/null
+++ b/app/compta/supplierBootstrap.js
@@ -0,0 +1,35 @@
+requirejs.config({
+    baseUrl: '../..',
+    paths: {
+        "supplier": "/app/compta",
+        "cpt": "/app/compta",
+        "tslib": "/js/tslib",
+        "prototype": "/js/scriptaculus/prototype",
+        "aebw": "/js/xgui/aebw",
+        "xgui": "/js/xgui",
+    },
+    shim: {
+        "supplier-ng": {
+            deps: ['xgui/CtrlDialogbox', 'prototype', 'cpt/Dialog'],
+            exports: 'Dialogbox',
+            init: function (x) {
+                return this.Dialogbox();
+            }
+        },
+        "CtrlDialogbox": {
+            deps: ['prototype'],
+            exports: ''
+        },
+        "Dialog": {
+            deps: ['CtrlDialog', 'prototype', 'xgui_json'],
+            exports: 'Proto'
+        },
+        "xgui_json": {
+            deps: ['aebw'],
+            exports: ''
+        }
+    }
+});
+requirejs(["require", "exports", "tslib", "xgui/xgui_json", "xgui/CtrlDialogbox", "cpt/transaction", "cpt/Dialog", "cpt/supplier"], function (myApp) {
+    console.log("starting Supplier application...");
+});
diff --git a/app/compta/supplier_account.xml b/app/compta/supplier_account.xml
new file mode 100644
index 0000000..fe9cf2c
--- /dev/null
+++ b/app/compta/supplier_account.xml
@@ -0,0 +1,104 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+        Compte fournisseur Exercice   
+         
+        
+
+        
+            
+              Information Generales 
+              
+                 
+                 Fournisseur 
+                   
+                
+                        
+               
+           
+          
+            
+                Compte 
+                
+                    
+                        Date 
+                        Réf 
+                        Désignation 
+                        Débit 
+                        Crédit  
+                 
+                
+                    02/01/2013 12435 Facture fioul 100 06/01/2013 d1 Virement 211  
+         
+             Solde: 0.0 0.0  
+            
+         
+            
+         
+     
+ 
diff --git a/app/compta/supplier_add.xml b/app/compta/supplier_add.xml
new file mode 100644
index 0000000..ef3e369
--- /dev/null
+++ b/app/compta/supplier_add.xml
@@ -0,0 +1,109 @@
+
+
+
+
+  User Managment 
+  
+    
+
+  Ajouter un fournisseur  
+        
+
+  
+    
+      Idendité 
+      
+        
+          Activité: Adresse: C.P./Ville: Region/Pays: N° Siret N° APE:  
+        
+          
+          Appliquer 
+          Nouveau 
+         
+       
+     
+    
+        
+        
+            
+              
+                Nom 
+                Prénom 
+                Adresse 
+                C.P. 
+                Tél 
+                Email  
+           
+          
+              
+          
+             
+           
+        
+     
+   
+  
+    
+     
+    
+     
+   
+   
+ 
diff --git a/app/compta/supplier_bill.xml b/app/compta/supplier_bill.xml
new file mode 100644
index 0000000..3d4972a
--- /dev/null
+++ b/app/compta/supplier_bill.xml
@@ -0,0 +1,119 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+         
+           
+Nouvelle Facture 
+
+          
+              Intitule Fournisseur 
+                   Date Saisie Charge 
+                   Date Facture Référence  Montant Fichier Clé Charge 
+                   
+          
+              
+          Enregistrer 
+        Annuler 
+        
+ 
+ 
+
+     
+      
+     
+
+     
+ 
diff --git a/app/compta/supplier_pay.xml b/app/compta/supplier_pay.xml
new file mode 100644
index 0000000..de67387
--- /dev/null
+++ b/app/compta/supplier_pay.xml
@@ -0,0 +1,109 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+
+         
+           
+Payer Facture 
+
+          
+              Intitule Fournisseur 
+                   Date Saisie Banque 
+                   Date Facture Reference  Montant  
+        
+          Enregistrer 
+        Annuler 
+          
+	        
+ 
+ 
+
+	        
+    
+     
+
+     
+ 
diff --git a/app/compta/supplier_remove.xml b/app/compta/supplier_remove.xml
new file mode 100644
index 0000000..284419e
--- /dev/null
+++ b/app/compta/supplier_remove.xml
@@ -0,0 +1,240 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+        Administration des utilisateurs  
+        
+        
+        
+        
+                
+          
+              Utilisateur 
+          
+		  
+			  Her
+                  
+	    
+            
+                    Plan Comptable 
+                
+                    1 Comptes de capitaux 
+                 
+                
+                    2 Comptes d immobilisation 
+                 
+                
+                    3 Stock et Command 
+                 
+                
+                    4 Comptes Tiers 
+                 
+                
+                    5 Comptes Financiers 
+                 
+                
+                    6 Comptes Charges 
+                 
+                
+                    7 Comptes Produits 
+                 
+                
+                    8 Hors Comptabilite 
+                 
+                
+                    9 Comptes Analytiques 
+                 
+             
+        
+        
+            
Test What happens here
+            
+             System 
+             
+              
+      
+     
+           
+          
+              Groupes 
+              
+                simpe test
+               
+           
+          
+              Frogs 
+              
+                Ok, 
+            
+             Info Gen 
+	     
+		     Une info:
+              
+            
+               
+           
+            
+
+      
+        
 
+           
+
+
+          
+          
+              Groupes 
+              
+ Strange
+                
+                    authentication 
+                    
+                        Test Content 
+                        do_invoke 
+                     
+                 
+                
+                    alias 
+                    
+                        display boxes : enable 
+                     
+                 
+                
+                    ssl 
+                    
+                        display boxes: 
+                            enable 
+                            disable 
+                         
+                     
+                 
+                
+                
+             
+           
+              
+          
+              Eglise 
+            
+                Page de debug pour web_server.
+                
+                    Yes 
+                    Vide
+   
+   
+             
+         
+        
+            T table 
+            
+                Test Table Stuff
+                
+                    Titre du tableau 
+                    
+                        r1 r2  
+                    
+                        Un test pour voir d1 Un bouton add 
+                        Un test pour voir d1 Un bouton rm 
+                         
+                
+                End Table
+                
+             
+         
+            
+                Calendar 
+                
+                    Test12
+                    
+                    
+                 
+             
+         
+
+     
+ 
diff --git a/app/compta/transaction.js b/app/compta/transaction.js
new file mode 100644
index 0000000..06c5617
--- /dev/null
+++ b/app/compta/transaction.js
@@ -0,0 +1,189 @@
+define(["require", "exports"], function (require, exports) {
+    "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    var Ledger;
+    (function (Ledger) {
+        class TransactionEntry {
+            constructor(_dc, _tp) {
+                var obj = this;
+                this.dc = _dc;
+                this.entry_type = _tp;
+                this.entry_id = -1;
+                this.json = function () {
+                    if (obj.entry_id == -1) {
+                        return { "amount": obj.amount,
+                            "acc_id": obj.acc_id,
+                            "dc": obj.dc,
+                            "entry_type": obj.entry_type,
+                            "key_charge": obj.key_charge };
+                    }
+                    else {
+                        return { "amount": obj.amount,
+                            "acc_id": obj.acc_id,
+                            "dc": obj.dc,
+                            "entry_type": obj.entry_type,
+                            "entry_id": obj.entry_id,
+                            "key_charge": obj.key_charge };
+                    }
+                };
+            }
+            fillFromForm(_pref) {
+                try {
+                    this.acc_id = $(_pref + '_id').value;
+                    this.amount = $(_pref + '_amount').value;
+                }
+                catch (e) {
+                    this.acc_id = "";
+                    this.amount = 0.0;
+                }
+                try {
+                    this.key_charge = $(_pref + '_charge_key').value;
+                }
+                catch (e) {
+                    this.key_charge = "0";
+                }
+            }
+            setDebitCredit(amount, _dc) {
+                this.amount = amount;
+                this.dc = _dc;
+            }
+            setAccount(acc) {
+                this.acc_id = acc;
+            }
+            setCharge(cle) {
+                this.key_charge = cle;
+            }
+        }
+        Ledger.TransactionEntry = TransactionEntry;
+        class TransactionInfo {
+            constructor(pref) {
+                var obj = this;
+                this.fillFromForm(pref);
+                this.json = function () {
+                    return { "amount": obj.amount,
+                        "act_trans_date": obj.act_trans_date,
+                        "trans_label": obj.trans_label,
+                        "voucher_date": obj.voucher_date,
+                        "voucher_ref": obj.voucher_ref
+                    };
+                };
+            }
+            fillFromForm(pref) {
+                try {
+                    this.voucher_date = new Date($(pref + '_voucher_date').value);
+                    this.act_trans_date = new Date($(pref + '_date').value);
+                    this.trans_label = $(pref + '_desc').value;
+                    this.voucher_ref = $(pref + '_voucher_ref').value;
+                }
+                catch (e) {
+                    console.log(e.message);
+                }
+                try {
+                    this.amount = $(pref + '_amount').value;
+                }
+                catch (e) {
+                    console.log("fillFromForm amount " + e.message);
+                }
+                var transp = $(pref + '_trans_id');
+                if (transp != null) {
+                    console.log("fillFromForm got trans_id");
+                    var id = transp.getAttribute('trans_id');
+                    if (id != null || id != "") {
+                        console.log("fillFromForm got trans_id got" + id);
+                        this.trans_id = id;
+                    }
+                }
+            }
+        }
+        Ledger.TransactionInfo = TransactionInfo;
+        class TransactionInfoBill extends TransactionInfo {
+            constructor(pref) {
+                super(pref);
+                var obj = this;
+                this.acc_charge = $(pref + '_charge').value;
+                this.acc_supplier = $(pref + '_id').value;
+                this.key_charge = $(pref + '_charge_key').value;
+                this.json = function () {
+                    return { "amount": obj.amount,
+                        "voucher_date": obj.voucher_date,
+                        "act_trans_date": obj.act_trans_date,
+                        "trans_label": obj.trans_label,
+                        "acc_charge": obj.acc_charge,
+                        "acc_supplier": obj.acc_supplier,
+                        "voucher_ref": obj.voucher_ref,
+                        "key_charge": obj.key_charge
+                    };
+                };
+            }
+        }
+        Ledger.TransactionInfoBill = TransactionInfoBill;
+        class TransactionInfoPaye extends TransactionInfo {
+            constructor(pref) {
+                super(pref);
+                var obj = this;
+                this.acc_id = $(pref + '_id').value;
+                this.acc_banque = $(pref + '_banque').value;
+                this.acc_supplier = $(pref + '_id').value;
+                this.json = function () {
+                    return { "amount": obj.amount,
+                        "voucher_date": obj.voucher_date,
+                        "act_trans_date": obj.act_trans_date,
+                        "trans_label": obj.trans_label,
+                        "acc_supplier": obj.acc_supplier,
+                        "acc_banque": obj.acc_banque,
+                        "acc_id": obj.acc_id,
+                        "voucher_ref": obj.voucher_ref
+                    };
+                };
+            }
+        }
+        Ledger.TransactionInfoPaye = TransactionInfoPaye;
+        class TransactionInfoVersement extends TransactionInfo {
+            constructor(pref) {
+                super(pref);
+                var obj = this;
+                this.acc_id = $(pref + '_id').value;
+                this.acc_banque = $(pref + '_banque').value;
+                this.json = function () {
+                    return { "amount": obj.amount,
+                        "voucher_date": obj.voucher_date,
+                        "act_trans_date": obj.act_trans_date,
+                        "trans_label": obj.trans_label,
+                        "acc_banque": obj.acc_banque,
+                        "acc_id": obj.acc_id,
+                        "voucher_ref": obj.voucher_ref
+                    };
+                };
+            }
+        }
+        Ledger.TransactionInfoVersement = TransactionInfoVersement;
+        class Transaction {
+            constructor(_tp, pref) {
+                var obj = this;
+                this.transi = this.getInfo(pref);
+                this.entries = [];
+                this.json = function () {
+                    var _str = "[";
+                    obj.entries.forEach(function (elt, i) {
+                        if (i != 0)
+                            _str += " , ";
+                        _str += AEBW.toJson(elt);
+                    });
+                    _str += "]";
+                    return { "transi": obj.transi, "entries": _str };
+                };
+            }
+            getEntry(_pref, account, _dc, trans_type) {
+                var entry = new TransactionEntry(_dc, trans_type);
+                entry.acc_id = account;
+                return entry;
+            }
+            getInfo(pref) {
+                var info = new TransactionInfo(pref);
+                console.log("Transaction::getInfo");
+                return info;
+            }
+        }
+        Ledger.Transaction = Transaction;
+    })(Ledger = exports.Ledger || (exports.Ledger = {}));
+});
diff --git a/app/compta/upload.php b/app/compta/upload.php
new file mode 100644
index 0000000..49fed12
--- /dev/null
+++ b/app/compta/upload.php
@@ -0,0 +1,30 @@
+
diff --git a/app/compta/users.xml b/app/compta/users.xml
new file mode 100644
index 0000000..284419e
--- /dev/null
+++ b/app/compta/users.xml
@@ -0,0 +1,240 @@
+
+
+
+
+    User Managment 
+    
+        
+
+        
+        Administration des utilisateurs  
+        
+        
+        
+        
+                
+          
+              Utilisateur 
+          
+		  
+			  Her
+                  
+	    
+            
+                    Plan Comptable 
+                
+                    1 Comptes de capitaux 
+                 
+                
+                    2 Comptes d immobilisation 
+                 
+                
+                    3 Stock et Command 
+                 
+                
+                    4 Comptes Tiers 
+                 
+                
+                    5 Comptes Financiers 
+                 
+                
+                    6 Comptes Charges 
+                 
+                
+                    7 Comptes Produits 
+                 
+                
+                    8 Hors Comptabilite 
+                 
+                
+                    9 Comptes Analytiques 
+                 
+             
+        
+        
+            
Test What happens here
+            
+             System 
+             
+              
+      
+     
+           
+          
+              Groupes 
+              
+                simpe test
+               
+           
+          
+              Frogs 
+              
+                Ok, 
+            
+             Info Gen 
+	     
+		     Une info:
+              
+            
+               
+           
+            
+
+      
+        
 
+           
+
+
+          
+          
+              Groupes 
+              
+ Strange
+                
+                    authentication 
+                    
+                        Test Content 
+                        do_invoke 
+                     
+                 
+                
+                    alias 
+                    
+                        display boxes : enable 
+                     
+                 
+                
+                    ssl 
+                    
+                        display boxes: 
+                            enable 
+                            disable 
+                         
+                     
+                 
+                
+                
+             
+           
+              
+          
+              Eglise 
+            
+                Page de debug pour web_server.
+                
+                    Yes 
+                    Vide
+   
+   
+             
+         
+        
+            T table 
+            
+                Test Table Stuff
+                
+                    Titre du tableau 
+                    
+                        r1 r2  
+                    
+                        Un test pour voir d1 Un bouton add 
+                        Un test pour voir d1 Un bouton rm 
+                         
+                
+                End Table
+                
+             
+         
+            
+                Calendar 
+                
+                    Test12
+                    
+                    
+                 
+             
+         
+
+     
+ 
diff --git a/app/compta/views/account_detail.php b/app/compta/views/account_detail.php
new file mode 100644
index 0000000..eea239b
--- /dev/null
+++ b/app/compta/views/account_detail.php
@@ -0,0 +1,150 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+  +
 
+
+  
+    Détail  
+    
+      Détail compte  
+      
+        
+          Date 
+          Réf 
+          Désignation 
+          Débit 
+          Crédit  
+       
+      
+       
+      
+        Solde: 
+            0.0 
+            0.0 
+         
+    
+   
+  
+    
+   
+ 
+XML;
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Detail extends \PageCompta
+             implements \IActionResult 
+{
+    function __construct($model)
+    {
+        $this->_model = $model;
+        parent::__construct(XmlAccount,true);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+    private function script()
+    {
+        $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $tbody = $xml->getElementsByTagName('tbody');
+        $f       = $tbody->item(0);
+        $nel     = $xml->createDocumentFragment();
+        $nel->appendXML($this->fillTable());
+        $f->appendChild($nel);
+        /* Update title from xml template */
+        $title = $this->getElementById($xml,"title");
+        $el    = $xml->createTextNode("compte ".$this->_model->_id);
+        $title->appendChild($el);
+        // Update return link
+        $retour = $this->getElementById($xml,"btRetour");
+        $retour->removeAttribute('link');
+        $retour->setAttribute('link',"/app/compta/services.php/".\AEB::$REQUEST['b']);
+	// Ok Handle solde
+        $solde = $this->getElementById($xml,"accSoldeCompte");
+        $el    = $xml->createTextNode("compte ".$this->_model->_solde[2]);
+        $solde->appendChild($el);
+    }
+
+    /**
+     * @brief Fill bilan table
+     */
+    private function fillTable()
+    {
+        $template=<<<_EOF
+%s %s 
+%s 
+%.2f 
+%.2f 
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+            implements \IActionResult 
+{
+
+    function __construct($b=true)
+    {
+        global $xmlAdminDocument;
+        parent::__construct($XmlAdminDocument,$b);
+    }
+
+    private function script()
+    {
+        $s=<<<_EOF
+
+_EOF;
+        echo $s;
+    }
+    public function render()
+    {
+        $this->show();
+    }
+    private function documents()
+    {
+        $_cfg = $this->_auth_cfg;
+        $syndic = new \Syndic( $this->getSession()
+             , $_cfg
+             , $this->getSession()->getDb());
+        $accounting = $syndic->baseType();
+        echo "";
+        echo "";
+        echo "Description Valeur  ";
+        echo "Type de compatbilite ".$accounting." Version ".$accounting." Compteur ".$accounting." 
";
+    }
+
+    /**
+     * @brief Display The articles in flex mode
+     * Also revise menu
+     */
+    function main() {
+        $this->script();
+        echo '';
+        echo "
Aperçu de la configuration ";
+        $this->documents();
+        echo '';
+    }
+}
+
+
+?>
diff --git a/app/compta/views/bank_index.php b/app/compta/views/bank_index.php
new file mode 100644
index 0000000..2754565
--- /dev/null
+++ b/app/compta/views/bank_index.php
@@ -0,0 +1,138 @@
+
+
+
+
+Gestion comptable 
+
+  
+
+
+
+
++
 
+
+  Banque 
+  
+  
+  
+  
+    Compte 
+    Libellé 
+    solde 
+       
+     
+    
+        
+    
+     
+  
+
+
+    Caisse 
+
+ 
+ 
+
+
+ 
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends    \PageCompta
+            implements \IActionResult 
+{
+    private $_model = null;
+
+    function __construct($model, $b = true)
+    {
+        $this->_model = $model;
+        global $xmlBankIndex;
+        parent::__construct($xmlBankIndex,$b);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+    private function script()
+    {
+      $s=<<<_EOF
+
+_EOF;
+      echo $s;
+    }
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $tbody = $xml->getElementsByTagName('tbody');
+        $f       = $tbody->item(0);
+        $nel     = $xml->createDocumentFragment();
+        $nel->appendXML($this->fillTable());
+        $f->appendChild($nel);
+    }
+    /**
+     * @brief Fill bilan table
+     */
+    private function fillTable()
+    {
+        $template=<<<_EOF
+
+%s 
+%.2f  
+_EOF;
+$frag    = "";
+        $_cfg = $this->_auth_cfg;
+        $pcmn = new  \Bank( $this->getSession()
+                 , $_cfg
+         , $this->getSession()->getDb());
+        $lst = $pcmn->getSolde();
+        $count = 0;
+        foreach( $lst as $row)
+        {
+            $frag.=sprintf($template
+                ,++$count % 2?"odd":"even"
+                ,$row[0]
+                ,$row[0],$row[1]
+                ,$row[2] > $row[3] ? "red" : "black"
+                ,$row[4]);
+        }
+        return $frag;
+    }
+
+}
+
+?>
diff --git a/app/compta/views/bank_upload.php b/app/compta/views/bank_upload.php
new file mode 100644
index 0000000..f1274a4
--- /dev/null
+++ b/app/compta/views/bank_upload.php
@@ -0,0 +1,136 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+
++
+
+
 
+
+  Banque upload OFX 
+  
+    
+      Nouveau 
+      
+        
+          
+             Fichier OFX 
+           
+         
+
+      
+
+Télécharger 
+Annuler 
+ 
+ 
+ 
+
+ 
+ 
+
+
+ 
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Upload extends \PageCompta
+	implements \IActionResult 
+{
+
+  function __construct($b = true)
+  {
+	global $xmlBankUpload;
+        parent::__construct($xmlBankUpload,$b);
+  }
+
+  public function render()
+  {
+    $this->show();
+  }
+
+  private function script()
+  {
+    $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+}
+
+?>
diff --git a/app/compta/views/bilan_index.php b/app/compta/views/bilan_index.php
new file mode 100644
index 0000000..ce215c4
--- /dev/null
+++ b/app/compta/views/bilan_index.php
@@ -0,0 +1,153 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+
+  +
 
+
+  
+  
+    Exercice 
+    
+      
+       
+      
+       Télécharger  
+       
+     
+   
+
+  
+      Bilan de L'exercice 
+      
+        
+          Compte 
+          Libelle 
+          Debit 
+          Credit 
+          Solde  
+       
+      
+          
+       
+  
+   
+  
+    
+   
+ 
+XML;
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class PageBilan extends PageCompta {
+
+  function __construct($s,$b)
+  {
+        parent::__construct($s,$b);
+  }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+  private function script()
+  {
+    $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $tbody = $xml->getElementsByTagName('tbody');
+        $f       = $tbody->item(0);
+        $nel     = $xml->createDocumentFragment();
+        $nel->appendXML($this->fillTable());
+        $f->appendChild($nel);
+    }
+    /**
+     * @brief Fill bilan table
+     */
+    private function fillTable()
+    {
+	    $template=<<<_EOF
+%s %s 
+%.2f 
+%.2f 
+%.2f 
+Gestion comptable 
+
+  
+  
+
+
+
++
+
+
 
+
+  
+    
+      Nouveau 
+      
+        
+          Année: Désignation:  
+
+      
+
+Nouveau 
+Annuler 
+ 
+ 
+ 
+
+
+
+  
+    Année 
+    Libellé 
+       
+     
+    
+        
+    
+     
+  
+
+
+
+          
+          
+            
+              
+                Compte 
+                Libellé 
+                N-1 
+                N  
+          
+         
+              
+         
+             
+             Total: 0.0 0.0  
+    
+ 
+ 
+ 
+
+
+ 
+ 
+XML;
+
+
+$_default_file = "ledger_syndic.xml";
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Detail extends \PageCompta
+	implements \IActionResult 
+{
+
+    function __construct($b = true)
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,$b);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+
+?>
diff --git a/app/compta/views/budget_index.php b/app/compta/views/budget_index.php
new file mode 100644
index 0000000..e48a559
--- /dev/null
+++ b/app/compta/views/budget_index.php
@@ -0,0 +1,120 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+
++
+
+
 
+
+  
+    
+
+ 
+
+
+
+  
+    Année 
+    Libellé 
+       
+     
+    
+        
+    
+     
+  
+
+
+
+          
+          
+            
+              
+                Compte 
+                Libellé 
+                N-1 
+                N  
+          
+         
+              
+         
+             
+             Total: 0.0 0.0  
+    
+ 
+ 
+ 
+
+
+ 
+ 
+XML;
+
+
+$_default_file = "ledger_syndic.xml";
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+	implements \IActionResult 
+{
+
+    function __construct($b = true)
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,$b);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+
+?>
diff --git a/app/compta/views/budget_nouveau.php b/app/compta/views/budget_nouveau.php
new file mode 100644
index 0000000..80bb354
--- /dev/null
+++ b/app/compta/views/budget_nouveau.php
@@ -0,0 +1,172 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+  
+
+
+
++
+
+
 
+
+  
+   Créer un nouveau budget 
+    
+      Nouveau 
+      
+        
+          Année: Désignation:  
+
+      
+
+Créer 
+Annuler 
+ 
+ 
+ 
+
+
+
+  
+    Année 
+    Libellé 
+       
+     
+    
+        
+    
+     
+  
+
+
+
+          
+          
+            
+              
+                Compte 
+                Libellé 
+                N-1 
+                N  
+          
+         
+              
+         
+             
+             Total: 0.0 0.0  
+    
+ 
+ 
+ 
+
+
+ 
+ 
+XML;
+
+
+$_default_file = "ledger_syndic.xml";
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Nouveau extends \PageCompta
+	implements \IActionResult 
+{
+
+    function __construct($b = true)
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,$b);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+/**
+ * Should I make the checks here ? I wonder 
+ * if this is required
+ */
+
+?>
diff --git a/app/compta/views/chart_index.php b/app/compta/views/chart_index.php
new file mode 100644
index 0000000..9510b08
--- /dev/null
+++ b/app/compta/views/chart_index.php
@@ -0,0 +1,144 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+  +
+    +
+
+
+
+
+
+
+
 
+  +
 
+
+  
+    Plan comptable 
+    
+      Titre du tableau 
+        
+          
+            class 
+            Libellé 
+            Type 
+             
+          
+          
+           
+          
+             Ajouter 
+            
+           
+         
+        
+          
+            1 
+            Compte de test 
+            Actif 
+            
+              Delete 
+              
+           
+          
+    
+     
+  
+   
+
+   
+ 
+XML;
+
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+            implements \IActionResult 
+{
+
+    function __construct($b=true)
+    {
+        global $XmlChartIndex;
+        parent::__construct($XmlChartIndex,$b);
+    }
+
+    private function script()
+    {
+        $s=<<<_EOF
+
+_EOF;
+        echo $s;
+    }
+    public function render()
+    {
+        $this->show();
+    }
+}
+
+
+
+?>
diff --git a/app/compta/views/compta_index.php b/app/compta/views/compta_index.php
new file mode 100644
index 0000000..1886e96
--- /dev/null
+++ b/app/compta/views/compta_index.php
@@ -0,0 +1,289 @@
+conf_auth = $conf['auth']['mysql'];
+        $this->_retrieve = new \Retrieve( $this->session
+             , $this->conf_auth
+             , $this->session->getDb());
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+    private function article($title,$img="iu-copro.jpg",$_content="") {
+        $_scheme = $this->request->getScheme();
+        $root= $_scheme."".$this->request->getServerHost()."/".$this->alias."/images/accounting";
+        $lnk = $_scheme."".$this->request->getServerHost()."/".$this->link($title);
+        echo ''; 
+        echo '
';
+        echo "
".$title." \n"; 
+        echo '
';
+        echo '
';
+        echo "
";
+        $c=<<
+     et encore da tatrtre ertr rete
+     Il reste a comprendre la position de l'image
+EOF;
+        if ($_content !="") {
+          echo $_content;
+        } else
+          echo $c;
+        echo ' ';
+        echo '
Sur l'exerice {$this->session->getCurrentExercice()}, vous disposez en banque  de {$solde} €
+_EOF;
+        echo $_text;
+      } else {
+        echo " Vous disposez en banque de xxxx.€
";
+      }
+    }
+
+    /**
+     * 
+     */
+    private function plan_comptable() {
+      $_content =<<
+Selectionner le plan comptablesession->getCurrentExercice()} 
+les factures,prêts, opération recurrentes 
+Saisir des transactions
+Créer un budgetProcès verbal de la dernière AG 
+__EOF;
+        } else if (!is_array($last_closed[0] ))
+        {
+            $_content =<<<__EOF
+Pas d'exerice clos pour l'instant Procès verbal de la dernière AG 
+__EOF;
+        } else{
+            $_content =<<<__EOF
+Procès verbal de la dernière AG 
+__EOF;
+        }
+        $this->article(_("Bilan"),"iu-bilan.jpg",$_content);
+        
+    }
+
+    private function decompte($title)
+    {
+        $retrieve = $this->_retrieve;
+        $res      = $retrieve->getSoldeCharge();
+        $compte   = $retrieve->getAccount($this->session->id());
+        $_content =<<<_EOF
+Les charges latentes: {$res[1]} € ';
+        if ($compta == "tpe")
+        {
+            $this->main_tpe();
+        }
+        else 
+        { // Default is always syndic
+            $this->main_syndic();
+        }
+        echo '
';
+    }
+}
+
+
+/*
+ *  vim:et:sw=2:list:
+ */
+?>
diff --git a/app/compta/views/exercice_index.php b/app/compta/views/exercice_index.php
new file mode 100644
index 0000000..bfd814c
--- /dev/null
+++ b/app/compta/views/exercice_index.php
@@ -0,0 +1,127 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+
+
+
+  +
+
+
+
 
+
+     Gestion Des Exercices :  
+     
+       
+          
+           Nouvel Exercice  
+             
+               
+                 Label Début Période Fin de Période  
+               
+                 
+                   Ajouter 
+                       
+              
+          
+         
+           Les exerices 
+           
+           
+             
+               
+                Status 
+                Exercice 
+                Date de Début 
+                Date de Fin 
+                Action 
+                
+              
+             
+                
+	   
+          
+        
+          Cloture de compte 
+         
+
+         
+       
+
+
+    
+   
+ 
+XML;
+
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+            implements \IActionResult 
+{
+    /**
+     *
+     */
+    function __construct($b=true)
+    {
+        global $XmlComptaExercice;
+        parent::__construct($XmlComptaExercice,$b);
+    }
+
+    /**
+     *
+     */
+    private function script()
+    {
+        $s=<<<_EOF
+
+_EOF;
+        echo $s;
+    }
+
+    /**
+     *
+     */
+    public function render()
+    {
+        $this->show();
+    }
+}
+
+
+
+?>
diff --git a/app/compta/views/jrnx_index.php b/app/compta/views/jrnx_index.php
new file mode 100644
index 0000000..6a54050
--- /dev/null
+++ b/app/compta/views/jrnx_index.php
@@ -0,0 +1,128 @@
+
+
+
+
+  Gestion comptable 
+  
+    
+    
+    
+      +
+
+
+
+        +
+
+
+
+
+
+
+
 
+
+     
+
+    
+      
+         
+          Sélection du journal 
+          
+            
+              Journal : 
+                 
+           
+         
+
+        
+          
+          
+            
+              
+                Date 
+                N° Compte 
+                Réf 
+                Libellé 
+                Débit 
+                Crédit 
+               
+             
+            
+               
+            
+              Solde: 0.0 0.0  
+          
+         
+       
+     
+
+
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+            implements \IActionResult 
+{
+    /**
+     *
+     */
+    function __construct($b=true)
+    {
+        global $XmlJrnxIndex;
+        parent::__construct($XmlJrnxIndex,$b);
+        $this->setTitle("Journal");
+    }
+
+    /**
+     *
+     */
+    private function script()
+    {
+        $s=<<<_EOF
+
+_EOF;
+        echo $s;
+    }
+
+    /**
+     *
+     */
+    public function render()
+    {
+        $this->show();
+    }
+}
+
+
+
+
+?>
diff --git a/app/compta/views/loan_detail.php b/app/compta/views/loan_detail.php
new file mode 100644
index 0000000..927741d
--- /dev/null
+++ b/app/compta/views/loan_detail.php
@@ -0,0 +1,159 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Detail extends \PageCompta
+            implements \IActionResult 
+{
+    private $_model = null;
+
+    function __construct($m)
+    {
+        parent::__construct("",true);
+        $this->_model = $m;
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+  private function script()
+  {
+    $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function documentLoanDetails($id)
+  {
+    $lst = $this->_model->getSummary($id);
+    echo "Détail ".$lst[4]."  ";
+    echo "";
+    echo "Date de début      :  ".$lst[0]." Prochaine échéance: ".$lst[8]." Durée restante     :  ".$lst[7]." mois Taux :  ".$lst[2]." % Capital restant du :  ".$lst[9]." € Intérets restant du : ".$lst[6]." € 
";
+    echo "Prochaine échéance  ";
+    $lp = $this->_model->getNextPayement($id);
+    echo "";
+
+  }
+
+  /**
+   *
+   *
+   */
+  private function documents()
+  {
+      $this->documentLoanDetails($this->_model->id);
+  }
+
+  /**
+   * @brief Display The articles in flex mode
+   * Also revise menu
+   */
+  function main() {
+      $this->script();
+      echo '';
+      $this->documents();
+      echo '
';
+  }
+}
+
+?>
diff --git a/app/compta/views/loan_index.php b/app/compta/views/loan_index.php
new file mode 100644
index 0000000..9e76879
--- /dev/null
+++ b/app/compta/views/loan_index.php
@@ -0,0 +1,278 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+            implements \IActionResult 
+{
+
+    function __construct($s = "",$b = true)
+    {
+        parent::__construct($s,$b);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+  private function script()
+  {
+    $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function documentLoanDetails($id)
+  {
+    $_cfg = $this->_auth_cfg;
+    $loan = new \Loan( $this->getSession()
+             , $_cfg
+             , $this->getSession()->getDb());
+    $lst = $loan->getSummary($id);
+    echo "Détail ".$lst[4]."  ";
+    echo "";
+    echo "Date de début      :  ".$lst[0]." Prochaine échéance: ".$lst[8]." Durée restante     :  ".$lst[7]." mois Taux :  ".$lst[2]." % Capital restant du :  ".$lst[9]." € Intérets restant du : ".$lst[6]." € 
";
+    echo "Prochaine échéance  ";
+    $lp = $loan->getNextPayement($id);
+    echo "";
+
+  }
+
+  /**
+   * @brief pay the loan for this month
+   * @return Array('trans_id') in case of success or empty Array() in case of failure
+   */
+  private function payLoan($id,$lp)
+  {
+    $_cfg = $this->_auth_cfg;
+    $book = new \Booking( $this->getSession()
+             , $_cfg
+             , $this->getSession()->getDb());
+      $trans = Array("trans_label" => "Remboursement prêt N°".$id
+        ,"voucher_date"    => $lp[6]
+        ,"act_trans_date"  => $lp[6]
+      );
+      $entries = Array(
+          "0" => Array("acc_id" => $lp[2] , "entry_type"=> "BQ" ,"amount" => $lp[7], "dc" => "c", "key_charge" => "1")
+         ,"1" => Array("acc_id" => $lp[3] , "entry_type"=> "BQ" ,"amount" => $lp[8], "dc" => "d", "key_charge" => "1")
+         ,"2" => Array("acc_id" => $lp[4] , "entry_type"=> "BQ" ,"amount" => $lp[9], "dc" => "d", "key_charge" => "1")
+      ); 
+      try {
+          return $book->postTransaction($trans,$entries);
+      } catch (Exception $e)
+      {
+          return Array();
+      }
+
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function documentLoanPayer($id,$lei)
+  {
+    $_cfg = $this->_auth_cfg;
+    $loan = new \Loan( $this->getSession()
+             , $_cfg
+             , $this->getSession()->getDb());
+    $lp = $loan->getNextPayement($id);
+    $result = $this->payLoan($id,$lp);
+    if (isset($result['trans_id']))
+    { // Success book the entry
+        $loan->markBooked($lei);
+    }
+    echo "Règlement échéance terminé ";
+    echo "";
+    $res =<<<_EOF
+Date 
+    annuite 
+    interet 
+    ammorti 
+      
+{$lp[6]} 
+    {$lp[7]} € 
+    {$lp[8]} € 
+    {$lp[9]} € 
+    
+      Retour 
+     
+
";
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function documentLoans()
+  {
+    $_cfg = $this->_auth_cfg;
+    $loan = new \Loan( $this->getSession()
+             , $_cfg
+	     , $this->getSession()->getDb());
+    $lst = $loan->getList();
+    echo "";
+    echo "";
+    echo "Date Description Montant Taux Durée  ";
+    foreach ($lst as $l)
+    {
+      $res="".$l[1]." ";
+      $res.=<<{$l[5]} 
+EOF;
+      $res.="".$l[2]." "; // Montant
+      $res.="".$l[3]." "; // Taux
+      $res.="".$l[4]." mois "; // Durée
+      $res.="--.--.-- 
+Nouveau prêt -- 
+-- 
+-- 
+EOF;
+    echo $res;
+    echo "
";
+  }
+  /**
+   *
+   *
+   */
+  private function documents()
+  {
+    if (isset($_GET['id']) )
+    {
+      $this->documentLoanDetails($_GET['id']);
+    } 
+    else if (isset($_POST) && isset($_POST["submit"]) )
+    {
+      $this->documentLoanPayer($_POST['li'],$_POST['lei']);
+    }
+    else
+    {
+      echo "Mes Prêts ";
+      $this->documentLoans();
+    }
+  }
+
+  /**
+   * @brief Display The articles in flex mode
+   * Also revise menu
+   */
+  function main() {
+      $this->script();
+      echo '';
+      $this->documents();
+      echo '
';
+  }
+}
+
+?>
diff --git a/app/compta/views/loan_nouveau.php b/app/compta/views/loan_nouveau.php
new file mode 100644
index 0000000..68bd8b4
--- /dev/null
+++ b/app/compta/views/loan_nouveau.php
@@ -0,0 +1,131 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Nouveau extends \PageCompta
+            implements \IActionResult 
+{
+    private $_model = null;
+
+    function __construct($m)
+    {
+        parent::__construct("",true);
+        $this->_model = $m;
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+    /**
+     * @brief insert a script in the page to update menu link
+     *
+     */
+    private function script()
+    {
+      $s=<<<_EOF
+
+_EOF;
+      echo $s;
+    }
+    /**
+     * @brief main page that will list all loans
+     *
+     */
+    private function documentLoanNew()
+    {
+      $res=<<<_OEF
+        
+_OEF;
+        echo $res;
+    }
+
+    /**
+     *
+     *
+     */
+    private function documents()
+    {
+        $this->documentLoanNew();
+    }
+
+    /**
+     * @brief Display The articles in flex mode
+     * Also revise menu
+     */
+    function main() {
+        $this->script();
+        echo '';
+        $this->documents();
+        echo '
';
+    }
+}
+
+
+?>
diff --git a/app/compta/views/loan_payer.php b/app/compta/views/loan_payer.php
new file mode 100644
index 0000000..d1c557f
--- /dev/null
+++ b/app/compta/views/loan_payer.php
@@ -0,0 +1,139 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Payer extends \PageCompta
+            implements \IActionResult 
+{
+    private $_model = null;
+    function __construct($m)
+    {
+        parent::__construct("",true);
+        $this->_model = $m;
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+  private function script()
+  {
+    $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function documentLoanPayer()
+  {
+    $lp = $this->_model->lp;
+    echo "Règlement échéance terminé ";
+    echo "";
+    $res =<<<_EOF
+Date 
+    annuite 
+    interet 
+    ammorti 
+      
+{$lp[6]} 
+    {$lp[7]} € 
+    {$lp[8]} € 
+    {$lp[9]} € 
+    
+      Retour 
+     
+
";
+  }
+  /**
+   *
+   *
+   */
+  private function documents()
+  {
+      $this->documentLoanPayer();
+  }
+
+  /**
+   * @brief Display The articles in flex mode
+   * Also revise menu
+   */
+  function main() {
+      $this->script();
+      echo '';
+      $this->documents();
+      echo '
';
+  }
+}
+
+
+
+?>
+
diff --git a/app/compta/views/lot_attribuer.php b/app/compta/views/lot_attribuer.php
new file mode 100644
index 0000000..873d82f
--- /dev/null
+++ b/app/compta/views/lot_attribuer.php
@@ -0,0 +1,254 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+  
+
+
+
+  +
+    +
+
 
+  
+    +
+
+
 
+ 
+
+     Gestion Des lots de copropriété :  
+     
+       
+
+     
+      Selection Copropriétaire 
+      
+          
+              Copropriétaire : 
+                   
+       
+     
+         
+        
+          
+          
+            
+              
+                Numéro 
+                Nom du lot 
+                Sel  
+          
+         
+              
+         
+             
+          
+	  
+         
+
+       
+       
+
+
+
+
+    
+   
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Attribuer extends \PageCompta
+             implements \IActionResult 
+{
+    function __construct()
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,true);
+    }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $gc = $this->getElementById($xml,"gestion-compta");
+        $nel     = $xml->createTextNode($_SESSION["compta_name"]);
+        $gc->appendChild($nel);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+?>
diff --git a/app/compta/views/lot_index.php b/app/compta/views/lot_index.php
new file mode 100644
index 0000000..d54aedd
--- /dev/null
+++ b/app/compta/views/lot_index.php
@@ -0,0 +1,274 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+  
+
+
+
+  +
+    +
+
 
+  
+    +
+
+
 
+ 
+
+     Gestion Des lots de copropriété :  
+     
+       
+
+        
+          
+          
+            
+              
+                N° 
+                Name 
+                Bat 
+                Etg 
+                Porte 
+                Type 
+                Surf. 
+              
+          
+         
+              
+	  
+         
+
+
+       
+       
+
+
+
+
+    
+   
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+             implements \IActionResult 
+{
+    function __construct()
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,true);
+    }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    private function fillLots()
+    {
+    }
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $gc = $this->getElementById($xml,"gestion-compta");
+        $nel     = $xml->createTextNode($_SESSION["compta_name"]);
+        $gc->appendChild($nel);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+?>
diff --git a/app/compta/views/lot_nouveau.php b/app/compta/views/lot_nouveau.php
new file mode 100644
index 0000000..540ae62
--- /dev/null
+++ b/app/compta/views/lot_nouveau.php
@@ -0,0 +1,268 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+  
+
+
+
+  +
+    +
+
 
+  
+    +
+
+
 
+ 
+
+     Gestion Des lots de copropriété :  
+     
+       
+
+        
+        Nouveau Lot  
+         
+          
+              Nom N° Type 
+                  Batiment Etage Porte Surface Description  
+          
+            Ajouter 
+            Annuler 
+	          
+        
+        
+
+        
+          
+          
+            
+              
+                N° 
+                Name 
+                Bat 
+                Etg 
+                Porte 
+                Type 
+                Surf. 
+              
+          
+         
+              
+	  
+         
+
+
+       
+       
+
+
+
+
+    
+   
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Nouveau extends \PageCompta
+             implements \IActionResult 
+{
+    function __construct()
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,true);
+    }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $gc = $this->getElementById($xml,"gestion-compta");
+        $nel     = $xml->createTextNode($_SESSION["compta_name"]);
+        $gc->appendChild($nel);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+?>
diff --git a/app/compta/views/lot_update.php b/app/compta/views/lot_update.php
new file mode 100644
index 0000000..a331338
--- /dev/null
+++ b/app/compta/views/lot_update.php
@@ -0,0 +1,268 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+  
+
+
+
+  +
+    +
+
 
+  
+    +
+
+
 
+ 
+
+     Gestion Des lots de copropriété :  
+     
+       
+
+        
+        Nouveau Lot  
+         
+          
+              Nom N° Type 
+                  Batiment Etage Porte Surface Description  
+          
+            Ajouter 
+            Annuler 
+	          
+        
+        
+
+        
+          
+          
+            
+              
+                N° 
+                Name 
+                Bat 
+                Etg 
+                Porte 
+                Type 
+                Surf. 
+              
+          
+         
+              
+	  
+         
+
+
+       
+       
+
+
+
+
+    
+   
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Update extends \PageCompta
+             implements \IActionResult 
+{
+    function __construct()
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,true);
+    }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $gc = $this->getElementById($xml,"gestion-compta");
+        $nel     = $xml->createTextNode($_SESSION["compta_name"]);
+        $gc->appendChild($nel);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+?>
diff --git a/app/compta/views/org_index.php b/app/compta/views/org_index.php
new file mode 100644
index 0000000..c132312
--- /dev/null
+++ b/app/compta/views/org_index.php
@@ -0,0 +1,255 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+  
+
+
+
+  +
+    +
+
 
+  
+    +
+
 
+  
+    +
+
+
 
+ 
+
+     Gestion Comptable :  
+     
+       
+          
+             Vos organisations 
+             
+           
+         
+       
+
+
+
+
+
+    
+   
+ 
+XML;
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+             implements \IActionResult 
+{
+    function __construct()
+    {
+        global $XmlComptaBudget;
+        parent::__construct($XmlComptaBudget,true);
+    }
+
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    private function fillOrgs()
+    {
+    }
+    /**
+     * @brief allow sub classes to modify xml file
+     */
+    protected function _updateXML(&$xml)
+    {
+        $gc = $this->getElementById($xml,"parameters-list");
+        //$nel     = $xml->createTextNode($_SESSION["compta_name"]);
+        //$gc->appendChild($nel);
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+}
+
+
+?>
diff --git a/app/compta/views/recurrent_detail.php b/app/compta/views/recurrent_detail.php
new file mode 100644
index 0000000..8d98a3b
--- /dev/null
+++ b/app/compta/views/recurrent_detail.php
@@ -0,0 +1,113 @@
+_model = $model;
+        parent::__construct("",true);
+    }
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+    private function script($loc = "/app/compta/services.php/")
+    {
+        $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+    private function document()
+    {
+       $tpl =<<<_EOF
+%s 
+    %s € 
+    %s € 
+    
+Détail ".$des[3]."  ";
+    echo "";
+    echo "Date de début      :  ".$des[1]." Prochaine échéance: ".$des[4]." Montant :  ".$des[2]."€ 
";
+    echo "Ecritures ";
+    /* acc | debit | credit */
+    echo "";
+    $res =<<<_EOF
+
+Account 
+    Débit 
+    Crédit 
+ 
+_EOF;
+    echo $res;
+    foreach( $lst as $k => $acc)
+    {
+        if ($acc[4] == 'd')
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],$acc[3],"0.0");
+        } else
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],"0.0",$acc[3]);
+        }
+    } 
+    echo "
";
+    $res=<<
+Retour Modifier ';
+        $this->document();
+        echo '
';
+    }
+}
+
+?>
diff --git a/app/compta/views/recurrent_index.php b/app/compta/views/recurrent_index.php
new file mode 100644
index 0000000..5c01365
--- /dev/null
+++ b/app/compta/views/recurrent_index.php
@@ -0,0 +1,310 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Index extends \PageCompta
+	implements \IActionResult 
+{
+
+    function __construct($s = "" ,$b = true)
+    {
+        parent::__construct($s,$b);
+    }
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+    private function script($loc = "/app/compta/services.php/")
+    {
+        $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+    private function docRecurrentDetails($id)
+    {
+       $tpl =<<<_EOF
+%s 
+    %s € 
+    %s € 
+    
+Détail ".$des[3]."  ";
+    echo "";
+    echo "Date de début      :  ".$des[1]." Prochaine échéance: ".$des[4]." Montant :  ".$des[2]."€ 
";
+    echo "Ecritures ";
+    /* acc | debit | credit */
+    echo "";
+    $res =<<<_EOF
+	    
+Account 
+    Débit 
+    Crédit 
+ 
+_EOF;
+    echo $res;
+    foreach( $lst as $k => $acc)
+    {
+        if ($acc[4] == 'd')
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],$acc[3],"0.0");
+        } else
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],"0.0",$acc[3]);
+        }
+    } 
+    echo "
";
+   /*
+    echo "Prochaine échéance  ";
+    $lp = $rec->getNextPayement($id);
+    $date_apayer = new DateTime($lp[6]);
+    $date_today  = new DateTime("now");
+    $p = "";
+    if ($date_apayer > $date_today) {
+    $p.= "en attente";
+    } else {
+            $p.=<<
+        Date 
+    annuite 
+    interet 
+    ammorti 
+      
+{$lp[6]} 
+    {$lp[7]} € 
+    {$lp[8]} € 
+    {$lp[9]} € 
+    {$p}
+     
+Règlement échéance terminé ";
+    echo "";
+    $res =<<<_EOF
+Date 
+    annuite 
+    interet 
+    ammorti 
+      
+{$lp[6]} 
+    {$lp[7]} € 
+    {$lp[8]} € 
+    {$lp[9]} € 
+    
+      Retour 
+     
+
";
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function docRecurrents()
+  {
+    $_cfg = $this->_auth_cfg;
+    $rec = new \Recurrent( $this->getSession()
+             , $_cfg
+             , $this->getSession()->getDb());
+    $lst = $rec->getList();
+    echo "";
+    echo "";
+    echo "Date Description Montant Fin Prochaine échéance  ";
+    $date_today  = new \DateTime("now");
+    foreach ($lst as $l)
+    {
+      $res="".$l[1]." ";
+      $prochaine_echeance = "";
+      $date_apayer = new \DateTime($l[4]);
+      if ($date_apayer < $date_today)
+      {
+          $prochaine_echeance .= " ".$l[4]." a régler ";
+      } else
+      { 
+          $prochaine_echeance .= $l[4]." en attente";
+      }
+      $res.=<<{$l[3]} 
+EOF;
+      $res.="".$l[2]." "; // Description
+      $res.="".$l[5]." "; // Find
+      $res.="".$prochaine_echeance." "; // Prochaine Echéance
+      $res.="--.--.-- ";
+    $res.=" Ajouter une opération récurrente  "; // Description
+      $res.="-- "; // Find
+      $res.="-- "; // Find
+      $res.="-- "; // Find
+    $res.="
";
+  }
+  /**
+   *
+   *
+   */
+  private function documents()
+  {
+    if (isset($_GET['id']) )
+    {
+      $this->docRecurrentDetails($_GET['id']);
+    } 
+    else if (isset($_GET['regler']) )
+    {
+      $this->docRecurrentPayer($_GET['regler']);
+    }
+    else
+    {
+      echo "Les opération récurrentes  ";
+      $this->docRecurrents();
+    }
+  }
+
+    /**
+     * @brief Display The articles in flex mode
+     * Also revise menu
+     */
+    function main()
+    {
+      if ( (isset($_POST) && isset($_POST['submit']) ) 
+        || isset($_GET['regler'])
+        || isset($_GET['id']))
+        {
+            error_log("to ledger_recurrent");
+            $this->script("/app/compta/services.php/");
+        } else
+        {
+            error_log("to pag_ledger");
+            $this->script();
+        }
+        echo '';
+        $this->documents();
+        echo '
';
+    }
+}
+
+?>
diff --git a/app/compta/views/recurrent_nouveau.php b/app/compta/views/recurrent_nouveau.php
new file mode 100644
index 0000000..7816d02
--- /dev/null
+++ b/app/compta/views/recurrent_nouveau.php
@@ -0,0 +1,310 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief Update GUI with the list of 
+ * documents available. All decomptes
+ */
+class Nouveau extends \PageCompta
+	implements \IActionResult 
+{
+
+    function __construct($s = "" ,$b = true)
+    {
+        parent::__construct($s,$b);
+    }
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+    private function script($loc = "/app/compta/services.php/")
+    {
+        $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+    private function docRecurrentDetails($id)
+    {
+       $tpl =<<<_EOF
+%s 
+    %s € 
+    %s € 
+    
+Détail ".$des[3]."  ";
+    echo "";
+    echo "Date de début      :  ".$des[1]." Prochaine échéance: ".$des[4]." Montant :  ".$des[2]."€ 
";
+    echo "Ecritures ";
+    /* acc | debit | credit */
+    echo "";
+    $res =<<<_EOF
+	    
+Account 
+    Débit 
+    Crédit 
+ 
+_EOF;
+    echo $res;
+    foreach( $lst as $k => $acc)
+    {
+        if ($acc[4] == 'd')
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],$acc[3],"0.0");
+        } else
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],"0.0",$acc[3]);
+        }
+    } 
+    echo "
";
+   /*
+    echo "Prochaine échéance  ";
+    $lp = $rec->getNextPayement($id);
+    $date_apayer = new DateTime($lp[6]);
+    $date_today  = new DateTime("now");
+    $p = "";
+    if ($date_apayer > $date_today) {
+    $p.= "en attente";
+    } else {
+            $p.=<<
+        Date 
+    annuite 
+    interet 
+    ammorti 
+      
+{$lp[6]} 
+    {$lp[7]} € 
+    {$lp[8]} € 
+    {$lp[9]} € 
+    {$p}
+     
+Règlement échéance terminé ";
+    echo "";
+    $res =<<<_EOF
+Date 
+    annuite 
+    interet 
+    ammorti 
+      
+{$lp[6]} 
+    {$lp[7]} € 
+    {$lp[8]} € 
+    {$lp[9]} € 
+    
+      Retour 
+     
+
";
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function docRecurrents()
+  {
+    $_cfg = $this->_auth_cfg;
+    $rec = new \Recurrent( $this->getSession()
+             , $_cfg
+             , $this->getSession()->getDb());
+    $lst = $rec->getList();
+    echo "";
+    echo "";
+    echo "Date Description Montant Fin Prochaine échéance  ";
+    $date_today  = new \DateTime("now");
+    foreach ($lst as $l)
+    {
+      $res="".$l[1]." ";
+      $prochaine_echeance = "";
+      $date_apayer = new \DateTime($l[4]);
+      if ($date_apayer < $date_today)
+      {
+          $prochaine_echeance .= " ".$l[4]." a régler ";
+      } else
+      { 
+          $prochaine_echeance .= $l[4]." en attente";
+      }
+      $res.=<<{$l[3]} 
+EOF;
+      $res.="".$l[2]." "; // Description
+      $res.="".$l[5]." "; // Find
+      $res.="".$prochaine_echeance." "; // Prochaine Echéance
+      $res.="--.--.-- ";
+    $res.=" Ajouter une opération récurrente  "; // Description
+      $res.="-- "; // Find
+      $res.="-- "; // Find
+      $res.="-- "; // Find
+    $res.="
";
+  }
+  /**
+   *
+   *
+   */
+  private function documents()
+  {
+    if (isset($_GET['id']) )
+    {
+      $this->docRecurrentDetails($_GET['id']);
+    } 
+    else if (isset($_GET['regler']) )
+    {
+      $this->docRecurrentPayer($_GET['regler']);
+    }
+    else
+    {
+      echo "Les opération récurrentes  ";
+      $this->docRecurrents();
+    }
+  }
+
+    /**
+     * @brief Display The articles in flex mode
+     * Also revise menu
+     */
+    function main()
+    {
+      if ( (isset($_POST) && isset($_POST['submit']) ) 
+        || isset($_GET['regler'])
+        || isset($_GET['id']))
+        {
+            error_log("to ledger_recurrent");
+            $this->script("/app/compta/services.php/");
+        } else
+        {
+            error_log("to pag_ledger");
+            $this->script();
+        }
+        echo '';
+        $this->documents();
+        echo '
';
+    }
+}
+
+?>
diff --git a/app/compta/views/recurrent_payer.php b/app/compta/views/recurrent_payer.php
new file mode 100644
index 0000000..9bd54ea
--- /dev/null
+++ b/app/compta/views/recurrent_payer.php
@@ -0,0 +1,203 @@
+
+
+
+
+Gestion comptable 
+
+  
+  
+    +
 
+
+
+
+    
+    Chargement ... 
+     
+
+
+    
+   
+ 
+XML;
+
+
+/**
+ * @brief GUI result when a recurrent entry 
+ * is payed. We would like to see the next
+ * payement date, the amount, the possibility
+ * to update this recurrent entry, go back to the list
+ * of recurrent entries, go back to the main page. 
+ */
+class Payer extends \PageCompta
+	implements \IActionResult 
+{
+    private $_model;
+
+    function __construct($_model ,$b = true)
+    {
+        parent::__construct("",$b);
+        $this->_model = $_model;
+    }
+
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+    private function script($loc = "/app/compta/services.php/")
+    {
+        $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+    private function docRecurrentDetails($id)
+    {
+       $tpl =<<<_EOF
+%s 
+    %s € 
+    %s € 
+    
+Détail ".$des[3]."  ";
+    echo "";
+    echo "Date de début      :  ".$des[1]." Prochaine échéance: ".$des[4]." Montant :  ".$des[2]."€ 
";
+    echo "Ecritures ";
+    /* acc | debit | credit */
+    echo "";
+    $res =<<<_EOF
+	    
+Account 
+    Débit 
+    Crédit 
+ 
+_EOF;
+    echo $res;
+    foreach( $lst as $k => $acc)
+    {
+        if ($acc[4] == 'd')
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],$acc[3],"0.0");
+        } else
+        {
+            echo sprintf($tpl,$acc[2]." - ".$acc[5],"0.0",$acc[3]);
+        }
+    } 
+    echo "
";
+  }
+
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+  private function docRecurrentPayer()
+  {
+       $tpl =<<<_EOF
+%s 
+    %s 
+    %s € 
+    %s € 
+    
+L'opération {$lp[0][2]} en date du {$lp[0][1]} est enregistrée avec succès.
+EOF;
+
+    $res.="";
+    $res.=<<<_EOF
+Account 
+    Journal 
+    Débit 
+    Crédit 
+
";
+    echo 'Retour ';
+  }
+  /**
+   *
+   *
+   */
+  private function documents()
+  {
+    if ($this->_model->isPayed() )
+    {
+      $this->docRecurrentPayer();
+    }
+    else
+    {
+      echo "Les opération récurrentes  ";
+      $this->docRecurrents();
+    }
+  }
+
+    /**
+     * @brief Display The articles in flex mode
+     * Also revise menu
+     */
+    function main()
+    {
+      if ( (isset($_POST) && isset($_POST['submit']) ) 
+        || isset($_GET['regler'])
+        || isset($_GET['id']))
+        {
+            error_log("to ledger_recurrent");
+            $this->script("/app/compta/services.php/");
+        } else
+        {
+            error_log("to pag_ledger");
+            $this->script();
+        }
+        echo '';
+        $this->documents();
+        echo '
';
+    }
+}
+
+?>
diff --git a/app/compta/views/recurrent_update.php b/app/compta/views/recurrent_update.php
new file mode 100644
index 0000000..f40f476
--- /dev/null
+++ b/app/compta/views/recurrent_update.php
@@ -0,0 +1,119 @@
+_model = $model;
+        parent::__construct("",true);
+    }
+    public function render()
+    {
+        $this->show();
+    }
+
+  /**
+   * @brief insert a script in the page to update menu link
+   *
+   */
+    private function script($loc = "/app/compta/services.php/")
+    {
+        $s=<<<_EOF
+
+_EOF;
+    echo $s;
+  }
+  /**
+   * @brief main page that will list all loans
+   *
+   */
+    private function document()
+    {
+       $tpl =<<<_EOF
+%s 
+    %s € 
+    %s € 
+    
+Détail {$des[3]}  
+