|
|
|
ช่วยด้วยคับ ใกล้จะสอบแล้ว ผมเหลือหน้าสุดท้าย เกียวกับการค้นหาจากวันที่ ถึงวันที่ |
|
|
|
|
|
|
|
ช่วยผมหน่อยนะคับ
มันมีปัญหาคับ คือข้อมูลโชว์ก่อนที่จะค้นหา แล้วตรงปฏิทิน มันไปใสๆอะคับ มันไม่เป็นรูป ปฏิทิน อะคับ
ปฏิทินมันควรจะเป็นแบบนี้
นี่โค้ดคับ
Code (PHP)
<?
@session_start();
ob_start();
$userid = $_SESSION["userid"];
if(empty($userid))
{
echo "<script>alert('หน้านี้จำกัดเฉพาะผู้ที่เกี่ยวข้องในระบบเท่านั้น');history.back();</script>";
exit();
}
require_once "include/tdate.php";
require_once "include/connectdb.php";
$sql="select * from useradmin where userid='$userid'";
$db_query=mysql_db_query($db,$sql);
$result=mysql_fetch_array($db_query);
$userid=$result[userid];
$adminname=$result[name];
$departid=$result[departid];
$password=$result[password];
?>
<html>
<head>
<title>ระบบการลาของฝ่ายผลิตในบริษัทภูไพรจำกัด</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<br>
<div align="center"><br>
<table border="0" cellpadding="0" cellspacing="0" width="945">
<tr>
<td><div align="right"><font color="#993333" size="2"><img src="images/icon_man.gif" width="15" height="15">
<font color="#333333">ยินดีต้อนรับคุณ</font></font><font color="#FF0000" size="2">
<? echo "<u>$adminname</u>"; ?> <font color="#333333">เข้าใช้งานในระบบ<br>
<a href="Profiles_head.php">ข้อมูลส่วนตัว</a> | <a href="Logout.php"><font color="#990000">ออกจากระบบ</font></a></font></font>
</div></td>
</tr>
<tr>
<td><img name="bx_r1_c1" src="images/ff.jpg" width="945" height="28" border="0" alt=""></td>
</tr>
<tr>
<td background="images/bx_r2_c1.jpg"><div align="center">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="688" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="184"> </td>
<td width="1"> </td>
<td width="184"><div align="center"><a href="LeaveOk.php"><img src="images/hh2.jpg" width="117" height="71" border="0"></a></div></td>
<td width="184"><div align="center"><a href="Leave_Report.php"><img src="images/cus3.jpg" width="117" height="71" border="0"></a></div></td>
<td width="184"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td><div align="center"><br>
<br>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<link rel="stylesheet" type="text/css" href="http://www.ninenik.com/css/smoothness/jquery-ui-1.7.2.custom.css">
<script type="text/javascript" src="http://www.ninenik.com/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="http://www.ninenik.com/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript">
$(function(){
// แทรกโค้ต jquery
$("#dateInput,#dateInput2").datepicker({
showOn: 'button',
buttonImage: 'images/formcal.gif',
buttonImageOnly:true ,
dateFormat: 'yy-mm-dd'
});
});
</script>
<script type="text/javascript">
<style type="text/css">
.ui-datepicker{
width:150px;
font-family:tahoma;
font-size:11px;
text-align:center;
}
</style> <br />
<br />
<br />
</script>
<form name="frmSearch2" method="get2" action="<?=$_SERVER['SCRIPT_NAME'];?>">
From:<input type="text" name="dateInput" id="dateInput" />
To:<input type="text2" name="dateInput2" id="dateInput2" />
<input type="submit" value="Search"></th>
</form>
<?
if($_GET["dateInput"] != "")
{
// Search By Name or Email
$strSQL = "SELECT * FROM leavemanager WHERE datefrom between '".$_GET['dateInput']."' and '".$_GET['dateInput2']."'order by datefrom asc";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
}?>
<br>
<font color="#FF0000" size="2">** หมายเหตุ ในกรณีที่ <font color="#003366">รออนุมัติ
</font>ท่านสามารถที่จะยกเลิกหากไม่ต้องการทำรายการลาในวันดังกล่าว</font><br>
<table width="93%" border="0" cellspacing="0" cellpadding="0" >
<tr class="jobscss">
<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td bgcolor="#333333"><table width="866" border="0" cellspacing="1" cellpadding="1">
<tr bgcolor="#FFFFCC">
<td><div style="width:41px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>#</strong></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>แผนก/ฝ่าย</strong></font></div></td>
<td><div style="width:100px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>ผู้ทำการลา</strong></font></div></td>
<td><div style="width:84px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>ประเภทการลา</strong></font></div></td>
<td><div style="width:167px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>สาเหตุ</strong></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>จากวันที่</strong></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>ถึงวันที่</strong></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>จำนวนวัน</strong></font></div></td>
<td><div style="width:81px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>วันที่ทำการ</strong></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><strong>การอนุมัติ</strong></font></div></td>
</tr>
</table></td>
</tr>
</table>
<?
$page = $_GET['page'];
$num = 1;
$select_type="select * from leavemanager order by leaveid asc";
$query_select=mysql_query($select_type);
$num_rows=mysql_num_rows($query_select);
if($num_rows<1){
echo "<br><br><center><font color=#666666 face=tahoma size=2><b>ยังไม่มีการเพิ่มข้อมูลค่ะ</b></font></center>";
}else{
$select="select * from leavemanager order by leaveid asc";
$q_ry = mysql_query($select);
$num_rows=mysql_num_rows($q_ry);
$pagesize=5;
$rt=$num_rows%$pagesize;
if($rt!=0)
{
$totalpage=floor($num_rows/$pagesize)+1;
}
else
{
$totalpage=floor($num_rows/$pagesize);
$toppic_id=1;
}
if(empty($page))
{
$page=1;
}
mysql_free_result($q_ry);
$goto=($page-1)*$pagesize;
$sql_select_mem="Select * From leavemanager order by status asc limit $goto,$pagesize";
$fect=mysql_query($sql_select_mem);
if(!$fect)
{
("ติดต่อฐานข้อมูลไม่ได้".mysql_error());
exit;
}
$bgcount=0;
while($rows=mysql_fetch_array($fect))
{
$leaveid =$rows['leaveid'];
$useridx =$rows['userid'];
$leavetypeid =$rows['leavetypeid'];
$datefrom = $rows['datefrom'];
$dateto = $rows['dateto'];
$amountdate = $rows['amountdate'];
$comment = $rows['comment'];
$status = $rows['status'];
$dateregis = $rows['dateregis'];
$bgcount=$bgcount+1;
$bgmod=$bgcount%2;
if($bgmod==0){
$bgcolor="#E1DFD7";
}else{
$bgcolor="#FDFBF4";
}
$sql1="select * from useradmin where userid='$useridx'";
$db_query=mysql_db_query($db,$sql1);
$result1=mysql_fetch_array($db_query);
$sname=$result1[name];
$departid=$result1[departid];
$sql2="select * from leavetype where leavetypeid='$leavetypeid'" ;
$db_query2=mysql_db_query($db,$sql2);
$result2=mysql_fetch_array($db_query2);
$leavetypename=$result2[leavetypename];
$sql3="select * from depart where departid='$departid'";
$db_query3=mysql_db_query($db,$sql3);
$result3=mysql_fetch_array($db_query3);
$departname=$result3[departname];
?>
<table width="100%" border="0" cellspacing="1" cellpadding="1" >
<td bgcolor="#333333"><table width="866" border="0" cellspacing="1" cellpadding="1">
<tr bgcolor="#FFFFFF">
<td><div style="width:41px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$num"; ?></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$departname"; ?></font></div></td>
<td><div style="width:100px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$sname"; ?></font></div></td>
<td><div style="width:84px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$leavetypename"; ?></font></div></td>
<td><div style="width:167px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$comment"; ?></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$datefrom"; ?></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$dateto"; ?></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$amountdate"; ?></font></div></td>
<td><div style="width:81px; word-wrap:break-word;"><div align="center"><font color="#993300" size="2"><? echo "$dateregis"; ?></font></div></td>
<td><div style="width:80px; word-wrap:break-word;"><div align="center">
<?
if($status == "99999")
{
echo "<font size=2 color=#1157B6>อนุมัติแล้ว</font></a>";
}else if($status == "11111")
{
echo "<font size=2 color=#ff0000>ไม่อนุมัติ</font>";
} else if($status == "22222")
{
echo "<font size=2 color=#000000><b>ยกเลิก</b></font>";
} else if($status == "00000")
{
echo "<font size=2 color=#107706><b>รออนุมัติ</b></font>";
}
?>
</div></td>
</tr>
</table></td>
</tr>
</table>
<?
$num = $num+1;
}
}
?>
</td>
</tr>
<tr class="jobscss">
<td height="19"> </td>
</tr>
<tr class="jobscss">
<td><strong><span class="maekhawtom"><font color="#990000" size="2">หน้าที่
:</font></span></strong> <font color="#999999" size="2"><span class="maekhawtom">
<?
for($i=1;$i<$page;$i++)
{
echo"[<a href='$PHP_SELF?page=$i'><font size=2 color='#000000'>$i</font></a>]";
}
echo"[<font size=2 color=#000000><b><font size=2 color='#FF00000'>$page</font></b></font>]";
for($i=$page+1;$i<=$totalpage;$i++)
{
echo"[<a href='$PHP_SELF?page=$i'><font size=2 color='#000000'>$i</font></a>]";
}
?>
</span></font><font color="#FFFFFF" size="2"><span class="maekhawtom">
</span></font></td>
</tr>
<tr>
<td><div align="center"></div></td>
</tr>
</table>
<br>
<br>
</div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><img name="bx_r3_c1" src="images/bx_r3_c1.jpg" width="945" height="9" border="0" alt=""></td>
</tr>
</table>
</div>
<script language="javascript">
function printpr()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}
</script>
<td width="88"><div align="center"> <input name="btnPrint" type="button" id="btnPrint" value="Print" onClick="JavaScript:this.style.display='none';printpr();"></div></td></body>
</html>
Tag : PHP, MySQL, JavaScript
|
|
|
|
|
|
Date :
2012-09-14 20:23:25 |
By :
golfharo |
View :
1063 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ปัญหานี้เกิดจาก CSS ไม่ถกต้องครับ อาจจะหาไม่เจอครับ หรือ path ผิดครับ
|
|
|
|
|
Date :
2012-09-14 20:42:03 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คับแล้วตรงที่ข้อมูลมันแสดงออกมาก่อนที่จะค้นหาแก้ตรงไหนคับ
|
|
|
|
|
Date :
2012-09-14 21:34:01 |
By :
golfharo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้แล้วคับขอบคุณคับ
|
|
|
|
|
Date :
2012-09-14 21:55:02 |
By :
golfharo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|