This commit is contained in:
2021-09-10 17:10:13 +06:00
11 changed files with 274 additions and 331 deletions

View File

@ -81,7 +81,7 @@ class SRec
if(this.rwin!=null)
{
this.rwin.hideProgressBar();
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: #f1f1f1;"><tr><td align="center"><a href="'+ScriptRName+'?file='+findFirstNode(node,'#cdata-section').nodeValue+'" target="_blank">'+trt('Download_report')+': "'+this.win.getCaption().innerHTML+'".</a></td></tr></table>');
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: '+g_backColor1+';"><tr><td align="center"><a href="'+ScriptRName+(ScriptRName.indexOf('?')!=-1 ? '&file=' : '?file=')+findFirstNode(node,'#cdata-section').nodeValue+'" target="_blank">'+trt('Download_report')+': "'+this.win.getCaption().innerHTML+'".</a></td></tr></table>');
}
}else
alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" );
@ -141,7 +141,7 @@ class SRec
{
let str='\
<div id="eDiv'+this.uid+'" style="width: 100%; height: 100%; position: relative;">\
<table class="SFilter" border="0" cellspacing="0" cellpadding="0" style="width: 100%; height: 100%;"><tr><td>\
<table class="SFilter" style="width: 100%; height: 100%;"><tr><td>\
<table id="idfilter'+this.uid+'" cellspacing="2" cellpadding="0" style="border: 1px solid rgb(99, 99, 99); table-layout: auto;" width="100%" bgcolor="'+g_rowColor2+'">\
<caption></caption><thead></thead><tbody></tbody>\
</table>\
@ -185,7 +185,7 @@ class SRec
document.getElementById('SRec_Add_'+this.uid).onclick = ()=>this.insertRecord();
document.getElementById('SRec_Del_'+this.uid).onclick = ()=>this.deleteRecord();
document.getElementById('SRec_Exc_'+this.uid).onclick = ()=>this.showreport('xls');
document.getElementById('SRec_Exc_'+this.uid).onclick = ()=>this.showReport('xls');
document.getElementById('SRec_Rfr_'+this.uid).onclick = ()=>{this.appendFilter(); this.sendFilter(-1,0);};
}
@ -718,45 +718,78 @@ class SRec
}else
if (columnNode.getAttribute("vt")==="i4")
{
let table=document.createElement('table');
table.border=0;
table.style.cssText="width:100%;/*table-layout:fixed;*/border-spacing:0;border-collapse:collapse;";
let newRow=table.insertRow(0); //We add a row in the created table.
let newCell1 = newRow.insertCell(0);
newCell1.style.cssText="padding:0px;padding-right:1px;width:100%;";
let newCell2 = newRow.insertCell(1);
newCell2.style.cssText="padding:0px;padding-right:1px;height:100%;";
let newCell3 = newRow.insertCell(2);
newCell3.style.cssText="padding:0px;width:25px;height:100%;";
let opt=findNode(columnNode, "options");
if(opt!=null) //If combobox
{
let select = document.createElement('select');
select.style.cssText="width: 100%;";
select.setAttribute("name",columnNode.getAttribute("n"));
select.setAttribute("id", 'filter_' + this.uid + '_' + columnNode.getAttribute("n"));
opt=opt.firstChild
while(opt!=null)
{
if(opt.nodeName=="option")
{
let option = document.createElement("option");
option.setAttribute("value",opt.getAttribute("val"));
option.appendChild(document.createTextNode(opt.getAttribute("d")));
select.appendChild( option );
}
opt=opt.nextSibling;
}
td2.appendChild(select);
let input = document.createElement('input');
input.style.cssText="width: 100%;";
input.setAttribute("type","text");
input.onkeydown=function(){ if(event.keyCode==13) event.keyCode=9; };
input.setAttribute("name",columnNode.getAttribute("n"));
if(columnNode.getAttribute("size")!=null)
input.setAttribute("maxlength",columnNode.getAttribute("size"),0);
input.setAttribute("value",value);
input.setAttribute("id",'filter_'+this.uid+'_'+columnNode.getAttribute("n"));
newCell1.appendChild( input );
}else {
let table = document.createElement('table');
table.border = 0;
table.style.cssText = "width:100%;/*table-layout:fixed;*/border-spacing:0;border-collapse:collapse;";
let newRow = table.insertRow(0); //We add a row in the created table.
let newCell1 = newRow.insertCell(0);
newCell1.style.cssText = "padding:0px;padding-right:1px;width:100%;";
let newCell2 = newRow.insertCell(1);
newCell2.style.cssText = "padding:0px;padding-right:1px;height:100%;";
let newCell3 = newRow.insertCell(2);
newCell3.style.cssText = "padding:0px;width:25px;height:100%;";
let button = document.createElement('input');
button.className='button-secondary';
button.setAttribute("type","button");
button.setAttribute("value","+");
button.style.cssText="height:100%;width:22px;margin:0px;padding:0px;";
newCell2.appendChild( button );
button.onclick=function(inp){return function(){ inp.value=getIntVal(inp.value)+1; }}(input);
let input = document.createElement('input');
input.style.cssText = "width: 100%;";
input.setAttribute("type", "text");
input.onkeydown = function () {
if (event.keyCode == 13) event.keyCode = 9;
};
input.setAttribute("name", columnNode.getAttribute("n"));
if (columnNode.getAttribute("size") != null)
input.setAttribute("maxlength", columnNode.getAttribute("size"), 0);
input.setAttribute("value", value);
input.setAttribute("id", 'filter_' + this.uid + '_' + columnNode.getAttribute("n"));
newCell1.appendChild(input);
button = document.createElement('input');
button.className='button-secondary';
button.setAttribute("type","button");
button.setAttribute("value","-");
button.style.cssText="height:100%;width:22px;margin:0px;padding:0px;";
button.onclick=function(inp){return function(){ inp.value=getIntVal(inp.value)-1; }}(input);
newCell3.appendChild( button );
let button = document.createElement('input');
button.className = 'button-secondary';
button.setAttribute("type", "button");
button.setAttribute("value", "+");
button.style.cssText = "height:100%;width:22px;margin:0px;padding:0px;";
newCell2.appendChild(button);
button.onclick = function (inp) {
return function () {
inp.value = getIntVal(inp.value) + 1;
}
}(input);
td2.appendChild( table );
button = document.createElement('input');
button.className = 'button-secondary';
button.setAttribute("type", "button");
button.setAttribute("value", "-");
button.style.cssText = "height:100%;width:22px;margin:0px;padding:0px;";
button.onclick = function (inp) {
return function () {
inp.value = getIntVal(inp.value) - 1;
}
}(input);
newCell3.appendChild(button);
td2.appendChild(table);
}
}else
if (columnNode.getAttribute("vt")==="f8")
{
@ -1437,7 +1470,7 @@ class SRec
if (error_msg!="") alert2(trt('Alert'),"ShowRecords: \n"+error_msg);
}
showreport(ext)
showReport(ext)
{
if(this.rwin!=null) this.rwin.Close();
@ -1446,7 +1479,7 @@ class SRec
this.rwin.setParent(this.win);
this.rwin.setSize(280,130);
this.rwin.setCaption(trt('Report'));
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: #f1f1f1;"><tr><td align="center"><b>'+trt('Preparing_of_report')+'</b></td></tr></table>');
this.rwin.setContent('<table border="0px" style="width: 100%; height: 100%; background-color: '+g_backColor1+';"><tr><td align="center"><b>'+trt('Preparing_of_report')+'</b></td></tr></table>');
this.appendFilter();
//Call data from server