From: Kilian Saffran Date: Tue, 2 Oct 2018 06:34:48 +0000 (+0200) Subject: Accounting Table correction X-Git-Tag: 3.24.6^0 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=9cd467adaeade67813f6ff3df2fa817412a3b024;p=creorga.git Accounting Table correction --- diff --git a/app_v3/chrome/content/modules/accounting/js/accountingchild.js b/app_v3/chrome/content/modules/accounting/js/accountingchild.js index 827f149..68c4a81 100644 --- a/app_v3/chrome/content/modules/accounting/js/accountingchild.js +++ b/app_v3/chrome/content/modules/accounting/js/accountingchild.js @@ -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'"); } diff --git a/app_v3/defaults/profile/creorga.sqlite b/app_v3/defaults/profile/creorga.sqlite index be1ff6e..6a8476a 100644 Binary files a/app_v3/defaults/profile/creorga.sqlite and b/app_v3/defaults/profile/creorga.sqlite differ