<!-- 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        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
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
css.setting
 formValidation()
MastTable.RecordID 
html.grid 1319
html.input.mask
html.button : {subform}
html.click.subForm
html.textarea
html.upload                          *
html.num
html.label 1487
//CHOICE.dblclick
first.Column.Label
second.column.label
html.Radio 1519
html.combo 1545
html.file 1716
html.date 1755
html.text 1812
tableRule
RetrievalStatus
inkey.Control
html.grid
 grid.header.caption
 grid.button
 grid.border
 grid.body NewRow.insertCell
 grid.append
  grid.parent.recordid
 grid.text.css
 grid.combo
 grid.onfocus
 grid.onblur
 grid.onchange
 grid.dbclick
tableName2_2Append()
/*create.formValidation Statement*/ 
function viewUpload(s14)
PRODUCT.EOL
function generateRecordID()
subform.input
function openNewWindow(url,mWidth,mHeight)
function blank()
function defaultInput()
function retrieval2(mConstraint)
function retrieval(orderBy)
function selectTextboxContent(textbox)
$(document).ready(function()
function _combo
http://192.168.10.8:8080/erp/input.jsp?mode=SINPUT&input=products.txt&config=productsConfig.txt&key=recordid&keyValue=1390296450593
-->
<!--last s10-->
<!--creatingField-->
<!--formValidation-->
<!--  ==13 -->
<!--1112 Same Line Second Label-->
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page errorPage="timeOut.jsp" %>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<%@ 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" />
<%
 String PATH=request.getContextPath();
 PATH=PATH.replace("/","");
 //out.println(PATH);
%>
<!--
e.g.20131211  input.jsp?input=paymentTerms.txt&config=paymentTermsConfig.txt&keyValue=1
e.g.20131211 input=paymentTermsList.txt&config=paymentTermsListConfig.txt&keyValue=1&mode=LIST
<jsp:include page="MPFCSV" />
-->
<%!
// variable Gobal area
// variable listing
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  [Input][][]   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// java : MODE , FocusBackGroundColor , fields, formats,valids,masks
// java : int : month , year , dayOfMonth
// javascript : newText.style.cssText
String tableRule="0";
String DATABASE = "";
int iTableCount=0;
String TableNames=""; 
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 {
 // e.g. xml xml=new xml();
 // e.g. String s0916=xml.parser("{1}aa{/1}","1");
 public 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();
}
%>
<%--  page contentType="text/html; charset=UTF-8" --%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!--java.variable-->
<%
 xml xml=new xml(); 
 String PROCESSING_MODE="D";
 String template=null;
 //String template=null;
 String labelOndblclickAfter="";
 String editTextAreaWidth="500";  // for line edit memo
 String editTextAreaHeight="300"; // for line edit memo
 String appendData0ActionAfter="";
 String aasdfdfs="",sadsdfdf="";
 String colWidth1="15";String colWidth2="15";  String colWidth3="10";  String colWidth4="20";  String colWidth5="5";  String colWidth6="0"; 
 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 appendData0Source="",appendData0TargetKey="";
 String appendData0="";
 String Refresh=""; //20140219
 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();
 String saveAction="ShowParameters?_database="+DATABASE+"&_user="+USER+"&_userRecordid="+USER_RECORDID;
 String srcFolder=request.getContextPath();
 String disableSessionReturn="false";
 String invisibleCancelButton="false";
 String setConstrain="";
 String notFoundAction="";
 String SaveButton2ClickMethod="";
 String SaveButton3ClickMethod="";
 String SaveButton1Caption="Save";
 String SaveButton2Caption="";
 String SaveButton3Caption="";
 String KEY1=""; String KEYVALUE1="";  String inputErrorColor="red"; String GridHeight="150px";
 String BackHistoryButton="0"; String FontSize="12px"; String EachLineHeight="5px";
 String InputTextRadius="5px"; String PageFrameHeight="300px"; String file="ADDRESS";
 String path = "/includes/"; String location = path+file+".jsp"; String masterTableName="";String selectTableName="";
 String PageBackGroundColor="#e1e1e1"; String FormWidth="920px"; String LABEL_WIDTH="120px";
 String BodyTopMargin="20px"; String LineSpacing="3px"; String Title="unTitled";
 String PreviouField="null"; String nextField="null"; String FocusBackGroundColor="#abcdef";
 String GridRowHighLight="RGB(255,255,187)";  String [] GridStyle={"General","Detail"};
 String [] PageHeaderCaption={"General","Detail"};
 String LabelFontSize="120%"; String key="" ;  String keyValue="null" ;
 String fields=""; // it is for update the database purpose
 String defaults="";
 //String listFields="";
 //String listTableSid="";
 //String listFormats="";
 //String listRefresh=""; // 20130829 _refreshv2('employee.employeenumber'+r,data[r][0]);
 String formats=""; // it is for update the database purpose
 String masks="";
 String valids="";
 String formValidation=""; // 20130512
 String retrievalField="";
 String formInit=""; // for readonly field
 String gridLeftOffset="0px";
 String InvisibleRetrivalNumber="0";
 String ListSubFormName="";
 String ListSubFormConfig="";
 String InputTextHeight="24px"; // change from 20 to 24
 //String modalWidth="1080px";
 //String modalHeight="570px";
 String modalWidth="";
 String modalHeight="";
 String modalMode="SINPUT";
 String where="";
 String clockRefresh="";
 String ListSubFormExtend="";
 String ReadonlyCssStyle="color:black;";
 int SetPageHeader=1;
 int SetGrid=1; 
 int iCreatingGrid=0;
 int SetBox=1; 
 int iCreatingBox=0;
%>
<%
String inputFile=request.getParameter("input");
String MODE="INPUT";
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");}
%>
<!----------------------------------------------------------------------------------------Initial Setting----------->
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<link href="css/modalPopLite.css" rel="stylesheet" type="text/css" />
<script src="js/modalPopLite.js" type="text/javascript"></script>
<script src="js/JavaScriptUtil.js"></script>
<script src="js/jquery-ui-1.10.3.custom.js"></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 src="js/jquery.validate.js"></script>
<script type="text/javascript" >
<!--------------------javascript.variable------------------------------constructor----------->
var currentTable="";
var currentEntity="";
var currentID="";
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 thisRowNo=0;
var limit=25; //201401301541
var offset=0;  //201401301541
var lastOffset=0;
var ascDesc="asc";
var latestOrderBy="recordID";
var WINDOW_HEIGHT = $(window).height();
var WINDOW_WIDTH = $(window).width();
$.validator.setDefaults({
 submitHandler: function()
 {
  $("#inputForm").submit();
 }
});
var formRefresh=0;
var RetrievalStatus=0;
var RECORDID='';
var DOCUMENT=''
var DATABASE='<%=DATABASE%>';
var COMPANYID='<%=bean.getCompanyProfileRecordid()%>';
var USER=" <%=bean.getAlias()%> <%=bean.getLastName()%>";
var USER_RECORDID=" <%=bean.getRecordid()%>";
var LOGINID=" <%=bean.getLoginId()%>";
//  bean.setRecordid(rs.getString(3).trim());
//     bean.setLoginId(rs.getString(4).trim());
     
//var USERID=" <%=bean.getAlias()%> <%=bean.getLastName()%>";
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>
<%@ page import="java.io.*"%>
<%----005.0------------------------------------------------------------specification--------parse.input.txt--%>
<%
String [][] Input;
String [] Label;
try {
 String labelFile=null;
 String configFile=null;
 int hasLabelFile=0;
 File fileDir=null;
 BufferedReader b =null;
 //BufferedReader in =null;
 String str;
 //String InputsFileName="/usr/local/apache-tomcat-7.0.37/webapps/Test/"+inputFile;
 String InputsFileName=srcFolder+"/"+inputFile;
 fileDir = null;
 fileDir = new File(InputsFileName);
 /*
  File fileXml = new File(srcFolder+"/staff.xml");
  //File file = new File(filename);
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  Document doc = db.parse(fileXml);
  doc.getDocumentElement().normalize();
  NodeList nList = doc.getElementsByTagName("staff");
  for develope xml
  out.println("----------------------------");
  for (int temp = 0; temp < nList.getLength(); temp++) {
   Node nNode = nList.item(temp);
   out.println("\nCurrent Element :" + nNode.getNodeName());
   if (nNode.getNodeType() == Node.ELEMENT_NODE) {
    Element eElement = (Element) nNode;
    out.println("Staff id : " + eElement.getAttribute("id"));
    out.println("First Name : " + eElement.getElementsByTagName("firstname").item(0).getTextContent());
    out.println("Last Name : " + eElement.getElementsByTagName("lastname").item(0).getTextContent());
    out.println("Nick Name : " + eElement.getElementsByTagName("nickname").item(0).getTextContent());
    out.println("Salary : " + eElement.getElementsByTagName("salary").item(0).getTextContent());
   }
  }
 */
 b = null;
 b = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
 int iInputCount=0;
 str=null;
 valids="$('#inputForm').validate({rules: { " ; // ...  })
 String delimiter="";
 iTableCount=0;
 TableNames="";
 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(":"); // e.g. tableFieldValudDefault ADDRESS.married.clickValue:Default
    String s2[]=tfvd[0].split("\\."); // e.g. ADDRESS.married.clickValue:Default
    String s=","+TableNames+",";
    if (s.indexOf(","+s2[0]+",")<0){
     //out.println(s2[0]);
     TableNames=TableNames+delimiter+s2[0];
     delimiter=",";
     iTableCount++;
    }
   }
  }
 }
 
 String aTableNames[] = TableNames.split(",");  
 //out.println(iTableCount);
 delimiter="";
 String [] listFields ;
 String [] retrievalBackString ;
 String [] listRefresh ; //   _refreshv2()
 String [] listFormats ; //   e.g. s,s,s,s
 String [] listTables  ; //   e.g. 0_361
 String [] sqlTableName  ; // e.g. po
 int[] retrievalFieldCounting ;
 retrievalBackString    = new String[iTableCount];
 retrievalFieldCounting = new int[iTableCount];
 listRefresh = new String[iTableCount];
 listFormats = new String[iTableCount];
 listFields  = new String[iTableCount];
 listTables  = new String[iTableCount];
 sqlTableName= new String[iTableCount];
 for (int i=0;i<iTableCount; i++){
  retrievalBackString[i]="";
  listRefresh[i]="";
  listTables[i]="";
  retrievalFieldCounting[i]=0;
  listFormats[i]="";
  listFields[i]="";
  sqlTableName[i]="";
 } 
 String listTableSid="";
 Input=new String[iInputCount][];
 Label=new String[iInputCount];
 b = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
 iInputCount=0;
 delimiter="";
 String listDelimiter="";
 String validDelimiter="";
 String cInputCount="";
 String g="";
 int gCount=0;
 while ((str = b.readLine()) != null)
 {
  //0.3,Employee.dateOfBirth,text,10,30,Personal : Date Birth
  //object.properties
  String s20="";
  if (str.length()>0) {
  s20=str.substring(0,1);
  }
  if ((str.length()>0) && (! s20.equals("#")) && (!str.equals(""))   ) {
  //20140114 cInputCount=Integer.toString(iInputCount);
  
  int j=0;
  Input[iInputCount]=new String[69];
  Input[iInputCount][68]=""; // ondblclickAfter
  Input[iInputCount][67]=""; // ondblclick
  Input[iInputCount][66]=""; // labelOndblclickAfter
  Input[iInputCount][65]=""; // labelOndblclick
  Input[iInputCount][64]=""; // formInit
  Input[iInputCount][63]=""; // SumTotal
  Input[iInputCount][62]=""; // documentStatus      
  Input[iInputCount][61]="0"; // listtableNumber (grid table) generator use
  Input[iInputCount][60]=""; // onFocus
  Input[iInputCount][59]="1"; // colspan
  Input[iInputCount][58]=""; // onChange
  Input[iInputCount][57]=""; // comboConstrain
  Input[iInputCount][56]=""; // Reference
  Input[iInputCount][55]=""; // inputMask
  Input[iInputCount][54]=""; // numeric value=numeric
  Input[iInputCount][53]=""; // lower
  Input[iInputCount][52]=""; // upper
  Input[iInputCount][51]=""; // email
  Input[iInputCount][50]=""; // setConstrain
  Input[iInputCount][49]=""; // toolTips tooltips
  Input[iInputCount][48]="WINDOW_HEIGHT"; // subformHeight control the area of the subform 
  Input[iInputCount][47]="WINDOW_WIDTH"; // subformWidth control the area of the subform
  Input[iInputCount][46]=""; // radio
  Input[iInputCount][45]=""; // label inline Style
  Input[iInputCount][44]=""; // combo
  Input[iInputCount][43]=""; // subform
  Input[iInputCount][42]=""; // onclick
  Input[iInputCount][41]=""; // default
  Input[iInputCount][40]=""; // readonly
  Input[iInputCount][39]=""; // lostfocus
  Input[iInputCount][38]=""; // refresh {refresh}
  Input[iInputCount][37]=""; // data
  Input[iInputCount][36]=""; // http
  Input[iInputCount][35]=""; // currency
  Input[iInputCount][34]=""; // disabled
  Input[iInputCount][33]=""; // getJson
  Input[iInputCount][32]=""; // event
  Input[iInputCount][31]=""; // inLineStyle
  Input[iInputCount][30]=""; // required
  Input[iInputCount][29]=""; // nextField
  Input[iInputCount][28]=""; // thisField //Input[i][3]+"."+Input[i][4];
  Input[iInputCount][27]=""; // prevField
  Input[iInputCount][26]="em"; // uom of display width
  Input[iInputCount][25]=""; // numberic value of display width
  Input[iInputCount][24]=""; // http link
  Input[iInputCount][23]=""; // float
  Input[iInputCount][22]=""; // Second Label
  Input[iInputCount][21]=""; // FirstLabel <---------------------------------------------Label on grid
  Input[iInputCount][19]=""; // width uom
  Input[iInputCount][18]=""; // memberCount
  Input[iInputCount][17]=""; // </br> generate next line
  Input[iInputCount][16]=""; // maxinum width
  Input[iInputCount][15]=""; // mininum width
  Input[iInputCount][14]=""; // Default
  Input[iInputCount][13]=""; // number of grid
  Input[iInputCount][12]=""; // ClassID
  Input[iInputCount][11]=""; // GroupName
  Input[iInputCount][10]=""; // Max Length
  Input[iInputCount][9]=""; // Deciminal
  Input[iInputCount][8]=""; // Display Length
  Input[iInputCount][7]=""; // Grid
  Input[iInputCount][6]=""; // input type
  Input[iInputCount][5]=""; // Click Value
  Input[iInputCount][4]=""; // field
  Input[iInputCount][3]=""; // table
  Input[iInputCount][2]=""; // line
  Input[iInputCount][1]=""; // page
  String raws[] = str.split(",");  
  Input[iInputCount][11]=raws[0].replace(".","_"); // Group
  //Input[iInputCount][57]=""; // comboConstrain
  //Input[iInputCount][58]=""; // onChange
  if (str.indexOf("{invisible}")>=0){
   Input[iInputCount][31]="display:none;";
   Input[iInputCount][45]="display:none;";
  }
  
  /////////////////////////////////////////////////////////////////////////
  
  if (str.indexOf("{ondblclickAfter}")>=0)    Input[iInputCount][68]= xml.parser(str,"ondblclickAfter");
  if (str.indexOf("{ondblclick}")>=0)    Input[iInputCount][67]= xml.parser(str,"ondblclick");
  if (str.indexOf("{documentStatus}")>=0) Input[iInputCount][62]="documentStatus";
  if (str.indexOf("{default}")>=0)    Input[iInputCount][41]= xml.parser(str,"default");
  if (str.indexOf("{onFocus}")>=0)    Input[iInputCount][60]= xml.parser(str,"onFocus");
  if (str.indexOf("{colspan}")>=0)    Input[iInputCount][59]= xml.parser(str,"colspan");
  if (str.indexOf("{onChange}")>=0)    Input[iInputCount][58]= xml.parser(str,"onChange");
  if (str.indexOf("{comboConstrain}")>=0) Input[iInputCount][57]= xml.parser(str,"comboConstrain");
  if (str.indexOf("{reference}")>=0)   Input[iInputCount][56]= xml.parser(str,"reference");
  if (str.indexOf("{inputMask}")>=0)   Input[iInputCount][55]= xml.parser(str,"inputMask");
  if (str.indexOf("{numeric}")>=0)    Input[iInputCount][54]="numeric";
  if (str.indexOf("{lower}")>=0)     Input[iInputCount][53]="lower";
  if (str.indexOf("{upper}")>=0)     Input[iInputCount][52]="upper";
  if (str.indexOf("{email}")>=0)     Input[iInputCount][51]="email";
  if (str.indexOf("{required}")>=0)    Input[iInputCount][30]="required";
  if (str.indexOf("{disabled}")>=0)    Input[iInputCount][34]="disabled";
  if ((str.indexOf("{readonly}")>=0) || MODE.equals("SVIEW")){
   Input[iInputCount][40]="readonly";
  }
  if (str.indexOf("{currency}")>=0)    Input[iInputCount][35]="currency";
  if (str.indexOf("{integer}")>=0)    Input[iInputCount][35]="integer";
  
  Input[iInputCount][50]= xml.parser(str,"setConstrain"); 
  setConstrain=setConstrain+Input[iInputCount][50]; 
  Input[iInputCount][49]= xml.parser(str,"toolTips");
  
  
  Input[iInputCount][46]= xml.parser(str,"radio");
  Input[iInputCount][45]= xml.parser(str,"labelInLineStyle");//{labelInLineStyle}"display:block;"{/labelInLineStyle}
  if  (Input[iInputCount][45].trim().equals("")){
   Input[iInputCount][45]="display:block;";
  } 
  if (str.indexOf("{lAlignRight}")>=0| str.indexOf("{labelRight}")>=0){
   Input[iInputCount][45]="text-align:right;";
  }
  if (str.indexOf("{lAlignLeft}")>=0 | str.indexOf("{labelLeft}")>=0){
   Input[iInputCount][45]="text-align:left;";
  }
  Input[iInputCount][44]= xml.parser(str,"combo");
  Input[iInputCount][43]= xml.parser(str,"subform");
  Input[iInputCount][31]= xml.parser(str,"inLineStyle");
  if (str.indexOf("{alignRight}")>=0)   Input[iInputCount][31]="text-align:right;";
  if (str.indexOf("{alignLeft}")>=0)   Input[iInputCount][31]="text-align:left;";
  if (str.indexOf("{alignCenter}")>=0 | str.indexOf("{alignCentre}")>=0  ){
   Input[iInputCount][31]="text-align:center;";
  }
  if (str.indexOf("{invisible}")>=0)   Input[iInputCount][31]="display:none;";
  Input[iInputCount][32]= xml.parser(str,"events");
  Input[iInputCount][33]= xml.parser(str,"getJson");
  
  Input[iInputCount][41]= xml.parser(str,"default");
  Input[iInputCount][42]= xml.parser(str,"onclick");
  Input[iInputCount][39]= xml.parser(str,"lostfocus");
  if (str.indexOf("onblur")>=9){Input[iInputCount][39]= xml.parser(str,"onblur");}
  Input[iInputCount][37]= xml.parser(str,"data");
  Input[iInputCount][36]= xml.parser(str,"http"); //{http}
  String  tfvd[]=raws[1].split(":"); // e.g. tableFieldValudDefault ADDRESS.married.clickValue:Default
  if (tfvd.length>=2){Input[iInputCount][14]=tfvd[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){Input[iInputCount][16]=wmm[2];}
  if (wmm.length>=2){Input[iInputCount][15]=wmm[1];}
  String s4[]=wmm[0].split("\\."); // e.g. 12.2  && display length width
  Input[iInputCount][0]=str;
  String s1[]=raws[0].split("\\."); // e.g. 2.1
  Input[iInputCount][1]=s1[0]; // page 1
  Input[iInputCount][2]=s1[1]; // group 2
  if (! Input[iInputCount][2].equals(g)){
   g=s1[1];gCount=1;
  }
  Input[iInputCount][18]=Integer.toString(gCount++);
  if (s1.length>=3){
   if (s1[2].equals("n")){
    Input[iInputCount][17]="<br/>"; // nextLine
    } else {
    Input[iInputCount][17]=s1[2]; // nextLine
   } 
  }
  Input[iInputCount][3]=s2[0]; // table 3
  Input[iInputCount][4]=s2[1]; // field 4
  if(s2.length>=3){
   Input[iInputCount][5]=s2[2];
  } else {
   Input[iInputCount][5]="";
  } // table,field,value 5
  Input[iInputCount][6]=s3[0]; // type 6
  
  if (Input[iInputCount][6].equals("textarea") || Input[iInputCount][6].equals("upload") ){
   Input[iInputCount][48]=editTextAreaHeight; //20140408
   Input[iInputCount][47]=editTextAreaWidth;
  }
  
  if  (! xml.parser(str,"subformHeight").trim().equals("")){
   Input[iInputCount][48]= xml.parser(str,"subformHeight");
  }
  if  (! xml.parser(str,"subformWidth").trim().equals("")){
   Input[iInputCount][47]= xml.parser(str,"subformWidth");
  }
  
  
  
  String s5[]=s3[0].split("\\.");
  if(s5.length>=2){Input[iInputCount][9]=s5[1];}
  if(s3.length>=2){Input[iInputCount][7]=s3[1].trim();} else {Input[iInputCount][7]="";} // 7 as Type2 GRID | FROMTO
  Input[iInputCount][8]=s4[0]; // len display length
  Input[iInputCount][10]=raws[4]; //  maxLength
  if(s4.length>=3){Input[iInputCount][19]=s4[2];} else {Input[iInputCount][19]="";} // deciminal
  Input[iInputCount][20]=raws[5];               // Input[20]=raws[5] =Label
  if (raws.length>=7){Input[iInputCount][24]=raws[6];}
  String ss[]=raws[5].split(":");
  if (ss.length>=1) {Input[iInputCount][21]=ss[0];} else  {Input[iInputCount][21]="";}  // Input[21]= First Label
  if (ss.length>=2) {
   Input[iInputCount][22]=ss[1];              // Input[22] = Second Label
   String ss2[]=ss[1].split("=");
   if (ss2.length>=2){Input[iInputCount][22]=ss2[0];
    Input[iInputCount][23]=ss2[1];} else
   {
    Input[iInputCount][23]="";              // Input[23]=Float
   }
  } else  {
   Input[iInputCount][22]="";
  }
  if (Input[iInputCount][21].indexOf("MMYY")>=0){  // when label is MMYY-1 it mean the date mm/yyyy format
   String ss2[]=Input[iInputCount][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;
    }
    Input[iInputCount][21]=i3+"/"+i2;
   }
  }
  if (hasLabelFile==0){
   Label[iInputCount]=raws[5];
   if (Label[iInputCount].indexOf("YY")>=0){
    Label[iInputCount]=Input[iInputCount][21]; //20131015
   }
  }
  Input[iInputCount][12]=Input[iInputCount][3]+"_"+Input[iInputCount][4];
  Input[iInputCount][25]=Input[iInputCount][8].replace("%","");
  Input[iInputCount][26]=(Input[iInputCount][8].indexOf("%")>=1)?"%":"em"; 
  Input[iInputCount][28]=Input[iInputCount][3]+"."+Input[iInputCount][4];
  
  if (str.indexOf("{formInit}")>=0) Input[iInputCount][64]= xml.parser(str,"formInit");
  Input[iInputCount][64]=Input[iInputCount][64].replaceAll("this.id",Input[iInputCount][28]);  //20140420
  Input[iInputCount][38]= xml.parser(str,"refresh"); 
  Input[iInputCount][38]=Input[iInputCount][38].replaceAll("this.id",Input[iInputCount][28]);  //20140421
  if (!Input[iInputCount][38].trim().equals("")) clockRefresh=clockRefresh+Input[iInputCount][38];
  
  if (str.indexOf("{labelOndblclickAfter}")>=0) Input[iInputCount][66]= xml.parser(str,"labelOndblclickAfter").replaceAll("this.id",Input[iInputCount][28]);
  labelOndblclickAfter=labelOndblclickAfter+Input[iInputCount][66];
  if (str.indexOf("{labelOndblclick}")>=0) Input[iInputCount][65]= xml.parser(str,"labelOndblclick");
  
  
  //Input[iInputCount][63]= xml.parser(str,"SumTotal");
  if (str.indexOf("{SumTotal}")>=0) {
   String s= xml.parser(str,"SumTotal");
   //out.println(s);
   s=s.replaceAll("this.id",Input[iInputCount][28]); 
   if (str.indexOf("this.")>=0) {
    s=s.replaceAll("this.",Input[iInputCount][3]);
   }
   //out.println(s);
   Input[iInputCount][63]= s;
  }
  
  formInit=formInit+Input[iInputCount][64];
  //out.println(Input[iInputCount][28]);
  //out.println(Input[iInputCount][64]);
  //selectTableName
  //out.println(Input[iInputCount][3]);
  if (selectTableName.equals("") && (!Input[iInputCount][3].equals("query"))){
   selectTableName=Input[iInputCount][3];
  }
  if (selectTableName.equals(Input[iInputCount][3])){
   String s8=Input[iInputCount][4];
   if(Input[iInputCount][6].equals("date")){
    //s8="if(isnull("+s8+"),STR_TO_DATE(`01/01/1753`, `^m/^d/^Y`),"+s8+")"; //201401221429
    s8="if("+s8+"=`0000-00-00` or (isnull("+s8+")),STR_TO_DATE(`01/01/1753`, `^m/^d/^Y`),"+s8+")"; //201401221429
    //s8="if("+s8+"=`0000-00-00`),STR_TO_DATE(`01/01/1753`, `^m/^d/^Y`),"+s8+")"; //201401221429
   }
   fields=fields+delimiter+s8; // creatingField
   s8=null;
   formats=formats+delimiter+"S";   
  }
  if (Input[iInputCount][30].equals("required"))
  {
   valids=valids+validDelimiter+"'"+Input[iInputCount][28]+"'"+": {required:true} "  ;
   validDelimiter=",";
  }
  if (str.indexOf("{invisible}")>=0){
   Input[iInputCount][31]="display:none;";
   Input[iInputCount][45]="display:none;";
  }
  
  //out.println(aTableNames[0]);
  //out.println(aTableNames[1]);
  int i6=0;
  for (int i=0;i<aTableNames.length;i++){
   //out.println(aTableNames[i]);
   if (Input[iInputCount][3].equals(aTableNames[i])) {
    i6=i;
    Input[iInputCount][61]= Integer.toString(i); //20140206
   }
  }
  cInputCount=Integer.toString(retrievalFieldCounting[i6]++) ; //20140112
  //out.println(i6);
   if (Input[iInputCount][35].equals("currency")){
    retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',translate(data[0]["+cInputCount+"],2) ); ";
   } else if (Input[iInputCount][35].equals("integer")){
    //retrievalBackString[i6]=retrievalBackString[i6]+"document.write('here');";
    //retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',translate(data[0]["+cInputCount+"],0) ); "; 
    retrievalBackString[i6]=retrievalBackString[i6]+"if (data[0]["+cInputCount+"]=='null' || data[0]["+cInputCount+"]=='NaN' || data[0]["+cInputCount+"]==''){";
    retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"','0'); ";
    retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
    retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',parseInt(data[0]["+cInputCount+"]) ); ";  
    //retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',data[0]["+cInputCount+"]); ";     
    retrievalBackString[i6]=retrievalBackString[i6]+"}";
    //retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',parseInt(data[0]["+cInputCount+"]) ); ";  
   } else if  (! Input[iInputCount][41].trim().equals("")){  // since 41 = default
    retrievalBackString[i6]=retrievalBackString[i6]+"if (data[0]["+cInputCount+"]=='null' || data[0]["+cInputCount+"]=='1753-01-01'){";
    retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',''); ";
    retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
    retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',data[0]["+cInputCount+"]); ";     
    retrievalBackString[i6]=retrievalBackString[i6]+"}";
   } else {
    if (Input[iInputCount][6].equals("text")) {
     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('"+Input[iInputCount][28]+"',''); ";
     retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
     retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',data[0]["+cInputCount+"]); ";     
     retrievalBackString[i6]=retrievalBackString[i6]+"}";
     //retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',data[0]["+cInputCount+"]); ";
    } else if (Input[iInputCount][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('"+Input[iInputCount][28]+"',''); ";
     retrievalBackString[i6]=retrievalBackString[i6]+"} else {";
     retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',data[0]["+cInputCount+"]); ";     
     retrievalBackString[i6]=retrievalBackString[i6]+"}";
    } else {
     retrievalBackString[i6]=retrievalBackString[i6]+"_refreshv2('"+Input[iInputCount][28]+"',''+data[0]["+cInputCount+"]); ";
    }  
   }
   if (Input[iInputCount][6].equals("upload")) {
     //String s="$('#"+Input[iInputCount][28]+"').attr('title', 'your new title');";
     //String s="document.getElementById('"+Input[iInputCount][28]+"').title = 'your new title';";
     String s="document.getElementById('"+Input[iInputCount][28]+"').title =data[0]["+cInputCount+"] ;";
     retrievalBackString[i6]=retrievalBackString[i6]+s;
     //listRefresh[i6]=listRefresh[i6]+"$('#"+Input[iInputCount][28]+"').attr('title', 'your new title');";
     //out.println(s);
   }
   
   if (Input[iInputCount][6].equals("image")) {
     //String s="document.getElementById('"+Input[iInputCount][28]+"').title =data[0]["+cInputCount+"] ;";
     
     String s="document.getElementById('img"+Input[iInputCount][28]+"').src="+"'data/'+"+"data[0]["+cInputCount+"] ;";
     retrievalBackString[i6]=retrievalBackString[i6]+s;
   }
 
 
   
   //////////////////////////////////////////////////////////////// java.defaults 
   String s="''";  
   if (Input[iInputCount][6].equals("num")){s="'0'";} //20130830
   if (Input[iInputCount][6].equals("num.1")){s="'0.0'";} //20130830
   if (Input[iInputCount][6].equals("num.2")){s="'0.00'";} //20130830
   if (Input[iInputCount][6].equals("num.3")){s="'0.000'";} //20130830
   if (Input[iInputCount][6].equals("num.4")){s="'0.0000'";} //20130830
   if (Input[iInputCount][6].equals("num.5")){s="'0.00000'";} //20130830
   if (Input[iInputCount][6].equals("date")){s="_today()";} //20130830
   if (!Input[iInputCount][41].trim().equals("")){s="'"+Input[iInputCount][41]+"'";}
  if (!(MODE.equals("LIST") | MODE.equals("CHOICE"))) {
  
   defaults=defaults+"_refreshv2('"+Input[iInputCount][28]+"',"+s+"); "; // java.defaults 20130830
  }
  if ((MODE.equals("SINPUT") || (MODE.equals("LIST") | MODE.equals("CHOICE"))) &&Input[iInputCount][7].equals("GRID"))
  {
   if (Input[iInputCount][6].equals("num.2") || Input[iInputCount][6].equals("num")){ //20131023
    listFields[i6]=listFields[i6]+listDelimiter+"if(isnull("+Input[iInputCount][4]+"),0,"+Input[iInputCount][4]+")";
   } else {
    listFields[i6]=listFields[i6]+listDelimiter+"if(isnull("+Input[iInputCount][4]+"),\"\","+Input[iInputCount][4]+")";
   }
   listFormats[i6]=listFormats[i6]+listDelimiter+"S";   
   
    if (Input[iInputCount][35].equals("currency")){
     listRefresh[i6]=listRefresh[i6]+"s12=translate(data[r][1+rf++],2);if(s12=='NaN'){s12=translate(0.00,2);}_refreshv2('"+Input[iInputCount][28]+"'+editRow,s12);";
    } else if (Input[iInputCount][35].equals("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('"+Input[iInputCount][28]+"'+editRow,s11);";
    } else if  (! Input[iInputCount][37].trim().equals("")){ 
     listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+Input[iInputCount][28]+"'+editRow, aname('"+Input[iInputCount][37]+"',data[r][1+rf++]));";
    } else {
     if (Input[iInputCount][6].equals("text") | Input[iInputCount][6].equals("upload")){
      listRefresh[i6]=listRefresh[i6]+"s10=data[r][1+rf++];";
      listRefresh[i6]=listRefresh[i6]+"if (s10=='No Value' || s10=='1753-01-01'  ){s10='';}";
      listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+Input[iInputCount][28]+"'+editRow,s10);";
      if (Input[iInputCount][6].equals("upload")){
       listRefresh[i6]=listRefresh[i6]+"$('#"+Input[iInputCount][28]+"').attr('title', 'your new title');";
      }
     } else {
      listRefresh[i6]=listRefresh[i6]+"_refreshv2('"+Input[iInputCount][28]+"'+editRow,data[r][1+rf++]);";
     } 
      //201402041837 listRefresh[i6]=listRefresh[i6]+"setFocus('"+Input[iInputCount][28]+"')";
    }
    listDelimiter=","; //20130829
  }
  
  
    /*create.formValidation Statement*/  
  if (Input[iInputCount][6].equals("date")){
   String s7="var x=_lookup('"+Input[iInputCount][28]+"');";
   s7=s7+"if(!x){_refreshv2('"+Input[iInputCount][28]+"','1753-01-01');};";
   formValidation=formValidation+s7;
  }
  
  if (Input[iInputCount][30].equals("required")){
   String s7="var x=_lookup('"+Input[iInputCount][28]+"');";
   s7=s7+"if (x==null || x=='') ";
   s7=s7+"{";
   s7=s7+"s16='"+Input[iInputCount][21]+"';";
   s7=s7+"s17='"+Input[iInputCount][22]+"';";
   s7=s7+"if (s16 != s17){s16=s16+' '+s17;}";
   s7=s7+"s16=s16.replace('=LF','');";
   s7=s7+"$('#dialog').dialog('open' );";
   s7=s7+"$('#dialog').dialog('option', 'title', 'Save Valid');";
   s7=s7+"$('#dialog p').html(s16+' cannot be empty');";
    s7=s7+"return false;";
   s7=s7+"}";
   //out.println(s7);
   formValidation=formValidation+s7;
  }
  
  if (Input[iInputCount][51].equals("email")){
   String s7="var x=_lookup('"+Input[iInputCount][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;
  }
  
  if ((MODE.equals("LIST") | MODE.equals("CHOICE"))){FocusBackGroundColor=GridRowHighLight;}
  delimiter=",";
  iInputCount++;
  }
 }
 
 
 
 
 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("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];}
  //out.println(i);
  //out.println(Input[i][7]);
  //out.println(Input[i][11]);
  if((Input[i][7]).equals("GRID") && !Input[i][11].equals(u)){u=Input[i][11];
  Input[i][13]=Integer.toString(++k) ;
  }
 } 
 u="";
 b.close();
 labelFile=request.getParameter("label");
 String FileName="/usr/local/apache-tomcat-7.0.37/webapps/Test/"+labelFile;
 fileDir = new File(FileName);
 if(fileDir.exists())
 {
  BufferedReader in =null;
  in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8"));
  int iLabelCount=0;
   while ((str = in.readLine()) != null)
   {
    if (iLabelCount<Label.length){
     Label[iLabelCount]=str;
     Input[iLabelCount][20]=str;
     iLabelCount++;
    }
   }
   in.close();
 }
 ////////////////////////////////java.config///////configfile//////config.txt//////////////parse.config/////// user CONFIG SETTING /////
 fileDir=null;
 configFile=request.getParameter("config");
 //FileName="/usr/local/apache-tomcat-7.0.37/webapps/Test/"+configFile;
 FileName=srcFolder+"/"+configFile;
 fileDir = new File(FileName);
 PageHeaderCaption[0]="XXX2"+fileDir;
 Title=fileDir +"Not Found ";
 if(fileDir.exists())
 {
  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="";
   try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection(connectionURL, "root", "root");
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery("select sum(Case when status ='A' Then 1 ELSE 0 end ) AS active,"+
     "sum(Case when status ='T' Then 1 ELSE 0 end ) AS term from employee;");
    if(rs.next()) {
     mActive=rs.getString(1).trim();
     mLeave=rs.getString(2).trim();
    }
   }catch(Exception e1){}
   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("template")){template=s[1];}
   if (s[0].equals("appendData0ActionAfter")){appendData0ActionAfter=s[1];}  //20140321
   appendData0ActionAfter=appendData0ActionAfter.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("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("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].equals("appendData0HeaderSource")){appendData0HeaderSource=s[1];}
   if (s[0].equals("appendData0Caption")){appendData0Caption=s[1];}
   if (s[0].equals("appendData0")){appendData0=s[1];}appendData0=appendData0.replaceAll(":","=");
   if (s[0].equals("appendData0Source")){appendData0Source=s[1];}
   if (s[0].equals("appendData0TargetKey")){appendData0TargetKey=s[1];}
   
   
   if (s[0].equals("Refresh")){Refresh=s[1];}
   Refresh=Refresh.replaceAll(":","=");
   if (s[0].equals("ApprovalStatus")){ApprovalStatus=s[1];}
   if (s[0].equals("formReadOnly")){formReadOnly=s[1].replace(":","=");}
   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("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 (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("ListSubFormConfig")){ListSubFormConfig=s[1];}
   if (MODE.equals("SINPUT") || 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;}
   //out.println(s[0]);
   //PageHeaderCaption={"General","Location","Shipper","Market","Detailx"};
   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");
   } 
  }
 }
 clockRefresh=clockRefresh+Refresh; //20140219
 //out.println(clockRefresh);
 //out.println("******************************"+listFields[i6]);
 //out.println("listRefresH: "+listRefresh.length);
 if (1==2){ // list userSettingByArray
  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++){
   out.println("["+j+"]");
   out.println(Input[i][j]);
   }
   out.println("<BR/><br/>");
  }
  out.println(" clock Refresh : "+clockRefresh);
 }
%>
<title><%=Title%></title>
<!---------------------------------------------------------------------------------------STYLESHEETS--------->
<link href="css/pagetab.css" rel="stylesheet" type="text/css" />
<link href="css/general.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" />
<!-- link rel="stylesheet" type="text/css" href="css/inputMaskStyle.css" -->
<style type="text/css"> <!--css.setting-->
select {
    -webkit-appearance: button;
    -moz-appearance: button;
    -webkit-user-select: none;
    -moz-user-select: none;
    /*-webkit-padding-end: 20px;*/
    -moz-padding-end: 20px;
    -webkit-padding-start: 2px;
    -moz-padding-start: 2px;
    background-color: #F07575; /* fallback color if gradients are not supported */
    background-image: url(../images/select-arrow.png), -webkit-linear-gradient(top, #E5E5E5, #F4F4F4); /* For Chrome and Safari */
    background-image: url(../images/select-arrow.png), -moz-linear-gradient(top, #E5E5E5, #F4F4F4); /* For old Fx (3.6 to 15) */
    background-image: url(../images/select-arrow.png), -ms-linear-gradient(top, #E5E5E5, #F4F4F4); /* For pre-releases of IE 10*/
    background-image: url(../images/select-arrow.png), -o-linear-gradient(top, #E5E5E5, #F4F4F4); /* For old Opera (11.1 to 12.0) */
    background-image: url(../images/select-arrow.png), linear-gradient(to bottom, #E5E5E5, #F4F4F4); /* Standard syntax; must be last */
    background-position: center right;
    background-repeat: no-repeat;
    border: 1px solid #AAA;
    border-radius: 2px;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
    color: #555;
    font-size: inherit;
    margin: 0;
    overflow: hidden;
    padding-top: 2px;
    padding-bottom: 2px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
    
form.inputform label.error, label.error {
 /* remove the next line when you have trouble in IE6 with labels in list */
 color: <%=inputErrorColor%> ;
 font-style: italic
}
 #clicker {font-size:20px;cursor:pointer;}
 #popup-wrapper{background-color:#ccc;padding:5px;
 -webkit-border-radius: .5em;
 -moz-border-radius: .5em;
 border-radius: .5em;
 }
 .ui-dialog-osx {
  -moz-border-radius: 0 0 8px 8px;
  -webkit-border-radius: 0 0 8px 8px;
  border-radius: 0 0 8px 8px; border-width: 0 8px 8px 8px;
 }
 .focused {background: <%=FocusBackGroundColor%>;}
 p{font-family:"Times New Roman";font-size:12px;line-height:1;}
 p{line-height:1;margin-top:<%=LineSpacing%>}
 input[type="text"] {font-size:<%=FontSize%>;height:<%=InputTextHeight%>;} 
 label {margin-right: 10px;}
 .spanL1 {font-size:<%=LabelFontSize%>; margin-bottom:3px; }
 label.L1 {clear:both; display:block; float: left; font-size:<%=LabelFontSize%>; margin-bottom:3px; }
 label.L1 {width:<%=LABEL_WIDTH%>;}
 label.FR {clear:both; display:block; float: right; font-size:<%=LabelFontSize%>; margin-bottom:3px; }
 label.LF {clear:both; display:block; float: left; font-size:<%=LabelFontSize%>; margin-bottom:3px; } /*20130720*/
 label.LE {white-space:nowrap;width:12em;overflow:hidden;} /*20130720*/
 label.LE {clear:both; display:block; float: left; font-size:<%=LabelFontSize%>; margin-bottom:3px; text-overflow:ellipsis; } /*20130720*/
 label.LE {width:<%=LABEL_WIDTH%>;}  /*20130720*/
 label.LC {white-space:nowrap;width:12em;overflow:hidden;} /*20130720*/
 label.LC {clear:both; display:block; float: left; font-size:<%=LabelFontSize%>; margin-bottom:3px; text-overflow:clip; } /*20130720*/
 label.LC {width:<%=LABEL_WIDTH%>;}  /*20130720*/
</style>
<!---------------------------------------------------------------------------------------CSS.Page--------->
<style type="text/css">
 ul.tabs li {background: <%=PageBackGroundColor%>;}
 .pageHeader {font-size: <%=FontSize%>;}
 .tab_content  {font-size: <%=FontSize%>;}
 div.tab_container {height: <%=PageFrameHeight%>;background-color:<%=PageBackGroundColor%>;}
 ul.tabs li.active  {background: <%=PageBackGroundColor%>;border-bottom: 1px solid <%=PageBackGroundColor%>;}
 ul.tabs li.active a:hover {background:<%=PageBackGroundColor%>;} 
 .pageFrame {width: auto; margin-top: 10px; padding-top: 0px;}
 #container {width: <%=FormWidth%>; margin: auto;}
 .posttext {font-size: <%=FontSize%>; line-height: 1.5;}
 #content {margin: 0px 0px;}
 <!---------------------------------------------------------------------------------------CSS.input Text--------->
 input {margin-right: 1px;margin-top:1px;margin-bottom:2px; line-height:2;}
 .LineInputTextx {border:thin solid #777; height: <%=FontSize%>; border-radius:3px; line-height:2; padding:0;  }
 .LineInputTexty {border:thin solid #777; height: 23px; border-radius:3px; line-height:2; outline:none; padding:0; margin:0; border:0;   }
 .LineInputText {
  height: <%=FontSize%>;
  border:thin solid #777;
  padding: 2px 2px 2px;
  line-height: 1;
  outline: none;
  -moz-border-radius:<%=InputTextRadius%>;
  -webkit-border-radius: <%=InputTextRadius%>;
  border-radius: <%=InputTextRadius%>;
 }input[type="text"][disabled] {color:black;}
 input[type="text"][readonly] {<%=ReadonlyCssStyle%>;}
</style>
</head>
<!------------html body------------------------------------------------------HTML.Body-------------->
<body style="display:inline">
<div id="clicker"></div>
<div id="popup-wrapper"> <!--modal box-->
 <iframe width="100%" height="100%"
  name="moralFrame" id="moralFrame"
  src=""
  frameborder="0" >
 </iframe>
 <a href="#" id="close-btn" style="display:none;">Close</a>
</div>
<!--form.caption-->
<div style="height:24px;
 padding-top:2px; color:white; border: 1px white solid;     
 padding-bottom:0px; margin-bottom:0;"
 class="formHeadCaptionBackground"
>
    <input style="width:400;float:left; color:black; font-weight: bold; font-size:16px"
    class="formCaption"
    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;" -->
   <!-- input style="margin-right:1px; float:right;" type="button" class="button" value="exit" id="exit"
   onclick="jConfirm( 'LEAVE ?' , 'box' , function(r) {if(r){self.close();}} )" style="padding:0px; " / -->
   <%}%>
 
  <div><!--clock.bar--><!--caption.line-->
   <input style="padding-left:5px;display:none;    font-size:16px;  float:right; color:white;
    width:80px;margin-top:1px;   margin-right:3px; background-color:rgb(67,120,182);
    border-left:1px black solid;" type="text" disabled="disabled" value="" name="rowid" id="rowid" /> <!--20131118-->
   <input   style="width:7%;    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="clock"    id="clock"/>
   <input
     style="width:80px;
      <%if (MODE.equals("CHOICE")){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%>-<%=month%>-<%=dayOfMonth%>"
     name="date"
     id="date"/>
   <input
     style="width:80px; padding-left:5px; float:right; margin-right:6px; text-align:right;"
     class="formCaption"
     type="text"
     disabled="disabled"
     value=""
     name="formStatus"
     id="formStatus"/>
   <span style="float:right; font-size:20px; display:none; ">Browser Level : 
    <input style="color:white; width:16px;margin-top:1px; margin-right:5px; background-color:rgb(67,120,182); "
     type="text" disabled="disabled" value="" name="browser" id="browser" />
   </span>
  </div>
</div>
<form id="inputForm" action="<%=saveAction%>" method="POST">
<div style="height:20px; margin-bottom:<%=BodyTopMargin%>;" >
<!--sinput.save.button-->
<% if (MODE.equals("CHOICE")  ) {%>
<button class="thisButton" type="button" onclick="parent.exitMoralBox();">Cancel</button> <!--subform.cancel--
<%}%>
<% if (MODE.equals("SINPUT") && (! SaveButton1Caption.equals("null")) && PROCESSING_MODE=="D") {%>
 <button style="color:red;" class="SaveButton" type="button" id="submit1"><%=SaveButton1Caption%></button> 
<%}%>
<% if ((MODE.equals("SINPUT") ) && (!SaveButton2Caption.trim().equals(""))) {%>
  <button style="color:<%=SaveButton2CaptionColor%>;" class="SaveButton" type="button" id="submit2"><%=SaveButton2Caption%></button> 
<%}%>
<% if ((MODE.equals("SINPUT")) && (!SaveButton3Caption.trim().equals(""))) {%>
  <button class="SaveButton SaveButton3Caption" type="button" id="submit3"><%=SaveButton3Caption%></button> 
<%}%>
<% if ((MODE.equals("SINPUT")) && (!printCaption0.trim().equals(""))) {%>
  <button class="SaveButton" type="button" id="printCaption0"><%=printCaption0%></button> 
<%}%>
<% if (MODE.equals("INPUT")) {%>
 <button style="color:red;" class="SaveButton" type="button" id="normalSubmit">Save</button><!--form.save-->
<%}%>
<% if (MODE.equals("INPUT") && invisibleCancelButton.equals("false")) {%>
 <button class="SaveButton" type="button" onclick="blank();">Cancel</button>
<%}%>
<% if (PROCESSING_MODE.trim()=="A")  {%>
 <button class="SaveButton" type="button" onclick="parent.exitMoralBox();">Exit</button>
<% } else if ((MODE.equals("SINPUT") | MODE.equals("CHOICE")))  {%>
 <button class="SaveButton" type="button" onclick="parent.exitMoralBox();">Cancel / Exit <%%></button> <!--subform.cancel-->
<% } else if (MODE.equals("SVIEW")) {%>
 <button class="SaveButton" type="button" onclick="parent.exitMoralBox();">Exit</button>
<%}%>
<% if (MODE.equals("SINPUT") | 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>
<%}%>
<script>
  $("#normalSubmit").click(function(){
   if (formValidation()){
    $("#inputForm").submit();
   }
  });
  $("#submit1").click(function(){  //subform.save.click
   if (formValidation()){
    $("#inputForm").submit();
    parent.exitMoralBox();
   }
   });
  $("#submit2").click(function(){
   //_refreshv2('ir56b.status','S');
   if (formValidation()){ 
   <%=SaveButton2ClickMethod%>
   saving=1;
   $("#inputForm").submit();
   parent.exitMoralBox();
   }
  });
  <% if(!printCaption0ClickMethod.equals("")) {%>
  $("#printCaption0").click(function(){
   if (DOCUMENT){
    //working
    //alert(DOCUMENT);
    //document.write('<%=printCaption0ClickMethod%>')   ; //20140321
    //alert('<%=printCaption0ClickMethod%>');
    window.open('<%=printCaption0ClickMethod%>','_blank','toolbar=0,scrollbars=0,location=0,location=no,width=1000,height=600')}
    else { alert('Please Save Before Print.\n\n DOCUMENT variable no values, define in {refresh}');}
  });
  <% }%>
  
  <% if(!SaveButton3ClickMethod.equals("")) {%>
  $("#submit3").click(function(){
   <%=SaveButton3ClickMethod%>
   saving=1;
   $("#inputForm").submit();
   parent.exitMoralBox();
  });
  <% }%>
  
</script>
<! input src="images/SAVE.BMP"  type="SUBMIT"   style="padding:0px; " />
<%
if (MODE.equals("INPUT") || MODE.equals("SINPUT")  || MODE.equals("SVIEW")){%>
<%}%>
</div>
<div id="container">
<div id="head"><div id="header"><div id="header_inner"><p></p></div></div></div>
<div id="content">
  <%
  //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
    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("SINPUT") || MODE.equals("SINPUT") || (MODE.equals("LIST") | MODE.equals("CHOICE"))){%>
   <table width=100% style=" table-layout:<%=formHeaderTableLayout%> ; border: <%=tableRule%>px black solid;"><!--20130828--><%}%>
  <%if ((MODE.equals("LIST") | MODE.equals("CHOICE"))) { %>
  
    <colgroup><!--2014 list.colgroup-->
     <col width="12%"><!--2014a-->
     <col width="15%"><!--2014a-->
     <col width="15%"><!--2014a-->
     <col width="15%"><!--2014a-->
     <col width="35%"><!--2014a-->
     <col width="0%"><!--2014a-->
    </colgroup><!--2014-->
    
    <tbody><!--2014-->
    
    <tr><td> <!--201401271104-->
  <%} else {%> 
    <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-->
    </colgroup>
    <tbody>
    <tr><td>
  <% } %>    
   <% } %>
   <% /*NewLine*/ if (iNewGroupNo !=iOldGroupNo && iOldGroupNo != 0) { %>
    <%if (SetGrid==2) {
     SetGrid=0; 
     iCreatingGrid=0; %>
     </TABLE> <!-- tableBodyClose -->
      </div>
      </div><!--20130529 Not End of define SetGrid==2 grid-->
      </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-->
    <tr><td style="border:<%=tableRule%>px solid black;" ><!--201309131023b--><!--20140113011-->
   <%}%>
   <% } %>
   <% //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>
     
     <table remark="page.Table">
       <!--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>");}
       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=6 style="border:<%=tableRule%>px solid black;"><!--20140113012-->
      <!--grid.border-->
      <div style="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>
        <span style='float: right; <% if(! (MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>' >
          <button class="GridButton" type="button" onclick="
            offset=offset*1+limit*1;
            retrieval(latestOrderBy);
           ">PgDn</button>
        </span>
        <span style='float: right; <% if(! (MODE.equals("LIST") | MODE.equals("CHOICE"))){out.println("display:none;");} %>' >
          <button class="GridButton" type="button" onclick="
            offset=offset*1-limit*1;
            //alert(offset+ ' '+latestOrderBy);
            retrieval(latestOrderBy);
           ">PgUp</button>
        </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 for="Recno_tableName<%=sID%>">Recno : </label><!--label2140127d-->      
          <input  style="width:2em;margin-left:5px;
             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("SVIEW")){%>
             <button class="GridButton" type="button"
              onfocus="thisTable=tableName<%=sID%>;"
              onclick="RetrievalStatus=0; currentID='';
              currentChoose='';
              delimiter=',';
              for (iix=0; iix<=thisTable.rows.length; iix++) {
               s=_lookup('<%=appendData0TargetKey%>'+iix);
               currentChoose=currentChoose+s+delimiter
              }
              hadEdit=1;
              currentTable='<%=sID%>';
              $('#popup-wrapper').width(800).height(600);$('#moralFrame').prop('src','<%=appendData0%>');
              $('#clicker').click();">
            <%=appendData0Caption%></button><!--20140221-->
            <button class="GridButton" type="button"
             onclick='deleteRow(thisDBFName,thisRowNo);hadEdit=1;'
             onfocus="thisTable=tableName<%=sID%>;"> 
             Delete</button> <!--20130531-->
            <%}%>         
         <% } else { %>
            <%if (MODE.equals("INPUT") || MODE.equals("SINPUT") || MODE.equals("SVIEW")){%>
             <button class="GridButton" type="button" onclick="
             RetrievalStatus=0;
             hadEdit=1;
             tableName<%=sID%>Append()">Append</button>
             <button class="GridButton" type="button"
             onclick='deleteRow(thisDBFName,thisRowNo);hadEdit=1;'
             onfocus="thisTable=tableName<%=sID%>;"> 
             Delete</button> <!--20130531-->
            <%}%>
         <%}%>
         </div>
        </span>
       </div>
       <!-- div style="clear:both; border: 1px black solid; width:<%=si2TotalWidth%>em"; --><!--grid-->
     
       <div style="clear:both; border: 0px black solid; width:100%"; ><!--grid-->
      
       <div style="padding-left:<%=gridLeftOffset%>;padding-right:12px;overflow:hidden;"> <!--gridLeftOffset-->
      
       <TABLE cellspacing=0 cellpadding=6 id=header style="text-align:center;       " rules="rows" border=1>
       <!-- COL WIDTH=10em><COL WIDTH=10em><COL WIDTH=30em -->   
       <!-----------------------------------------grid.header.caption ------------>   
       <colgroup>
        <col span='1' style='width:30px;min-width:30px' > <!-- header.delete.mark -->
        <%
         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){
          out.println("<col span='1' style='width:"+si2Width+Input[i2][26]+";'/>");
         }
         }%>       
       </colgroup>
        <tr style="font-size:<%=FontSize%>;height:<%=InputTextHeight%>;" >
       <%
        if (MODE.equals("INPUT")  || MODE.equals("SINPUT")){
         out.println("<th style='margin-left:10px; width:10px; bgcolor=lightgrey;'>_</th>");
        } else {
         out.println("<th style='border:0px;'></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(displayLength);*/
         double si2Width =  new Double(Input[i2][25]);
         
         
         if (si2No==iNewGroupNo){
          %>
          <!--
           <th style="width:<%=si2Width%><%=Input[i2][26]%>;" bgcolor="lightgrey">
           <div style="text-overflow:ellipsis;width:<%=si2Width%><%=Input[i2][26]%>;">
          -->
            <th  bgcolor="lightgrey">
            <% if ((MODE.equals("LIST") | MODE.equals("CHOICE"))) { %>
            <div title="<%=Input[i2][49]%>" style="text-overflow:ellipsis; cursor:pointer; " onclick="retrieval('<%=Input[i2][4]%>');">
           <% } else { %> 
            <div title="<%=Input[i2][49]%>" style="text-overflow:ellipsis;">
           <%}%>
           
           
           
    <%    
    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);
    } else {
     out.println(Label[i2]);
    }
    %>       
           
            </div>
            </th>
          <% }
         }%> 
        </tr>
        </TABLE> 
        </div><!--end of table header-->
        <%------------------------------------------------------------------Grid Body---%>
        <!-- DIV STYLE="overflow-y: scroll; width: <%=si2TotalWidth%>em; height:<%=GridHeight%>;
        border-left: 1px gray solid; border-bottom: 1px gray solid; background: #fff;
        padding:0px; margin: 0px; " -->
        <DIV STYLE="overflow-y: scroll; width:100%; height:<%=GridHeight%>;
        border-left: 1px gray solid; border-bottom: 1px gray solid; background: #fff;
        padding:0px; margin: 0px; ">
        <TABLE id="tableName<%=sID%>" class="t1" ><!--tableBody-->
        <!-- COL WIDTH=100><COL WIDTH=150><COL WIDTH=200 -->
     <%} %>  
     <%-----------------------------------------------------endof.html.grid---------------Grid Head----%>
      <%if (iCreatingGrid==0) {%>
      <!--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  style="padding-bottom:<%=EachLineHeight%>; inline-display:block; border:0px solid black; <%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> "> <!--xxNewLine 201401271203-->
    <!--20130720L label class="L1" for="<%=tableField%>"><%=sLabel[0]%></label -->
    <% if (isChangePage) {%>
     <tr><td style="vertical-align:top;"><!--20131122--><!--20140312-->
    <%}%>
    <!--1112-->
    <%if (! Input[i][62].equals("documentStatus")){%>
      <label
      title="<%=Input[i][49]%>"
      class="<%=labelCSS%>"
      style="<%=Input[i][45]%>margin-top:0px; border:solid 0px black"
      for="<%=tableField%>">
      <%=labelCaption%>
      </label><!--201401271155-->     
    <%}%>
     
     
    </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")){ %>  
    </td>
    <td style="border:<%=tableRule%>px solid black;"><!--20140113013-->
    <!--second.column.label-->
    <%if ((! Input[i][62].equals("documentStatus")) && (Input[i][65].equals(""))) {%>
     <label ondblclick="currentID='<%=Input[i][28]%>'; <%=Input[i][65]%>" class="<%=labelCSS%>" style="<%=Input[i][45]%>margin-top:0px;
     border:solid 0px black" for="<%=  tableField%>"><%=labelCaption%></label><!--20140127b--><!--20140411-->  
    <%}%>
    <%if ((! Input[i][62].equals("documentStatus")) && (! Input[i][65].equals(""))) {%>
     <label ondblclick="currentID='<%=Input[i][28]%>'; <%=Input[i][65]%>" class="<%=labelCSS%>" style="<%=Input[i][45]%>margin-top:0px;
     border:solid 0px black;cursor:pointer;text-decoration:underline;" for="<%=  tableField%>"><%=labelCaption%></label><!--20140127b--><!--20140411-->  
    <%}%>
    
    <%}%>
    
    <%}%>
    <!--20140113-->
   <% } %>
   <%--------------------------------------------------------------------------html.Radio- it include radio's label---%>
   <% String sInputType=siElement[2];
   if (Input[i][6].equals("radio")) {
   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 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><!--label2140127c-->
    <%}%>
   <%-----------------------------------------------------------html.combo----------------%> 
   <% } else if (Input[i][6].equals("combo")){ %> 
    </td>
    <td style="border:<%=tableRule%>px solid black;"><!--20140113016-->
    <select
    onchange="<%=Input[i][58]%>;"
    onfocus="
    oldValue=this.value;
    if ('<%=Input[i][57]%>'){
     _combo(this.id,'<%=Input[i][33]%>','<%=Input[i][56]%>','<%=Input[i][57]%>');
    }
    "
    onclick="newValue=this.value; if(oldValue!=newValue){hadEdit=1;}" 
    style="width:<%=Input[i][25]%><%=Input[i][26]%>;padding:0px;margin-left:0px;"
    title="<%=Input[i][49]%>"
    name="<%=tableField%>"
    id="<%=tableField%>"  <%=Input[i][32]%> <%=Input[i][34]%>  <%=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.lookup-----------------%> 
   <% } else if (Input[i][6].equals("lookup")){ %> <!--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:400px; margin-right: 5px; " /> 
   <%--------------------------------------------------------------------------------html.Check-------%>
   <% } else if (Input[i][6].equals("check")){ %>
    <span style="margin-right: 5px; font-size:<%=LabelFontSize%>; " ><%=sLabel[1]%></span><!--html.click-->
    <input
     type="checkbox"
     style="font-size:<%=FontSize%>; margin-top: 2px;overflow:hidden; margin: 0;height:16px;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="<%=sLabel[1]%>" />
   <%----------------------------------------------------html.click------------------------------html.button-------%>
   <% } else if (Input[i][6].equals("button")){ %>
    <% if (labelCSS.equals("FR")) { %>
     <%if(Input[i][24].equals("")){%>
      <button style="<%=Input[i][45]%> float:right; <%=Input[i][31]%>  class="formButton" type="button" onclick="alert('<%=Input[i][22]%>')"><%=Input[i][22]%></button><!--20131204a-->
     <%}else{%>
      <button style=" <%=Input[i][45]%> float:right; <%=Input[i][31]%>" class="formButton" type="button" onclick=window.open("<%=Input[i][24]%>","_blank")><%=Input[i][22]%></button><!--20131204b-->
     <%}%>
    <% } else {%>  
     <%if (! Input[i][36].equals("")){%>
     <!--http-->
     <button style=" <%=Input[i][45]%> <%=Input[i][31]%>" class="formButton" 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 style=" <%=Input[i][45]%> <%=Input[i][31]%>" class="formButton" 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 buttonID="<%=tableField%>" style="<%=Input[i][45]%> <%=Input[i][31]%>" class="formButton" type="button" onclick="<%=Input[i][42]%>"><!--MarkBClose--><%=sLabel[1]%></button><!--20131204d-->     
      <%} else {%> 
       <button buttonID="<%=tableField%>" style=" <%=Input[i][45]%> <%=Input[i][31]%>" class="formButton" type="button" onclick="<%=Input[i][42]%>"><!--MarkBClose--><%=sLabel[0]%></button>           
      <%}%>
     <%}else{%>
      <button buttonID="<%=tableField%>" style=" <%=Input[i][45]%><%=Input[i][31]%>" class="formButton" type="button" onclick="location.href='<%=Input[i][24]%>'"><%=sLabel[1]%></button>
     <%}%>
    <%}%> 
   <%--------------------------------------------------------------------------------------html.num---------%>
   <% } else if (Input[i][6].equals("num"))
   {
      masks="var numericMask = new InputMask(JST_MASK_NUMBERS, '"+tableField+"');"+masks;
      //masks="var errorMessage"+i+" = 'Invalid date: ${value}. Expected format: ${mask}';var dateMask1 = new DateMask('yyyy-MM-dd', '"+tableField+"');dateMask1.validationMessage = errorMessage"+i+";"+masks;
   %>
    <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-->
   
      <!--20140127e--><input type="text"
       size="10"
       id="<%=tableField%>"
       name="<%=tableField%>"
       onblur="<%=Input[i][39]%>"
       style="
       clear:both;
       min-width:<%=Input[i][15]%>;
       max-width:<%=Input[i][16]%>;
       width:<%=Input[i][25]%>
       <%=Input[i][26]%>;"
       maxlength="<%=Input[i][10]%>"
       onClick="SelectAll(this.id);"
       title="<%=Input[i][49]%>"
       <%=Input[i][34]%>
       <%=Input[i][40]%>
       onfocus="
        SelectAll(this.id);
        prevField='<%=Input[i][27]%>';
        upperField='<%=Input[i][27]%>';
        nextField='<%=Input[i][29]%>' ;
        lowerField='<%=Input[i][29]%>';
        enterField='<%=Input[i][29]%>';"        
    />     
   <!----------------------------------------------------------------------------------------html.num.2----------->
   <% } else if (
     (Input[i][6].equals("num.1") ||
     Input[i][6].equals("num.2") ||
     Input[i][6].equals("num.3") ||
     Input[i][6].equals("num.4") ||
     Input[i][6].equals("num.5") ) && (! Input[i][7].equals("GRID")) )
   {
      masks=" var numParser"+i+
       " = new NumberParser("+Input[i][9]+", decimalSeparator, groupSeparator, false);var numMask"+i+
       " = new NumberMask(numParser"+i+
       ", '"+tableField+"', 10);numMask"+i+
       ".allowNegative = false; numMask"+i+
       ".leftToRight = true;"+masks;
   %>
    <span class="spanL1" style="border:0px solid black; min-width:200px; width:200px; margin-right: 5px;" ><!--sameLineSecondLabel-->
    <%=Input[i][22]%></span>
    
     </td>
     <td style="border:<%=tableRule%>px solid black;"><!--20140113018 -->
    
    <input type="text"
     class="LineInputText"
     autocomplete=off
     size="10"
     id="<%=tableField%>"
     name="<%=tableField%>"
     onblur="<%=Input[i][39]%>"
     style="border:1px solid black; text-align:right; clear:both;<%=inputWidth%> "  
     maxlength="<%=Input[i][10]%>"
     onClick="SelectAll(this.id);"
     <%=Input[i][34]%>
     <%=Input[i][40]%>
     onfocus="
      SelectAll(this.id);
      prevField='<%=Input[i][27]%>';
      upperField='<%=Input[i][27]%>';
      nextField='<%=Input[i][29]%>' ;
      lowerField='<%=Input[i][29]%>';
      enterField='<%=Input[i][29]%>';"
    />  
    <% if (Input[i][17].equals("s")){individualDiv=0;} else {individualDiv=1;out.println(Input[i][17]);}%>
   <!---------------------------------------------------------------------------------endof.html.num.2----------->    
   <%----------------------------------------------------------------------------------html.hidden--------%> 
   <% } else if (Input[i][6].equals("hidden")){ %>
    <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")){ %>
    <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>
    <textarea
       rows="<%=Input[i][10]%>"
       cols="<%=Input[i][8]%>"
       id="<%=tableField%>"
       name="<%=tableField%>"
       onblur="newValue=this.value; if(oldValue!=newValue){hadEdit=1;}<%=Input[i][39]%>;"
       style="min-width:100%; max-width:100%; clear:both;"
       onClick="SelectAll(this.id);"
       onKeyPress="hadEdit=1;"
       onDblclick="
        s1='<%=Input[i][21]%>';
        s=this.value; 
        s=s.replace(new RegExp('\r?\n','g'), '<z><z>');
        s=s.replace('&', '<and><and>');
        $('#popup-wrapper').width(<%=Input[i][47]%>).height(<%=Input[i][48]%>);
        $('#moralFrame').prop('src','editTextArea.jsp?fieldName=<%=tableField%>'+'&thisValue='+s+'&caption='+s1);
        $('#clicker').click();
       "
      
       
       
       
       title="<%=Input[i][49]%>"
       <%=Input[i][34]%>
       <%=Input[i][40]%>
        onfocus="
        oldValue=this.value;
        SelectAll(this.id);
        prevField ='';
        upperField='';
        nextField ='' ;
        lowerField='';
        enterField='';"        
    />
    </textarea>
   
   <!---------------------------------------------------------------------------------html.date-------->         
   <% } else if (Input[i][6].equals("date") ){
   
    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;
     }
    
   %>
    <!-- span> Date(yyyy-MM-dd)</span --> <!--20140122-->
    </td>
    <td>
    <input
       type="text"
       id="<%=tableField%>"
       name="<%=tableField%>"
       onblur="newValue=this.value; if(oldValue!=newValue){hadEdit=1;}<%=Input[i][39]%>" 
       style="clear:both; width:70px;"
       maxlength="<%=Input[i][10]%>"
       onClick="SelectAll(this.id);"
       title="<%=Input[i][49]%>"
       <%=Input[i][34]%>
       <%=Input[i][40]%>
       onfocus="
        oldValue=this.value;
        SelectAll(this.id);
        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")){
   %>
    </td>
    <td>
    <input type="button" value="upload" class="UploadButton"
       onclick="
       mTargetName='';
       <%=Input[i][42]%>
       if (mTargetName!='NoContinue'){
        $('#popup-wrapper').width(<%=Input[i][47]%>).height(<%=Input[i][48]%>);
        $('#moralFrame').prop('src','upload6.jsp?fieldName=<%=tableField%>&targetName='+mTargetName+'&updateIMG=');
        $('#clicker').click();
       }
       "
    style="cursor:pointer;">
    <input type="text"
        size="2"
        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="SelectAll(this.id);"
        ondblclick="viewUpload(this.value); /* function viewUpload */"
        title="<%=Input[i][49]%>"
        <%=Input[i][34]%>
        <%=Input[i][40]%>
        onfocus="
        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")){
   %>
    </td>
    <td>
    <input type="button" value="image" class="UploadButton"
       style="width:200px;"
       onclick="
       <%=Input[i][42]%>
       $('#popup-wrapper').width(<%=Input[i][47]%>).height(<%=Input[i][48]%>);
       $('#moralFrame').prop('src','upload6.jsp?fieldName=<%=tableField%>&updateIMG=img<%=tableField%>');
       $('#clicker').click();
       "
    style="cursor:pointer;">
    <input type="text"
        size="2"
        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="SelectAll(this.id);"
        ondblclick="viewUpload(this.value); /* function viewUpload */"
        title="<%=Input[i][49]%>"
        <%=Input[i][34]%>
        <%=Input[i][40]%>
        onfocus="
        SelectAll(this.id);
        prevField ='<%=Input[i][27]%>';
        upperField='<%=Input[i][27]%>';
        nextField ='<%=Input[i][29]%>';
        lowerField='<%=Input[i][29]%>';
        enterField='<%=Input[i][29]%>';"        
    />
    <br/>
<!--
    <img border="1" id="img<%=tableField%>" src="/erp/data/AA33.BMP" alt="Pulpit rock" width="304" height="228">
-->
    <!-- img border="1" id="img<%=tableField%>" src="/erp/data/AA30.BMP" alt="Pulpit rock" width="304" height="228" -->
    <!-- img border="1" id="img<%=tableField%>" src="/erp/data/harddisk1.jpg" alt="Pulpit rock" width="304" height="228" -->
    <img border="1" id="img<%=tableField%>" alt="upload Image" width="304" height="228">
    
    
    <!--endof.html.upload-->    <!--documentStatus-->
    
   <%---------------------------------------------------------------------------------html.num--------%>
   <% } 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 style="font-size:<%=LabelFontSize%>; ">
   <%=sLabel[1]%></span>
   <%---it is second label-------%>
   <% } %>
   <%if (iCreatingGrid==100) {%><td> <%}%>    
      <%if (iCreatingGrid==0) {%>
      <%-------------------------------------------------------------------------------------text--------%>
      <!--html.input.mask-->
      <% if(Input[i][54].equals("numeric")){
       masks="var numericMask = new InputMask(JST_MASK_NUMBERS,'"+Input[i][28]+"');"+masks;
      }
      %>
      
      <% if(Input[i][52].equals("upper")){
       masks="var upperMask = new InputMask(fieldBuilder.upperAll(),'"+Input[i][28]+"');"+masks;
      }
      %>
      <% 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;
      }
      %>
     </td>
     <%-----------------------------------------------------------------------html.text--------%>      
     
    
     
     <td style="border:<%=tableRule%>px solid black;"  colspan="<%=Input[i][59]%>" ><!--20140113019-->
       <!--20140205--><div style="width:100px; padding-bottom:<%=EachLineHeight%>; border:0px solid black; <%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> "> <!--xxNewLine 201401271206 -->
      <!--201401271152--><input
        type="<%=Input[i][6]%>"
       class="LineInputText"
       autocomplete=off
       id="<%=Input[i][28]%>"
       name="<%=Input[i][28]%>"
       style="<%=inputWidth%><%=Input[i][31]%>
       <%if (InvisibleRetrivalNumber.equals("1")&& i==0){ %>display:none <%}%> "
       maxlength="<%=siElement[4]%>"
       onClick="this.select();"
       onKeyPress="hadEdit=1;"
       title="<%=Input[i][49]%>"    
       <%=Input[i][34]%>
       <%=Input[i][40]%>
       onfocus="
        oldValue=this.value;
        selectTextboxContent(this);
        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; if(oldValue!=newValue){hadEdit=1;} 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 (Type2.equals("FROMTO")) {  %> TO
           <input
            class="LineInputText"
            type="<%=siElement[2]%>"
            id="<%=tableField%>_to"
            name="<%=tableField%>_to"
            style="width:<%=siElement[3]%><%=InputDisplayUom%>;"
            maxlength="<%=siElement[4]%>"
            onblur=''
            onfocus="nextField='<%=nextField%>';enterField='<%=nextField%>';" />
           <%}%>    
      <%}%>
   <%if (iCreatingGrid==100) {%></td> <%}%> 
    <% } %>  
  <%}//endfor Input.length%>
   <%if (iCreatingGrid==0) {%>
  <% } %>
  </p> <!--ddd-->
    <%if (iCreatingGrid==0) {%>
  <% } %>
  <%if (SetGrid==2) { %>
    </TABLE><!--tableClose-->
     </div>
     </div><!--End of define SetGrid==2 grid-->
  <%} else if (SetBox==2){%>      
    </div><!-- boxClose 20130913-->
  <%}%>  
  </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("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" -->
<%--------------------------------------------------------------------------JavaScript.variable ------%>
<script>
var PROCESSING_MODE='<%=PROCESSING_MODE%>';
var numWindows = 0;var windows = new Array(100);var _top=20;var _left=20 ;var parameters = "";
onerror=handleErr;
var errortxt="";
 $.ajaxSetup({
 async: false
 }); //201312161144
function handleErr(msg,url,l)
{
errortxt="There was an error on this page.\n\n";
errortxt+="Error: " + msg + "\n";
errortxt+="URL: " + url + "\n";
errortxt+="Line: " + l + "\n\n";
errortxt+="Click OK to continue.\n\n";
alert(errortxt);
return true;
}
function viewUpload(s14) {
   var re = /(?:\.([^.]+))?$/;
   var s = re.exec(s14)[1];     
   ext=s.toUpperCase();
   //document.write(ext);
   if (ext=="PDF" | ext=="pdf"){
     window.open("ViewPDF?db=data&viewFile="+s14+"&ContentType=application/pdf","_blank","width=800,height=600");
     //   CONTENT_TYPE = "application/pdf";
     //  CONTENT_TYPE = ContentType;
   } else if (ext=="BMP" | ext=="bmp" | ext=="JPG")   {
     window.open("ViewPDF?db=data&viewFile="+s14+"&ContentType=image/x-xbitmap","_blank","width=800,height=600");
     
   } else if (ext=="xls" | ext=="XLS" | ext=="XLSX")   {
     s="ViewPDF?db=data&viewFile="+s14+"&ContentType=application/vnd.ms-excel";
     $('#moralFrame').prop('src',s);
   }
}
function openNewWindow(url,mWidth,mHeight) {
 if (window.showModalDialog) {
   var returnTarget=window.showModalDialog
   (url,this,
   "dialogWidth:600px;dialogHeight:400px; resizable:0;scroll:0;");
 } else {
  _top=_top*1+numWindows*20;
  _left=_left;
  numWindows += 1;
  parameters = "toolbar=0,scrollbars=0,location=0,statusbar=0,"+
  "menubar=0,resizable=0,width=mWidth,height=mHeight,top = 1 ,left =650 ";
  var title = "Window #"+numWindows;
  myWindow=window.open(url,'','location=false,width=400,height=300');
  //myWindow=window.open(url);
  myWindow.focus();  
 }
}
/*
function function_3TW0PIB9U()     {
 if (window.showModalDialog) {
  var returnTarget=window.showModalDialog("solistmc.php",this,
  "dialogWidth:600px;dialogHeight:400px;resizable:0;scroll:0;");
 } else  {
  var returnTarget=window.open("solistmc.php",this,"height=400px,width=600px,toolbar=no,directories=no,status=no,memubar=no,modal=yes,location=no,resizable=no,menubar=no,scrollbars=no,copyhistory=no");
 } 
cookiefunction_3TW0PIB9U()}
*/
$(function(){
 generateRecordID();
 var browserLevel=0;
 var upperField=""; var nextField=""; var enterField=""; var firstField="";  var thisID;
 var prevField="";  var lowerField="";var thisTable="" ; var thisRowNo=0; var thisDBFName="";
 var ActivePage = 0;
 var $defaultLi = $('ul.tabs li').eq(ActivePage).addClass('active');
 $($defaultLi.find('a').attr('href')).siblings().hide();
 $('ul.tabs li').click(function() { //click|mouseover
  var $this = $(this), _clickTab = $this.find('a').attr('href');  
  $this.addClass('active').siblings('.active').removeClass('active');
  $(_clickTab).stop(false, true).fadeIn().siblings().hide();// fade out pagehead
  return false;
 }).find('a').focus(function(){
  this.blur();
 });
 var netscape = "";
 ver = navigator.appVersion; len = ver.length;
 for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
 netscape = (ver.charAt(iln+1).toUpperCase() != "C");
 browserLevel = _getlevel();
 _refreshv2("browser",browserLevel);
});
function generateRecordID()
{
 c=milliseconds = new Date().getTime(); //generate recordID for master generate.recordID
 
 <% if (! keyValue.trim().equals("")){out.println("Xc="+keyValue);} // 20130823 %>
  //document.write(keyValue);
 
   _refreshv2('<%=masterTableName%>.recordID',c);
   RECORDID=c;
 
 <% if ((! KEYVALUE1.trim().equals("")) && KEY1.equals("RecordID")){out.println("_refreshv2('"+masterTableName+".recordID',"+KEYVALUE1+");RECORDID='"+KEYVALUE1+"';");} // 20130823 %>
}
<% /*******************************************java.javascript*********************Java Generate JavaScript  */
out.println("keyValue="+keyValue) ; //20130829
String blank="";
if (MODE.equals("INPUT") || MODE.equals("SINPUT")  || MODE.equals("SVIEW")){out.println("$('.SaveButton').css('display', 'inline');");}  //20130821
iOldGroupNo=0;SetGrid=0;int iFieldCount=0;PreviouField="null"; nextField="null";
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(".","_");
 //out.println("document.write('"+sID+"')");
 //out.println("alert('"+sID+"')");
 //out.println(sID);
 //listTables[1]="sID";
 
 
 
 
 
 
 
 
 
 
 
 //*****************************************************************************java.blank******//
 if (!(MODE.equals("LIST") | MODE.equals("CHOICE"))) { //20131114
 if(!Input[i][41].equals("")){
  blank=blank+"_refreshv2('"+tableField+"','"+Input[i][41]+"');";
 } else {
  blank=blank+"_refreshv2('"+tableField+"','"+Input[i][14]+"');";
 } 
  //blank=blank+"_refreshv2('"+tableField+"','123');";
 }
 /*************************************************************function key : append****CreateTableBody********/
 if (iNewGroupNo!=iOldGroupNo && SetGrid==2){SetGrid=0;out.println("setFocus(firstField);}"); }
 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.
  var obj_field=document.getElementById('<%=Input[i][28]%>');
  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]));
   }
   }
   }
  ) 
 <%}%> 
 
 
 
 <%
 /************************************************************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
   sqlTableName[i11]=Input[i][3];
   //out.println("alert('"+sqlTableName[i11]+"')");
   //out.println("alert('"+sID+"')");
   //out.println("alert('"+i11+"')");
   //out.println(sID);  
  
 %> var reccount__tableName<%=sID%>=1;
 
  function tableName<%=sID%>Append(){ // grid.append
    var table=document.getElementById("tableName<%=sID%>");
    var thisRow = table.rows.length;
    var NewRow=table.insertRow(thisRow);
    var firstField='<%=tableField%>' + thisRow; //20130530
    <%if (MODE.equals("INPUT") || MODE.equals("SINPUT")  || MODE.equals("SVIEW")){%>
     /********************************************************************************Delete Mark*/
     var newText = document.createElement('input'); // Delete mark on the table
     newText.style.cssText = 'width:8px'
     newText.name = '<%=dbfName%>._action[' + thisRow+']';
     newText.id = '<%=dbfName%>_action' + thisRow;
     newText.setAttribute('autocomplete','off') ;
     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; <%=Input[i][31]%>'
     newText.name = '<%=dbfName%>.parent_recordid[' + thisRow+']';
     newText.id = '<%=dbfName%>.parent_recordid' + thisRow;
     newText.value=RECORDID;
     newText.type="hidden";
     var newColumn = NewRow.insertCell(-1);
     newColumn.appendChild(newText); // parentTablerecordID
    <%}%>
  <%}%>
  <%
  /*******************************************************************************when inputtype=lookup **********/
  if (sInputType.equals("lookup")){ %> var old<%=s_FieldName%>=""; <!--initialLookup-->
  <%}%>
  <%if (tableField.equals(dbfName+".recordID")&& siType.length==1){ %>
   //20131219 c=milliseconds = new Date().getTime();
   //20131219 _refreshv2('<%=tableField%>',c);
  <% } %>
  
  
  <%if (iOldGroupNo==iNewGroupNo &&  siType.length==2){ //201401211735%>
  // <%=tableField%>  <%=dbfName+".recordID"%>
  //201401221742 grid.num2 grid.num.2
  <% if (siType[0].equals("textarea") || siType[0].equals("date") || siType[0].equals("num.2") || siType[0].equals("text") || siType[0].equals("combo")  || siType[0].equals("numeric")) { %>
  var newColumn = NewRow.insertCell(-1);
      <% if  (siType[0].equals("combo") ) {  // grid.combo %>
          var newText = document.createElement('select');
          
          
    
    <%
     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-->");
      
      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;");
      
     }
    %>
          
          
          
          
          
          
          
          
          
          
          
          s20140123='<%=Input[i][33]%>&db=<%=DATABASE%>';
          $.getJSON(s20140123,
           function(data20140123) {
           xxr=0;
            if (data20140123[0] && RetrievalStatus){
             for (r20140123=0; r20140123<data20140123.length; r20140123++){
               $(obj_field).append($('<option></option>').val(data20140123[r20140123][0]).html(data20140123[r20140123][1])
               );
               var option1 = document.createElement("option");
               option1.value=data20140123[r20140123][0];
               option1.innerHTML=data20140123[r20140123][1];
               newText.appendChild(option1);
               option1=null;
               
               //alert(++xxr);
             }
            }
           }
          );
      <% } else if  (siType[0].equals("textarea") ) {  // grid.textarea %>     
        var newText =zxcFormField('TEXTAREA','option1');
        //newText.style.height = "42px";
        //newText.style.width = "496px";
      <% } else { %>
      
          var newText = document.createElement('input');
      
      <% }  %>
      
  newText.style.cssText = 'font-family:monospace; display:block;width:100%; <%=Input[i][31]%>'; //grid.text.css
  newText.name = '<%=tableField%>[' + thisRow+']';
  newText.id = '<%=tableField%>' + thisRow;
  newText.type='text';   
  /*newText.innerHTML ='<textarea name="textarea2" id="textarea2" cols="28" rows="2"></textarea>';*/
  if ('<%=tableField%>'=='<%=dbfName%>.recordID'){
   newText.value=milliseconds = new Date().getTime();
   currentRecordID=newText.value; //20140224
  } 
  newText.className="gridDblClick"; //20130904
  newText.onkeypress=function(event) {
      hadEdit=1;
      <%
      if (Input[i][54].equals("numeric")) {
       out.println("return Validate_Numeric(event,this.value);");
      }
      %> 
  }
  
  newText.onchange=function(event){  //grid.onchange
      hadEdit=1;
      <%=Input[i][58]%>;
  };
  
  //MODE.equals("CHOICE")
  newText.ondblclick = function(event){  // grid.dbclick
      <%if (siType[0].equals("textarea")) {%>
        s1='<%=Input[i][21]%>'; // grid.textarea.label
        s=this.value;  // grid.textarea.dbclick
        s=s.replace(new RegExp('\r?\n','g'), '<z><z>');
        $('#popup-wrapper').width(<%=Input[i][47]%>).height(<%=Input[i][48]%>);
        $('#moralFrame').prop('src','editTextArea.jsp?fieldName=<%=tableField%>'+thisRow+'&thisValue='+s+'&caption='+s1);
        $('#clicker').click();
      <%}%>
      currentID='<%=tableField%>'+thisRow;
      
      
      <%=Input[i][67]%>;
      
      
      <%if(MODE.equals("CHOICE")){%>
        parent.formResult=Xdata[thisRowNo]; 
       parent.exitMoralBox();
      <%}%>
      
      
      <%
      if ( !ListSubFormName.trim().equals("")){
       if (! modalWidth.equals("")){
        out.println("$('#popup-wrapper').width("+modalWidth+").height("+modalHeight+");");
       } else {
        out.println("$('#popup-wrapper').width(WINDOW_WIDTH).height(WINDOW_HEIGHT);");
       } 
       if (! ListSubFormExtend.trim().equals("")){ 
        out.println("s1='';");
        out.println(ListSubFormExtend);
        out.println("s='input.jsp?mode="+modalMode+"&input='+s1+'"+ListSubFormName+"&config='+s1+'"+ListSubFormConfig+"&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("s='input.jsp?mode="+modalMode+"&input="+ListSubFormName+"&config="+ListSubFormConfig+"&key=recordid&keyValue='+Xdata[thisRowNo];");     
        out.println("editingRow=thisRowNo;");
        //out.println("document.write(s);");  //20131113  // e.g. can input grid.dbclick subform.input
        out.println("$('#moralFrame').prop('src', s);");
        out.println("$('#clicker').click();//20131113a");
       }  
      }
      %>
  };  // end of grid.dblclick
  
  
  newText.onblur = function(event) {  // grid.onblur
      newValue=this.value;
      <%
      //String s="SumTotal(<tableName>,value1,value2,targetValue)";
      if (! Input[i][63].equals("")) {
       String s=Input[i][63];
       s=s.replace("tableName()","tableName"+sID)+";";
       out.println(s);
      }
      %>
      //s=""
      //alert("tableName<%=sID%>");
      <% if(Input[i][54].equals("numeric")){ %> 
        <% if(Input[i][31].indexOf("text-align:right")>=0){ %> 
         document.getElementById(this.id).style.textAlign="right"; //20140207 numeric.handle
        <%}%>
      <%}%>
  }
  
  newText.onfocus = function(event) { //grid.onfocus
      oldValue=this.value;
      <%if((MODE.equals("SINPUT") | MODE.equals("INPUT")) & (! siType[0].equals("combo"))){out.println("SelectAll(this.id);");}%>
      <%if (siType[0].equals("combo")) {%>
       _combo(this.id,'<%=Input[i][33]%>','<%=Input[i][56]%>'+thisRow,"<%=Input[i][57]%>",this.value);
      <%}%>
      <%if(MODE.equals("INPUT")){out.println("SelectAll(this.id);");}%>
      
      thisID='<%=tableField%>' + thisRow;
      <%if(!Input[i][40].equals("readonly")){%>
       document.getElementById(this.id).style.textAlign="left"; //20140207 numeric.handle
      <%}%>
      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%>");
  };
  
  newText.onclick = function(event) {
      newValue=this.value; if(oldValue!=newValue){hadEdit=1;}
      <%if((MODE.equals("SINPUT") | MODE.equals("INPUT")) & (! siType[0].equals("combo"))){out.println("SelectAll(this.id);");}%>
      sayRecno(this.parentNode.parentNode.rowIndex);
      <%if (siType[0].equals("combo")) {%>
      _combo(this.id,'<%=Input[i][33]%>','<%=Input[i][56]%>'+thisRow,"<%=Input[i][57]%>",this.value);
      <%}%>
  }; 
  
 
  /*newText.value='<%=Input[i][40]%>';*/
  
  <%if ((MODE.equals("LIST") | MODE.equals("CHOICE")) | Input[i][40].equals("readonly")){%>newText.setAttribute("readOnly","true");<%}%> 
  newColumn.appendChild(newText);
  newColumn.height='20'; // grid.column.height
  newColumn.style.cssText = 'width:<%=iWidth%><%=Input[i][26]%>; '; //grid.column.width
  
    <%
   if (Input[i][6].equals("date")){
    out.println("s13='"+tableField+"'+thisRow;");
    out.println("var dateMask = new DateMask('yyyy-MM-dd', s13);"); 
   }
   if ( //20140206
   Input[i][6].equals("num.1") ||
   Input[i][6].equals("num.2") ||
   Input[i][6].equals("num.3") ||
   Input[i][6].equals("num.4") ||
   Input[i][6].equals("num.5") )
   {
    out.println("var numParser3 = new NumberParser("+Input[i][9]+", decimalSeparator, groupSeparator, false);");
    out.println("s13='"+tableField+"'+thisRow;");
    out.println("var numMask3 = new NumberMask(numParser3, s13, 12);");  
    out.println("NumberMask.leftToRight = true;");  
    
    /*
    masks=" var numParser"+i+
       " = new NumberParser("+Input[i][9]+", decimalSeparator, groupSeparator, false);var numMask"+i+
       " = new NumberMask(numParser"+i+
       ", '"+tableField+"', 10);numMask"+i+
       ".allowNegative = false; numMask"+i+
       ".leftToRight = true;"+masks;
    */   
    
   }    
  
  %>
  
  
  
  <%if (siType[0].equals("combo")) {%>
  <%}%>  
  
  <% PreviouField=tableField; iFieldCount++;}%>
  <% if (iNewGroupNo!=iOldGroupNo) {iOldGroupNo=iNewGroupNo;} 
  } //201401211735 %> 
  <% } //201401221721 %>
  
  <%if (SetGrid==2){ %>setFocus(firstField);
  }
  
  <%}%>
<%@ include file="inputFooterJavaScript.jsp" %>
</script>
<script type="text/javascript">
/////////////////////////////////////////////////////////////////// Control runtime.init ////////////
<%out.println("function blank(){" + blank+
"generateRecordID();"+
 "}"); %> //running.blank
<%out.println(masks); %>
<%out.println("function defaultInput(){" + defaults+ "}"); %>
<%out.println(formInit); %>
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]%>
   }
    //<%=retrievalBackString[0]%>
   }  else {
    <%=notFoundAction%>
    //if (keyValue!="'D'" && keyValue!="'C'" ){alert("Input.jsp : No This Number "+keyValue);}
   }
  }
 ); //endofgetJsonRetrieval2
}
function retrieval(orderBy)
{
 
 //alert(thisRowNo); //20
 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();
 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 (keyValue)
 {
  _refreshv2('<%=masterTableName%>.recordID',keyValue); //201312181616
  RECORDID=keyValue; //201312181616
  keyValue="'"+keyValue+"'";
  //alert("paraMode : "+paraMode);
  <% if (MODE.equals("SINPUT") || MODE.equals("SVIEW")){key="recordID";} %>
  <% if (MODE.equals("INPUT") || MODE.equals("SINPUT") || MODE.equals("SVIEW") ||  MODE.equals("VIEW")) {%>
   keyValue=keyValue.trim();
   <%
   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=parent_recordid&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
    out.println("$.getJSON(sx,");
    out.println("function(data) {");
    out.println("if (data[0]){");
    out.println("for (r=0 ; r<data.length; r++){");
    out.println("Xdata[r]=data[r][0];");
    out.println("tableName"+listTables[i]+"Append()");
    out.println("rf=0; ");
    out.println("editRow=r;");
    out.println(listRefresh[i]);  // 20140206 from 1 to i
    out.println("}");
    out.println("hadEdit=0;oldValue='';newValue='';}"); //20140304
    out.println("}");
    out.println(");");
   }
   %>  
  
   s= 'tableRead?'+
    'db=<%=DATABASE%>&'+
    'table=<%=masterTableName%>&'+
    'fields=<%=fields%>&'+
    'key=<%=key%>&value='+keyValue+'&format=<%=formats%>&'+
    'limit='+limit+'&'+
    'offset='+offset+'&'+
    'fields=<%=fields%>&'+
    'where=<%=where%>&'+
    'callback=?';
   //form.retrieval.tableRead
   //document.write(s);  // retrieval.key  editing.retreival.sql
    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]){
       <%=retrievalBackString[0]%>
       if ((<%=formReadOnly%>) |(PROCESSING_MODE!="D")) { //20140317
         if (<%=formReadOnly%>) {
         _refreshv2("formStatus","Approved");
         $("#formStatus").css("color","red");
        }
        
        $('input[type="text"]').keypress(function(e){e.preventDefault();});
        $('input[type="TEXT"]').keypress(function(e){e.preventDefault();});
        $('input').keypress(function(e){e.preventDefault();});
        $('select').each(function() {this.disabled='disabled';})
        $('textarea').each(function() {this.disabled='disabled';})
        $('button').each(function() {this.disabled='disabled';})
        $('.SaveButton').each(function() {this.disabled='';})
        
        
        //$(select).attr('disabled', 'disabled');
        //$('select').prop('disabled', false);
        //$('select').click(function(e){e.preventDefault();});
       } else {
        _refreshv2("formStatus","Draft");
       }
      }
     }
    ); //endofgetJson
   }, 100);
   //document.write(s);
  <%}%>
  mWhere='<%=where%>';
  <% 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=' where ( '+ _c00 + ' or '+_c01 + ' or '+_c02+' or '+_c03+' or '+_c04+' or '+_c05+' or '+_c06+' or '+_c07+' or '+_c08+' or '+_c09 +')';
    }
    //mWhere=" "+mWhere+" and (status:`D` or status:`A`) ";
    mWhere=" "+mWhere+" <%=formConstrain%>";
   <%}%>
   //list.retrieval.tableRead
   //var ascDesc="asc";
   if (latestOrderBy != orderBy){
    ascDesc="asc";
    offset=0;
   }
   if (offset<0){offset=0;}
   //subform.retrieval.sql
   if (! orderBy){orderBy="recordID";}
   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=?';
   
   //alert(s)
   
   
   //s='tableRead?db=BR201312111529&table=DNQTYOS&fields=recordid,SUPPLIER_NAME,PURCHASE_ORDER,PO_ITEM,PO_DESCRIPTION,DN_OSQTY,PO_UNIT&key=status&value=%27D%27&format=S,S,S,S,S,S,S&where=where%20qty#0 &callback=?'
   //document.write(s)
   //alert(parent.currentEntity); //20140324
   
   if (ascDesc=="asc"){
    ascDesc="desc";
   } else {
    ascDesc="asc";
   }
   //currentEntity    20140321
   latestOrderBy=orderBy;
   $.getJSON(s,
    function(data) {
    
    if (data[0]){
      lastOffset=offset;
      i9=0;
      for (r=0 ; r<data.length; r++){
       if (1==1){
        Xdata[r]=data[r][0];
        if (currentRecordID==Xdata[r]){
         //alert(Xdata[r]);
         i9=r;
        }
        //201402041753 currentRecordID
        //newText.onfocus
        
        tableName<%=listTableSid%>Append();
        rf=0;
        editRow=r;
        <%=listRefresh[0]%>
       }
      } //201312180428
  
     
      r=i9;  //20140204
      rf=0;
      editRow=r;
      <%=listRefresh[0]%>
     
  
      
      
     }  else {
      offset=lastOffset;
      <%=notFoundAction%>
      //if (keyValue!="'D'" && keyValue!="'C'" ){alert("Input.jsp : No This Number "+keyValue);}
     }
    }
   ); //endofgetJson201312180427
  <%}%>  
 }
 //alert(data[0][1]);
 //20131107 <%=clockRefresh%>
}
//****************************************************form.init html.init****************************
<%if ( MODE.equals("VIEW")){%>
 $('input[type="text"]').keypress(function(e){e.preventDefault();});
<%}%>
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 selectTextboxContent(textbox)
{
    setTimeout(function() { textbox.select(); }, 10);
}
$(function() {
 blank(); //20130829
 defaultInput();
 retrieval();
 //_setfocus("employee.employeeNumber"); //20130627
 <%=clockRefresh%>
 $('input:radio[name=employee\\.marriedStatus]:nth(0)').attr('checked',true); //hardcode
}); //endof$function
$('.recordID').keypress(function(e){e.preventDefault();    }); //20130827
$('.recordID').css('disabled', 'disabled'); 
$('.filePrew').change(function(){$('.browseText').val($(this).val());});
$('a').css('cursor', 'pointer');
$('.filePrew').css('cursor', 'pointer'); 
document.onkeydown = keyDown; /* work together to analyze keystrokes */
//if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
$(document).ready(function() { // inkey.Control
 //==13
 $(window).keydown(function(event){
    if(event.keyCode == 13  && event.target.nodeName != "TEXTAREA"   && event.target.nodeName != "textarea" ) {
   //alert(event.target.nodeName);
      event.preventDefault();
      return false;
    }
  if(event.keyCode == 37  || event.keyCode == 38 || event.keyCode == 39 || event.keyCode == 40 ) {
      event.preventDefault();
      return false;
  }
  });
});
</script>
<script>
 $( "#popup-wrapper" ).draggable(); //201312301439
 $(function() {
  $("#dialog").dialog({autoOpen: false});
 });
 
 function formValidation()
 {
  <%=formValidation%>
  return true;
 }
 $(function () {
  $('#popup-wrapper').modalPopLite({ openButton: '#clicker', closeButton: '#close-btn', isModal: true});
  $('body').css('display', 'inline');
 });
 //out.println(listRefresh[1]);
 
 <%
   if (listRefresh.length>=2){%>
    function updateThisform(resultRecordId){ //20140221 20140224
     //alert('call from updateThisForm() 20140411 - '+resultRecordId);
     // remark : receive key should same as view e.g.reckey SODP_RecordID, SALES_ORDER_PO_DESC have SODP_RecordID
    
     // s31=tableName<%=listTables[1]%>.row.length;
    //  alert(s31);
     // document.write(s31);
    <%
    // out.println("s31=tableName"+listTables[1]+".row.length;");
    // out.println("alert('tableName"+listTables[1]+".row.length');");
    %>
    /*
    if (1=0) { 
     var lastRow = tbl.rows.length - 1;
     var iix;
     for (iix=0; iix<=lastRow; iix++) {
       var obj_qty=document.getElementById(value1+iix);
       obj_qty.value=parseFloat(obj_qty.value).toFixed(0);
       if ( isNaN(obj_qty.value)) {obj_qty.value=0;}
       var obj_price=document.getElementById(value2+iix);
       obj_price.value=parseFloat(obj_price.value).toFixed(2);
       if ( isNaN(obj_price.value)) {obj_price.value=0;}
       var i=obj_qty.value*obj_price.value;
       _refreshv2(targetValue+iix,i.toFixed(2));
     }
    }
    */
 
     
     keyValue=resultRecordId;
     s= 'tableRead?'+
       'db=<%=DATABASE%>&'+
       'table=<%=appendData0Source%>&'+
       'fields=recordid,<%=listFields[1]%>&'+
       'key=recordID&value='+keyValue+'&format=S,<%=listFormats[1]%>&'+
       'callback=?'; // retrieval after choice
     $.getJSON(s,
      function(data) {
      if (data[0]){
        <%
         out.println("tableName"+listTables[1]+"Append()"); //20140321        
        %>  
        rf=0;r=0;
        editRow=thisRowNo;
        refRecordID=data[r][0];
        <%=listRefresh[1]%>
        _refreshv2('<%=sqlTableName[1]%>.recordID'+editRow,currentRecordID);
        _refreshv2('<%=appendData0TargetKey%>'+editRow,refRecordID);
        data[0]=null;
        formResult="";
       }  else {alert("Connection Error"+keyValue);}
      }
     ); //140225 endOfGetJson  
    
    // retrieval after choice
    s= 'tableRead?'+
       'db=<%=DATABASE%>'+
       '&table=<%=appendData0Source%>'+
       '&fields=<%=appendData0HeaderSource%>'+
       '&key=recordID&value='+keyValue+'&format=<%=appendData0HeaderSourceFormat%>'+
       '&callback=?';
    //document.write(s);   
    $.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("_refreshv2('"+s+"',data[0]["+i+"]);//1402251213");
        } 
       %>
       
       //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(string){  /* java.exitMoralBox */
  $('#close-btn').click();
  if (formRefresh){
    window.setTimeout(function() {
    retrieval();
   }, 10);
  } else {
    if (formResult){
      if (1==0) {
       <%=labelOndblclickAfter%>
      } else {
       updateThisform(formResult);
      } 
    }
    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]%>
       }  else {alert("No This Number "+keyValue);}
      }
     ); //endofgetJson  
    }, 300); 
  }
 }
 
 function winexit(sid) {window.returnValue =sid;window.close();}
 
 function _combo(p_id,p_combo,p_filter,p_constrain,p_thisValue){
   //p_id = target ID
   //p_combo = tableRead statement
   if (! p_thisValue){p_thisValue="";}
   if (p_combo) {
    reference=_lookup(p_filter);  //201401231801
    if (! reference) {reference="ZdummyZ";}
    s=p_constrain.replace(/reference/,reference);
    s10=p_combo+'&db=<%=DATABASE%>';
    s10=s10.replace(/(true)/,s);
    var obj_field=document.getElementById(p_id);
    obj_field.options[0] = new Option('','');
    if (reference) {
     s=s10
    } else {
     s=p_combo+'&db=<%=DATABASE%>';
    }
    $(obj_field).find('option').remove().end()
    $.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('');
      }
     }
    );
    _refreshv2(p_id,p_thisValue); //_comboRefresh
   }
 } //201401231033
 
 
function SumTotal(tableName,value1,value2,targetValue)  //20140213
{
 
 var obj_fc_amt=document.getElementById(targetValue);
 
 //obj_fc_amt.value=0;
 
 var tbl = document.getElementById(tableName);
 
 var lastRow = tbl.rows.length - 1;
 
 var iix;
 
 for (iix=0; iix<=lastRow; iix++) {
   var obj_qty=document.getElementById(value1+iix);
   obj_qty.value=parseFloat(obj_qty.value).toFixed(0);
   if ( isNaN(obj_qty.value)) {obj_qty.value=0;}
   var obj_price=document.getElementById(value2+iix);
   obj_price.value=parseFloat(obj_price.value).toFixed(2);
   if ( isNaN(obj_price.value)) {obj_price.value=0;}
   var i=obj_qty.value*obj_price.value;
   _refreshv2(targetValue+iix,i.toFixed(2));
   //alert(obj_qty.value);
   
   //var obj_result=document.getElementById("subtotal"+iix);
   //obj_result.value=(obj_qty.value* parseFloat(obj_price.value)).toFixed(2);
   //obj_fc_amt.value=(parseFloat(obj_result.value)+parseFloat(obj_fc_amt.value)).toFixed(2);
 }
}
 
 
</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">
  <p style="font-size:medium;">...</p>
</div>
</body>
</html>
 
沒有留言:
張貼留言