2014年4月30日 星期三

generator-autocomplete

0.20,CUSTOMER.NAME,autocomplete,100%:380px:400px,400,[NAME],,{autoComplete}TABLE_NAME.FIELD_NAME{/autoComplete}{noDuplicate}



{object}
0.20,VENDOR.NAME,autocomplete,100%:380px:400px,400,Supplier,,
{autoComplete}VENDOR.NAME{/autoComplete}{noDuplicate}
{placeHolder}Full Supplier Name for Cheque Issue{/placeHolder}
{/object}


{object}
0.20,PRODUCT.MANUFACTURER,autocomplete,100%:380px:400px,400,Manufacturer  ,,
{spaceLine}
{autoComplete}PRODUCT.MANUFACTURER{/autoComplete}
{onchange}
this.value=='N/A' ? _refreshv2('PRODUCT.MODEL','N/A'):_refreshv2('PRODUCT.MODEL','');
{/onchange}
{tooltips}Manufacturer{/tooltips}
{placeHolder}N/A for nouse{/placeHolder}
{/object}

{object}
0.22,PRODUCT.PRODUCT_LINE,autocomplete,100%:380px:400px,400,Product Line,,
{spaceLine}
{autoComplete}PRODUCT.PRODUCT_LINE{/autoComplete}
{tooltips}Manufacturer{/tooltips}
{placeHolder}N/A for nouse{/placeHolder}
{/object}




/**/
{object}
0.30,PRDTMSTR.MANUFACTURER,autocomplete,100%:380px:400px,400,Manufacturer  ,,
{spaceLine}{draftMust}
{autoComplete}PRDTMSTR.MANUFACTURER{/autoComplete}
{onchange}
this.value=='N/A' ? _refreshv2('PRDTMSTR.MODEL','N/A'):_refreshv2('PRDTMSTR.MODEL','');
{/onchange}
{tooltips}e.g. Microsoft{/tooltips}
{placeHolder}N/A for Not Applicable{/placeHolder}
{ondblclick}
if(PROCESSING_MODE=='D'){
this.value='N/A';_refreshv2('PRDTMSTR.MODEL','N/A');
}
{/ondblclick}
{onblur}
this.value=='N/A' ? _refreshv2('PRDTMSTR.MODEL','N/A'):_refreshv2('PRDTMSTR.MODEL','');
{/onblur}
{/object}

2014年4月29日 星期二

javascript-indexof

Example

Search an array for the item "Apple":
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var a = fruits.indexOf("Apple");
The result of a will be:
2
Meaning that "Apple" is located at position 2 in the array.

2014年4月28日 星期一

input.jsp 20141015

<%@ page errorPage="timeOut.jsp" %>
<!-- current
//subform.retrieval.sql
//view.sql
//0.61,SALES_ORDER_HEAD_VIEW0.STATUS,text:GRID,10%,150,Status,, {data}D,draft,A,approved{/data}
//Refresh=if(hadEdit::1){$("#submit1").css( "display", "inline");} else {$("#submit1").css( "display", "none");}
//formReadOnly=_lookup('PRODUCT.status')::'A'
listTables
MODE : INPUT SINPUT LIST CHOICE SVIEW MINPUT     I.E. MODE.equals("CHOICE")
function retrieval(orderBy)
list.retrieval.tableRead
editing.retreival.sql
editing.grid.retreival.sql
runtime.init
From.Load : blank() java.blank , defaultInput() java.defaults [28] retrieval()
form.caption : formStatus  clock.bar caption.line
formReadOnly      $('input[type="text"]').keypress(function(e){e.preventDefault();});
form.retrieval.tableRead
list.retrieval.tableRead
Wrapper : java.exitMoralBox
form.save
/*create.formValidation Statement*/
sinput.save.button
save.submit
page.table
javascript.variable 243
parse.input.txt 297
java.variable formHeaderTableLayout="auto";
HTML.Body 1039
sinput.save.button
subform.cancel
subform.save.click 1139

formValidation()
MastTable.RecordID

//CHOICE.dblclick
first.Column.Label
second.column.label
tableRule
RetrievalStatus
inkey.Control
html.grid
table.cell
http://192.168.10.8:8080/erp/input.jsp?mode=SINPUT&input=products.txt&config=productsConfig.txt&key=recordid&keyValue=1390296450593
<!--formValidation-->
<!--  ==13 -->

<%@ page errorPage="timeOut.jsp" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.io.File" %>
<%@ page import="javax.xml.parsers.DocumentBuilder" %>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
<%@ page import="org.w3c.dom.Document" %>
<%@ page import="org.w3c.dom.Element" %>
<%@ page import="org.w3c.dom.Node" %>
<%@ page import="org.w3c.dom.NodeList" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.ParseException" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="org.xml.sax.EntityResolver" %>
<%@ page import="org.xml.sax.ErrorHandler" %>
<%@ page import="org.xml.sax.InputSource" %>
<%@ page import="org.xml.sax.SAXException" %>
<%@ page import="org.xml.sax.SAXParseException" %>
<%@ page import="org.xml.sax.helpers.DefaultHandler" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.*" %>
<jsp:useBean scope="session" id="bean" class="com.erp.utils.CompanyProfile" />
<jsp:useBean scope="session" id="lingual" class="com.erp.utils.Lingual" />
<%
session.setMaxInactiveInterval(12*60*60);
String PATH=request.getContextPath();
PATH=PATH.replace("/","");
//out.println(PATH);
%>

<%!
public void updateInput(String vVariable[][],Integer a,String spec,String aTableNames[], String listRefresh[], String listFields[], String listFormats[],String alistTables[][],String Label[] ) throws IOException
{
//vVariable.define
vVariable[a]=new String[125];
//{approvalRequired}
vVariable[a][124]=""; //{approveMust} 201410150930
vVariable[a][123]=""; //{enableWhenApprove} 201410150930
vVariable[a][122]=""; //{deleteBind} 20141009
vVariable[a][121]=""; //{spaceCombo} //20140919
vVariable[a][120]=""; //{web} //20140917
vVariable[a][119]=""; //gridTextColor9when //2014109051440
vVariable[a][118]=""; //gridTextColor8When//2014109051440
vVariable[a][117]=""; //gridTextColor7When//2014109051440
vVariable[a][116]=""; //gridTextColor6When//2014109051440
vVariable[a][115]=""; //gridTextColor6When//2014109051440
vVariable[a][114]=""; //gridTextColor4When//2014109051440
vVariable[a][113]=""; //gridTextColor3When//2014109051440
vVariable[a][112]=""; //gridTextColor2When//2014109051440
vVariable[a][111]=""; //gridTextColor1When//2014109051440
vVariable[a][110]=""; //submitMust
vVariable[a][109]=""; //approvalRequired
vVariable[a][108]=""; //readonlyWhen
vVariable[a][107]=""; //maxWidth
vVariable[a][106]=""; //minWidth
vVariable[a][105]=""; //redColorWhen
vVariable[a][104]=""; //nearLabel
vVariable[a][103]=""; //tableIsDate
vVariable[a][102]=""; //valueTooltip
vVariable[a][101]=""; //dow
vVariable[a][100]="autocomplete=off"; //autocomplete
vVariable[a][99]=""; //subformCaption e.g. dnotes.txt
vVariable[a][98]=""; //placeHolder
vVariable[a][97]="1"; //labelColspan
vVariable[a][96]=""; //likeConstrain
vVariable[a][95]=""; //insertButton
vVariable[a][94]=""; //referential
vVariable[a][93]=""; //gridDeleteData
vVariable[a][92]=""; //findValue
vVariable[a][91]=""; //dependent
vVariable[a][90]=""; //onfocusUpdateCombo
vVariable[a][89]=""; //tableBind
vVariable[a][88]=""; //autofocus
vVariable[a][87]=""; //inkey
vVariable[a][86]=""; //saveDefault
vVariable[a][85]=""; //enableWhen
vVariable[a][84]=""; //renameMessage
vVariable[a][83]="";  //rename
vVariable[a][82]="";  //tableID
vVariable[a][81]="";  //onChangeAjax
vVariable[a][80]="";  //dblclickSetData
vVariable[a][79]="";  //dblclickGetData
vVariable[a][78]="";  //gridAppendData
vVariable[a][77]="1"; // {rowspan}
vVariable[a][76]=""; // {errMess}
vVariable[a][75]=""; // pressAppendEvent
vVariable[a][74]="folder"; // folder
vVariable[a][73]="padding-left:2px;background:write;border:1px solid gray"; // tdInLineStyle
vVariable[a][72]=""; // {likes} | {from}
vVariable[a][71]=""; // {noDuplicate}
vVariable[a][70]=""; // {autoComplete}
vVariable[a][69]=""; // {spaceLine}
vVariable[a][68]=""; // ondblclickAfter
vVariable[a][67]=""; // ondblclick
vVariable[a][66]=""; // labelOndblclickAfter
vVariable[a][65]=""; // labelOndblclick
vVariable[a][64]=""; // formInit
vVariable[a][63]=""; // SumTotal
vVariable[a][62]=""; // documentStatus
vVariable[a][61]="0"; // listtableNumber (grid table) generator use
vVariable[a][60]=""; // onFocus
vVariable[a][59]="1"; // colspan
vVariable[a][58]=""; // onChange
vVariable[a][57]=""; // comboConstrain
vVariable[a][56]=""; // Reference
vVariable[a][55]=""; // inputMask
vVariable[a][54]=""; // numeric value=numeric
vVariable[a][53]=""; // lower
vVariable[a][52]=""; // upper
vVariable[a][51]=""; // email
vVariable[a][50]=""; // setConstrain
vVariable[a][49]=""; // toolTips tooltips
vVariable[a][48]="WINDOW_HEIGHT"; // subformHeight control the area of the subform
vVariable[a][47]="WINDOW_WIDTH"; // subformWidth control the area of the subform
vVariable[a][46]=""; // radio
vVariable[a][45]=""; // label inline Style
vVariable[a][44]=""; // combo
vVariable[a][43]=""; // subform
vVariable[a][42]=""; // onclick
vVariable[a][41]=""; // default
vVariable[a][40]=""; // readonly
vVariable[a][39]=""; // lostfocus
vVariable[a][38]=""; // refresh {refresh}
vVariable[a][37]=""; // data
vVariable[a][36]=""; // http
vVariable[a][35]=""; // currency
vVariable[a][34]=""; // disabled
vVariable[a][33]=""; // getJson
vVariable[a][32]=""; // event
vVariable[a][31]=""; // inLineStyle
vVariable[a][30]=""; // required
vVariable[a][29]=""; // nextField
vVariable[a][28]=""; // thisField //Input[i][3]+"."+Input[i][4];
vVariable[a][27]=""; // prevField
vVariable[a][26]="em"; // uom of display width
vVariable[a][25]=""; // numberic value of display width
vVariable[a][24]=""; // http link
vVariable[a][23]=""; // float
vVariable[a][22]=""; // Second Label
vVariable[a][21]=""; // FirstLabel <---------------------------------------------Label on grid
vVariable[a][19]=""; // width uom
vVariable[a][18]=""; // memberCount
vVariable[a][17]=""; // </br> generate next line
vVariable[a][16]=""; // maxinum width
vVariable[a][15]=""; // mininum width
vVariable[a][14]=""; // Default
vVariable[a][13]=""; // number of grid
vVariable[a][12]=""; // ClassID
vVariable[a][11]=""; // GroupName
vVariable[a][10]=""; // Max Length
vVariable[a][9]=""; // Deciminal
vVariable[a][8]=""; // Display Length
vVariable[a][7]=""; // Grid
vVariable[a][6]=""; // input type
vVariable[a][5]=""; // Click Value
vVariable[a][4]=""; // field
vVariable[a][3]=""; // table
vVariable[a][2]=""; // line
vVariable[a][1]=""; // page

String raws[] = spec.split(",");
String tfvd[]=raws[1].split(":"); // e.g. tableFieldValudDefault ADDRESS.married.clickValue:Default
if (tfvd.length>=2){vVariable[a][14]=tfvd[1];}
String s1[]=raws[0].split("\\."); // e.g. 2.1
String s2[]=tfvd[0].split("\\."); // e.g. ADDRESS.married.clickValue:Default
String s3[]=raws[2].split(":"); // e.g. num:grid
String  wmm[]=raws[3].split(":");   // width min max
if (wmm.length>=3){vVariable[a][16]=wmm[2];}
if (wmm.length>=2){vVariable[a][15]=wmm[1];}
String s4[]=wmm[0].split("\\."); // e.g. 12.2  && display length width
vVariable[a][3]=s2[0]; // table 3
vVariable[a][4]=s2[1]; // field 4
vVariable[a][0]=spec;
vVariable[a][1]=s1[0]; // page 1
vVariable[a][2]=s1[1]; // group 2
//////////////////// grouping g ????
if (s1.length>=3){
if (s1[2].equals("n")){
vVariable[a][17]="<br/>"; // nextLine
} else {
vVariable[a][17]=s1[2]; // nextLine
}
}

if(s2.length>=3){
vVariable[a][5]=s2[2];
} else {
vVariable[a][5]="";
}
vVariable[a][6]=s3[0]; // type 6
Double iNewGroupNo_ = new Double(vVariable[a][1]+"."+vVariable[a][2]);
vVariable[a][82]=Double.toString(iNewGroupNo_).replace(".","_");
//if (keyValue!="null")vVariable[a][84]=""; saveDefault
//if (keyValue!="null")vVariable[a][84]=""; saveDefault
//if (keyValue!="null")vVariable[a][84]=""; saveDefault
//if (keyValue!="null")vVariable[a][84]=""; saveDefault
//autofocus="autofocus"
//if (spec.indexOf("{inkey}")>=0) vVariable[a][87]= xml.parser(spec,"inkey");
//out.println(xml.parser(spec,"inkey"));
//if (spec.indexOf("{autofocus}")>=0) vVariable[a][30]="autofocus";
//vVariable[a][90]=""; //onfocusUpdateCombo

//vVariable[a][94]=""; //referential

//


if (spec.indexOf("{approveMust}")>=0 | spec.indexOf("{124}")>=0) vVariable[a][124]="approveMust";
if (spec.indexOf("{enableWhenApprove}")>=0) vVariable[a][123]="enableWhenApprove";
if (spec.indexOf("{deleteBind}")>=0) vVariable[a][122]="deleteBind";
if (spec.indexOf("{spaceCombo}")>=0) vVariable[a][121]="spaceCombo";
if (spec.indexOf("{web}")>=0) vVariable[a][120]="web";
if (spec.indexOf("{gridTextColor9When}")>=0) vVariable[a][119]= xml.parser(spec,"gridTextColor9When"); //201409051300
if (spec.indexOf("{gridTextColor8When}")>=0) vVariable[a][118]= xml.parser(spec,"gridTextColor8When"); //201409051300
if (spec.indexOf("{gridTextColor7When}")>=0) vVariable[a][117]= xml.parser(spec,"gridTextColor7When"); //201409051300
if (spec.indexOf("{gridTextColor6When}")>=0) vVariable[a][116]= xml.parser(spec,"gridTextColor6When"); //201409051300
if (spec.indexOf("{gridTextColor5When}")>=0) vVariable[a][115]= xml.parser(spec,"gridTextColor5When"); //201409051300
if (spec.indexOf("{gridTextColor4When}")>=0) vVariable[a][114]= xml.parser(spec,"gridTextColor4When"); //201409051300
if (spec.indexOf("{gridTextColor3When}")>=0) vVariable[a][113]= xml.parser(spec,"gridTextColor3When"); //201409051300
if (spec.indexOf("{gridTextColor2When}")>=0) vVariable[a][112]= xml.parser(spec,"gridTextColor2When"); //201409051300
if (spec.indexOf("{gridTextColor1When}")>=0) vVariable[a][111]= xml.parser(spec,"gridTextColor1When"); //201409051300
if (spec.indexOf("{submitMust}")>=0 | spec.indexOf("{110}")>=0) vVariable[a][110]="submitMust";
if (spec.indexOf("{labelRight}")>=0) spec="{labelInLineStyle}text-align:right;{/labelInLineStyle} {default}today(){/default}";
if (spec.indexOf("{gridComboValueToolTip}")>=0) vVariable[a][102]="gridComboValueToolTip";
if (spec.indexOf("{readonlyWhen}")>=0) vVariable[a][108]= xml.parser(spec,"readonlyWhen");
if (spec.indexOf("{maxWidth}")>=0) vVariable[a][107]= xml.parser(spec,"maxWidth");
if (spec.indexOf("{minWidth}")>=0) vVariable[a][106]= xml.parser(spec,"minWidth");
if (spec.indexOf("{redColorWhen}")>=0) vVariable[a][105]= xml.parser(spec,"redColorWhen");
if (spec.indexOf("{nearLabel}")>=0) vVariable[a][104]="nearLabel";
if (spec.indexOf("{tableIsDate}")>=0) vVariable[a][103]="tableIsDate";
if (spec.indexOf("{valueTooltip}")>=0) vVariable[a][102]="valueTooltip";
if (spec.indexOf("{valueToolTip}")>=0) vVariable[a][102]="valueTooltip";
if (spec.indexOf("{valuetooltip}")>=0) vVariable[a][102]="valueTooltip";
if (spec.indexOf("{dow}")>=0) vVariable[a][101]=dowTemplate;
if (spec.indexOf("{enableAutocomplete}")>=0) vVariable[a][100]="autocomplete=on";
if (spec.indexOf("{subformCaption}")>=0) vVariable[a][99]= xml.parser(spec,"subformCaption");
if (spec.indexOf("{placeHolder}")>=0) vVariable[a][98]= xml.parser(spec,"placeHolder");
if (spec.indexOf("{labelColspan}")>=0) vVariable[a][97]= xml.parser(spec,"labelColspan");
if (spec.indexOf("{likeConstrain}")>=0) {vVariable[a][96]="likeConstrain";
likeConstrainCount++;
vVariable[a][50]="_c2=document.getElementById('this.id').checked;if(_c2){_c0"+likeConstrainCount+"='..id like `^'+_c0+'^`';} else {_c0"+likeConstrainCount+"='false';}";
vVariable[a][72]="_c0";
}
if (spec.indexOf("{from}")>=0) {vVariable[a][96]="from";}
if (spec.indexOf("{to}")>=0) {vVariable[a][96]="to";}
if (spec.indexOf("{insertButton}")>=0) vVariable[a][95]=insertButtonTemplate;
if (spec.indexOf("{referential}")>=0) vVariable[a][94]= xml.parser(spec,"referential");
if (spec.indexOf("{findValue}")>=0) vVariable[a][92]= xml.parser(spec,"findValue");
if (spec.indexOf("{dependent}")>=0) vVariable[a][91]="dependent";
if (spec.indexOf("{onfocusUpdateCombo}")>=0) vVariable[a][90]="onfocusUpdateCombo";
if (spec.indexOf("{tableBind}")>=0) vVariable[a][89]= xml.parser(spec,"tableBind");
if (spec.indexOf("{inkey}")>=0) vVariable[a][87]= xml.parser(spec,"inkey");
if (spec.indexOf("{saveDefault}")>=0) vVariable[a][86]= xml.parser(spec,"saveDefault");
if (spec.indexOf("{enableWhen}")>=0) vVariable[a][85]= xml.parser(spec,"enableWhen");
if (spec.indexOf("{renameMessage}")>=0) vVariable[a][84]= xml.parser(spec,"renameMessage");
if (spec.indexOf("{rename}")>=0) vVariable[a][83]= xml.parser(spec,"rename");
if (spec.indexOf("{onChangeAjax}")>=0) vVariable[a][81]= xml.parser(spec,"onChangeAjax");
if (spec.indexOf("{dblclickSetData}")>=0) vVariable[a][80]= xml.parser(spec,"dblclickSetData");
if (spec.indexOf("{dblclickGetData}")>=0) vVariable[a][79]= xml.parser(spec,"dblclickGetData");
if (spec.indexOf("{gridAppendData}")>=0) vVariable[a][78]= xml.parser(spec,"gridAppendData");
if (spec.indexOf("{rowspan}")>=0) vVariable[a][77]= xml.parser(spec,"rowspan");
if (spec.indexOf("{errMess}")>=0) vVariable[a][76]= xml.parser(spec,"errMess");
if (spec.indexOf("{pressAppendEvent}")>=0)vVariable[a][75]= xml.parser(spec,"pressAppendEvent");
if (spec.indexOf("{folder}")>=0) vVariable[a][74]= xml.parser(spec,"folder");
if (spec.indexOf("{tdInLineStyle}")>=0) vVariable[a][73]= xml.parser(spec,"tdInLineStyle");
if (spec.indexOf("{likes}")>=0) vVariable[a][72]= xml.parser(spec,"likes");
if (spec.indexOf("{noDuplicate}")>=0) vVariable[a][71]="noDuplicate";
if (spec.indexOf("{autoComplete}")>=0) vVariable[a][70]= xml.parser(spec,"autoComplete");
if (spec.indexOf("{spaceLine}")>=0 | spec.indexOf("{spaceline}")>=0){
if (spec.indexOf("{/spaceLine}")>=0){
vVariable[a][69]= xml.parser(spec,"spaceLine");
} else {
vVariable[a][69]=spaceLineTemplate;
}
}

if (spec.indexOf("{ondblclickAfter}")>=0)vVariable[a][68]= xml.parser(spec,"ondblclickAfter");
if (spec.indexOf("{ondblclick}")>=0) vVariable[a][67]= xml.parser(spec,"ondblclick");
if (spec.indexOf("{documentStatus}")>=0) vVariable[a][62]="documentStatus";
if (spec.indexOf("{default}")>=0) vVariable[a][41]= xml.parser(spec,"default");
if (spec.indexOf("{onFocus}")>=0) vVariable[a][60]= xml.parser(spec,"onFocus");
if (spec.indexOf("{colspan}")>=0) vVariable[a][59]= xml.parser(spec,"colspan");
if (spec.indexOf("{onChange}")>=0 ) vVariable[a][58]= xml.parser(spec,"onChange");
if (spec.indexOf("{onchange}")>=0 ) vVariable[a][58]= xml.parser(spec,"onchange");
if (spec.indexOf("{comboConstrain}")>=0) vVariable[a][57]= xml.parser(spec,"comboConstrain");
if (spec.indexOf("{reference}")>=0) vVariable[a][56]= xml.parser(spec,"reference");
if (spec.indexOf("{inputMask}")>=0) vVariable[a][55]= xml.parser(spec,"inputMask");
if (spec.indexOf("{numeric}")>=0) vVariable[a][54]="numeric";
if (spec.indexOf("{lower}")>=0) vVariable[a][53]="lower";
if (spec.indexOf("{upper}")>=0) vVariable[a][52]="upper";
if (spec.indexOf("{email}")>=0) vVariable[a][51]="email";
if (spec.indexOf("{setConstrain}")>=0)
{vVariable[a][50]= xml.parser(spec,"setConstrain");vVariable[a][50]=vVariable[a][50]+"_c0= _c0.replace(/&/g,'[and]');";}

if (spec.indexOf("{required}")>=0 | spec.indexOf("{30}")>=0  | spec.indexOf("{110}")>=0) vVariable[a][30]="required";
if (spec.indexOf("{approvalRequired}")>=0 & PROCESSING_MODE.equals("A")) vVariable[a][30]="required";
if (spec.indexOf("{disabled}")>=0) vVariable[a][34]="disabled";
vVariable[a][11]=raws[0].replace(".","_"); // Group
if (spec.indexOf("{currency}")>=0) vVariable[a][35]="currency";
if (spec.indexOf("{integer}")>=0) vVariable[a][35]="integer";
if (spec.indexOf("{toolTips}")>=0) vVariable[a][49]= xml.parser(spec,"toolTips");
if (spec.indexOf("{tooltips}")>=0) vVariable[a][49]= xml.parser(spec,"tooltips");
if (spec.indexOf("{tooltip}")>=0) vVariable[a][49]= xml.parser(spec,"tooltip");
if (vVariable[a][120].equals("web")){vVariable[a][49]="Display Web : Double Click or Ctrl+Double Click new Window";}
vVariable[a][46]= xml.parser(spec,"radio");
vVariable[a][45]= xml.parser(spec,"labelInLineStyle");//{labelInLineStyle}"display:block;"{/labelInLineStyle}
if  (vVariable[a][45].trim().equals("")){
vVariable[a][45]="display:block;";
}
if (spec.indexOf("{lAlignRight}")>=0| spec.indexOf("{labelRight}")>=0){
vVariable[a][45]="text-align:right;";
}
if (spec.indexOf("{lAlignLeft}")>=0 | spec.indexOf("{labelLeft}")>=0){
vVariable[a][45]="text-align:left;";
}
vVariable[a][44]= xml.parser(spec,"combo");
vVariable[a][43]= xml.parser(spec,"subform");
vVariable[a][31]= xml.parser(spec,"inLineStyle");
if (spec.indexOf("{alignRight}")>=0) vVariable[a][31]="text-align:right;";
if (spec.indexOf("{alignright}")>=0) vVariable[a][31]="text-align:right;";
if (spec.indexOf("{alignLeft}")>=0) vVariable[a][31]="text-align:left;";
if (spec.indexOf("{alignleft}")>=0) vVariable[a][31]="text-align:left;";
if (spec.indexOf("{alignCenter}")>=0 | spec.indexOf("{alignCentre}")>=0 | spec.indexOf("{aligncenter}")>=0 | spec.indexOf("{aligncentre}")>=0  ){
vVariable[a][31]="text-align:center;";
}

vVariable[a][32]= xml.parser(spec,"events");
vVariable[a][33]= xml.parser(spec,"getJson");
vVariable[a][41]= xml.parser(spec,"default");
if (spec.indexOf("{readonly}")>=0) vVariable[a][40]="readonly"; //20140815
if (spec.indexOf("{readOnly}")>=0) vVariable[a][40]="readonly"; //20140815
if (spec.indexOf("{onclick}")>=0) vVariable[a][42]= xml.parser(spec,"onclick");
if (spec.indexOf("{onClick}")>=0) vVariable[a][42]= xml.parser(spec,"onClick");
vVariable[a][39]= xml.parser(spec,"lostfocus");
//20140722 if (spec.indexOf("onblur")>=9){vVariable[a][39]= xml.parser(spec,"onblur");}
if (spec.indexOf("onblur")>=0 | spec.indexOf("onBlur")>=0){vVariable[a][39]= xml.parser(spec,"onblur");}
if (spec.indexOf("{data}")>=0) vVariable[a][37]= xml.parser(spec,"data");
vVariable[a][37]=vVariable[a][37].replaceAll("documentStatus",documentStatus);  //201409181705

vVariable[a][36]= xml.parser(spec,"http"); //{http}

if (vVariable[a][6].equals("combo")) {createJavaScriptComboFunction=1; vVariable[a][102]="valueTooltip";} //201410101100

if  (vVariable[a][6].equals("textarea") || vVariable[a][6].equals("combo")){
vVariable[a][73]="border:solid 1px gray; padding-left:1px;background:write;"; // tdInLineStyle table.cell
}
// if (vVariable[a][6].equals("textarea") || vVariable[a][6].equals("upload") ){
// vVariable[a][48]=editTextAreaHeight; //20140408
// vVariable[a][47]=editTextAreaWidth;
// }
if  (! xml.parser(spec,"subformHeight").trim().equals("")){
vVariable[a][48]= xml.parser(spec,"subformHeight");
}
if  (! xml.parser(spec,"subformWidth").trim().equals("")){
vVariable[a][47]= xml.parser(spec,"subformWidth");
}



////////////////////////////
String s5[]=s3[0].split("\\.");
if(s5.length>=2){vVariable[a][9]=s5[1];}  // decinimal
if(s5.length>=2){vVariable[a][6]=s5[0];} //201408281140 num handling
if(s3.length>=2){vVariable[a][7]=s3[1].trim();} else {vVariable[a][7]="";} // 7 as Type2 GRID | FROMTO
vVariable[a][8]=s4[0]; // len display length
vVariable[a][10]=raws[4]; //  maxLength
if(s4.length>=3){vVariable[a][19]=s4[2];} else {vVariable[a][19]="";} // deciminal
vVariable[a][20]=raws[5];  // Input[20]=raws[5] =Label
if (raws.length>=7){vVariable[a][24]=raws[6];}
String ss[]=raws[5].split(":");
if (ss.length>=1) {vVariable[a][21]=ss[0];} else  {vVariable[a][21]="";} // Input[21]= First Label
if (ss.length>=2) {
vVariable[a][22]=ss[1]; // Input[22] = Second Label
String ss2[]=ss[1].split("=");
if (ss2.length>=2){vVariable[a][22]=ss2[0];
vVariable[a][23]=ss2[1];} else
{
vVariable[a][23]=""; // Input[23]=Float
}
} else  {
vVariable[a][22]="";
}

if (vVariable[a][21].indexOf("MMYY")>=0){  // when label is MMYY-1 it mean the date mm/yyyy format
String ss2[]=vVariable[a][21].split("-");
if (ss2.length>=2){
int i0=Integer.parseInt(ss2[1]);
int i1=year*12+month-i0;
int i2=i1/12;
int i3=i1%12;
if (i3==0){
i3=12;
i2=i2-1;
}
vVariable[a][21]=i3+"/"+i2;
}
}

////////////////////////////
vVariable[a][12]=vVariable[a][3]+"_"+vVariable[a][4];
vVariable[a][25]=vVariable[a][8].replace("%","");
vVariable[a][26]=(vVariable[a][8].indexOf("%")>=1)?"%":"em";
if (spec.indexOf("{width}")>=0) vVariable[a][25]= xml.parser(spec,"width"); //20140523
if (spec.indexOf("{widthUom}")>=0) vVariable[a][26]= xml.parser(spec,"widthUom"); //20140523
vVariable[a][28]=vVariable[a][3]+"."+vVariable[a][4];
if (vVariable[a][28].equals("to")) vVariable[a][28]=vVariable[a][28]+"{to}"; //201409291030
if (vVariable[a][28].equals("from")) vVariable[a][28]=vVariable[a][28]+"{from}"; //201409291030

if (spec.indexOf("{formInit}")>=0) vVariable[a][64]= xml.parser(spec,"formInit");
if (spec.indexOf("{autofocus}")>=0){vVariable[a][88]="autofocus";autoFocus=vVariable[a][28];}
vVariable[a][64]=vVariable[a][64].replaceAll("this.id",vVariable[a][28]);  //20140420
vVariable[a][95]=vVariable[a][95].replaceAll("this.id",vVariable[a][28]);  //20140420


vVariable[a][101]=vVariable[a][101].replaceAll("this.id",vVariable[a][28]);  //20140725
vVariable[a][101]=vVariable[a][101].replaceAll("this.",vVariable[a][3]);  //20140725
vVariable[a][101]=vVariable[a][101].replaceAll(".\\.id",vVariable[a][4]);  //20140725


vVariable[a][50]=vVariable[a][50].replaceAll("this.id",vVariable[a][28]);  //20140708
vVariable[a][50]=vVariable[a][50].replaceAll("this.",vVariable[a][3]);  //20140708
vVariable[a][50]=vVariable[a][50].replaceAll(".\\.id",vVariable[a][4]);  //20140708

vVariable[a][75]=vVariable[a][75].replaceAll("this.id",vVariable[a][28]);  //20140523
vVariable[a][75]=vVariable[a][75].replaceAll("this.",vVariable[a][3]);  //20140523

vVariable[a][58]=vVariable[a][58].replaceAll("this.\\.",vVariable[a][3]+"."); //58 = ONCHANGE this..
vVariable[a][42]=vVariable[a][42].replaceAll("this.\\.",vVariable[a][3]+".");

vVariable[a][38]= xml.parser(spec,"refresh");

if  (vVariable[a][6].equals("check")) vVariable[a][38]=vVariable[a][38].replaceAll("thisValue","document.getElementById('this.id').checked");
vVariable[a][38]=vVariable[a][38].replaceAll("this.id",vVariable[a][28]);  //20140421
 vVariable[a][38]=vVariable[a][38].replaceAll("this.",vVariable[a][3]);  //20140725
vVariable[a][38]=vVariable[a][38].replaceAll(".\\.id",vVariable[a][4]);  //20140725

vVariable[a][79]=vVariable[a][79].replaceAll("this.id",vVariable[a][28]);  //20140421
 vVariable[a][79]=vVariable[a][79].replaceAll("this.",vVariable[a][3]);  //20140725
vVariable[a][79]=vVariable[a][79].replaceAll(".\\.id",vVariable[a][4]);  //20140725

if (spec.indexOf("{labelOndblclickAfter}")>=0) vVariable[a][66]= xml.parser(spec,"labelOndblclickAfter").replaceAll("this.id",vVariable[a][28]);
if (spec.indexOf("{labelOndblclick}")>=0) vVariable[a][65]= xml.parser(spec,"labelOndblclick");
//////////////////////////////
if (vVariable[a][31].equals("display:none;")){
vVariable[a][73]="padding-left:0px;background:write;border:0px solid gray"; // tdInLineStyle
}

if (!vVariable[a][85].equals("") ){  //[85]=enableWhen it can hand checkbox and combo
String s71="";
if (vVariable[a][85].indexOf("==")>=0) {
String sa71[]=vVariable[a][85].split("==");
s71="objectWhen=_lookup('"+sa71[0]+"');";
s71=s71+"if (objectWhen=='"+sa71[1]+"'){$('."+vVariable[a][28].replace(".","_")+"').removeAttr('disabled');}  else {    $('."+vVariable[a][28].replace(".","_")+"').attr( 'disabled', 'disabled');}";
} else {
s71=" if (document.getElementById('"+vVariable[a][85]+"').type=='checkbox'){";
s71=s71+"_c2=document.getElementById('"+vVariable[a][85]+"').checked;";
s71=s71+"if (_c2){$('."+vVariable[a][28].replace(".","_")+"').removeAttr('disabled');}  else {    $('."+vVariable[a][28].replace(".","_")+"').attr( 'disabled', 'disabled');}}";
}
enableWhen=enableWhen+s71;
//20140813 clockRefresh=clockRefresh+s71;
    }
clockRefresh=clockRefresh+vVariable[a][38]+vVariable[a][101];
//.attr( 'disabled', 'disabled' );
//{"+vVariable[a][28]+"}



if (keyValue!="null")vVariable[a][84]="";


////////////////////////////////
/*
labelOndblclickAfter=labelOndblclickAfter+vVariable[a][66];
if (!vVariable[a][79].equals("")){
String s=dbClickGetKeyValueTemplate.replaceAll("this.id",vVariable[a][28]);
s=s.replaceAll("this.",vVariable[a][3]);
String akey[]=vVariable[a][79].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
s=s.replace(akeyValue[0].trim(),akeyValue[1].trim());
}
labelOndblclickAfter=labelOndblclickAfter+s;
}
*/

///////////////////////////////////////////////


if (!vVariable[a][81].equals("")){
String s81="";
String akey[]=vVariable[a][81].replaceAll(" ","").replaceAll("this.",vVariable[a][3]).split(",");
String table_="";
String fields_="";
String formats_="";
String delimiter_="";
String updates_="$.getJSON(s43,function(data) {if (data[0]){";
for (int i91=0;i91<akey.length;i91++){
String akeyValue[]=akey[i91].split("=");
if (akeyValue[0].trim().equals("TABLE")){table_=akeyValue[1].trim();}
if (akeyValue[0].trim().equals("FIELDS")){
fields_=akeyValue[1].trim().replaceAll("&",",");
String akey2[]=akeyValue[1].split("&");
for (int i92=0;i92<akey2.length;i92++){
formats_=formats_+delimiter_+"S";
delimiter_=",";
}
} //endif FIELDS
if (akeyValue[0].trim().equals("UPDATES")){
String akey2[]=akeyValue[1].split("&");
for (int i92=0;i92<akey2.length;i92++){
updates_=updates_+"_refreshv2('"+akey2[i92]+"',data[0]["+i92+"].replace(/<z><z>/g, '\\n')); ";
}
updates_=updates_+"}});";
} //endif UPDATES
} //endfor
s81="s0821=this.value;s43="
+" 'tableRead?table="+table_
+"&fields="+fields_
+"&key=RECORDID&value='+s0821+"
+"'&format="+formats_+"&callback=?&db='+DATABASE ; ";
s81=s81+updates_;
updates_="";
vVariable[a][81]=s81;
}



i6=0;
for (int i=0;i<aTableNames.length;i++){
if (vVariable[a][3].equals(aTableNames[i])) {
i6=i;
vVariable[a][61]= Integer.toString(i); //20140206
}
}

cInputCount=Integer.toString(retrievalFieldCounting[i6]++) ; //20140112

// retrievalBackString[i6] // refresh.header html.header.refresh html.head.refresh html.data.refresh
//parseFloat(num).toFixed(d)
if (vVariable[a][6].equals("num")){ //refresh.header.num
//s12=(s12*1).formatMoney("+vVariable[a][9]+", '.', ',');




retrievalBackString[i6]=retrievalBackString[i6]+
"_refreshv2('"+vVariable[a][28]+"',translate(data[0]["+cInputCount+"],"+vVariable[a][9]+"));/*201409081900*/ ";
retrievalBackString[i6]=retrievalBackString[i6]+"var i = _lookup('"+vVariable[a][28]+"');";
retrievalBackString[i6]=retrievalBackString[i6]+"i = (i*1).formatMoney("+vVariable[a][9]+",'.',',');"; //201409191700
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',i);";
//retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',translate(data[0]["+cInputCount+"],"+vVariable[a][9]+"));/*201409081900*/ ";
} else if (vVariable[a][35].equals("currency")){
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',translate(data[0]["+cInputCount+"],2) ); ";
} else if (vVariable[a][35].equals("integer")){
retrievalBackString[i6]=retrievalBackString[i6]+"if (data[0]["+cInputCount+"]=='null' || data[0]["+cInputCount+"]=='NaN' || data[0]["+cInputCount+"]==''){";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"','0'); ";
retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',parseInt(data[0]["+cInputCount+"]) ); ";
retrievalBackString[i6]=retrievalBackString[i6]+"}";
} else if  (! vVariable[a][41].trim().equals("")){  // since 41 = default  //undefined
retrievalBackString[i6]=retrievalBackString[i6]+"if (data[0]["+cInputCount+"]=='null' || data[0]["+cInputCount+"]=='1753-01-01'){";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',''); ";
retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',data[0]["+cInputCount+"]); ";
retrievalBackString[i6]=retrievalBackString[i6]+"}";
} else {
if (vVariable[a][6].equals("text") || vVariable[a][6].equals("autocomplete")) {
if (!vVariable[a][70].equals("")){
String s55[]=vVariable[a][70].split("\\.");
autoCompleteS=autoCompleteS+autoCompleteTemplate.replace("TABLE", s55[0]).replace("FIELD", s55[1]).replace("TARGET", vVariable[a][3]+vVariable[a][4]);
if (vVariable[a][71].equals("noDuplicate") & PROCESSING_MODE.equals("D")){ //201410031045

tableVariables=tableVariables+"var "+vVariable[a][3]+vVariable[a][4]+" Array();";
// autocompletePopup
String s7="s=_lookup('"+vVariable[a][28]+"');"+
"i="+vVariable[a][3]+vVariable[a][4]+".indexOf(s); "+
"if(i>=0 & newAdd==1){_messagebox(s,0,16,'Duplicate input ! ');"
+"return false;}";
formValidation=formValidation+s7+"\n";
}
}
retrievalBackString[i6]=retrievalBackString[i6]+"if (data[0]["+cInputCount+"]=='1753-01-01' || data[0]["+cInputCount+"]=='null' || data[0]["+cInputCount+"]=='No Value'){";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',''); ";
retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',uiDisplay(data[0]["+cInputCount+"])); ";
retrievalBackString[i6]=retrievalBackString[i6]+"}";
} else if (vVariable[a][6].equals("date")) {
retrievalBackString[i6]=retrievalBackString[i6]+"if (data[0]["+cInputCount+"]=='1753-01-01' || data[0]["+cInputCount+"]=='null' || data[0]["+cInputCount+"]=='No Value'){";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',''); ";
retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',data[0]["+cInputCount+"]); ";
retrievalBackString[i6]=retrievalBackString[i6]+"}";
} else {
retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+vVariable[a][28]+"',''+data[0]["+cInputCount+"]); ";
}
}


if (vVariable[a][6].equals("combo")){ //html.data.combo.retrieval
retrievalBackString[i6]=retrievalBackString[i6]+"s20140804a='"+vVariable[a][33]+"&db="+DATABASE+"';"; // not yet use
}

if (vVariable[a][6].equals("date")){
String s7="var x=_lookup('"+vVariable[a][28]+"');";
s7=s7+"if(!x){_refreshv2('"+vVariable[a][28]+"','');};";
formValidation=formValidation+s7+"\n";
}

if (vVariable[a][6].equals("upload")) {
String s="document.getElementById('"+vVariable[a][28]+"').title =data[0]["+cInputCount+"] ;";
retrievalBackString[i6]=retrievalBackString[i6]+s;
}
if (vVariable[a][6].equals("image")) {
String s=" if (data[0]["+cInputCount+"])document.getElementById('img"+
vVariable[a][28]+"').src="+"'"+DATABASE+"/"+vVariable[a][74]+"/'+"+"data[0]["+cInputCount+"] ;";
retrievalBackString[i6]=retrievalBackString[i6]+s;
}




// after combo choice and display the data {onChangeAjax}
if  (vVariable[a][76].trim().equals("")){
vVariable[a][76]=vVariable[a][21]+vVariable[a][22]+" Cannot be empty...";
//vVariable[a][76]=vVariable[a][76]+"document.getElementById('"+vVariable[a][28]+"').focus();";
}

// double click display the form and choice the Row Recordid {dblclicksetdata}
if (!vVariable[a][80].equals("")){
String s75=dbClickSetKeyValueTemplate.replace("TABLE_ID",vVariable[a][82]).replaceAll("this.id",vVariable[a][28]);
String akey[]=vVariable[a][80].split(",");
vVariable[a][80]="";
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
s75=s75.replace(akeyValue[0].trim(),akeyValue[1].trim());
vVariable[a][80]=vVariable[a][80]+s75;
}
}


//function _messagebox(s0801,pboxType,pboxIcon){

//////////////////////// {required}
if (vVariable[a][30].equals("required")){
if (vVariable[a][7].equals("GRID")) { // grid.validation
gridValids=gridValids
+"var doit=1;"
+"if ('"+vVariable[a][110]+"'=='submitMust' & documentAction==''){doit=0;}\n" //201409031200
+"if ('"+vVariable[a][124]+"'=='approveMust' & documentAction==''){doit=0;}\n" //201410151750
+"if ('"+vVariable[a][110]+"'=='submitMust' & documentAction=='P'){doit=1;}\n" //201409031200
+"if ('"+vVariable[a][124]+"'=='approveMust' & documentAction=='A'){doit=1;}\n" //201410151750
+"if(doit){if(_lookup('"+vVariable[a][3]+"_action'+n78)!='x' & s=='"+vVariable[a][28]+"' && (v==''| v=='0'| v=='0.00')){"
+"\n$('."+vVariable[a][28].replace(".","_")+"0').focus();/*201409231015*/" //validationPopup
+"_messagebox('"+vVariable[a][76]+"',0,16,'Required Input ! ');"
+"$('#clicker').click();"
+"result=false ;}}\n";
} else {
String s7="var doit=1; var x=_lookup('"+vVariable[a][28]+"');\n"; ///html.validation
s7=s7+"if ('"+vVariable[a][110]+"'=='submitMust' & documentAction==''){doit=0;}\n"; //201409031200
s7=s7+"if ('"+vVariable[a][110]+"'=='submitMust' & documentAction=='P'){doit=1;}\n";//201409031200
s7=s7+"if ('"+vVariable[a][124]+"'=='approveMust' & documentAction==''){doit=0;}\n"; //201410151750
s7=s7+"if ('"+vVariable[a][124]+"'=='approveMust' & documentAction=='A'){doit=1;}\n";//201410151750
s7=s7+"if (doit==1 & (x==null || x=='')) \n ";
s7=s7+"{";
s7=s7+"$('."+vVariable[a][28].replace(".","_")+"').focus();"; //201408251445
s7=s7+"_messagebox('"+vVariable[a][76]+"',0,16,'Required Input ! ');";
s7=s7+"return false;";
s7=s7+"}";
formValidation=formValidation+s7+"\n";
}
}

if (vVariable[a][51].equals("email")){
String s7="var x=_lookup('"+vVariable[a][28]+"');";
s7=s7+"var atpos=x.indexOf('@');";
s7=s7+"var dotpos=x.lastIndexOf('.');";
s7=s7+"if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)";
s7=s7+"{";
s7=s7+"alert('Not a valid e-mail address');";
s7=s7+"return false;";
s7=s7+"}";
formValidation=formValidation+s7+"\n";
}

//////////////////////////create grid.data.refresh ////////////////////
if (((MODE.equals("SINPUT") | MODE.equals("MINPUT")) || (MODE.equals("LIST") | MODE.equals("CHOICE"))) &&vVariable[a][7].equals("GRID") & (!vVariable[a][3].equals("query")))
{
if (vVariable[a][6].equals("num.2") || vVariable[a][6].equals("num")){
listFields[i6]=listFields[i6]+listDelimiter+"if(isnull("+vVariable[a][4]+"),0,"+vVariable[a][4]+")";
} else {
listFields[i6]=listFields[i6]+listDelimiter+"if(isnull("+vVariable[a][4]+"),\"\","+vVariable[a][4]+")";
}

listFormats[i6]=listFormats[i6]+listDelimiter+"S";



if (vVariable[a][35].equals("currency")){ //refresh.currency grid.currency.update
listRefresh[i6]=listRefresh[i6]
+"s12=translate(data[r][1+rf++],2);"
+"if(s12=='NaN'){s12=translate(0.00,2);}"
+"s12=(s12*1).formatMoney(2, '.', ',');"
+"_refreshv2('"+vVariable[a][28]+"'+editRow,s12);";

} else if (vVariable[a][35].equals("integer")){  // refresh.integer
listRefresh[i6]=listRefresh[i6]+"s11=parseInt(data[r][1+rf++],10);";
listRefresh[i6]=listRefresh[i6]+"if('NaN'==$.trim(s11)){s11=0;}";
listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+vVariable[a][28]+"'+editRow,s11);";

} else if  (vVariable[a][6].equals("num")){ //refresh.num grid.num.update 201408281140
listRefresh[i6]=listRefresh[i6]
+"s12=translate(data[r][1+rf++],2);"
+"if(s12=='NaN'){s12=translate(0.00,2);}"
+"s12=(s12*1).formatMoney("+vVariable[a][9]+", '.', ',');" //
+"_refreshv2('"+vVariable[a][28]+"'+editRow,s12);";

} else if  (! vVariable[a][37].trim().equals("")){

listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+vVariable[a][28]+"'+editRow, aname('"+vVariable[a][37]+"',data[r][1+rf++]));generator='gridrefresh1';";


} else {
if (vVariable[a][6].equals("date") |vVariable[a][6].equals("text") | vVariable[a][6].equals("autocomplete") | vVariable[a][6].equals("upload")){
listRefresh[i6]=listRefresh[i6]+"\ns10=data[r][1+rf++];/*refresh.grid*/";
//201409231420 listRefresh[i6]=listRefresh[i6]+"\nif (s10=='No Value' || s10=='1753-01-01' || s10=='0000-00-00' ){s10='';}";
listRefresh[i6]=listRefresh[i6]+"\n_refreshv2('"+vVariable[a][28]+"'+editRow,uiDisplay(s10));"+"generator='gridrefresh2';\n/*201408251120*/";
//201409231230 listRefresh[i6]=listRefresh[i6]+"data[r][rf]=data[r][rf].replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n');";
//201409231230 listRefresh[i6]=listRefresh[i6]+"s0806=data[r][rf].replace(/<SinglEQuoT>/g, \"'\");";
listRefresh[i6]=listRefresh[i6]+"s0806=uiDisplay(data[r][rf]);";


if (vVariable[a][102].equals("valueTooltip") &!  vVariable[a][6].equals("combo")){
listRefresh[i6]=listRefresh[i6]+"document.getElementById('"+vVariable[a][28]+"'+editRow).title =s0806;";
}
if (vVariable[a][6].equals("upload")){
listRefresh[i6]=listRefresh[i6]+"$('#"+vVariable[a][28]+"').attr('title', 'your new title');";
}
} else {
if (vVariable[a][6].equals("combo")){ //20140805 grid.combo.update
listRefresh[i6]=listRefresh[i6]+"var referRecordid=data[r][1+rf];";
listRefresh[i6]=listRefresh[i6]+"s20140804b='"+vVariable[a][33]+"&db="+DATABASE+"';"; // not yet use
listRefresh[i6]=listRefresh[i6]+"$.getJSON(s20140804b,";
listRefresh[i6]=listRefresh[i6]+" function(data20140804) {";
listRefresh[i6]=listRefresh[i6]+" xxr=0;";
listRefresh[i6]=listRefresh[i6]+" if (data20140804[0] && RetrievalStatus){";

listRefresh[i6]=listRefresh[i6]+" var obj_field0804=document.getElementById('"+vVariable[a][28]+"'+editRow);";
listRefresh[i6]=listRefresh[i6]+" for (r20140123=0; r20140123<data20140804.length; r20140123++){ ";
listRefresh[i6]=listRefresh[i6]+" $(obj_field0804).append($('<option></option>').val(data20140804[r20140123][0]).html(data20140804[r20140123][1]));";

//out.println(vVariable[a][102]);

if (vVariable[a][102].equals("gridComboValueToolTip") | vVariable[a][102].equals("valueTooltip")){
listRefresh[i6]=listRefresh[i6]+"if (data[r][rf+1]==data20140804[r20140123][0]){";
listRefresh[i6]=listRefresh[i6]+"obj_field0804.title =obj_field0804.title+' '+data20140804[r20140123][1];}";
}
listRefresh[i6]=listRefresh[i6]+" option1=null; ";



listRefresh[i6]=listRefresh[i6]+" } ";
listRefresh[i6]=listRefresh[i6]+" }";
listRefresh[i6]=listRefresh[i6]+" }";
listRefresh[i6]=listRefresh[i6]+" );";

}
if (vVariable[a][6].equals("lookupValue")){  //20140805 grid.lookup.update
String s0807=gridFindValueTemplate;
String akey[]=vVariable[a][92].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue8[]=akey[i9].split("=");
String source_="";
String target_="";
for (int i90=0;i90<akeyValue8.length;i90++){
//out.println(akeyValue8[i90].trim()+" "+i9);
if (i90==0) source_=akeyValue8[i90].trim();
if (i90==1) target_=akeyValue8[i90].trim();
}
//out.println(akeyValue8[1]);
//out.println(akeyValue8[1]+" "+i9);
//out.println(akeyValue[1].trim());
s0807=s0807.replace(source_,target_);
//out.println(s0807);
}
s0807=s0807+"";

listRefresh[i6]=listRefresh[i6]+"var referRecordid=data[r][1+rf];";
listRefresh[i6]=listRefresh[i6]+"s20140804b='"+s0807+"&db="+DATABASE+"';";
listRefresh[i6]=listRefresh[i6]+"$.getJSON(s20140804b,";
listRefresh[i6]=listRefresh[i6]+" function(data20140804) {";
listRefresh[i6]=listRefresh[i6]+" xxr=0;";
listRefresh[i6]=listRefresh[i6]+" if (data20140804[0] && RetrievalStatus){";
listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+vVariable[a][28]+"_Display_'+editRow,data20140804[0][1]  );generator='gridrefresh4';";

listRefresh[i6]=listRefresh[i6]+" }";
listRefresh[i6]=listRefresh[i6]+" }";
listRefresh[i6]=listRefresh[i6]+" );";
}
// grid.data.update.title choice.ajax.refresh
listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+vVariable[a][28]+"'+editRow,data[r][1+rf++].replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n'));generator='gridrefresh3';"; //201408251140
if (vVariable[a][102].equals("valueTooltip")){
listRefresh[i6]=listRefresh[i6]+"s0806=data[r][rf].replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n');";
listRefresh[i6]=listRefresh[i6]+"document.getElementById('"+vVariable[a][28]+"'+editRow).title =s0806;";
}
}
}
// grid.body.css
if (! vVariable[a][105].equals("")) { //redColorWhen thisValue=='R' | thisValue=='r'
listRefresh[i6]=listRefresh[i6]+"var thisValue=data[r][rf].replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n');";
listRefresh[i6]=listRefresh[i6]+"if("+vVariable[a][105]+"){document.getElementById('"+vVariable[a][28]+"'+editRow).style.fontWeight = '900';}";
listRefresh[i6]=listRefresh[i6]+"if("+vVariable[a][105]+"){document.getElementById('"+vVariable[a][28]+"'+editRow).style.color = 'rgb(255,0,0)';}"; // redcolor=rgb(255,0,0)
}

for (int iColor=1; iColor<10; iColor++){ //2014009051440 grid.body.css
if (! vVariable[a][110+iColor].equals("")) {

String gridBodyStyle[]=gridTextColor[iColor].split(";");

listRefresh[i6]=listRefresh[i6]+"var thisValue=data[r][rf].replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n');\n";

listRefresh[i6]=listRefresh[i6]+"if("+vVariable[a][110+iColor]+"){document.getElementById('"+vVariable[a][28]+"'+editRow).style.fontWeight = '"+gridBodyStyle[1]+"';}\n";

listRefresh[i6]=listRefresh[i6]+"if("+vVariable[a][110+iColor]+"){document.getElementById('"+vVariable[a][28]+"'+editRow).style.color = '"+gridBodyStyle[0]+"';}\n";
}
}

// grid.body.enableWhen
if (!vVariable[a][85].equals("")){  // grid.enable.when
String s811="";
s811=s811+"var l ; \n";
s811=s811+"setTimeout(function() {l=document.getElementById('"+vVariable[a][85]+"').checked;\n";
s811=s811+"var r811=0; \n";
s811=s811+"while (document.getElementById('"+vVariable[a][28]+"'+r811)){ \n";
s811=s811+"var l0=!l;document.getElementById('"+vVariable[a][28]+"'+r811).disabled=l0;r811++; \n"
+"}";
s811=s811+"\n";
s811=s811+ " },100);\n ";
listRefresh[i6]=listRefresh[i6]+s811;
}


if (!vVariable[a][108].equals("")){  // grid.readonly.when
String s811="";
s811=s811+"var l ; \n";
s811=s811+"setTimeout(function() {\n";
s811=s811+"l=document.getElementById('"+vVariable[a][108]+"').checked;\n";
s811=s811+"var r811=0; \n";
s811=s811+"while (document.getElementById('"+vVariable[a][28]+"'+r811)){ \n";
s811=s811+"var l0=!l;document.getElementById('"+vVariable[a][28]+"'+r811).readOnly=l0;r811++; \n";
s811=s811+"}";

s811=s811+"\n";
s811=s811+ " },100);\n ";
listRefresh[i6]=listRefresh[i6]+s811;
}

listDelimiter=","; //20130829
} ////////////////////////// end of create grid.data.refresh ////////////////////

//////////////////////////////
String s="''";
if (vVariable[a][6].equals("num")){s="'0'";} //20130830
if (vVariable[a][6].equals("num.1")){s="'0.0'";} //20130830
if (vVariable[a][6].equals("num.2")){s="'0.00'";} //20130830
if (vVariable[a][6].equals("num.3")){s="'0.000'";} //20130830
if (vVariable[a][6].equals("num.4")){s="'0.0000'";} //20130830
if (vVariable[a][6].equals("num.5")){s="'0.00000'";} //20130830
if (vVariable[a][6].equals("date") ){s="_today()";} //20130830
if (vVariable[a][41].trim().equals("today()")){
s="_today()"; //20140618
} else if (!vVariable[a][41].trim().equals("")){
s="'"+vVariable[a][41]+"'";
}

if (vVariable[a][6].equals("date") & vVariable[a][41].trim().equals("empty")){s="''";} //20140613
if (!(MODE.equals("LIST") | MODE.equals("CHOICE"))) {
defaults=defaults+"_refreshv2('"+vVariable[a][28]+"',"+s+"); \n /*201409291040*/"; // java.defaults 20130830
}
//////////////////
if (! vVariable[a][2].equals(g)){g=s1[1];gCount=1;}
vVariable[a][18]=Integer.toString(gCount++);

////////////////////

if ((spec.indexOf("{ }")>=0) || MODE.equals("SVIEW")) vVariable[a][40]="readonly";
setConstrain=setConstrain+vVariable[a][50];

if (vVariable[a][6].equals("textarea") || vVariable[a][6].equals("upload") ){
vVariable[a][48]=editTextAreaHeight; //20140408
vVariable[a][47]=editTextAreaWidth;
}

formInit=formInit+vVariable[a][64]+vVariable[a][95];

////////////////
for ( int i = 0; i < alistTables.length; i++){  //scanTable
if (alistTables[i][1].equals(vVariable[a][3])){
Double iNewGroupNo = new Double(vVariable[a][1]+"."+vVariable[a][2]);
String sID=Double.toString(iNewGroupNo);
sID=sID.replace(".","_");  
alistTables[i][0]=sID;
alistTables[i][2]=alistTables[i][2]+vVariable[a][75];
alistTables[i][4]=alistTables[i][4]+vVariable[a][89];
if (!vVariable[a][78].equals("")){  //[78] e.g. productsListOnly.txt
String s55=getKeyValueTemplate.replace("TABLE_ID",sID).replaceAll("this.id",vVariable[a][28]);
String akey[]=vVariable[a][78].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
s55=s55.replace(akeyValue[0].trim(),akeyValue[1].trim());
}
alistTables[i][2]=alistTables[i][2]+s55;
}
}
if (alistTables[i][1].equals(vVariable[a][89])){
alistTables[i][3]=vVariable[a][82];
}
}

/////////
if (selectTableName.equals("") && (!vVariable[a][3].equals("query"))){
selectTableName=vVariable[a][3];
}



if (selectTableName.equals(vVariable[a][3]) & (!vVariable[a][3].equals("query"))){

String s8=vVariable[a][4];
if(vVariable[a][6].equals("date") | vVariable[a][103].equals("tableIsDate")){
s8="if("+s8+"=`0000-00-00` or (isnull("+s8+")),STR_TO_DATE(`01/01/1753`, `^m/^d/^Y`),"+s8+")";
}
fields=fields+delimiter+s8; // creatingField
s8=null;
formats=formats+delimiter+"S";

}

/////////////////


if (spec.indexOf("{SumTotal}")>=0) {
String s57= xml.parser(spec,"SumTotal");
s57=s57.replaceAll("this.id",vVariable[a][28]);
s57=s57.replaceAll("this.",vVariable[a][3]);
vVariable[a][63]= s57;
}


//inkey


////////////
if (hasLabelFile==0){
Label[a]=raws[5];
if (Label[a].indexOf("YY")>=0){
Label[a]=vVariable[a][21]; //20131015
}
}



/////////


///Input[iInputCount]
if (spec.indexOf("{invisible}")>=0){
vVariable[a][31]="display:none;";
vVariable[a][45]="display:none;";
}

}

%>

<%!
// variable Gobal area java.gobal.varaible.setting

String documentStatus="P,Pending,D,Draft,A,Approved,C,Closed,R,Reject,r,Revoke,F,Frozen";
String [] gridTextColor=new String[10];


int createJavaScriptComboFunction=0;
int gCount=0;
int likeConstrainCount=0;
String PROCESSING_MODE="";
String enableWhen=""; //20140813
String autoFocus="";
String inkey="";
String selectTableName="";
String autoCompleteS="";
String [] retrievalBackString ;
String cInputCount="";
String TableNames="";
String clockRefresh="";


//String clockRefresh="if (printCaption0 & hadEdit==1){$('#printCaption0').hide();};";
String labelOndblclickAfter="";
String tableVariables="";
String formValidation="";
String gridValids="";
int hasLabelFile=0;
String keyValue="null" ;
String formats=""; // it is for update the database purpose
String masks="";
String valids="";
String delimiter="";
String fields=""; // it is for update the database purpose
String formInit=""; // for readonly field
String editTextAreaWidth="800";  // for line edit memo
String editTextAreaHeight="300"; // for line edit memo
String setConstrain="";
String g="";
int i6=0;
int[] retrievalFieldCounting ;
String defaults="";
String requiredLabelStyle="font-weight:bold;color:blue;";
String tableRule="0";
String DATABASE = "";
int iTableCount=0;
String MODE="";
String defaultSearch="";
String listDelimiter="";
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Calendar now = Calendar.getInstance();
int dayOfMonth = now.get(Calendar.DAY_OF_MONTH);
int month = now.get(Calendar.MONTH) + 1;
int year = now.get(Calendar.YEAR);
Date today = Calendar.getInstance().getTime();      
String reportDate = df.format(today);

private static class xml { //class.xml procedure xml()
// e.g. xml xml=new xml();
// e.g. String s0916=xml.parser("{1}aa{/1}","1");
public static String parser(String values, String key){
String result="";
if (values.indexOf("{/"+key+"}")>=0){
int b=values.indexOf("{"+key+"}");
int e=values.indexOf("{/"+key+"}");
result=values.substring(b+key.length()+2,e);
}
return result;
}
 }
%>
<%
if (bean.getDatabase() != null && !bean.getDatabase().equals("")){
DATABASE=bean.getDatabase();
}
if (DATABASE.equals("")) {
response.sendRedirect("timeOut.jsp");
}
%>

<%--  page contentType="text/html; charset=UTF-8" --%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%!
// java.template
//oBeijing



String XdowTemplate=""
+"var d=new Date(_lookup('this.id'));_refreshv2('this.id_dow',dow(d));d=null;";

String dowTemplate=""
+"var s=_lookup('this.id'); if (s && s!='empty'){var d=parseDate(s);_refreshv2('this.id_dow',dow(d));d=null;}";

String insertButtonTemplate=""
+"if (PROCESSING_MODE=='D'){$('button[buttonID=\"this.id\"]').css('display','inline')} else {$('button[buttonID=\"this.id\"]').css('display','none')}  ;";

String spaceLineTemplate="<tr style='height:10px;'><td colspan='6'></td></tr>";
String deleteReferentialIntegrityTemplate=""
+""
+"s= 'tableRead?table=SOURCE_TABLE&fields=SOURCE_NAME&key=SOURCE_CODE&value='+s10+'&format=S&callback=?&db='+DATABASE ;"
+"$.getJSON(s,function(data) {if (data[0]){   s= data[0][0];"
+"s='';"
+"var delimiter='';"
+"var i=0;"
+"for (i=0;i<data.length;i++){s=s+'<br>'+delimiter+data[i][0];delimiter=',';}"
+"s='ERR_MESS : '+s+'<br> Cannot be deleted !';"
+"$('#popup-wrapper').width('400').height(250+i*12).css({top: -250, left: -100, position:'absolute'});"
+"$('#popup-wrapper').resizable('disable').removeClass('ui-state-disabled');"
+"$('#moralFrame').prop('src','messageBox.jsp?message='+s+'&boxType=0&boxIcon=16');"
+"$('#clicker').click();canDelete=0;"
+"}"
+"}"
+");";

String gridFindValueTemplate=""
+"tableRead?table=SOURCE_TABLE&fields=RECORDID,SOURCE_NAME&where=where (SOURCE_CODE='+referRecordid+') &format=S,S&callback=?";


int runtime=0;

String findValueTemplate=""
+"s10=_lookup('this.id');"
+"if (s10){"
+"if (s10!=runtimeVariable"+runtime+"){"
+"runtimeVariable"+runtime+"=s10;"
+"s= 'tableRead?table=SOURCE_TABLE&fields=SOURCE_NAME&key=SOURCE_CODE&value='+s10+'&format=S&callback=?&db='+DATABASE ;"
+"$.getJSON(s,function(data) {if (data[0]){   s= data[0][0];"
  +"_refreshv2('this.idDisplay',s);}});"
+"s10='';s='';"
+"}"
+"}";

//dblclickSetData // getAddressPopup //grid.dblclick.getproduct
String dbClickSetKeyValueTemplate=" " //html.choice.ajax.popup //201408261035 choiceFormPosition
+"RetrievalStatus=0;currentChoose='';"
+"hadEdit=1; $('html, body').css('overflowY', 'hidden'); "
+"vformStatus='choicing';"
+"$('#popup-wrapper').css({width:$(window).width()*0.91, height:621, top: -101, left: 0, position:'absolute'});/*201409131130*/"
+"$('#moralFrame').prop('src',  'input.jsp?input=FORM.txt&config=FORMConfig.txt&mode=CHOICE');"
+"$('#clicker').click();";

String dbClickGetKeyValueTemplate0=" "
+"} else if (currentField=='this.id'){";
String dbClickGetKeyValueTemplate1=" "
+"s= 'tableRead?'+'db='+DATABASE+'&'"
+"+'table=SOURCE_TABLE&'+'fields=recordid,SOURCE_NAME,SOURCE_CODE&'+'key=recordID&value='+formResult+'&format=S,S,S&'+'callback=?';"
+"$.getJSON(s,function(data) {"
+"_refreshv2('this..TARGET_RECORDID'+currentRow,data[0][0]);"
+"_refreshv2('this..TARGET_NAME'+currentRow,data[0][1]);"
+"_refreshv2('this.id'+currentRow,data[0][2]);});";

String dbClickGetKeyValueTemplate1a=" " //20140818
+"s= 'tableRead?'+'db='+DATABASE+'&'"
+"+'table=SOURCE_TABLE&'+'fields=SOURCE_FIELD&'+'key=recordID&value='+formResult+'&format=SOURCE_FORMAT&'+'callback=?';"
+"\n$.getJSON(s,function(data) { TARGET_FIELD"
+"});/*2014081818*/\n";

//getProductPopup8102
String getKeyValueTemplate=""  //201408261035 choiceFormPosition
+"currentID='this.id'+currentRow;currentField='this.id';"
+"RetrievalStatus=0;currentChoose='';hadEdit=1;"
+"$('html, body').css('overflowY', 'hidden');"
+"vformStatus='choicing';"
+"$('#popup-wrapper').width($(window).width()*0.9).height(601).css({top: -100, left: 0, position:'absolute'});" //grid.choice.ajax.popup
+"$('#moralFrame').prop('src',  'input.jsp?input=FORM.txt&config=FORMConfig.txt&mode=CHOICE&choiceEvent=parent.tableNameTABLE_IDAppend();');"
+"$('#clicker').click();";

String autoCompleteTemplate=""+
""+
" TARGET='';"+
" S1= 'tableRead?'+"+
" 'db='+DATABASE+'&'+"+
" 'table=TABLE&'+"+
" 'fields=FIELD&'+"+
" 'format=S&'+"+
" 'where=where NOT RECORDID='+RECORDID+' &'+"+
" 'callback=?'; "+
" $.getJSON(S1, function (data) {if (data[0]){"+
" var array_=new Array();"+
" for (r=0 ; r<data.length; r++){"+
" array_[r]=data[r][0];"+
" }"+
" TARGET=array_;"+
" $('.TARGET').autocomplete({source: array_,"+
" minLength: 2"+
" })"+
" }});"+
";";



%>
<%
// java.variable.init java.init
for (int i = 0 ; gridTextColor.length<i; i++)
{
gridTextColor[i]="";
}
createJavaScriptComboFunction=0;
gridTextColor[0]="blue";
gridTextColor[1]="";
int numericMaskCount=0;
likeConstrainCount=0;
inkey="";
cInputCount="";
clockRefresh="";
enableWhen="";
labelOndblclickAfter="";
xml xml=new xml();
autoFocus="";
defaultSearch="";
String endofload=""; //201410091730
String LineInputTextHeight="20px"; //201409171730
String dummy0="forTestPurpose";
String selectedButtonCaption="null";
String orderBy="Recordid";
String parentRecordid="PARENT_RECORDID";
String gridAddButtonStyle="";
String gridDelButtonStyle="";
String containerStyle="";
String layoutDivWidth="100px";
String PropertyButton1Caption="";
String PropertyButton1Action="";
String [][] Input;
String [] Label;
String readonly="";
String template=null;
String renameFile="";
String choiceEvent="";
String timeOut="900";
String MessageControl="off";
String SaveButton1MessageControl="off";
String SaveButton2MessageControl="off";
String SaveButton3MessageControl="off";
String formHeaderTableProperties="";
String textInputHeight="20px";
String gridTableWidth="0.96";
String TitleColor="black";
PROCESSING_MODE="D";
editTextAreaWidth="800";  // for line edit memo
editTextAreaHeight="300"; // for line edit memo
tableVariables="";
String order=""; //20140606
autoCompleteS="";
String appendData0ModalWidth="900";
String appendData0ModalHeight="600";
String appendData0ModalTop="-100";
String appendData0ActionAfter="";
String aasdfdfs="",sadsdfdf="";
String colWidth1="15";String colWidth2="15"; String colWidth3="10"; String colWidth4="20"; String colWidth5="5";
String colWidth6="0";
String colWidth7="0";
String colWidth8="0";
String colWidth9="0";
String colWidth10="0";
String colWidth11="0";
String colWidth12="0";
String viewContentCtl="";
String printCaption0="",printCaption0ClickMethod="";
String appendData0HeaderSourceFormat="";
String appendData0HeaderTarget="",appendData0HeaderSource="";
String appendData0Caption="";
String [] pageColWidth=new String [10];
for (int i = 0 ;i< pageColWidth.length; i++) {pageColWidth[i]="2,20,2,2";}
String [] pageTableWidth=new String [10]; //201410101040
for (int i = 0 ;i< pageTableWidth.length; i++){pageTableWidth[i]="";} //201410101040
String appendData0Source="",appendData0TargetKey="";String appendData0="";
String Refresh="";String ApprovalStatus="";String formReadOnly="false";String formConstrain="";String SaveButton2CaptionColor="";
String formHeaderTableLayout="auto";String queryMode="and";String USER = bean.getAlias()+" "+bean.getLastName();
String USER_RECORDID=bean.getRecordid();
USER_RECORDID.replaceAll("\\;","");
String saveAction="ShowParameters?_database="+DATABASE+"&_user="+USER+"&_userRecordid="+USER_RECORDID;
String srcFolder=request.getContextPath();
String disableSessionReturn="false"; String invisibleCancelButton="false";
setConstrain="";
String notFoundAction=""; String SaveButton2ClickMethod=""; String SaveButton3ClickMethod="";
String SaveButton2ClickMethodAfterValidation="";
String SaveButton1Caption="Save"; String SaveButton2Caption=""; String SaveButton3Caption="";
String KEY1=""; String KEYVALUE1=""; String inputErrorColor="red";
String GridHeight="467px"; //160px 531PX 460
String BackHistoryButton="0";
String InputTextRadius="0px"; String PageFrameHeight="611px"; String file="ADDRESS";
String path = "/includes/"; String location = path+file+".jsp"; String masterTableName="";
selectTableName="";
String PageBackGroundColor="#e1e1e1";
String FormWidth="98%";  //  "920px"; ->98%  20140709
String LABEL_WIDTH="120px";
String BodyTopMargin="20px"; String LineSpacing="3px"; String Title="unTitled";
String PreviouField="null"; String nextField="null";
String FocusBackGroundColor="#ffd700"; // abcdef css.focus.backgroud
String GridRowHighLight="RGB(255,255,187)"; String [] GridStyle={"General","Detail"};
String [] PageHeaderCaption={"General","Detail"};
String FontSize="12px"; //css.fontsize
String EachLineHeight="5px";
String LabelFontSize="12px"; // "120%" -> 12px 20140709 ;
String key="" ;
keyValue="null" ;
fields=""; // it is for update the database purpose
defaults="";
formats=""; // it is for update the database purpose
masks="";
valids="";
formValidation="";
String retrievalField="";
gridValids="";
formInit=""; // for readonly field
String gridLeftOffset="0px"; String InvisibleRetrivalNumber="0";
String ListSubFormName=""; String ListSubFormConfig=""; String ListSubFormConfig0="dummy";
String InputTextHeight="24px"; // change from 20 to 24
String modalWidth=""; String modalHeight=""; String modalMode="SINPUT";
String where=""; String ListSubFormExtend="";
String ReadonlyCssStyle="color:black;";
int SetPageHeader=1; int SetGrid=1;   int iCreatingGrid=0; int SetBox=1;   int iCreatingBox=0;
MODE="INPUT";
defaultSearch="";
String inputFile=request.getParameter("input");
//from.parameter form.parameter
if (request.getParameter("defaultSearch") != null){defaultSearch=request.getParameter("defaultSearch");}
if (request.getParameter("choiceEvent") != null){choiceEvent=request.getParameter("choiceEvent");}
if (request.getParameter("mode") == null) {} else {MODE=request.getParameter("mode");}
if (request.getParameter("key") != null) {key=request.getParameter("key");}
if (request.getParameter("keyValue") != null) {keyValue=request.getParameter("keyValue");}

if (MODE.equals("LIST"))GridHeight="531px";

%>
<!------------------------------------------------------Initial Setting----------->
<%@ page errorPage="timeOut.jsp" %>
<%@ page import="java.io.*"%>
<%----005.0------------------------------------------------------------specification--------parse.input.txt--%>

<%

try {
String labelFile=null;
String configFile="dummy";
String configFile0="dummy";
String [] configFiles=new String [2];
hasLabelFile=0;
File fileDir=null;
BufferedReader b =null;
String str;
String InputsFileName=srcFolder+"/"+inputFile;
fileDir = null;
fileDir = new File(InputsFileName);
b = null;
b = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
int iInputCount=0;
str=null;
valids="$('#inputForm').validate({rules: { " ; // ... })
delimiter="";
iTableCount=0;

//***************************************************************** getTableNames *****************
TableNames="";
String allStr="";
while ((str = b.readLine()) != null)
{
str = str.replaceAll("\t", ""); // 20140724
str = str.replaceAll("\n", "");  // 20140724
allStr=allStr+str;
}
if (allStr.indexOf("{object}")>=0 & 1==1){
String s73=allStr;
String a73[] = s73.split("\\{object\\}");
Integer i74=0;
Integer L73=0;
if (a73.length>0){
for (int i73=0;i73<a73.length-1;i73++){
int b73=s73.indexOf("{object}",i74);
int e73=s73.indexOf("{/object}",i74+8+L73);
str=s73.substring(b73+8,e73);
L73=e73-b73;
i74=b73+1;
//out.println(str);
String s20=str.substring(0,1);
if ((! s20.equals("#")) && (!s20.equals(""))  && (! str.trim().equals("")) & str.length()>=2) {
++iInputCount;
String raws[] = str.split(",");
String tfvd[]=raws[1].split(":");
String s2[]=tfvd[0].split("\\.");
String s=","+TableNames+",";
if (s.indexOf(","+s2[0]+",")<0){
TableNames=TableNames+delimiter+s2[0];
delimiter=",";
iTableCount++;
}
}
}
}
} else {
b = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
while (((str = b.readLine()) != null) ) {
if (str.length()>0){
String s20=str.substring(0,1);
if ((! s20.equals("#")) && (!s20.equals(""))  && (! str.trim().equals("")) & str.length()>=2   ) {
++iInputCount;
String raws[] = str.split(",");
String tfvd[]=raws[1].split(":");
String s2[]=tfvd[0].split("\\.");
String s=","+TableNames+",";
if (s.indexOf(","+s2[0]+",")<0){
TableNames=TableNames+delimiter+s2[0];
delimiter=",";
iTableCount++;
}
}
}
}
}


//out.println(TableNames);



//String[] aTableNames;

String aTableNames[] = TableNames.split(",");
delimiter="";
String [] listFields ;
String [] listRefresh ; //   _refreshv2()
String [] listFormats ; //   e.g. s,s,s,s
String [] listTables  ; // e.g. 0_361
String [][] alistTables  ; // e.g. 0_361
String [] sqlTableName  ; // e.g. po

retrievalBackString    = new String[iTableCount];
retrievalFieldCounting = new int[iTableCount];
listRefresh = new String[iTableCount];
listFormats = new String[iTableCount];
listFields  = new String[iTableCount];
listTables  = new String[iTableCount];
alistTables  = new String[iTableCount][];

sqlTableName= new String[iTableCount];
for (int i=0;i<iTableCount; i++){
retrievalBackString[i]="";
listRefresh[i]="";
listTables[i]="";
alistTables[i]=new String[5];
alistTables[i][0]="";
alistTables[i][1]= aTableNames[i] ;
alistTables[i][2]="";
alistTables[i][3]="";
alistTables[i][4]="";
//out.println(alistTables[i][1]);
retrievalFieldCounting[i]=0;
listFormats[i]="";
listFields[i]="";
sqlTableName[i]="";
}



labelFile=request.getParameter("label");
String FileName="/usr/local/apache-tomcat-7.0.37/webapps/Test/"+labelFile;

////////////config.sys////////////////////java.config///////configfile//////config.txt//////////////parse.config/////// user CONFIG SETTING /////
//read.styleFile
fileDir=null;
configFile=request.getParameter("config");
if (request.getParameter("config0") !=null )configFile0=request.getParameter("config0");
configFiles[0]=configFile0;
configFiles[1]=configFile;
for (int i71 = 0 ; i71<configFiles.length; i71++){
FileName=srcFolder+"/"+configFiles[i71];
fileDir = new File(FileName);
//20140430 PageHeaderCaption[0]="XXX2"+fileDir;
Title=fileDir +"Not Found ";
if(fileDir.exists())
{


String configStr=""; //201409151600
BufferedReader in0 =null; //201409151600
in0 = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8")); //201409151600
while ((str = in0.readLine()) != null) configStr=configStr+str.replaceAll("\t", "").replaceAll("\n", ""); //201409151600


BufferedReader in =null;
in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
int iLabelCount=0;
while ((str = in.readLine()) != null)
{
String s[] = str.split("\\=");
String connectionURL = "jdbc:mysql://localhost/"+DATABASE+"?useUnicode=true&characterEncoding=UTF8";
String mActive="";
String mLeave="";
if (s[0].equals("template")){template=s[1];}
if (s[0].equals("template")){template=s[1];}
if (s[0].equals("template")){template=s[1];}
if (s[0].equals("template")){template=s[1];}


if (s[0].equals("LineInputTextHeight")){LineInputTextHeight=s[1];}
if (s[0].indexOf("{appendData0}")>=0) appendData0= xml.parser(configStr,"appendData0"); //201409151600
if (s[0].equals("viewContentCtl")){viewContentCtl=s[1];}
viewContentCtl=viewContentCtl.replaceAll(":","=");
if (s[0].equals("selectedButtonCaption")){selectedButtonCaption=s[1];} //201409081640
if (s[0].equals("gridTextColor9")){gridTextColor[9]=s[1];} //2014109051440
if (s[0].equals("gridTextColor8")){gridTextColor[8]=s[1];} //2014109051440
if (s[0].equals("gridTextColor7")){gridTextColor[7]=s[1];} //2014109051440
if (s[0].equals("gridTextColor6")){gridTextColor[6]=s[1];} //2014109051440
if (s[0].equals("gridTextColor5")){gridTextColor[5]=s[1];} //2014109051440
if (s[0].equals("gridTextColor4")){gridTextColor[4]=s[1];} //2014109051440
if (s[0].equals("gridTextColor3")){gridTextColor[3]=s[1];} //2014109051440
if (s[0].equals("gridTextColor2")){gridTextColor[2]=s[1];} //2014109051440
if (s[0].equals("gridTextColor1")){gridTextColor[1]=s[1];} //gridTextColor1=green
if (s[0].equals("gridTextColor0")){gridTextColor[0]=s[1];} //2014109051440
if (s[0].equals("orderBy")){orderBy=s[1];}
if (s[0].equals("parentRecordid")){parentRecordid=s[1];}
if (s[0].equals("gridDelButtonStyle")){gridDelButtonStyle=s[1];}
if (s[0].equals("gridAddButtonStyle")){gridAddButtonStyle=s[1];}

if (s[0].equals("containerStyle")){containerStyle=s[1];}

if (s[0].equals("layoutDivWidth")){layoutDivWidth=s[1];}
if (s[0].equals("PropertyButton1Action")){PropertyButton1Action=s[1];}
PropertyButton1Action=PropertyButton1Action.replaceAll(":","=");
PropertyButton1Action=PropertyButton1Action.replaceAll("--",":");
if (s[0].equals("PropertyButton1Caption")){PropertyButton1Caption=s[1];}

if (s[0].equals("SaveButton1MessageControl")){SaveButton1MessageControl=s[1];}
if (s[0].equals("SaveButton2MessageControl")){SaveButton2MessageControl=s[1];}
if (s[0].equals("SaveButton3MessageControl")){SaveButton3MessageControl=s[1];}
if (s[0].equals("MessageControl")){MessageControl=s[1];}
if (s[0].equals("formHeaderTableProperties")){formHeaderTableProperties=s[1];}
if (s[0].equals("gridTableWidth")){gridTableWidth=s[1];}
if (s[0].equals("appendData0ModalWidth")){appendData0ModalWidth=s[1];}
if (s[0].equals("appendData0ModalHeight")){appendData0ModalHeight=s[1];}
if (s[0].equals("appendData0ModalTop")){appendData0ModalTop=s[1];}
if (s[0].equals("appendData0ActionAfter")){appendData0ActionAfter=s[1];}  //20140321
appendData0ActionAfter=appendData0ActionAfter.replaceAll(":","=");
formHeaderTableProperties=formHeaderTableProperties.replaceAll(":","=");
if (s[0].equals("Page1ColWidth")){pageColWidth[1]=s[1];}
if (s[0].equals("Page2ColWidth")){pageColWidth[2]=s[1];}
if (s[0].equals("Page3ColWidth")){pageColWidth[3]=s[1];}
if (s[0].equals("Page4ColWidth")){pageColWidth[4]=s[1];}
if (s[0].equals("Page5ColWidth")){pageColWidth[5]=s[1];}
if (s[0].equals("Page6ColWidth")){pageColWidth[6]=s[1];}
if (s[0].equals("Page7ColWidth")){pageColWidth[7]=s[1];}
if (s[0].equals("Page8ColWidth")){pageColWidth[8]=s[1];}
if (s[0].equals("Page9ColWidth")){pageColWidth[9]=s[1];}
if (s[0].equals("Page1TableWidth")){pageTableWidth[1]=s[1];}
if (s[0].equals("Page2TableWidth")){pageTableWidth[2]=s[1];}
if (s[0].equals("Page3TableWidth")){pageTableWidth[3]=s[1];}
if (s[0].equals("Page4TableWidth")){pageTableWidth[4]=s[1];}
if (s[0].equals("Page5TableWidth")){pageTableWidth[5]=s[1];}
if (s[0].equals("Page6TableWidth")){pageTableWidth[6]=s[1];}
if (s[0].equals("Page7TableWidth")){pageTableWidth[7]=s[1];}
if (s[0].equals("Page8TableWidth")){pageTableWidth[8]=s[1];}
if (s[0].equals("Page9TableWidth")){pageTableWidth[9]=s[1];}

if (s[0].equals("PROCESSING_MODE")){PROCESSING_MODE=s[1];}
if (s[0].equals("PM")){PROCESSING_MODE=s[1];}
if (s[0].equals("colWidth1")){colWidth1=s[1];}
if (s[0].equals("colWidth2")){colWidth2=s[1];}
if (s[0].equals("colWidth3")){colWidth3=s[1];}
if (s[0].equals("colWidth4")){colWidth4=s[1];}
if (s[0].equals("colWidth5")){colWidth5=s[1];}
if (s[0].equals("colWidth6")){colWidth6=s[1];}
if (s[0].equals("colWidth7")){colWidth7=s[1];}
if (s[0].equals("colWidth8")){colWidth8=s[1];}
if (s[0].equals("colWidth9")){colWidth9=s[1];}
if (s[0].equals("colWidth10")){colWidth10=s[1];}
if (s[0].equals("colWidth11")){colWidth11=s[1];}
if (s[0].equals("colWidth12")){colWidth12=s[1];}
if (s[0].equals("printCaption0ClickMethod")){printCaption0ClickMethod=s[1];}
printCaption0ClickMethod=printCaption0ClickMethod.replaceAll(":","=");
if (s[0].equals("printCaption0")){printCaption0=s[1];}
if (s[0].equals("appendData0HeaderSourceFormat")){appendData0HeaderSourceFormat=s[1];}

if (s[0].equals("appendData0HeaderTarget")){appendData0HeaderTarget=s[1];}
if (s[0].indexOf("{appendData0HeaderTarget}")>=0) appendData0HeaderTarget= xml.parser(configStr,"appendData0HeaderTarget"); //201409151600

if (s[0].equals("appendData0HeaderSource")){appendData0HeaderSource=s[1];}
if (s[0].indexOf("{appendData0HeaderSource}")>=0) appendData0HeaderSource= xml.parser(configStr,"appendData0HeaderSource");


if (s[0].equals("appendData0Caption")){appendData0Caption=s[1];}
if (s[0].equals("appendData0")){appendData0=s[1];}appendData0=appendData0.replaceAll(":","=");
appendData0=appendData0.replaceAll("SEARCH","defaultSearch="+defaultSearch);
if (s[0].equals("appendData0Source")){appendData0Source=s[1];}
if (s[0].equals("appendData0TargetKey")){appendData0TargetKey=s[1];}

if (s[0].indexOf("{refresh}")>=0) Refresh= xml.parser(configStr,"refresh");
if (s[0].indexOf("{Refresh}")>=0) Refresh= xml.parser(configStr,"Refresh");
if (s[0].equals("Refresh")){Refresh=s[1];}

if (s[0].indexOf("{Refresh}")>=0) Refresh= xml.parser(configStr,"Refresh"); //201409151600
Refresh=Refresh.replaceAll(":","=");


if (s[0].equals("ApprovalStatus")){ApprovalStatus=s[1];}
if (s[0].equals("formReadOnly")){formReadOnly=s[1].replace(":","=");} // form.status.control
if (s[0].equals("formConstrain")){formConstrain=s[1];}
if (s[0].equals("SaveButton2CaptionColor")){SaveButton2CaptionColor=s[1];}
if (s[0].equals("formHeaderTableLayout")){formHeaderTableLayout=s[1];}
if (s[0].equals("queryMode")){queryMode=s[1];}
if (s[0].equals("saveAction")){saveAction=s[1];}
if (s[0].equals("disableSessionReturn")){disableSessionReturn=s[1];}
if (s[0].equals("invisibleCancelButton")){invisibleCancelButton=s[1];}
if (s[0].equals("notFoundAction")){notFoundAction=s[1];}
if (s[0].equals("modalMode")){modalMode=s[1];}
if (s[0].equals("ListSubFormExtend")){ListSubFormExtend=s[1];}
ListSubFormExtend=ListSubFormExtend.replace(":", "=");
if (s[0].equals("ReadonlyCssStyle")){ReadonlyCssStyle=s[1];}
if (s[0].equals("SaveButton2ClickMethod")){SaveButton2ClickMethod=s[1].replaceAll(":","=");}
if (s[0].equals("SaveButton2ClickMethodAfterValidation")){SaveButton2ClickMethodAfterValidation=s[1].replaceAll(":","=");}
if (s[0].equals("SaveButton3ClickMethod")){SaveButton3ClickMethod=s[1].replaceAll(":","=");}
if (s[0].equals("where")){where=s[1];}
if (s[0].equals("modalWidth")){modalWidth=s[1];}
if (s[0].equals("modalHeight")){modalHeight=s[1];}
if (s[0].equals("GridHeight")){GridHeight=s[1];}
if (s[0].equals("EachLineHeight")){EachLineHeight=s[1];}
if (s[0].equals("PageFrameHeight")){PageFrameHeight=s[1];}
if (s[0].equals("PageBackGroundColor")){PageBackGroundColor=s[1];}
if (s[0].equals("FormWidth")){FormWidth=s[1];}
if (s[0].equals("FontSize")){FontSize=s[1];}
if (s[0].equals("LABEL_WIDTH")){LABEL_WIDTH=s[1];}
if (s[0].equals("BodyTopMargin")){BodyTopMargin=s[1];}
if (s[0].equals("LineSpacing")){LineSpacing=s[1];}
if (s[0].equals("InputTextRadius")){InputTextRadius=s[1];}
if (s[0].equals("BackHistoryButton")){BackHistoryButton=s[1];}
if (s[0].equals("GridRowHighLight")){GridRowHighLight=s[1];}
if (s[0].equals("SaveButton2Caption")){SaveButton2Caption=s[1];}
if (s[0].equals("SaveButton3Caption")){SaveButton3Caption=s[1];}
if (s[0].equals("SaveButton1Caption")){SaveButton1Caption=s[1];}
if (s[0].equals("Title")){Title=s[1];}
if (Title.equals("Create")){Title="Are you sure to create ?";}
if (Title.indexOf("S. O.")>=0 | Title.indexOf("Sales Order")>=0) {
TitleColor="SlateBlue";  //hardcode or default
} else if (Title.indexOf("D Notes")>=0 | Title.indexOf("D. Notes")>=0 | Title.indexOf("Delivery Note")>=0 ){
TitleColor="DodgerBlue";

} else if (Title.indexOf("P.O.")>=0 | Title.indexOf("Purchase Order")>=0){
TitleColor="Purple";
}else if (Title.indexOf("GRN")>=0 | Title.indexOf("Good Received Note")>=0){
TitleColor="Green";
} else if (Title.indexOf("Supplier Invoice")>=0 | Title.indexOf("Sinvoice")>=0){
TitleColor="SlateGray";
}  else if (Title.indexOf("Payment")>=0 | Title.indexOf("payment")>=0){
TitleColor="Peru";
} else if (Title.indexOf("Receipt")>=0 | Title.indexOf("receipt")>=0 | Title.indexOf("Customer Payment")>=0  ){

TitleColor="RosyBrown";
} else if (Title.indexOf("Customer Invoice")>=0 | Title.indexOf("Customer Invoice")>=0){
TitleColor="Chocolate";
}  else if (Title.indexOf("Customer")>=0 | Title.indexOf("CUSTOMER")>=0){
TitleColor="#FF00FF";
} else if (Title.indexOf("Supplier")>=0 | Title.indexOf("SUPPLIER")>=0){
TitleColor="SeaGreen";
} else if (Title.indexOf("Product")>=0 | Title.indexOf("PRODUCT")>=0){
TitleColor="PaleVioletRed";
}  
if (s[0].equals("key")){KEY1=s[1];}

if (s[0].equals("keyValue")){
keyValue=s[1];
if  (keyValue.indexOf("session")>=0) {
String s6[] = keyValue.split(":");
String s6a=s6[1].replace("\"","");
String s6b = (String)session.getAttribute("EmployeeRecordID");
keyValue=s6b;
}
}
if (s[0].equals("keyValue")){KEYVALUE1=s[1];}
if (s[0].equals("InputTextHeight")){InputTextHeight=s[1];}
if (s[0].equals("InvisibleRetrivalNumber")){InvisibleRetrivalNumber=s[1];}
if (s[0].equals("ListSubFormName")){ListSubFormName=s[1];}
if (s[0].equals("ListSubFormConfig0")){ListSubFormConfig0=s[1];}
if (s[0].equals("ListSubFormConfig")){ListSubFormConfig=s[1];}
if ((MODE.equals("SINPUT") | MODE.equals("MINPUT")) || MODE.equals("SVIEW") ){key="recordID";}
if (s[0].equals("PageHeaderCaption")){String t[]=s[1].split(",");PageHeaderCaption=t;}
if (s[0].equals("GridStyle")){String t[]=s[1].split(",");GridStyle=t;}
if (s[0].equals("LabelFontSize")){LabelFontSize=s[1];}
if (s[0].equals("key")){key=s[1];}
if (s[0].equals("key")){key=s[1];}
}
in.close();
if (MODE.equals("INPUT")){gridLeftOffset="13px";}
if (session.isNew() || session.getAttribute("Login") == null ){
if (disableSessionReturn.equals("false")){
response.sendRedirect("timeOut.jsp");
}
}
}
}

////////////////////
//read.layoutFile //
////////////////////
String listTableSid="";
Input=new String[iInputCount][];
Label=new String[iInputCount];
b = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
iInputCount=0;
delimiter="";
listDelimiter="";
String validDelimiter="";
cInputCount="";
g="";
gCount=0;
if (allStr.indexOf("{object}")>=0){
if (! allStr.equals("")){
String s73=allStr;
String a73[] = s73.split("\\{object\\}");
Integer i74=0;
Integer L73=0;
if (a73.length>0){
for (int i73=0;i73<a73.length-1;i73++){
int b73=s73.indexOf("{object}",i74);
int e73=s73.indexOf("{/object}",i74+8+L73);
str=s73.substring(b73+8,e73);
updateInput(Input,iInputCount,str,aTableNames,listRefresh,listFields,listFormats,alistTables,Label);
delimiter=",";
iInputCount++;
L73=e73-b73;
i74=b73+1;
}
}
}
} else {
b = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
while ((str = b.readLine()) != null)
{
String s20="";
if (str.length()>0) s20=str.substring(0,1);
if ((str.length()>0) && (! s20.equals("#")) && (!str.equals(""))   )
{
updateInput(Input,iInputCount,str,aTableNames,listRefresh,listFields,listFormats,alistTables,Label);
//if ((MODE.equals("LIST") | MODE.equals("CHOICE"))){FocusBackGroundColor=GridRowHighLight;}
delimiter=",";
iInputCount++;
} //endif ((str.length()>0) && (! s20.equals("#")) && (!str.equals(""))   )
} //endofwhile eofwhile ((str = b.readLine()) != null)
}

fields=fields+",recordID";
formats=formats+",S";
valids=valids+"}}); //endOfValids";

String u="";
int k=0;
for ( int i = 0; i < Input.length; i++){
if (i<Input.length-1){
Input[i][29]=Input[i][28];
for (int j=i+1;j<Input.length;j++){
if (Input[j][6].equals("text") || Input[j][6].equals("autocomplete") || Input[j][6].equals("date") ||
Input[j][6].equals("num.2") || Input[j][6].equals("num") ||
Input[j][6].equals("combo")  || Input[j][6].equals("check") ){
Input[i][29]=Input[j][28];
break;}
}
}
if (i>0){Input[i][27]=Input[i-1][28];}
if((Input[i][7]).equals("GRID") && !Input[i][11].equals(u)){u=Input[i][11];
Input[i][13]=Integer.toString(++k) ;
}
}
u="";
b.close();

clockRefresh=clockRefresh+Refresh; //clockRefresh.define
delimiter="";
for (int i=0; i<Input.length; i++) {
if (! Input[i][83].equals("")) {
renameFile=renameFile+delimiter+Input[i][83];
delimiter=",";
}
}

for (int i=0; i<Input.length; i++) {  //readonly.define
if ((! Input[i][87].equals(""))) {
String s58="";
s58="if(event.keyCode == "+Input[i][87]+") {event.preventDefault(); $('."+Input[i][28].replace(".","_")+"').click();}";
inkey=inkey+s58;
}
if ((! Input[i][40].equals(""))){
readonly=readonly+"$('#"+Input[i][28]+"').attr('readonly',true);";
}
}

for (int i=0; i<Input.length; i++) {



if (Input[i][41].equals("defaultSearch")){Input[i][41]=defaultSearch;}  //20140910


if ((!Input[i][92].equals("")) & (!Input[i][7].equals("GRID"))) {
String s=findValueTemplate;
runtime++;
s=s.replaceAll("this.id",Input[i][28]);
s=s.replaceAll("this.",Input[i][3]);
String akey[]=Input[i][92].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
s=s.replace(akeyValue[0].trim(),akeyValue[1].trim());
}
clockRefresh=clockRefresh+s;
}
labelOndblclickAfter=labelOndblclickAfter+Input[i][66]; //labeldblclick.define
if (!Input[i][79].equals("")){
String s=dbClickGetKeyValueTemplate0+dbClickGetKeyValueTemplate1a; //20140818
s=s.replaceAll("this.id",Input[i][28]);
s=s.replaceAll("this.",Input[i][3]);
String akey[]=Input[i][79].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
if (akeyValue[0].trim().equals("TARGET_FIELD")) {
String akey2[]=akeyValue[1].split("&");
String updates_="";
for (int i92=0;i92<akey2.length;i92++){
updates_=updates_+"_refreshv2('"+akey2[i92]+"'+currentRow,data[0]["+i92+"].replace(/<z><z>/g, '\\n'));\n";
}
akeyValue[1]=updates_;

if (!Input[i][89].equals("")){
updates_=updates_.replaceAll(Input[i][3],Input[i][89]);
akeyValue[1]=akeyValue[1]+updates_;
}
}
s=s.replace(akeyValue[0].trim(),akeyValue[1].trim().replaceAll("&",","));
}
labelOndblclickAfter=labelOndblclickAfter+s;
}
}


delimiter="";


if (1==4){
for (int i=0; i<listFields.length; i++) {
out.println(listFields[i]+"\n<br>");
}
}

if (1==3){ // list alistTables
for (int i=0; i<alistTables.length; i++) {
out.println("{"+i+"}");
for (int j=0; j<alistTables[i].length; j++){
out.println("["+j+"]\n");

out.println(alistTables[i][j]+"\n<br>");
}
out.println("<BR/><br/>");
}

}

if (1==2){ // list userSettingByArrayo
out.println(dummy0);
out.println("MODE :"+MODE);
out.println("userSettingByArray");
for (int i=0; i<Input.length; i++) {
out.println("{"+i+"}");
for (int j=1; j<Input[i].length; j++){
if (j==124){

/*
String s0807=gridFindValueTemplate;
String akey[]=Input[i][j].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue8[]=akey[i9].split("=");
String source_="";
String target_="";
for (int i90=0;i90<akeyValue8.length;i90++){
out.println(akeyValue8[i90].trim()+" "+i9);
if (i90==1) source_=akeyValue8[i90].trim();
if (i90==2) target_=akeyValue8[i90].trim();
}
//out.println(akeyValue8[1]);
//out.println(akeyValue8[1]+" "+i9);
//out.println(akeyValue[1].trim());
s0807=s0807.replace(source_,target_);
out.println(s0807);
}
*/



out.println("["+j+"]");

out.println(Input[i][j]);
}
}
out.println("<BR/><br/>");
}
out.println(" clock Refresh : "+clockRefresh);
}
if (PROCESSING_MODE.equals("D")) clockRefresh=clockRefresh+enableWhen;
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page errorPage="timeOut.jsp" %>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<!-- META http-equiv="refresh" content="5;URL=http://www.indiana.edu/~account/new-directory" -->

<script src="js/JavaScriptUtil.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<link href="css/modalPopLite.css" rel="stylesheet" type="text/css" />
<script src="js/modalPopLite.js" type="text/javascript"></script>
<script src="js/Parsers.js"></script>
<script src="js/InputMask.js"></script>
<script src="input.js"></script>
<script src="js/udf2.js"></script>
<script type="text/javascript" src="js/jquery.alphanumeric.pack.js"></script>
<script src="js/jquery.validate.js"></script>
<script src="js/bootstrap.min.js"></script> <!--20140609-->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" >

<!--------------------javascript.variable------------------------------constructor----------->
var finishedOfLoad=0;
var reccount='';
var messageBoxCaption=''; //201409230945
var fieldEditBegin=0;
var hadEditShould=0;
var ROLE='<%=bean.getRole()%>';
var defaultSearch='<%=defaultSearch%>'; //20140915
var DISK_DOC_STATUS='';
var windows = new Array(100);
var errortxt="";
var _top=20;
var _left=20 ;
var parameters = "";
var MESSAGEBOX_HEIGHT=210;
var documentCompanyPrefix='<%=bean.getCompanyPrefix()%>';
var PROCESSING_MODE='<%=PROCESSING_MODE%>';
var numWindows = 0;var windows = new Array(100);var _top=20;var _left=20 ;var parameters = "";
var browserLevel=0;
var upperField=""; var nextField=""; var enterField=""; var firstField="";  var thisID;
var prevField=""; var lowerField="";
var thisRowNo=0;
var ActivePage = 0;
var documentAction='';
var thisDBFName="";
var runtimeVariable0='';
var runtimeVariable1='';
var runtimeVariable2='';
var runtimeVariable3='';
var runtimeVariable4='';
var runtimeVariable5='';
var runtimeVariable6='';
var runtimeVariable7='';
var runtimeVariable8='';
var runtimeVariable9='';
var runtimeVariable10='';
var runtimeVariable11='';
var _row='';
var _col='';
var thisTable='';
var _setFocus='';
var messageRecordID=parent.parent.RECORDID;
var vformStatus='';
var SaveButton1MessageControl='off';
var SaveButton2MessageControl='off';
var SaveButton3MessageControl='off';
var _c0='';
var timeOut=<%=timeOut%>;
var newAdd=0;
var afterUpdate='';
var saveAction='';
var currentTable="";
var currentRow="";
var currentEntity="";
var currentCurrency="";
var currentID="";
var currentField="";
var currentChoose="";  //SELECT SUPPLIER FROM SOQTYOS WHERE  ! FIND_IN_SET(TRIM(SUPPLIER),'1394705940696,232') >0;
var formResult="";
var newValue="";
var oldValue="";
var hadEdit=0;
var uploadTempFile="";
var MODE="<%=MODE%>";
var thisRowNo=0;
var limit=25; //201401301541
var offset=0;  //201401301541
var lastOffset=0;
var ascDesc="asc";
var latestOrderBy="";
var WINDOW_HEIGHT = $(window).height();
var WINDOW_WIDTH = $(window).width();
$.validator.setDefaults({
submitHandler: function()
{
$("#inputForm").submit();
}
});
var formRefresh=0;
var RetrievalStatus=0;
var RECORDID='TESTING';
var DOCUMENT=''
var DATABASE='<%=DATABASE%>';
var COMPANYID='<%=bean.getCompanyProfileRecordid()%>';
var USER=" <%=bean.getAlias()%> <%=bean.getLastName()%>";
var USER_RECORDID=" <%=bean.getRecordid()%>";
var LOGINID=" <%=bean.getLoginId()%>";
var DATE = new Date();
var YEAR = DATE.getFullYear();
var MONTH = DATE.getMonth();
var DAY = DATE.getDay();
var saving=0;
var editingRow=0;
var Xdata=new Array(100);
var decimalSeparator = ".";
var groupSeparator = ",";
var gRowNo;
var keyValue="";
var _VALUES="scty_code,side,order_type,short_sell,comment,channel,ac_code,confirm_flag,price,qty,all_or_nothing,odd_lot"
var _VALID="scty_code,side,order_type,channel,price,qty,all_or_nothing,odd_lot"
var S_post="";
</script><script> //<-- it is must
<%=tableVariables%>
</script>
<!------------------------------------------css.setting.css---------------------------------------------STYLESHEETS--------->
<title><%=Title%></title>
<link href="css/pagetab.css" rel="stylesheet" type="text/css" />
<link href="input.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />


<style type="text/css"> <!--css.setting-->
ul.tabs li {background: <%=PageBackGroundColor%>;}
div.tab_container {height: <%=PageFrameHeight%>;background-color:<%=PageBackGroundColor%>;}
ul.tabs li.active  {height:30px; margin-bottom:-20px; background: <%=PageBackGroundColor%>;border-bottom: 3px solid <%=PageBackGroundColor%>;}
ul.tabs li.active a:hover {background:<%=PageBackGroundColor%>;}
#container {width: <%=FormWidth%>; margin: auto;}

</style>


</head>
<!------------html body----------------------------------------HTML.Body-------------->
<body style="display:none; min-height: 100%;" ondrop="return false;"
onmousemove="timeOut=900;"
onkeypress="timeOut=900;">
<a name="top_" id="top_"></a><!--20140716-->
<div id="dialog-confirm"></div>
<div id="clicker"></div><!--201408281040-->
<div id="popup-wrapper"  draggable="true"
style="display:block; height:0px; position:relative; left:1px; top:0px; border:0px solid black;">
<iframe generator="input_iframe" width="100%" height="100%"
style="overflow:hidden;"
name="moralFrame" id="moralFrame"
src=""
frameborder="0" >
</iframe>
<a href="#" id="close-btn" style="display:none;">Close</a>
</div>


<div id="divFormCaption" style="margin:0;height:24px;
padding-top:2px; color:white; border: 1px white solid;
padding-bottom:0px; margin-bottom:0;" class="formHeadCaptionBackground" >


<input
id="idFormCaption"
style="float:left; color:<%=TitleColor%>; font-weight: bold;"
class="idformCaption"
type="text" disabled="disabled" value="<%=Title%>"
/>
<!--form.caption form.title-->

<% if(BackHistoryButton.equals("1")) {%>
<INPUT style="float:right; margin-right:3px;" class="ExitButton"
Type="button" VALUE="X" onClick="history.go(-1);return true;">
<%}%>


<div><!--clock.bar--><!--caption.line--><!--clock.caption.line clockCaption-->
<!-- input id="clock" style="float:right;  
<%if (MODE.equals("CHOICE") | MODE.equals("MINPUT")){out.println("display:none;");}%>
margin-right:6px; padding-right:0px; border-left: solid 1px black;
text-align:right;"
class="formCaption" type="text"   disabled="disabled"     value=""   name="clock"  
/ --><!--bar.clock-->

<span id='clockHtml'style="float:right;  
<%if (MODE.equals("CHOICE") | MODE.equals("MINPUT")){out.println("display:none;");}%>
margin-right:6px; padding-right:0px; border-left: solid 1px black;
text-align:right; color:black;"
padd
class="formCaption">
</span>

<span style="display:inline;width:auto;max-width:100px;
<%if (MODE.equals("CHOICE") | MODE.equals("MINPUT")){out.println("display:none;");}%>
padding-left:5px; float:right; margin-right:6px;
border-left: solid 1px black; color:black;"
class="formCaption">
<%=year%>-<%if(month<10){out.println("0");}%><%=month%>-<%if(dayOfMonth<10){out.println("0");}%><%=dayOfMonth%>
</span>


<!-- input id="date" name="date"
style="display:inline;width:auto;max-width:100px;
<%if (MODE.equals("CHOICE") | MODE.equals("MINPUT")){out.println("display:none;");}%>
padding-left:5px; float:right; margin-right:6px;
border-left: solid 1px black;"
class="formCaption"
type="text"
disabled="disabled"
value="<%=year%>-<%if(month<10){out.println("0");}%><%=month%>-<%if(dayOfMonth<10){out.println("0");}%><%=dayOfMonth%>"
/ --><!--bar.date-->


<input id="timeOut" style="display:none; width:4%; float:right; <%if (MODE.equals("CHOICE")){out.println("display:none;");}/*20140225*/%>
margin-right:6px; padding-right:0px; border-left: solid 1px black; text-align:right"
class="formCaption"   type="text"   disabled="disabled"     value=""   name="timeOut"
/><!--bar.timeout.bar-->

<input id="formWidth" style="display:none; width:4%; float:right;
margin-right:6px; padding-right:0px; border-left: solid 1px black; text-align:right"
class="formCaption"   type="text"   disabled="disabled"     value=""   name="formWidth"
/><!--bar.formWidth-->

<input id="formHeight" style="display:none; width:4%; float:right;
margin-right:6px; padding-right:0px; border-left: solid 1px black; text-align:right"
class="formCaption"   type="text"   disabled="disabled"     value=""   name="formHeight"
/><!--bar.formHeight-->

<input id="formInputStatus" style="display:none; width:14%; float:right;
margin-right:6px; padding-right:0px; border-left: solid 1px black;
text-align:right;"
class="formCaption"   type="text"   disabled="disabled"     value=""   name="formInputStatus"
/><!--bar.formInputStatus-->

<input
id="formStatus"
generator="input11"
style="width:80px; padding-left:5px; float:right; margin-right:6px;
text-align:right;<%if(MODE.equals("MINPUT")){out.println("display:none;");}%>"
class="form.status.display formCaption"
disabled="disabled"
type="text"
name="formStatus"
/><!--bar.formStatus-->

<center>
<p style="padding-top:5px; margin:auto;color:black;" id='createByL'><strong></strong> </p>

<!-- input id='createByL' style='display:block; float:right; text-overflow:ellipsis;
color:black;'
class="form.status.display formCaption"
disabled="disabled"
type='text'
/ -->
<!--bar.CreateByL create.bar createbl.bar bar.create->
</center>

<input id="rowid" variable="thisRow" class="formCaption" style="display:none; float:right;"
type="text" disabled="disabled" value="recno" name="rowid"
/><!--bar.rowid-->

<span style="float:right; display:none; ">Browser Level :
<input id="browser" style="color:white; width:16px;margin-top:1px;
margin-right:5px; background-color:rgb(67,120,182);" class="formCaption"
type="text" disabled="disabled" class="formCaption" value="" name="browser" />
<!--bar.browser-->
</span>

</div>
</div>

<form ondragstart="return false;"  id="inputForm" action="<%=saveAction%>" method="POST"><!--20140603-->
<input name="_recordid" id="_recordid" value="" style="display:none;">
<input name="_renameFile" id="_renameFile" style="width:500px;display:none;" value="<%=renameFile%>">
<div style="height:20px; margin-bottom:<%=BodyTopMargin%>;" >
<!--sinput.save.button-->

<% if (MODE.equals("INPUT") | MODE.equals("SINPUT")  ) {%>
<button generator='button10'  id="messageAdd" class="xthisButton xSaveButton"
type="button" style="display:none;"
onclick=" $('#popup-wrapper').width(<%=appendData0ModalWidth%>).height(<%=appendData0ModalHeight%>);
$('#popup-wrapper').css('margin-top', '0px');
$('#moralFrame').prop('src','input.jsp?mode=MINPUT&input=message.txt&config=messageAddConfig.txt');
$('#clicker').click();
"
style="float:right;">Add Event Message</button>
<%}%>

<% if (MODE.equals("CHOICE") & (! SaveButton1Caption.equals("null"))){%>
<button generator='button11'  class="thisButton" type="button" onclick="
if(parent.formResult) parent.formResult=''; /*201408271035*/
parent.exitMoralBox();">Back</button> <!--subform.cancel html.cancel html.exit-->
<%}%>

<% if (!defaultSearch.equals("") & MODE.equals("LIST")) {%>
<button generator='button27'  class="thisButton" type="button" onclick="
if(parent.formResult) parent.formResult=''; /*201409101805*/
parent.exitMoralBox();">Back</button> <!--html.return-->
<%}%>

<%if(!selectedButtonCaption.equals("null")){%>
<button
style="display:inline;"
class="thisButton" type="button"
onclick="
var s='';
var i = 0;
var delimiter='';
$('#'+currentTable).find('input:checkbox').each(function()
{
if (this.checked)
{
s=s+delimiter+Xdata[i];
delimiter=',';
}
i++;
});
parent.formResult=s;
parent.exitMoralBox();
 ">
<%=selectedButtonCaption%>
</button><!--html.selected html.go 201409081015-->
<%}%>


<% if ((MODE.equals("SINPUT") | MODE.equals("MINPUT")) && (! SaveButton1Caption.equals("null")) && PROCESSING_MODE=="D") {%>
<button generator='button12'  style="color:red;display:none" class="btn btn-default thisButton" type="button" id="submit1"><%=SaveButton1Caption%></button>
<%}%>

<% if (((MODE.equals("SINPUT") | MODE.equals("MINPUT")) ) && (!SaveButton2Caption.trim().equals("")) & !SaveButton2Caption.equals("null")) {%>
  <button generator='button13' ctl='SaveButton2Caption' style="color:<%=SaveButton2CaptionColor%>;" class="btn btn-default SaveButton" type="button" id="submit2"><%=SaveButton2Caption%></button>
<%}%>

<% if (((MODE.equals("SINPUT") | MODE.equals("MINPUT"))) & (!SaveButton3Caption.trim().equals("")) & (!SaveButton3Caption.trim().equals("null"))) {%>
  <button generator='button14'  style="display:inline;" class="btn btn-default SaveButton SaveButton3Caption" type="button" id="submit3x"><%=SaveButton3Caption%></button>
<%}%>

<% if (((MODE.equals("SINPUT") | MODE.equals("MINPUT"))) && (!printCaption0.trim().equals("")) && (!printCaption0.trim().equals("null"))) {%>
  <button generator='button15' ctl='printCaption0'  class="btn btn-default SaveButton" type="button" id="printCaption0"><%=printCaption0%></button>
<%}%>

<% if (MODE.equals("INPUT")) {%>
<button generator='button16'  style="color:red;" class="btn btn-default SaveButton" type="button" id="normalSubmit">Save</button><!--form.save-->
<%}%>
<% if (MODE.equals("INPUT") && invisibleCancelButton.equals("false")) {%>
<button generator='button17'  class="btn btn-default SaveButton" type="button" onclick="blank();">Cancel</button>
<%}%>

<% if (PROCESSING_MODE.trim()=="A")  {%>
<button generator='button18'  class="btn btn-default SaveButton" type="button" onclick="parent.exitMoralBox();">Exit</button>
<% } else if (((MODE.equals("SINPUT") | MODE.equals("MINPUT")) | MODE.equals("CHOICE")))  {%>
<input generator="button28" type="button" call="fnOpenNormalDialog" class="btn btn-default SaveButton"  id="exitButtonEvent" value="
<%if(PROCESSING_MODE.equals("D")){out.println("Cancel");}else{out.println("Back");}%>
" />

<% } else if (MODE.equals("SVIEW")) {%>
<button generator='button19'  class="btn btn-default SaveButton" type="button" onclick="parent.exitMoralBox();">Exit</button>
<%}%>

<% if ((MODE.equals("SINPUT") | MODE.equals("MINPUT")) | MODE.equals("INPUT")) {%>
<span style="float:right;padding-right:10px;display:none">Approval Status
<input type="text" id="<%=ApprovalStatus%>"  namme="<%=ApprovalStatus%>" style="width:20px;"/>
</span>
<%}%>

<%
if (MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT"))  || MODE.equals("SVIEW")){%>
<%}%>
</div>

<div id="container" style="border:0px black solid;<%=containerStyle%>" >
<div id="head"><div id="header"><div id="header_inner" ></div></div></div>
<div id="content" style="border:0px black solid;" >


<%
//begin.gen.html
//20140831
//static tables stru = new tables();
double iOldGroupNo=0;
int individualDiv=1;
for ( int i = 0; i < Input.length; i++){
/* setting gooble variable here */
if (i+1<Input.length)
{
String _si3x=Input[i+1][0];
String raws[] = _si3x.split(",");
nextField=raws[1];
}
String InputDisplayUom=Input[i][19];
String tableField=Input[i][3]+"."+Input[i][4];
String checkValue=Input[i][5];
String Type2=Input[i][7];
String _sl=Label[i]; //20130606
String sLabel[] = _sl.split(":"); // <<<<<<<<<<<<<<<<<<<<<<<<<<< First Label >>>>>>>>>>>>>>>>>>>>>>
String labelCaption=""; //20130720
String labelCSS="L1"; //20130720
String LabelProperties[]=sLabel[0].split("="); //20130720
labelCaption=LabelProperties[0] ; //20130720

labelCaption=labelCaption.replaceAll("--",":"); //20140702

if (LabelProperties[0].indexOf("[")>=0){
String _space=" ";
if (bean.getLingual().equals("chinese")){
_space="";
}
String Lingual[]=LabelProperties[0].split(" ");
labelCaption="";
String ss4="";
for (int rr3=0;rr3<Lingual.length;rr3++){
String ss3="";
ss3=Lingual[rr3].replace("[","").replace("]","");
ss3=lingual.get(ss3);
if (ss3.trim().equals("")){
ss3=" "+Lingual[rr3].replace("[","").replace("]","");
}
labelCaption=labelCaption+ss4+ss3;
ss4=_space;
}
}
if (LabelProperties.length>=2){labelCSS=LabelProperties[1];
String rtrim = labelCSS.replaceAll("\\s+$","");
labelCSS=rtrim;
}   //20130720
if (sLabel.length>=2){
String LabelPropertie2[]=sLabel[1].split("="); //20130729
if (LabelPropertie2.length>=2){
labelCSS=LabelPropertie2[1];
String rtrim = labelCSS.replaceAll("\\s+$","");
labelCSS=rtrim;
}
}   //20130729
String _si=Input[i][0];
String siElement[] = _si.split(",");
String siType[]=siElement[2].split(":");
Double iNewGroupNo = new Double(Input[i][1]+"."+Input[i][2]);
String sID=Double.toString(iNewGroupNo);
siElement[3]=Input[i][25];  // Display Length 20130726
String displayLength=Input[i][25];
String sFieldName=siElement[1];
String splits[]=sFieldName.split("\\.");
String dbfName=splits[0];
String dbfField=splits[1];
if ((! dbfName.equals("query")) && masterTableName.isEmpty()){masterTableName=dbfName;}
sID=sID.replace(".","_");
String inputWidth="";
if (Input[i][15].trim().equals("")){
inputWidth="width:"+Input[i][25] +Input[i][26]+";" ;
} else {
inputWidth="min-width:"+Input[i][15]+";"+
"max-width:"+Input[i][16]+";"+
"width:"+Input[i][25] +Input[i][26]+";"
;
}
if (Input[i][7].equals("GRID")){
listTableSid=sID;} //20130829
%>
<%if (iOldGroupNo == 0) { %>
<div id="content" class="posttext">
<%if (MODE.equals("INPUT") || (MODE.equals("DUMMY") |MODE.equals("SINPUT") | MODE.equals("MINPUT")) || (MODE.equals("SINPUT") | MODE.equals("MINPUT")) || (MODE.equals("LIST") | MODE.equals("CHOICE"))){%>
<table
id='headerTable' generator='table1' width=100% <%=formHeaderTableProperties%> style=" table-layout:<%=formHeaderTableLayout%> ; border: <%=tableRule%>px black solid;"><!--20130828--><%}%>

<colgroup><!--2014-->
<col width="<%=colWidth1%>%"><!--2014a-->
<col width="<%=colWidth2%>%"><!--2014a-->
<col width="<%=colWidth3%>%"><!--2014a-->
<col width="<%=colWidth4%>%"><!--2014a-->
<col width="<%=colWidth5%>%"><!--2014a-->
<col width="<%=colWidth6%>%"><!--2014a-->
<col width="<%=colWidth7%>%"><!--2014a-->
<col width="<%=colWidth8%>%"><!--2014a-->
<col width="<%=colWidth9%>%"><!--2014a-->
<col width="<%=colWidth10%>%"><!--2014a-->
<col width="<%=colWidth11%>%"><!--2014a-->
<col width="<%=colWidth12%>%"><!--2014a-->
</colgroup>
<tbody>
<tr><td generator="td7" colspan="<%=Input[i][59]%>" rowspan="<%=Input[i][77]%>">
<% } %>
<% /*NewLine*/ if (iNewGroupNo !=iOldGroupNo && iOldGroupNo != 0) { %>
<%if (SetGrid==2) {
SetGrid=0;
iCreatingGrid=0; %>
</TABLE> <!-- tableBodyClose -->
</div>
<div id="tableFooter"></div>
</div><!--20130529 Not End of define SetGrid==2 grid-->
<div id="tableFooter"></div>
</div>
</div><!--End of AllGrid Not End of define SetGrid==2 grid-->
<%} else if (SetBox==2 && individualDiv==1){%>
</div><!--20130913-->
<%} else {%>
</div> <!--xxNewLine--> <%}%>

<% if (individualDiv==1) {%>
</td>
</tr> <!--endline--><!--20140414-->
<% out.println(Input[i][69]); %>
<%=Input[i][69]%>
<tr>
<!--page.grid.header-->
<td colspan="<%=Input[i][97]%>" style="vertical-align:top;" generator="td2" style="border:<%=tableRule%>px solid black;<%=Input[i][45]%>" ><!--201309131023b--><!--20140113011--><!--201404281041-->
<%}%>
<% } %>
<% //end of PageGroup
int iNewPageNum=(int) iNewGroupNo.doubleValue();
int iOldPageNum=(int) iOldGroupNo;
boolean isChangePage;
if (iNewPageNum !=iOldPageNum && iNewPageNum != 0) {isChangePage=true;} else {isChangePage=false;}
if (isChangePage) {  %>
<!--Footer of Page --newPage-->
<!--201307260945-->
</tbody><!--2014-->
</table>
<%if (SetPageHeader==2) {%>
</div> <!-- div id="tab1" class="tab_content" -->

<%}%>
<%if (SetPageHeader==1) {SetPageHeader=2;%>
<div class="pageFrame"   ><ul class="tabs">
     <% for ( int ii = 0; ii < PageHeaderCaption.length; ii++){ %>
      <li class="pageHeader"><a href="#page<%=ii+1%>"><%=PageHeaderCaption[ii]%></a></li>
<%}%>
</ul><div class="tab_container"  >

<%}%>
<div    id="page<%=iNewPageNum%>" class="tab_content"> <!--Header of Page--newPage -->
<table  style='table-layout:fixed; width:<%=pageTableWidth[iNewPageNum]%>;'  generator='table2' remark="page.Table"><!--secondPageTable 201410101040-->
<!--Page3ColWidth=2,20,2,2,2,2-->
<colgroup remark="forPage.Table">
<%
String nCols[] = pageColWidth[iNewPageNum].split(",");
for (int i00 = 0; i00 < nCols.length;i00++) {
out.println("<col width='"+nCols[i00]+"%'><!--iNewPageNum-->");
}
%>
</colgroup>


<% } //isChangePage %>
<% if (iNewGroupNo!=iOldGroupNo && Type2.equals("BOX") && individualDiv==1 ) {
out.println("<div style='margin:10px; border:2px solid black;'><!-20130913--html.box-----> ");
iCreatingBox=1;SetBox=2;
}%>
<%---------------------------html.table--------html.grid---------------Grid.Head----%>
<% if (iNewGroupNo!=iOldGroupNo && Type2.equals("GRID")) {
if (isChangePage) {out.println("<tr><td generator='td8'>");}
iCreatingGrid=1;SetGrid=2;%>
<% double si2TotalWidth=0;
for ( int i2 = i; i2 < Input.length; i2++){
String _si2=Input[i2][0];
String si2Element[] = _si2.split(",");
double si2No = new Double(si2Element[0]);
double si2Width = new Double(Input[i2][25]);
if (si2No==iNewGroupNo){
si2TotalWidth= si2TotalWidth+si2Width;}
if (si2No!=iNewGroupNo)break;
}
%>
<% si2TotalWidth=si2TotalWidth+3; %>
<br>
<%int aInt=Integer.parseInt(Input[i][13])-1;
String s08=GridStyle[Integer.parseInt(Input[i][13])-1];
%>

<tr>
<td colspan=16 style="border:<%=tableRule%>px solid black;"><!--20140113012-->
<!--grid.border-->
<div generator="div2" style="width:100%; display:inline-block;margin:auto; max-width:100%; border:1px gray solid;" id="gridBorder"><!--Begin of AllGrid -->
<!-- div style="border: 1px black solid;height: 20px; width:<%=si2TotalWidth%>em;" align="right" -->
<div>

<%if(!PropertyButton1Action.equals("")){%>
<span id="PropertyButton1" style='float: left; <% if(! (MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>' >
<button generator='button26'  class="GridButton" type="button" onclick="
offset=offset*1+limit*1;
var s=Xdata[thisRowNo];
<%=PropertyButton1Action%>
"><%=PropertyButton1Caption%></button>
</span>
<%}%>

<span id='pgdn' style='float: right; <% if(! (MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>' >
<button generator='button20'  class="ListButton" type="button" onclick="
offset=offset*1+limit*1;
retrieval(latestOrderBy);
">PgDn</button>
</span>
<span id='pgup' style='float: right; <% if(! (MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>' >
<button generator='button21'  class="ListButton" type="button" onclick="
offset=offset*1-limit*1;
retrieval(latestOrderBy);
">PgUp</button>
</span>
<!--html.offset-->
<span id="offset" style="display:inline; float:right;padding-right:10px;padding-top:5px;"></span>
</div>

<div style="<% if((MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>  border-bottom:1px  black solid; width:100%;" align="right" >

<span style="margin-right:12px;">



<%--------------------grid.button--------addButton--------------Grid Button----%>
<span style='float: left; <% if((MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>' >
<label style="display:none" generator='label7' for="Recno_tableName<%=sID%>">Recno : </label>
<input  updateBy='sayRecno'  variable='thisRowNo' generator='input10' style="width:2em;margin-left:5px;
display:none;
background-color:#elelel; text-align:right;"
type="text" disabled="disabled" value="" name="Recno_tableName<%=sID%>" id="Recno_tableName<%=sID%>" />
</span>



<div style="
<%
if (PROCESSING_MODE.equals("D")){out.println("display:inline;");} else {out.println("display:none;");}

%>
"
>


<%if (!appendData0.equals("")) {%>
<%if (MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT")) || MODE.equals("SVIEW")){%>
<button generator='button22'
id="appendData0"
class="GridButton"
type="button"
onfocus=""
style="<%=gridAddButtonStyle%>";
onclick="thisTable=tableName<%=sID%>;
RetrievalStatus=0; currentID='';
currentChoose='';
delimiter=',';
for (iix=0; iix<=thisTable.rows.length; iix++) {
s=_lookup('<%=appendData0TargetKey%>'+iix);
currentChoose=currentChoose+s+delimiter
}

currentTable='<%=sID%>'; //simple.choice.grid.popup

//additemPopup
$('html, body').css('overflowY', 'hidden'); //201409131335
$('#popup-wrapper').draggable( 'disable'); //201409131105
$('#popup-wrapper').resizable('disable').removeClass('ui-state-disabled');
$('#popup-wrapper').css({width:<%=appendData0ModalWidth%>, height:<%=appendData0ModalHeight%>, top: <%=appendData0ModalTop%>, left: 0, position:'absolute'}); //201408261225 subformHeight
//document.write('<%=appendData0%>');
$('#moralFrame').prop('src','<%=appendData0%>');
//input.jsp?input=dNotesSalesOrderList.txt&config=dNotesSalesOrderListConfig.txt&mode=CHOICE
//vformStatus!='choicing'
$('#clicker').click();">
<%=appendData0Caption%>
</button>

<!--20140221-->
<button generator='button23'  class="GridButton" type="button"
id="buttonDelete"
style="<%=gridDelButtonStyle%>";
onclick="
s10=_lookup(thisDBFName+'.recordID'+thisRowNo);
<%
if (Input[i][89].equals("")){out.println("canDelete=1;");} // 201408211730
if (!Input[i][94].equals("")){
String s=deleteReferentialIntegrityTemplate;
String akey[]=Input[i][94].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
s=s.replace(akeyValue[0].trim(),akeyValue[1].trim());
}
out.println(s);
if (Input[i][89].equals("")){out.println("if (canDelete==1){deleteRow(thisDBFName,thisRowNo);hadEdit=1;}");}
} else {
out.println("deleteRow(thisDBFName,thisRowNo);hadEdit=1;");
}

%>
"
onfocus="thisTable=tableName<%=sID%>;">
Delete</button> <!--20130531-->
<%}%>
<% } else { %>
<%if (MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT")) || MODE.equals("SVIEW")){%>
<!--append.button button.append button.add addbutton -->
<button generator='button24a'  generator="buttonAdd" class="GridButton" type="button"
onclick="trievalStatus=0;_setFocus=''; hadEdit=1;
<%
for (int i57 =0;i57<alistTables.length;i57++ ){
if (alistTables[i57][0].equals(sID)){
if (alistTables[i57][2].trim()=="null" | alistTables[i57][2].trim().equals("") ){
out.println("tableName"+sID+"Append();/*1*/");
} else {
String s88="";
s88="choiceEvent=parent.tableName"+alistTables[i57][3]+"Append();";
alistTables[i57][2]=alistTables[i57][2].replace("choiceEvent=",s88);
alistTables[i57][2]=alistTables[i57][2].replace("parent.tableNameAppend();",""); //20140804
out.println(alistTables[i57][2]+"/*2*/");
}
}
}
%>
setFocus(firstField); //201409151000
">Add Item(s)</button>
<button generator='button25'  class="GridButton" type="button"
onclick="
if(thisDBFName){
s10=_lookup(thisDBFName+'.recordID'+thisRowNo);
var canDelete=1;
<%
if (!Input[i][94].equals("")){
String s=deleteReferentialIntegrityTemplate;
String akey[]=Input[i][94].split(",");
for (int i9=0;i9<akey.length;i9++){
String akeyValue[]=akey[i9].split("=");
s=s.replace(akeyValue[0].trim(),akeyValue[1].trim());
}
out.println(s);
}
out.println("if (canDelete) {deleteRow(thisDBFName,thisRowNo);hadEdit=1;");
for (int i57 =0;i57<alistTables.length;i57++ ){
if (alistTables[i57][0].equals(sID)){
if (!alistTables[i57][4].equals("")){
if (Input[i57][122].equals("deleteBind")){
out.println("\n deleteRow('"+alistTables[i57][4].trim()+"',thisRowNo);/* "+Input[i57][122] +" 20140813a 20141091200 deleteBind*/");
}
}
}
}
out.println("}");
%>}"
onfocus="thisTable=tableName<%=sID%>;">
Delete</button>

<%}%>
<%}%>
</div>
</span>
</div>
<!-- div style="clear:both; border: 1px black solid; width:<%=si2TotalWidth%>em"; --><!--grid-->
<div style="overflow:hidden;clear:both; border: 0px black solid; width:100%;" id="gridTable"><!--grid-->
<div style="padding-left:<%=gridLeftOffset%>;padding-right:12px;overflow:hidden;"> <!--gridLeftOffset-->
<table     generator='table3' cellspacing=0 cellpadding=6 id=header style="overflow:hidden;text-align:center;" rules="rows" border=1>
<!-- COL WIDTH=10em><COL WIDTH=10em><COL WIDTH=30em -->
<!-------grid.colgroup----------------------------grid.header.caption ------------>
<colgroup>
<% if (MODE.equals("INPUT")  || (MODE.equals("SINPUT") | MODE.equals("MINPUT"))){ %>
<col span='1' style='width:30px;min-width:30px' > <!-- header.delete.markX -->
<%}%>
<%
for ( int i2 = 0; i2 < Input.length; i2++){ //20140625
double si2Width =  new Double(Input[i2][25]);
if (si2Width!=0){
String _si2=Input[i2][0];
String si2Element[] = _si2.split(",");
double si2No = new Double(si2Element[0]);

if (si2No==iNewGroupNo){
out.println("<col span='1' style='width:"+si2Width+Input[i2][26]+";");
out.println("'/>");
}
} //endif
}%>
</colgroup>
<tr style="height:<%=InputTextHeight%>;" >
<%
if (MODE.equals("INPUT")  || (MODE.equals("SINPUT") | MODE.equals("MINPUT"))){
//out.println("<th id='firstColumnExtend' style='display:block; margin:0px; padding:0; width:8px; bgcolor=lightgrey;border-bottom:solid 1px gray;'>1</th>");

out.println(""
+"<th generator='th01' bgcolor='lightgrey' style='padding-left:2px;background:write;border:1px solid gray'>"
+"<div title='' style='width:6px;display:block;text-overflow:ellipsis;'></div></th>");


} else {
//out.println("<th style='border:0px; width:0px; margin-left:20px;'></th>");
}
for ( int i2 = 0; i2 < Input.length; i2++){
String _si2=Input[i2][0];
String si2Element[] = _si2.split(",");
double si2No = new Double(si2Element[0]);
double si2Width =  new Double(Input[i2][25]);
if (si2No==iNewGroupNo & (!Input[i2][21].equals(""))){ //20160625
String displayStyle=Input[i2][73];
%>


 <th  bgcolor="lightgrey" generator='th02' style="<%=displayStyle%>">
 <% if ((MODE.equals("LIST") | MODE.equals("CHOICE"))) { %>
<!--grid.title-->
<div generator='div02' title="<%=Input[i2][49].trim()%>"
style="text-overflow:ellipsis; cursor:pointer; "
onclick="retrieval('<%=Input[i2][4].trim()%>');
if (ascDesc=='asc'){ascDesc='desc';} else {ascDesc='asc';};">
<% } else {
String s="";
if (Input[i2][30]=="required")s=requiredLabelStyle;
%>
<div generator='div03' title="<%=Input[i2][49].trim()%>" style="text-overflow:ellipsis;<%=s%>">
<%}%>
<%
if (Label[i2].indexOf("[")>=0){
String _space=" ";
if (bean.getLingual().equals("chinese")){
_space="";
}
String Lingual[]=Label[i2].split(" ");
String labelCaption2="";
String ss4="";
for (int rr3=0;rr3<Lingual.length;rr3++){
String ss3="";
ss3=Lingual[rr3].replace("[","").replace("]","");
ss3=lingual.get(ss3);
if (ss3.trim().equals("")){
ss3=" "+Lingual[rr3].replace("[","").replace("]","");
}
labelCaption2=labelCaption2+ss4+ss3;
ss4=_space;
}
out.println(labelCaption2); //grid.label.chinese

} else {
out.println(Label[i2]); //grid.label

if(Input[i2][30]=="required" & !Input[i2][110].equals("submitMust")){out.println("*");} //201409031200

}
%>
 </div>
 </th>

<% }
}%>

<th generator='th03' id="lastColumnExtend" style="width:125px;"></th><!--201404280422-->
</tr>
</TABLE>
</div><!--end of table header-->

<%------------------------------------------------------------------Grid Body---%>
<DIV   id="divTableBody" STYLE="overflow-x:hidden;overflow-y: scroll; width:100%; height:<%=GridHeight%>;
border-left: 1px gray solid; border-bottom: 1px gray solid; background: #fff;
padding:0px; margin: 0px; ">

<table     generator='table4'id="tableName<%=sID%>" class="t1" style="width:100%; margin-top:<%if (MODE.equals("CHOICE") | MODE.equals("LIST")){out.println("-11px");} else {out.println("-0px");}%>;" ><!--20140522-->

<%} %>
<%-----------------------------------------------------endof.html.grid---------------Grid Head----%>
<%if (iCreatingGrid==0) {%>
<!--endof.html.grid Header of Grid -->
<% } %>
<%-- } //isChangePage --%>
<%------------------------------------------------html.label--------First Label with table Caption----------%>
<!--html.label-->

<%
if (iNewGroupNo!=iOldGroupNo) {
iOldGroupNo=iNewGroupNo;
if (iCreatingGrid==0) {%>
<!-- tr><td --><!--201309131023-->
<!--first.Column.Label-->
<!-- div  generator="div01" style="padding-bottom:<%=EachLineHeight%>; inline-display:block; border:0px solid black; <%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> "-- > <!--xxNewLine 201401271203-->

<div  generator="div01" style="inline-display:block;
border:0px solid black;
<%if ((InvisibleRetrivalNumber.equals("1")&& i==0) | Input[i][6].equals("button")){ %>display:none <%}%> "> <!--xxNewLine 201401271203-->
<!--20130720L label class="L1" for="<%=tableField%>"><%=sLabel[0]%></label -->
<% if (isChangePage) {%>
<tr><td style="vertical-align:top;"><!--20131122--><!--20140312 valign='top'-->
<%}%>
<!--1112-->
<%if ((! Input[i][62].equals("documentStatus")) && (Input[i][65].equals("")) && (Input[i][80].equals(""))) {
String s="";
if (Input[i][30]=="required")s=requiredLabelStyle;
%>
<label
generator='label2'
title="<%=Input[i][49]%>"
class="<%=labelCSS%> <%out.println(Input[i][28].replace(".","_").trim()+"_label");%>"
style="<%=Input[i][45]%>width:auto;margin-top:0px; border:solid 0px black;<%=s%>"
for="<%=tableField%>">
<%=labelCaption%>
<%if(!Input[i][110].equals("submitMust") & !Input[i][124].equals("approveMust") & Input[i][30].equals("required")){out.println("*");}%>
</label><!--201401271155-->
<%}%>

<%if ((! Input[i][62].equals("documentStatus")) && ((! Input[i][65].equals("")) | (! Input[i][80].equals(""))) ) { //80=dblclickSetData
String s="";
if (Input[i][30]=="required")s=requiredLabelStyle;%>
<!--html.button-->
<button type='button' class="btn btn-default SaveButton"  style="display: inline;"  generator="label8"
onclick="currentRow='';currentID='<%=Input[i][28]%>'; currentField='<%=Input[i][28]%>';
<%if(PROCESSING_MODE.equals("D")){out.println(Input[i][65]+Input[i][80]);}%>
"
title="<%=Input[i][49]%>" class="<%=labelCSS%>" style="<%=Input[i][45]%>margin-top:0px; <%=s%>
border:solid 0px black;cursor:pointer;text-decoration:underline;" for="<%=tableField%>"><%=labelCaption%>
</button>
<%}%>



</div><!--201401271156--->
<!-- div  style="padding-bottom:<%=EachLineHeight%>; inline-display:block; border:0px solid black; <%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> " --> <!--xxNewLine 201401271209-->
<% } %>
<% } else {  %>
<!-- same line label 201401201154-->
<% if (iCreatingGrid==0){%>

<% if (!Input[i][6].equals("button")){ %>

<% if (!Input[i][91].equals("dependent")){ %>
</td>
<td generator="td4" style="padding-left:5px; vertical-align:top; border:<%=tableRule%>px solid black;<%=Input[i][45]%> ">
<%}%>
<!--20140113013-->
<!--second.column.label-->

<%if ((! Input[i][62].equals("documentStatus")) && (Input[i][65].equals("")) && (Input[i][80].equals(""))) {
String s="";
if (Input[i][30]=="required")s=requiredLabelStyle;%>
<label generator="label1"
title='<%if (!Input[i][49].equals("")){out.println(Input[i][49]);}
else {if (Input[i][6].equals("date")) {out.println("Double the Input field for Calendar");} }
%>'
ondblclick="currentRow='';currentField='<%=Input[i][28]%>';
id="<%out.println(Input[i][28].replace(".","_").trim()+"_label");%>";
currentID='<%=Input[i][28]%>'; <%=Input[i][65]%>"

<% if (Input[i][91].equals("dependent")){ %>
class="L1A <%out.println(Input[i][28].replace(".","_").trim()+"_label");%>"
style="width:10px; <%=Input[i][45]%>margin-top:0px; <%=s%> border:solid 0px black;display:inline;"
<%} else {%>
class="<%=labelCSS%> <%out.println(Input[i][28].replace(".","_").trim()+"_label");%>"
style="width:100%; <%=Input[i][45]%>margin-top:0px; <%=s%> border:solid 0px black"
<%}%>

 for="<%=tableField%>"
><%=labelCaption%>
<%if(!Input[i][110].equals("submitMust") & Input[i][30].equals("required")){out.println("*");}%>
</label><!--20140127b--><!--20140411-->
<%}%>

<%if ((! Input[i][62].equals("documentStatus")) && ((! Input[i][65].equals("")) | (! Input[i][80].equals(""))) ) { //80=dblclickSetData
String s="";
if (Input[i][30]=="required")s=requiredLabelStyle;%>
<!--html.button-->
<button type='button' class="btn btn-default SaveButton"  style="display: inline;"  generator="label3"
onclick="currentRow='';currentID='<%=Input[i][28]%>'; currentField='<%=Input[i][28]%>';
<%if(PROCESSING_MODE.equals("D")){out.println(Input[i][65]+Input[i][80]);}%>
"
title="<%=Input[i][49]%>" class="<%=labelCSS%>" style="<%=Input[i][45]%>margin-top:0px; <%=s%>
border:solid 0px black;cursor:pointer;text-decoration:underline;" for="<%=tableField%>"><%=labelCaption%>
</button>
<%}%>

<%}%>

<%}%>
<!--20140113-->
<% } %>
<%--------------------------------------------------------------------------html.Radio- it include radio's label---%>
<% String sInputType=siElement[2];
if (Input[i][6].equals("radio")  & (! Input[i][7].equals("GRID"))) {
if (! Input[i][18].equals("1") ){out.println(sLabel[0]+" : ");}
%>
<%
String arrS[] = Input[i][46].split(",");
for (int j=0;j<arrS.length/2;j++){
int i1=j*2;
int i2=j*2+1;
//for ( int j = 1; j < sLabel.length; j++){
%>
</td>
<td style="border:<%=tableRule%>px solid black;"><!--20140113014-->
<label generator='label4' for="<%=arrS[i1]%>" style="<%=Input[i][31]%>">
</td>
<td style="border:<%=tableRule%>px solid black;"><!--20140113015-->
<input
type="radio"
id="<%=tableField%>"
name="<%=tableField%>"
value="<%=arrS[i1]%>" <%=Input[i][34]%> <%=Input[i][40]%>
<%if (arrS[i1].equals(Input[i][41])){out.println("checked");}%>
/><%=arrS[i2]%>
</label>
<%}%>
<%-----------------------------------------------------------html.combo----------------%>
<% } else if (Input[i][6].equals("combo") && (! Input[i][7].equals("GRID"))){ %>

<% if (!Input[i][91].equals("dependent") & !Input[i][104].equals("nearLabel")){ %>
</td>
<td generator="td6" style="vertical-align:top; border:<%=tableRule%>px solid black;">
<%}%>
<select
onchange="<%=Input[i][58]%>;<%=Input[i][81]%>;"
<% if(Input[i][90].equals("onfocusUpdateCombo")){ %>
onfocus="
$(this).find('option').remove().end();
oldValue=this.value;
_combo(this.id,'<%=Input[i][33]%>','<%=Input[i][56]%>','<%=Input[i][57]%>',this.value,'noSpace');
"
<%}%>
onclick="newValue=this.value; if(oldValue!=newValue){hadEdit=1;};_setFocus='<%=Input[i][28]%>';"
style="display:inline;width:<%=Input[i][25]%><%=Input[i][26]%>;padding:0px;margin-left:0px;<%=Input[i][31]%>;"
title="<%=Input[i][49]%>"
name="<%=tableField%>"
class="<%out.println(Input[i][28].replace(".","_").trim());%> "
id="<%=tableField%>"  <%=Input[i][32]%> <%=Input[i][34]%>  readonly="<%=Input[i][40]%>"
>
<%for ( int j = 1; j < sLabel.length; j++){ %>
<option value="<%=sLabel[j]%>"><%=sLabel[j]%></option>
<%}%>
<%
String arrS[] = Input[i][44].split(",");
for (int r=0;r<arrS.length/2;r++){
int i1=r*2;
int i2=r*2+1;
out.println("<option value='"+arrS[i1].trim()+"'>"+arrS[i2].trim()+"</optin><!--20131104-->");
}
%>
</select>
<%------------------------------------------------------------------------------html.Xlookup-----------------%>
<% } else if (Input[i][6].equals("Xlookup")  & (! Input[i][7].equals("GRID"))){ %> <!--html.lookup-->

<input  class="LineInputText"  type="<%=siElement[2]%>"
id="<%=tableField%>" name="<%=tableField%>" size="<%=Input[i][25]%><%=Input[i][26]%>"
maxlength="<%=siElement[2]%>" onblur='' />
<input type="text" disabled="disabled" value=""
name="<%=sLabel[1]%>.<%=sLabel[2]%>"
id="<%=sLabel[1]%>.<%=sLabel[2]%>"
style="width:401px; margin-right: 5px; " />


<% } else if (Input[i][6].equals("lookupValue")  & (! Input[i][7].equals("GRID"))){
%>
</td>
<td>

<input type="text"
generator='input08'
autocomplete=off
id="<%=Input[i][28]%>"
name="<%=Input[i][28]%>"
autofocus="<%=Input[i][88]%>"
style="display:none"
maxlength="<%=siElement[4]%>"
onClick="/*201408221710  this.select();*/"
onKeyPress="hadEdit=1;"
title="<%=Input[i][49]%>"
onfocus="
/*201408221710 SelectAll(this.id);*/
prevField ='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField ='<%=Input[i][29]%>';
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/>
<input type="text"
generator='input08'
autocomplete=off
id="<%=Input[i][28]%>Display"
autofocus="<%=Input[i][88]%>"
style="height:<%=textInputHeight%>; <%=inputWidth%><%=Input[i][31]%>"
maxlength="<%=siElement[4]%>"
onClick="/*201408221710  this.select();*/"
onKeyPress="hadEdit=1;"
title="<%=Input[i][49]%>"
readonly=readonly
class="LineInputText "
onfocus="
/*201408221710 SelectAll(this.id);*/
prevField ='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField ='<%=Input[i][29]%>';
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/>













<%-------------------------------------20140623--------------html.checker-----html.checkbox---------------html.Check-------%>
<% } else if (Input[i][6].equals("check")  & (! Input[i][7].equals("GRID"))){ %>

<%if (MODE.equals("INPUT") || MODE.equals("SINPUT") || MODE.equals("LIST")  ){%>
</td>
<td generator='td10'>
<%}%>

<label generator='label5' class="L1"
style="float:left; width:auto; display:table; margin-right:0px;"
title="<%=Input[i][49]%>"
><%=sLabel[1]%></label>

<input
generator="input13"
onclick="hadEdit=1;
<%=Input[i][42]%>
<%if(Input[i][40].equals("readonly")){out.println("return false;");}%>

"
type="checkbox"
<%=Input[i][34]%>
style="float:left; overflow:hidden; margin: 0;height:18px;padding: 0 ;"
id="<%=tableField%>"
<%
if (Input[i][41].equals("1") || Input[i][41].equals("true") || Input[i][41].equals("checked")  ){
out.println("checked");
}
%>

name="<%=tableField%>" value="1" />

<input type='hidden' value='0' name='<%=tableField%>'>

<%----------------------------------------------------html.click------------------------------html.button-------%>
<% } else if (Input[i][6].equals("button")  & (! Input[i][7].equals("GRID"))){ %>
<% if (labelCSS.equals("FR")) { %>
<%if(Input[i][24].equals("")){%>
<button generator='button01'  style="<%=Input[i][45]%> float:right; <%=Input[i][31]%>  class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button" onclick="alert('<%=Input[i][22]%>')"><%=Input[i][22]%></button><!--20131204a-->
<%}else{%>
<button generator='button02'  style=" <%=Input[i][45]%> float:right; <%=Input[i][31]%>" class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button" onclick=window.open("<%=Input[i][24]%>","_blank")><%=Input[i][22]%></button><!--20131204b-->
<%}%>
<% } else {%>
<%if (! Input[i][36].equals("")){%>
<!--http-->
<button generator='button03'  style=" <%=Input[i][45]%> <%=Input[i][31]%>" class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button"
onclick=window.open("<%=Input[i][36]%>&db=<%=DATABASE%>","_blank","toolbar=0,scrollbars=0,location=0,location=no,width=1000,height=600")><%=sLabel[1]%></button><!--20131204c-->
<%} else if(! Input[i][43].equals("")){%>
<!--html.click.subForm-->
<button generator='button04'  style=" <%=Input[i][45]%> <%=Input[i][31]%>" class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button"  buttonID="<%=tableField%>"
onclick="
<%=Input[i][42]%>
//$('#popup-wrapper').width(<%=Input[i][47]%>).height(<%=Input[i][48]%>);
$('#moralFrame').prop('src','<%=Input[i][43]%>?db=<%=DATABASE%>');
$('#clicker').click();
"><%=sLabel[1]%></button><!--20131022 [43]{subform}-->
<%} else if(Input[i][24].equals("")){%>
<%if(sLabel.length>=2){%>
<button generator='button05'
buttonID="<%=tableField%>"
style=" <%=Input[i][45]%>  <%=Input[i][31]%>"
class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button" onclick="<%=Input[i][42]%>"><!--MarkBClose--><%=sLabel[1]%></button><!--20131204d-->
<%} else {%>
<button generator='button06'  buttonID="<%=tableField%>" style=" <%=Input[i][45]%> <%=Input[i][31]%>" class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button" onclick="<%=Input[i][42]%>"><!--MarkBClose--><%=sLabel[0]%></button>
<%}%>
<%}else{%>
<button generator='button07'  buttonID="<%=tableField%>" style=" <%=Input[i][45]%><%=Input[i][31]%>" class="formButton <%out.println(Input[i][28].replace(".","_"));%>" type="button" onclick="location.href='<%=Input[i][24]%>'"><%=sLabel[1]%></button>
<%}%>
<%}%>
<%--------------------------------------------------------------------------------------html.num---------%>
<% } else if (Input[i][6].equals("num")  & (! Input[i][7].equals("GRID"))) //201409101140
{
%>
<span></span>
<!-- input name="date" onClick="SelectAll(this.id);" type="text" id="date" size="10"  maxlength="10" onblur='check_date(this);'/ -->
</td><td style="border:<%=tableRule%>px solid black;"><!--20140113017-->
<input type="text"
fieldType="num"
class="num"
size="10"
autoComplete=off
value="<%=Input[i][41]%>"
id="<%=tableField%>"
name="<%=tableField%>"
onkeypress="hadEdit=1;if(fieldEditBegin==1){this.value='';fieldEditBegin=0;};"
onblur="
document.getElementById(this.id).style.textAlign='right';
this.value=this.value.replace(/,/g,'');
this.value=(this.value*1).formatMoney(<%=Input[i][9]%>, '.', ',');
<%=Input[i][39]%>
"
style="
<%=Input[i][31]%>;
clear:both;
min-width:<%=Input[i][15]%>;
max-width:<%=Input[i][16]%>;
width:<%=Input[i][25]%><%=Input[i][26]%>;"
maxlength="<%=Input[i][10]%>"
onClick="this.select();"
title="<%=Input[i][49]%>"
<%=Input[i][34]%>
<%=Input[i][40]%>
onfocus="
fieldEditBegin=1;
document.getElementById(this.id).style.textAlign='left';
prevField='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField='<%=Input[i][29]%>' ;
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/>

<%----------------------------------------------------------------------------------html.hidden--------%>
<% } else if (Input[i][6].equals("hidden")  & (! Input[i][7].equals("GRID"))){ %>
<input class="LineInputText" type="hidden" id="<%=tableField%>" name="<%=tableField%>" value="<%=dbfField%>" >
<% if (dbfField.equals("recordID")) { %>
<input class="LineInputText" type="hidden" id="<%=dbfName%>_action" name="<%=dbfName%>._action" value="" >
<%}%>
<%--newText.value=milliseconds = new Date().getTime();} --%>
<%---------------------------------------------------------------------------------html.file--------%>  
<% } else if (Input[i][6].equals("file")  & (! Input[i][7].equals("GRID"))){ %>
<div class="styleFileInput">
<a class="btn_addPic"
href="javascript:void(0);"
>
Upload File
<input type="file" style="cursor:pointer;" class="filePrew"
id="<%=tableField%>" name="<%=tableField%>" size="3">
</a>
<input type="text"
class="browseText"
id="<%=tableField%>" name="<%=tableField%>"
style="clear:both; width:<%=Input[i][25]%><%=Input[i][26]%>;"
<%=Input[i][34]%>
<%=Input[i][40]%>
maxlength="<%=Input[i][10]%>" >

<!--http://192.168.10.8:8080/hr/PLPDF?db=hr-->
</div>
<%------------------------------------------------------------------------html.textarea- text.area-------%>

<% } else if (Input[i][6].equals("textarea")  && (! Input[i][7].equals("GRID"))){

%>
</td>
<td colspan="<%=Input[i][59]%>" rowspan="<%=Input[i][77]%>" style="<%=Input[i][31]%>">
<textarea
generator='input12'
rows="<%=Input[i][10]%>"
id="<%=tableField%>"
name="<%=tableField%>"
onblur="<%=Input[i][39]%>;"
style="resize: none; clear:both; <%=Input[i][31]%>; width:<%=Input[i][8]%>; min-width:25%; max-width:97.8%;"
onClick="/*201408221710 SelectAll(this.id);*/"
onDblclick="
//editTextAreapopup
var editMode='edit';
if ($(this).is('[readonly]')) {editMode='readonly';}
vformStatus='editingTextarea';
s1='<%=Input[i][21]%>';//21 first Label
var s=this.value;
s=s.replace(new RegExp('\r?\n','g'), '<z><z>');
s=s.replace('&', '<and>');
s=s.replace('\'', '<SinglEQuot>');
if (_row<700) {_i=-250;} else{_i=_row*1-900;}
$('#popup-wrapper').parent().css( 'width', '40%' );
$('#popup-wrapper').width('100%').height(<%=Input[i][48]%>).css({top: _i,  position:'absolute'});
$('#popup-wrapper').css('border-top','10px #ccc solid');
$('#popup-wrapper').css('margin-top', '0px');
_i=null;
setTimeout(function(){
$('#moralFrame').prop('src',
'editTextArea.jsp?fieldName=<%=tableField%>' +'&thisValue='+s+'&caption='+s1+'&mode='+editMode);
},10)
$('#clicker').click();
"
title="<%=Input[i][49]%>"
<%=Input[i][34]%>
<%=Input[i][40]%>
onfocus="oldValue=this.value;/*201408221710 SelectAll(this.id);*/
prevField ='';upperField='';nextField ='' ;lowerField='';enterField='';"
class="<%out.println(Input[i][28].replace(".","_").trim());%> "
/>
</textarea>


<% } else if (Input[i][6].equals("date") & (! Input[i][7].equals("GRID"))){

if (!Input[i][40].equals("readonly")) {
//masks="var errorMessage"+i+" = 'Invalid date: ${value}. Expected format: ${mask}';var dateMask"+i+" = new DateMask('yyyy-MM-dd', '"+tableField+"'); dateMask"+i+".validationMessage = errorMessage"+i+";"+masks;
//formInit=formInit+"$('."+Input[i][28].replace(".","_").trim()+Input[i][96].trim()+"').datepicker().datepicker('option', 'dateFormat', 'yy-mm-dd').datepicker({autoOpen:false}).datepicker().unbind('focus').dblclick(function() {$(this).datepicker('show');});/*0929*/";
//.datepicker();

// $('.datepicker').datepicker('option', 'dateFormat', 'yy-mm-dd');
//$('.datepicker').datepicker({autoOpen:false});
//$('.datepicker').datepicker().unbind('focus').dblclick(function() {$(this).datepicker('show');});
}

%>
</td>
<td style="vertical-align:top;" generator="td5" >
<!-------------------------------------------------------------------html.date-------->
<input
tempdeleteClass=' datepicker'
generator='input01'
placeholder="<%=Input[i][98]%>"
class='LineInputText
<%out.println(Input[i][28].replace(".","_").trim()+Input[i][96].trim());%>
<%if (PROCESSING_MODE.equals("D")){out.println("datepicker");}%>
<%if(! Input[i][41].equals("empty")){out.println("today");};%>'
type="text"
<%=Input[i][34]%>
autocomplete=off
id="<%=tableField%>"
name="<%=tableField%>"
onblur="<%=Input[i][39]%>"
style="cursor:pointer;clear:both; width:90px;<%=Input[i][31]%>"
maxlength="<%=Input[i][10]%>"
onkeydown="DateKeyDown(event,this.value,this.id);"
onClick=""
<%=Input[i][32]%>
title=""
<%=Input[i][34]%>
<%=Input[i][40]%>
onfocus="
oldValue=this.value;
prevField ='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField ='<%=Input[i][29]%>' ;
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/><!--endof.html.date-->
<!-- input type='text' value="<%=i%> - <%=Input[i][28]%>" style='width:500px;' disabled / -->
<%
if (!Input[i][101].equals("")){
out.println("<input type='text' id='"+tableField+"_dow' style='width:30px' disabled />");
}
%>


<!-------------------------------------------------------------------html.date-------->
<% } else if (Input[i][6].equals("Date") & (! Input[i][7].equals("GRID"))){

if (!Input[i][40].equals("readonly")) {
masks="var errorMessage"+i+" = 'Invalid date: ${value}. Expected format: ${mask}';var dateMask"+i+" = new DateMask('yyyy-MM-dd', '"+tableField+"'); dateMask"+i+".validationMessage = errorMessage"+i+";"+masks;
}

%>
</td>
<td style="vertical-align:top;" generator="td9" >
<input
generator='input02'
class='<%out.println(Input[i][28].replace(".","_"));%>'
type="date"
id="<%=tableField%>"
name="<%=tableField%>"
onblur="<%=Input[i][39]%>"
style="clear:both; width:70px;<%=Input[i][31]%>"
maxlength="<%=Input[i][10]%>"
onClick="/*201408221710 SelectAll(this.id);*/"
title="<%=Input[i][49]%>"
<%=Input[i][34]%>
<%=Input[i][40]%>
onfocus="
oldValue=this.value;
/*201408221710  this.select();*/
prevField ='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField ='<%=Input[i][29]%>' ;
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/><!--endof.html.date-->


<%------------------------------------------------------------------------html.upload--------%>
<% } else if (Input[i][6].equals("upload")  & (! Input[i][7].equals("GRID"))){
%>
</td>
<td style="vertical-align:top;">
<input type="button" value="Upload" class="UploadButton"
generator='input03'
<%=Input[i][34]%>
onclick="
vformStatus='upload';
mTargetName='';
<%=Input[i][42]%>


<%if(PROCESSING_MODE.equals("D") | (Input[i][123].equals("enableWhenApprove") & PROCESSING_MODE.equals("A")) ){%>
//upload.popup
if (mTargetName!='NoContinue'){
if (_row<700) {_i=-250;} else{_i=_row*1-900;}
_i=0; // uploadPopup
$('#popup-wrapper').parent().css('width', '40%');
$('#popup-wrapper').parent().css({position:'relative'});
$('#popup-wrapper').width('100%').height(200).css({top: _i,  position:'absolute'});
$('#popup-wrapper').css('border-top','10px #ccc solid');
$('#popup-wrapper').css('margin-top', '0px');
_i=null;
$('#popup-wrapper').resizable('disable').removeClass('ui-state-disabled');
$('#moralFrame').prop('src','upload6.jsp?folder=<%=Input[i][74]%>'
+'&fieldName=<%=tableField%>'
+'&renameMessage=<%=Input[i][84]%>'
+'&targetName='+mTargetName+'&updateIMG=' );
$('#clicker').click();
}
<%}%>
"
style="cursor:pointer;<%=Input[i][31]%>">
<br\>
<input type="text"
generator='input04'
class="viewUpload"
size="2"
id="<%=tableField%>"
name="<%=tableField%>"
onblur="<%=Input[i][39]%>"
style="clear:both; width:<%=Input[i][25]%><%=Input[i][26]%>;cursor:pointer;<%=Input[i][31]%>"
maxlength="<%=Input[i][10]%>"
onClick="/*201408221710 SelectAll(this.id);*/"
ondblclick="s97=this.value; viewUpload(s97,''); /* function viewUpload */"
title="<%=Input[i][49]%>, Click it to zoom"
<%=Input[i][34]%>
<%=Input[i][40]%>
onfocus="
/*201408221710 SelectAll(this.id);*/
prevField ='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField ='<%=Input[i][29]%>';
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/>

<%---------------------------------------------------------------------------------html.image--------%>
<% } else if (Input[i][6].equals("image")  & (! Input[i][7].equals("GRID"))){
%>
</td>
<td colspan='2'>
<div style="height:20px;width:300px;">
<input type="button" value="image" class="UploadButton"
generator='input05'
style="clear:both; float:left; width:60px;"
onclick="
mTargetName='';
<%=Input[i][42]%>
if (mTargetName!='NoContinue'){
//imagePopup
$('#popup-wrapper').resizable('disable').removeClass('ui-state-disabled');
$('#popup-wrapper').width(<%=Input[i][47]%>).height(200);
$('#moralFrame').prop('src','upload6.jsp?folder=<%=Input[i][74]%>'
+'&fieldName=<%=tableField%>'
+'&renameMessage=<%=Input[i][84]%>'
+'&updateIMG=img<%=tableField%>&targetName='+mTargetName+'&updateIMG=' );
$('#clicker').click();
}
"
style="cursor:pointer;">



<input type="button" value="Refresh" class="UploadButton"  generator='input02'
style="float:left; width:60px;"
onclick="
s=_lookup('<%=tableField%>');
s='<%=DATABASE%>/<%=Input[i][74]%>/'+s;
document.getElementById('img<%=tableField%>').src=s;"
style="cursor:pointer;">

<input type="text"
size="2"
readonly="readonly"
id="<%=tableField%>"
name="<%=tableField%>"
onblur="<%=Input[i][39]%>"
style="clear:both; width:<%=Input[i][25]%><%=Input[i][26]%>;cursor:pointer;"
maxlength="<%=Input[i][10]%>"
onClick="/*201408221710 SelectAll(this.id);*/"
ondblclick="viewUpload(this.value,''); /*
*/"
title="<%=Input[i][49]%>"
<%=Input[i][34]%>
<%=Input[i][40]%>
onfocus="
/*201408221710 SelectAll(this.id);*/
prevField ='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField ='<%=Input[i][29]%>';
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
/>
</div>
<img src="images/noImage.jpg" border="1" id="img<%=tableField%>" alt="upload Image" width="304" height="228">
<!--
<img src="BR201312111529/product/Jellyfish.jpg" border="1" id="img<%=tableField%>" alt="upload Image" width="304" height="228">
-->
<!--endof.html.upload--> <!--documentStatus-->

<% } else if (Input[i][62].equals("documentStatus")){ %>  <!--20140210-->
<% } else if (Input[i][6].equals("dummy")){ %>
<span>It is dummy input</span>
<% } else { %>
<% if (sLabel.length>=2  && iCreatingGrid==0) { %>
<span>
<%=sLabel[1]%></span>
<%---it is second label-------%>
<% } %>
<%if (iCreatingGrid==100) {%><td style="vertical-align:top;" generator='td1'> <%}%>  
<%if (iCreatingGrid==0) {%>
<%-------------------------------------------------------------------------------------text--------%>
<!--html.mask.numeric-->
<% if(Input[i][54].equals("numeric")){
masks="var numericMask = new InputMask(JST_MASK_NUMBERS,'"+Input[i][28]+"');"+masks;
}
%>
<!--html.mask.upper-->
<% if(Input[i][52].equals("upper")){
masks="var upperMask = new InputMask(fieldBuilder.upperAll(),'"+Input[i][28]+"');"+masks;
}
%>
<!--html.mask.lower-->
<% if(Input[i][53].equals("lower")){
masks="var lowerMask = new InputMask(fieldBuilder.lowerAll(),'"+Input[i][28]+"');"+masks;
}
%>
<% if(! Input[i][55].trim().equals("")){
masks="var inputMask"+Input[i][28].replace(".","_")+" = new InputMask('"+ Input[i][55].trim()+"','"+Input[i][28]+"');"+masks;
}
%>
<% if (!Input[i][91].equals("dependent") & !Input[i][104].equals("nearLabel")){ %>
</td>
<%-----------------------------------------------------------------------html.text--------%>
<td style="border:<%=tableRule%>px solid black;vertical-align:top;" generator="td3"
colspan="<%=Input[i][59]%>" rowspan="<%=Input[i][77]%>" ><!--20140113019-->
<!--20140205--><div style="<%=layoutDivWidth%>;  padding-bottom:<%=EachLineHeight%>; border:0px solid black; <%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> "> <!--xxNewLine 201401271206 -->
<%}%>

<!--201401271152-->

<input
generator="input09"
 type="text"
class="LineInputText
<%out.println(Input[i][28].replace(".","_").trim());%>
<%
if (Input[i][6].equals("autocomplete")) {out.println(" "+Input[i][3]+Input[i][4]);}
%>
"
<%=Input[i][100]%>
id="<%=Input[i][28]%>"
onClick="/*201408221710 this.setSelectionRange(0, this.value.length);*/<%=Input[i][42]%>;"
<%if (Input[i][120].equals("web")){%>
ondblclick="if (this.value.indexOf('http')>=0) window.open(this.value,'_blank')"
<%} else { %>
ondblclick="<%=Input[i][67]%>;"
<%}%>
name="<%=Input[i][28]%>"
autofocus="<%=Input[i][88]%>"
style="height:<%=textInputHeight%>; <%=inputWidth%><%=Input[i][31]%>
<%if (Input[i][120].equals("web")){%>cursor:pointer;<%}%>
<%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> "
maxlength="<%=siElement[4]%>"
<%=Input[i][34]%>
<%=Input[i][40]%>
onchange="<%=Input[i][58]%>;"
value="<%=Input[i][41]%>" /*html.text.default*/
placeholder="<%=Input[i][98]%>"
onfocus="
_setFocus='<%=Input[i][28]%>';
oldValue=this.value;
prevField='<%=Input[i][27]%>';
upperField='<%=Input[i][27]%>';
nextField='<%=Input[i][29]%>' ;
lowerField='<%=Input[i][29]%>';
enterField='<%=Input[i][29]%>';"
<%if (i+1<Input.length) {
if (i!=0){out.println("onblur=\" newValue=this.value;"+Input[i][39]+" enterField='"+Input[i+1][29]+"';\" ");}}%>

<%if (i==0 && keyValue.equals("null")){out.println("onblur='keyValue=this.value; retrieval();'");}%>
<%if (i==0 && !keyValue.equals("null") && (KEYVALUE1.trim().equals(""))){out.println("readonly"); }%>
/>

<%
if (!Input[i][101].equals("")){
out.println("<input type='text' id='"+tableField+"_dow' style='width:30px' disabled />");
}
%>
<%}%>
<%if (iCreatingGrid==100) {%></td> <%}%>
<% } %>
<%} //endfor Input.length%>
<%if (iCreatingGrid==0) {%>
<% } %>
</p> <!--ddd-->
<%if (iCreatingGrid==0) {%>
<% } %>
<%if (SetGrid==2) { %>
</TABLE><!--tableClose-->
<div id='emptyDiv01' style='border:0 black solid;height:0%;width:100%;'></div><!--201408281525-->
</div>
</div><!--End of define SetGrid==2 grid-->
<div id='emptyDiv02' style='border:0 black solid;height:100%;width:100%;'></div><!--201408281525-->
<%} else if (SetBox==2){%>
</div><!-- boxClose 20130913-->
<%}%>
</table><!--page.table-->
</div> <!-- End of div id="content" class="posttext"-->
<%if (SetPageHeader==2) {%>
</div><!-- div id="tab1" class="tab_content"-->
</div><!-- Generate class="pageFrame" -->
<%}%>
<%if (MODE.equals("INPUT") || (MODE.equals("SINPUT")  | MODE.equals("DUMMY") | MODE.equals("MINPUT")) || MODE.equals("SVIEW")){%>
</tbody><!--20140113a>
</table><!--20130828-->
<%}%>
</div> <!-- id="content"-->
<input style="display:none;" title="MastTable.RecordID" class="recordID" type="text" value="value2" id="<%=masterTableName%>.recordID" name="<%=masterTableName%>.recordID"></input> <!--20130821-->
</form>
</div> <!--id="container" -->
<%if   (MessageControl.equals("on") & ((MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT")) || MODE.equals("SVIEW")))){%>
<!-- table STYLE='MARGIN-TOP:100PX;CLEAR:BOTH' id="messageList" -->
<!---------------------------MessageList--------------------------------------------------------------------->
<div
  id='MessageListBox' style='border-right:1px  lightgray solid;'    >
<div
  id="MessageButton" style="background:lightblue;margin-top:50px;  border-bottom:1px  lightgray solid; width:100%;">
<h1 style="text-align:center;">Activities</h1>
<!-- span style="margin-left:12px; display:table-cell;padding-left;12px;width:100%; background:lightblue; text-align:centre;">Active History</span -->
<span style="margin-right:12px;">

<span style='float: left;border:1px solid lightgray; ' >

<label generator='label6' style="display:none" for="Recno_tableName_MessageHeader">Recno : </label>
<input  style="width:2em;margin-left:5px; display:none;
background-color:#elelel; text-align:right;"
type="text" disabled="disabled" value="" name="Recno_tableName_MessageHeader" id="Recno_tableName_MessageHeader" />
</span>
<div style="display:none;">
<button generator='button08'  class="GridButton" type="button"
onclick="RetrievalStatus=0;hadEdit=1;
tableName_MessageHeaderAppend()">Append</button>
<button generator='button09'  class="GridButton" type="button"
onclick='deleteRow(thisDBFName,thisRowNo);hadEdit=1;'
onfocus="thisTable=tableName_MessageHeader;">
Delete</button> <!--20130531-->
</div>
</span>
</div>

<div    style="clear:both; border: 0px black solid; width:100%;" id="MessageTable"><!--grid-->
<div style="padding-left:0px;padding-right:12px;overflow:hidden;"  id="MessageHeader"> <!--gridLeftOffset-->
<table     generator='table5' cellspacing=0 cellpadding=6 id="MessageTableHeader" style="text-align:center;" rules="rows" border=1>
<colgroup>
<col span='1' style='width:30px;min-width:30px' > <!-- header.delete.mark -->
<col span='1' style='width:20.0%;'/>
<col span='1' style='width:80.0%;'/>
</colgroup>
<tr style="height:18px;" >
<th generator='th04' id='firstColumnExtend' style='margin:0px; broder:0; padding:0; width:8px; bgcolor=lightgrey;'>_</th>
<th generator='th05' bgcolor="lightgrey">
<div    title="" style="text-overflow:ellipsis;">Date</div>
</th>
<th generator='th06' bgcolor="lightgrey">
<div    title="" style="text-overflow:ellipsis;">Remark</div>
</th>
<th generator='th07' id="lastColumnExtend" style="width:15px;"></th><!--201404280422-->
</tr>
</TABLE>
</div>
<DIV STYLE="overflow-y: scroll; width:100%; height:240px;
border-left: 1px gray solid; border-bottom: 1px gray solid; background: #fff;
padding:0px; margin: 0px; " id="divMessageBody">
<table     generator='table6' id="tableName_MessageHeader" class="t1" ></TABLE>
</div>
</div><!--End of define SetGrid==2 grid-->
</div id='MessageListBox'>
<%}%>


<%--------------------------------------------------------------------------------%>
<script>
//documentCompanyPrefix='<%=bean.getCompanyPrefix()%>';
PROCESSING_MODE='<%=PROCESSING_MODE%>';
numWindows = 0;
_top=20;
_left=20 ;
parameters = "";
onerror=handleErr;

if($){
$.ajaxSetup({  //ajax.setup
async: false,
timeout:5000
});
}
//201312161144


<% /*******************************************java.javascript*********************Java.Generate.JavaScript  */
out.println("keyValue="+keyValue) ; //20130829
String blank="";
if (MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT"))  || MODE.equals("SVIEW")){out.println("$('.SaveButton').css('display', 'inline');");}  //20130821
iOldGroupNo=0;SetGrid=0;int iFieldCount=0;PreviouField="null"; nextField="null";
String defaults="";
for ( int i = 0; i < Input.length; i++){
if (i+1<Input.length){
String _si3x=Input[i+1][0];
String raws[] = _si3x.split(",");
nextField=raws[1];
}


String tableField=Input[i][3]+"."+Input[i][4];
String _si=Input[i][0];
String siElement[] = _si.split(",");
String sInputType=siElement[2];
String siType[]=siElement[2].split(":");
siElement[3]=Input[i][25];  // Display Length 20130726
Double iNewGroupNo = new Double(Input[i][1]+"."+Input[i][2]);
String splits[]=tableField.split("\\.");
String dbfName=splits[0];
String s_FieldName=tableField.replace(".","_");
//20130601
siElement[3]=Input[i][25];  // Display Length 20130726
double iWidth =  new Double(siElement[3]);
String sID=Double.toString(iNewGroupNo);
sID=sID.replace(".","_");

//*****************************************************************************java.blank******//
if (!(MODE.equals("LIST") | MODE.equals("CHOICE"))) { //20131114
if((!Input[i][41].equals("")) & (!Input[i][41].equals("null"))){ //41=default
if (Input[i][41].equals("today")){
blank=blank+"\n_refreshv2('"+tableField+"',_today());";
} else {
blank=blank+"\n_refreshv2('"+tableField+"','"+Input[i][41]+"');";
}


} else {

blank=blank+"\n_refreshv2('"+tableField+"','"+Input[i][14]+"');";

}
}
/*************************************************************function key : append****CreateTableBody********/
if (iNewGroupNo!=iOldGroupNo && SetGrid==2){SetGrid=0;out.println(""+defaults+"}"); defaults=""; } //Endof.Grid.append
if (iNewGroupNo!=iOldGroupNo && SetBox==2){SetBox=0;}
%>

<% if((!Input[i][7].equals("GRID")) && Input[i][6].equals("combo") && (! Input[i][33].trim().equals("")) ){

%>
//alert('<%=Input[i][7]%>');
//2013091901  JAVA generate multi jquery statement.
// 20140919 html.combo.ajax
var obj_field=document.getElementById('<%=Input[i][28]%>');
<%if(Input[i][121].equals("spaceCombo")){out.println("obj_field.options[0] = new Option('','');");}%>
//20140919 obj_field.options[0] = new Option('','');
s='<%=Input[i][33]%>&db=<%=DATABASE%>'

$.getJSON(s,
function(data) {
if (data[0]){
for (r=0 ; r<data.length; r++)
{
$(obj_field).append($('<option></option>').val(data[r][0]).html(data[r][1]));
}
}
}
)
obj_field=null; //20140718
<%}%>
<%
/************************************************************grid.body**************/
if (iNewGroupNo!=iOldGroupNo && siType.length==2) {iCreatingGrid=1;SetGrid=2;iOldGroupNo=iNewGroupNo;
int i11=Integer.parseInt(Input[i][61]);
listTables[i11]=sID; //20140206
alistTables[i11][0]=sID; //20140206
sqlTableName[i11]=Input[i][3];
%> var reccount__tableName<%=sID%>=1;

function tableName<%=sID%>Append(){ // grid.append
var table=document.getElementById("tableName<%=sID%>");
var thisRow = table.rows.length;
currentRow=thisRow; //20140520
var NewRow=table.insertRow(thisRow);
firstField='<%=tableField%>' + thisRow; //20130530
<%if (MODE.equals("CHOICE") | MODE.equals("LIST")){out.println("firstField='"+tableField+"0';");}%>
<%if (MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT"))  || MODE.equals("SVIEW")){%>
/************************Delete Mark***********************grid.delete.mark*/

var newText = document.createElement('input'); // Delete mark on the table
newText.style.cssText = 'width:6px;'
newText.name = '<%=dbfName%>._action[' + thisRow+']';
newText.id = '<%=dbfName%>_action' + thisRow;
newText.setAttribute('autocomplete','off') ;
var newColumn = NewRow.insertCell(-1);
newColumn.style.cssText = 'border-right:0px;border-bottom:1px solid gray;padding-left:-1px;background:write;';
newColumn.appendChild(newText); // Delete mark on the table

/*************************grid.parent.recordid************/


var newText = document.createElement('input'); // parentTablerecordID
newText.style.cssText = 'width:0px; display:none;border: <%=Input[i][31]%>'
newText.name = '<%=dbfName%>.<%=parentRecordid%>[' + thisRow+']';
newText.id = '<%=dbfName%>.<%=parentRecordid%>' + thisRow;
newText.value=RECORDID;
newText.type="hidden";
var newColumn = NewRow.insertCell(-1);
newColumn.style.cssText = 'border-right:0px;border-bottom:1px solid gray;background:write;';
newColumn.appendChild(newText); // parentTablerecordID


<%}%>

<%}%>
<% if (sInputType.equals("Xlookup")){ %> var old<%=s_FieldName%>="";
<%}%>

<%if (tableField.equals(dbfName+".recordID")&& siType.length==1){ %>
<% } %>
<%if (iOldGroupNo==iNewGroupNo &&  siType.length==2){ //201401211735%>
// <%=tableField%>  <%=dbfName+".recordID"%>
//201401221742 grid.num2 grid.num.2

<%String types=",textarea,date,num.5,num.4,num.3,num.2,num.1,num.0,text,autocomplete,combo,numeric,upload,lookupValue,check,";%>
<%if (types.indexOf(siType[0])>=0){%>



//grid.dependent
<% if (! Input[i][91].equals("dependent")){
out.println("var newColumn = NewRow.insertCell(-1);");
}%>

//////////////////////////////////////////////////
// grid.type.define
//////////////////////////////////////////////////
//grid.upload
<% if  (siType[0].equals("upload") ) { %>
var newText = document.createElement('button'); //20140623
newText.type='button';  
newText.style.cssText = 'display:block;float:left;'; //grid.upload.css
var t=document.createTextNode("Upload");
newText.appendChild(t);
newText.className = 'UploadButton';
<%if(PROCESSING_MODE.equals("D")){%>
newText.onclick=function(event){
mTargetName=datetimer(); // grid.upload.click grid.upload.onclick
vformStatus='upload';
$("#popup-wrapper").parent().css( "width", "40%"); //20140814
$("#popup-wrapper").parent().css( {position:'relative'}); //20140814
if (_row<700) {_i=-250;} else{_i=_row*1-900;}
$('#popup-wrapper').resizable('disable').removeClass('ui-state-disabled'); //20140721
$('#popup-wrapper').width("100%").height(200).css({top: _i ,  position:'absolute'}); //20140814
_i=null;
$('#popup-wrapper').css("border-top","10px #ccc solid");
$("#popup-wrapper").css("margin-top", "0px");
$('#moralFrame').prop('src','upload6.jsp?folder=<%=Input[i][74]%>'
+'&fieldName=<%=tableField%>'+thisRow
+'&renameMessage=The file name will rename to Sales Order'
+'&targetName='+mTargetName+'&updateIMG=' );
$('#clicker').click();
}
<%}%>
newColumn.appendChild(newText);  //grid.upload.table.cell
newColumn.height='20'; // grid.column.height
var newText = document.createElement('input');
newText.style.cssText = 'cursor:pointer;border:1px gray solid;  display:block;<%=Input[i][31]%>';
newText.readOnly=true;  // grid.readonly
newText.ondblclick = function(event){
s97=this.value; viewUpload(s97,''); //hardcode 201409031600
};

<% } else if  (siType[0].equals("lookupValue") ) {  //grid.lookup.create %>
var newText = document.createElement('input'); //20140623
newText.type='text';  
newText.id = '<%=tableField%>_Display_' + thisRow;
newText.disabled='disabled';
newColumn.appendChild(newText);  //table.cell
var newText = document.createElement('input');

<% } else if  (siType[0].equals("check") ) {  //grid.check 201409051810 %>
var newText = document.createElement('input'); //20140623
newText.type='checkbox';  
newText.id = '<%=tableField%>_Display_' + thisRow;
newText.style.cssText = 'height:18px;';
newText.classList.add("choiceCheckbox")

<% } else if  (siType[0].equals("combo") ) {  //grid.combo %>
var newText = document.createElement('select');
newText.setAttribute('fieldName','<%=tableField%>') ; //grid.fieldName
<% String arrS[] = Input[i][44].split(",");
if (!PROCESSING_MODE.equals("D")){out.println(" newText.disabled=true;");}; //201409031700
for (int r=0;r<arrS.length/2;r++){
int i1=r*2;
int i2=r*2+1;
out.println("var option1 = document.createElement('option');");
out.println("option1.value='"+arrS[i1].trim()+"';");
out.println("option1.innerHTML='"+arrS[i2].trim()+"';");
out.println("newText.appendChild(option1);");
out.println("option1=null;");
} %>

<% } else if  (siType[0].equals("textarea") ) {  // grid.textarea grid.memo %>
var newText =zxcFormField('TEXTAREA','option1');
//20140917 newText.style.cssText = 'resize:none;border:0px;'; //20140722

<% } else { %>
var newText = document.createElement('input');  // grid.text
<% }%>
if (newText.type & newText.type=='') newText.type='text';  //201409051815 before is newText.type='text'
// endof grid.type.define



//201409051817 newText.className="gridDblClick"; //20130904


//grid.classAddd
newText.classList.add("gridDblClick") // 201409051817
newText.classList.add("<%=dbfName%>_deleteRow"+thisRow); //20140627
newText.classList.add("<%=Input[i][3]%>_<%=Input[i][4]%>"+thisRow); //20140811 <%=tableField%>
<% if(Input[i][6].equals("num")){ out.println("newText.classList.add('num')");}  //201409221030 %>

//grid.date
<%
if  (Input[i][6].trim().equals("date")){
//onkeydown="DateKeyDown(event,this.value,this.id);"
out.println("newText.onkeydown = function(event){DateKeyDown(event,this.value,this.id);};"); //201409021600
out.println("newText.classList.add('datepicker');"); //grid.date.css
out.println("if (PROCESSING_MODE!='D'){newText.readOnly=true;}"); //201408291500

out.println("newText.classList.add('today');"); //20140912


}
%>


//grid.css
<% if  (siType[0].equals("textarea") ) {  // grid.textarea.css %>
newText.style.cssText = 'cursor:pointer;border:0;margin-top:0; display:block;width:100%;resize:none;<%=Input[i][31]%>';
<% } else if  (Input[i][120].equals("web")) {   %> // grid.web.css
newText.style.cssText = 'cursor:pointer;width:100%';
<% } else if  (Input[i][120].equals("combo")) {   %> // grid.combo.css
<% } else if  (siType[0].equals("lookupValue") ) {   %> // grid.lookup.css
newText.style.cssText = 'display:none';
<% } else if  (siType[0].equals("check") ) { %> // grid.check.css 20140906
newText.style.cssText = 'height:18px;  display:block;min-width=107px;width:100%; <%=Input[i][31]%>';
<% } else if  (! siType[0].equals("upload") ) { %> // grid.upload.css
newText.style.cssText = 'display:block;min-width=107px;width:100%; <%=Input[i][31]%>'; //grid.text.css
<% } else if  (Input[i][6].trim().equals("date")) {out.println(Input[i][6]); %>
<%} else {%>

<%}%>

// grid.general.setting
if (PROCESSING_MODE!="D"){newText.readOnly=true;} //201408291500
newText.autocomplete = 'off'; //20140423
newText.name = '<%=tableField%>[' + thisRow+']';  // grid.name
newText.setAttribute('lastValue','') ; //grid.lastValue
newText.setAttribute('fieldName','<%=tableField%>') ; //grid.fieldName
newText.setAttribute('rownum',thisRow) ; //grid.fieldName
newText.setAttribute('isDisabled','<%=Input[i][34]%><%=Input[i][40]%>') ; //20140730
<%
if (Input[i][86].trim().equals("ZERo")){
out.println("newText.setAttribute('fielddefault','testingxx');");
} else {
out.println("newText.setAttribute('fielddefault','');");
}
%>

newText.setAttribute('fieldType','<%=Input[i][54]%><%=Input[i][35]%>') ; //grid.fieldType 20140528
newText.id = '<%=tableField%>' + thisRow;
/*newText.innerHTML ='<textarea name="textarea2" id="textarea2" cols="28" rows="2"></textarea>';*/

// grid.value
if ('<%=tableField%>'=='<%=dbfName%>.recordID'){
newText.value=milliseconds = new Date().getTime(); //grid.datetimer
currentRecordID=newText.value; //20140224
}

//grid.default
<%if(!Input[i][41].equals("")){
if (Input[i][41].equals("today"))
{defaults=defaults+"_refreshv2('"+tableField+"'+thisRow,_today());\n /*201409291040*/";}
else {
defaults=defaults+"_refreshv2('"+tableField+"'+thisRow,'"+Input[i][41]+"');\n";
}
}%>

//grid.placeHolder
newText.placeholder = "<%=Input[i][98]%>";//201409121100

//grid.keypress grid.onkeypress

<% if(Input[i][6].equals("num")){ %>

newText.onkeypress=function(event) {hadEdit=1; if(fieldEditBegin==1){this.value='';fieldEditBegin=0;}}

<%} else {%>

newText.onkeypress=function(event) {hadEdit=1;}

<%}%>

//grid.onchange
newText.onchange=function(event){hadEdit=1; <%=Input[i][58]%>;};


// grid.dbclick
<% if  (! siType[0].equals("upload") ) { %>
newText.ondblclick = function(event){  // grid.dbclick grid.dblclick.textarea grid.textarea.dblclick
   //201409071826 if (window.getSelection){window.getSelection().removeAllRanges();} else if (document.selection){document.selection.empty();} //201409041010
// grid.textarea.dbclick gridd.dblclick.textarea //grid.editTextAreaPopup
<%if (siType[0].equals("textarea")) {
String s77=Input[i][21];
if (!Input[i][99].equals(""))s77=Input[i][99]; //201407222
%>
var editMode='edit';
if ($(this).is('[readonly]')) {editMode='readonly';}
else {hadEdit=1;}
vformStatus='editingTextarea';
s1='<%=s77%>'; // grid.textarea.label
var s=this.value;
s=s.replace(new RegExp('\r?\n','g'), '<z><z>');
s=s.replace('&', '<and>');
s=s.replace('\'', '<SinglEQuot>');
$("#popup-wrapper").parent().css( "width", "40%"); //20140814
if (_row<700) {_i=-250;} else{_i=_row*1-900;}
_i=-226; //201409011545 popup_top
$('#popup-wrapper').width("100%").height(<%=Input[i][48]%>).css({top: _i ,  position:'absolute'}); //20140814
_i=null
$('#popup-wrapper').css("border-top","10px #ccc solid");
$("#popup-wrapper").css("margin-top", "0px");
$('#moralFrame').prop('src','editTextArea.jsp?fieldName=<%=tableField%>'+thisRow+'&thisValue='+s
+'&caption='+s1+'&mode='+editMode);
$('#clicker').click();
<%}%>
currentRow=thisRow;
currentID='<%=tableField%>'+thisRow;
currentField='<%=tableField%>';


<%if (PROCESSING_MODE.equals("D")){%> //201409031640 grid.dblclick.choice
<%=Input[i][67]%>;
<%=Input[i][80]%>
<%}%>

//choice.grid.dblclick.choice 20140523
<%if(MODE.equals("CHOICE")){%>
<%=choiceEvent%>
parent.formResult=Xdata[thisRowNo];
parent.exitMoralBox();
<%}%>


//grid.num.dblclick  grid.dblclick.num 20140907
<% if(Input[i][6].equals("num")){ out.println("this.select();");}%>


//grid.dblclick.list grid.list.dblclick
<%
if(Input[i][120].equals("web")){ out.println("window.open(this.value,'_blank');");} // grid.dblclick.web 201409171000
else  //201409171000
if ( !ListSubFormName.trim().equals("") &!ListSubFormName.trim().equals("null")){
if (! modalWidth.equals("")){
out.println("$('#popup-wrapper').width("+modalWidth+").height("+modalHeight+");");

} else {
//grid.dblclick.list
out.println("$('#popup-wrapper').width(WINDOW_WIDTH).height(WINDOW_HEIGHT);");
out.println("$('#popup-wrapper').css('padding', '0px');");
}
if (! ListSubFormExtend.trim().equals("")){
out.println("s1='';");
out.println(ListSubFormExtend);
out.println("s='input.jsp?mode="+modalMode+"&input='+s1+'"+ListSubFormName+"&config='+s1+'"+ListSubFormConfig+"&config0='+s1+'"+ListSubFormConfig0+"&key=recordid&keyValue='+Xdata[thisRowNo];");
out.println("editingRow=thisRowNo;");
//out.println("document.write(s);");  //  for mode=LIST e.g. taxfiling  multi sub form
out.println("$('#moralFrame').prop('src', s);");
out.println("$('#clicker').click();//20131113b");
} else {
out.println("var viewContent=1;");
out.println(viewContentCtl); //201409121430 viewContentCtl
out.println("if (viewContent==1){");
out.println("m0721=datetimer(); s='input.jsp?mode="+modalMode+"&input="+ListSubFormName+"&config="+ListSubFormConfig+"&config0="+ListSubFormConfig0+"&key=recordid&keyValue='+Xdata[thisRowNo]+'&timer='+m0721");
out.println("editingRow=thisRowNo;");
//out.println("document.write(s);");  //20131113  // e.g. can input grid.dbclick.input.subform.input
// ok out.println(" window.open(s);");
out.println("$('#popup-wrapper').draggable( 'disable');"); //201409131105
out.println("$('#popup-wrapper').parent().css( 'top', '-5px' ); ");//201408251105 body top -5px
out.println("$('#popup-wrapper').css( 'top', '0px' ); ");//201408251105
out.println("$('#popup-wrapper').resizable('disable').removeClass('ui-state-disabled');");
out.println("if($(window).width() !=$('#popup-wrapper').width() ) $('#popup-wrapper').css('width',$(window).width()+'px');"); //20140812
out.println("if($(window).height() !=$('#popup-wrapper').height() ) $('#popup-wrapper').css('height',$(window).height()+'px');"); //20140812
out.println("if($('#popup-wrapper').height()==0){$('#popup-wrapper').css('height',700);};");
out.println("$('#moralFrame').prop('src', s);");
out.println("$('#clicker').click();//20131113a");
out.println("}");
out.println("else {_messagebox('Not Authorized !!',0,16);}");//20140912141
}
}
%>
};
<%}%>
// end of grid.dblclick


// grid.onblur grid.lostfocus
newText.onblur = function(event) {
newValue=this.value;
<%=Input[i][39]%> //grid.onblur
<%
if (! Input[i][63].equals("")) {  //[63] sumTotal
String s=Input[i][63];
s=s.replace("tableName()","tableName"+sID)+";";
out.println(s+";//201410091550");
//formInit=formInit+s;
endofload=endofload+s;
}
%>
<% if(Input[i][35].equals("currency") & !Input[i][40].equals("readonly") ){ %> //grid.currency.onblur
<% if(Input[i][31].indexOf("text-align:right")>=0){ %>
this.value=this.value.replace(/,/g,'');
i73=this.value*1;
this.value=i73.formatMoney(2, '.', ',');
document.getElementById(this.id).style.textAlign="right"; //20140207 currency
<%}%>
<%}%>

//grid.num.onblur 201408281140
<% if(Input[i][6].equals("num")){ %>
<% if(Input[i][31].indexOf("text-align:right")>=0){
out.println("i73=this.value*1;");
out.println("this.value=i73.formatMoney("+Input[i][9]+", '.', ',');");
out.println("document.getElementById(this.id).style.textAlign='right'; ");
}%>
<%}%>


//grid.numeric.onblur
<% if(Input[i][54].equals("numeric")){ %> // grid.numeric
//var numericMask = new InputMask(JST_MASK_NUMBERS,'<%=tableField%>'+thisRow); //2014082215555
<% if(Input[i][31].indexOf("text-align:right")>=0){ %>
this.value=this.value*1;
document.getElementById(this.id).style.textAlign="right"; //20140207 numeric.handle
<%}%>
<%}%>

thisID='dummy'; //20140813
highlightGridRow("tableName<%=sID%>","<%=MODE%>"); //20140813
}



newText.onfocus = function(event) { //grid.onfocus grid.focus
oldValue=this.value;
fieldEditBegin=1;
_refreshv2('rowid',thisRow); // 20140730
<%if(((MODE.equals("SINPUT") | MODE.equals("MINPUT")) | MODE.equals("INPUT")) & (! siType[0].equals("combo"))){
out.println("if ($(this).is('[readonly]')) {return false;}");
out.println("/*201408221710 SelectAll(this.id);*/");
}%>
<% if(Input[i][6].equals("num")){ out.println("setTimeout(function(){this.select();},50);");} //grid.num.onfocus %>
<%if (siType[0].equals("combo")) {%>
_combo(this.id,'<%=Input[i][33]%>','<%=Input[i][56]%>'+thisRow,"<%=Input[i][57]%>",this.value); //grid.combo.onfocus
<%}%>
<%if(MODE.equals("INPUT")){out.println("/*201408221710 SelectAll(this.id);*/");}%>
thisID='<%=tableField%>' + thisRow;
<%if((! MODE.equals("LIST") )){%>
document.getElementById(this.id).style.textAlign="left"; //20140207 numeric.handle
<%if(Input[i][35].equals("currency")){%>
i7x=this.value;
this.value=i7x.replace(/,/g,"");
<%}%>
<%}%>
currentRecordID=_lookup('<%=dbfName%>.recordID'+thisRow); //20140625
thisDBFName="<%=dbfName%>";
nextField='<%=nextField%>' + thisRow;
<%if (siType[0].equals("textarea") ) {%>
enterField='textarea';
<%} else {%>
enterField='<%=nextField%>' + thisRow;
<%}%>
prevField='<%=PreviouField%>' + thisRow;
upperField='<%=tableField%>' + ((thisRow*1)-1);
lowerField='<%=tableField%>' +((thisRow*1)+1) ;
thisTable="tableName<%=sID%>";
thisRowNo=this.parentNode.parentNode.rowIndex;
gRowNo=thisRowNo;
sayRecno(thisRowNo);
highlightGridRow("tableName<%=sID%>","<%=MODE%>");
<%if((!Input[i][40].equals("readonly")) & (! MODE.equals("LIST") )){%>
$(this).select();
<%}%>
<%if (siType[0].equals("combo")) {%>
_combo(this.id,'<%=Input[i][33]%>','<%=Input[i][56]%>'+thisRow,"<%=Input[i][57]%>",this.value);  //20140804
<%}%>
};

//grid.click
newText.onclick = function(event) {
<%if(Input[i][35].equals("currency")){%>
i7x=this.value;
this.value=i7x.replace(/,/g,"");
this.select(); //grid.click.currency
<%}%>
<% if(Input[i][6].equals("num")){ out.println("this.select();//grid.num.onclick");} %>
newValue=this.value; if(oldValue!=newValue){hadEdit=1;}
<%if(((MODE.equals("SINPUT") | MODE.equals("MINPUT")) | MODE.equals("INPUT")) & (! siType[0].equals("combo")))
{out.println("/*SelectAll(this.id);201408221710*/");}%>
sayRecno(this.parentNode.parentNode.rowIndex);
currentTable='tableName<%=sID%>'; //201409081210
};

//grid.disabled
<%if(Input[i][34].equals("disabled")){out.println("if (PROCESSING_MODE!='D') newText.disabled=true;");}%>


// grid.readonly
<%if(Input[i][40].equals("readonly")){out.println("newText.readonly=true;");}%>

$('.datepicker').datepicker(); // grid.date.datepicker
$('.datepicker').datepicker('option', 'dateFormat', 'yy-mm-dd');
$('.datepicker').datepicker({autoOpen:false});
$('.datepicker').datepicker().unbind('focus').dblclick(function() {$(this).datepicker('show');});
$('.num').numeric({allow:"."});


/*newText.value='<%=Input[i][40]%>';*/
<%if (((MODE.equals("LIST") | MODE.equals("CHOICE")) | Input[i][40].equals("readonly"))
& (!Input[i][6].equals("check"))) //201409051845
{%>
newText.setAttribute("readOnly","true"); // grid.readonly.all.sestting
<%}%>


newColumn.appendChild(newText);  //newColumn.define
newColumn.height='20'; // grid.column.height
newColumn.style.cssText = 'width:<%=Input[i][25]%><%=Input[i][26]%>;<%=Input[i][73]%>;'; //grid.column.width table.cell
<% if(Input[i][54].equals("numeric")){numericMaskCount++;%> // grid.numeric.mask
var numericMask<%=numericMaskCount%> = new InputMask(JST_MASK_NUMBERS,'<%=tableField%>'+thisRow);
<%}%>


<%if (siType[0].equals("combo")) {%><%}%>

<% PreviouField=tableField; iFieldCount++;}%>
<% if (iNewGroupNo!=iOldGroupNo) {iOldGroupNo=iNewGroupNo;}
}  //201401211735 %>
<% } //201401221721 %>

<%if (SetGrid==2){ %>
//201409111135 setFocus(firstField);
} //endOfDefineAppendGrid

<%}%>
<%@ include file="inputFooterJavaScript.jsp" %>

/////////////////////////////////////////////////////////////////// Control runtime.init form.init////////////
<%out.println("function blank(){" + blank+"generateRecordID();"+ "}"); %>
<%out.println(masks);%>// errorMessage of masks
<%out.println("function defaultInput(){" + defaults+ "}"); %>


function retrieval2(mConstraint){  // call from input.txt file not for editing
s= 'tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=masterTableName%>&'+
'fields=recordid,<%=listFields[0]%>&'+
'key=<%=key%>&value='+keyValue+'&format=S,<%=listFormats[0]%>&'+
'where=where '+mConstraint+' &'+
'callback=?';
//document.write(s);
$.getJSON(s,
function(data) {
if (data[0]){
var ThisTable=document.getElementById("tableName<%=listTableSid%>");
while(1){
var lastRow = ThisTable.rows.length;
if (lastRow >=1) ThisTable.deleteRow(lastRow - 1);else break;
}
for (r=0 ; r<data.length; r++){
Xdata[r]=data[r][0];
tableName<%=listTableSid%>Append()
rf=0;
editRow=r;
<%=listRefresh[0]%>
}
}  else {
<%=notFoundAction%>
//if (keyValue!="'D'" && keyValue!="'C'"){alert("Input.jsp : No This Number "+keyValue);}
}
}
); //endofgetJsonRetrieval2
}



function retrieval(orderBy) //function retrieval() fretrieval()
{
vformStatus='reading'
currentRecordID="";
if (Xdata){currentRecordID=Xdata[thisRowNo];}
if(!orderBy){
orderBy='';
}
RetrievalStatus=1;
$.getJSON('getDate?callback=?',
function(data) {
if (data[0]){
for (r=0 ; r<data.length; r++)
{
//alert(data[0][0]);
//obj_field.options[r+1] = new Option(data[r][0],data[r][1]);
}
}
}
)
blank();

hadEdit=0;
var ThisTable=document.getElementById("tableName<%=listTableSid%>");  //20131114
if (ThisTable) {  //20131114
while(1){  //20131114
var lastRow = ThisTable.rows.length;  //20131114
if (lastRow >=1) ThisTable.deleteRow(lastRow - 1);else break;  //20131114
}  //20131114
}  //20131114
defaultInput();
<%if (queryMode.equals("and")){%>
_c00='true'; _c01='true'; _c02='true'; _c03='true'; _c04='true'; _c05='true'; _c06='true';
_c07='true'; _c08='true'; _c09='true';

<%=setConstrain%>
if ((_c00!= 'true')  | (_c01!= 'true')  | (_c02 != 'true') |( _c03 !='true') |( _c04 !='true') |( _c05 !='true') |( _c06 !='true') |( _c07 !='true') |( _c08 !='true') |( _c09 !='true'))
{
if (! keyValue){
keyValue='true';
}
}
<% } else { %>
_c00='false'; _c01='false'; _c02='false'; _c03='false'; _c04='false'; _c05='false'; _c06='false';
_c07='false'; _c08='false'; _c09='false';
<%=setConstrain%>
if ((_c00!= 'false')  | (_c01!= 'false')  | (_c02 != 'false') |( _c03 !='false') |( _c04 !='false') |( _c05 !='false')|( _c06 !='false')|( _c07 !='false')|( _c08 !='false')|( _c09 !='false'))
{
if (! keyValue){
keyValue='true';

}
}
<%}%>
if (_c0){
//20140804 document.write("<%=setConstrain%>");
}
newAdd=1;;
//alert(999);
//$('#appendData0').click();
if (keyValue)
{
newAdd=0;
_refreshv2('<%=masterTableName%>.recordID',keyValue); //201312181616
RECORDID=keyValue; //201312181616
keyValue="'"+keyValue+"'";
//alert("paraMode : "+paraMode);
<% if ((MODE.equals("SINPUT") | MODE.equals("MINPUT")) || MODE.equals("SVIEW")){key="recordID";} %>
<% if (MODE.equals("INPUT") || (MODE.equals("SINPUT") | MODE.equals("MINPUT")) || MODE.equals("SVIEW") ||  MODE.equals("VIEW")) {%>
keyValue=keyValue.trim();
$("#gridBorder").css("display", "none"); //201408251030
<%
for (int i=1;i<aTableNames.length;i++){
out.println("//alert('20140206 - '+'"+aTableNames[i]+"')");
out.println("sx= 'tableRead?'+");
out.println("'db="+DATABASE+"&' +");
out.println("'table="+aTableNames[i]+"&' +");
if(listFields[i].substring(0,1).equals(",")){
out.println("'fields=recordid"+listFields[i]+"&' +");
} else {
out.println("'fields=recordid,"+listFields[i]+"&' +");
}
out.println("'key="+parentRecordid+"&value='+keyValue +");
if(listFormats[i].substring(0,1).equals(",")){
out.println("'&format=S"+listFormats[i]+"&' +");
} else {
out.println("'&format=S,"+listFormats[i]+"&' +");
}
out.println("'callback=?';");
//  out.println("document.write(sx);"); //editing.grid.retreival.sql  // body.ajax
out.println("$.getJSON(sx,");
out.println("function(data) {");
out.println("if (data[0]){");
out.println("setTimeout(function(){");  //20140729 20140811
out.println("var r=0; for (r=0 ; r<data.length; r++){var r0729=r;");
out.println("Xdata[r]=data[r][0];");
out.println("tableName"+alistTables[i][0]+"Append()"); // grid.body.addLine
out.println("setTimeout(function(){");  //20140729
out.println("r=r0729++;rf=0; ");
out.println("editRow=r;");
out.println(listRefresh[i]);  // grid.body.retrieval
out.println("},1)");//20140729 // grid.body.retrieval.timeout
out.println("} r0729=0;");
out.println("},10)");//20140729 20140811 // grid.body.retrieval.timeout
out.println("hadEdit=0;oldValue='';newValue='';}"); //20140304
out.println("}");
out.println(");");
}
%>
$("#gridBorder").css("display", "block"); //201408251030
//window.scrollTo(0,0);
s= 'tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=masterTableName%>&'+
'fields=<%=fields%>&'+
'key=<%=key%>&value='+keyValue+'&format=<%=formats%>&'+
'limit='+limit+'&'+
'offset='+offset+'&'+
'fields=<%=fields%>&'+
'where=<%=where%>&'+
'callback=?';
//document.write(s);  // retrieval.key  editing.retreival.sql header.ajax
window.setTimeout(function() {
$.getJSON('tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=masterTableName%>&'+
'fields=<%=fields%>&'+
'key=<%=key%>&value='+keyValue+'&format=<%=formats%>&'+
'limit=25&'+
'offset=0&'+
'callback=?',
function(data) {
if (data[0]){

//alert(masterTableName);
//document.write("<%=retrievalBackString[0]%>");
<%=retrievalBackString[0]%>
//alert('<%=masterTableName%>.status');
DISK_DOC_STATUS=_lookup('<%=masterTableName%>.STATUS');

if ((<%=formReadOnly%>) | PROCESSING_MODE!="D") { //form.Readonly.handle
$('input[type="text"]').keypress(function(e){e.preventDefault();});
$('input[type="TEXT"]').keypress(function(e){e.preventDefault();});
//20140513 when enable it, status cannot save. $('input:not(.viewUpload)').each(function() {this.disabled='disabled';})
$('select').each(function() {this.disabled='disabled';})
//$('textarea').each(function() {this.disabled='disabled';})
$('button').each(function() {this.disabled='disabled';})
$('.SaveButton').each(function() {this.disabled='';})
$('input').prop('readonly', true);
$('textarea').prop('readonly', true);
}

if ((<%=formReadOnly%>) |(PROCESSING_MODE!="D")) { //show.formstatus
 if (<%=formReadOnly%>) {
_refreshv2("formStatus","Approved");
$("#formStatus").css("color","red");
} //update.form.status.set
} else {
_refreshv2("formStatus","Draft");
}


s=_lookup('<%=masterTableName%>.CREATEUSER') ;
if (s){ //show.createBy
url='tableRead?db=erp&table=USER&fields=RECORDID, ALIAS,Last_Name&where=where recordid:`'+s+'` &format=S,S,S&callback=?'
$.getJSON(url,
function(data) {
if (data[0]){
//_refreshv2('createByL','Created by : '+data[0][1]+' '+data[0][2])
$('#createByL').html('Created by : '+data[0][1]+' '+data[0][2]);
}
}
)
}

//
// begin message.Ajax  ////////////////////////////////////////

<%if (MessageControl.equals("on")){%>
setTimeout(function(){
messageAjax= 'tableRead?'+
'db=<%=DATABASE%>&' +
'table=MESSAGE_VIEW0&' +
'fields=recordid,if(isnull(TIMESTAMP),"",CONCAT(TIMESTAMP," ",SAVE_ACTION)) ,if(isnull(CONTENT),"",CONCAT(USER," - ",CONTENT)),USER,SAVE_ACTION&' +
'key=parent_recordid&value='+keyValue +
'&format=S,S,S,S,S&' +
'&order=TIMESTAMP DESC&' +
'callback=?';
//document.write(messageAjax);
$("#MessageTable").css("display", "none");
$.getJSON(messageAjax,
function(data) {
if (data[0]){
for (r=0 ; r<data.length; r++){
Xdata[r]=data[r][0];
tableName_MessageHeaderAppend();
rf=0;
editRow=r;
var s0820=data[r][1+rf++];if (s0820=='No Value' || s0820=='1753-01-01'  ){s0820='';}
_refreshv2('MESSAGE_HEADER_VIEW0.DATE'+editRow,s0820);s0820=data[r][1+rf++];
if (s0820=='No Value' || s0820=='1753-01-01'  ){s0820='';}
//201409231200 _refreshv2('MESSAGE_HEADER_VIEW0.CONTENT'+editRow,s0820.replace(/<SinglEQuoT>/g, "'").replace(/<z><z>/g, '\n').replace(/<z>/g, '\n'));
_refreshv2('MESSAGE_HEADER_VIEW0.CONTENT'+editRow,uiDisplay(s0820));
s0820=null;
window.location.href="#top_";


}
}
$( "#divMessageBody").scrollTop(0); // scroll the message to the top
}
);
$("#MessageTable").css("display", "block");

},11);

<%}%> //endofload

window.location.href="#top_";
//setTimeout(finishedOfLoad=1,2500);
$('body').css('display', 'inline'); //body.display 201409021140
} // end messageAjax  ////////////////////////////////////////

}

); //endofgetJson

}, 1);

//document.write(s);
<%}%>
mWhere='<%=where%>';
//alert(mWhere);
<% if ((MODE.equals("LIST") | MODE.equals("CHOICE"))) {%>

//String aTableNamesxx[] = TableNames.split(",");
<%if (queryMode.equals("and")){%>
if ((_c00!= 'true') | (_c01!= 'true') | (_c02 != 'true') |( _c03 !='true') |( _c04 !='true') |( _c05 !='true') |( _c06 !='true') |( _c07 !='true') |( _c08 !='true') |( _c09 !='true')){
mWhere=' where ( '+ _c00 + ' and '+_c01 + ' and '+_c02+' and '+_c03+' and '+_c04+' and '+_c05+' and '+_c06+' and '+_c07+' and '+_c08+' and '+_c09 +')' ;
}
<% } else {%>
if ((_c00!= 'false')  | (_c01!= 'false')  | (_c02 != 'false') |( _c03 !='false') |( _c04 !='false') |( _c05 !='false') |( _c06 !='false') |( _c07 !='false') |( _c08 !='false') |( _c09 !='false')){
mWhere=mWhere + ' and ( '+ _c00 + ' or '+_c01 + ' or '+_c02+' or '+_c03+' or '+_c04+' or '+_c05+' or '+_c06+' or '+_c07+' or '+_c08+' or '+_c09 +')';
}
<%}%>

var contstrain0=' or (';
var LongConstrain0='';
if (_c0){
var res = _c0.split(" ");
var delimiter="";
for (var i=0;i<res.length;i++)
{
contstrain0=contstrain0+delimiter +' FielD like `^'+res[i]+'^`'
delimiter=" and ";
}
contstrain0=contstrain0+') ';


<%
for (int i72=0;i72<Input.length ; i72++){
if (! Input[i72][72].equals("")){  //[72] likes
out.println("aa=contstrain0.replace(/FielD/g, '\\"+Input[i72][4]+"');");
out.println("if (document.getElementById('"+Input[i72][28]+"').checked)LongConstrain0=LongConstrain0+aa;");
}
}
%>




mWhere='<%=where%>';
mWhere=mWhere + ' and ( false '+LongConstrain0+' )'
}


<%
for (int i72=0;i72<Input.length ; i72++){
String s0928=Input[i72][4];
s0928=s0928.replace("{from}","");
s0928=s0928.replace("{to}","");
if (Input[i72][96].equals("from")){
//out.println("mWhere=mWhere+' and "+Input[i72][4]+" <=`2014-09-27`'");
out.println("mWhere=mWhere+' and "+s0928+" >=`'+_lookup('"+Input[i72][28]+"')+'`'");
}
if (Input[i72][96].equals("to")){
//out.println("mWhere=mWhere+' and "+Input[i72][4]+" <=`2014-09-27`'");
out.println("mWhere=mWhere+' and "+s0928+" <=`'+_lookup('"+Input[i72][28]+"')+'`'");
}
}
%>

//str.replace(/{to}/,"")
//mWhere=mWhere + ' and 100=100'; //20140927 working

if (latestOrderBy != orderBy){
ascDesc="Desc";
offset=0;
}
offset=offset*1;//201409221600
if (offset<0){offset=0;}
if (! orderBy){orderBy="<%=orderBy%>";ascDesc="DESC"} //list.ajax.orderby
s0922='tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=masterTableName%>&'+
'order='+orderBy+' '+ascDesc+' &'+
'limit='+limit+'&'+
'offset='+offset+'&'+
'fields=count(1)&'+
'key=<%=key%>&value='+keyValue+'&format=S&'+
'where='+mWhere+'&'+
'callback=?';
//document.write(s0922);  count
$.getJSON(s0922,
function(data) {
if (data[0]){
reccount=data[0][0];
}}
)

$("#offset,#pgdn,#pgup").css( "display",(reccount*1<=limit*1 ? 'none' : 'inline') );
$('#offset').html((offset+1)+' - '+(Math.min(offset+limit,reccount))+' / '+reccount);

s= 'tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=masterTableName%>&'+
'order='+orderBy+' '+ascDesc+' &'+
'limit='+limit+'&'+
'offset='+offset+'&'+
'fields=recordid,<%=listFields[0]%>&'+
'key=<%=key%>&value='+keyValue+'&format=S,<%=listFormats[0]%>&'+
'where='+mWhere+'&'+
'callback=?';

//document.write(s);

if (offset+limit>=reccount*1) offset=offset-25
$("#gridBorder").css("display", "none"); //201408251030
latestOrderBy=orderBy;
var getJsonfail=0;
var failTimes=0
do {
$.getJSON(s,
function(data) {
if (data[0]){
lastOffset=offset;
i9=0;
for (r=0 ; r<data.length; r++){
Xdata[r]=data[r][0];
if (currentRecordID==Xdata[r]){i9=r;}
tableName<%=listTableSid%>Append(); //html.body.update
rf=0; editRow=r;
<%=listRefresh[0]%>
}
r=i9;  rf=0; editRow=r;
<%=listRefresh[0]%>
}  else {
offset=lastOffset;
<%=notFoundAction%>
}
}
).fail(function(){setTimeout(getJsonfail=1,500);failTimes++;});
} while (getJsonfail==1 & failTimes<3)
if (failTimes>=2) {
/* it is ok but affect the follow display _messagebox('Network fail, please try again!!',0,16); */
}
getJsonfail=null;
failTimes=null;
$("#gridBorder").css("display", "block"); //201408251030
<%}%>
}
vformStatus=''
<%
if(!autoFocus.equals("")) {
out.println("document.getElementById('"+autoFocus+"').focus();");
}
%>
//endofloadform(4551)

<%if(!defaultSearch.equals("")){out.println("setTimeout(function(){$('#appendData0').click();},500);");}%>//201409151540
//setTimeout(function(){$('#appendData0').click();},500); //201409151540
hadEdit=0;
//alert(PROCESSING_MODE);
setTimeout(function(){<%=endofload%>},0); //201410091730
setTimeout(function(){<%=endofload%>},500); //201410091730
setTimeout(function(){<%=endofload%>},1000); //201410091730
setTimeout(function(){<%=endofload%>},3000); //201410091730
}

//****************************************************form.init html.init form.load****************************

function DateKeyDown(event,value,id){  //201409021600 dateAllow / input
if(event.keyCode==111){
var x=document.getElementById(id);
if(x.value.length==2){
var old=x.value;
x.value='20'+old;
} else if (x.value.length==6) {
var old1=x.value.substr(0,5);
var old2=x.value.substr(5,1);
x.value=old1+'0'+old2;
} else {
event.keyCode=109;
}
};
};

function HadEdit()
{
$('body input').keypress(function(){hadEdit=1;});
$('body input').change(function(){hadEdit=1;});
$('body select').change(function(){hadEdit=1;});
$('body textarea').keypress(function(){hadEdit=1;});
$('.GridButton').click(function(){hadEdit=1;});
}


$(function(){ //form.loaded
hadEdit=0;
HadEdit();
$('.num').numeric({allow:"."});


/*
$( "body" ).click(function( event ) {
event.stopPropagation();
// Do something
});
*/

$(window).resize(function(){resizeElements();}); // It is import and it must

//mousePointer.Define
$('.recordID').css('disabled', 'disabled');
$('.filePrew').change(function(){$('.browseText').val($(this).val());});
$('a').css('cursor', 'pointer');
$('.filePrew').css('cursor', 'pointer');

//mouseMove.Define
$( document ).on( "mousemove", function( event ) {_row=event.pageY;_col=event.pageX;});

//Keypress.Define key.define

$( 'textarea' ).dblclick( function( event ) {
   if (window.getSelection)
        window.getSelection().removeAllRanges();
else if (document.selection)
        document.selection.empty();
}) //201409041010 nodblclick select on textarea
$('div').attr('unselectable', 'on').on('selectstart', false).css('user-select', 'none'); //201409031405 noSelectElements
$('html').keyup(function(e){if(e.keyCode == 46 | e.keyCode == 8)hadEdit=1;})
$('.recordID').keypress(function(e){e.preventDefault();});
document.onkeydown = keyDown; /*IMPORTANT ! cannot Delete this line   */
//20140906 $('#divTableBody').dblclick(function(e){e.preventDefault();});  //201408261720
//20140906 $('#divTableBody').click(function(e){e.preventDefault();});  //201408261720
$(window).keydown(function(event){
<%out.println(inkey);%>
if(event.keyCode == 13 && event.target.nodeName != "TEXTAREA"   && event.target.nodeName != "textarea") {
event.preventDefault();
return false;
}
});
<%if ( MODE.equals("VIEW")){%>
$('input[type="text"]').keypress(function(e){e.preventDefault();});
<%}%>


//javascript.variable.reset
generateRecordID();
browserLevel=0;
upperField=""; nextField=""; enterField=""; firstField="";   prevField=""; lowerField="";
thisID=""; thisTable="" ; thisRowNo=0; ActivePage = 0;

//pageLayout.reset
var $defaultLi = $('ul.tabs li').eq(ActivePage).addClass('active');
$($defaultLi.find('a').attr('href')).siblings().hide();
$('ul.tabs li').click(function() {  //pageTabAction
var $this = $(this), _clickTab = $this.find('a').attr('href');
$this.addClass('active').siblings('.active').removeClass('active');
$(_clickTab).stop(false, true).fadeIn().siblings().hide();
return false;
}).find('a').focus(function(){
this.blur();
});

//form.variable.reset
blank();
//defaultInput();
setTimeout(function(){defaultInput();},0);
setTimeout(function(){retrieval();},0);
hadEdit=0;
setTimeout(function(){hadEdit=0;},0);
setTimeout(function(){
<%out.println(formInit); %>
;},0);
<%out.println(readonly);%>
$('#exitButtonEvent').click(fnOpenNormalDialog);
browserLevel = _getlevel();
_refreshv2("browser",browserLevel);
<%=clockRefresh%>
<%=autoCompleteS%>/*endofAutoComplete*/

//popup-wrapper.setting
$('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn', isModal: true});
$("#popup-wrapper").draggable().resizable(); //201312301439
$("#dialog").dialog({autoOpen: false});

//date.setting
$('.datepicker').datepicker();
$('.datepicker').datepicker("option", "dateFormat", 'yy-mm-dd');
$('.datepicker').datepicker({autoOpen:false});
$('.datepicker').datepicker().unbind('focus').dblclick(function() {$(this).datepicker('show');});
$(".today").val(_today()); //default.today

//screen.setting
resizeElements();  //It is important
document.body.scrollTop //20140825
if (keyValue==null | keyValue=="null" | MODE=='LIST' | MODE=='CHOICE') {
$('body').css('display', 'inline'); //body.display 201409021140
}
}

); //endof$(function(){});

function zxcFormField(tag,nme,type){
 var el;
 try {
  el=document.createElement('<'+tag+(type?' type='+type:'')+' name='+nme+' >');
 }
 catch (e){
  el=document.createElement(tag);
  if (type) el.type=type;
  el.name=nme;
 }
 return el;
}


function formValidation() //fformvalidation fvalidation
{
var result=true;
if (documentAction!='R' & documentAction!='r')
{
//alert(documentAction);
<%=formValidation%> //form.validation
result=true;
$('td input,td select').each(function()
{  //table.scan
var n78,s,v;
n78=$(this).attr('rowNum'); //grid.fieldname
s=$(this).attr('fieldName'); //grid.fieldname
// if (s!=null) document.write(s+',\n');
v=$(this).val();
if (!v) v='';
<%=gridValids%> //grid.validation
})
$('td input').each(function()
{  //table.scan remove , before save numeric doSomeThingBeforeSave

s=$(this).attr('fieldType'); //grid.fieldType
if (s=='currency' | s=='num') //201409191700
{
var i=$(this).val();
i=i.replace(/,/g,"");
this.value=i;
}
var s66="";
if ($(this).attr('fielddefault'))
{
s66=$(this).attr('fielddefault'); //grid.fielddefault
}
s67=$(this).attr('dummy0611'
); //grid.fielddefault
if (this.value==""){
this.value=s66 ;
}
}
)
} //endif(documentAction!='R')
return result;
}



//out.println(listRefresh[1]);

<%
if (listRefresh.length>=2){%>
function updateThisform(resultRecordId){ //20140221 20140224
keyValue=resultRecordId;
s= 'tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=appendData0Source%>&'+
'fields=recordid,<%=listFields[1]%>'+
'&key=recordID'+
'&value='+keyValue+
'&where=where FIND_IN_SET(TRIM(RECORDID),"'+keyValue+'")!:0 '+ //201409081430
'&format=S,<%=listFormats[1]%>&'+
'callback=?'; // retrieval after choice  afterchoice.ajax.body after.choice.ajax.body
//document.write(s);
$.getJSON(s,
function(data) {
if (data[0]){
r=0;
for (var r=0 ; r<data.length; r++){ //201409081430
<%
out.println("tableName"+alistTables[1][0]+"Append()"); //afterchoice.grid.append
%>
rf=0;
var table=document.getElementById("tableName<%=alistTables[1][0]%>"); //201408270950
editRow = table.rows.length-1; //201408270950
//201408270950 editRow=thisRowNo;
refRecordID=data[r][0];
<%=listRefresh[1]%>
_refreshv2('<%=sqlTableName[1]%>.recordID'+editRow,currentRecordID);
_refreshv2('<%=appendData0TargetKey%>'+editRow,refRecordID);
data[0]=null;
//201409081245 formResult="";
} //201409081430
}  else {alert("Connection Error"+keyValue);}
}
); //140225 endOfGetJson


// retrieval after choice refresh.header.after.choice update.header
s= 'tableRead?'+
'db=<%=DATABASE%>'+
'&table=<%=appendData0Source%>'+
'&fields=<%=appendData0HeaderSource%>'+
'&key=recordID&value='+keyValue+'&format=<%=appendData0HeaderSourceFormat%>'+
'&callback=?';
//document.write(s); //afterChoice.ajax
$.getJSON(s,
function(data) {
if (data[0]){
<%
String headTargets[] = appendData0HeaderTarget.split(",");
for(int i = 0; i < headTargets.length; i++) {
String s=headTargets[i].trim();
out.println("var s0821b=data[0]["+i+"].replace(/<z>/g, '\\n').replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n');\n");
if(s.indexOf("[")>=0){
String s0821=s.replace("[","").replace("]","");
out.println("var s0821a=_lookup('"+s0821+"');");
out.println("s0821a=s0821a.replace('[SysGen]',s0821b);");
out.println("_refreshv2('"+s0821+"',s0821a)");
} else {
out.println("_refreshv2('"+s+"',s0821b)");
//20140821 out.println("_refreshv2('"+s+"',data[0]["+i+"].replace(/<z>/g, '\\n').replace(/<SinglEQuoT>/g, \"'\").replace(/<z><z>/g, '\\n').replace(/<z>/g, '\\n'));\n");
}
}
%>

//currentEntity=_lookup('PURCHASE_HEADER.SUPPLIER');
//alert(currentEntity);
<%=appendData0ActionAfter%> //20140321
//_refreshv2("<%=appendData0HeaderTarget%>",data[0][0]);
}
}
)
//_refreshv2("PURCHASE_HEADER.SHIP_TO_ADDRESS","ABC-CBA");
//_refreshv2("PURCHASE_HEADER.COMPANY","T");

}
<%}%>



function exitMoralBox(fexit){  /* form.exit.click  fexitMoralBox messagebox.close*/
if (MODE=='MINPUT')
{
//parent.hadEdit=0;
//parent.parent.hadEdit=0;
//alert('saveAndExit');
}


if (fexit){_refreshv2('<%=masterTableName%>.STATUS',DISK_DOC_STATUS);} //201409141736

$('html, body').css('overflowY', 'auto');
//window.parent.$( "#popup-wrapper").resizable(); //20140721
$("#popup-wrapper").resizable( "enable");
$('#popup-wrapper').css({top: 0}); //201408251545
$('#popup-wrapper').css("border-top","0px #ccc solid");
$('#popup-wrapper').parent().css( "width", ""); //20140807
$("#popup-wrapper").draggable( "enable"); //myObject.draggable( 'disable' )

//20140801 window.scrollTo(0,0);
$('#close-btn').click();
if (afterUpdate=='Message'){
setTimeout(function() {
$("#inputForm").submit();
parent.exitMoralBox();
}, 100);
}


if (MODE=='SINPUT') {
//_refreshv2('<%=masterTableName%>.STATUS',DISK_DOC_STATUS);
}

if (_setFocus!=''){
setTimeout(function(){document.getElementById(_setFocus).focus();_setFocus='';},100);
}

if (formRefresh){
window.setTimeout(function() {
retrieval();
}, 200);
} else {
if (formResult){
if (1==0) {
<%=labelOndblclickAfter%>
} else {
updateThisform(formResult);
}
formResult='';  //201408271035
}


window.setTimeout(function() {
keyValue=Xdata[editingRow];
s= 'tableRead?'+
'db=<%=DATABASE%>&'+
'table=<%=masterTableName%>&'+
'fields=recordid,<%=listFields[0]%>&'+
'key=recordID&value='+keyValue+'&format=S,<%=listFormats[0]%>&'+
'callback=?';
$.getJSON(s,
function(data) {
if (data[0]){
rf=0;r=0;
editRow=editingRow;
<%=listRefresh[0]%>  //action.After.choice
}  else {alert("No This Number "+keyValue);}
}
); //endofgetJson
}, 300);

}
setTimeout(function(){$('#moralFrame').prop('src','');},200);
}

function uiDisplay(s0923){
if (!s0923) s0923=''
s0923=s0923.replace(/<SinglEQuoT>/g, "'").replace(/<z><z>/g, '\n').replace(/<z>/g, '\n');
s0923=s0923.replace(/No Value/g, "").replace(/1753-01-01/g, "").replace(/0000-00-00/g, "")
return s0923;
}

function winexit(sid) {window.returnValue =sid;window.close();}


<% if(createJavaScriptComboFunction==1){%>
function _combo(p_id,p_combo,p_filter,p_constrain,p_thisValue,p_space){  //_combo() combo.ajax
$('#'+p_id).find('option').remove().end(); //20140610
if (! p_space){p_space="";}
if (! p_thisValue){p_thisValue="";}
if (p_combo) {
reference=_lookup(p_filter);  //201401231801
if (! reference) {reference="ZdummyZ";}
var s=p_constrain.replace(/reference/,reference);
var s0821=p_combo+'&db=<%=DATABASE%>';
s0821=s0821+'&limit=999999'; //20140527
s0821=s0821.replace(/(true)/,s);
var obj_field=document.getElementById(p_id);
obj_field.options[0] = new Option('','');
if (reference) {
s=s0821
} else {
s=p_combo+'&db=<%=DATABASE%>';
}
$(obj_field).find('option').remove().end()
//document.write(s);  //20140417
var data;
$(obj_field).find('option').remove().end().append('<option value=""></option>').val('');
$.getJSON(s,
function(data) {
if (data[0]){
for (r=0; r<data.length; r++){
$(obj_field).append($('<option></option>').val(data[r][0]).html(data[r][1]));
}
}  else {
$(obj_field).find('option').remove().end().append('<option value=""></option>').val('');
}
}
); // .fail(function(){setTimeout(getJsonfail=1,500);failTimes++;});
_refreshv2(p_id,p_thisValue); //_comboRefresh
obj_field=null;
s=null
s0821=null
}
} //end of combo 201401231033
<%}%>

function SumTotal(tableName,value1,value2,targetValue,grandTotal,curRate)  //20140213
{
var obj_fc_amt=document.getElementById(targetValue);
var tbl = document.getElementById(tableName);
var lastRow = tbl.rows.length - 1;
var iix;
var i2=0;
for (iix=0; iix<=lastRow; iix++) {
x=0;
if(value1+iix){
obj_qty=document.getElementById(value1+iix);
x=parseFloat(obj_qty.value.replace(/,/g,"")).toFixed(0);
}
if ( isNaN(x)) {x=0;}

y=0;
if (value2+iix){
obj_price=document.getElementById(value2+iix);
y=parseFloat(obj_price.value.replace(/,/g,"")).toFixed(2);
}
if ( isNaN(y)) {y=0;}
var i=x*y;
if (value1==value2) i=x*1; //201410131245
if (curRate)
{
var obj_rate=document.getElementById(curRate+iix);
if(obj_rate){
i2=i2+i*obj_rate.value;
//i2=i2+i;
}
}
else
{
i2=i2+i;
}
if (targetValue+iix) {
_refreshv2(targetValue+iix,i.formatMoney(2, '.', ','));
}
}
if (grandTotal) _refreshv2(grandTotal,i2.formatMoney(2, '.', ','));
}



function fnOpenNormalDialog() { //form.back
// CancelButtonPopupReset
if (hadEdit==1 & MODE!='MINPUT'){ //201408200950 form.back form.cancel form.exit
hadEdit=0; //201409151600 problem
hadEditShould=1;
_messagebox('You have unsaved changes that will be lost.',2,32,'Are you sure to cancel ?');
} else {
parent.hadEdit=parent.hadEditShould;
parent.exitMoralBox(1);
}
}

function callback(value) {
    if (value) {
       parent.exitMoralBox();
    } else {
        //alert("Rejected");
    }
}

<%if (MessageControl.equals("on")){%>
function tableName_MessageHeaderAppend(){ //Message.Append
var table=document.getElementById("tableName_MessageHeader");
var thisRow = table.rows.length;
var NewRow=table.insertRow(thisRow);
var firstField='MESSAGE_HEADER_VIEW0.DATE' + thisRow; //20130530
// firstColumnExtend message.delete.mark
var newText = document.createElement('input'); // Delete mark on the table
newText.style.cssText = 'width:8px'
newText.name = 'MESSAGE_HEADER_VIEW0._action[' + thisRow+']';
newText.id = 'MESSAGE_HEADER_VIEW0_action' + thisRow;
newText.disabled = true; //201410101550
var newColumn = NewRow.insertCell(-1);
newColumn.appendChild(newText); // Delete mark on the table
/*************************grid.parent.recordid************/
var newText = document.createElement('input'); // parentTablerecordID
newText.style.cssText = 'width:0px; display:none; '
newText.name = 'MESSAGE_HEADER_VIEW0.parent_recordid[' + thisRow+']';
newText.id = 'MESSAGE_HEADER_VIEW0.parent_recordid' + thisRow;
newText.value=RECORDID;
newText.type="hidden";
newText.disabled = true; //201410101550
var newColumn = NewRow.insertCell(-1);
newColumn.appendChild(newText); // parentTablerecordID
var newColumn = NewRow.insertCell(-1);
var newText = document.createElement('input');
newText.style.cssText = ' display:block;width:100%; '; //grid.text.css
newText.name = 'MESSAGE_HEADER_VIEW0.DATE[' + thisRow+']';
newText.id = 'MESSAGE_HEADER_VIEW0.DATE' + thisRow;
newText.type='text';  
/*newText.innerHTML ='<textarea name="textarea2" id="textarea2" cols="28" rows="2"></textarea>';*/
if ('MESSAGE_HEADER_VIEW0.DATE'=='MESSAGE_HEADER_VIEW0.recordID'){
newText.value=milliseconds = new Date().getTime();
currentRecordID=newText.value;
}
newText.className="gridDblClick"; // messageTableAppend
newText.ondblclick = function(event){currentRow=thisRow; //messageAppendDbclick
currentID='MESSAGE_HEADER_VIEW0.DATE'+thisRow;
currentField='MESSAGE_HEADER_VIEW0.DATE';
$('#popup-wrapper').width(800).height(300);
s='input.jsp?mode=MINPUT&input=message.txt&config=messageSearchConfig.txt&config0=dummy&key=recordid&keyValue='+Xdata[thisRowNo];
editingRow=thisRowNo;
$('#moralFrame').prop('src', s);
$('#clicker').click();//20140512
};  // end of grid.dblclick
newText.onclick = function(event) {
newValue=this.value; if(oldValue!=newValue){hadEdit=1;}
sayRecno(this.parentNode.parentNode.rowIndex);
};
newText.disabled = true; //201410101550
newColumn.appendChild(newText);  //table.cell
newColumn.height='20'; // grid.column.height
newColumn.style.cssText = 'width:20.0%;padding-left:2px;background:write;border:1px solid gray;'; //grid.column.width table.cell
var newColumn = NewRow.insertCell(-1);
var newText = document.createElement('input');
newText.style.cssText = ' display:block;width:100%; '; //grid.text.css
newText.autocomplete = 'off'; //20140423
newText.name = 'MESSAGE_HEADER_VIEW0.CONTENT[' + thisRow+']';
newText.id = 'MESSAGE_HEADER_VIEW0.CONTENT' + thisRow;
newText.type='textarea';  
if ('MESSAGE_HEADER_VIEW0.CONTENT'=='MESSAGE_HEADER_VIEW0.recordID'){
newText.value=milliseconds = new Date().getTime();
currentRecordID=newText.value; //20140224
}
newText.className="gridDblClick"; //20130904  // messageTableAppend
newText.ondblclick = function(event){  // grid.dbclick //messageAppendDbclick
currentRow=thisRow;
currentID='MESSAGE_HEADER_VIEW0.CONTENT'+thisRow;
currentField='MESSAGE_HEADER_VIEW0.CONTENT';
$('#popup-wrapper').width(800).height(300);
s='input.jsp?mode=MINPUT&input=message.txt&config=messageSearchConfig.txt&config0=dummy&key=recordid&keyValue='+Xdata[thisRowNo];
editingRow=thisRowNo;
$('#moralFrame').prop('src', s);
$('#clicker').click();//20131113a
};
newText.onfocus = function(event) { //grid.onfocus (message)
oldValue=this.value;
thisID='MESSAGE_HEADER_VIEW0.CONTENT' + thisRow;
document.getElementById(this.id).style.textAlign="left";
thisTable="tableName_MessageHeader";
thisRowNo=this.parentNode.parentNode.rowIndex;
gRowNo=thisRowNo;
sayRecno(thisRowNo);
highlightGridRow("tableName_MessageHeader","SINPUT");
};
newText.onclick = function(event) {
newValue=this.value; if(oldValue!=newValue){hadEdit=1;}
sayRecno(this.parentNode.parentNode.rowIndex);
};
newText.disabled = true; //201410101550
newColumn.appendChild(newText);  //table.cell
newColumn.height='20'; // grid.column.height
newColumn.style.cssText = 'width:80.0%;padding-left:2px;background:write;border:1px solid gray;';
//setFocus(firstField);
} //endOfFunction tableName_MessageHeaderAppend(){
<%}%>

function resizeElements(){
if (MODE != 'CHOICE' & vformStatus!='editingTextarea'
& vformStatus!='messageInputBox' & vformStatus!='messageBox'
& vformStatus!='upload' & vformStatus!='choicing' )
{
$('#popup-wrapper').css('height',$(window).height()+'px');
$('#popup-wrapper').css('width',$(window).width()+'px');
}
if (vformStatus=='messageInputBox')
{
$('#popup-wrapper').css('right',$(window).width()*1-1193-100+'px');
}
_refreshv2('formWidth','W' +$(window).width());
_refreshv2('formHeight','H'+$(window).height());
_refreshv2('formInputStatus',vformStatus);
}


<%if ((MODE.equals("SINPUT") | MODE.equals("MINPUT")) & PROCESSING_MODE.equals("D")){%>
window.onbeforeunload = function (e) {  //201409031400 afterEditConfirmCancel
if (hadEdit==1){
var message = "Confirm canel after edit",
e = e || window.event;
if (e) {e.returnValue = message;}
return message;
}
};
<%}%>
<%%>
SaveButton1MessageControl="<%=SaveButton1MessageControl%>";
SaveButton2MessageControl="<%=SaveButton2MessageControl%>";
SaveButton3MessageControl="<%=SaveButton3MessageControl%>";
var selectTableName="<%=selectTableName%>";
/*<%=tableVariables%>*/


<%if ((MODE.equals("SINPUT") | MODE.equals("MINPUT"))){ //201409231200 %>
$("#normalSubmit").click(function(){
if (formValidation()){$("#inputForm").submit();}
});

$("#submit1").click(function(){  //subform.save.click submit1click form.save html.save
hadEdit=0; //201409151600
hadEditShould=1;  //201409151600
documentAction='';
if (formValidation()){
if (newAdd==1 & SaveButton1MessageControl=="on"){ //20140516
saveAction='Create';
messageBoxCaption='Are you sure to create?'; //201409230945
messageBoxPopup();
$('#moralFrame').prop('src','input.jsp?mode=MINPUT&input=message.txt&config=messageConfig.txt');
parent.formRefresh=1;
} else {
$("#inputForm").submit(); // normalSave
parent.exitMoralBox();
}
}
});



$("#submit2").click(function(){  //submit2click form.submit.click HTML.SUBMIT
hadEditShould=hadEdit;
hadEdit=0; //201409151800 problem
<%=SaveButton2ClickMethod%> //201408271230
if (formValidation()){
<%=SaveButton2ClickMethodAfterValidation%> //201409021700
vformStatus='messageInputBox';
_refreshv2('formInputStatus',vformStatus);
//201408271230 <%=SaveButton2ClickMethod%>
//alert('<%=SaveButton2Caption%>');
<%if (SaveButton2MessageControl.equals("on")){%>
messageBoxPopup();
//alert('<%=SaveButton2Caption%>');
$('#moralFrame').prop('src','input.jsp?mode=MINPUT&input=message.txt&config=messageConfig.txt');
parent.formRefresh=1;
<%} else {%>
$("#inputForm").submit(); //20140512
setTimeout(function() {
parent.exitMoralBox();
parent.formRefresh=1;
}, 10);
<%}%>
}
});


<% if(!printCaption0ClickMethod.equals("")) {%>
$("#printCaption0").click(function(){  //printClick form.print.click
if (DOCUMENT){
window.open('<%=printCaption0ClickMethod%>','_blank','toolbar=0,scrollbars=0,location=0,location=no,width=1000,height=600')}
else {
_messagebox('Please Save It Before Change ',0,16,'System require ! ');
return false;
}
});
<% }%>


function messageBoxPopup(){
// $('#popup-wrapper').parent().css( {position:'relative'}); //20140807
$('#popup-wrapper').parent().css( "width", "40%");
$('#popup-wrapper').width("100%").height(250).css({top: -250,  position:'absolute'});
$("#popup-wrapper").resizable('disable').removeClass('ui-state-disabled');
$('#popup-wrapper').css("border-top","10px #ccc solid");
$('#clicker').click();
}


<%if ((MODE.equals("SINPUT") | MODE.equals("MINPUT"))){ //201409231200 %>
function _messagebox(s0801,pboxType,pboxIcon,pcaption){
if(!pcaption) pcaption='';
vformStatus='messageBox';
$("#popup-wrapper").resizable('disable').removeClass('ui-state-disabled'); //20140721
$('#popup-wrapper').width('400').height(MESSAGEBOX_HEIGHT).css({top: -250, left: 0, position:'absolute'});
$('#moralFrame').prop('src','messageBox.jsp?message='+s0801+'&boxType='+pboxType+'&boxIcon='+pboxIcon+'&caption='+pcaption);
$('#clicker').click();
}
<%}%>


<% if(!SaveButton3ClickMethod.equals("")) {%>
$("#submit3x").click(function(){  //submit3xclick form.revoke.click html.revoke
<%=SaveButton3ClickMethod%> //201408271220
if (formValidation()){
vformStatus='messageInputBox';
<%if (MessageControl.equals("on")){%>
messageBoxPopup();
$('#moralFrame').prop('src','input.jsp?mode=MINPUT&input=message.txt&config=messageConfig.txt');
parent.formRefresh=1;
<%} else {%>
$("#inputForm").submit();
setTimeout(function() {
parent.exitMoralBox();
parent.formRefresh=1;
}, 10);
<%}%>
}
});
<%}%>
<%} //201409231200 %>
</script>


<%
}
catch (UnsupportedEncodingException e){out.println(e.getMessage());}
catch (IOException e){out.println(e.getMessage());}
catch (Exception e){out.println(e.getMessage());}
%>
<div id="dialog" title="Messagebox" Style="display:none;">
  <p>Time Out...Please Press Logout Button</p>
</div>

</body>
</html>