<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <title>Hellomyweb.com</title> <link href="css/style.css" rel="stylesheet" type="text/css"> <?php require_once('Connection/conn.php'); ?> <style type="text/css"> <!-- #head { background-image: url(images/head.jpg); background-repeat: no-repeat; clear: both; height: 150px; width: 796px; border: 2px solid #FFFFFF; } --> </style> </head> <body> <link rel="stylesheet" type="text/css" href="tcal.css" /> <script type="text/javascript" src="tcal.js"></script> <SCRIPT Language="JavaScript"> function startCalc(){ interval = setInterval("calc()",1); } function calc(){ EmpDay = document.frmEmpInput.txtEmpDay.value; EmpNight = document.frmEmpInput.txtEmpNight.value; EmpNormalDay = document.frmEmpInput.EmpNormalDay.value; EmpNormalNight = document.frmEmpInput.EmpNormalNight.value; EmpPregDay= document.frmEmpInput.EmpPregDay.value; EmpPregNight= document.frmEmpInput.EmpPregNight.value; EmpActDay= document.frmEmpInput.EmpActDay.value; EmpActNight= document.frmEmpInput.EmpActNight.value; iEmpHolDay= document.frmEmpInput.EmpHolDay.value; iEmpHolNight= document.frmEmpInput.EmpHolNight.value; EmpSickDay= document.frmEmpInput.EmpSickDay.value; EmpSickNight= document.frmEmpInput.EmpSickNight.value; EmpSplDay= document.frmEmpInput.EmpSplDay.value; EmpSplNight= document.frmEmpInput.EmpSplNight.value; EmpAbsDay= document.frmEmpInput.EmpAbsDay.value; EmpAbsNight= document.frmEmpInput.EmpAbsNight.value; EmpMtlDay= document.frmEmpInput.EmpMtlDay.value; EmpMtlNight= document.frmEmpInput.EmpMtlNight.value; document.frmEmpInput.txtEmpAll.value = (EmpDay*1)+(EmpNight*1) ; document.frmEmpInput.EmpNormalAll.value = (EmpNormalDay*1)+(EmpNormalNight*1) ; document.frmEmpInput.EmpPregAll.value = (EmpPregDay*1)+(EmpPregNight*1) ; document.frmEmpInput.EmpHolAll.value = (iEmpHolDay*1)+(iEmpHolNight*1) ; document.frmEmpInput.EmpSickAll.value = (EmpSickDay*1)+(EmpSickNight*1) ; document.frmEmpInput.EmpSplAll.value = (EmpSplDay*1)+(EmpSplNight*1) ; document.frmEmpInput.EmpAbsAll.value = (EmpAbsDay*1)+(EmpAbsNight*1) ; document.frmEmpInput.EmpMtlAll.value = (EmpMtlDay*1)+(EmpMtlNight*1) ; document.frmEmpInput.EmpActDay.value = (EmpDay*1)-(iEmpHolDay*1)-(EmpSickDay*1)-(EmpAbsDay*1) -(EmpMtlDay*1); document.frmEmpInput.EmpActNight.value = (EmpNight*1)-(iEmpHolNight*1)-(EmpSickNight*1)-(EmpAbsNight*1) -(EmpMtlNight*1) ; document.frmEmpInput.EmpAct.value =(EmpDay*1)+(EmpNight*1)-(iEmpHolDay*1)-(iEmpHolNight*1) -(EmpSickDay*1)-(EmpSickNight*1)-(EmpAbsDay*1)-(EmpAbsNight*1)-(EmpMtlDay*1)-(EmpMtlNight*1) ; EmpActualDay=document.frmEmpInput.EmpActDay.value EmpActualNight=document.frmEmpInput.EmpActNight.value EmpActualAll=document.frmEmpInput.EmpAct.value //Cal percent emp document.frmEmpInput.EmpPerDay.value= (EmpActualDay*1)/((EmpDay*1)+(EmpNight*1)); document.frmEmpInput.EmpPerNight.value= (EmpActualNight*1)/((EmpDay*1)+(EmpNight*1)); document.frmEmpInput.EmpPer.value= (EmpActualAll*1)/((EmpDay*1)+(EmpNight*1)); } </SCRIPT> <div align="center"> <div id="containner"> <div id="main"> <div id="right" align="center"> <!-- end content--> <!-- end content--> <!-- end content--> <div id="content" class="blue"> <h1>บันทึกอัตราการมาทำงาน</h1> <div id="story"> <form action="" method="post" name="frmEmpInput" id="frmEmpInput" > <script language="JavaScript"> document.onkeydown = chkEvent function chkEvent(e) { var keycode; if (window.event) keycode = window.event.keyCode; //*** for IE ***// else if (e) keycode = e.which; //*** for Firefox ***// if(keycode==13) { return false; } } function setNextFocus(objId){ if (event.keyCode == 13){ var obj=document.getElementById(objId); if (obj){ obj.focus(); } } } $(function(){ $("#dateInput").datepicker({ dateFormat: 'dd/M/yy' }); }); function showResult(result) { if(result==1) { document.getElementById("divResult").innerHTML = "<font color=green> Save successfully! </font> <br>"; } elseif (result==2) { document.getElementById("divResult").innerHTML = "<font color=red> Error!! Cannot save data </font> <br>"; } else { document.getElementById("divResult").innerHTML = "<font color=red> Error!! Cannot save data Tray again</font> <br>"; } } </script> <?php echo $result; ?> <table width="517" border="1"> <tr> <td width="101">USER</td> <td colspan="3"><input name="txtusername" type="text" id="txtusername" value="XXX"></td> </tr> <tr> <td>SECTION</td> <td width="176"><input name="txtsection" type="text" id="txtsection" value="XXX"></td> <td width="79">FACTORY</td> <td width="127"><input name="txtfactory" type="text" id="txtfactory" value="XX"></td> </tr> <tr> <td>TYPE</td> <td colspan="3"><input name="txtclass" type="text" id="txtclass" value="NORMAL"></td> </tr> </table> <table width="455" border="1" cellspacing="0" bordercolor="#000000"> <caption> <br> <input name="txtdate" type="text" class="tcal" id="txtdate" value="<?=date('Y-m-d')?>"> <input name="btSearch" type="submit" id="btSearch" value="Search" > <br> </caption> <tr> <td width="91"> </td> <td width="105">DAY SHIFT </td> <td width="6"> </td> <td width="105">NIGHT SHIFT</td> <td width="6"> </td> <td width="105">TOTAL</td> <td width="7"> </td> </tr> <?php if($_POST["btSearch"]=="Search"){ //############################## Check data in mas_empworkresult ################################### mysql_select_db($dbname,$IT) or die ("เชื่อมต่อฐานข้อมูลไม่ได้"); $SectionCD='PC PO'; $workdate = $_POST['date']; $strSQL = "SELECT "; $strSQL .= "sum(case when `EmpShift`='DAY' then `EmpFlg` else 0 end) as empday, "; $strSQL .= "sum(case when `EmpShift`='NIGHT' then `EmpFlg` else 0 end) as empnight "; $strSQL .= "FROM mas_emp "; $strSQL .= "WHERE EmpFlg=1 " ; $strSQL .= "and SectionCode='PC PO' "; $strSQL .= "and FactoryCD = 'F1' "; $result = mysql_query($strSQL, $IT) or die(mysql_error()); $irow = mysql_fetch_array($result); } ?> <tr> <td>พนักงาน</td> <td><input name="txtEmpDay" type="text" id="txtEmpDay" size="5" value="<?php echo $irow["empday"];?>" onKeyUp="if(this.value*1!=this.value) this.value='' ;" onFocus="startCalc();" onBlur="stopCalc();"></td> <td> </td> <td><input name="txtEmpNight" type="text" id="txtEmpNight" size="5" value="<?php echo $irow["empnight"];?>" onKeyUp="if(this.value*1!=this.value) this.value='' ;" onFocus="startCalc();" onBlur="stopCalc();"></td> <td> </td> <td><input name="txtEmpAll" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> </tr> <tr> <td>ปกติ</td> <td><input name="EmpNormalDay" type="text" id="inputtxtbox" value="0" size="5" onKeyUp="if(this.value*1!=this.value) this.value='' ;" onFocus="startCalc();" onBlur="stopCalc();" onKeyDown="setNextFocus('EmpNormalNight');" readonly=""></td> <td> </td> <td><input name="EmpNormalNight" type="text" id="inputtxtbox" value="0" size="5" onKeyUp="if(this.value*1!=this.value) this.value='' ;" onFocus="startCalc();" onBlur="stopCalc();" onKeyDown="setNextFocus('EmpPregDay');" readonly=""></td> <td> </td> <td><input name="EmpNormalAll" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> </tr> <tr> <td>ทำงานจริง</td> <td><input name="EmpActDay" type="text" id="inputtxtbox" onFocus="startCalc();" onBlur="stopCalc();" onKeyUp="if(this.value*1!=this.value) this.value='' ;" value="0" size="5"></td> <td> </td> <td><input name="EmpActNight" type="text" id="inputtxtbox" onFocus="startCalc();" onBlur="stopCalc();" onKeyUp="if(this.value*1!=this.value) this.value='' ;" value="0" size="5"></td> <td> </td> <td><input name="EmpAct" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> </tr> <tr> <td>ลากิจ</td> <td><input name="EmpSplDay" type="text" id="EmpSplDay" onFocus="startCalc();" onBlur="stopCalc();" onKeyUp="if(this.value*1!=this.value) this.value='' ;" value="0" size="5" onKeyDown="setNextFocus('EmpSplNight');"></td> <td> </td> <td><input name="EmpSplNight" type="text" id="EmpSplNight" onFocus="startCalc();" onBlur="stopCalc();" onKeyUp="if(this.value*1!=this.value) this.value='' ;" value="0" size="5" onKeyDown="setNextFocus('EmpAbsDay');"></td> <td> </td> <td><input name="EmpSplAll" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> </tr> <tr> <td>ขาดงาน</td> <td><input name="EmpAbsDay" type="text" id="EmpAbsDay" onFocus="startCalc();" onBlur="stopCalc();" onKeyUp="if(this.value*1!=this.value) this.value='' ;" value="0" size="5" onKeyDown="setNextFocus('EmpAbsNight');"></td> <td> </td> <td><input name="EmpAbsNight" type="text" id="EmpAbsNight" onFocus="startCalc();" onBlur="stopCalc();" onKeyUp="if(this.value*1!=this.value) this.value='' ;" value="0" size="5" onKeyDown="setNextFocus('EmpMtlDay');"></td> <td> </td> <td><input name="EmpAbsAll" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> </tr> <tr> <td>%ทำงาน</td> <td><input name="EmpPerDay" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> <td><input name="EmpPerNight" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> <td><input name="EmpPer" type="text" id="inputtxtbox" size="5" readonly="" ></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="5"><div align="center"> </div></td> <td> </td> </tr> </table> <p> </p> </form> </div> <form action="InputEmpDailySave.php" method="post" name="frmEmpAccept" id="frmEmpAccept" target="iframe_target"> <iframe id="iframe_target" name="iframe_target" src="#" style="width:200;height:50;border:0px solid #fff;"></iframe> <div id="divResult"></div> <input type="submit" name="Submit" value="Submit"> <input type="submit" name="Submit" value="Clear"> </form> <p id="auther"> </p> <p> </p> <p> </p> </div> <!-- end content--> </div> <!-- end right--> </div> <!-- end main--> </div> <!-- end containner --> </div> <? //} mysql_close(); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง