Viewing file: CarBymont.php (7.87 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
define( '_VALID_ACCESS', 1 );
/** Configuration */
require_once( "./configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once( "./include/Function.php" );
require_once( "./calendar/check.php" );
require_once( "./calendar/cal_func.php" );
require_once( "./link/function.php" );
/** Create Database Object */
$dbObj = new DBConn;
/** Config Table for This Page */
$myTable = "personal_tb";
$Username = $valid_user;
$sql = " SELECT Date_start,Date_finish from formcaroffice ";
$rsCal = mysql_query($sql) or die(" Error").mysql_error();
$row = mysql_fetch_array($rsCal);
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link href="./css/calendar.css" rel="stylesheet" type="text/css" />
<link href="./css/default.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="./js/utilities.js"></script>
<title>ยินดีต้อนรับ - การขอใช้รถยนต์</title>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
</head>
<body topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<?php
include("./templates/incHeader.php");
?>
<table width="1003" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="203" align="left" valign="top" style="padding:10px 0px 0px 5px"><?php include( "templates/incMainMenuLeft.php" );?></td>
<td width="800" align="center" valign="top" style="padding:10px 0px 5px 10px"><fieldset>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="30" background="./images/background/bg-head-topic-w780.gif" class="PADDING-LEFT-10 PATRON11"><strong><a href="index.php">หน้าหลัก</a> » <a href="CarByYear.php">ข้อมูลการขอใช้รถยนต์รายปีงบประมาณ</a> »</strong><strong><span class="NOTE">ปฏิทินการขอใช้รถยนต์ราชการ</span></strong></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><span class="PADDING-TOP-10"><img src="images/icons/arrow-circle-225-left.png" width="16" height="16" border="0" align="absmiddle" /> <a href="javascript:;" onclick="window.history.back();"><strong>‹ ย้อนกลับ</strong></a></span></td>
</tr>
<tr>
<td height="370" align="center" valign="top"><table width="448" height="279" border="0">
<tr>
<th width="28" height="28" scope="col"> </th>
<th width="391" align="center" scope="col"><a href="CarDayList.php" title=" Click to more detail "><strong>วันที่
<?php
// $sday = $rs0['Start_Date'];
$yearthai = explode("-",$sday);
$day = intval($yearthai[2]);
$month = intval($yearthai[1]);
$year = intval($yearthai[0]);
$m = getThaiSubMonth($month);
echo abbreDate(date("d-m-Y"));
?>
</strong></a></th>
<th width="15" scope="col"> </th>
</tr>
<tr>
<td height="28"> </td>
<td><table width="101%" height="31" border="1" cellpadding="0" cellspacing="0">
<tr bgcolor="#004080" class="title">
<td width="13%" height="29" bgcolor="#CCCCCC" class="title" ><div align="left" class="style1"><a href="<?php echo "$PHP_SELF?Y=$cal_prev_year&m=$cal_prev_month&d=$cal_day" ?>"><<</a></div></td>
<td width="73%" bgcolor="#CCCCCC"><div align="center"><font face="Tahoma"><?php echo $_month_name[$cal_month]." ปี พ.ศ ".($cal_year+543);?> </font></div></td>
<td width="14%" align="center" bgcolor="#CCCCCC" class="title"><div align="right"><span class="style1"></span><a href="<?php echo "$PHP_SELF?Y=".$cal_next_year."&m=".$cal_next_month."&d=".$cal_day;?>">>></a><span class="style1"></span></div></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="163"> </td>
<td><table width="101%" height="193" border="1" cellpadding="0" cellspacing="1" class="overview" >
<tr>
<td width="13%" height="20" class="dayname"><div align="center">จ</div></td>
<td width="16%" class="dayname"><div align="center">อ</div></td>
<td width="15%" class="dayname"><div align="center">พ</div></td>
<td width="16%" class="dayname"><div align="center">พฤ</div></td>
<td width="12%" class="dayname"><div align="center">ศ</div></td>
<td width="14%" class="dayname"><div align="center">ส</div></td>
<td width="14%" class="dayname"><div align="center">อา</div></td>
</tr>
<?php
//เอาวันเริ่มและสิ้นสุดมาเก็บใน array เพื่อใช้ในการเปรียบเทียบ
$st=array();$ed=array();
$i=0;
do{
$st[$i]=$row['Date_start'];
$ed[$i]=$row['Date_finish'];
$i++;}
while ($row = mysql_fetch_array($rsCal));
for($i=0;$i<count($st);$i++)
{
$ed[$i]=substr($ed[$i],0,4).substr($ed[$i],5,2).substr($ed[$i],8,2);
$st[$i]=substr($st[$i],0,4).substr($st[$i],5,2).substr($st[$i],8,2);
}
if ( ( $cal_year == $cur_year ) && ( $cal_month == $cur_month ) )
{
$today_day = $cur_day;
} else $today_day = 0;
//จำนวนวันในเดือนที่แล้ว จำนวนวันในเดือนนี้ หาค่าวันที่ 1 ของเดือนแบบสัปดาห์
$days_last_month = num_days( $cal_prev_year, $cal_prev_month );
$days_this_month = num_days( $cal_year, $cal_month );
$first_day_pos = date( "w", mktime( 0,0,0,$cal_month,1,$cal_year) );
//เปลี่ยนค่าที่ได้ถ้าเป็นวันอาทิตย์ให้เท่ากับ 7 แทน Mo=1 to Su=7
if ( $first_day_pos == 0 ) $first_day_pos = 7;
$day_num= $days_last_month - ($first_day_pos-2);
$class="last_month";
$p=array();
for ( $y=1; $y<=6; $y++ )
{
echo "<tr>";
for ( $x=1; $x<=7; $x++ )
{
if ( ($y==1) && ($x==$first_day_pos) )
{
$day_num = 1; $class="";
}
if ( ($y >1) && ($day_num>$days_this_month) )
{
$day_num = 1; $class="next_month";
}
if ( ($class=="") && ($day_num == $today_day) )
{
$id="today";
} else $id="";
if ( $class == "" ){
if($cal_month<=9)
$mm="0".$cal_month;
else $mm=$cal_month;
if($day_num<=9)
$dd="0".$day_num;
else $dd=$day_num;
$times=$cal_year."-".$mm."-".$dd;
}
$cur_day=$cal_year.$mm.$dd;
for($i=0;$i<count($st);$i++){
if(($cur_day>=$st[$i])&&($cur_day<=$ed[$i])){
$p[$day_num]=1;
}
}
if($p[$day_num]==1&&$class==""){
?>
<td class="<? echo $class; ?>" id="<? echo $id; ?>" bgcolor=#E9FFE9><div align="center"> <a href="#" onClick="MM_openBrWindow('Carcalendar.php?now_stamp=<? echo $times; ?>','','scrollbars=yes,width=550,height=550')"><? echo $day_num; ?></a></div></td><?
}else{ echo "<td class='".$class."' id='".$id."' bgcolor=#E9E9E9><div align='center'>".$day_num."</div></td>";
}
$day_num++;
}
echo "</tr>";
}
?>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
</td>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="top"> </td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
<?php include("./templates/incFooter.php"); ?>
</body>
</html>
<?php
/** Free Resource */
$dbObj->freeresult($result);
/** Close the Database */
$dbObj->disconn();
/** Unset Class */
unset($dbObj);
?>
|