MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/pathumthani_eoffice/application/meetingroom/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/meetingroom/reserve_room_bk20100503c.php
<?
//include("chk_permission.php");
session_start();
include("../../config/config.inc.php");
include("../../common/function.php");
include("var.inc.php");
$phpfile = "reserve_room.php" ; 

//insert timeQuery
include("../../common/common_system.inc.php"); 
$ApplicationName="metting"; 
$time_start = getmicrotime();  
//insert timeQuery




##meeting_reserve 
################ HARD FIX
#$_SESSION[session_staffid] = 49 ;
$user=$_SESSION[session_staffid];
################

?>
<HTML>
<HEAD><TITLE>ระบบจองห้องประชุม</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-874">
<LINK href="../../common/style.css" rel="stylesheet" type="text/css">
<LINK href="../../common/tab_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>

<SCRIPT language="javascript" src="../../common/popcalendar.js"></SCRIPT>
<SCRIPT language="javascript" src="../../common/xmlhttp.js"></SCRIPT>
<SCRIPT type="text/javascript" src="../../common/tabber.js"></SCRIPT>
<SCRIPT type="text/javascript">
function noNumbers(e)
{
	var keynum;
	var keychar;
	var numcheck;
	
	if(window.event) // IE
		{
		keynum = e.keyCode;
		}
	else if(e.which) // Netscape/Firefox/Opera
		{
		keynum = e.which;
		}
	keychar = String.fromCharCode(keynum);
	numcheck = /\d/;
	return numcheck.test(keychar);
}
<?
               $rs_roomsize=0;
				$sql = " SELECT  rid,rname,rdetail,rfloor,rsize,rrent,rper   FROM  meeting_room WHERE rid='$roomid'";
				$result = mysql_query($sql) ; 
				$rs = mysql_fetch_assoc($result);
				$rs_roomname =  $rs[rname] ;
				$rs_roomsize =  $rs[rsize] ;
				$rs_roomrfloor =  $rs[rfloor] ;				
				$rs_roomrrent =  $rs[rrent] ;				
				$rs_roomrper =  $rs[rper] ;												
?>
function checkForm() {
	missinginfo = "";
	missinginfo1 = "";
	var val = document.post.meeting_person.value;
	var xformhh1 = (document.post.formhh1.value);
	var xformmm1 = (document.post.formmm1.value);
	var xformhh2 = (document.post.formhh2.value);
	var xformmm2 = (document.post.formmm2.value);
	if (document.post.pdate.value == "")  {	missinginfo1 += "\n        -  วันที่ประชุม "; }
//	if ((xformhh1 >= xformhh2)  & (xformmm1 >= xformmm2)){missinginfo1 += "\n        -   เวลาสิ้นสุดการฝึกอบรมต้องมากกว่าเวลาเริ่มต้นการฝึกอบรม  "; }	parseInt

	if ((xformhh1 >  xformhh2) || ((xformhh1==  xformhh2) && (xformmm1 >= xformmm2)) ){  
			missinginfo1 += "\n        -   "+xformhh1+" > "+ xformhh2+" ) || (("+xformhh1+"==  "+xformhh2+") & (!("+xformmm1+" < "+xformmm2 +" ))))  "; 	
		missinginfo1 += "\n        -   เวลาสิ้นสุดการฝึกอบรมต้องมากกว่าเวลาเริ่มต้นการฝึกอบรม  "; 
	}
//	if (xformhh1 >  xformhh2){
//		alert(xformhh1);
//		alert(xformhh2);
//			missinginfo1 += "\n        -   เวลาสิ้นสุดการฝึกอบรมต้องมากกว่าเวลาเริ่มต้นการฝึกอบรม  "; 
//			missinginfo1 += "\n        -   (("+xformhh1+" > "+ xformhh2+" ) || (("+xformhh1+"==  "+xformhh2+") & (!("+xformmm1+" < "+xformmm2+"))))  "; 
//	}else 	if ((xformhh1==  xformhh2) & (xformmm1 >= xformmm2)){		
			
//		missinginfo1 += "\n        -   เวลาสิ้นสุดการฝึกอบรมต้องมากกว่าเวลาเริ่มต้นการฝึกอบรม  "; 
//		missinginfo1 += "\n        -   (("+xformhh1+" > "+ xformhh2+" ) || (("+xformhh1+"==  "+xformhh2+") & (!("+xformmm1+" < "+xformmm2+"))))  "; 
//	}	
//	if (xformhh1 >  xformhh2)	{ missinginfo1 += "\n        -   กรณีที่ 1  "; } 
//	if ((xformhh1==  xformhh2) & (!(xformmm1 <= xformmm2)))	{ missinginfo1 += "\n        -   กรณีที่ 2  "; } 
//alert(xformhh1 +" xxxxxx "+ xformhh2 );		

	if (document.post.meeting_chairman.value == "")  {	missinginfo1 += "\n        -  ประธานที่ประชุม  "; }
	if (document.post.meeting_topic.value == "")  {	missinginfo1 += "\n        -  หัวข้อการประชุม  "; }
	if (document.post.contactpoint.value == "")  {	missinginfo1 += "\n        -  ผู้ประสานงาน  "; }
	if (document.post.contactpointtel.value == "")  {	missinginfo1 += "\n        -  เบอร์โทรผู้ประสานงาน  "; }
	if (document.post.meeting_person.value == "")  {	missinginfo1 += "\n        -  จำนวนผู้เข้าร่วมประชุม  "; }
	//if (document.post.meeting_person.value > <?=$rs_roomsize?>)  {	missinginfo1 += "\n        -  จำนวนผู้เข้าร่วมประชุมต้องไม่เกิน <?=$rs_roomsize?> คน"; }
	if (missinginfo1 != "") { 
		missinginfo += "ท่านกรอกข้อมูลผิดพลาดหรือไม่ถูกต้อง ดังนี้ \n";
		missinginfo +=" _____________________________\n";
		missinginfo = missinginfo + missinginfo1;
		missinginfo += "\n_____________________________";
		missinginfo += "\n               กรุณาตรวจสอบ ";
		alert(missinginfo);
		return false;
	} // if (missinginfo1 != "") { 
		
		return true;
		
			
//	if (val><?=$rs_roomsize?>) {
//		alert("จำนวนผู้เข้าร่วมประชุม มีมากกว่าจำนวนที่ห้องประชุมสามารถรองรับได้");
//		val.focus();
//		return false;
//	}else if (val==0) {
//		alert("กรอกจำนวนผู้เข้าร่วมประชุม");
//		val.focus();
//		return false;
//	}
//	else { return true; }
}

function inputDate(obj){
		//alert(obj.checked);
		//if(obj.checked==true){ obj.checked=false; }else{ obj.checked=true; }
		if(obj.checked==false ){ document.getElementById('sum_date').disabled=false; }else{ document.getElementById('sum_date').disabled=true; }
		if(!obj.checked){
		document.getElementById('sum_date').value="";	
			}
}

function chknShowDate(val){
	be=document.getElementById('begin_date');
	en=document.getElementById('end_date');
	str=document.getElementById('pdate').value;
	txt_str=str.split("/");
	txt_str[2]-=543;
	begin=new Date(txt_str[2],txt_str[1],txt_str[0]);
	set=parseInt(begin.getDate())+parseInt(val)-1;
	begin.setDate(set);
	date=parseInt(begin.getDate())<10?"0"+begin.getDate():begin.getDate();
	mon=parseInt(begin.getMonth())<9?"0"+(parseInt(begin.getMonth())):(parseInt(begin.getMonth())+1);
	
	be.innerHTML=document.getElementById('pdate').value;
	en.innerHTML=date+"/"+mon+"/"+(begin.getFullYear()+543);
	
}

function noNumbers(e)
{
var keynum;
var keychar;
var numcheck;

if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar);
}



</SCRIPT>
<STYLE type=text/css>
BODY {OVERFLOW: scroll; OVERFLOW-X: hidden}
.DEK {POSITION: absolute; VISIBILITY: hidden; Z-INDEX: 200}
.style1 {color: #FF0000}
</STYLE> 
</HEAD>
<BODY topmargin="0">
<? 			 	
$title_label = "ระบบจองห้องประชุม";
include "header.php";   
include "menu_bar.php";  
include "../../common/tag_alt.txt";   
?>
<? 	
$table_var1 = " <br><table width='300' border='0' cellspacing='0' cellpadding='0' align='center'   ><tr>
                <td width='51'><img src='../../images/alert.gif'  width=31 height=32></td>
                <td width='349'  valign=middle align='center' > ";
$table_var2 = "  &nbsp;</td> </tr></table> <br>";		
$status="";	  
	  
if ($save_reserve != "" AND $editid == ""){ 

	############################# while (list ($key, $val) = each ($_POST)) { echo " <br>  $key  ::::::::: $val  "; 	}
	$mysql_date = convert_2mysql($pdate) ;
	$time_start = $formhh1 .":". $formmm1 ; $frm_start 	= $time_start  ; 
	$time_end = $formhh2 .":". $formmm2 ; $frm_end = $time_end ; 
	#------------------------------------------------------------------------------------------------------------------------------------Start ตรวจสอบการจองห้องซ้ำ
/*	$sql = "  SELECT * FROM meeting_reserve WHERE 
		(('$frm_start'   BETWEEN  time_start  AND  time_end  AND ('$frm_start'   >time_end)) OR 
		('$frm_end'   BETWEEN  time_start  AND  time_end  AND ('$frm_end' >time_start))) 
		AND  daterent = '$mysql_date'  	 AND roomid = '$roomid'  ";  */ 


	$sql = "  SELECT * FROM meeting_reserve WHERE 
		daterent = '$mysql_date'  	 AND roomid = '$roomid' AND 
		(
		(('$frm_start'   BETWEEN  time_start  AND  time_end   ) OR 
		('$frm_end'   BETWEEN  time_start  AND  time_end   )) "; 

	$result = mysql_query($sql) ; 
	echo @mysql_num_rows($result) ; 

	if (@mysql_num_rows($result)){
		$rs = @mysql_fetch_assoc($result) ;
		$roomid = $frm_oldroomid ; 
		$echostr =  "$table_var1 <b>  ห้องที่เลือกในช่วงเวลา $time_start -  $time_end ไม่ว่าง  <br> กรุณาเลือกห้องหรือช่วงเวลาอีกครั้ง  </b>  $table_var2";
		$echostr = str_replace( ":0 ",":00 "  ,$echostr ) ; 
		$rs_meeting_chairman = $meeting_chairman ; 
		$rs_meeting_topic = $meeting_topic ; 
		$rs_contactpoint = $contactpoint ; 
		$rs_contactpointtel = $contactpointtel ; 
		$rs_meeting_person = $meeting_person ; 		
	
		
	/*[pdate] => 27/06/2552
    [formhh1] => 08
    [formmm1] => 00
    [formhh2] => 09
    [formmm2] => 00
    [meeting_chairman] => 11111
    [meeting_topic] => 1
    [contactpoint] => 1
    [contactpointtel] => 1
    [meeting_person] => 1
    [frmpricebath_1] => 700
    [frmpricebath_3] => 1000
    [frmpricebath_4] => 1000
    [roomid] => 4
    [jump] => 27/06/2009
    [editid] => 
    [frm_oldroomid] => 4
    [save_reserve] => บันทึก*/

		

# die ("<br><br>ห้องที่เลือกไม่ว่าง   $time_start -  $time_end die บรรทัดที่  ".__LINE__ ." <br>   <hr>"); 			
	}else{ 		
				$errdate=$mysql_date;
				if($sum_date!=""){
						
										list($wy,$wm,$wd)=explode("-",$mysql_date);
										$wb=mktime(0,0,0,$wm,$wd,$wy);
										$thisindex=$sum_date;				
				}else{
										$thisindex=0;
				}
				
				
				$i=0;
				$j=0;
				do{
							if($sum_date!=""){
								$we=$wb+$j*86400;
								$errdate=date("Y-m-d",$we);
								
							}
					
							$sql="select time_start,time_end from meeting_reserve where roomid='$roomid' and  daterent='$errdate' and  admin_confirm<>'30'";
						
							
							$chang_query=mysql_query($sql);
							list($uh,$um)=explode(":",$time_start);
							list($ueh,$uem)=explode(":",$time_end);
							$unx_user=mktime((int)$uh,(int)$um,0,1,1,1970);
							$unx_user_end=mktime((int)$ueh,(int)$uem,0,1,1,1970);
						
						
							while(list($chang_start,$chang_end)=mysql_fetch_row($chang_query)){
								
								list($csh,$csm,$css)=explode(":",$chang_start);
								list($ceh,$cem,$ces)=explode(":",$chang_end);
								
								$unx_start=mktime((int)$csh,(int)$csm,0,1,1,1970);
								$unx_end=mktime((int)$ceh,(int)$cem,0,1,1,1970);
								if($i==0){
									if(   ($unx_user>=$unx_start &&$unx_user<$unx_end) || ($unx_user_end>$unx_start&&$unx_user_end<=$unx_end)  || ($unx_user<$unx_start&&$unx_user_end>$unx_end)  )$i=1;
								}
							
							}	
					++$j;
					
					
				}while($j<$thisindex);    //Check error while
			
			
			
				if($i==0){
								while (list ($key, $val) = each ($_POST)) { ################# เริ่มบันทึก อุปกรณ์โสต 
									if (eregi('frmaccid_', $key))  {	
										$post_runid =  str_replace("frmaccid_","",$key) ; 
										$frm_bath1 = "frmpricebath_" . $post_runid  ;eval("\$frm_bath1  = \"$frm_bath1\";");  $frm_bath =  $$frm_bath1 ; 
										$sql0 = "INSERT INTO meeting_reserve_access ( reserve_id,accid,costbath) VALUES ( '$mysql_insertid','$post_runid','$frm_bath')";  
										mysql_query($sql0) ;
									}	############# if (eregi('frmaccid_', $key))  {		
								} ################ END while (list ($key, $val) = each ($_POST)) {
							
								$sum_date=$_POST['sum_date'];
								if($sum_date!=""){
										list($wy,$wm,$wd)=explode("-",$mysql_date);
										$wb=mktime(0,0,0,$wm,$wd,$wy);
										
										$i=0;
										do{	
											$we=$wb+$i*86400;
											$usedate=date("Y-m-d",$we);
											$tbegin=$i==0?$time_start:"08:00";
											$tend=$i==($sum_date-1)?$time_end:"16:00";
											$admin_confirm = $NoCost ? 31 : 10;
											$sql = " INSERT INTO meeting_reserve ( roomid,daterent,time_start,time_end,staff_regis,contactpoint,contactpointtel,meeting_topic,meeting_chairman,meeting_person , admin_confirm  ,cost_request  ,date_payment_limit  ) VALUES ('$roomid','$usedate','$tbegin','$tend','$user','$contactpoint','$contactpointtel','$meeting_topic','$meeting_chairman' ,'$meeting_person' , '$admin_confirm' ,'$txtCost' ,'".swapdate($date_payment_limit)."' ) "; 
											$result = mysql_query($sql) ; #-------------------------------------------บันทึก
											mysql_error() ; 
											++$i;
										}while($i<$sum_date);
						
								}else{
										$admin_confirm = $NoCost ? 31 : 10;
										$sql = " INSERT INTO meeting_reserve ( 
										roomid,daterent,time_start,time_end,staff_regis,contactpoint,
										contactpointtel,meeting_topic,meeting_chairman,meeting_person , admin_confirm   ,cost_request  ,date_payment_limit) VALUES ( 
										'$roomid','$mysql_date','$time_start','$time_end','$user','$contactpoint',
										'$contactpointtel','$meeting_topic','$meeting_chairman' ,'$meeting_person' , '$admin_confirm' ,'$txtCost' ,'".swapdate($date_payment_limit)."' )  "; 
								 #die ("<br><br> INSERT INTO meeting_reserve   die บรรทัดที่  ".__LINE__ ." <br>   $sql    <hr>"); 			
										$result = mysql_query($sql) ; #-------------------------------------------บันทึก
										mysql_error() ; 
										$mysql_insertid = mysql_insert_id()   ; 
										# บันทึก log การจองห้องประชุม
										addlog("จองห้องประชุม $frm_roomid ",$m_id,$logid7,$mysql_insertid); // add log
								}
			}else{
				echo '<div style="width:100%;height:26px;padding-top:4px;padding-right:5px;background-color:#FF0033;border:#000000 solid 1px;text-align:right;font-weight:bold;"> ห้องที่เลือกในช่วงเวลา ',$time_start,' -  ',$time_end,' ไม่ว่าง กรุณาเลือกห้องหรือช่วงเวลาอีกครั้ง</div>';
		$rs_meeting_chairman = $meeting_chairman ; 
		$rs_meeting_topic = $meeting_topic ; 
		$rs_contactpoint = $contactpoint ; 
		$rs_contactpointtel = $contactpointtel ; 
		$rs_meeting_person = $meeting_person ; 			
       $rs_sum_date =$sum_date;
			}
								
	} ############  if (mysql_num_rows($result)){ 
#SELECT * FROM meeting_reserve WHERE (('10:0' BETWEEN time_start AND time_end AND ('10:0' >time_end)) OR ('10:0' BETWEEN time_start AND time_end AND ('10:0' >time_start))) AND daterent = '2009-03-14' AND roomid = '3' 	
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx frmaccid_
# UPDATE meeting_reserve_access SET reserve_id='3' WHERE (runid='16')  
# INSERT INTO meeting_reserve_access ( reserve_id,accid,costbath) VALUES ( '3','2','200')

#---------------------------------------------------------------------------------------------------------------------------------------END ตรวจสอบการจองห้องซ้ำ
} ############# if ($save_reserve != ""){
if ($save_reserve != "" AND $editid != ""){ 
	$mysql_date = convert_2mysql($pdate) ;
	$time_start = $formhh1 .":". $formmm1 ; $frm_start 	= $time_start  ; 
	$time_end = $formhh2 .":". $formmm2 ; $frm_end = $time_end ; 

	if ($frm_roomid != ""){ $updateroomid = $frm_roomid ; }else{ $updateroomid = $roomid; } 
	$roomid = $updateroomid ; 
	#---------------------------------------------------------------------------------------------------------------------------------------Start ตรวจสอบการจองห้องซ้ำ
#	(time_start >= '$time_start' AND  time_end <= '$time_start') or
	$sql = "
		SELECT * FROM meeting_reserve WHERE 

		(('$frm_start'   BETWEEN  time_start  AND  time_end  AND ('$frm_start'   >time_end)) OR 
		('$frm_end'   BETWEEN  time_start  AND  time_end  AND ('$frm_end' >time_start))) 
				
		AND  daterent = '$mysql_date'  	 AND roomid = '$roomid'  
		AND  refid != $editid  
		"; 
	$result = mysql_query($sql) ; 
	if (@mysql_num_rows($result)){
		$rs = @mysql_fetch_assoc($result) ;
		$roomid = $frm_oldroomid ; 
		$echostr =  "$table_var1<center><b>  ห้องที่เลือกในช่วงเวลา $time_start -  $time_end ไม่ว่าง  <br> กรุณาเลือกห้องหรือช่วงเวลาอีกครั้ง  </b></center> $table_var2";
		$echostr = str_replace( ":0 ",":00 "  ,$echostr ) ; 
	}else{ 	
		$sql = " UPDATE meeting_reserve SET 
		roomid='$updateroomid',daterent='$mysql_date',time_start='$time_start',time_end='$time_end',staff_regis='$user',
		contactpoint='$contactpoint',contactpointtel='$contactpointtel',meeting_topic='$meeting_topic',
		meeting_chairman='$meeting_chairman',meeting_person='$meeting_person', cost_request =  '$txtCost' ,date_payment_limit='".swapdate($date_payment_limit)."'
		WHERE   (refid='$editid')   ";   
		$result = mysql_query($sql) ;  #-------------------------------------------บันทึก
		echo mysql_error() ; 
		addlog("แก้ไขรายการจองห้องประชุม $updateroomid ",$m_id,$logid9,$editid); // add log
		$sql = " DELETE FROM  meeting_reserve_access  WHERE ( reserve_id='$editid')    ";
		$result = mysql_query($sql) ; 	echo mysql_error() ; 		
		while (list ($key, $val) = each ($_POST)) { ################# เริ่มบันทึก อุปกรณ์โสต 
			if (eregi('frmaccid_', $key))  {	
				$post_runid =  str_replace("frmaccid_","",$key) ; 
				$frm_bath1 = "frmpricebath_" . $post_runid  ;eval("\$frm_bath1  = \"$frm_bath1\";");  $frm_bath =  $$frm_bath1 ; 
				$sql0 = "INSERT INTO meeting_reserve_access ( reserve_id,accid,costbath) VALUES ( '$editid','$post_runid','$frm_bath') ";  
				//echo $sql0."<br>";
				mysql_query($sql0) ;
			}	############# if (eregi('frmaccid_', $key))  {		
		} ################ END while (list ($key, $val) = each ($_POST)) {		
	} ############  if (mysql_num_rows($result)){ 
	#---------------------------------------------------------------------------------------------------------------------------------------END ตรวจสอบการจองห้องซ้ำ
} ########### END if ($save_reserve != "" AND $editid != ""){
//die; 
?>
    <TABLE width="100%" height="400" border="0" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">
      <TR>
        <TD valign="top"><TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
          <TR>
            <TD width="19%" align="center" valign="top">
<? 
$csql = " SELECT * FROM  meeting_reserve  ";			
include("_calendar.php"); 
?>
<BR>
<BR>
<TABLE width="98%" border="0" cellpadding="2" cellspacing="0">
  <TR>
    <TD>
      ชื่อห้อง : <?=$rs_roomname?><BR/>
      ชั้น :
      <?=$rs_roomrfloor;?>
      <BR/>
      ขนาดความจุห้อง :
      <?=$rs_roomsize?>
      <BR/>
      ค่าเช่าห้อง :
      <?=$rs_roomrrent?>
      บาท/<? if($rs_roomrper==0){echo"ชั่วโมง";}elseif($rs_roomrper==1){echo"วัน";}?>    
	  <br><br>อุปกรณ์โสดมาตราฐานประจำห้อง :<br>
	<?
	$sql = " SELECT * FROM meeting_room_accessories WHERE rid='$roomid' ";
	$result = mysql_query($sql) ; 
	$nrows = mysql_num_rows($result);
	if ($nrows) {
		while ($rs_room= mysql_fetch_assoc($result)){ 
			$nonm++;
			echo "<li> $rs_room[accname] </li>";
		}
	}
	?>				  
	  
	  
	  </TD>
  </TR>
</TABLE></TD>
            <TD colspan="3" rowspan="2" valign="top">
<?


$nowdatemysql  = convert_2mysql($jump) ; 
$roomstr =""; if ($roomid != "" and $editid == ""){ $roomstr = "  AND  rid = $roomid  "; } 
$sql = " 
SELECT rid, roomid , refid, rname, rdetail, rfloor, rsize, rrent, meeting_reserve.daterent, meeting_reserve.time_start, 
meeting_reserve.time_end, meeting_reserve.contactpoint, meeting_reserve.contactpointtel, 
meeting_reserve.meeting_topic, meeting_reserve.meeting_chairman, meeting_reserve.meeting_person , 
admin_confirm , statusname
FROM meeting_room 
LEFT  JOIN meeting_reserve ON rid = meeting_reserve.roomid
INNER  JOIN  meeting_status ON admin_confirm = statusid 
WHERE    
meeting_reserve.daterent =  '$nowdatemysql'      
$roomstr 
 "; 
$result = mysql_query($sql) ; 
while ($rs = mysql_fetch_assoc($result)){ 
	$xroomid = $rs[roomid] ; 
	$xrefid = $rs[refid] ; 
	$refid = $rs[refid] ; 
	$arr_timestart = explode(":" , $rs[time_start] ) ; 
	$arr_timeend = explode(":" , $rs[time_end] ) ; 
	
	$starthh = $arr_timestart[0] ; 	$startmin = $arr_timestart[1] ; 	
	$endhh = $arr_timeend[0] ; 	$endmin = $arr_timeend[1] ; 
	
	$arr_roomref[$xroomid]  = $arr_roomref[$xroomid] .",".  $xrefid ; 
	
	$arr_starthh[$xroomid][$xrefid] =   $starthh  ; 	$arr_startmin[$xroomid][$xrefid] =   $startmin  ; 	
	$arr_endhh[$xroomid][$xrefid] =   $endhh  ; 	$arr_endmin[$xroomid][$xrefid] =   $endmin  ; 
	$arr_confirm[$xroomid][$xrefid] = $rs[admin_confirm] ; 
#	echo "<br><br> ========== $xroomid $xrefid   $rs[meeting_topic]  ";
	$arr_meetingtopic[$xroomid][$xrefid] = $rs[meeting_topic] ."<br> <strong>ประธานการประชุม :</strong>". $rs[meeting_chairman] ." <br> <strong>contactpoint :</strong>". $rs[contactpoint]  ; 		
} ###### END while ($rs = mysql_fetch_assoc($result)){ 
####################################################################
$sql = " SELECT * FROM meeting_status  "; 
$result = mysql_query($sql) ; 
while ($rs = mysql_fetch_assoc($result)){ 
	$arr_colorselect[$rs[statusid]] = $rs[statuscolor] ; 
} #########  while ($rs = mysql_fetch_assoc($result)){ 
####################################################################
$roomstr =""; if ($roomid != "" and $editid == ""){ $roomstr = "  WHERE  rid = $roomid  ";   } 
$sql = " SELECT  rid,rname,rdetail,rfloor,rsize,rrent   FROM  meeting_room   $roomstr  ";
$result = mysql_query($sql) ; 

?>
เลือกรูปแบบการแสดงผล [แบบตาราง] [<A href="reserve_list.php?jump=<?=$jump?>">แบบรายการ</A>]
<TABLE width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#666666">
  <TR  bgcolor="#466A8E"  class="headerTB_white" >
    <TD width="165" rowspan="2" align="center"  bgcolor="#466A8E" ><STRONG>ห้องประชุม</STRONG></TD>
    <TD colspan="10" align="center"><STRONG>สถานะการใช้งานห้องประชุมวันที่
      <?=jump_daythai($jump)?> 
    </STRONG></TD>
  </TR>
  <TR  bgcolor="#466A8E"  class="ptext_w" >
    <TD width="84" align="center"> 8.00-9.00 </TD>
    <TD width="63" align="center"> 9.00-10.00 </TD>
    <TD width="72" align="center"> 10.00-11.00 </TD>
    <TD width="73" align="center"> 11.00-12.00 </TD>
    <TD width="86" align="center"> 12.00-13.00 </TD>
    <TD width="74" align="center"> 13.00-14.00 </TD>
    <TD width="78" align="center"> 14.00-15.00 </TD>
    <TD width="72" align="center"> 15.00-16.00</TD>
    <TD width="81" align="center">16.00-17.00</TD>
    <TD width="79" align="center">17.00-18.00</TD>
  </TR>
<?
while ($rs= mysql_fetch_assoc($result)){ 
	$nonm++; 	
	if ($bgcolor1 == "DDDDDD"){  $bgcolor1 = "EFEFEF"  ; } else {$bgcolor1 = "DDDDDD" ;}
	$xroomid = $rs[rid] ; 	
	$xrefid = $editid ; 
	$arr001 = $arr_starthh[$xroomid] ; 
	$xroomname = $rs[rname] ; 
	$arr_meetingroom[$xroomid] = $xroomname ; 
#	echo "<br><br> ==========ห้อง $xroomid ||  xrefid=$xrefid    ||   editid=$editid   ";
	while (list ($xrefid, $val) = @each($arr001)) {   ########## หาว่าห้อง   $roomid มีการประชุมกี่โมง 
		$val = (int)$val ; 
#		echo " ============= ห้อง $roomid || ลำดับ(key) $xrefid ||  เวลา $val  <br> ";  
		$admin_confirm = $arr_confirm[$xroomid][$xrefid] ; 
		$xtimestart =  (int)$arr_starthh[$xroomid][$xrefid] ; 
		$xtimeend =  (int)$arr_endhh[$xroomid][$xrefid] ; 
		$topicxx = $arr_meetingtopic[$xroomid][$xrefid]  ;  ########### ตั้งค่าสำหรับ popup
		
		$xtimestart_min = (int)$arr_startmin[$roomid][$xrefid];
		$xtimeend_min = (int)$arr_endmin[$roomid][$xrefid];

		
				$temp_time_end = "";
	//	if($xtimestart_min > 0 or $xtimeend_min > 0) // กรณีมีเศษเป็นนาที
			
			$temp_sm = cal_time_persen($xtimestart_min); // หาเปอร์เซ็นของเวลาเริ่มต้น
			// หา start loop เริ่มต้นของตัวแปร
if($temp_sm <= 25){$start_loop = 0;}else if($temp_sm > 25 and $temp_sm <= 50){ $start_loop = 1;}else if($temp_sm > 50 and $temp_sm <= 75){ $start_loop = 2; }else if($temp_sm > 75 and $temp_sm <= 100){ $start_loop = 3;}

		if($xtimeend_min > 0){			// หา end loop 
			$temp_em = cal_time_persen($xtimeend_min); // หาเปอร์เซ็นของเวลาสิ้นสุด
if($temp_em <= 25){ $end_loop = 1;}else if($temp_em > 25 and $temp_em <= 50){ $end_loop = 2; }else if($temp_em > 50 and $temp_em <= 75){ $end_loop = 3;}else if($temp_em > 75 and $temp_em <= 100){ $end_loop = 4;}
		}else{
			$end_loop = 4;
		} // end if($xtimeend_min > 0){

			if($xtimeend_min > 0){ $temp_time_end = $xtimeend+1;  }else{ $temp_time_end = $xtimeend;} // กรณีเวลาสิ้นสุดมีเศษนาทีให้บวกเพิ่มไปอีก 1
			
			$n = 0;  // เช็ค loop
			$temp_check_loop = $temp_time_end - $xtimestart; // เช็คว่าจำนวน loop ทั้งหมดมีเท่าไหร่
			//echo "$xtimestart   == $temp_time_end<br>";
			for($j = $xtimestart ; $j < $temp_time_end ; $j++){
			$colorselect = $arr_colorselect[$admin_confirm] ; 
			$n++;
			if($n == 1){ // loop แรกเป็นเวลาเริ่มต้น
					for($k = $start_loop ; $k < 4; $k++){
						$varbgtmp = "bgcolor_c" . $j."_". $k;  $$varbgtmp = "bgcolor='$colorselect'" ;  ##### กำหนดสีให้ตัวแปร
					eval("\$varbgtmp  = \"$varbgtmp\";"); $varbg  = $$varbgtmp  ; 	
					if ($editid ==  $xrefid ){ $arrval[$xroomid]["$j"]["$k"] = "||||||||";  } 
					$arralt[$xroomid]["$j"]["$k"] =  "onmouseout=kill() onmouseover=\"popup('  $topicxx ','white')\";  " ; ## สำหรับ popup			

					}// end for
				} else if($n == $temp_check_loop){ // เช็คว่าเป็น loop สุดท้าย
						for($k = 0 ; $k < $end_loop; $k++){
						$varbgtmp = "bgcolor_c" . $j."_". $k;  $$varbgtmp = "bgcolor='$colorselect'" ;  ##### กำหนดสีให้ตัวแปร
					eval("\$varbgtmp  = \"$varbgtmp\";"); $varbg  = $$varbgtmp  ; 	
					if ($editid ==  $xrefid ){ $arrval[$xroomid]["$j"]["$k"] = "||||||||";  } 
					$arralt[$xroomid]["$j"]["$k"] =  "onmouseout=kill() onmouseover=\"popup('  $topicxx ','white')\";  " ; ## สำหรับ popup			

						
						}// end for
				}else{
						for($k = 0 ; $k < 4; $k++){
						$varbgtmp = "bgcolor_c" . $j."_". $k;  $$varbgtmp = "bgcolor='$colorselect'" ;  ##### กำหนดสีให้ตัวแปร
					eval("\$varbgtmp  = \"$varbgtmp\";"); $varbg  = $$varbgtmp  ; 	
					if ($editid ==  $xrefid ){ $arrval[$xroomid]["$j"]["$k"] = "||||||||";  } 
					$arralt[$xroomid]["$j"]["$k"] =  "onmouseout=kill() onmouseover=\"popup('  $topicxx ','white')\";  " ; ## สำหรับ popup			

						}// end for
				}// end 	if($n == 1){
					
//				eval("\$varbgtmp  = \"$varbgtmp\";"); $varbg  = $$varbgtmp  ; 	
//				if ($editid ==  $xrefid ){ $arrval[$xroomid]["$j"] = "||||||||";  } 
//				$arralt[$xroomid]["$j"] =  "onmouseout=kill() onmouseover=\"popup('  $topicxx ','white')\";  " ; ## สำหรับ popup			

			}// end for($j = $xtimestart ; $j < $temp_time_end ; $j++){

		
//		for ($ii = $xtimestart ; $ii < $xtimeend ; $ii++){ ########## start ทราบเวลาเิริ่มและเวลาจบ วนหาเวลาตรงกลาง
//			$colorselect = $arr_colorselect[$admin_confirm] ; 
//
//			$varbgtmp = "bgcolor_c" . $ii ;  $$varbgtmp = "bgcolor='$colorselect'" ;  ##### กำหนดสีให้ตัวแปร
//			eval("\$varbgtmp  = \"$varbgtmp\";"); 	$varbg  = $$varbgtmp  ; 
//			
//			if ($editid ==  $xrefid ){ $arrval[$xroomid]["$ii"] = "||||||||";  } 
//			$arralt[$xroomid]["$ii"] =  "onmouseout=kill() onmouseover=\"popup('  $topicxx ','white')\";  " ; ## สำหรับ popup			
//		}######end for  ########## end  ทราบเวลาเิริ่มและเวลาจบ วนหาเวลาตรงกลาง
	}################## end while (list ($name, $val) = each($arr001)) { 

?>
  <TR  bgcolor="#FFFFFF"  align="center" >
    <TD height="25" align="left"  bgcolor="#FFFFFF"><A href="room_detail.php?roomid=<?=$rs[rid]?>" target="_blank"  > </A>
      <?=$rs[rname]?></TD>
    <TD>
		<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c8_0?> <?=$arralt[$xroomid]["8"]["0"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c8_1?> <?=$arralt[$xroomid]["8"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c8_2?> <?=$arralt[$xroomid]["8"]["2"]?> width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c8_3?> <?=$arralt[$xroomid]["8"]["3"]?> width="25%">&nbsp;</TD>
      </TR>
    </TABLE>
	<?=$arrval[$xroomid]["8"]?></TD>
    <TD >
		<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c9_0?>  <?=$arralt[$xroomid]["9"]["0"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c9_1?>  <?=$arralt[$xroomid]["9"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c9_2?>  <?=$arralt[$xroomid]["9"]["2"]?>  width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c9_3?>  <?=$arralt[$xroomid]["9"]["3"]?>  width="25%">&nbsp;</TD>
      </TR>
    </TABLE>
	<?=$arrval[$xroomid]["9"]?></TD>
    <TD >
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c10_0?> <?=$arralt[$xroomid]["10"]["0"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c10_1?> <?=$arralt[$xroomid]["10"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c10_2?>  <?=$arralt[$xroomid]["10"]["2"]?> width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c10_3?> <?=$arralt[$xroomid]["10"]["3"]?>  width="25%">&nbsp;</TD>
      </TR>
    </TABLE>

	
	<?=$arrval[$xroomid]["10"]?></TD>
    <TD  >
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c11_0?>  <?=$arralt[$xroomid]["11"]["0"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c11_1?>  <?=$arralt[$xroomid]["11"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c11_2?> <?=$arralt[$xroomid]["11"]["2"]?>  width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c11_3?>  <?=$arralt[$xroomid]["11"]["3"]?> width="25%">&nbsp;</TD>
      </TR>
    </TABLE>

	
	<?=$arrval[$xroomid]["11"]?></TD>
    <TD >
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c12_0?> <?=$arralt[$xroomid]["12"]["0"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c12_1?>  <?=$arralt[$xroomid]["12"]["1"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c12_2?> <?=$arralt[$xroomid]["12"]["2"]?> width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c12_3?>  <?=$arralt[$xroomid]["12"]["3"]?> width="25%">&nbsp;</TD>
      </TR>
    </TABLE>
	<?=$arrval[$xroomid]["12"]?></TD>
    <TD >
		<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c13_0?>  <?=$arralt[$xroomid]["13"]["0"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c13_1?>  <?=$arralt[$xroomid]["13"]["1"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c13_2?>  <?=$arralt[$xroomid]["13"]["2"]?> width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c13_3?>  <?=$arralt[$xroomid]["13"]["3"]?> width="25%">&nbsp;</TD>
      </TR>
    </TABLE>
	
	<?=$arrval[$xroomid]["13"]?></TD>
    <TD  >
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c14_0?> <?=$arralt[$xroomid]["14"]["0"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c14_1?> <?=$arralt[$xroomid]["14"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c14_2?> <?=$arralt[$xroomid]["14"]["2"]?>  width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c14_3?> <?=$arralt[$xroomid]["14"]["3"]?>  width="25%">&nbsp;</TD>
      </TR>
    </TABLE>

	<?=$arrval[$xroomid]["14"]?></TD>
    <TD  >
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c15_0?> <?=$arralt[$xroomid]["15"]["0"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c15_1?> <?=$arralt[$xroomid]["15"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c15_2?> <?=$arralt[$xroomid]["15"]["2"]?>  width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c15_3?> <?=$arralt[$xroomid]["15"]["3"]?>  width="25%">&nbsp;</TD>
      </TR>
    </TABLE>	
	<?=$arrval[$xroomid]["15"]?></TD>
    <TD  ><TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c16_0?> <?=$arralt[$xroomid]["16"]["0"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c16_1?> <?=$arralt[$xroomid]["16"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c16_2?> <?=$arralt[$xroomid]["16"]["2"]?>  width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c16_3?> <?=$arralt[$xroomid]["16"]["3"]?>  width="25%">&nbsp;</TD>
      </TR>
    </TABLE>	
	<?=$arrval[$xroomid]["16"]?></TD>
    <TD  ><TABLE width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      <TR>
        <TD  <?=$bgcolor_c17_0?> <?=$arralt[$xroomid]["17"]["0"]?> width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c17_1?> <?=$arralt[$xroomid]["17"]["1"]?>  width="25%">&nbsp;</TD>
        <TD <?=$bgcolor_c17_2?> <?=$arralt[$xroomid]["17"]["2"]?>  width="25%">&nbsp;</TD>
		<TD <?=$bgcolor_c17_3?> <?=$arralt[$xroomid]["17"]["3"]?>  width="25%">&nbsp;</TD>
      </TR>
    </TABLE>	
	<?=$arrval[$xroomid]["17"]?></TD>
  </TR>
  <?
					
 for ($ii = 1 ; $ii < 24 ; $ii++){
 	for($m = 0 ; $m < 4; $m++){
	$varbgtmp = "bgcolor_c" . $ii."_".$m  ;
	$$varbgtmp = "" ;
	} //end 
 }// end  for ($ii = 1 ; $ii < 24 ; $ii++){

}  ################## end while ($rs= mysql_fetch_assoc($result)){ 
?>
</TABLE>
<BR>
                <TABLE width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <TR>
                  <TD colspan="7"><STRONG>สถานะการจองห้องประชุม</STRONG></TD>
                </TR>
                <TR>
                  <TD width="5%">&nbsp;</TD>
                  <TD width="3%" bgcolor="#FFFFFF">&nbsp;</TD>
                  <TD width="27%"> &nbsp; ห้องประชุมว่าง</TD>
                  <TD width="3%" bgcolor="#FFFF99">&nbsp;</TD>
                  <TD width="26%">&nbsp; จองห้องประชุม</TD>
                  <TD width="3%" bgcolor="#A0C779">&nbsp;</TD>
                  <TD width="33%">&nbsp; ผ่านยืนยันการจองโดยผู้ดูแลระบบ</TD>
                </TR>
              </TABLE>
<? 
################################# jump=13/03/2009&editid=1 
if ($editid != ""){ 
	$poststr = "&jump=". $jump ."&editid=". $editid ; 
}else{
	$poststr = "";
} ########## END  if ($editid != ""){
?>

            <FORM name="post" method="post" action="reserve_room.php?roomid=<?=$roomid?><?=$poststr?>" onSubmit="return checkForm()" >
              <?
if ($editid != ""){ 
	$sql = " SELECT * FROM meeting_reserve WHERE refid = '$editid'  ";
	$result = mysql_query($sql) ; 
	while ($rs = mysql_fetch_assoc($result)){ 
		$rs_refid    = $rs[refid] ; 
		$rs_roomid    = $rs[roomid] ; 
		$rs_daterent   = $rs[daterent] ; 
		$rs_time_start    = $rs[time_start] ; 
		$rs_time_end    = $rs[time_end] ; 
		$rs_staff_regis    = $rs[staff_regis] ; 
		$rs_contactpoint    = $rs[contactpoint] ; 
		$rs_contactpointtel    = $rs[contactpointtel] ; 		
		$rs_meeting_topic    = $rs[meeting_topic] ; 
		$rs_meeting_chairman    = $rs[meeting_chairman] ; 
		$rs_meeting_person    = $rs[meeting_person] ; 	
		$rs_admin_confirm    = $rs[admin_confirm] ; 
		$rs_paid_comment	= $rs[paid_comment];
		$rs_date_payment_limit	= $rs[date_payment_limit] ? swapdate($rs[date_payment_limit]) : "";
	} ########## END while ($rs = mysql_fetch_assoc($result)){  	
} ######################### END if ($editid != ""){ 
echo $echostr ;  $echostr  ="";
?>
              <TABLE width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#F5F5F5">
                <TR>
                  <TD><STRONG>รายละเอียดการจองห้องประชุม</STRONG></TD>
                </TR>
                <TR>
                  <TD><TABLE width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#EEEEEE">
                    
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">&nbsp;</TD>
                      <?php
					  		$sql = " SELECT image  FROM  meeting_room   where rid ='$roomid'";
							$query = mysql_query($sql) ; 
							list($rs_image_name)=mysql_fetch_row($query);
					  		$show_image=$rs_image_name==""?"no_image.jpg":$rs_image_name;
					  ?>
                      <TD>&nbsp; 
                      <a href="images/room_image/<?php echo $show_image;	?>" rel="lightbox" title="">
             		<img src="images/room_image/<?php echo $show_image;	?>" width="150px" style="border:#000 solid 2px" /> 
             		</a>
                    <br />
                    <br />
                    <br />
                    
                    </TD>
                    </TR>
                    
                    
                    <TR>
                      <TD width="4%">&nbsp;</TD>
                      <TD width="19%" align="right">ห้อง : </TD>
                      <TD>                  
<? ############ roomid  
if ($editid != ""){   ########if ($editid != ""){   เปิด List box เพื่อแก้ ห้องประชุมได้
?>					  
				<SELECT name="frm_roomid">
<?  while (list($xmid, $xmname) = each($arr_meetingroom)){   
		if ($roomid == $xmid ){ $str_select = " selected "; }else{ $str_select= "";} 	
?>
					 <OPTION value="<?=$xmid?>"  <?=$str_select?> ><?=$xmname?>  </OPTION>
<? }  ## END while (list($xmid, $xmname) = each($arr_meetingroom)){ ?>						 
				 </SELECT>
<?
}else{
	echo $xroomname  ;   
?>
	 <A href='main.php?jump=<?=$jump?>'>เปลี่ยนห้องประชุม</A> 
<?   } ########if ($editid != ""){   ?>				 
					   </TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">วันที่ : </TD>
                      <TD>
<?

$thyy = date("Y") + 543 ; 
$nowdate=date("d") ."/". date("m") ."/". $thyy ; 
$jump_th =  convert2th($jump) ; 

?>					  
<INPUT name="pdate" type="text" class="input" id="pdate" style="width:120px;" value="<?=$jump_th?>" maxlength="10" readonly>
<SCRIPT language='javascript'>	if (!document.layers) {	document.write("<input type=button onclick='popUpCalendar(this, post.pdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>")	}</SCRIPT>					  
                        <SPAN class="style1"> *</SPAN>
                        &nbsp;&nbsp;&nbsp;
                        <!--<input id="more_one" name="more_one" type="checkbox"  onMouseUp="inputDate(this)"  <? if($rs_sum_date!=""){echo "checked";}?>  onChange="room_bill();" /> จำนวนวัน (กรณีจองมากกว่า 1 วัน)  <input type="text" id="sum_date" name="sum_date" disabled="disabled" style="width:25px;" maxlength="2"  value="<?=$rs_sum_date?>" onKeyPress="return noNumbers(event)"  onChange="room_bill();" />--><!--onChange="chknShowDate(this.value)"-->
                        </TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">เริ่มประชุมเวลา :</TD>
                      <TD width="77%"><?
						$nowhh = date("G") ; 
						$nowmin = date("i") ; 		
						$arr_xstart = @explode(":" , $rs_time_start ) ; 
						$arr_xend  = @explode(":" , $rs_time_end  ) ; 
						
						$xhh1 = (int)$arr_xstart[0] ; $xmm1 = (int)$arr_xstart[1] ; 
						$xhh2 = (int)$arr_xend[0] ; $xmm2 = (int)$arr_xend[1] ; 						  				  
						  ?>
                        <SELECT name="formhh1" onChange="room_bill();">
                          <? for ($ii = 8; $ii <= 18 ; $ii++){ 
						  			if ($ii < 10 ){ $ii2 = "0". $ii ; }else{ $ii2 = $ii ; }
					  			if ($ii==8 and $editid =="" ){ $str_select = " selected "; }else{ 
									$str_select= ""; 
									if ($ii==$xhh1 and $editid !="" ){$str_select = " selected "; }else{ $str_select= "";} 	
								}##############################end if ($ii==8 and $editid =="" ){ .................
                           		echo " <option value=\"$ii2\"   $str_select >$ii2</option> "; 
							  } ?>
                        </SELECT>
                        <SELECT name="formmm1" onChange="room_bill();">
                          <? for ($ii = 0; $ii < 56 ; $ii = $ii + 30){ 
						  			if ($ii < 10 ){ $ii2 = "0". $ii ; }else{ $ii2 = $ii ; }
									if ($ii==0 and $editid =="" ){$str_select = " selected "; }else{ 
										$str_select= ""; if ($ii==$xmm1 and $editid !="" ){$str_select = " selected "; }else{ $str_select= "";} 	
									}##############################end if ($ii==8 and $editid =="" ){ .................
                           	echo " <option value=\"$ii2\"   $str_select >$ii2</option> "; 
							  } ?>
                        </SELECT>
                         <span class="style1">*</span>&nbsp;
                        <span id="begin_date" style="width:100px;height:20px;"></span> 
                      	
                       </TD>
                      </TR>
                      <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">เลิกประชุมเวลา :</TD>
                      <TD width="77%">
                       
                         <SELECT name="formhh2" onChange="room_bill();">
                          <? for ($ii = 8; $ii <= 18 ; $ii++){ 
						  			if ($ii < 10 ){ $ii2 = "0". $ii ; }else{ $ii2 = $ii ; }
									if ($ii==16 and $editid =="" ){$str_select = " selected "; }else{ 
										$str_select= ""; if ($ii==$xhh2 and $editid !="" ){$str_select = " selected "; }else{ $str_select= "";} 	
									}##############################end if ($ii==8 and $editid =="" ){ .................								
                           	echo " <option value=\"$ii2\"   $str_select >$ii2</option> "; 
							  } ?>
                        </SELECT>
                        <SELECT name="formmm2" onChange="room_bill();">
                          <? for ($ii = 0; $ii < 60 ;  $ii = $ii + 30 ){ 
						  			if ($ii < 10 ){ $ii2 = "0". $ii ; }else{ $ii2 = $ii ; }
									if ($ii==0 and $editid =="" ){$str_select = " selected "; }else{ 
										$str_select= ""; if ($ii==$xmm2 and $editid !="" ){$str_select = " selected "; }else{ $str_select= "";} 	
									}##############################end if ($ii==8 and $editid =="" ){ .................									
                           	echo " <option value=\"$ii2\"   $str_select >$ii2</option> "; 
							  } ?>
                        </SELECT>
                        <SPAN class="style1"> *</SPAN>&nbsp;
                         <span id="end_date" style="width:100px;height:20px;"></span> 				
                      </TD>
                      </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">&nbsp;</TD>
                      <TD>&nbsp; </TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">ประธานที่ประชุม : </TD>
                      <TD><INPUT name="meeting_chairman" type="text" id="meeting_chairman" value="<?=$rs_meeting_chairman?>" size="80">
                        <SPAN class="style1">                      *</SPAN></TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">หัวข้อการประชุม : </TD>
                      <TD><INPUT name="meeting_topic" type="text" id="meeting_topic" value="<?=$rs_meeting_topic?>" size="80">
                        <SPAN class="style1"> *</SPAN></TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">ผู้ประสานงาน : </TD>
                      <TD><INPUT name="contactpoint" type="text" id="contactpoint" value="<?=$rs_contactpoint?>" size="80">
                        <SPAN class="style1"> *</SPAN></TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">เบอร์โทรผู้ประสานงาน : </TD>
                      <TD><INPUT name="contactpointtel" type="text" id="contactpointtel" value="<?=$rs_contactpointtel?>" size="80" onKeyPress="return noNumbers(event)">
                        <SPAN class="style1"> *</SPAN></TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">จำนวนผู้เข้าร่วมประชุม : </TD>
                      <TD><INPUT name="meeting_person" type="text" id="meeting_person" value="<?=$rs_meeting_person?>" size="10">                        
                        คน ระบุข้อมูลเป็นตัวเลขเช่น &quot;<?=rand(5,$rs_roomsize)?>&quot;(สูงสุด  
                        <?=$rs_roomsize?>
                        คน)                        <SPAN class="style1">*</SPAN></TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right" valign="top">&nbsp;อัตราค่าธรรมเนียม :</TD>
                      <TD valign="top">
					  <span id="money_payment" style="display:block"></span>
                      <input type="hidden" name="txtCost" id="txtCost"  value="" >
                       <input type="hidden" name="NoCost" id="NoCost"  value="" >
                      <script language="javascript">
					  	function room_bill(){
                      <?
                      	$sql = " SELECT meeting_room_owner  FROM  epm_staff   where staffid ='$session_staffid' limit 1";
						$query = mysql_query($sql) ; 
						$row_result = @mysql_fetch_assoc($query) ;
						if($row_result[meeting_room_owner]){
							
					  ?>
						  document.getElementById('money_payment').innerHTML = "งดค่าธรรมเนียมเนื่องจากเป็นหน่วยงานเจ้าของสถานที่" ;
						  document.getElementById('NoCost').value = "1";
					  <?		   
						}else{

					  ?>							
							if( parseFloat(document.getElementById('formhh1').value) < 10 ){
								hour_st = document.getElementById('formhh1').value.substring(1);
							}else{
								hour_st = parseFloat(document.getElementById('formhh1').value)	;
							}

							if( parseFloat(document.getElementById('formhh2').value) < 10 ){
								hour_en = document.getElementById('formhh2').value.substring(1);
							}else{
								hour_en = parseFloat(document.getElementById('formhh2').value)	;
							}

							if(hour_st > hour_en){
								alert("เวลาเลิกประชุม ควรมากกว่า เวลา เริ่มประชุม!");	
								return false;;
							}
							
							minute_st = parseFloat(document.getElementById('formmm1').value/ 60) ;
							minute_en = parseFloat(document.getElementById('formmm2').value/ 60) ;		
							
							//if( document.getElementById('more_one').checked == true ){
							//	date_number =  document.getElementById('sum_date').value
							//}else{
								date_number = 1 ; 									
							//}	

							var room_pay = <?=$rs_roomrrent?>;
							def_hour = parseFloat(hour_en) + parseFloat(minute_en) - parseFloat(hour_st) - parseFloat(minute_st);
							pay_money = room_pay * def_hour * date_number ;
							//pay_money = room_pay * def_hour ;
							//alert( pay_money + " บาท");
							document.getElementById('money_payment').innerHTML = pay_money + "&nbsp;บาท" ;
							document.getElementById('txtCost').value = pay_money ;
							
	                      <? } ?>
						}
						 room_bill();
					  </script>
					  </TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right">ชำระค่าธรรมเนียม ภายในวันที่</TD>
                      <TD>
                      	<?
                        $rs_date_payment_limit = $rs_date_payment_limit ? $rs_date_payment_limit : $jump ; 
						?>
                        <input name="date_payment_limit"  id="date_payment_limit"  type="text" value="<?=$rs_date_payment_limit;?>" size="15" readonly>
                        <input name="button2" type="button" class="index2" style='font-size:11px; width:80px;' onClick="popUpCalendar(this, form.date_payment_limit, 'd/m/yyyy')" value='เลือกวัน'>
						</TD>
                    </TR>                    
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD align="right" valign="top">อุปกรณ์โสต : </TD>
                      <TD><TABLE width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                        <TR>
                          <TD width="6%" bgcolor="#EEEEEE">&nbsp; </TD>
                          <TD width="71%" align="center" bgcolor="#EEEEEE"><STRONG>อุปกรณ์</STRONG></TD>
                          <TD width="23%" align="center" bgcolor="#EEEEEE"><STRONG>ราคาต่อหน่วย</STRONG></TD>
                        </TR>
<?
############ accid  accname  accdetail  accunit  accprice
$sql1 = " select * from  meeting_accessories  "; 
$result1 = mysql_query($sql1) ;
while ($rs1 = mysql_fetch_assoc($result1)){ 
?>					
                        <TR>
                          <TD align="center" bgcolor="#EEEEEE">
                          <?php
						  	$ac=$rs1[accid];
						  	$sql="select count(accid) from meeting_reserve_access where accid='$ac' and reserve_id='$editid' ";
							$query=mysql_query($sql);
							list($accessory)=mysql_fetch_row($query);
							//if($accessory==0){
							if($accessory>0){
						  ?>
                          <input name="frmaccid_<?=$rs1[accid]?>" type="checkbox" id="frmaccid_<?=$rs1[accid]?>" value="<?=$rs1[accid]?>"  checked  >
                          <? }else{?>
						  <INPUT name="frmaccid_<?=$rs1[accid]?>" type="checkbox" id="frmaccid_<?=$rs1[accid]?>" value="<?=$rs1[accid]?>" >
						<? } ?></TD>
                          <TD bgcolor="#EEEEEE" <?php if($accessory>0){echo 'style="color:999;"';} ?>><?=$rs1[accname]?>
<INPUT name="frmpricebath_<?=$rs1[accid]?>" type="hidden" id="frmpricebath_<?=$rs1[accid]?>" value="<?=$rs1[accprice]?>"></TD>
                          <TD align="center" bgcolor="#EEEEEE" <?php if($accessory>0){echo 'style="color:999;"';} ?>><?=$rs1[accprice]?> บาท </TD>
                        </TR>
<?
}
?>						
                        <TR>
                          <TD bgcolor="#EEEEEE">&nbsp;</TD>
                          <TD bgcolor="#EEEEEE">&nbsp;</TD>
                          <TD bgcolor="#EEEEEE">&nbsp;</TD>
                        </TR>
                      </TABLE></TD>
                    </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD>
					 
					  <INPUT name="roomid" type="hidden" id="roomid" value="<?=$roomid?>">
                        <INPUT name="jump" type="hidden" id="jumpdate" value="<?=$jump?>">
                        <INPUT name="editid" type="hidden" id="editid" value="<?=$editid?>">						
						<INPUT name="frm_oldroomid" type="hidden" id="frm_oldroomid" value="<?=$roomid?>"></TD>
                      <TD><INPUT type="submit" name="save_reserve" value="บันทึก"> 
					  <INPUT type="button" name="Submit2" value="กลับหน้าหลัก"  onclick="window.location='main.php'  " ></TD>
                      </TR>
                    <TR>
                      <TD>&nbsp;</TD>
                      <TD>&nbsp;</TD>
                      <TD>&nbsp;</TD>
                      </TR>
                  </TABLE></TD>
                </TR>
              </TABLE>
              สามารถชำระค่าธรรมเนียมการใช้ห้องประชุมได้ที่เจ้าหน้าที่งานการเงินและบัญชี&nbsp; ฝ่ายอำนวยการ &nbsp;&nbsp; สำนักงานจังหวัดปทุมธานี
            </FORM>
            </TD>
          </TR>
          <TR>
            <TD align="left" valign="top">&nbsp;
			
			</TD>
          </TR>
        </TABLE></TD>
      </TR>
</TABLE>
</BODY>
</HTML>
<?
//insert timeQuery
 $time_end = getmicrotime();
  writetime2db($timestart,$timeend);
//insert timeQuery
?>

Anon7 - 2021