TRA02525M.jsp 12.7 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
<%@page contentType="text/html; charset=UTF-8"%>
<%@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.*"  %>
<%@page import="java.util.HashMap, java.util.Iterator"  %>
<%
	CheckNull chk = new CheckNull();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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/MISC.js'></script>
<script type='text/javascript' src='../JS/SCREEN.js'></script>
<script type='text/javascript' src='../JS/ICONSMENU.js'></script>
<script language='javascript'>setLang('<%=chk.chkNullString(request.getParameter("__language"))%>');</script>
<script  type='text/javascript'  src="../JS/VIEWCALENDAR.js"></script>
<script language="JavaScript" >
function setMass(){
	setMassAbsence();
	setMassLate();
}
function setMassAbsence(){
	with(document.cscform){
		subject0.value = "Training Absence Alert";
		massage0.value = "เรียน empname\nตามที่ท่านมีรายชื่อเข้าอบรมหลักสูตร "+trn.value+" วันที่ "+tmp_date.value+"\nเวลา "+sttime.value+" - "+entime.value+" สถานที่ "+loc.value+"  \nปรากฎว่าท่านขาดอบรมในวันที่ traindate ขอให้ท่านส่งแบบฟอร์มใบลาขาดอบรมด้วย";
	}
}
function setMassLate(){
	with(document.cscform){
		subject1.value = "Training Late Time Alert";
		massage1.value = "เรียน empname\nตามที่ท่านมีรายชื่อเข้าอบรมหลักสูตร "+trn.value+" วันที่ "+tmp_date.value+"\nเวลา "+sttime.value+" - "+entime.value+" สถานที่ "+loc.value+" \nปรากฎว่าท่านเข้าอบรมสายในวันที่ traindate ขอให้ท่านส่งแบบฟอร์มใบลาเข้าอบรมสายด้วย";
	}
}
// window.open('http://hronline/he/MYNOTE/INBOX.jps','MYNOTE','');
function sendMail(){
	with(document.cscform){
		if(send_type[0].checked){
			mframe.document.cscform.sendall.value="1";
		}
		if(send_type[1].checked){
			mframe.document.cscform.sendall.value="0";
		}
		if(mframe.document.cscform.thisemp.value!=""){
			if(mframe.document.cscform.__mail_from.value==""){
				alert("กรุณากรอกเมล์ผู้ส่ง");
				mframe.document.cscform.__mail_from.focus();
			}else{
				mframe.document.cscform.__cmd.value = "send";
				mframe.document.cscform.submit();
			}
		}else{
			alert("ไม่มีเมลล์ที่จะส่ง");
		}
	}
}
function goBack(){
	close();
}
function setTypeCC(){
	if(document.cscform.type_cc.checked){
		if(mframe.document.cscform.thisemp.value!=""){
			mframe.document.cscform.__mail_cc.value =  document.getElementById("bossmail$"+mframe.document.cscform.thisemp.value).value;
		}
	}else{
		mframe.document.cscform.__mail_cc.value = "";
	}
}

function chkSend(objvalue){
	with(document.cscform){
		if(objvalue == "2"){
			if(mail_tmp.value != "")
				mframe.document.cscform.__mail_to.value = mail_tmp.value;
			if(mail_cctmp.value != "")
				mframe.document.cscform.__mail_cc.value = mail_cctmp.value;
		}else{
			mframe.document.cscform.__mail_to.value = mail_all.value;
			mframe.document.cscform.__mail_cc.value = mail_ccall.value;
		}
		window.mframe.document.cscform["sendall"].value = objvalue;
		setTypeMail();
	}
}

</script>
<STYLE type=text/css>
	FONT.wait {
	FONT-FAMILY: "MS Sans Serif", sans-serif, "Microsoft Sans Serif";
	font-size: 12px;
	color: #E85C00;
	}
	FONT.free {
	FONT-FAMILY: "MS Sans Serif", sans-serif, "Microsoft Sans Serif";
	font-size: 12px;
	color: #339900;
	}
	FONT.stop {
	FONT-FAMILY: "MS Sans Serif", sans-serif, "Microsoft Sans Serif";
	font-size: 12px;
	color: #FF0000;
	}
</STYLE>
</head>
 <body leftmargin="0" topmargin="0"  onLoad="">
 <div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
 <form name="cscform" method="post" action="TRA02525M.jsp">
 


	<input type="hidden"name="__screen"  value="TRA02525M">
	<input type="hidden" name="__fixCon" value="">
	<input type="hidden" name="__help" value="">
	<input type="hidden" name="__keyList" value="">
	<input type="hidden" name="__cmd"  value="">
	<input type="hidden" name="__chkReq"  value="">
	<input type="hidden" name="__calendar">
	<input type="hidden" name="__childFilter">
	<script language="javascript">getInputFormatDate();</script>
	<input type="hidden" name="__language" value ="<%=chk.chkNullString(request.getParameter("__language"))%>">
	<input type="hidden" name="__user" value="<%=chk.chkNullString(request.getParameter("__user"))%>">
    <input type="hidden" name="__companyid" value="<%=chk.chkNullString(request.getParameter("__companyid"))%>">
	<input type="hidden" name="__backpage" value="<%=request.getParameter("__backpage")%>">
	<input type="hidden" name="emp_id" value="<%=chk.chkNullString(request.getParameter("emp_id"))%>">
	<input type="hidden" name="crs" value="<%=new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("crs")))%>">
	<input type="hidden" name="trnid" value="<%=new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("trnid")))%>">
	<input type="hidden" name="trn" value="<%=new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("trn")))%>">
	<input type="hidden" name="sttime" value="<%=chk.chkNullString(request.getParameter("sttime"))%>">
	<input type="hidden" name="entime" value="<%=chk.chkNullString(request.getParameter("entime"))%>">
	<input type="hidden" name="tmp_date" value="<%=new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("tmp_date")))%>">
	<input type="hidden" name="loc" value="<%=new ThaiUtilities().ASCII2Unicode(chk.chkNullString(request.getParameter("loc")))%>">
	<input type="hidden" name="mail_type" value="<%=chk.chkNullString(request.getParameter("mail_type"))%>">
	<input type="hidden" name="mailform" value="HRonline">
	<input type="hidden" name="subject0">
	<input type="hidden" name="massage0">
	<input type="hidden" name="subject1">
	<input type="hidden" name="massage1">
<div align="center">
	<table class = "largest" align="center"  cellpadding="0"  cellspacing="0">
	   <tr> 
			<td class="header">TRA02525M, 
				<script language="javascript">swapLang('Send Mail');</script></td>
			</tr>
			<%
					String tmp_com = chk.chkNullString(request.getParameter("__companyid"));
					String emp_id = chk.chkNullString(request.getParameter("emp_id"));
					emp_id = emp_id.replace("$","#");
					String tmp_emp_id[] = emp_id.split(",");
					emp_id = "";
					String tmp_subemp_id[] = null;
					UProfile user = (UProfile) request.getSession().getAttribute("userprofile");
					DbRecord emp = new InitialRecord(user).getDbRecord("MEMPLOYEE");
								   emp.setColumn("employeeid,emp_prefix,fname,efname,lname,elname,email,bossid,companyid");
					DbRecord boss = new InitialRecord(user).getDbRecord("MEMPLOYEE");
							       boss.setColumn("employeeid,emp_prefix,fname,efname,lname,elname,email,companyid");
			%>
			<tr>
				<td>
					<div align="center"> 
						<table  border="1" cellpadding="0" cellspacing="1" bgcolor="#333333" class="maxsize" colspan="5">
							<tr>
								<td colspan="5" width="55%" align="center" class="row3"><script language="javascript">swapLang("Trainee");</script></td>
								<td colspan="2" width="45%" align="center" class="row3"><script language="javascript">swapLang("Supervisor");</script></td>
							</tr>
							<tr>
								<td width="10%" align="center" class="row3"><script language="javascript">swapLang("Emp ID");</script></td>
								<td width="20%" align="center" class="row3">&nbsp;<script language="javascript">swapLang("Name Surname");</script></td>
								<td width="15%" align="center" class="row3">&nbsp;<script language="javascript">swapLang("Email");</script></td>
								<td width="8%" align="center" class="row3">&nbsp;<script language="javascript">swapLang("Type");</script></td>
								<td width="12%" align="center" class="row3">&nbsp;<script language="javascript">swapLang("Date");</script></td>
								<td width="20%" align="center" class="row3">&nbsp;<script language="javascript">swapLang("Name Surname");</script></td>
								<td width="15%" align="center" class="row3">&nbsp;<script language="javascript">swapLang("Email");</script></td>
							</tr>
							<%
							String mail_all = "";
							String mail_ccall = "";
							HashMap cc = new HashMap();
								for(int i=0;i<tmp_emp_id.length;i++){
									tmp_subemp_id = tmp_emp_id[i].split("#");
									if(tmp_subemp_id!=null&tmp_subemp_id.length==3){
										emp.set("employeeid",tmp_subemp_id[0]);
										emp.set("companyid",tmp_com);
										if(emp.search()==1){
												boss.set("employeeid",emp.getString("bossid"));
											boss.set("companyid",tmp_com);
											boss.search();
											cc.put(boss.getString("email"), boss.getString("email"));
											if(mail_all.length() > 0) 
												mail_all += ",";
											mail_all += emp.getString("email");
											if(mail_cc.length() > 0)
												mail_cc += ",";
							%>
									<tr>
										<td align="center" id="empid$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=emp.getString("employeeid")%>">&nbsp;<%=emp.getString("employeeid")%></td>
										<td align="left" id="empname$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=emp.getString("fname")+" "+emp.getString("lname")%>">&nbsp;<%=emp.getString("fname")%>&nbsp;&nbsp;<%=emp.getString("lname")%></td>
										<td align="left" id="empmail$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=emp.getString("email")%>">&nbsp;<%=emp.getString("email")%></td>
										<td align="center" id="type$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=tmp_subemp_id[2]%>">&nbsp;<%=(tmp_subemp_id[2].equals("1"))?"สาย":"ขาด"%></td>
										<td align="center" id="date$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=tmp_subemp_id[1]%>">&nbsp;<%=tmp_subemp_id[1]%></td>
										<td align="left" id="bossname$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=boss.getString("fname")+" "+boss.getString("lname")%>">&nbsp;<%=boss.getString("fname")%>&nbsp;&nbsp;<%=boss.getString("lname")%></td>
										<td align="left" id="bossmail$<%=emp.getString("employeeid")%>$<%=tmp_subemp_id[1]%>" value="<%=boss.getString("email")%>">&nbsp;<%=boss.getString("email")%></td>
									</tr>
							<%
										}
									}
									if(!emp_id.equals("")){
										emp_id+=",";
									}
									emp_id += tmp_subemp_id[0]+"$"+tmp_subemp_id[1];
								}

								Iterator it = cc.keySet().iterator();
								while(it.hasNext()){
									String key = (String)it.next();
									if(mail_ccall.length() > 0){
										mail_ccall += ",";
									}
									mail_ccall += (String)cc.get(key);
								}
							%>
						</table>
					</div>
					<input type="hidden" name="mail_all" value="<%=mail_all%>">
					<input type="hidden" name="mail_tmp" value="">
					<input type="hidden" name="mail_ccall" value="<%=mail_ccall%>">
					<input type="hidden" name="mail_cctmp" value="">
				</td>
			</tr>
			<tr>
				<td ><div align="center">
						<input type="checkbox" id="type_cc" name="type_cc" onclick="setTypeCC();" checked>cc&nbsp;
						<input type="radio" name="send_type" value="1" onclick="chkSend(this.value);" checked><script language='javascript'>swapLang('Sends All');</script>&nbsp;
						<input type="radio" name="send_type" value="2" onclick="chkSend(this.value);" ><script language='javascript'>swapLang('Send Any');</script>&nbsp;&nbsp; 
						<a href="javascript:sendMail();"><img src="../IMAGES/BUTTON/SEND.gif" alt="mail" border="0" align="absmiddle"></a>&nbsp;&nbsp; 
						<a href="javascript:goBack();"><img src="../IMAGES/BUTTON/BACK.gif" border="0" align="absmiddle"></a>
				</div></td>
			</tr>
			<script language="javascript">setMass();</script>
			<tr>
				<td class="blankspace"></td>
			</tr>
			<tr > 
				<td > 
					<div align="center"> 
						<table  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333" class="maxsize">
							<tr width = "100%">
								<td ><div align="center" class = "maxsize"><iframe id="mframe" frameborder="0" name="mframe" src="TRA02525MS.jsp?emp_id=<%=emp_id%>&mailform=HRonline<%/*=screen.getUProfile().get("email")*/%>&sendall=1" scrolling="NO" width="100%" height="210" ></iframe></div></td>
							</tr>
						</table>
					</div>
				</td>
		</tr>	
		<tr>
			<td class="blankspace"></td>
		</tr>
		<tr>
			<td class="bottom"></td>
		</tr>
	</table>
</div>
</form>

</body>
</html>