<%@ page import="com.csc.library.entry.*,com.csc.library.utilities.*,com.csc.library.session.*,com.csc.library.database.*,java.util.*" contentType="text/html;charset=UTF-8"%> <jsp:useBean id="RC001" scope="page" class="com.csc.library.system.Task"/> <jsp:useBean id="RC002" scope="page" class="com.csc.library.system.Task"/> <% RC001.setChannel(request ,response); RC002.setChannel(request,response); UIManager screen=(UIManager)RC001.process("ChildEntry","BUDGET_APPLPLY1"); CheckNull chk = new CheckNull(); String APP_CHANELID = chk.chkNullString(request.getParameter("__APP_CHANELID")); String budg_year = chk.chkNullString(request.getParameter("__budg_year")); %> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="../CSS/TISCO.css" rel="stylesheet" type="text/css"> <script type='text/javascript' src='../JS/SCREEN.js'></script> <script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script> <script src="../JS/VIEWCALENDAR.js"></script> <script language="javascript">getTitleName();</script> <!--DWR INCLUDE--> <script type='text/javascript' src='/hr/dwr/interface/SearchDWR.js'></script> <script type='text/javascript' src='/hr/dwr/engine.js'></script> <script type='text/javascript' src='/hr/dwr/util.js'></script> <script type="text/javascript" src="/hr/dwr/interface/SystemCode.js"></script> <script type="text/javascript" src="/hr/dwr/interface/CscCalendar.js"></script> <script type="text/javascript" src="/hr/dwr/interface/Budget_applply_dwr.js"></script> <!--DWR INCLUDE--> <script language="JavaScript" type="text/JavaScript"> <!-- function goHelp(helpName,inputName){ var helpReturn; var fixCon = ""; if(inputName=="__app_chanelid" ){ helpReturn="__app_chanelid:app_chanelid,APPLPLY_CHANEL@TDESC"; } else if(inputName=="__currency" ) { helpReturn="__currency:currencyid,MCURRENCY@TDESC"; } else if(inputName=="__bankid" ) { helpReturn="__bankid:bankid,MBANK@TDESC"; } else { return; } linkHelp_Return(helpName, helpReturn, fixCon); } function saveChild(acktion){ if(nullCheck()){ with(document.cscform){ var list_record = document.getElementById("__wf__list_record").value; var last_record = document.getElementById("__wf__last_record").value; line = list_record.split(","); var str = new Array(line.length); if(last_record=="0"){ str[0] = new Array(6); str[0][0] = __budg_year.value; str[0][1] = __app_chanelid.value; str[0][2] = ""; str[0][3] = ""; str[0][4] = ""; str[0][5] = __payment.value; }else{ for(i=0; i<line.length; i++){ if (line[i]!="") { str[i] = new Array(6); str[i][0] = __budg_year.value; str[i][1] = __app_chanelid.value; str[i][2] = document.getElementById("__start_date$"+line[i]).value; str[i][3] = document.getElementById("__end_date$"+line[i]).value; str[i][4] = document.getElementById("__apply_count$"+line[i]).value; str[i][5] = __payment.value; } } } Budget_applply_dwr.saveBA(str,{callback: function(data){ //alert(data); if(data!="error"){ with(window.opener.document.cscform){ __help.value="__budg_year#"+__budg_year.value; submit(); } window.close(); } },async:true }); //} } } } function back(){ with(window.opener.document.cscform){ __cmd.value = 'ack'; submit(); } } function addRowToTable(linecount){ if(nullCheck()) { var last_record = document.getElementById("__wf__last_record"); var list_record = document.getElementById("__wf__list_record"); var line = last_record.value; line++; list_record.value += ","+line; last_record.value = parseInt(last_record.value)+1; addRow(line); } } function addRow(line){ var tbody = document.getElementById("rsTable").tBodies[0]; var tr = document.createElement("TR"); tr.align = "center"; var cell1 = document.createElement("TD"); cell1.className = "row-data"; var inputChkBox = document.createElement("INPUT"); inputChkBox.name = "__checkbox$"+line; inputChkBox.id = inputChkBox.name; inputChkBox.type = "checkbox"; inputChkBox.value = line; cell1.appendChild(inputChkBox); var cell2 = document.createElement("TD"); cell2.className = "row-data"; var span2 = document.createElement("SPAN"); span2.innerHTML = " "; var inputStartDate = document.createElement("INPUT"); inputStartDate.name = "__start_date$"+line; inputStartDate.id = inputStartDate.name; inputStartDate.className = "txt01"; inputStartDate.type = "text"; inputStartDate.size = 10; inputStartDate.maxlength = 10; inputStartDate.onblur = function(){chkInputDate2(this, document.getElementById("__end_date$"+line));copyDate(this,document.getElementById("__end_date$"+line));set_time0id2(this.value,line);chkTotal();}; inputStartDate.onkeyup = function(){formatDate(this)}; inputStartDate.onkeypress = function(){chkIntegerOfDate(this.value)}; var linkCal1 = document.createElement("A"); linkCal1.href = "javascript:;"; var imgCal1 = document.createElement("IMG"); imgCal1.src = "../IMAGES/BUTTON/MAIN/CALENDAR20.gif"; imgCal1.alt = "Calendar"; imgCal1.name = "startdate"+line; imgCal1.id = "startdate"+line; imgCal1.border = 0; imgCal1.align = "absmiddle"; imgCal1.onclick = function(){viewCal(inputStartDate.name)}; linkCal1.onmouseout = function(){MM_swapImgRestore()}; linkCal1.onmouseover = function(){MM_swapImage(imgCal1.name,'','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1);}; linkCal1.appendChild(imgCal1); cell2.appendChild(inputStartDate); cell2.appendChild(span2); cell2.appendChild(linkCal1) var cell3 = document.createElement("TD"); cell3.className = "row-data"; var span3 = document.createElement("SPAN"); span3.innerHTML = " "; var inputEndDate = document.createElement("INPUT"); inputEndDate.name = "__end_date$"+line; inputEndDate.id = inputEndDate.name; inputEndDate.className = "txt01"; inputEndDate.type = "text"; inputEndDate.size = 10; inputEndDate.maxlength = 10; inputEndDate.onblur = function(){chkInputDate2(inputStartDate, this);chkDayOver(this);chkTotal();}; inputEndDate.onkeyup = function(){formatDate(this)}; inputEndDate.onkeypress = function(){chkIntegerOfDate(this.value)}; var linkCal2 = document.createElement("A"); linkCal2.href = "javascript:;"; var imgCal2 = document.createElement("IMG"); imgCal2.src = "../IMAGES/BUTTON/MAIN/CALENDAR20.gif"; imgCal2.alt = "Calendar"; imgCal2.name = "enddate"+line; imgCal2.id = "enddate"+line; imgCal2.border = 0; imgCal2.align = "absmiddle"; imgCal2.onclick = function(){viewCal(inputEndDate.name)}; linkCal2.onmouseover = function(){ MM_swapImage(imgCal2.name,'','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1);}; linkCal2.onmouseout = function(){MM_swapImgRestore()}; linkCal2.appendChild(imgCal2); cell3.appendChild(inputEndDate); cell3.appendChild(span3); cell3.appendChild(linkCal2); var cell4 = document.createElement("TD"); cell4.className = "row-data"; var inputTotalTime = document.createElement("INPUT"); inputTotalTime.name = "__apply_count$"+line; inputTotalTime.id = inputTotalTime.name; inputTotalTime.className = "txt01"; inputTotalTime.type = "text"; inputTotalTime.size = 10; inputTotalTime.onkeypress = function(){chkInteger(event)}; cell4.appendChild(inputTotalTime); // appendChild To Row tr.appendChild(cell1); tr.appendChild(cell2); tr.appendChild(cell3); tr.appendChild(cell4); tbody.appendChild(tr); } function delRowInTable() { var con = confirm(MyCode[4]); if (con) { with (document.cscform) { for(i=0; i<elements.length; i++){ if ((elements[i].type=="checkbox") && (elements[i].checked==true) && (elements[i].name!="chkall")) { deleteRow(elements[i]); } } } } } function deleteAll(){ var list = document.getElementById("__wf__list_record"); var tbody = document.getElementById("rsTable").tBodies[0]; var sub = list.value.split(","); for(i=1; i<=sub.length; i++){ var del = document.getElementById("del$"+sub[i]); if (tbody.rows.length > 1) tbody.deleteRow(1); } dwr.util.setValue("__wf__list_record", ""); dwr.util.setValue("__wf__last_record", 0); } function deleteRow(btn) { var cell, row, sect; if ((cell = btn.parentNode) && (row = cell.parentNode)&& (sect = row.parentNode) && sect.removeChild) { row.parentNode.removeChild(cell.parentNode); var list_record = document.getElementById("__wf__list_record"); var line = btn.name.substring(btn.name.lastIndexOf("$")+1, btn.name.length); var split_list = list_record.value.split(","); for (i = 1; i<split_list.length; i++) { if (split_list[i] == line) list_record.value = list_record.value.replace(","+line,""); } } } //--> </script> </head> <body> <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div> <script language="javascript">initToolTips();</script> <form name="cscform" method="post" action="RC001.jsp"> <!----------BEGIN CSC INITIAL ZONE ------------------------> <%=screen.InitialVariable()%> <!----------END CSC INITIAL ZONE --------------------------> <input type="hidden" name="__cmd" value=""> <input type="hidden" name="__sysisedit" value=""> <input type="hidden" name="__cmdchild"> <input type="hidden" name="__ack" value="<%=request.getParameter("__ack")%>"> <input type="hidden" name="__referPage" value=""> <input type="hidden" name="__fixCon" value=""> <input type="hidden" name="__help" value=""> <input type="hidden" name="__notNull" value="<%=screen.getRequire()%>"> <input type="hidden" name="__screen" value="BUDGET_APPLPLY1"> <input type="hidden" name="__companyid" value='<%=screen.getUProfile().get("companyid")%>'> <input type="hidden" name="__budg_year" id="__budg_year" value="<%=request.getParameter("__budg_year")%>"> <input type="hidden" name="__language" value='<%=screen.getUProfile().get("lang")%>'> <input type="hidden" name="__lastrec" value="<%=request.getParameter("__lastrec")%>"> <input type="hidden" name="__maxrec" value="<%=screen.getTable("BUDGET_APPLPLY1").recCount()%>"> <input type="hidden" name="__gorec" value="<%=request.getParameter("__gorec")%>"> <input type="hidden" name="__headMulti" value="<%=request.getParameter("__headMulti")%>"> <input type="hidden" name="__language" value='<%=screen.getUProfile().get("lang")%>'> <input type="hidden" name="__calendar"> <input type="hidden" name="__headMulti" value="<%=request.getParameter("__headMulti")%>"> <input type="hidden" name="__Rec_No" value="<%=request.getParameter("__Rec_No")%>"> <script language="javascript">getInputFormatDate();</script> <% int lineno=0; if (!request.getParameter("__line_no").trim().equals("")) { lineno = Integer.parseInt(request.getParameter("__line_no")); } if (request.getParameter("__ack").trim().equals("edit")) { lineno = Integer.parseInt(request.getParameter("__gorec")); }else if(request.getParameter("__ack").equals("add")){ lineno++; } %> <input type="hidden" name="__line_no" value="<%=lineno%>"> <% if(request.getParameter("__ack").equals("add")) { screen.getRecord().clearChild(); } %> <div align="center"> <table cellspacing="0"> <tr> <td class="header" colspan="2">RC001,<script language="JavaScript">swapLang('Applply detail');</script> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0"> <tr> <td colspan="2" class="blankspace"></td> </tr> <tr> <td class="columnlabel"><%=screen.getLabel("APP_CHANELID")%> </td> <td class="columnobject1"> <%=screen.getInput("APP_CHANELID")%> <input type="text" name="APPLPLY_CHANEL@TDESC" id="APPLPLY_CHANEL@TDESC" value="<%=screen.getDataLabel("APPLPLY_CHANEL","TDESC")%>" size="30" disabled> </td> </tr> <tr> <td class="columnlabel"><%=screen.getLabel("PAYMENT")%> </td> <td class="columnobject1"> <%=screen.getInput("PAYMENT")%> <script language="JavaScript">swapLang('Bath');</script> </td> </tr> <tr> <td colspan="2" class="blankspace"></td> </tr> </table> <br> <table width="600" border="0" cellpadding="0" cellspacing="1" bgcolor="#333333" id="rsTable" name="rsTable" cols=9 class="inframe" > <tr> <td class="row3" align="center" width="10%"><input type="checkbox" name="chkall"></td> <td class="row3" align="center" width="30%"><script language="JavaScript">swapLang('Start Date');</script></td> <td class="row3" align="center" width="30%"><script language="JavaScript">swapLang('End Date');</script></td> <td class="row3" align="center" width="30%"><script language="JavaScript">swapLang('Apply Count');</script></td> </tr> <% int linecount=0; int line=1; String last=""; try { DbInquiry inq = new InitialInquiry(screen.getUProfile()).getDbInquiry("BUDGET_APPLPLY2"); inq.setColumn("*"); inq.setFilter("BUDG_YEAR = '"+budg_year+"' and APP_CHANELID = '"+APP_CHANELID+"' "); inq.refresh(); if (inq.recCount() > 0) { while(inq.next()){ %> <tr> <td align="center"><input type="checkbox" name="checkbox$<%=line%>"></td> <td align="center"> <input type="text" name="__start_date$<%=line%>" id="__start_date$<%=line%>" size="10" maxlength="10" value="<%=new CscCalendar(inq.getString("start_date")).getDDMMYYYY()%>" onkeypress="chkIntegerOfDate(this.value,event);" onkeyup="sysIsEdit();formatDate(this);" onblur="chkInputDate2(this,__end_date);" onfocus="this.select();" alt="วันที่เริ่มต้น" onmousemver="toolTip('วันที่เริ่มต้น')" onmouseout="toolTip()"> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image01','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)" onClick="viewCal('__start_date$<%=line%>');"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Calendar" name="Image01" width="20" height="20" border="0" align="absmiddle"></a> </td> <td align="center"> <input type="text" name="__end_date$<%=line%>" id="__end_date$<%=line%>" size="10" maxlength="10" value="<%=new CscCalendar(inq.getString("end_date")).getDDMMYYYY()%>" onkeypress="chkIntegerOfDate(this.value,event);" onkeyup="sysIsEdit();formatDate(this);" onblur="chkInputDate2(__start_date,this);" onfocus="this.select();" alt="วันที่สิ้นสุด" onmousemver="toolTip('วันที่สิ้นสุด')" onmouseout="toolTip()"> <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image02','','../IMAGES/BUTTON/SWAP/CALENDAR_SWAP20.gif',1)" onClick="viewCal('__end_date$<%=line%>');"><img src="../IMAGES/BUTTON/MAIN/CALENDAR20.gif" alt="Calendar" name="Image02" width="20" height="20" border="0" align="absmiddle"></a> </td> <td align="center"> <input type="text" name="__apply_count$<%=line%>" id="__apply_count$<%=line%>" size="10" maxlength="10" value="<%=inq.getString("apply_count")%>" onkeypress="chkInteger(event);" onkeyup="sysIsEdit();" onfocus="this.select();" alt="จำนวนการประกาศ" onmousemver="toolTip('จำนวนการประกาศ')" onmouseout="toolTip()"> </td> </tr> <% last+=","+line; line++; linecount++; } } } catch (Exception e) { MyLog.error(screen, e); } %> </table> </td> </tr> <tr> <td><div align="center"> <a href="javascript:checkAll()"><img src="../IMAGES/BUTTON/SELECTALL.gif" alt="Select All" border="0" align="absmiddle"></a> <a href="javascript:decheckAll()"><img src="../IMAGES/BUTTON/DESELECTALL.gif" alt="Un Select All" border="0" align="absmiddle"></a> <a href="javascript:addRowToTable(<%=linecount %>);"><img src="../IMAGES/BUTTON/ADD.gif" alt="Insert" border="0" align="absmiddle"></a> <a href="javascript:delRowInTable();"><img src="../IMAGES/BUTTON/DELETE.gif" alt="Delete" border="0" align="absmiddle"></a> <a href="javascript:saveChild('save')"><img src="../IMAGES/BUTTON/SUBMIT.gif" alt="Select All" border="0" align="absmiddle"></a></div></td> </tr> <tr> <td colspan="2" class="blankspace"></td> </tr> <tr> <td class="bottom"></td> </tr> </table> <input type="hidden" name="__wf__last_record" id = "__wf__last_record" value="<%=chk.chkNullString(request.getParameter("__wf__last_record"),String.valueOf(linecount))%>"> <input type="hidden" name="__wf__list_record" id = "__wf__list_record" value="<%=chk.chkNullString(request.getParameter("__wf__list_record"),last)%>"> </div> <% if((request.getParameter("__cmdchild")!=null)&&(!request.getParameter("__cmdchild").equals(""))){%> <script language="javascript">back();</script> <%}%> </form> <!--Start ERROR AND WARNING --> <% screen.referLangOff(); %> </body> </html>