PSWQUEUE.jsp 13.5 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*,java.io.*,java.text.*,org.apache.commons.lang.StringUtils" %>
<%@page import="com.csc.library.util.ManageDocument"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.utilities.*"%>
<%@ page import="com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"  %>
<jsp:useBean id="CSCQUQUE" class="com.csc.library.system.Task" scope="page" />
<jsp:useBean id="CSCQUQUE01" class="com.csc.library.system.Task" scope="page" /><%
	CSCQUQUE.setChannel(request, response);
	UIManager screenq = (UIManager) CSCQUQUE.process("SingleEntry","CSC_QUQUE");

	CSCQUQUE01.setChannel(request, response);
	HelpEntry screen = (HelpEntry) CSCQUQUE01.process("HelpEntry","CSC_QUQUEHELP");
	screen.getInquiry().setFilter("process_status<>'D' and class_name='ExportPISWINProcess'");
    screen.setMaxLine(30);
	screen.process();

	String gopage = StringUtils.defaultIfEmpty( request.getParameter("__goPage"), "+1" );

%>
<html ng-app="myHR">

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >

<link href="/hr/CSS/TISCO.css" rel="stylesheet" type="text/css">
<link href="../CSS/bootstrap.css" rel="stylesheet"  type="text/css">
<link href="../CSS/bootstrap_csc_backend.css" rel="stylesheet"  type="text/css">
<script  language="JavaScript" src="/hr/JS/SCREEN.js"></script>
<!-- <script src="../JS/angular-1.3.15/angular.js" type="text/javascript"></script>
<script src="../JS/ANGULAR/SCREEN_ANGULAR.js" type="text/javascript"></script> -->
<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="../JS/jquery-2.1.3.min.js"></script>
<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
<script language="JavaScript" type="text/JavaScript">


function GoSearch(){
	search();
}

function checkLength(strfiled){
	with(document.cscform){
		if((typeof strfiled.length) != "undefined") {
			return true;
		}else{
			return false;
		}
	}
}


function GoSave() {
	beforeSave();
	with(document.cscform) {
		__ququeid.value="-9999";
	}
	confirmSave();
}
function GoDelete() {}
function GoUpdate() {}

function beforeSave() {
	with(document.cscform) {
		__statuslist.value="";
		if(checkLength(__delprocess)) {
			for(var v=0; v<__delprocess.length;v++) {
				if(__delprocess[v].checked) {
					__statuslist.value+=__delprocess[v].value+",";
				}
			}
		} else {
			if(__delprocess.checked) {
				__statuslist.value+=__delprocess.value+",";
			}
		}
	}
}



function viewProcess(page,key){
	with(document.cscform){
		action=page+".jsp";
		__help.value="__ququeid#"+key+",__companyid#<%=screen.getUProfile().get("companyid")%>";
		__ququeid.value=key;
		__cmd.value="search";
		submit();
	}
}


function goPreview(fName){
	window.open("/hr/FileViewer.jsp?uploadfield=queue.report&filename="+fName);
}
function goDownload(fName) {
	//location.href = "/hr/FileDownload.jsp?uploadfield=queue.report&filename="+fName;
		with(document.cscform){
	    	window.open("PSWP004.jsp?id="+fName,"Child","left=150,top=20,width=700,height=600,toolbar=no,status=yes,scrollbars=yes,resizable=yes");
		}
}

EngCode[250]= " Do you want cancel proceee ? ";
ThaiCode[250]= " ต้องการยกเลิก Process หรือไม่ ?";

function cancelProcess(processid) {
	var bcon=confirm(MyCode[250]);
	with(document.cscform){
		if(bcon){
			__ququeid.value = "-99999";
			__cmd.value = "save";
			__cancelprocess.value = processid;
			__confirm.value = "s";
			submit();
		}
	}
}

function dirtypop(objname) {
	var generator = window.open('','name','height=400,width=500,scrollbars=yes,resizable=yes');
	var str = '<html><head><title>Popup</title></head><body><p>' +eval("document.cscform."+objname+".value") +'</p></body></html>';
	generator.document.write(str);
	generator.document.close();
}

function init() {
	fillTable();
}

function fillTable() {
	DWRUtil.useLoadingMessage("Loading...");
	DWREngine.beginBatch();
	var filter="csc_quque:process_status<>'D' and class_name='ExportPISWINProcess'";
	SearchDWR.searchDBXMLAll(new Array("CSC_QUQUEHELP","csc_quque.ququeid,csc_quque.parentid,csc_quque.user_name,csc_quque.employeeid,csc_quque.process_msg,csc_quque.process_status,csc_quque.process_status|,csc_quque.start_time,csc_quque.end_time,csc_quque.cancle_by,csc_quque.cancle_time,csc_quque.cancle_msg,csc_quque.remark,csc_quque.result_type,csc_quque.longtime,csc_quque.csc_log,csc_quque.companyid",filter,"ququeid","langon"),filltablevalue);
	DWREngine.endBatch({
	  async: false,
	   timeout:1000
	});
	setTimeout("fillTable();", 30000);
}

var filltablevalue = function (data1) {
	var id;
	var rtype="";
	var msg="";
	var tmpmsg="";
	var clog="";
	var gopage="<%=gopage.substring(1)%>";
	var gomax=(parseFloat(gopage)*30);
	if(gomax>data1.length) {
		gomax=data1.length;
	}
	var gomin=(parseFloat(gopage)*30)-30;
	var j=0;
	var rec;
    for(var i=gomin;i<gomax;i++,j++) {
		if(j>=30) {
			 break;
		}
		rec = data1[i];

		 id=rec[0];
			if(rec[13]=="EXPORT_PDF"){
				rtype="PDF";
			}else if(rec[13]=="EXPORT_HTML"){
				rtype="HTML";
			}else if(rec[13]=="EXPORT_XML"){
				rtype="XML";
			}else if(rec[13]=="EXPORT_CSV_COM" || rec[13]=="EXPORT_CSV"){
				rtype="CSV";
			}else if(rec[13]=="EXPORTFILE"||rec[13]=="EXPORT_TXT"){
				rtype="TXT";
			}else if(rec[13]=="EXPORT_XLS"){
				rtype="XLS";
			}else if(rec[13]=="EXPORT_ZIP"){
				rtype="ZIP";
			} else{
			  	rtype="";
			}

			msg=rec[4];
			if(msg.length>0) {
					 if(msg.length>20) {
							msg = msg.substring(0, 20) +"...";
					}else{
							msg = msg.substring(0, msg.length) +"...";
					}
			}


			clog = rec[15];
			if(clog.length>0) {
				clog = "<a href=javascript:goPreview('"+id+"log.txt')><img src='/hr/IMAGES/WARNING.gif'  border='0'></a>";
			}

			tmpmsg = "<a href=javascript:dirtypop('__msg"+id+"')>"+msg+"</a><input  type='hidden' name='__msg"+id+"' value='"+rec[4]+"'>";

			DWRUtil.cloneNode("pattern", { idSuffix:id});
			DWRUtil.setValue("deleteprocess"+id, "<input type='checkbox' name='__delprocess' value="+id+">");
			DWRUtil.setValue("parentid"+id, rec[1]);
			DWRUtil.setValue("process_status"+id, rec[6]);
			DWRUtil.setValue("start_time"+id, rec[7]);
			DWRUtil.setValue("end_time"+id, rec[8]);
			DWRUtil.setValue("process_msg"+id, tmpmsg+clog);
			DWRUtil.setValue("remark"+id, rec[12].replace(/\n/g,'<br>'));
			DWRUtil.setValue("longtime"+id, rec[14]);
			if(rec[5]=="W" || rec[5]=="R"||rec[5]=="T"){
				DWRUtil.setValue("linkpage"+id,"<a href=javascript:cancelProcess(\'"+id+"\')><img src='/hr/IMAGES/BUTTON/MAIN/EXIT20.gif' border='0' alt='Cancel'></a>");
			} else {
				DWRUtil.setValue("linkpage"+id, "<a href=\"javascript:goDownload('"+id+"')\"><img src='/hr/IMAGES/MINI_"+rtype+".gif'  border='0'></a>");
				//DWRUtil.setValue("linkpage"+id, "<a href=\"/hr/FileDownload.jsp?uploadfield=queue.report&filename=-"+id +"." +rtype.toLowerCase() +"\" target=\"downloadframe\"><img src='/hr/IMAGES/MINI_"+rtype+".gif'  border='0'></a>");
			}
			//$("pattern" + id).style.display = "";
        $("#pattern").show();
	}
}

//-->
</script>

<style type="text/css">
#contentTable tbody td {
	padding: 0 3px;
}
#contentTable .center {
	text-align:center;
}
#disabledZone {
	position: absolute;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 15px;
}
#disabledZone #messageZone {
	position:absolute;
    top: 0px;
    right: 0px;

    background: #f00;
	font-weight: bold;
    color: #fff;
    padding: 2px;
	font-size: 11px;
}
</style>
</head>
<body >

<div id="disabledZone"><span id="messageZone"></span></div>
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="javascript">initToolTips();</script>
<form name="cscform" method="post">
  <!----------BEGIN CSC INITIAL ZONE ------------------------>
  <%=screen.InitialVariable()%>
  <!----------END CSC INITIAL ZONE -------------------------->
  <input type="hidden" name="__calendar">
  <input type="hidden" name="__screen" value="PSWQUEUE">
  <input type="hidden" name="__webid">
  <input type="hidden" name="__readposter">
  <script language="javascript">getInputFormatDate();</script>
  <input type="hidden" name="__cmd" value="">
  <input type="hidden" name="__help" value="">
  <input type="hidden" name="__goPage" value="<%=gopage%>">
  <input type="hidden" name="__helpReturn" value="">
  <input type="hidden" name="__helpName" value="">
  <input type="hidden" name="__pageCall" value="">
  <input type="hidden" name="__referPage" value="">
  <input type="hidden" name="__language" value="<%=screen.getUProfile().get("lang")%>">
  <input type="hidden" name="__lockPage" value="">
  <input type="hidden" name="__fixCon" value="">
  <input type="hidden" name="__orderBy" value="<%=request.getParameter("__orderBy")%>">
  <input type="hidden" name="__companyid"  value="<%=screen.getUProfile().get("companyid")%>">
  <input type="hidden" name="__ququeid" value="">
  <input type="hidden" name="__statuslist" value="">
  <input type="hidden" name="__confirm" value="">
  <input type="hidden" name="__cancelprocess" value="">
  <input name="__notNull" type="hidden" value="">
  <div align="center">
    <table cellpadding="0" cellspacing="0" class="inframe">
      <tr >
        <td class="header" >PSWQUEUE, <script language="javascript">swapLang("PISWINQueue");</script>&nbsp;</td>
      </tr>
      <tr >
        <td ><table  border="0" align="center" cellpadding="0" cellspacing="1" class="inframe">
        	<tr>
                  <td>&nbsp;</td>
                  <td align="right"><%=screen.getPageTag()%></td>
                </tr>
            <tr>
              <td colspan="2" width="100%" class="blankspace">
              <div align="center">
                  <table width="638" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#808080" class="inframe tablewithborder" id="contentTable">
                    <thead>
                      <tr class="title1">
                        <td width="3%"  class="title1"><div align="center"><span swlang code="SW000123">Delete</span><!-- <script language="javascript">swapLang('Delete');</script> --></div></td>
                        <td width="6%"  class="title1"><span swlang code="SW012796">Queue ID</span><div align="center"><!-- <script language="javascript">swapLang('Queue ID');</script> --></div></td>
                        <td width="7%"  class="title1"><div align="center"><%=screen.getLabel("process_status")%></div></td>
                        <td width="11%"  class="title1"><div align="center"><%=screen.getLabel("start_time")%></div></td>
                        <td width="10%"  class="title1"><div align="center"><%=screen.getLabel("end_time")%></div></td>
                        <td width="6%"  class="title1"><div align="center"><script language="javascript">swapLang("Total time");</script></div></td>
                        <td width="17%" class="title1"><div align="center"><%=screen.getLabel("process_msg")%></div></td>
                        <td width="36%"  class="title1"><div align="center"><%=screen.getLabel("remark")%></div></td>
                        <td width="4%"  class="title1"><div align="center"><script language="javascript">swapLang("Download");</script></div></td>
                      </tr>
                    </thead>
                    <tbody>
                      <tr id="pattern" style="display:none;">
                        <td class="center" ><span id="deleteprocess"></span></td>
                        <td ><span id="parentid"></span></td>
                        <td ><span id="process_status"></span></td>
                        <td><span id="start_time"></span></td>
                        <td ><span id="end_time"></span></td>
                        <td ><span id="longtime"></span></td>
                        <td><span id="process_msg"></span></td>
                        <td><span id="remark"></span></td>
                        <td class="center"><span id="linkpage"></span></td>
                      </tr>
                    </tbody>
                      <tfoot>
                      <tr>
                        <td colspan="9">
                        	<div style="margin:10px auto; text-align:center;">
                                <span><img src="/hr/IMAGES/MINI_CSV.gif"> CSV file</span>  &nbsp;&nbsp;
                                <span><img src="/hr/IMAGES/BUTTON/MAIN/EXIT20.gif"> Cancel Process</span>  &nbsp;&nbsp;
                                <span><img src="/hr/IMAGES/WARNING.gif" /> Process Message</span>
                            </div>
                        </td>
                        </tr>
                      </tfoot>
                  </table>

          <tr>
            <td  class="buttonline" colspan="7"><div align="center">
              <button type="button" class="btn btn-primary width100" swlang code="SW013163" onClick="checkAll();">Select All</button>&nbsp;
              <button type="button" class="btn btn-primary width100" swlang code="SW013164" onClick="decheckAll();">Deselect All</button>&nbsp;
              <button type="button" class="btn btn-primary width100" swlang code="SW013166" onClick="GoSave;">DELETE</button>

            </div>
            </td>
          </tr>
          </table>
          </td>
      </tr>
      <tr>
        <td  class="bottom" ></td>
       </tr>
    </table>
    <!--iframe id="downloadframe" style="visibility:hidden;display:none;"></iframe-->
  </div>
  <script language="javascript">window.setTimeout("init();", 0);</script>
</form>
</body>
</html>