Path : /var/www/html/smart_kpp2_bk17 มีค 69/rss/
File Upload :
Current File : /var/www/html/smart_kpp2_bk17 มีค 69/rss/report_meeting_calMonth.php

<?php
require ( "language/lang-thai.php");
//include ("include/popup.js");
require_once "modules/meeting/time_inc.php";	
?>
<script type="text/javascript" src="./css/js/calendarDateInput.js"></script> 
<?php

$user=$_SESSION['login_user_id'];
//กรณีเลือกแสดงเฉพาะห้องประชุม
if(isset($_REQUEST['room_index'])){
$room_index=$_REQUEST['room_index'];
}
else{
$room_index="";
}
?>
<script language='javascript'>
//<!–
function printContentDiv(content){
var printReady = document.getElementById(content);
//var txt= 'nn';
var txt= '';

if (document.getElementsByTagName != null){
var txtheadTags = document.getElementsByTagName('head');
if (txtheadTags.length > 0){
var str=txtheadTags[0].innerHTML;
txt += str; // str.replace(/funChkLoad();/ig, ” “);
}
}
//txt += 'nn';
if (printReady != null){
txt += printReady.innerHTML;
}
//txt +='nn';
var printWin = window.open();
printWin.document.open();
printWin.document.write(txt);
printWin.document.close();
printWin.print();
}
// –>
</script>

<div id="lblPrint">
<?php
//ส่วนหัว
echo "<br />";
if(!(($index==1) or ($index==2) or ($index==5))){
	echo "<table width='100%' border='0' align='center'>";
	echo "<tr align='center'><td><font color='#006666' size='3'><strong>ปฏิทินทะเบียนจองห้องประชุม</strong></font></td></tr>";
	echo "</table>";
}
//ส่วนยืนยันการลบข้อมูล
if($index==2) {
echo "<table width='500' border='0' align='center'>";
echo "<tr><td align='center'><font color='#990000' size='4'>โปรดยืนยันความต้องการลบข้อมูลอีกครั้ง</font><br></td></tr>";
echo "<tr><td align=center>";
		$book_date=explode("-", $_GET['Date']);
		$goto_date = $book_date[1]."-".$book_date[2]."-".$book_date[0];
echo "<INPUT TYPE='button' name='smb' value='ยืนยัน' onclick='location.href=\"?option=meeting&task=main/calMonth&index=3&id=$_GET[id]&Date=$goto_date\"'>
		&nbsp;&nbsp;<INPUT TYPE='button' name='back' value='ยกเลิก' onclick='location.href=\"?option=meeting&task=main/calMonth&Date=$goto_date\"'";
echo "</td></tr></table>";
}

//ส่วนลบข้อมูล
if($index==3){
$sql = "delete from meeting_main where id='$_GET[id]'";
$dbquery = mysqli_query($connect,$sql);
}

//ส่วนบันทึกข้อมูล
if($index==4){
$date_time_now = date("Y-m-d H:i:s");
if(!isset($_POST['allchk'])){
$_POST['allchk']="";
}

	foreach($_POST as $key => $value){
		if($key!=$_POST['allchk']){
		$sql = "update meeting_main set approve='$value', officer='$_SESSION[login_user_id]', officer_date='$date_time_now' where id='$key'";
		$dbquery = mysqli_query($connect,$sql);
		}
	}
}

if ($index==5){
echo "<form id='frm1' name='frm1'>";
echo "<Center>";
echo "<Font color='#006666' Size=3><B>ส่วนของการอนุญาต</Font>";
echo "</Cener>";
echo "<Br><Br>";

$sql_room = "select * from meeting_room where active='1' order by id";
$dbquery_room = mysqli_query($connect,$sql_room);
While ($result_room = mysqli_fetch_array($dbquery_room))
{
$room_ar[$result_room['room_code']]=$result_room['room_name'];
}

$sql="select meeting_main.id, meeting_main.room, meeting_main.type_obj,meeting_main.book_date, meeting_main.start_time, meeting_main.finish_time, meeting_main.objective, meeting_main.person_num,  meeting_main.other, meeting_main.book_person, meeting_main.rec_date, meeting_main.approve, meeting_main.reason, person_main.name ,person_main.surname from meeting_main left join person_main on meeting_main.book_person = person_main.person_id where meeting_main.id='$_GET[id]' ";
$dbquery = mysqli_query($connect,$sql);
$result = mysqli_fetch_array($dbquery);
		$id= $result['id'];
		$room= $result['room'];
		$start_time=$result['start_time'];
		$start_time=number_format($start_time,2);
		$finish_time=$result['finish_time'];
		$finish_time=number_format($finish_time,2);
		//$book_date = $result['book_date'];
		$rec_date = $result['rec_date'];
		$name= $result['name'];
		$surname = $result['surname'];

echo "<Table width='60%'><tr><td>";
echo "<fieldset>";
//echo "<legend>&nbsp;<B>ข้อมูลผู้ขอใช้</B>: &nbsp;</legend>";
echo "<h4>ข้อมูลผู้ขอใช้</h4>";
echo "<table>";
echo "<Tr align='left'><Td align='right'>เลือกประเภทการใช้งาน&nbsp;&nbsp;</Td><Td><Select  name='type_obj'  size='1'>";
	$sql_type_obj = "select * from meeting_type_obj order by id";
	$dbquery_type_obj = mysqli_query($connect,$sql_type_obj);
	if($result['type_obj']==''){
		echo "<option value=''><font color=red>**</font> เลือกประเภทการใช้งานห้องประชุม </option>";
	}
	while($result_type_obj = mysqli_fetch_array($dbquery_type_obj)){
		if($result[type_obj] == $result_type_obj[code]){
			echo "<option value='$result_type_obj[code]' selected>$result_type_obj[name]</option>";
		}else{
			echo "<option value='$result_type_obj[code]'>$result_type_obj[name]</option>";
		}
	}
echo "</select>";
echo "</Td></Tr>";
echo "<Tr align='left'><Td align='right'>ห้องประชุม&nbsp;&nbsp;</Td><Td>";
echo "<Select  name='room'  size='1'>";
$sql_m = "select * from meeting_room where active='1' order by id";
$dbquery_m = mysqli_query($connect,$sql_m);
While ($result_m = mysqli_fetch_array($dbquery_m))
{
	$room_code = $result_m['room_code'];
	$room_name = $result_m['room_name'];
	//if($room_ar[$room]==$room_code){
	if($room==$room_code){
		echo  "<option value = $room_code selected>$room_name</option>";
	}else{
		echo  "<option value = $room_code>$room_name</option>";
	}
}
echo "</select>";
echo "</Td></Tr>";
echo "<Tr align='left'><Td align='right'>วันทีใช้ห้อง&nbsp;&nbsp;</Td>";
echo "<Td align='left'>";
		$book_date=explode("-", $result['book_date']);
		$goto_date = $book_date[1]."-".$book_date[2]."-".$book_date[0];
		?>
		<script>
										var Y_date=<?php echo $book_date[0]?>  
										var m_date=<?php echo $book_date[1]?>  
										var d_date=<?php echo $book_date[2]?>  
										Y_date= Y_date+'/'+m_date+'/'+d_date
										DateInput('book_date', true, 'YYYY-MM-DD', Y_date)</script> 
		<?php
echo "</Td></Tr>";
//echo "<Tr align='left'><Td align='right'>วันทีใช้หห้อง&nbsp;&nbsp;</Td>";
//echo "<Td align='left'>";
//echo thai_date_3($book_date);
//echo "</Td></Tr>";

echo "<Tr align='left'><Td align='right'>ตั้งแต่เวลา&nbsp;&nbsp;</Td><Td><Select  name='start_time'  size='1'>";
$i=0;
for ($i=='0'; $i<='24'; $i++){
	if ($result['start_time']==$i) {
		echo "<option value = $i selected>".$i.".00 น.</option>";
	}else{
		echo "<option value = $i>".$i.".00 น.</option>";
	}
}
echo "</select>";
echo "</td></tr>";
//echo "<Tr align='left'><Td align='right'>ตั้งแต่เวลา&nbsp;&nbsp;</Td>";
//echo "<Td align='left'>$start_time น.</Td></Tr>";

echo "<Tr align='left'><Td align='right'>ถึงเวลา&nbsp;&nbsp;</Td><Td><Select  name='finish_time'  size='1'>";
$i=0;
for ($i=='0'; $i<='24'; $i++){
	if ($result['finish_time']==$i) {
		echo "<option value = $i selected>".$i.".00 น.</option>";
	}else{
		echo "<option value = $i>".$i.".00 น.</option>";
	}
}
echo "</select>";
echo "</td></tr>";
//echo "<Tr align='left'><Td align='right'>ถึงเวลา&nbsp;&nbsp;</Td>";
//echo "<Td align='left'>$finish_time น.</Td></Tr>";

//echo "<Tr align='left'><Td align='right'>วัตถุประสงค์&nbsp;&nbsp;</Td><Td>$result[objective]</Td></Tr>";
//echo "<Tr align='left'><Td align='right'>จำนวนผู้เข้าประชุม&nbsp;&nbsp;</Td><Td>$result[person_num]&nbsp;คน</Td></Tr>";
//echo "<Tr align='left'><Td align='right'>อื่น ๆ&nbsp;&nbsp;</Td><Td>$result[other]</Td></Tr>";
echo "<Tr align='left'><Td align='right'>วัตถุประสงค์&nbsp;&nbsp;</Td><Td><Input Type='Text' Name='objective' Size='60' value='$result[objective]'></Td></Tr>";
echo "<Tr align='left'><Td align='right'>จำนวนผู้เข้าประชุม&nbsp;&nbsp;</Td><Td><Input Type='Text' Name='person_num' Size='4' value='$result[person_num]'>&nbsp;คน</Td></Tr>";
//echo "<Tr align='left'><Td align='right'>อื่นๆ (ถ้ามี)&nbsp;&nbsp;</Td><Td><Input Type='Text' Name='other' Size='100'></Td></Tr>";
echo "<Tr align='left'><Td align='right' valign='top'>อื่นๆ (ถ้ามี)&nbsp;&nbsp;</Td><Td><textarea Name='other' cols=60 rows=2>$result[other]</textarea><br>*** ระบุสื่ออุปกรณ์ที่ต้องการใช้ เช่น โปรเจคเตอร์, ไมค์-สาย, ไมค์-ลอย, เครื่องฉายภาพ, คอมพิวเตอร์โน๊ตบุ๊ค ฯลฯ<br>หรือ มีการแสดงดนตรี-ร้องเพลง (ถ้ามี)</Td></Tr>";

echo "<Tr align='left'><Td align='right'>ผู้จองฺ&nbsp;&nbsp;</Td><Td>$name&nbsp;&nbsp;$surname</Td></Tr>";

echo "<Tr align='left'><Td align='right'>วันเวลาจอง&nbsp;&nbsp;</Td><Td>";
echo thai_date_5($rec_date);
echo "</td></tr>";
echo "</table></fieldset>";

echo "<fieldset>";
//echo "<legend>&nbsp;<B>ส่วนเจ้าหน้าที่</B>: &nbsp;</legend>";
echo "<h4>ส่วนเจ้าหน้าที่</h4>";
echo "<table>";
$approve_check1="";  $approve_check2="";	
		if($result['approve']==1){
		$approve_check1="checked";
		}
		else if($result['approve']==2){
		$approve_check2="checked";
		}
echo "<Tr align='left'><Td align='right'>อนุญาต/ไม่อนุญาตการใช้ห้องประชุม&nbsp;&nbsp;</Td><Td><Input Type='radio' Name='approve' value='1' $approve_check1>อนุญาต&nbsp;&nbsp;<Input Type='radio' Name='approve' value='2' $approve_check2>ไม่อนุญาต&nbsp;&nbsp;</Td></Tr>";
echo "<Tr align='left'><Td align='right'>หมายเหตุ(ถ้ามี)&nbsp;&nbsp;</Td><Td><Input Type='Text' Name='reason' Size='50' value='$result[reason]'></Td></Tr>";

echo "</table></fieldset>";

echo "</td></tr></Table>";
echo "<Input Type=Hidden Name='id' Value='$_GET[id]'>";
echo "<Input Type=Hidden Name='page' Value='$_GET[page]'>";
echo "<Br />";
echo "<Input Type=Hidden Name='id' Value='$_GET[id]'>";
		$book_date=explode("-", $_GET['Date']);
		$goto_date = $book_date[1]."-".$book_date[2]."-".$book_date[0];
echo "<Input Type=Hidden Name='goto_date' Value='$goto_date'>";
echo "<INPUT TYPE='button' name='smb' value='ตกลง' onclick='goto_url_update(1)' class=entrybutton> <INPUT TYPE='button' name='back' value='ย้อนกลับ' onclick='goto_url_update(0)' class=entrybutton'>";
//echo "<INPUT TYPE='button' name='smb' value='ตกลง' onclick='location.href=\"?option=meeting&task=main/calMonth&index=6&id=$_GET[id]&Date=$goto_date\"'>&nbsp;&nbsp;<INPUT TYPE='button' name='back' value='ย้อนกลับ' onclick='location.href=\"?option=meeting&task=main/calMonth&Date=$goto_date\"'>";
echo "</form>";
}

if ($index==6){
//		$sql = "update meeting_main set approve='$_POST[approve]', 
//		reason='$_POST[reason]', 
//		officer='$_SESSION[login_user_id]', 
//		officer_date='$date_time_now'
//		where id='$_POST[id]'"; 
		$sql = "update meeting_main set 
		type_obj='$_POST[type_obj]',
		book_date='$_POST[book_date]',
		room='$_POST[room]',
		start_time='$_POST[start_time]',
		finish_time='$_POST[finish_time]',
		objective='$_POST[objective]',
		approve='$_POST[approve]', 
		reason='$_POST[reason]', 
		person_num='$_POST[person_num]', 
		other='$_POST[other]', 
		officer='$_POST[login_user_id]', 
		officer_date='$date_time_now'
		where id='$_POST[id]'";
		$dbquery = mysqli_query($connect,$sql); 
}

//ส่วนฟอร์ม
if(!(($index==2) or ($index==5))){
echo "<form  name='frm1'>";
echo "<table width=100%><tr><td align='left' width='50%'>";
echo "<INPUT TYPE='button' name='smb' value='จองห้องประชุม' onclick='location.href=\"?option=meeting&task=main/meeting&index=1\"'>";
echo " <INPUT TYPE='button' name='smb' value='มุมมองตาราง' onclick='location.href=\"?option=meeting&task=main/meeting\"'>";
echo " <INPUT TYPE='button' name='smb' value='พิมพ์ตารางการใช้ห้องประชุม' onclick='location.href=\"?option=meeting&task=main/calMonthPrint&room_index=$room_index&Date=$Date\"'>&nbsp;";
echo "</td><td align='right'>";
echo "&nbsp;<Select  name='room_index' size='1'>";
echo  '<option value ="" >เลือกห้องประชุม</option>' ;
	$sql_room = "select * from meeting_room where active='1' order by id";
	$dbquery_room = mysqli_query($connect,$sql_room);
	While ($result_room = mysqli_fetch_array($dbquery_room )){ 
		if ($room_index==$result_room ['room_code']){
			echo "<option value=$result_room[room_code]  selected>$result_room[room_name]</option>"; 
		}else{
			echo "<option value=$result_room[room_code]>$result_room[room_name]</option>"; 
		}
	}
echo "</select>";
echo "&nbsp;<INPUT TYPE='button' name='smb' value='เลือก' onclick='goto_url2(1)'>";
echo "</td></tr></table>";
echo "</form>";


	if (empty($Date)) {
		$Date = Date("m-d-Y");
	}	
	$Date_Array = explode("-", $Date);
	if ($Date_Array[2] < 1970)
		print("ERROR! System can not interpret dates befor 01/01/1970");
        else {
			$Date = mktime(0, 0, 0, $Date_Array[0], $Date_Array[1], $Date_Array[2]);  //0=เดือน 1=วัน 2=ปี

			##########     ส่วนหัว     |-------------------------------------------
			$Prev_Month = mktime(0, 0, 0, $Date_Array[0] - 1, 1, $Date_Array[2]);
			$Prev_Date = Date("m-d-Y",$Prev_Month);
			$Next_Month = mktime(0, 0, 0, $Date_Array[0] + 1, 1, $Date_Array[2]);
			$Next_Date = Date("m-d-Y",$Next_Month);
			$month_priv = $Date_Array[0]-1;
			$month_next = $Date_Array[0]+1;

			if($room_index=='')  {			//ลิงค์หน้าปฏิทินหลัก
				print("\n<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr height=\"20\">");
				##########     Print Title : เดือนก่อนนี้     |-------------------------------------------
				print("<td width=\"20%\" align=\"left\"><a href=\"?option=meeting&room_index=$room_index&Date=$Prev_Date\"><img src=\"images/arr_circle_prev42-42.gif\" border=0 valign=middle>&nbsp; $_month_priv</a></td>");
				print("\n<td width=\"60%\" align=\"center\">");

				##########     Print Title : ประจำเดือน     |-------------------------------------------
				print("<B>");
				print("ประจำเดือน ");
				print(getMonthName($Date));
				print(" พ.ศ. ");
				print($Date_Array[2]+543);
				print(" / ");
				print(getMonthEnName($Date));
				print(" ".$Date_Array[2]."");
				print("</B>");
				print("</TD>");

				##########     Print Title : เดือนถัดไป     |-------------------------------------------
				print("<td width=\"20%\" align=\"right\"><a href=\"?option=meeting&room_index=$room_index&Date=$Next_Date\">$_month_next&nbsp;<img src=\"images/arr_circle_next42-42.gif\" border=0 valign=middle></a></td>");
				print("</TR></TABLE>");
			}else{		//ลิงค์หน้าปฏิทินของห้องประชุม
				print("\n<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"><tr><td><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr height=\"20\">");

				##########     Print Title : เดือนก่อนนี้     |-------------------------------------------
				print("<td width=\"20%\" align=\"left\"><a href=\"?option=meeting&room_index=$room_index&Date=$Prev_Date\"><img src=\"images/arr_circle_prev42-42.gif\" border=0>&nbsp; $_month_priv</a></td>");
				print("\n<td width=\"60%\" align=\"center\">");

				##########     Print Title : ประจำเดือน     |-------------------------------------------
				print("<B>");
				print("ประจำเดือน ");
				print(getMonthName($Date));
				print(" พ.ศ. ");
				print($Date_Array[2]+543);
				print(" / ");
				print(getMonthEnName($Date));
				print(" ".$Date_Array[2]."");
				print("</B>");
				print("</TD>");

				##########     Print Title : เดือนถัดไป     |-------------------------------------------
				print("<td width=\"20%\" align=\"right\"><a href=\"?option=meeting&room_index=$room_index&Date=$Next_Date\">$_month_next&nbsp;<img src=\"images/arr_circle_next42-42.gif\" border=0></a></td>");
				print("</TR></TABLE>");
			}

			/**** Get the Day (Integer) for the first day in the month */
			$First_Day_of_Month_Date = mktime(0, 0, 0, $Date_Array[0], 1, $Date_Array[2]);
			$Day_of_First_Week = Date("w",$First_Day_of_Month_Date);
			/**** Find the last day of the month */
			$Month = Date("m",$Date);
			$day = 27;
			do {
				$End_of_Month_Date = mktime(0, 0, 0, $Date_Array[0], $day, $Date_Array[2]);
				$Test_Month = Date("m",$End_of_Month_Date);
				$day += 1;
			} while ( $Month == $Test_Month );
				$Last_Day = $day - 2;

				/**** Get todays date */
				$Today_d = Date("d");
				$Today_m = Date("m");
				$Today_y = Date("Y");

				##########     กำหนดค่าเดือน     |-------------------------------------------
				if ($Date_Array[0]=='01'){
					$Date_Arrayx[0]='1'; $imgcalendar="<img src=\"images/calendar/1.png\" border=0>";
				}elseif ($Date_Array[0]=='02'){
					$Date_Arrayx[0]='2'; $imgcalendar="<img src=\"images/calendar/2.png\" border=0>";
				}elseif ($Date_Array[0]=='03'){
					$Date_Arrayx[0]='3'; $imgcalendar="<img src=\"images/calendar/3.png\" border=0>";
				}elseif ($Date_Array[0]=='04'){
					$Date_Arrayx[0]='4'; $imgcalendar="<img src=\"images/calendar/4.png\" border=0>";
				}elseif ($Date_Array[0]=='05'){
					$Date_Arrayx[0]='5'; $imgcalendar="<img src=\"images/calendar/5.png\" border=0>";
				}elseif ($Date_Array[0]=='06'){
					$Date_Arrayx[0]='6'; $imgcalendar="<img src=\"images/calendar/6.png\" border=0>";
				}elseif ($Date_Array[0]=='07'){
					$Date_Arrayx[0]='7'; $imgcalendar="<img src=\"images/calendar/7.png\" border=0>";
				}elseif ($Date_Array[0]=='08'){
					$Date_Arrayx[0]='8'; $imgcalendar="<img src=\"images/calendar/8.png\" border=0>";
				}elseif ($Date_Array[0]=='09'){
					$Date_Arrayx[0]='9'; $imgcalendar="<img src=\"images/calendar/9.png\" border=0>";
				}elseif ($Date_Array[0]=='10'){ $imgcalendar="<img src=\"images/calendar/1.png\" border=0><img src=\"images/calendar/0.png\" border=0>";
				}elseif ($Date_Array[0]=='11'){ $imgcalendar="<img src=\"images/calendar/1.png\" border=0><img src=\"images/calendar/1.png\" border=0>";
				}elseif ($Date_Array[0]=='12'){ $imgcalendar="<img src=\"images/calendar/1.png\" border=0><img src=\"images/calendar/2.png\" border=0>";
				}
				##########     ปฏิทิน     |-------------------------------------------
				echo "<CENTER>".$imgcalendar."<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" style=\"background-attachment: fixed; background-image: url(images/calendar/bg.jpg); background-repeat: no-repeat; background-position: right\">";
				echo "<tr> ";
				echo "<td class=\"weekname\"><hr size=1 color=#ff0000><font color=#ff0000>$_suLong</font></td>";
				echo "<td class=\"weekname\"><hr size=1 color=#ffff99><font color=#ffff99>$_moLong</font></td>";
				echo "<td class=\"weekname\"><hr size=1 color=#ffc0cb><font color=#ffc0cb>$_tuLong</font></td>";
				echo "<td class=\"weekname\"><hr size=1 color=#98fb98><font color=#98fb98>$_weLong</font></td>";
				echo "<td class=\"weekname\"><hr size=1 color=#ffa500><font color=#ffa500>$_thLong</font></td>";
				echo "<td class=\"weekname\"><hr size=1 color=#87ceeb><font color=#87ceeb>$_frLong</font></td>";
				echo "<td class=\"weekname\"><hr size=1 color=#800080><font color=#ffaaff>$_saLong</font></td>";
				echo "</tr>";
                $day_of_week = 1;

                /**** Previous Greyed month days */
                While ($day_of_week < ($Day_of_First_Week + 1)) {
						##########	     วันในเดือนก่อนนี้     |-------------------------------------------
                        if ($day_of_week == 1) {
                                print("\n<tr >");
                                }
                        $Tmp_Date = mktime(0, 0, 0, $Date_Array[0], 1 - (($Day_of_First_Week + 1) - $day_of_week), $Date_Array[2]);
                        $Tmp_Day = Date("d",$Tmp_Date);
                        print("<TD align=center valign=top class=\"tbcalendar\">$Tmp_Day</TD>");
                        $day_of_week += 1;
                }
                $usedcount = 0;
                $cellcount = 0;

				##########     วันในปฏิทินเดือนปัจจุบันที่เลือก     |-------------------------------------------
				for ($day = 1 ; $day <= $Last_Day ; $day++) {
						if ($day_of_week == 1) {
								##########	     วันในเดือนนี้     |-------------------------------------------
                                print("\n<tr>");
                                }
						#########	ค้นหาวันหยุดราชการ		|-------------------------------------------
						$db2sql = "select * from ".$prefix."_calholiday where did='$day' AND mid='$Date_Array[0]' AND yid='$Date_Array[2]' ";
						$rsHoliday = mysqli_query($connect2,$db2sql);
						$rowHoliday = mysqli_fetch_array($rsHoliday);
						$num_rowsHoliday = mysqli_num_rows($rsHoliday);

						if	($num_rowsHoliday != 0 ) { 
							$Holiday ="<font color=red><b>หยุดราชการ</b></font> ".$rowHoliday[content]."";
							if (($day == $Today_d) && ($Date_Array[0] == $Today_m) && ($Date_Array[2] == $Today_y))
								##########      วันหยุด - วันที่ปัจจุบันในเดือนนี้     |-------------------------------------------
								print("\n\t<TD valign=top align=top><TABLE width=100% cellpadding=0 cellspacing=0 border=0><TR><TD align=center class=\"dayname\"><img src=\"images/loading.gif\" border=0>$day วันนี้<br>".$Holiday."");
							else
								##########      วันหยุด - วันที่อื่นในเดือนนี้     |-------------------------------------------
								print("\n\t<TD valign=top align=top><TABLE width=100% cellpadding=0 cellspacing=0 border=0><TR><TD align=center class=\"dayname\">$day<br>".$Holiday."");
						}else{ 
							if (($day == $Today_d) && ($Date_Array[0] == $Today_m) && ($Date_Array[2] == $Today_y))
								##########      วันที่ปัจจุบันในเดือนนี้     |-------------------------------------------
								print("\n\t<TD valign=top align=top><TABLE width=100% cellpadding=0 cellspacing=0 border=0><TR><TD align=center class=\"dayname\"><img src=\"images/loading.gif\" border=0>$day วันนี้");
							else
								##########      วันที่อื่นในเดือนนี้     |-------------------------------------------
								print("\n\t<TD valign=top align=center><TABLE width=100% cellpadding=0 cellspacing=0 border=0><TR><TD align=center class=\"dayname\">$day");
							}

			##########		เริ่มต้น -> นำเข้าข้อมูลแสดงในปฏิทินในแต่ละวัน
			##########     ตรวจสอบวันที่ตรงกับวันที่ใช้งาน
			switch ( $day ) {
				case "1" : $day='01' ; break; case "2" : $day='02' ; break; case "3" : $day='03' ; break;
				case "4" : $day='04' ; break;case "5" : $day='05' ; break;case "6" : $day='06' ; break;
				case "7" : $day='07' ; break;case "8" : $day='08' ; break;case "9" : $day='09' ; break;
			}
			$ck_startDate = ($Date_Array[2])."-".$Date_Array[0]."-".$day;
			##########     เลือกฐานข้อมูลทั้งหมด
			##########     แยกแสดงผลการใช้งานเฉพาะห้องประชุมคันใดคันหนึ่ง กับ การใช้งานทั้งหมด
			##########     เลือกฐานข้อมูลแยกจาก ห้องประชุมทั้งหมด $room_index =='' ,เฉพาะห้องประชุม $room_index !='' 
			$sql_room = "select * from meeting_room where active='1' order by id";
			$dbquery_room = mysqli_query($connect,$sql_room);
			While ($result_room = mysqli_fetch_array($dbquery_room))
			{
			$room_ar[$result_room['room_code']]=$result_room['room_name'];
			}
			if($room_index != ''){	 //แสดงการใช้งานเฉพาะห้องประชุมในวันนั้น
				$sqlConfirm = "select meeting_main.id, meeting_main.room, meeting_main.book_date, meeting_main.start_time, meeting_main.finish_time, meeting_main.objective, meeting_main.person_num, meeting_main.other, meeting_main.book_person, meeting_main.rec_date, meeting_main.approve, meeting_main.reason, person_main.name ,person_main.surname from meeting_main left join person_main on meeting_main.book_person = person_main.person_id where meeting_main.room='$room_index' and meeting_main.book_date='$ck_startDate' order by meeting_main.room";
			}else{	//แสดงการใช้งานทั้งหมดในวันนั้น
				$sqlConfirm = "select meeting_main.id, meeting_main.room, meeting_main.book_date, meeting_main.start_time, meeting_main.finish_time, meeting_main.objective, meeting_main.person_num,  meeting_main.other, meeting_main.book_person, meeting_main.rec_date, meeting_main.approve, meeting_main.reason, person_main.name ,person_main.surname from meeting_main left join person_main on meeting_main.book_person = person_main.person_id where meeting_main.book_date='$ck_startDate' order by meeting_main.room";
			}

			$rsConfirm = mysqli_query($connect,$sqlConfirm);
			$num_rowsConfirm = mysqli_num_rows($rsConfirm);
			$conf = 1;
			if($num_rowsConfirm != '0'){	print("</TD></TR></TABLE>"); }else{ print(" (ว่าง)</TD></TR></TABLE>"); }

			print ("<TABLE width=100% cellpadding=2 border=0>");
			while ($row_rsConfirm = mysqli_fetch_array($rsConfirm)) {
				$id= $row_rsConfirm['id'];
				$room= $row_rsConfirm['room'];
				$start_time=$row_rsConfirm['start_time'];
				$start_time=number_format($start_time,2);
				$finish_time=$row_rsConfirm['finish_time'];
				$finish_time=number_format($finish_time,2);
				//$dotx=Strlen($row_rsConfirm['objective']);
				//if($dotx>=150){ $dot="ฯ"; }else{ $dot=""; }
				//$objective=substr($row_rsConfirm['objective'],0,150).$dot;
				$objective=$row_rsConfirm['objective'];
				$book_date = $row_rsConfirm['book_date'];
				$rec_date = $row_rsConfirm['rec_date'];
				$name= $row_rsConfirm['name'];
				$surname = $row_rsConfirm['surname'];
				if(isset($room_ar[$room])){
				$room_name = $room_ar[$room];
				}
				$approve=$row_rsConfirm['approve'];

			//กำหนดสีประจำสัปดาห์
			if ( $day_of_week == 1 ) $color ="#ffaaaa";	//แดง  #ff4040
			if ( $day_of_week == 2 ) $color ="#fff";	//เหลือง  #ffffd5
			if ( $day_of_week == 3 ) $color ="#fff";	//ชมภู  pink
			if ( $day_of_week == 4 ) $color ="#fff";		//เขียว  #d5ffd5
			if ( $day_of_week == 5 ) $color ="#fff";		//แสด  Orange
			if ( $day_of_week == 6 ) $color ="#fff";		//ฟ้า  #d5ffff
			if ( $day_of_week == 7 ) $color ="#ffaaff";		//ม่วง  #bf80ff
			$color2 = '#FFFFB'; 
switch ( $approve ) {
	case '1' :
		$g="<img src=images/yes.png border='0'>";
		$f="meeting_report" ; $index="1"; 
		break;
	case '2' :
		$g="<img src=images/no.png border='0'>";
		$f="meeting_report" ; $index="1"; 
		break;
	default :
		if( ($row_rsConfirm['book_person']==$user) && ($result['approve']=='') ){
			$color = "#d5ffd5";
			$color2 = "#d5ffd5";
			$g = "<a href=?option=meeting&task=main/meeting&index=2&id=$id&page=$page&room_index=$room_index><img src=images/drop.png border='0' alt='ลบ'></a>";
			$f="meeting" ; $index="2"; 
		}else{
			$color = "#d5ffd5";
			$color2 = "#d5ffd5";
			$g = "<img src=images/loading.gif border='0'> รออนุมัติ";
			$f="meeting_report" ; $index="1"; 
		}
		if(($result_permission['p1']==1) or ($_SESSION['admin_meeting']=="meeting")){
			$color = "#d5ffd5";
			$color2 = "#d5ffd5";
			$g="<img src=images/loading.gif border='0'> รออนุมัติ</a>";
			$f="officer" ; $index="5"; 
		}
	break;
}

if($_SESSION['login_status']<=4){	
	if(($result_permission['p1']==1) or ($_SESSION['admin_meeting']=="meeting")){
		$permission_admin = "<a href=?option=meeting&task=main/calMonth&index=5&id=$id&Date=$ck_startDate><img src=images/b_edit.png border='0' alt='แก้ไข' title='แก้ไข'></a>&nbsp;&nbsp;<a href=?option=meeting&task=main/calMonth&index=2&id=$id&Date=$ck_startDate><img src=images/drop.png border='0' alt='ลบ' title='ลบ'></a>";
	}
}

				##########     แสดงข้อมูลที่พบ     |-------------------------------------------
				print ("<TR bgcolor=$color onmouseover=\"javascript:this.bgColor='$color2'\" onmouseout=\"javascript:this.bgColor='$color'\"><TD valign=\"top\"><table width=100%><tr bgcolor=#e9e9e9><td widht=50%>".$g."</td><td widht=50% align=left>".$permission_admin."</td></table><a href=\"?option=meeting&task=main/".$f."&index=".$index."&id=".$row_rsConfirm['id']."\">".$room_name."</a><br>+".$objective."<br>จำนวน ".$row_rsConfirm['person_num']." คน<br>".$name."&nbsp;&nbsp;".$surname." ".$d." ".$e."<br>$start_time น. ถึง $finish_time น.</TD></TR>");
				$conf++;
			}	//end while
			print("</TABLE></td>");		//สิ้นสุดคอลัมส์ในแต่ละวัน

						if ($day_of_week == 7) {
                                $day_of_week = 0;
                                print("\n</TR>");
                        }
                        $day_of_week += 1;
                }

                /**** Next Greyed month days */
                $day = 1;
                While (($day_of_week <= 7) && ($day_of_week != 1)) {
						##########	     วันในเดือนถัดไป     |-------------------------------------------
                        print("<TD align=center valign=top>$day</TD>");
                        $day_of_week += 1;
                        $day += 1;
                }
                print("\n</TR>\n</TABLE>\n</td></tr></table></CENTER>");
		}

}	//end if( !($index=='')
?>

<script>
function goto_url2(val){
	callfrm("?option=meeting"); 		
}
function CheckAll() {
	for (var i = 0; i < document.frm1.elements.length; i++)
	{
	var e = document.frm1.elements[i];
	if (e.name != "allchk")
		e.checked = document.frm1.allchk.checked;
	}
}
function goto_url_update(val){
	if(val==0){
		callfrm("?option=meeting&task=main/calMonth&Date=<?php echo $goto_date ; ?>");   // page ย้อนกลับ 
	}else if(val==1){
		if(!(frm1.approve[0].checked || frm1.approve[1].checked)){
			alert("กรุณาเลือกการอนุญาต");
		}else{
			callfrm("?option=meeting&task=main/calMonth&index=6&Date=<?php echo $goto_date ; ?>");   //page ประมวลผล
		}
	}
}
</script>