noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 25/34: Task 0002128: Clôture comptabilité fra


From: dwm
Subject: [Noalyss-commit] [noalyss] 25/34: Task 0002128: Clôture comptabilité française
Date: Wed, 17 Jan 2024 12:54:08 -0500 (EST)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit e723c5c5b1b637936107fd524b9788b4cb49460d
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Jan 7 17:17:10 2024 +0100

    Task 0002128: Clôture comptabilité française
---
 html/ajax_misc.php                                 |   13 +-
 html/js/acc_ledger.js                              | 1776 +++++++++++---------
 include/ajax/ajax_operation_exercice.php           |  153 ++
 include/class/acc_ledger.class.php                 |   28 -
 include/class/operation_closing.class.php          |   43 +
 include/class/operation_exercice.class.php         |  156 ++
 include/class/operation_opening.class.php          |  146 ++
 include/constant.php                               |    1 +
 .../operation_exercice_detail_sql.class.php        |   79 +
 include/database/operation_exercice_sql.class.php  |   81 +
 include/operation_exercice.inc.php                 |   49 +
 include/template/operation_exercice-input_row.php  |  114 ++
 .../template/operation_exercice-input_source.php   |  129 ++
 sql/upgrade.sql                                    |   56 +-
 14 files changed, 2009 insertions(+), 815 deletions(-)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 0492c3772..173edfb35 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -327,7 +327,18 @@ $path = array(
     //visibility quantity
     "update_visibility_quantity"=>"ajax_update_visibility_quantity",
     // detail customer , supplier operation
-    "event_display_detail"=>"ajax_event_display_detail"
+    "event_display_detail"=>"ajax_event_display_detail",
+    // update periode in opening operation
+    "operation_exercice+update_periode"=>"ajax_operation_exercice",
+    // modify row in exercice (opening/closing) operation
+    "operation_exercice+modify_row"=>"ajax_operation_exercice",
+    // save row  in exercice (opening/closing) operation
+    "operation_exercice+save_row"=>"ajax_operation_exercice",
+    // compute the balance after saving row  in exercice (opening/closing) 
operation
+    "operation_exercice+display_total"=>"ajax_operation_exercice",
+    // delete row  in exercice (opening/closing) operation
+    "operation_exercice+delete_row"=>"ajax_operation_exercice",
+
 ) ;
 
 if (array_key_exists($op, $path)) {
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 41dd5f16f..8c205ff85 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -26,77 +26,75 @@
  *
  */
 var layer = 1;
+
 /**
  * \fn
  * \brief update the list of available predefined operation when we change the 
ledger.
  */
-function update_predef(p_type, p_direct, p_ac)
-{
+function update_predef(p_type, p_direct, p_ac) {
     var jrn = g("p_jrn").value;
     var dossier = g("gDossier").value;
     var querystring = 'gDossier=' + dossier + '&l=' + jrn + '&t=' + p_type + 
'&d=' + p_direct + "&op=up_predef&ac=" + p_ac;
     g("p_jrn_predef").value = jrn;
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_get_predef,
-                onSuccess: function (req) {
-                    try {
-                        $('info_div').innerHTML = "ok";
-                        var answer = req.responseXML;
-                        var a = answer.getElementsByTagName('code');
-                        var html = answer.getElementsByTagName('value');
-                        if (a.length == 0)
-                        {
-                            var rec = req.responseText;
-                            alert_box(content[48] + rec);
-                        }
-                        var code_html = getNodeText(html[0]);
-                        code_html = unescape_xml(code_html);
-                        // document.getElementsByName(name_ctl)[0].value = 
code_html;
-                        $('modele_op_div').innerHTML = code_html;
-                    } catch (e) {
-                        $('info_div').innerHTML = e.message;
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_get_predef,
+            onSuccess: function (req) {
+                try {
+                    $('info_div').innerHTML = "ok";
+                    var answer = req.responseXML;
+                    var a = answer.getElementsByTagName('code');
+                    var html = answer.getElementsByTagName('value');
+                    if (a.length == 0) {
+                        var rec = req.responseText;
+                        alert_box(content[48] + rec);
                     }
+                    var code_html = getNodeText(html[0]);
+                    code_html = unescape_xml(code_html);
+                    // document.getElementsByName(name_ctl)[0].value = 
code_html;
+                    $('modele_op_div').innerHTML = code_html;
+                } catch (e) {
+                    $('info_div').innerHTML = e.message;
                 }
             }
+        }
     );
 }
 
 /**
  *  update the list of payment method when we change the ledger.
  */
-function update_pay_method()
-{
+function update_pay_method() {
     waiting_box();
     var jrn = g("p_jrn").value;
     var dossier = g("gDossier").value;
     var querystring = 'gDossier=' + dossier + '&l=' + jrn + 
"&op=up_pay_method";
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_get_predef,
-                onSuccess: function (req) {
-                    remove_waiting_box();
-                    var answer = req.responseText;
-                    $('payment').innerHTML = answer;
-                }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_get_predef,
+            onSuccess: function (req) {
+                remove_waiting_box();
+                var answer = req.responseText;
+                $('payment').innerHTML = answer;
             }
+        }
     );
 }
+
 /**
  *  update the list of additional tax
  */
-function update_other_tax()
-{
+function update_other_tax() {
     waiting_box();
     var jrn = g("p_jrn").value;
     var dossier = g("gDossier").value;
-    var querystring ={gDossier: dossier,jrn_id:jrn ,op:"up_other_tax"};
+    var querystring = {gDossier: dossier, jrn_id: jrn, op: "up_other_tax"};
     var action = new Ajax.Request(
         "ajax_misc.php",
         {
@@ -112,32 +110,32 @@ function update_other_tax()
         }
     );
 }
+
 /**
  * update ctl id =jrn_name with the value of p_jrn
  */
-function update_name()
-{
+function update_name() {
     var jrn_id = $('p_jrn').value;
     var dossier = g("gDossier").value;
     var querystring = 'gDossier=' + dossier + '&l=' + jrn_id + 
"&op=ledger_description";
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_get_pj,
-                onSuccess: function (req) {
-                    $('jrn_name_div').innerHTML = req.responseText;
-                }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_get_pj,
+            onSuccess: function (req) {
+                $('jrn_name_div').innerHTML = req.responseText;
             }
+        }
     );
 
 }
+
 /**
  *  update the field predef
  */
-function error_get_predef(request, json)
-{
+function error_get_predef(request, json) {
     alert_box(content[49]);
 
 }
@@ -145,122 +143,124 @@ function error_get_predef(request, json)
 /**
  *  update the list of available predefined operation when we change the 
ledger.
  */
-function update_pj()
-{
+function update_pj() {
     var jrn = g("p_jrn").value;
     var dossier = g("gDossier").value;
     var querystring = 'gDossier=' + dossier + '&l=' + jrn + "&op=upd_receipt";
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_get_pj,
-                onSuccess: success_get_pj
-            }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_get_pj,
+            onSuccess: success_get_pj
+        }
     );
 }
+
 /**
  * ask the name, quick_code of the bank for the ledger
  */
-function update_bank()
-{
+function update_bank() {
     var jrn = g('p_jrn').value;
     var dossier = g('gDossier').value;
     var qs = 'gDossier=' + dossier + '&op=bkname&p_jrn=' + jrn;
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: qs,
-                onFailure: error_get_pj,
-                onSuccess: success_update_bank
-            }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: qs,
+            onFailure: error_get_pj,
+            onSuccess: success_update_bank
+        }
     );
 
 }
+
 /**
  *  Update the number of rows when changing of ledger
  */
-function update_row(ctl)
-{
-    try
-    {
-        var row_to_keep=3; /* Number of row to keep (head and foot)*/
-        if ( ctl === 'quick_item' ) { row_to_keep=1;} /* for ODS , only 1 rows 
to keep */
+function update_row(ctl) {
+    try {
+        var row_to_keep = 3; /* Number of row to keep (head and foot)*/
+        if (ctl === 'quick_item') {
+            row_to_keep = 1;
+        } /* for ODS , only 1 rows to keep */
         var jrn = g('p_jrn').value;
         var dossier = g('gDossier').value;
         var qs = encodeURI('gDossier=' + dossier + '&op=minrow&j=' + jrn + 
'&ctl=' + ctl);
         var current_row = parseFloat($('nb_item').value);
         var action = new Ajax.Request(
-                "ajax_misc.php",
-                {
-                    method: 'get',
-                    parameters: qs,
-                    onFailure: null,
-                    onSuccess: function (request, json)
-                    {
-                        try {
-                            var answer = request.responseText.evalJSON(true);
-                            var row = parseFloat(answer.row);
-                            
-                            var table_to_update=$(ctl);
-                            if (current_row > row) {
-                                // Too many row, we always must keep 2 rows 
for the sum
-                                var delta = $('nb_item').value - row ;
-                                var idx = $('nb_item').value;
-                                for (var i = 0; i < delta; i++) {
-                                    var pos_row=table_to_update.rows.length;
-                                    var cell0 = 
table_to_update.rows[pos_row-row_to_keep].cells[0];
-                                    var cell0Element=cell0.childNodes;
-                                    var canDelete=true;
-                                    /**
-                                     * prevent truncating
-                                     */
-                                    cell0Element.forEach(function (x) { 
-                                        if (canDelete && x.nodeName=='INPUT' 
&& x.type==="text" && x.value) 
-                                        { 
-                                            canDelete=false;
-                                        }}
-                                            );
-                                   /* 
-                                    * prevent truncating
-                                    * For ODS we also need to check the second 
column 
-                                    * */
-                                    if ( canDelete && ctl === 'quick_item') {
-                                        var cell1 = 
table_to_update.rows[pos_row-row_to_keep].cells[1];
-                                        var cell1Element=cell1.childNodes;
-                                        cell1Element.forEach(function (x) { 
-                                        if (canDelete && x.nodeName=='INPUT' 
&& x.type==="text" && x.value) 
-                                        { 
-                                            canDelete=false;
-                                        }});
+            "ajax_misc.php",
+            {
+                method: 'get',
+                parameters: qs,
+                onFailure: null,
+                onSuccess: function (request, json) {
+                    try {
+                        var answer = request.responseText.evalJSON(true);
+                        var row = parseFloat(answer.row);
+
+                        var table_to_update = $(ctl);
+                        if (current_row > row) {
+                            // Too many row, we always must keep 2 rows for 
the sum
+                            var delta = $('nb_item').value - row;
+                            var idx = $('nb_item').value;
+                            for (var i = 0; i < delta; i++) {
+                                var pos_row = table_to_update.rows.length;
+                                var cell0 = table_to_update.rows[pos_row - 
row_to_keep].cells[0];
+                                var cell0Element = cell0.childNodes;
+                                var canDelete = true;
+                                /**
+                                 * prevent truncating
+                                 */
+                                cell0Element.forEach(function (x) {
+                                        if (canDelete && x.nodeName == 'INPUT' 
&& x.type === "text" && x.value) {
+                                            canDelete = false;
+                                        }
                                     }
-                                    if ( canDelete )  { 
table_to_update.deleteRow(pos_row-row_to_keep);idx--;}
-                                    
+                                );
+                                /*
+                                 * prevent truncating
+                                 * For ODS we also need to check the second 
column
+                                 * */
+                                if (canDelete && ctl === 'quick_item') {
+                                    var cell1 = table_to_update.rows[pos_row - 
row_to_keep].cells[1];
+                                    var cell1Element = cell1.childNodes;
+                                    cell1Element.forEach(function (x) {
+                                        if (canDelete && x.nodeName == 'INPUT' 
&& x.type === "text" && x.value) {
+                                            canDelete = false;
+                                        }
+                                    });
+                                }
+                                if (canDelete) {
+                                    table_to_update.deleteRow(pos_row - 
row_to_keep);
+                                    idx--;
                                 }
-                                $('nb_item').value = 
table_to_update.rows.length-row_to_keep;
+
                             }
-                            if (current_row < row) {
-                                // We need to add rows
-                                var delta = row - current_row ;
-                                for (var i = 0; i < delta; i++) {
-                                    if (ctl == 'fin_item') {
-                                        ledger_fin_add_row();
-                                    }
-                                    if (ctl == 'sold_item') {
-                                        ledger_add_row();
-                                    }
-                                    if (ctl == 'quick_item') {
-                                        quick_writing_add_row();
-                                    }
+                            $('nb_item').value = table_to_update.rows.length - 
row_to_keep;
+                        }
+                        if (current_row < row) {
+                            // We need to add rows
+                            var delta = row - current_row;
+                            for (var i = 0; i < delta; i++) {
+                                if (ctl == 'fin_item') {
+                                    ledger_fin_add_row();
+                                }
+                                if (ctl == 'sold_item') {
+                                    ledger_add_row();
+                                }
+                                if (ctl == 'quick_item') {
+                                    quick_writing_add_row();
                                 }
                             }
-                        } catch (e) {
-                            alert_box("update_row:01"+e.message);
                         }
+                    } catch (e) {
+                        alert_box("update_row:01" + e.message);
                     }
                 }
+            }
         );
     } catch (e) {
         alert_box(e.message);
@@ -270,8 +270,7 @@ function update_row(ctl)
 /**
  * @brief hide or show the column quantity
  */
-function update_visibility_quantity()
-{
+function update_visibility_quantity() {
     var jrn = g("p_jrn").value;
     var dossier = g("gDossier").value;
     var querystring = 'gDossier=' + dossier + '&l=' + jrn + 
"&op=update_visibility_quantity";
@@ -283,21 +282,21 @@ function update_visibility_quantity()
             onSuccess: function (req) {
                 try {
                     // retrieve quantity
-                    var 
quantity_col=document.getElementsByClassName("col_quant");
-                    for (var i=0;i < quantity_col.length;i++){
-                        if (req.responseText=="0") {
+                    var quantity_col = 
document.getElementsByClassName("col_quant");
+                    for (var i = 0; i < quantity_col.length; i++) {
+                        if (req.responseText == "0") {
                             // hide the columns quantity and return
                             quantity_col[i].hide();
                             quantity_col[i].addClassName('d-none');
                         }
-                        if (req.responseText=="1") {
+                        if (req.responseText == "1") {
                             // show the columns quantity and return
                             quantity_col[i].show();
                             quantity_col[i].removeClassName('d-none');
                         }
                     }
                 } catch (e) {
-                    console.error("update_visibility_quantity"+e.message);
+                    console.error("update_visibility_quantity" + e.message);
                 }
 
 
@@ -305,80 +304,72 @@ function update_visibility_quantity()
         }
     );
 }
+
 /**
  *  Put into the span, the name of the bank, the bank account
  * and the quick_code
  */
-function success_update_bank(req)
-{
-    try
-    {
+function success_update_bank(req) {
+    try {
         var answer = req.responseXML;
         var a = answer.getElementsByTagName('code');
         var html = answer.getElementsByTagName('value');
-        if (a.length == 0)
-        {
+        if (a.length == 0) {
             var rec = req.responseText;
-            alert_box('UPDBK-'+content[48]+ rec);
+            alert_box('UPDBK-' + content[48] + rec);
         }
         var name_ctl = a[0].firstChild.nodeValue;
         var code_html = getNodeText(html[0]);
         code_html = unescape_xml(code_html);
         $(name_ctl).innerHTML = code_html;
-    }
-    catch (e)
-    {
+    } catch (e) {
         alert_box("success_update_bank" + e.message);
     }
 }
+
 /**
  *  call ajax, ask what is the last date for the current ledger
  */
-function get_last_date()
-{
+function get_last_date() {
     var jrn = g('p_jrn').value;
     var dossier = g('gDossier').value;
     var qs = 'gDossier=' + dossier + '&op=lastdate&p_jrn=' + jrn;
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: qs,
-                onFailure: error_get_pj,
-                onSuccess: success_get_last_date
-            }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: qs,
+            onFailure: error_get_pj,
+            onSuccess: success_get_last_date
+        }
     );
 }
+
 /**
  *  callback ajax, set the ctl with the last date from the ledger
  */
-function success_get_last_date(req)
-{
-    try
-    {
+function success_get_last_date(req) {
+    try {
         var answer = req.responseXML;
         var a = answer.getElementsByTagName('code');
         var html = answer.getElementsByTagName('value');
-        if (a.length == 0)
-        {
+        if (a.length == 0) {
             var rec = req.responseText;
-            alert_box('GETLASTDA:'+content[48] + rec);
+            alert_box('GETLASTDA:' + content[48] + rec);
         }
         var name_ctl = a[0].firstChild.nodeValue;
         var code_html = getNodeText(html[0]);
         code_html = unescape_xml(code_html);
         document.getElementsByName(name_ctl)[0].value = code_html;
-    }
-    catch (e)
-    {
+    } catch (e) {
         alert_box(e.message);
     }
 }
+
 /**
  *  update the field predef
  */
-function success_get_pj(request, json)
-{
+function success_get_pj(request, json) {
 
     var answer = request.responseText.evalJSON(true);
     var obj = g("e_pj");
@@ -388,19 +379,18 @@ function success_get_pj(request, json)
     obj.value = answer.pj;
     g("e_pj_suggest").value = answer.pj;
 }
+
 /**
  *  update the field predef
  */
-function error_get_pj(request, json)
-{
-    alert_box("GETPJ:"+content[48]);
+function error_get_pj(request, json) {
+    alert_box("GETPJ:" + content[48]);
 }
 
 /**
  *  add a line in the form for the ledger fin
  */
-function ledger_fin_add_row()
-{
+function ledger_fin_add_row() {
     var style = 'class="input_text"';
     var mytable = g("fin_item").tBodies[0];
     var line = mytable.rows.length;
@@ -408,8 +398,7 @@ function ledger_fin_add_row()
     var nb = g("nb_item");
     var rowToCopy = mytable.rows[1];
     var nNumberCell = rowToCopy.cells.length;
-    for (var e = 0; e < nNumberCell; e++)
-    {
+    for (var e = 0; e < nNumberCell; e++) {
         var newCell = row.insertCell(e);
         if (e == 0) {
             newCell.id = 'tdchdate' + nb.value;
@@ -423,7 +412,7 @@ function ledger_fin_add_row()
         new_tt = new_tt.replace(/e_other0_label/g, "e_other" + nb.value + 
'_label');
         new_tt = new_tt.replace(/dateop0/g, "dateop" + nb.value);
         newCell.innerHTML = new_tt;
-        newCell.className=rowToCopy.cells[e].className;
+        newCell.className = rowToCopy.cells[e].className;
         new_tt.evalScripts();
     }
     g("e_other" + nb.value).value = "";
@@ -443,29 +432,36 @@ function ledger_fin_add_row()
  * Add multiple row
  * @param string p_elid is the id of element  with the number of rows to add, 
and p_elid+"_ledger" is the type of ledger : M : Misc Operation O : Sales or 
purchase and F for financial
  */
-function ledger_add_multiple(p_elid)
-{
-    var nbrow=$(p_elid).value;
-    if (nbrow == NaN) {nbrow=1;}
-    var type_ledger=$(p_elid+"_ledger").value;
-    var i=0;
-    for (i=0;i<nbrow;i++) {
-        if ( type_ledger == 'O' ) {ledger_add_row();}
-        if ( type_ledger == 'F') { ledger_fin_add_row();}
-        if ( type_ledger == 'M') { quick_writing_add_row();}
+function ledger_add_multiple(p_elid) {
+    var nbrow = $(p_elid).value;
+    if (nbrow == NaN) {
+        nbrow = 1;
     }
-    if ( type_ledger == 'M') {
-        var aCheckBox=$$('.debit-credit')
-        aCheckBox.forEach((item)=>display_dcside(item))
+    var type_ledger = $(p_elid + "_ledger").value;
+    var i = 0;
+    for (i = 0; i < nbrow; i++) {
+        if (type_ledger == 'O') {
+            ledger_add_row();
+        }
+        if (type_ledger == 'F') {
+            ledger_fin_add_row();
+        }
+        if (type_ledger == 'M') {
+            quick_writing_add_row();
+        }
+    }
+    if (type_ledger == 'M') {
+        var aCheckBox = $$('.debit-credit')
+        aCheckBox.forEach((item) => display_dcside(item))
     }
 }
+
 /**
  *  add a line in the form for the purchase ledger
  * @param p_dossier folder id
  * @param p_table_name
  */
-function ledger_add_row()
-{
+function ledger_add_row() {
     try {
         style = 'class="input_text"';
         var mytable = g("sold_item").tBodies[0];
@@ -474,8 +470,7 @@ function ledger_add_row()
         var nCell = mytable.rows[1].cells.length;
         var row = mytable.insertRow(line);
         var nb = g("nb_item");
-        for (var e = 0; e < nCell; e++)
-        {
+        for (var e = 0; e < nCell; e++) {
             var newCell = row.insertCell(e);
             var tt = ofirstRow.cells[e].innerHTML;
             var new_tt = tt.replace(/march0/g, "march" + nb.value);
@@ -484,7 +479,7 @@ function ledger_add_row()
             new_tt = new_tt.replace(/compute_ledger\(0\)/g, "compute_ledger(" 
+ nb.value + ")");
             new_tt = new_tt.replace(/clean_tva\(0\)/g, "clean_tva(" + nb.value 
+ ")");
             newCell.innerHTML = new_tt;
-            newCell.className=ofirstRow.cells[e].className;
+            newCell.className = ofirstRow.cells[e].className;
             new_tt.evalScripts();
         }
 
@@ -503,17 +498,16 @@ function ledger_add_row()
         alert_box(e.message);
     }
 }
+
 /**
  *  compute the sum of a purchase, update the span tvac, htva and tva
  * all the needed data are taken from the document (hidden field :  gdossier)
  * @param the number of the changed ctrl
  */
-function compute_ledger(p_ctl_nb)
-{
+function compute_ledger(p_ctl_nb) {
     var dossier = g("gDossier").value;
     var a = -1;
-    if (document.getElementById("e_march" + p_ctl_nb + '_tva_amount'))
-    {
+    if (document.getElementById("e_march" + p_ctl_nb + '_tva_amount')) {
         a = trim(g("e_march" + p_ctl_nb + '_tva_amount').value);
         g("e_march" + p_ctl_nb + '_tva_amount').value = a;
     }
@@ -523,8 +517,7 @@ function compute_ledger(p_ctl_nb)
     g("e_march" + p_ctl_nb).value = trim(g("e_march" + p_ctl_nb).value);
     var qcode = g("e_march" + p_ctl_nb).value;
 
-    if (qcode.length == 0)
-    {
+    if (qcode.length == 0) {
         clean_ledger(p_ctl_nb);
         refresh_ledger();
         return;
@@ -533,11 +526,9 @@ function compute_ledger(p_ctl_nb)
      * if tva_id is empty send a value of -1
      */
     var tva_id = -1;
-    if (g('e_march' + p_ctl_nb + '_tva_id'))
-    {
+    if (g('e_march' + p_ctl_nb + '_tva_id')) {
         tva_id = g('e_march' + p_ctl_nb + '_tva_id').value;
-        if (trim(tva_id) == '')
-        {
+        if (trim(tva_id) == '') {
             tva_id = -1;
         }
     }
@@ -547,32 +538,39 @@ function compute_ledger(p_ctl_nb)
 
     g('e_quant' + p_ctl_nb).value = trim(g('e_quant' + p_ctl_nb).value);
     var quantity = g('e_quant' + p_ctl_nb).value;
-    let other_tax=g("other_tax");
-    let other_tax_id=(other_tax && other_tax.checked)?other_tax.value:-1;
-
-    var querystring = { gDossier : dossier , c : qcode ,t :tva_id,p : price , 
q:quantity,n:p_ctl_nb,'other_tax_id':other_tax_id};
+    let other_tax = g("other_tax");
+    let other_tax_id = (other_tax && other_tax.checked) ? other_tax.value : -1;
+
+    var querystring = {
+        gDossier: dossier,
+        c: qcode,
+        t: tva_id,
+        p: price,
+        q: quantity,
+        n: p_ctl_nb,
+        'other_tax_id': other_tax_id
+    };
     var action = new Ajax.Request(
-            "compute.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_compute_ledger,
-                onSuccess: success_compute_ledger
-            }
+        "compute.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_compute_ledger,
+            onSuccess: success_compute_ledger
+        }
     );
 }
+
 /**
  * refresh the purchase screen, recompute vat, total...
  */
-function refresh_ledger()
-{
+function refresh_ledger() {
     var tva = 0;
     var htva = 0;
     var tvac = 0;
 
-    nb_item=g("nb_item").value;
-    for (var i = 0; i < nb_item; i++)
-    {
+    nb_item = g("nb_item").value;
+    for (var i = 0; i < nb_item; i++) {
         if (g('tva_march' + i))
             tva += g('tva_march' + i).value * 1;
         if (g('htva_march' + i))
@@ -580,62 +578,57 @@ function refresh_ledger()
         if (g('tvac_march' + i))
             tvac += g('tvac_march' + i).value * 1;
     }
-    id_tva=g("tva");
-    id_htva=g("htva");
-    id_tvac=g("tvac");
-    id_other_tax=g("other_tax_amount");
+    id_tva = g("tva");
+    id_htva = g("htva");
+    id_tvac = g("tvac");
+    id_other_tax = g("other_tax_amount");
     if (id_tva)
         id_tva.innerHTML = Math.round(tva * 100) / 100;
     if (id_htva)
         id_htva.innerHTML = Math.round(htva * 100) / 100;
-    if ( id_other_tax) {
-        let total_operation=tvac+parseFloat(id_other_tax.value);
-        
$('total_operation_other_tax').innerHTML=Math.round(total_operation*100)/100;
+    if (id_other_tax) {
+        let total_operation = tvac + parseFloat(id_other_tax.value);
+        $('total_operation_other_tax').innerHTML = Math.round(total_operation 
* 100) / 100;
     }
     if (id_tvac)
         id_tvac.innerHTML = Math.round(tvac * 100) / 100;
 
 
 }
+
 /**
  * update the field htva, tva_id and tvac, callback function for  compute_sold
  * it the field TVA in the answer contains NA it means that VAT is appliable 
and then do not
  * update the VAT field except htva_martc
  */
-function success_compute_ledger(request, json)
-{
+function success_compute_ledger(request, json) {
     var answer = request.responseText.evalJSON(true);
     var ctl = answer.ctl;
     var rtva = answer.tva;
     var rhtva = answer.htva;
     var rtvac = answer.tvac;
-    let other_tax=g("other_tax_amount")
-    if ( other_tax) {
-        other_tax.value=answer.other_tax;
+    let other_tax = g("other_tax_amount")
+    if (other_tax) {
+        other_tax.value = answer.other_tax;
     }
-    if (rtva == 'NA')
-    {
+    if (rtva == 'NA') {
         var rhtva = answer.htva * 1;
         g('htva_march' + ctl).value = rhtva;
         g('tvac_march' + ctl).value = rtvac;
         g('sum').show();
         refresh_ledger();
-        CurrencyCompute('p_currency_rate','p_currency_euro');
+        CurrencyCompute('p_currency_rate', 'p_currency_euro');
 
         return;
     }
     rtva = answer.tva * 1;
 
 
-
     g('sum').show();
-    if (g('e_march' + ctl + '_tva_amount').value == "" || g('e_march' + ctl + 
'_tva_amount').value == 0)
-    {
+    if (g('e_march' + ctl + '_tva_amount').value == "" || g('e_march' + ctl + 
'_tva_amount').value == 0) {
         g('tva_march' + ctl).value = rtva;
         g('e_march' + ctl + '_tva_amount').value = rtva;
-    }
-    else
-    {
+    } else {
         g('tva_march' + ctl).value = g('e_march' + ctl + '_tva_amount').value;
     }
     g('htva_march' + ctl).value = Math.round(parseFloat(rhtva) * 100) / 100;
@@ -643,31 +636,28 @@ function success_compute_ledger(request, json)
     var tmp2 = Math.round(parseFloat(g('tva_march' + ctl).value) * 100) / 100;
     g('tvac_march' + ctl).value = Math.round((tmp1 + tmp2) * 100) / 100;
     refresh_ledger();
-    CurrencyCompute('p_currency_rate','p_currency_euro');
-    
+    CurrencyCompute('p_currency_rate', 'p_currency_euro');
+
 }
 
 /**
  *  callback error function for  compute_sold
  */
-function error_compute_ledger(request, json)
-{
+function error_compute_ledger(request, json) {
     alert_box('Ajax does not work');
 }
-function compute_all_ledger()
-{
+
+function compute_all_ledger() {
     var loop = 0;
-    let nb_item=g("nb_item").value;
-    for (loop = 0; loop < nb_item; loop++)
-    {
+    let nb_item = g("nb_item").value;
+    for (loop = 0; loop < nb_item; loop++) {
         compute_ledger(loop);
     }
     var tva = 0;
     var htva = 0;
     var tvac = 0;
 
-    for (var i = 0; i < nb_item; i++)
-    {
+    for (var i = 0; i < nb_item; i++) {
         if (g('tva_march'))
             tva += g('tva_march' + i).value * 1;
         if (g('htva_march' + i))
@@ -675,61 +665,54 @@ function compute_all_ledger()
         if (g('tvac_march' + i))
             tvac += g('tvac_march' + i).value * 1;
     }
-    id_other_tax=g("other_tax_amount");
+    id_other_tax = g("other_tax_amount");
     if (g('tva'))
         g('tva').innerHTML = Math.round(tva * 100) / 100;
     if (g('htva'))
         g('htva').innerHTML = Math.round(htva * 100) / 100;
-    if (id_other_tax) { tvac+=id_other_tax.value;}
+    if (id_other_tax) {
+        tvac += id_other_tax.value;
+    }
     if (g('tvac'))
         g('tvac').innerHTML = Math.round(tvac * 100) / 100;
 
-   
+
 }
 
-function clean_tva(p_ctl)
-{
+function clean_tva(p_ctl) {
     if (g('e_march' + p_ctl + '_tva_amount'))
         g('e_march' + p_ctl + '_tva_amount').value = 0;
 }
 
-function clean_ledger(p_ctl_nb)
-{
-    if (g("e_march" + p_ctl_nb))
-    {
+function clean_ledger(p_ctl_nb) {
+    if (g("e_march" + p_ctl_nb)) {
         g("e_march" + p_ctl_nb).value = trim(g("e_march" + p_ctl_nb).value);
     }
-    if (g('e_march' + p_ctl_nb + '_price'))
-    {
+    if (g('e_march' + p_ctl_nb + '_price')) {
         g('e_march' + p_ctl_nb + '_price').value = '';
     }
-    if (g('e_quant' + p_ctl_nb))
-    {
+    if (g('e_quant' + p_ctl_nb)) {
         g('e_quant' + p_ctl_nb).value = '1';
     }
-    if (g('tva_march' + p_ctl_nb + '_show'))
-    {
+    if (g('tva_march' + p_ctl_nb + '_show')) {
         g('tva_march' + p_ctl_nb + '_show').value = '0';
     }
-    if (g('tva_march' + p_ctl_nb))
-    {
+    if (g('tva_march' + p_ctl_nb)) {
         g('tva_march' + p_ctl_nb).value = 0;
     }
-    if (g('htva_march' + p_ctl_nb))
-    {
+    if (g('htva_march' + p_ctl_nb)) {
         g('htva_march' + p_ctl_nb).value = 0;
     }
-    if (g('tvac_march' + p_ctl_nb))
-    {
+    if (g('tvac_march' + p_ctl_nb)) {
         g('tvac_march' + p_ctl_nb).value = 0;
     }
 
 }
+
 /**
  *  add a line in the form for the quick_writing
  */
-function quick_writing_add_row()
-{
+function quick_writing_add_row() {
     style = 'class="input_text"';
     var mytable = g("quick_item").tBodies[0];
     var nNumberRow = mytable.rows.length;
@@ -739,8 +722,7 @@ function quick_writing_add_row()
     var nb = g("nb_item");
 
     var oNewRow = mytable.insertRow(nNumberRow);
-    for (var e = 0; e < nNumberCell; e++)
-    {
+    for (var e = 0; e < nNumberCell; e++) {
         var newCell = oRow.insertCell(e);
         var tt = rowToCopy.cells[e].innerHTML;
         new_tt = tt.replace(/qc_0/g, "qc_" + nb.value);
@@ -749,12 +731,15 @@ function quick_writing_add_row()
         new_tt = new_tt.replace(/ck0/g, "ck" + nb.value);
         new_tt = new_tt.replace(/ld0/g, "ld" + nb.value);
         newCell.innerHTML = new_tt;
-        newCell.className=rowToCopy.cells[e].className;
+        newCell.className = rowToCopy.cells[e].className;
         new_tt.evalScripts();
 
     }
-    var ck=$('ck'+nb.value);
-    ck.addEventListener('click',function(event) { 
display_range_dcside(event,ck); display_dcside(ck);});
+    var ck = $('ck' + nb.value);
+    ck.addEventListener('click', function (event) {
+        display_range_dcside(event, ck);
+        display_dcside(ck);
+    });
 
 
     $("qc_" + nb.value).value = "";
@@ -763,230 +748,240 @@ function quick_writing_add_row()
     $("ld" + nb.value).value = "";
 
 
-
     nb.value++;
 
 }
-function RefreshMe()
-{
+
+function RefreshMe() {
     window.location.reload();
 }
 
 
-function go_next_concerned()
-{
+function go_next_concerned() {
     var form = document.forms[1];
 
-    for (var e = 0; e < form.elements.length; e++)
-    {
+    for (var e = 0; e < form.elements.length; e++) {
         var elmt = form.elements[e];
-        if (elmt.type == "checkbox")
-        {
-            if (elmt.checked == true)
-            {
+        if (elmt.type == "checkbox") {
+            if (elmt.checked == true) {
                 return confirm(content[52]);
             }
         }
     }
     return true;
 }
+
 /**
  *  View the history of an account
  * @param {type} p_value
  * @param {type} dossier
  * @returns {undefined}
  */
-function view_history_account(p_value, dossier,p_exercice)
-{
+function view_history_account(p_value, dossier, p_exercice) {
     layer++;
     var idbox = 'det' + layer;
     var popup = {'id': idbox, 'cssclass': 'inner_box', 'html': loading(), 
'drag': false};
 
-    var 
querystring={'gDossier':dossier,'act':'de','pcm_val':p_value,'div':idbox,'l':layer,'op':'history','exercice':p_exercice};
+    var querystring = {
+        'gDossier': dossier,
+        'act': 'de',
+        'pcm_val': p_value,
+        'div': idbox,
+        'l': layer,
+        'op': 'history',
+        'exercice': p_exercice
+    };
     waiting_box();
 
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_box,
-                onSuccess: function (req, xml)
-                {
-                    remove_waiting_box();
-                    add_div(popup);
-                    success_box(req, xml);
-                    $(idbox).style.top = calcy(140 + (layer * 3)) + "px";
-                }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_box,
+            onSuccess: function (req, xml) {
+                remove_waiting_box();
+                add_div(popup);
+                success_box(req, xml);
+                $(idbox).style.top = calcy(140 + (layer * 3)) + "px";
             }
+        }
     );
 
 }
+
 /**
  *  View the history of an account
  * @param {type} p_value
  * @param {type} dossier
  * @returns {undefined}
  */
-function view_history_anc_account(p_value, dossier,p_exercice)
-{
+function view_history_anc_account(p_value, dossier, p_exercice) {
     layer++;
     var idbox = 'det' + layer;
     var popup = {'id': idbox, 'cssclass': 'inner_box', 'html': loading(), 
'drag': false};
 
-    var 
querystring={'gDossier':dossier,'op':'history_anc_account','po_id':p_value,'div':idbox,'l':layer,'act':'history','exercice':p_exercice};
+    var querystring = {
+        'gDossier': dossier,
+        'op': 'history_anc_account',
+        'po_id': p_value,
+        'div': idbox,
+        'l': layer,
+        'act': 'history',
+        'exercice': p_exercice
+    };
     waiting_box();
 
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_box,
-                onSuccess: function (req, xml)
-                {
-                    remove_waiting_box();
-                    add_div(popup);
-                    $(idbox).innerHTML=req.responseText;
-                    $(idbox).style.top = calcy(140 + (layer * 3)) + "px";
-                }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_box,
+            onSuccess: function (req, xml) {
+                remove_waiting_box();
+                add_div(popup);
+                $(idbox).innerHTML = req.responseText;
+                $(idbox).style.top = calcy(140 + (layer * 3)) + "px";
             }
+        }
     );
 
 }
+
 /**
  *  Change the view of account history
  * @param {type} obj
  * @returns {Boolean}
  */
-function update_history_account(obj)
-{
+function update_history_account(obj) {
     try {
         var querystring = {
-            "l" :obj.div ,
-            "div" :obj.div ,
-            "gDossier" : obj.gDossier,
-            "pcm_val" : obj.pcm_val ,
-            "ex" : obj.select.options[obj.select.selectedIndex].text,
-            "op":"history",
-            "exercice":obj.exercice
+            "l": obj.div,
+            "div": obj.div,
+            "gDossier": obj.gDossier,
+            "pcm_val": obj.pcm_val,
+            "ex": obj.select.options[obj.select.selectedIndex].text,
+            "op": "history",
+            "exercice": obj.exercice
         };
         waiting_box();
         var action = new Ajax.Request(
-                "ajax_misc.php",
-                {
-                    method: 'get',
-                    parameters: querystring,
-                    onFailure: error_box,
-                    onSuccess: function (req, xml)
-                    {
-                        remove_waiting_box();
-                        success_box(req, xml);
-                        g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
-                    }
-                });
-    } catch (e)
-    {
+            "ajax_misc.php",
+            {
+                method: 'get',
+                parameters: querystring,
+                onFailure: error_box,
+                onSuccess: function (req, xml) {
+                    remove_waiting_box();
+                    success_box(req, xml);
+                    g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
+                }
+            });
+    } catch (e) {
         alert_box("update_history_account error " + e.message);
     }
 
     return false;
 }
+
 /*!\brief Change the view of card history
  * \param p_value f_id of the card
  */
-function view_history_card(p_value, dossier,p_exercice)
-{
+function view_history_card(p_value, dossier, p_exercice) {
     layer++;
     var idbox = 'det' + layer;
-    var popup = {'id':idbox,
-                'cssclass': 'inner_box', 
-                'html':loading(), 
-                'drag':false};
-    var querystring = { 'gDossier' : dossier ,
-         'act':'de',
-         'f_id' : p_value , 
-         'div' : idbox ,
-          "l" : layer,
-          "op":"history",
-      "exercice":p_exercice};
+    var popup = {
+        'id': idbox,
+        'cssclass': 'inner_box',
+        'html': loading(),
+        'drag': false
+    };
+    var querystring = {
+        'gDossier': dossier,
+        'act': 'de',
+        'f_id': p_value,
+        'div': idbox,
+        "l": layer,
+        "op": "history",
+        "exercice": p_exercice
+    };
     waiting_box();
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_box,
-                onSuccess: function (req, xml)
-                {
-                    remove_waiting_box();
-                    add_div(popup);
-                    success_box(req, xml);
-                    g(idbox).style.top = calcy(140 + (layer * 3)) + "px";
-                }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_box,
+            onSuccess: function (req, xml) {
+                remove_waiting_box();
+                add_div(popup);
+                success_box(req, xml);
+                g(idbox).style.top = calcy(140 + (layer * 3)) + "px";
             }
+        }
     );
 }
+
 /**
  *  update history view after changing the exercice
  * @param {type} obj
  * @returns {Boolean}
  */
-function update_history_card(obj)
-{
+function update_history_card(obj) {
     try {
         var querystring = {
-            "l" : obj.div , 
-            "div" : obj.div ,
-            "gDossier" : obj.gDossier,
-            "f_id" : obj.f_id ,
-            "ex" : obj.select.options[obj.select.selectedIndex].text,
-            "op":"history",
-            "exercice":obj.exercice
+            "l": obj.div,
+            "div": obj.div,
+            "gDossier": obj.gDossier,
+            "f_id": obj.f_id,
+            "ex": obj.select.options[obj.select.selectedIndex].text,
+            "op": "history",
+            "exercice": obj.exercice
         };
         waiting_box();
         var action = new Ajax.Request(
-                "ajax_misc.php",
-                {
-                    method: 'get',
-                    parameters: querystring,
-                    onFailure: error_box,
-                    onSuccess: function (req, xml)
-                    {
-                        remove_waiting_box();
-                        success_box(req, xml);
-                        g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
-                    }
-                });
-    } catch (e)
-    {
+            "ajax_misc.php",
+            {
+                method: 'get',
+                parameters: querystring,
+                onFailure: error_box,
+                onSuccess: function (req, xml) {
+                    remove_waiting_box();
+                    success_box(req, xml);
+                    g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
+                }
+            });
+    } catch (e) {
         alert_box("update_history_account error " + e.message);
     }
 
     return false;
 }
+
 /**
  * remove an Operation
  *@param p_jr_id is the jrn.jr_id
  *@param dossier
  *@param the div
  */
-function removeOperation(p_jr_id, dossier, div)
-{
+function removeOperation(p_jr_id, dossier, div) {
     waiting_box();
-    var qs = { "gDossier" :  dossier ,
-        "op":"ledger",
-        "act":"rmop",
-        "div" : div ,
-        "jr_id" : p_jr_id};
+    var qs = {
+        "gDossier": dossier,
+        "op": "ledger",
+        "act": "rmop",
+        "div": div,
+        "jr_id": p_jr_id
+    };
     new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: qs,
-                onFailure: error_box,
-                onSuccess: infodiv
-            }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: qs,
+            onFailure: error_box,
+            onSuccess: infodiv
+        }
     );
 
 }
@@ -995,36 +990,41 @@ function removeOperation(p_jr_id, dossier, div)
  * reverse an Operation
  *@param pointer to the FORM
  */
-function reverseOperation(obj)
-{
-    var qs = $(obj).serialize()+ "&op=ledger";
+function reverseOperation(obj) {
+    var qs = $(obj).serialize() + "&op=ledger";
     g('ext' + obj.divname).style.display = 'none';
     waiting_box();
     new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: qs,
-                onFailure: error_box,
-                onSuccess: function (req) {
-                    try {
-                        var action = new Ajax.Request(
-                                "ajax_misc.php",
-                                {
-                                    method: 'get',
-                                    parameters:{"gDossier" : 
obj["gDossier"].value,"op":"ledger","act":"de","div":obj['div'].value,"jr_id":obj['jr_id'].value},
-                                    onFailure: error_box,
-                                    onSuccess: function (xml, txt) {
-                                        
-                                        success_box(xml, txt);
-                                        infodiv(req);
-                                    }
-                                });
-                    } catch (ex) {
-                        smoke.alert(ex.message);
-                    }
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: qs,
+            onFailure: error_box,
+            onSuccess: function (req) {
+                try {
+                    var action = new Ajax.Request(
+                        "ajax_misc.php",
+                        {
+                            method: 'get',
+                            parameters: {
+                                "gDossier": obj["gDossier"].value,
+                                "op": "ledger",
+                                "act": "de",
+                                "div": obj['div'].value,
+                                "jr_id": obj['jr_id'].value
+                            },
+                            onFailure: error_box,
+                            onSuccess: function (xml, txt) {
+
+                                success_box(xml, txt);
+                                infodiv(req);
+                            }
+                        });
+                } catch (ex) {
+                    smoke.alert(ex.message);
                 }
             }
+        }
     );
 
     return false;
@@ -1035,33 +1035,39 @@ function reverseOperation(obj)
  * \param p_value jrn.jr_id
  * \param dossier dossier id
  */
-function modifyOperation(p_value, dossier)
-{
+function modifyOperation(p_value, dossier) {
     layer++;
     var id_div = 'det' + layer;
     waiting_box();
-    var querystring = { "gDossier" :  dossier ,
-        "op":"ledger",
-        "act":"de",
-        "div" : id_div ,
-        "jr_id" : p_value};
+    var querystring = {
+        "gDossier": dossier,
+        "op": "ledger",
+        "act": "de",
+        "div": id_div,
+        "jr_id": p_value
+    };
     var action = new Ajax.Request(
-            "ajax_misc.php",
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: error_box,
-                onSuccess: function (xml, txt) {
-                    if ( xml.responseText === 'NOCONX') { reconnect();return;}
-                    var popup = {'id': id_div, 'cssclass': 'inner_box'
-                        , 'html': "", 'drag': false};
-                    remove_waiting_box();
-                    add_div(popup);
-                    success_box(xml, txt);
-                    $(id_div).style.position = "absolute";
-                    $(id_div).style.top = calcy(100 + (layer * 3)) + "px";
+        "ajax_misc.php",
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: error_box,
+            onSuccess: function (xml, txt) {
+                if (xml.responseText === 'NOCONX') {
+                    reconnect();
+                    return;
                 }
+                var popup = {
+                    'id': id_div, 'cssclass': 'inner_box'
+                    , 'html': "", 'drag': false
+                };
+                remove_waiting_box();
+                add_div(popup);
+                success_box(xml, txt);
+                $(id_div).style.position = "absolute";
+                $(id_div).style.top = calcy(100 + (layer * 3)) + "px";
             }
+        }
     );
 }
 
@@ -1069,27 +1075,29 @@ function modifyOperation(p_value, dossier)
  * \param p_value jrn.jr_id
  */
 
-function viewOperation(p_value, p_dossier)
-{
+function viewOperation(p_value, p_dossier) {
     modifyOperation(p_value, p_dossier)
 }
-function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2)
-{
-    var querystring = { "gDossier" :  p_dossier ,
-        "op":"ledger",
-        "act":"rmr",
-        "div" : p_div ,
-        "jr_id" : p_jr_id,
-        "jr_id2" : p_jr_id2};
+
+function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2) {
+    var querystring = {
+        "gDossier": p_dossier,
+        "op": "ledger",
+        "act": "rmr",
+        "div": p_div,
+        "jr_id": p_jr_id,
+        "jr_id2": p_jr_id2
+    };
     var action = new Ajax.Request('ajax_misc.php',
-            {
-                method: 'get',
-                parameters: querystring,
-                onFailure: null,
-                onSuccess: null
-            }
+        {
+            method: 'get',
+            parameters: querystring,
+            onFailure: null,
+            onSuccess: null
+        }
     );
 }
+
 /**
  * this function is called before the querystring is send to the
  * fid2.php, add a filter based on the ledger 'p_jrn'
@@ -1097,60 +1105,50 @@ function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2)
  *@param queryString is the queryString to modify
  *@see ICard::input
  */
-function filter_card(obj, queryString)
-{
+function filter_card(obj, queryString) {
     jrn = $('p_jrn').value;
-    if (jrn == -1)
-    {
+    if (jrn == -1) {
         type = $('ledger_type').value;
         queryString = queryString + '&type=' + type;
-    }
-    else
-    {
+    } else {
         queryString = queryString + '&j=' + jrn;
     }
     return queryString;
 }
+
 /**
  * to display the lettering for the operation, call
  * ajax function
  *@param obj object attribut :  gDossier,j_id,obj_type
  */
-function dsp_letter(obj)
-{
-    try
-    {
+function dsp_letter(obj) {
+    try {
         //var queryString = 'gDossier=' + obj.gDossier + '&j_id=' + obj.j_id + 
'&op=dl' + '&ot=' + obj.obj_type+'&start='+obj.start;
-        
+
         var action = new Ajax.Request(
-                "ajax_misc.php",
-                {
-                    method: 'get',
-                    parameters: obj,
-                    onFailure: error_dsp_letter,
-                    onSuccess: success_dsp_letter
-                }
+            "ajax_misc.php",
+            {
+                method: 'get',
+                parameters: obj,
+                onFailure: error_dsp_letter,
+                onSuccess: success_dsp_letter
+            }
         );
         g('search').style.display = 'none';
         g('list').style.display = 'none';
         $('detail').innerHTML = loading();
         g('detail').style.display = 'block';
-    }
-    catch (e)
-    {
+    } catch (e) {
         alert_box('dsp_letter failed  ' + e.message);
     }
 }
 
-function success_dsp_letter(req)
-{
-    try
-    {
+function success_dsp_letter(req) {
+    try {
         var answer = req.responseXML;
         var a = answer.getElementsByTagName('code');
         var html = answer.getElementsByTagName('value');
-        if (a.length == 0)
-        {
+        if (a.length == 0) {
             var rec = req.responseText;
             alert_box('erreur :' + rec);
         }
@@ -1158,30 +1156,23 @@ function success_dsp_letter(req)
         var code_html = getNodeText(html[0]);
         code_html = unescape_xml(code_html);
         $('detail').innerHTML = code_html;
-    }
-    catch (e)
-    {
+    } catch (e) {
         alert_box(e.message);
     }
-    try
-    {
+    try {
         code_html.evalScripts();
-    }
-    catch (e)
-    {
-        alert_box("DSPLETTER:"+content[48] + e.message);
+    } catch (e) {
+        alert_box("DSPLETTER:" + content[48] + e.message);
     }
 
 }
-function error_dsp_letter(req)
-{
-    alert_box("DSPLETTER:"+content[48]);
+
+function error_dsp_letter(req) {
+    alert_box("DSPLETTER:" + content[48]);
 }
 
-function search_letter(obj)
-{
-    try
-    {
+function search_letter(obj) {
+    try {
         var str_query = '';
         if (obj.elements['gDossier'])
             str_query = 'gDossier=' + obj.elements['gDossier'].value;
@@ -1204,127 +1195,122 @@ function search_letter(obj)
 
 
         var action = new Ajax.Request(
-                "ajax_misc.php",
-                {
-                    method: 'get',
-                    parameters: str_query,
-                    onFailure: error_dsp_letter,
-                    onSuccess: success_dsp_letter
-                }
+            "ajax_misc.php",
+            {
+                method: 'get',
+                parameters: str_query,
+                onFailure: error_dsp_letter,
+                onSuccess: success_dsp_letter
+            }
         );
         $('list').hide();
         $('search').hide();
         $('detail').innerHTML = loading();
         $('detail').show();
-    }
-    catch (e)
-    {
+    } catch (e) {
         alert_box('search_letter  ' + e.message);
     }
 }
+
 /**
  * save an operation in ajax, it concerns only the
  * comment, the pj and the rapt
  * the form elements are access by their name
  *@param obj form
  */
-function op_save(obj)
-{
+function op_save(obj) {
     try {
         var queryString = $(obj).serialize(true);
-        queryString ["gDossier"]= obj.gDossier.value;
+        queryString ["gDossier"] = obj.gDossier.value;
         var rapt2 = "rapt" + obj.whatdiv.value;
-        queryString ["rapt"] =   g(rapt2).value;
+        queryString ["rapt"] = g(rapt2).value;
         queryString  ["jr_id"] = obj.jr_id.value;
-        var jr_id=obj.jr_id.value;
-        queryString ["div"]= obj.whatdiv.value;
-        var divid=obj.whatdiv.value;
-        queryString ["act"]="save";
-        queryString ["op"]="ledger";
-        
+        var jr_id = obj.jr_id.value;
+        queryString ["div"] = obj.whatdiv.value;
+        var divid = obj.whatdiv.value;
+        queryString ["act"] = "save";
+        queryString ["op"] = "ledger";
+
         waiting_box();
         /*
          * Operation detail is in a new window
          */
-        if (g('inpopup'))
-        {
+        if (g('inpopup')) {
             var action = new Ajax.Request('ajax_misc.php',
-                    {
-                        method: 'post',
-                        parameters: queryString,
-                        onFailure: null,
-                        onSuccess: function (req){
-                            remove_waiting_box();
-                            var answer=req.getElementsByTagName('code');
-                            if (answer[0] !=='OK') {
-                                console.error("D2. op_save")
-                                smoke.alert(req.responseText);
-                            }
+                {
+                    method: 'post',
+                    parameters: queryString,
+                    onFailure: null,
+                    onSuccess: function (req) {
+                        remove_waiting_box();
+                        var answer = req.getElementsByTagName('code');
+                        if (answer[0] !== 'OK') {
+                            console.error("D2. op_save")
+                            smoke.alert(req.responseText);
                         }
                     }
+                }
             );
             // window.close();
-        }
-        else
-        {
+        } else {
             /*
              *Operation is in a modal box 
              */
             var action = new Ajax.Request('ajax_misc.php',
-                    {
-                        method: 'post',
-                        parameters: queryString,
-                        onFailure: null,
-                        onSuccess: function(req,json) {
-                            
-                             
-                            if (req.responseXML == null ){
-                                 smoke.alert(req.responseText);
-                             }
-                            new Ajax.Request('ajax_misc.php', {
-                                parameters:{'gDossier':obj.gDossier.value,
-                                         'act':'de',
-                                         'op':'ledger',
-                                         'jr_id' :  jr_id,
-                                         'div' :  divid},
-                                onSuccess:function(xml) {
-                                    try {
-                                        var answer=xml.responseXML;
-                                        var html = 
answer.getElementsByTagName('code');
-                                        
$(divid).innerHTML=unescape(getNodeText(html[0]));
-                                         $(divid).innerHTML.evalScripts();
-                                        remove_waiting_box();
-                                        }  catch (e) {
-                                            console.error("D1. op_save")
-                                            alert_box("1038"+e.message)
-                                        } 
-                                    }
-                             });
-                            
+                {
+                    method: 'post',
+                    parameters: queryString,
+                    onFailure: null,
+                    onSuccess: function (req, json) {
+
+
+                        if (req.responseXML == null) {
+                            smoke.alert(req.responseText);
                         }
-                    });
+                        new Ajax.Request('ajax_misc.php', {
+                            parameters: {
+                                'gDossier': obj.gDossier.value,
+                                'act': 'de',
+                                'op': 'ledger',
+                                'jr_id': jr_id,
+                                'div': divid
+                            },
+                            onSuccess: function (xml) {
+                                try {
+                                    var answer = xml.responseXML;
+                                    var html = 
answer.getElementsByTagName('code');
+                                    $(divid).innerHTML = 
unescape(getNodeText(html[0]));
+                                    $(divid).innerHTML.evalScripts();
+                                    remove_waiting_box();
+                                } catch (e) {
+                                    console.error("D1. op_save")
+                                    alert_box("1038" + e.message)
+                                }
+                            }
+                        });
+
+                    }
+                });
         }
         return false;
-    } catch (e)
-    {
+    } catch (e) {
         console.error("F1. op_save")
         alert_box(e.message);
     }
 }
-function  get_history_account(ctl, dossier) {
-    if ($(ctl).value != '')
-    {
+
+function get_history_account(ctl, dossier) {
+    if ($(ctl).value != '') {
         view_history_account($(ctl).value, dossier);
     }
 }
+
 var previous = [];
-var let_previous="";
-function show_reconcile(p_div, p_let)
-{
-    try
-    {
-        if (previous.length != 0 || p_let == let_previous )
-        {
+var let_previous = "";
+
+function show_reconcile(p_div, p_let) {
+    try {
+        if (previous.length != 0 || p_let == let_previous) {
             var count_elt = previous.length;
             var i = 0;
             for (i = 0; i < count_elt; i++) {
@@ -1335,8 +1321,8 @@ function show_reconcile(p_div, p_let)
         }
         var name = 'tr_' + p_let + '_' + p_div;
         var elt = document.getElementsByName(name);
-        if ( p_let != let_previous )  {
-            
+        if (p_let != let_previous) {
+
             previous = elt;
             var count_elt = elt.length;
             var i = 0;
@@ -1346,24 +1332,22 @@ function show_reconcile(p_div, p_let)
                 elt[i].style.fontWeight = 'bolder';
 
             }
-            let_previous=p_let;
-        }
-        else {
-                let_previous="";
+            let_previous = p_let;
+        } else {
+            let_previous = "";
         }
 
-    } catch (e)
-    {
+    } catch (e) {
         alert_box(e.message);
     }
 
 
 }
+
 /**
  *  add a line in the form for the purchase ledger
  */
-function gestion_add_row()
-{
+function gestion_add_row() {
     try {
         style = 'class="input_text"';
         var mytable = g("art").tBodies[0];
@@ -1372,8 +1356,7 @@ function gestion_add_row()
         var nCell = mytable.rows[1].cells.length;
         var row = mytable.insertRow(line);
         var nb = g("nb_item");
-        for (var e = 0; e < nCell; e++)
-        {
+        for (var e = 0; e < nCell; e++) {
             var newCell = row.insertCell(e);
             var tt = ofirstRow.cells[e].innerHTML;
             var new_tt = tt.replace(/march0/g, "march" + nb.value);
@@ -1407,97 +1390,109 @@ function gestion_add_row()
     }
 
 }
-function document_remove(p_dossier,p_div,p_jrid)
-{
-    smoke.confirm(content[50], function (e) 
-    {
+
+function document_remove(p_dossier, p_div, p_jrid) {
+    smoke.confirm(content[50], function (e) {
         if (e) {
             new Ajax.Request('ajax_misc.php',
-            {
-                
parameters:{"op":"ledger","gDossier":p_dossier,"div":p_div,"p_jrid":p_jrid,'act':'rmf'},
-                onSuccess : function(x) {
-                    $('receipt'+p_div).innerHTML=x.responseText;
-                }
-            })
+                {
+                    parameters: {"op": "ledger", "gDossier": p_dossier, "div": 
p_div, "p_jrid": p_jrid, 'act': 'rmf'},
+                    onSuccess: function (x) {
+                        $('receipt' + p_div).innerHTML = x.responseText;
+                    }
+                })
         }
     });
 }
+
 /***
  *  receive an object and display a list of filter + form to save one
  * fill up the span (id : {div}search_filter_span) with the name of the 
selected filter
- * Object = '{'div':'','type':'ALL','all_type':1,'dossier':'10104'}' 
+ * Object = '{'div':'','type':'ALL','all_type':1,'dossier':'10104'}'
  * @see Acc_Ledger_Search
  */
 function manage_search_filter(p_obj) {
     waiting_box();
     new Ajax.Request("ajax_misc.php", {
-       method:'get',
-       
parameters:{"op":"display_search_filter","gDossier":p_obj.dossier,"div":p_obj.div,"ledger_type":p_obj.ledger_type,"all_type":p_obj.all_type},
-       onSuccess:function(req) {
+        method: 'get',
+        parameters: {
+            "op": "display_search_filter",
+            "gDossier": p_obj.dossier,
+            "div": p_obj.div,
+            "ledger_type": p_obj.ledger_type,
+            "all_type": p_obj.all_type
+        },
+        onSuccess: function (req) {
             remove_waiting_box();
-            var x=posX;
-            var y=calcy(200)
-            
create_div({'id':'boxfilter'+p_obj.div,'cssclass':'inner_box','html':req.responseText,'style':'top:'+y+'px;left:'+x+'px;position:absolute;width:400px',drag:1});
-            $('boxfilter'+p_obj.div).show();
-       }
+            var x = posX;
+            var y = calcy(200)
+            create_div({
+                'id': 'boxfilter' + p_obj.div,
+                'cssclass': 'inner_box',
+                'html': req.responseText,
+                'style': 'top:' + y + 'px;left:' + x + 
'px;position:absolute;width:400px',
+                drag: 1
+            });
+            $('boxfilter' + p_obj.div).show();
+        }
     });
 }
 
 /**
  * Send data from the form and record a new filter , the ajax answer is a json 
object
  * with the attribute filter_name,filter_id,status,message
- * 
+ *
  * @param p_div prefix id of all concerned DOM Element
- * @param p_dossier 
+ * @param p_dossier
  * @see Acc_Ledger_Search
  */
-function save_filter(p_div,p_dossier) {
-    var elt=['ledger_type','nb_jrn','date_start','date_end',
-        
'date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting',
-        'operation_filter','tag_option','p_currency_code','tva_id_search'];
-    var eltValue={};
-    var i =0;
-    eltValue['gDossier']=p_dossier;
-    eltValue['op']="save_filter";
-    eltValue['div']=p_div;
-    eltValue['filter_name']=$(p_div+"filter_new").value;
+function save_filter(p_div, p_dossier) {
+    var elt = ['ledger_type', 'nb_jrn', 'date_start', 'date_end',
+        'date_paid_start', 'date_paid_end', 'desc', 'amount_min', 
'amount_max', 'qcode', 'accounting',
+        'operation_filter', 'tag_option', 'p_currency_code', 'tva_id_search'];
+    var eltValue = {};
+    var i = 0;
+    eltValue['gDossier'] = p_dossier;
+    eltValue['op'] = "save_filter";
+    eltValue['div'] = p_div;
+    eltValue['filter_name'] = $(p_div + "filter_new").value;
     // Get all elt from the form
-    for ( var i = 0 ; i < elt.length;i++) {
-        var idx=elt[i];
-        eltValue[idx]=$(p_div+elt[i]).value;
-   
+    for (var i = 0; i < elt.length; i++) {
+        var idx = elt[i];
+        eltValue[idx] = $(p_div + elt[i]).value;
+
     }
-    if (eltValue['amount_min']=="") eltValue["amount_min"]=0;
-    if (eltValue['amount_max']=="") eltValue["amount_max"]=0;
-    
+    if (eltValue['amount_min'] == "") eltValue["amount_min"] = 0;
+    if (eltValue['amount_max'] == "") eltValue["amount_max"] = 0;
+
     //ledger's list r_jrn
     if (eltValue['nb_jrn'] > 0) {
-        eltValue['r_jrn']=[];
-        for (i=0;i<eltValue['nb_jrn'];i++) {
-            var idx=p_div+'r_jrn['+i+']';
-            eltValue['r_jrn'+i]=$(idx).value
-   
+        eltValue['r_jrn'] = [];
+        for (i = 0; i < eltValue['nb_jrn']; i++) {
+            var idx = p_div + 'r_jrn[' + i + ']';
+            eltValue['r_jrn' + i] = $(idx).value
+
         }
     }
-      //ledger's tags
-    var aTag=Array.from(document.getElementsByName(p_div+"tag[]"));
-    eltValue["tag[]"]=[];
-    for (i=0 ; i < aTag.length;i++) {
-            eltValue["tag[]"][i]=aTag[i].value;
+    //ledger's tags
+    var aTag = Array.from(document.getElementsByName(p_div + "tag[]"));
+    eltValue["tag[]"] = [];
+    for (i = 0; i < aTag.length; i++) {
+        eltValue["tag[]"][i] = aTag[i].value;
     }
     new Ajax.Request('ajax_misc.php', {
-        method:"POST",
-        parameters:eltValue,
-        onSuccess:function (req) {
+        method: "POST",
+        parameters: eltValue,
+        onSuccess: function (req) {
             try {
-                var answer=req.responseJSON;
-                if ( answer.status == 'OK') {
+                var answer = req.responseJSON;
+                if (answer.status == 'OK') {
                     /*Add the new list to the selection */
-                    var new_item=document.createElement('li');
-                    new_item.innerHTML=answer.filter_name;
-                    
new_item.setAttribute("id","manageli"+p_div+"_"+answer.filter_id);
-                    $('manage'+p_div).appendChild(new_item);
-                    $(p_div+"filter_new").value="";
+                    var new_item = document.createElement('li');
+                    new_item.innerHTML = answer.filter_name;
+                    new_item.setAttribute("id", "manageli" + p_div + "_" + 
answer.filter_id);
+                    $('manage' + p_div).appendChild(new_item);
+                    $(p_div + "filter_new").value = "";
                 } else {
                     throw answer.message;
                 }
@@ -1507,154 +1502,367 @@ function save_filter(p_div,p_dossier) {
         }
     });
 }
+
 /**
  * Load a search filter  and fill up the form search
  * @param p_div prefix id of all concerned DOM Element
- * @param p_dossier 
+ * @param p_dossier
  * @param p_filter_id filter id (SQL user_filter.id)
  * @see Acc_Ledger_Search
  */
-function load_filter(p_div,p_dossier,p_filter_id) {
-    new Ajax.Request('ajax_misc.php',{
-       method:"get",
-       
parameters:{"gDossier":p_dossier,"div":p_div,"op":"load_filter","filter_id":p_filter_id},
-       onSuccess:function (req) {
-           try {
-                var answer=req.responseJSON;    
-                var 
elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end',
-                    
'desc','amount_min','amount_max','qcode','accounting','operation_filter','tag_option'
-                    ,'p_currency_code','tva_id_search'];
-                for (var i=0;i<elt.length;i++) {
-                    var idx=elt[i];
-                    $(p_div+idx).value=answer[elt[i]];
+function load_filter(p_div, p_dossier, p_filter_id) {
+    new Ajax.Request('ajax_misc.php', {
+        method: "get",
+        parameters: {"gDossier": p_dossier, "div": p_div, "op": "load_filter", 
"filter_id": p_filter_id},
+        onSuccess: function (req) {
+            try {
+                var answer = req.responseJSON;
+                var elt = ['ledger_type', 'date_start', 'date_end', 
'date_paid_start', 'date_paid_end',
+                    'desc', 'amount_min', 'amount_max', 'qcode', 'accounting', 
'operation_filter', 'tag_option'
+                    , 'p_currency_code', 'tva_id_search'];
+                for (var i = 0; i < elt.length; i++) {
+                    var idx = elt[i];
+                    $(p_div + idx).value = answer[elt[i]];
                 }
-               // fillup the r_jrn array
-               var eltLedgerId=$("ledger_id"+p_div);
-               eltLedgerId.innerHTML="";
-               var eltHidden=document.createElement("input");
-               eltHidden.setAttribute("name",p_div+"nb_jrn");
-               eltHidden.setAttribute("type","hidden");
-               eltHidden.setAttribute("id",p_div+"nb_jrn");
-               eltHidden.setAttribute("value",answer.nb_jrn);
-               eltLedgerId.appendChild(eltHidden);  
-               
-               for ( var i=0;i < answer.nb_jrn;i++) {
-                   // create hidden element and add them into eltLedgerId
-                   var eltHidden=document.createElement("input");
-                   
-                   eltHidden.setAttribute("name",p_div+"r_jrn["+i+"]");
-                   eltHidden.setAttribute("type","hidden");
-                   eltHidden.setAttribute("id",p_div+"r_jrn["+i+"]");
-                   eltHidden.setAttribute("value",answer.r_jrn[i]);
-                   eltLedgerId.appendChild(eltHidden);
-               }
-               new Ajax.Request("ajax_misc.php",{
-                   method:"get",
-                   
parameters:{"gDossier":p_dossier,"div":p_div,"op":"display_filter_tag","filter_id":p_filter_id,
-                   uf_tag:answer.uf_tag},
-                   onSuccess:function (req) {
-                       $(p_div+'tag_choose_td').update(req.responseText);
-                   }
-               })
-               
-               
-           } catch (e) {
-              smoke.alert(e.message);
-           }
-           
-       }
+                // fillup the r_jrn array
+                var eltLedgerId = $("ledger_id" + p_div);
+                eltLedgerId.innerHTML = "";
+                var eltHidden = document.createElement("input");
+                eltHidden.setAttribute("name", p_div + "nb_jrn");
+                eltHidden.setAttribute("type", "hidden");
+                eltHidden.setAttribute("id", p_div + "nb_jrn");
+                eltHidden.setAttribute("value", answer.nb_jrn);
+                eltLedgerId.appendChild(eltHidden);
+
+                for (var i = 0; i < answer.nb_jrn; i++) {
+                    // create hidden element and add them into eltLedgerId
+                    var eltHidden = document.createElement("input");
+
+                    eltHidden.setAttribute("name", p_div + "r_jrn[" + i + "]");
+                    eltHidden.setAttribute("type", "hidden");
+                    eltHidden.setAttribute("id", p_div + "r_jrn[" + i + "]");
+                    eltHidden.setAttribute("value", answer.r_jrn[i]);
+                    eltLedgerId.appendChild(eltHidden);
+                }
+                new Ajax.Request("ajax_misc.php", {
+                    method: "get",
+                    parameters: {
+                        "gDossier": p_dossier, "div": p_div, "op": 
"display_filter_tag", "filter_id": p_filter_id,
+                        uf_tag: answer.uf_tag
+                    },
+                    onSuccess: function (req) {
+                        $(p_div + 'tag_choose_td').update(req.responseText);
+                    }
+                })
+
+
+            } catch (e) {
+                smoke.alert(e.message);
+            }
+
+        }
     });
 }
+
 /**
  *  delete a saved search filter  from the db, it is limited to the current
  * user
  * @parameter p_div
-identification des elements LI manageli{div}_{filter_id}
-identification element UL manage{div}
-@parameter p_filter_id SQL user_filter.id
-*/
-
-function delete_filter (p_div,p_dossier,p_filter_id) {
-    new Ajax.Request("ajax_misc.php",{
-        
parameters:{"gDossier":p_dossier,"div":p_div,"filter_id":p_filter_id,'op':"delete_search_operation"},
-        method:"POST",
-        onSuccess:function (req) {
+ identification des elements LI manageli{div}_{filter_id}
+ identification element UL manage{div}
+ @parameter p_filter_id SQL user_filter.id
+ */
+
+function delete_filter(p_div, p_dossier, p_filter_id) {
+    new Ajax.Request("ajax_misc.php", {
+        parameters: {"gDossier": p_dossier, "div": p_div, "filter_id": 
p_filter_id, 'op': "delete_search_operation"},
+        method: "POST",
+        onSuccess: function (req) {
             try {
-            var answer=req.evalJSON;
-           
-            var child=$("manageli"+p_div+"_"+p_filter_id);
-                if ( child )  {$("manage"+p_div).removeChild(child); }
-            }catch (e) {
+                var answer = req.evalJSON;
+
+                var child = $("manageli" + p_div + "_" + p_filter_id);
+                if (child) {
+                    $("manage" + p_div).removeChild(child);
+                }
+            } catch (e) {
                 console.log(e.message)
             }
-            
+
         }
     })
-    
-}     
+
+}
+
 /**
  * Reset the search_form and reinitialize all the input but ledger_type
  * @param p_div prefix for DOM Element
  */
 function reset_filter(p_div) {
-  // clean all the input fields but ledger_type remains
-  var 
elt=['date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting','tva_id_search'];
-                for (var i=0;i<elt.length;i++) {
-                    var idx=elt[i];
-                    $(p_div+idx).value="";
-                }
-  if ( $(p_div+"date_start_hidden")) {
-      $(p_div+"date_start").value=$(p_div+"date_start_hidden").value;
-  }
-  if ( $(p_div+"date_end_hidden")) {
-      $(p_div+"date_end").value=$(p_div+"date_end_hidden").value;
-  }
-  // clean all the selected ledger
-   var eltLedgerId=$("ledger_id"+p_div);
-               eltLedgerId.innerHTML="";
-               var eltHidden=document.createElement("input");
-               eltHidden.setAttribute("name",p_div+"nb_jrn");
-               eltHidden.setAttribute("type","hidden");
-               eltHidden.setAttribute("id",p_div+"nb_jrn");
-               eltHidden.setAttribute("value",0);
-               eltLedgerId.appendChild(eltHidden);
-  
-  // By default , unpaid is uncked
-   $(p_div+"operation_filter").value="all";
+    // clean all the input fields but ledger_type remains
+    var elt = ['date_start', 'date_end', 'date_paid_start', 'date_paid_end', 
'desc', 'amount_min', 'amount_max', 'qcode', 'accounting', 'tva_id_search'];
+    for (var i = 0; i < elt.length; i++) {
+        var idx = elt[i];
+        $(p_div + idx).value = "";
+    }
+    if ($(p_div + "date_start_hidden")) {
+        $(p_div + "date_start").value = $(p_div + "date_start_hidden").value;
+    }
+    if ($(p_div + "date_end_hidden")) {
+        $(p_div + "date_end").value = $(p_div + "date_end_hidden").value;
+    }
+    // clean all the selected ledger
+    var eltLedgerId = $("ledger_id" + p_div);
+    eltLedgerId.innerHTML = "";
+    var eltHidden = document.createElement("input");
+    eltHidden.setAttribute("name", p_div + "nb_jrn");
+    eltHidden.setAttribute("type", "hidden");
+    eltHidden.setAttribute("id", p_div + "nb_jrn");
+    eltHidden.setAttribute("value", 0);
+    eltLedgerId.appendChild(eltHidden);
+
+    // By default , unpaid is uncked
+    $(p_div + "operation_filter").value = "all";
 }
 
 /**
  * propose to duplicate an operation
  */
-function duplicate_operation(p_dossier,p_jr_id) {
+function duplicate_operation(p_dossier, p_jr_id) {
     waiting_box();
-    var 
duplicate_div=create_div({id:"duplicate_operation_div",cssclass:"inner_box"});
-    
+    var duplicate_div = create_div({id: "duplicate_operation_div", cssclass: 
"inner_box"});
+
     new Ajax.Request("ajax_misc.php", {
-                            parameters : {
-                                "op":"ledger",
-                                "gDossier":p_dossier,
-                                "jr_id":p_jr_id,
-                                "act":"duplicateop",
-                                "div":"duplicate_operation_div"
-                            },
-                            onSuccess:function(req) {
-                                remove_waiting_box();
-                                var xml=req.responseXML;
-                                
-                                if ( 
xml.getElementsByTagName("ctl").length==0) {
-                                    console.log("erreur"+req.responseText);
-                                }
-                                 add_div(duplicate_div);
-                                
-                                
duplicate_div.setStyle({"position":"fixed","top":"15%","z-index":"999",
-                                    "min-width":"30rem",
-                                    "left":"30%",
-                                    "width":"40%"});
-                                
duplicate_div.innerHTML=getNodeText(xml.getElementsByTagName("code")[0]);
-                                duplicate_div.setStyle({display:"block"});
+            parameters: {
+                "op": "ledger",
+                "gDossier": p_dossier,
+                "jr_id": p_jr_id,
+                "act": "duplicateop",
+                "div": "duplicate_operation_div"
+            },
+            onSuccess: function (req) {
+                remove_waiting_box();
+                var xml = req.responseXML;
+
+                if (xml.getElementsByTagName("ctl").length == 0) {
+                    console.log("erreur" + req.responseText);
+                }
+                add_div(duplicate_div);
+
+                duplicate_div.setStyle({
+                    "position": "fixed", "top": "15%", "z-index": "999",
+                    "min-width": "30rem",
+                    "left": "30%",
+                    "width": "40%"
+                });
+                duplicate_div.innerHTML = 
getNodeText(xml.getElementsByTagName("code")[0]);
+                duplicate_div.setStyle({display: "block"});
+            }
+        }
+    );
+}
+
+/**
+ * For operation_exercice let update periode when changing folder
+ * @type {{update_periode: operation_exercice.update_periode}}
+ */
+var operation_exercice = {
+    update_periode: function (dossier_id) {
+        try {
+            waiting_box();
+            var queryString = {
+                op: 'operation_exercice+update_periode',
+                folder: $('dos_id').value,
+                gDossier: dossier_id
+            };
+            var action = new Ajax.Request(
+                "ajax_misc.php",
+                {
+                    method: 'GET',
+                    parameters: queryString,
+                    onFailure: ajax_misc_failure,
+                    onSuccess: function (req) {
+                        remove_waiting_box();
+                        if (req.responseText == 'NOCONX') {
+                            reconnect();
+                            return;
+                        }
+
+                        $("select_exercice_id").update(req.responseText);
+
+                    }
+                }
+            );
+        } catch (e) {
+            console.error('oe-update_periode', e.message);
+        }
+    },
+    modify_row: function (row_operation_exercice,oe_id) {
+        try {
+            var dgbox = "operation_exercice_bx";
+            waiting_box();
+            removeDiv(dgbox);
+            // For form , most of the parameters are in the FORM
+            // method is then POST
+            //var queryString=$(p_form_id).serialize(true);
+            console.debug(row_operation_exercice);
+            var queryString = {
+                op: 'operation_exercice+modify_row',
+                oe_id : oe_id,
+                row_id: row_operation_exercice,
+                gDossier: $('gDossier').value
+            };
+            var action = new Ajax.Request(
+                "ajax_misc.php",
+                {
+                    method: 'POST',
+                    parameters: queryString,
+                    onFailure: ajax_misc_failure,
+                    onSuccess: function (req) {
+                        remove_waiting_box();
+                        if (req.responseText == 'NOCONX') {
+                            reconnect();
+                            return;
+                        }
+                        console.debug(req.responseText)
+                        var y = calcy(15);
+                        var div_style = "position:absolute;" + ";top:" + y + 
"px";
+                        add_div({id: dgbox, cssclass: 'inner_box', html: 
loading(), style: div_style, drag: true});
+                        $(dgbox).update(req.responseText);
+                    }
+                }
+            );
+        } catch (e) {
+            console.error('oe-modify_row', e.message);
+        }
+    },
+    /**
+     * Save data from modify_row
+     */
+    save_row: function () {
+        try {
+            var dgbox = "operation_exercice_bx";
+            waiting_box();
+
+            // For form , most of the parameters are in the FORM
+            // method is then POST
+            //var queryString=$(p_form_id).serialize(true);
+
+            var queryString = 
$('operation_exercice_input_row_frm').serialize(true);
+
+            var action = new Ajax.Request(
+                "ajax_misc.php",
+                {
+                    method: 'POST',
+                    parameters: queryString,
+                    onFailure: ajax_misc_failure,
+                    onSuccess: function (req) {
+                        remove_waiting_box();
+                        if (req.responseText == 'NOCONX') {
+                            reconnect();
+                            return;
+                        }
+
+                        if (req.responseJSON['status'] == "OK") {
+                            rowid=req.responseJSON['row_id'];
+                            if (queryString['row_id'] == -1) {
+                                var row = new Element("tr");
+                                row.id="oe_"+rowid;
+                                row.setAttribute("oed_id",rowid);
+                                
row.setAttribute("oe_id",req.responseJSON['oe_id']);
+                                row.update(req.responseJSON['content']);
+                                $("operation_exercice_tb").appendChild(row);
+                                row.addEventListener("click",function(event) 
{operation_exercice.click_modify_row(row)})
+
+                            } else{
+                                
$("oe_"+rowid).update(req.responseJSON['content']);
                             }
+                            new Effect.Highlight("oe_" + 
req.responseJSON['row_id'], {
+                                startcolor: '#FAD4D4',
+                                endcolor: '#F78082'
+                            });
+                            operation_exercice.display_total(rowid)
+                            $(dgbox).remove();
+                            return;
+
                         }
-                    
-                    );
+                        $(dgbox).update(req.responseText);
+
+                    }
+                }
+            );
+        } catch (e) {
+            console.error('oe-save_row' + e.message);
+        }
+    },
+    /**
+     * display the balance
+     */
+    display_total: function (row_id) {
+        try {
+            var dgbox = "tot_ope_exe";
+            var queryString = {
+                op: 'operation_exercice+display_total',
+                row_id: row_id,
+                gDossier: $('gDossier').value
+            };
+            var action = new Ajax.Request(
+                "ajax_misc.php",
+                {
+                    method: 'GET',
+                    parameters: queryString,
+                    onFailure: ajax_misc_failure,
+                    onSuccess: function (req) {
+                        remove_waiting_box();
+                        if (req.responseText == 'NOCONX') {
+                            reconnect();
+                            return;
+                        }
+
+                        $(dgbox).update(req.responseText);
+
+                    }
+                }
+            );
+        } catch (e) {
+            console.error('oe-display_total' + e.message);
+        }
+    },
+    /**
+     * delete a row
+     */
+    delete_row: function (row_id) {
+        try {
+            var queryString = {
+                op: 'operation_exercice+delete_row',
+                row_id: row_id,
+                gDossier: $('gDossier').value
+            };
+            var action = new Ajax.Request(
+                "ajax_misc.php",
+                {
+                    method: 'GET',
+                    parameters: queryString,
+                    onFailure: ajax_misc_failure,
+                    onSuccess: function (req) {
+                        remove_waiting_box();
+                        if (req.responseText == 'NOCONX') {
+                            reconnect();
+                            return;
+                        }
+                        if (req.responseJSON["row_id"] != "") {
+                            
operation_exercice.display_total(req.responseJSON["row_id"])
+                        }
+                        $('oe_' + queryString['row_id']).remove();
+                        $('operation_exercice_bx').remove();
+                    }
+                }
+            );
+        } catch (e) {
+            alert_box("oe+delete_row", e.message);
+        }
+    },
+    click_modify_row: function (item) {
+        
operation_exercice.modify_row(item.getAttribute("oed_id"),item.getAttribute("oe_id"));
+    }
 }
diff --git a/include/ajax/ajax_operation_exercice.php 
b/include/ajax/ajax_operation_exercice.php
new file mode 100644
index 000000000..0b253ac3d
--- /dev/null
+++ b/include/ajax/ajax_operation_exercice.php
@@ -0,0 +1,153 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 6/01/24
+/*! 
+ * \file
+ * \brief display the possible value of exercice
+ */
+global $http, $g_user;
+if ($g_user->check_module("OPCL") == 0) throw new \Exception(EXC_FORBIDDEN);
+
+//-------------------------------------------------------------------------------------------
+// Update the periode of the selected folder
+//-------------------------------------------------------------------------------------------
+if ($op == "operation_exercice+update_periode") {
+
+    try {
+        $folder_id = $http->get("folder", "number");
+        if ($g_user->check_dossier($folder_id, true) == 'X') throw new 
\Exception(EXC_FORBIDDEN);
+
+    } catch (\Exception $e) {
+
+        return;
+    }
+
+    $conx = new Database($folder_id);
+    $periode = $conx->make_array("select distinct p_exercice,p_exercice from 
parm_periode order by p_exercice desc");
+    $sExercice = new ISelect("exercice");
+    $sExercice->id = "select_exercice_id";
+    $sExercice->value = $periode;
+    echo $sExercice->input();
+    return;
+}
+//-------------------------------------------------------------------------------------------
+// Display a detail operation_exercice to modify or add id
+//-------------------------------------------------------------------------------------------
+if ($op == "operation_exercice+modify_row") {
+    try {
+        $row_id = $http->post("row_id", "number", -1);
+        $oe_id=$http->post("oe_id","number");
+    } catch (\Exception $e) {
+        echo $e->getMessage();
+        return;
+    }
+    $operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
+    $operation_detail_sql->oe_id=$oe_id;
+  if ( $row_id == -1)  $operation_detail_sql->oed_debit='f';
+    Operation_Exercice::input_row($operation_detail_sql);
+
+    return;
+}
+//-------------------------------------------------------------------------------------------
+// save a row
+//-------------------------------------------------------------------------------------------
+if ($op == "operation_exercice+save_row") {
+    try {
+        $row_id = $http->post("row_id", "number");
+        $oe_id = $http->post("oe_id", "number");
+        $oe_poste = $http->post("oe_poste", "text");
+        $qcode = $http->post("qcode", "text");
+        $label = $http->post("label", "text");
+        $amount = $http->post("amount", "number");
+        $debit = $http->post("debit", "text", 'f');
+    } catch (\Exception $e) {
+        echo $e->getMessage();
+        return;
+    }
+    $operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, $row_id);
+
+    $operation_detail_sql->setp("oed_poste", $oe_poste)
+        ->setp("oed_qcode", $qcode)
+        ->setp("oed_label", $label)
+        ->setp("oed_amount", $amount)
+        ->setp("oe_id",$oe_id)
+        ->setp("oed_debit", $debit);
+    try {
+        $operation_detail_sql->save();
+        $data = $operation_detail_sql->to_array();
+
+        ob_start();
+        $operation_exercice = new Operation_Exercice();
+        if ($row_id == -1 ) {
+            $operation_exercice->display_row($data, true);
+        } else {
+
+            $operation_exercice->display_row($data, false);
+        }
+        $str = ob_get_contents();
+        ob_end_clean();
+
+        $answer = [];
+        $answer["status"] = "OK";
+        $answer['row_id'] = $operation_detail_sql->oed_id;
+        $answer['oe_id'] = $operation_detail_sql->oe_id;
+        $answer['content'] = $str;
+        echo json_response($answer);
+    } catch (\Exception $e) {
+        echo $e->getMessage();
+        return;
+    }
+}
+//-------------------------------------------------------------------------------------------
+// Compute the balance, we receive only the OED_ID , then we must find out 
what was the complete
+// OPERATION_EXERCICE
+//-------------------------------------------------------------------------------------------
+if ($op == "operation_exercice+display_total") {
+    try {
+        $row_id = $http->get("row_id", "number");
+        $operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, 
$row_id);
+        if ($operation_detail_sql->getp("oe_id") == "") {
+            throw new Exception("AOE-113:not existing line");
+        }
+        $operation_exercice = new 
Operation_Exercice($operation_detail_sql->oe_id);
+        $operation_exercice->display_total(false);
+
+    } catch (\Exception $e) {
+        echo $e->getMessage();
+        return;
+    }
+}
+//-------------------------------------------------------------------------------------------
+//delete a row  OPERATION_EXERCICE
+//-------------------------------------------------------------------------------------------
+if ($op == "operation_exercice+delete_row") {
+    try {
+        $row_id = $http->get("row_id", "number");
+        $operation_detail_sql = new Operation_Exercice_Detail_SQL($cn, 
$row_id);
+        $oe_id=$operation_detail_sql->oe_id;
+        $other_row=$cn->get_value("select oed_id from 
operation_exercice_detail where oe_id=$1 limit 1 ",
+        [$oe_id]);
+
+        $operation_detail_sql->delete();
+        echo json_response(array("status"=>"OK","row_id"=>$other_row));
+    } catch (\Exception $e) {
+        echo $e->getMessage();
+        return;
+    }
+}
diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index 8fe002ce2..dd6b85c2a 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1759,34 +1759,6 @@ class Acc_Ledger  extends jrn_def_sql
         return $card;
     }
 
-    /**
-     * @brief get the saldo of an exercice, used for the opening of a folder
-     * @param$p_exercice is the exercice we want
-     * \return an array
-     * index =
-     * - solde (debit > 0 ; credit < 0)
-     * - j_poste
-     * - j_qcode
-     */
-    function get_saldo_exercice($p_exercice)
-    {
-        $sql="select sum(a.montant) as solde, j_poste, j_qcode
-             from
-             (select j_id, case when j_debit='t' then j_montant
-             else j_montant * (-1) end  as montant
-             from jrnx) as a
-             join jrnx using (j_id)
-             join parm_periode on (j_tech_per = p_id )
-             where
-             p_exercice=$1
-             and j_poste::text not like '7%'
-             and j_poste::text not like '6%'
-             group by j_poste,j_qcode
-             having (sum(a.montant) != 0 ) order by 1 desc";
-        $res=$this->db->get_array($sql, array($p_exercice));
-        return $res;
-    }
-
     /**
      * @brief Check if a Dossier is using the strict mode or not
      * \return true if we are using the strict_mode
diff --git a/include/class/operation_closing.class.php 
b/include/class/operation_closing.class.php
new file mode 100644
index 000000000..b82a6bc1d
--- /dev/null
+++ b/include/class/operation_closing.class.php
@@ -0,0 +1,43 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 6/01/24
+/*! 
+ * \file
+ * \brief 
+ */
+class Operation_Closing extends Operation_Exercice
+{
+    private $signature ;
+
+    function __construct()
+    {
+        parent::__construct();
+        $this->signature='closing';
+
+    }
+    public function get_signature(): string
+    {
+        return $this->signature;
+    }
+
+    function from_request()
+    {
+
+    }
+}
\ No newline at end of file
diff --git a/include/class/operation_exercice.class.php 
b/include/class/operation_exercice.class.php
new file mode 100644
index 000000000..076463357
--- /dev/null
+++ b/include/class/operation_exercice.class.php
@@ -0,0 +1,156 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 6/01/24
+/*!
+ * \file
+ * \brief
+ */
+
+class Operation_Exercice
+{
+    protected $operation_exercice_sql;
+
+    public function __construct($p_id = -1)
+    {
+        $this->operation_exercice_sql = new 
Operation_Exercice_SQL(Dossier::connect(), $p_id);
+    }
+
+    /**
+     * @brief input the source of the data : folder, exercice, closing or 
opening operation
+     * @return void
+     */
+    public static function input_source()
+    {
+        require NOALYSS_TEMPLATE . "/operation_exercice-input_source.php";
+    }
+
+    function display_result()
+    {
+        $cn = Dossier::connect();
+        // get data
+        $a_data = $cn->get_array("
+       SELECT oed_id
+            , oe_id
+            , oed_poste
+            , oed_qcode
+            , oed_label
+            , oed_amount
+            , oed_debit
+       FROM public.operation_exercice_detail
+       where 
+           oe_id=$1
+       order by oed_debit desc,oed_poste,oed_qcode
+
+        ", [$this->operation_exercice_sql->oe_id]);
+        $aheader = array(_("Poste"), _("Fiche"), _("Libellé"), _("Montant"), 
_("Débit/Crédit"));
+        echo \HtmlInput::filter_table("operation_exercice_tb", '0,1,2,3,4', 1);
+        echo \HtmlInput::button_action(_("Ajouter une ligne"), 
sprintf("operation_exercice.modify_row('-1','%s')", 
$this->operation_exercice_sql->oe_id));
+        echo '<table class="result" id="operation_exercice_tb">';
+        foreach ($aheader as $header) echo th($header, 
'style="text-align:center"');
+        echo th("");
+
+        foreach ($a_data as $data) {
+            $this->display_row($data);
+        }
+        echo '</table>';
+        echo \HtmlInput::button_action(_("Ajouter une ligne"), 
sprintf("operation_exercice.modify_row('-1','%s')", 
$this->operation_exercice_sql->oe_id));
+        $this->display_total();
+        echo Dossier::hidden();
+        $js = <<<EOF
+(function() {
+   
$$(".op-exercice").forEach(item=>item.addEventListener("click",function(event) 
{operation_exercice.click_modify_row(item)}));
+    })();
+EOF;
+        echo create_script($js);
+    }
+
+    /**
+     * @brief display the balance (total) of the operation
+     * @param bool $with_span if yes add the span wrapper , otherwise doesn't 
add it
+     */
+    public function display_total($with_span = true)
+    {
+        $cn = Dossier::connect();
+        $sql_total = "
+     with saldo_deb_cred as
+(
+       select
+               case when oed_debit is true then oed_amount else 0-oed_amount 
end signed_amount ,
+               case when oed_debit is true then oed_amount end debit,
+               case when oed_debit is false then oed_amount end credit
+       from public.operation_exercice_detail
+       where oe_id=$1
+)
+select sum(signed_amount) delta,sum(debit) debit,sum(credit) credit from 
saldo_deb_cred
+        ";
+        $total = $cn->get_row($sql_total, 
[$this->operation_exercice_sql->oe_id]);
+        if ($with_span) {
+            echo '<span id="tot_ope_exe" style="margin-left:20%">';
+        }
+        $style = 
'style="display:inline-block;padding:1rem;margin:1rem;border:1px solid 
navy;width:20%;text-align:center;font-size:140%"';
+
+        echo span(sprintf(_("Débit   %s"), nbm($total['debit'])), $style);
+        echo span(sprintf(_("Crédit  %s"), nbm($total['credit'])), $style);
+        $s="";
+        if ($total['delta'] > 0) {
+            $s = " Solde débiteur ";
+        }
+        if ($total['delta'] < 0) {
+            $s = " Solde créditeur ";
+        }
+        echo span($s . " " . nbm($total['delta']), $style);
+        if ($with_span) {
+            echo '</span>';
+        }
+    }
+
+    /**
+     * @brief let display one row
+     * @param $data array row of operation_exercice_detail [oed_id, oe_id, 
oed_poste, oed_qcode oed_label
+     * oed_amount oed_debit]
+     * @return void
+     * @see Operation_Exercice_Detail_SQL
+     */
+    function display_row($data, $row_tr = true)
+    {
+        if ($row_tr) printf('<tr class="op-exercice even" id="oe_%s" 
oed_id="%s" oe_id="%s">', $data['oed_id'], $data['oed_id'], $data['oe_id']);
+        echo td($data['oed_poste']);
+        echo td($data['oed_qcode']);
+        echo td(h($data['oed_label']));
+        echo td(nbm($data['oed_amount']), 'class="num"');
+        echo td(($data['oed_debit'] == 'f' ? _("Crédit") : _("Débit")), 
'style="text-align:center"');
+        echo td(\Icon_Action::modify(uniqid(), 
sprintf("operation_exercice.modify_row('%s','%s')", $data['oed_id'], 
$data['oe_id'])));
+
+
+        if ($row_tr) print ('</tr >');
+    }
+
+    /**
+     * @brief input one row of operation_exercice
+     * @param $data array row of operation_exercice_detail [oed_id, oe_id, 
oed_poste, oed_qcode oed_label
+     * oed_amount oed_debit]
+     * @return void
+     * @see Operation_Exercice_Detail_SQL
+     */
+    public static function input_row(Operation_Exercice_Detail_SQL 
$operation_detail_sql)
+    {
+        require_once NOALYSS_TEMPLATE . "/operation_exercice-input_row.php";
+    }
+
+}
diff --git a/include/class/operation_opening.class.php 
b/include/class/operation_opening.class.php
new file mode 100644
index 000000000..298a2ca8d
--- /dev/null
+++ b/include/class/operation_opening.class.php
@@ -0,0 +1,146 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 6/01/24
+/*! 
+ * \file
+ * \brief 
+ */
+
+class Operation_Opening extends Operation_Exercice
+{
+    private $signature;
+    private $from_folder;
+    private $exercice;
+
+    function __construct()
+    {
+        parent::__construct();
+        $this->signature = 'opening';
+
+    }
+
+    /**
+     * @return mixed
+     */
+    public function get_from_folder()
+    {
+        return $this->from_folder;
+    }
+
+    /**
+     * @param mixed $from_folder
+     */
+    public function set_from_folder($from_folder): void
+    {
+        $this->from_folder = $from_folder;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function get_exercice()
+    {
+        return $this->exercice;
+    }
+
+    /**
+     * @param mixed $exercice
+     */
+    public function set_exercice($exercice): void
+    {
+        $this->exercice = $exercice;
+    }
+
+    public function get_signature(): string
+    {
+        return $this->signature;
+    }
+
+    function from_request()
+    {
+        $http = new HttpInput();
+        $this->exercice = $http->request("exercice", "number");
+        $this->from_folder = $http->request("dos_id", "number");
+    }
+
+    /**
+     * @brief insert data into data operation_exercice and 
operation_exercice_detail
+     * @return void
+     */
+    function insert()
+    {
+        $cn = Dossier::connect();
+        $other_dossier = new Database($this->from_folder);
+
+        $sql = "
+with total_account as (
+       select sum(a.montant) as tot_amount, j_poste, f_id
+             from
+             (select j_id, case when j_debit='t' then j_montant
+             else j_montant * (-1) end  as montant
+             from jrnx) as a
+             join jrnx using (j_id)
+             join parm_periode on (j_tech_per = p_id )
+             where
+             p_exercice=$1
+             and j_poste::text not like '7%'
+             and j_poste::text not like '6%'
+             group by j_poste,f_id
+             having (sum(a.montant) != 0 ) 
+             )
+select t1.tot_amount
+       ,t1.j_poste
+       ,(select pcm_lib from tmp_pcmn where pcm_val=t1.j_poste) as 
lib_accounting
+       ,t1.f_id
+       ,(select ad_value fd2 from fiche_detail fd2 where fd2.f_id=t1.f_id and 
fd2.ad_id=23) qcode
+,(select fd3.ad_value from fiche_detail fd3 where fd3.f_id=t1.f_id and 
fd3.ad_id=1) f_name
+,abs(t1.tot_amount) atot_amount
+,case when tot_amount <0 then 'f' else 't' end debit
+from total_account t1
+";
+        $exercice_report=$this->exercice+1;
+        $this->operation_exercice_sql->setp("oe_type", $this->signature)
+            ->setp("oe_dossier_id", $this->from_folder)
+            ->set("oe_text",_("Ecriture ouverture $exercice_report"))
+            ->setp("oe_exercice", $this->exercice);
+        try {
+            $cn->start();
+            $this->operation_exercice_sql->insert();
+            $array = $other_dossier->get_array($sql, array($this->exercice));
+            if (empty($array)) return;
+            foreach ($array as $item) {
+                $row = new Operation_Exercice_Detail_SQL($cn);
+                $row->oe_id = $this->operation_exercice_sql->oe_id;
+                $row->oed_poste = 
(empty($item['qcode']))?$item["j_poste"]:null;
+                $row->oed_qcode = $item["qcode"];
+                $row->oed_amount = $item['atot_amount'];
+                
$row->oed_label=(empty($item['qcode']))?$item['lib_accounting']:$item['f_name'];
+                $row->oed_debit = $item["debit"];
+                $row->save();
+            }
+            $cn->commit();
+
+        } catch (\Exception $e) {
+            $cn->rollback();
+            echo $e->getMessage();
+            throw $e;
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/include/constant.php b/include/constant.php
index 5ee720e1e..adcc63388 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -341,6 +341,7 @@ define('EXC_PARAM_VALUE', 1005);
 define('EXC_PARAM_TYPE', 1006);
 define('EXC_DUPLICATE', 1200);
 define('EXC_INVALID', 1400);
+define('EXC_FORBIDDEN', 1500);
 define("UNPINDG", "&#xf047;");
 define("PINDG", "&#xe809;");
 
diff --git a/include/database/operation_exercice_detail_sql.class.php 
b/include/database/operation_exercice_detail_sql.class.php
new file mode 100644
index 000000000..a05afb44b
--- /dev/null
+++ b/include/database/operation_exercice_detail_sql.class.php
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ *   This file is part of NOALYSS
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * copyright Dany WM De Bontridder($(YEAR))
+ *
+ *  $(DATE)
+ */
+
+/**
+ * @file
+ * @brief abstract of the table
+ */
+
+/**
+ * @class
+ * @brief  abstract of the table
+ */
+class Operation_Exercice_Detail_SQL extends Table_Data_SQL
+{
+
+    function __construct(DatabaseCore $p_cn, $p_id = -1)
+    {
+        $this->table = "operation_exercice_detail";
+        $this->primary_key = "oed_id";
+        /*
+         * List of columns
+         */
+        $this->name = array(
+            'oed_id' => 'oed_id'
+        , 'oe_id' => 'oe_id'
+        , 'oed_poste' => 'oed_poste'
+        , 'oed_qcode' => 'oed_qcode'
+        , 'oed_label' => 'oed_label'
+        , 'oed_amount' => 'oed_amount'
+        , 'oed_debit' => 'oed_debit'
+
+
+        );
+        /*
+         * Type of columns
+         */
+        $this->type = array(
+            'oed_id' => 'number'
+        , 'oe_id' => 'number'
+        , 'oed_poste' => 'text'
+        , 'oed_qcode' => 'text'
+        , 'oed_label' => 'text'
+        , 'oed_amount' => 'number'
+        , 'oed_debit' => 'text'
+
+        );
+
+        $this->default = array(
+            "oed_id" => "oed_id"
+        );
+
+
+
+        $this->date_format = "DD.MM.YYYY";
+        parent::__construct($p_cn, $p_id);
+    }
+
+
+}
\ No newline at end of file
diff --git a/include/database/operation_exercice_sql.class.php 
b/include/database/operation_exercice_sql.class.php
new file mode 100644
index 000000000..c295d9002
--- /dev/null
+++ b/include/database/operation_exercice_sql.class.php
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ *   This file is part of NOALYSS
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * copyright Dany WM De Bontridder($(YEAR))
+ *
+ *  $(DATE)
+ */
+
+/**
+ * @file
+ * @brief abstract of the table public.operation_exercice
+ */
+
+/**
+ * @class
+ * @brief  abstract of the table public.operation_exercice
+ */
+class Operation_Exercice_SQL extends Table_Data_SQL
+{
+
+    function __construct(DatabaseCore $p_cn, $p_id = -1)
+    {
+        $this->table = "public.operation_exercice";
+        $this->primary_key = "oe_id";
+        /*
+         * List of columns
+         */
+        $this->name = array(
+            "oe_id" => "oe_id",
+            "oe_date" => "oe_date",
+            "oe_text" => "oe_text",
+            "oe_type" => "oe_type",
+            "tech_user" => "tech_user",
+            "tech_date" => "tech_date",
+            "oe_dossier_id" => "oe_dossier_id",
+            "oe_exercice" => "oe_exercice",
+
+        );
+        /*
+         * Type of columns
+         */
+        $this->type = array(
+            "oe_id" => "number",
+            "oe_date" => "date",
+            "oe_text" => "text",
+            "oe_type" => "text",
+            "tech_user" => "text",
+            "tech_date" => "date",
+            "oe_dossier_id" => "number",
+            "oe_exercice" => "number",
+
+        );
+
+
+        $this->default = array(
+            "oe_id" => "oe_id",
+            "tech_user" => "tech_user",
+            "tech_date" => "tech_date",
+        );
+
+        $this->date_format = "DD.MM.YYYY";
+        parent::__construct($p_cn, $p_id);
+    }
+
+
+}
\ No newline at end of file
diff --git a/include/operation_exercice.inc.php 
b/include/operation_exercice.inc.php
new file mode 100644
index 000000000..40555f4b6
--- /dev/null
+++ b/include/operation_exercice.inc.php
@@ -0,0 +1,49 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 6/01/24
+/*! 
+ * \file
+ * \brief For opening or closing exercice , operation needed
+ */
+
+$http=new HttpInput();
+if ( $http->request("sa","string","") == "" )
+{
+    Operation_Exercice::input_source();
+    return;
+}
+if ( $http->request("sa") == "opening")
+{
+
+    $operation_exercice_id= $http->get("operation_exercice_id","number",-1);
+    $operation_opening=new Operation_Opening($operation_exercice_id);
+    try {
+        // take data from request
+        $operation_opening->from_request();
+        if ( $operation_exercice_id == -1 ) {
+            $operation_opening->insert();
+        }
+        // Display result
+        $operation_opening->display_result();
+
+    } catch (\Exception $e) {
+        echo $e->getMessage();
+    }
+    return;
+}
\ No newline at end of file
diff --git a/include/template/operation_exercice-input_row.php 
b/include/template/operation_exercice-input_row.php
new file mode 100644
index 000000000..0e2b94261
--- /dev/null
+++ b/include/template/operation_exercice-input_row.php
@@ -0,0 +1,114 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 7/01/24
+/*! 
+ * \file
+ * \brief input data for one row of OPERATION_EXERCICE_DETAIL, inherited data 
$operation_detail_sql
+ *
+ * \see Operation_Exercice::input_row
+ */
+Noalyss\Dbg::echo_file(__FILE__);
+
+$data = $operation_detail_sql->to_array();
+
+if (DEBUGNOALYSS > 1) echo \Noalyss\Dbg::hidden_info("data", $data);
+
+$poste = new \IPoste("oe_poste");
+$poste->value = $data['oed_poste'];
+$poste->id = 'oe_poste';
+$poste->set_attribute('gDossier', Dossier::id());
+$poste->set_attribute('jrn', 0);
+$poste->set_attribute('account', 'oe_poste');
+$label_id= uniqid('label');
+$poste->set_attribute('label',$label_id);
+
+$poste->dbl_click_history();
+
+
+$card = new \ICard("qcode");
+$card->value = $data['oed_qcode'];
+$card->set_dblclick("fill_ipopcard(this);");
+$card->set_attribute('label', "label");
+$card->set_function('fill_data');
+$card->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ',    
$card->name);
+
+$label = new IText("label", $data['oed_label']);
+$label->id=$label_id;
+$label->size = 80;
+
+$amount = new INum("amount", $data['oed_amount']);
+
+$checkbox = new ICheckBox("debit");
+
+$checkbox->value = 't';
+$checkbox->selected =($data['oed_debit'] == 't')?true:false;
+
+$checkbox->javascript='onclick="display_dcside(this)"';
+
+echo \HtmlInput::title_box("", "operation_exercice_bx");
+?>
+<div>
+    <form onsubmit="operation_exercice.save_row();return false;" 
id="operation_exercice_input_row_frm" method="POST">
+        <?php
+        echo Dossier::hidden();
+        echo HtmlInput::hidden("ac", "OPCL");
+        echo HtmlInput::hidden("row_id", $operation_detail_sql->oed_id);
+        echo HtmlInput::hidden("op", 'operation_exercice+save_row');
+        echo HtmlInput::hidden("oe_id", $operation_detail_sql->oe_id);
+        ?>
+        <div class="form-group">
+            <label for="oe_poste"><?= _("Poste") ?></label>
+            <?= $poste->input() ?>
+        </div>
+        <div class="form-group">
+            <label for="qcode"><?= _("Fiche") ?></label>
+            <?= $card->input() ?>
+            <?= $card->search() ?>
+        </div>
+        <div class="form-group">
+            <label for="oed_label"><?= _("Libellé") ?></label>
+            <?= $label->input() ?>
+        </div>
+        <div class="form-group">
+            <label for="amount"><?= _("Montant") ?></label>
+            <?= $amount->input() ?>
+
+            <?= $checkbox->input() ?>
+            <label for="debit">
+                <span id="txtdebit">
+                    <?=($data['oed_debit']=="f")?_("Crédit"):_("Débit")?>
+                </span>
+
+            </label>
+        </div>
+        <ul class="aligned-block">
+            <li>
+                <?= \HtmlInput::submit("save", _("Sauve")) ?>
+            </li>
+            <li>
+                <?= \HtmlInput::button_close("operation_exercice_bx") ?>
+            </li>
+            <li>
+                <?=\HtmlInput::button_action(_("Effacer"), 
sprintf("operation_exercice.delete_row('%s')", $data['oed_id']))?>
+            </li>
+        </ul>
+
+    </form>
+</div>
+
diff --git a/include/template/operation_exercice-input_source.php 
b/include/template/operation_exercice-input_source.php
new file mode 100644
index 000000000..35a43661b
--- /dev/null
+++ b/include/template/operation_exercice-input_source.php
@@ -0,0 +1,129 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 6/01/24
+
+/*! 
+ * \file
+ * \brief input the source of the opening / closing operation
+ */
+
+\Noalyss\Dbg::echo_file(__FILE__);
+
+global $cn;
+global $g_user;
+global $g_parameter;
+
+//-------------------------------------------------------------------------------------------
+// if DEBUG then show both , otherwise if MY_REPORT=Y shows opening otherwise 
, shows only closing
+// Show opening if report == Y or NOALYSS > 1
+//-------------------------------------------------------------------------------------------
+if ( $g_parameter->MY_REPORT=="Y" || DEBUGNOALYSS > 1) :
+?>
+<div class="content">
+
+    <div class="row">
+        <div class="col">
+            <FORM method="POST">
+
+                <div class="" id="opening_div">
+                    <h2><?= _("Ouverture") ?></h2>
+                    <div class="text-muted">
+                        <?= _("Ouverture des comptes pour l'exercice qui 
débute pour les comptes 0 à 5.") ?>
+                        <?= ("Choisissez l'exercice clôturé (exercice N-1) du 
dossier à reporter pour les a-nouveaux (exercice N)") ?>
+                    </div>
+                    <?php
+                    
/**************************************************************************
+                     * Needed information :
+                     *        -  Date of the first day of exercice
+                     *        -  Folder
+                     *        -  Exercice N-1
+                     
*************************************************************************/
+                    $date = new IDate("date_opening");
+                    $avail = $g_user->get_available_folder();
+
+
+                    $array = array();
+                    $i = 0;
+                    foreach ($avail as $r) {
+                        $array[$i]['value'] = $r['dos_id'];
+                        $array[$i]['label'] = sprintf("%s %s 
(%s)",$r['dos_id'],$r['dos_name'],substr($r['dos_description']??"",0,50));
+                        $i++;
+                    }
+                    $sAvail = new ISelect('dos_id');
+                    $sAvail->id = "dos_id";
+                    $sAvail->selected = Dossier::id();
+                    $sAvail->value = $array;
+                    $sAvail->javascript = 
sprintf('onchange="operation_exercice.update_periode(%d)"',Dossier::id());
+
+                    $exercice = $cn->make_array("select distinct 
p_exercice,p_exercice_label from parm_periode order by p_exercice desc");
+                    $sExercice = new ISelect("exercice");
+                    $sExercice->id = "select_exercice_id";
+                    $sExercice->value = $exercice;
+
+                    echo 
HtmlInput::array_to_hidden(["gDossier","ac"],$_REQUEST);
+                    echo HtmlInput::hidden("sa","opening");
+                    ?>
+                    <div class="form-group">
+                        <label for="dos_id"><?= _("Depuis le dossier") 
?></label>
+                        <?= $sAvail->input() ?>
+                    </div>
+                    <div class="form-group">
+                        <label for="dos_id"><?= _("Exercice N-1") ?></label>
+                        <?= $sExercice->input() ?>
+                    </div>
+                    <?= \HtmlInput::submit("ope_submit", _("Valider")) ?>
+                </div>
+            </FORM>
+<?php
+endif;
+//-------------------------------------------------------------------------------------------
+// Show closing if report == N or NOALYSS > 1
+//-------------------------------------------------------------------------------------------
+
+if ( $g_parameter->MY_REPORT=="N" || DEBUGNOALYSS > 1) :
+?>
+        </div>
+        <div class="col">
+
+            <FORM method="POST">
+                <div class="" id="closing_div" style="display:grid">
+                    <h2>Clôture</h2>
+                    <div class="text-muted">Clôture de l'exercice pour les 
comptes 6 à 7</div>
+
+                </div>
+                <?php
+                echo HtmlInput::array_to_hidden(["gDossier","ac"],$_REQUEST);
+                echo HtmlInput::hidden("sa","closing");
+                $cl_exercice = $cn->make_array("select distinct 
p_exercice,p_exercice_label from parm_periode order by p_exercice desc");
+                $sclExercice = new ISelect("exercice_cl");
+                $sclExercice->id = "select_exercice_cl_id";
+                $sclExercice->value = $cl_exercice;
+                ?>
+                <div class="form-group">
+                    <label for="exercice_cl"><?= _("Exercice à clôturer") 
?></label>
+                    <?php echo $sclExercice->input(); ?>
+                </div>
+                <?= \HtmlInput::submit("ope_submit", _("Valider")) ?>
+            </FORM>
+        </div>
+
+    </div>
+<?php
+endif;
+?>
\ No newline at end of file
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 9440fefa3..15c9ce17e 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -22,8 +22,7 @@ begin
        end if;
 return NEW;
 end;
-$function$
-;
+$function$;
 
 drop trigger if exists fiche_detail_check_qcode_trg on public.fiche_detail ;
 drop function  comptaproc.fiche_detail_qcode_upd();
@@ -40,3 +39,56 @@ insert into parameter values ('MY_REPORT','N') ON CONFLICT 
DO NOTHING;
 
 update menu_ref set me_file='payment_method.inc.php' where me_code='CFGPAY';
 
+update menu_ref set me_menu='Principal' where me_code='COMPANY';
+update menu_ref set me_menu='Financier' where me_code='MENUFIN';
+
+CREATE OR REPLACE FUNCTION comptaproc.set_tech_user()
+    RETURNS trigger
+AS $function$
+declare
+    /* variable */
+    noalyss_user text;
+begin
+    new.tech_user := current_setting('noalyss.user_login');
+    new.tech_date := now();
+    return NEW;
+
+exception when others then
+    new.tech_date := now();
+    new.tech_user := current_user;
+    return NEW;
+end ;
+$function$
+LANGUAGE plpgsql;
+
+drop table if exists operation_exercice_detail;
+drop table if exists operation_exercice;
+
+create table operation_exercice
+(
+    oe_id   bigint generated by default as identity  primary key,
+    oe_date date null,
+    oe_type text not null check  (oe_type = 'opening' or oe_type = 'closing'),
+    oe_text text ,
+    oe_dossier_id int not null,
+    oe_exercice int not null,
+    tech_user text,
+    tech_date timestamp default  now()
+);
+
+create table operation_exercice_detail
+(
+    oed_id  bigint generated by default as identity  primary key,
+    oe_id bigint references operation_exercice (oe_id) on update cascade on 
delete cascade not null,
+    oed_poste account_type ,
+    oed_qcode text ,
+    oed_label text,
+    oed_amount numeric (20,4),
+    oed_debit bool
+);
+
+create trigger trg_set_tech_user  before insert or update on 
operation_exercice  for each row execute function comptaproc.set_tech_user();
+
+update menu_ref set me_code='OPCL' , 
me_menu='Ouvert./Fermeture',me_file='operation_exercice.inc.php',me_description='Opération
 de cloture ou d''ouverture d''exercice'
+                  ,me_description_etendue ='Ecriture d''ouverture ou de 
fermeture , , reporte les soldes des comptes de l''année passé du poste 
comptable 0xxx à 5xxxx sur l''année courante ou ferme les comptes de 6 à 7 de 
l''année '
+where me_code='OPEN';
\ No newline at end of file



reply via email to

[Prev in Thread] Current Thread [Next in Thread]