Accounting Table correction 3.24.6
authorKilian Saffran <ksaffran@dks.lu>
Tue, 2 Oct 2018 06:34:48 +0000 (08:34 +0200)
committerKilian Saffran <ksaffran@dks.lu>
Tue, 2 Oct 2018 06:34:48 +0000 (08:34 +0200)
app_v3/chrome/content/modules/accounting/js/accountingchild.js
app_v3/defaults/profile/creorga.sqlite

index 827f149..68c4a81 100644 (file)
@@ -372,12 +372,14 @@ function newinvoice(){
 function save_accounting(){
         var sql1 = new Array();
         var sql2 = new Array();
-   
+        // var cntnum = "01"; 
         var type = $("#frmeditaccounting #action").val();
         if (type == 'ins'){
           sql1.push('childuuid');
           sql2.push("'"+ pconfig.accchild +"'");
+          
         }
+        
         $("#frmeditaccounting :input").each(function(){
           var input = $(this);
           if (input.attr("id") ){
@@ -398,7 +400,11 @@ function save_accounting(){
               sql2.push(ival);
               if (input.attr("id") == 'invoicedate'){
                 sql1.push('"accmonth"');
+                
                 var newaccmonth = ival.replace(/'/g,"");
+                // var cntx = appdb.dbquery("select count(accmonth)+1 as cnt from accounting where childuuid = '"+ pconfig.accchild +"' and accmonth between date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01') and date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01','+1 month','-1 day'); ");
+                // cntnum = cntx.sqldata[0].cntx;
+                // if (cntnum < 10){ cntnum = "0" + cntnum;}
                 sql2.push('\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
               }
             }else {
@@ -417,6 +423,9 @@ function save_accounting(){
                 sql2.push('"' + input.attr("id") +'"='+ ival);
                 if (input.attr("id") == 'invoicedate'){
                   var newaccmonth = ival.replace(/'/g,"");
+                //   var cntx = appdb.dbquery("select count(accmonth)+1 as cnt from accounting where childuuid = '"+ pconfig.accchild +"' and accmonth between date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01') and date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01','+1 month','-1 day'); ");
+                // cntnum = cntx.sqldata[0].cntx;
+                // if (cntnum < 10){ cntnum = "0" + cntnum;}
                   sql2.push('"accmonth"=\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
                 }
                 
index be1ff6e..6a8476a 100644 (file)
Binary files a/app_v3/defaults/profile/creorga.sqlite and b/app_v3/defaults/profile/creorga.sqlite differ