var xcheck = $('#childs_checkservicenumber').val().replace(/\s/g,'').substring(0,8);
var bday = $('#childs_birthday').val();
- var xcheckdate = xcheck.substring(6,8) + "." + xcheck.substring(4,6) +"."+xcheck.substring(0,4);
+ var xcheckdate = xcheck.substring(0,4)+'-' + xcheck.substring(4,6) + '-' + xcheck.substring(6,8);
if (bday != xcheckdate) {
$('#childs_birthday').val(xcheckdate);
setborderdates();
function setborderdates() {
var minamonths = parent.appdb.dbquery("select minage,maxage from creche LIMIT 1;");
- var bday = encodeparam($('#childs_birthday').val(),'date').replace(/'/g,'');
- var centrydate = encodeparam($('#childs_entrydate').val(),'date').replace(/'/g,'');
- var cleavedate = encodeparam($('#childs_leavedate').val(),'date').replace(/'/g,'');
+ var bday = $('#childs_birthday').val();
+ var centrydate = $('#childs_entrydate').val();
+ var cleavedate = $('#childs_leavedate').val();
var dtbday = new Date(bday);
var dtminentrydate = new Date(dtbday.getFullYear(),dtbday.getMonth() + parseInt(minamonths.sqldata[0].minage), dtbday.getDate());
var today = new Date();
$('#childs_leavedate').val(dtmaxleavedate.toISOString().substring(0,10));
}
- centrydate = encodeparam($('#childs_entrydate').val(),'date').replace(/'/g,'');
- cleavedate = encodeparam($('#childs_leavedate').val(),'date').replace(/'/g,'');
+ centrydate = $('#childs_entrydate').val();
+ cleavedate = $('#childs_leavedate').val();
parent.appdb.dbexec("update childs set birthday=date('"+bday+"'),entrydate=date('"+centrydate+"'),leavedate=date('"+cleavedate+"') where uuid='"+pconfig.uuid+"';");
}
if (pconfig == null) {
pconfig = {};
}
-
+ //update vacancycalendar set vacyear=strftime('%Y',datefrom) where vacyear is null;
if (!pconfig.year) {
pconfig.year=new Date().getFullYear();
};
if (type == 'upd') {
- var evsql = "select uuid,vacdatefrom,vacdateto,timefrom,description,staffuuid,case when hours = '0.00' then '" + maxdayhours +"' else hours end as hours,accepted from (SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, printf(\"%.2f\",cast((cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int))/3600 as real)) as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "');";
+ var evsql = "select uuid,vacdatefrom,vacdateto,timefrom,description,staffuuid,case when hours = '0.00' then '" + maxdayhours +"' else hours end as hours,accepted from (SELECT uuid, datefrom as vacdatefrom, dateto as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, printf(\"%.2f\",cast((cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int))/3600 as real)) as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "');";
evdata = parent.appdb.dbquery(evsql);
evdata = evdata.sqldata[0];
var savesql = "";
if (type == 'ins') {
savesql = "INSERT INTO vacancycalendar (uuid, datefrom, dateto, timefrom, timeto, description, staffuuid, type,vacyear) VALUES "
- +"('" + parent.appdb.generate_uuid() + "', date("+encodeparam(evsvdata.datefrom, 'date')+"), date("+encodeparam(evsvdata.dateto, 'date')+"), "+encodeparam(evsvdata.timefrom, 'text')+", strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), "+encodeparam(evsvdata.description, 'text')+", "+encodeparam(evsvdata.staffuuid, 'text')+","+evsvdata.type+","+encodeparam(evsvdata.datefrom, 'year')+");";
+ +"('" + parent.appdb.generate_uuid() + "', date('"+evsvdata.datefrom+"'), date('"+evsvdata.dateto+"'), "+encodeparam(evsvdata.timefrom, 'text')+", strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), "+encodeparam(evsvdata.description, 'text')+", "+encodeparam(evsvdata.staffuuid, 'text')+","+evsvdata.type+",strftime(\"%Y\",date('"+evsvdata.datefrom+"')))";
} else {
- savesql = "UPDATE vacancycalendar SET vacyear=" + encodeparam(evsvdata.datefrom, 'year') + ", datefrom = date("+encodeparam(evsvdata.datefrom, 'date')+"), dateto = date("+encodeparam(evsvdata.dateto, 'date')+"), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';";
+ savesql = "UPDATE vacancycalendar SET vacyear=strftime(\"%Y\",date('"+evsvdata.datefrom+"')), datefrom = date('"+evsvdata.datefrom+"'), dateto = date('"+evsvdata.dateto+"'), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';";
}
- // console.log("save vacancy");
- // console.log(savesql);
+ //console.log("save vacancy");
+ //console.log(savesql);
parent.appdb.dbexec(savesql);
load_table_vacancy();