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/Copy of reserve_summary.php
<?
//include("chk_permission.php");
session_start();
include("../../config/config.inc.php");
include("../../common/function.php");
include("var.inc.php");

$appsession = $_SESSION[session_apppermit][3];

if (!$_POST) {
	if (!$date_start){ $date_start=convert2th(convert_mysql2carendar(date("Y-m-1"))); } 
	if (!$date_end){ $date_end=convert2th(convert_mysql2carendar(date("Y-m-d"))); }
}

//echo $appid;
//echo "<pre>";
//print_r($_SESSION);

################ HARD FIX
#$_SESSION[session_staffid] = 49 ;
$user=$_SESSION[session_staffid];
################
if ($jump != ""){$jump=$jump;}else{$jump=date("d") ."/". date("m") ."/". date("Y") ;  $jump = $jump; } 


/*  
function jump_daythai($cal_format){
	$smonth = array("","ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค.");
	$arr_day = explode("/",$cal_format) ;  
	$mm = (int)$arr_day[1] ; 
	$thyy =  (int)$arr_day[2] + 543 ; 
	$daythai = (int)$arr_day[0] ."  ".  $smonth[$mm]  ."  ".  $thyy   ;
	return $daythai ; 
} ################# function jump_daythai($cal_format){
*/
function cutlast2digit($strx){
	$len1 = strlen($strx)-3 ; 
	$newval = substr($strx,0,$len1 ) ; 
	return $newval ; 
}################# function cutlast2digit($cal_format){

function toStaffName($staffid) {
	$sqlx = "SELECT staffname FROM epm_staff WHERE staffid='$staffid'";
	$qx = mysql_query($sqlx) or die(mysql_error());
	$rx = mysql_fetch_assoc($qx);
	if (!$rx[staffname]) { $rx[staffname]="ไม่ระบุ"; }
	return $rx[staffname];
}

function getRoomName($rid) {
	$sqlx = "SELECT rname FROM meeting_room WHERE rid='$rid'";
	$qx = mysql_query($sqlx) or die(mysql_error());
	$rx = mysql_fetch_assoc($qx);
	if (!$rx[rname]) { $rx[rname]="ไม่ระบุ"; }
	return $rx[rname];
}

function getRentPrice($rid) {
	$sqlx = "SELECT rrent,rper FROM meeting_room WHERE rid='$rid'";
	$qx = mysql_query($sqlx) or die(mysql_error());
	$rx = mysql_fetch_assoc($qx);
	if($rx[rper]==0){$per="ชั่วโมง";}elseif($rx[rper]==1){$per="วัน";}
	if (!$rx[rrent]) { $rx[rrent]=0; }
	return set_currency($rx[rrent])." บาท/".$per;
}
?>
<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" />
<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>
</head>
<body topmargin="0" bgcolor="#EEEEEE">

<? 			 	
	$title_label = "ระบบจองห้องประชุม";
	include "header.php";
	include "menu_bar.php";
?>
<?
		$xdate_start = convert_2mysql($date_start);
		$xdate_end = convert_2mysql($date_end);
		if ($rid) { 
			$sql1 = "SELECT * FROM meeting_reserve WHERE roomid='$rid' AND daterent BETWEEN '$xdate_start' AND '$xdate_end'";
			$sql2 = "SELECT SUM(meeting_room.rrent) AS trent FROM meeting_reserve Left Join meeting_room ON meeting_reserve.roomid = meeting_room.rid WHERE meeting_reserve.roomid='$rid' AND meeting_reserve.daterent BETWEEN '$xdate_start' AND '$xdate_end' GROUP BY meeting_reserve.roomid"; 
		} else { 
			$sql1 = "SELECT * FROM meeting_reserve WHERE daterent BETWEEN '$xdate_start' AND '$xdate_end'"; 
			$sql2 = "SELECT SUM(meeting_room.rrent) AS trent FROM meeting_reserve Left Join meeting_room ON meeting_reserve.roomid = meeting_room.rid WHERE meeting_reserve.daterent BETWEEN '$xdate_start' AND '$xdate_end' GROUP BY meeting_reserve.roomid"; 
		}
		$qx1 = mysql_query($sql1) or die(mysql_error());
		$nrowx1 = mysql_num_rows($qx1);
		$qx2 = mysql_query($sql2) or die(mysql_error());
		if($rid) {
			$rsx2 = mysql_fetch_assoc($qx2);
			$sumx=$rsx2[trent];
		} else {
			while($rsx2 = mysql_fetch_assoc($qx2)) {
				$sumx=(int)$sumx+(int)$rsx2[trent];
			}
		}
	?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top"><form name="form1" method="post" action="">
				  <br>
				  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="2">
                      <tr>
                        <td width="50%" align="center"><table width="350" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000">
                          <tr>
                            <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
                                <tr>
                                  <th align="right" bgcolor="#EEEEEE"><strong>สรุปการใช้งานห้องประชุม</strong></th>
                                  <td bgcolor="#EEEEEE"><strong>
                                    <select name="rid" id="rid" style="width:100px;">
                                      <option value="0" <? if($rid==0){?>selected="selected"<? } ?>>ทั้งหมด</option>
                                      <? $sqlx = "SELECT rid,rname FROM meeting_room ORDER BY rid ASC";
									$qx = mysql_query($sqlx) or die(mysql_error());
									while($rx = mysql_fetch_assoc($qx)) { ?>
                                      <option value="<?=$rx[rid];?>" <? if($rid==$rx[rid]){?>selected="selected"<? } ?>>
                                        <?=$rx[rname];?>
                                      </option>
                                      <? } ?>
                                    </select>
                                  </strong></td>
                                </tr>
                                <tr>
                                  <th align="right" bgcolor="#EEEEEE"><strong>ระหว่างวันที่</strong></th>
                                  <td bgcolor="#EEEEEE"><strong>
                                    <input name="date_start" type="text" value="<?=$date_start;?>" size="15" readonly>
                                    <input name="button2" type="button" class="index2" style='font-size:11px; width:80px;' onClick="popUpCalendar(this, form.date_start, 'd/m/yyyy')" value='เลือกวัน'>
                                  </strong></td>
                                </tr>
                                <tr>
                                  <th align="right" bgcolor="#EEEEEE"><strong>ถึงวันที่</strong></th>
                                  <td bgcolor="#EEEEEE"><strong>
                                    <input name="date_end" type="text" value="<? if (!$date_end){echo convert2th(convert_mysql2carendar(date("Y-m-d")));}else{echo $date_end;} ?>" size="15" readonly>
                                    <input name="button" type="button" class="index2" style='font-size:11px; width:80px;' onClick="popUpCalendar(this, form.date_end, 'd/m/yyyy')" value='เลือกวัน'>
                                  </strong></td>
                                </tr>
                                <tr>
                                  <th colspan="2" align="center" bgcolor="#EEEEEE"> <input name="Submit" type="submit" class="epm_button" value="     เรียกดู     ">
                                  </th>
                                </tr>
                            </table></td>
                          </tr>
                        </table></td>
                        <td width="50%" align="center"><table width="300" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#000000">
                          <tr>
                            <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
                                <tr>
                                  <td width="50%" align="right" bgcolor="#466A8E" class="txtwhite"><strong>สรุปการใช้งานห้องประชุม</strong></td>
                                  <td width="50%" align="left" bgcolor="#466A8E" class="txtwhite"><strong>
                                    <? if($rid!=0){echo " ".getRoomName($rid);}else{echo"ทั้งหมด";}?>
                                  </strong></td>
                                </tr>
                                <tr>
                                  <td width="50%" align="right" bgcolor="#466A8E" class="txtwhite"><strong>ระหว่างวันที่</strong></td>
                                  <td width="50%" align="left" bgcolor="#466A8E" class="txtwhite"><strong>
                                    <? if (!$date_start){echo daythai2(date("Y-m-d"));}else{echo daythai2(convert_2mysql($date_start));} ?>
                                  </strong></td>
                                </tr>
                                <tr>
                                  <td width="50%" align="right" bgcolor="#466A8E" class="txtwhite">ถึงวันที่</td>
                                  <td width="50%" align="left" bgcolor="#466A8E" class="txtwhite"><strong>
                                    <? if (!$date_end){echo daythai2(date("Y-m-d"));}else{echo daythai2(convert_2mysql($date_end));} ?>
                                  </strong></td>
                                </tr>
                                <tr>
                                  <td align="right" bgcolor="#466A8E" class="txtwhite">มีการใช้งาน</td>
                                  <td align="left" bgcolor="#466A8E" class="txtwhite"><strong>
                                    <?=$nrowx1;?>
                                  ครั้ง</strong></td>
                                </tr>
                                <tr>
                                  <td align="right" bgcolor="#466A8E" class="txtwhite">รวมเป็นเงิน</td>
                                  <td align="left" bgcolor="#466A8E" class="txtwhite"><strong>
                                    <?=set_currency($sumx);?>
                                    บาท</strong></td>
                                </tr>
                            </table></td>
                          </tr>
                        </table></td>
                      </tr>
                    </table>
				    <br>
				  </form>
    <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
          <tr  align="center" bgcolor="#466A8E"  class="headerTB_white" >
            <td width="5%" height="20" >ลำดับ</td>
            <td width="10%" height="20">วัน/เดือน/ปี</td>
            <td width="10%">เวลา</td>
            <td width="10%">ห้องประชุม</td>
            <td width="30%">หัวข้อการประชุม</td>
            <td width="20%">หน่วยงานที่ใช้บริการ</td>
            <td width="15%">อัตราค่าเช่า</td>
          </tr>
          <?
			while($rx = mysql_fetch_assoc($qx1)) {
			if ($bgcolor1 == "DDDDDD"){  $bgcolor1 = "EFEFEF"  ; } else {$bgcolor1 = "DDDDDD" ;}
			$i++;
			$time1=explode(":",$rx[time_start]);
			$time2=explode(":",$rx[time_end]);
		?>
          <tr  bgcolor="#<?=$bgcolor1?>">
            <td align="center" valign="top"><?=$i;?></td>
            <td align="center" valign="top"><?=daythai2($rx[daterent]);?></td>
            <td align="center" valign="top"><?=(int)$time1[0];?>.<?=$time1[1];?> - <?=(int)$time2[0];?>.<?=$time2[1];?></td>
            <td align="center" valign="top"><?=getRoomName($rx[roomid]);?></td>
            <td align="left" valign="top"><? if (!$rx[meeting_topic]) { echo"ไม่ระบุ"; }else{echo $rx[meeting_topic];}?></td>
            <td align="left" valign="top"><?=toStaffName($rx[staff_regis]);?></td>
            <td align="center" valign="top"><?=getRentPrice($rx[roomid]);?></td>
          </tr>
          <? } ?>
    </table>
	  <br>
	</td>
  </tr>
</table>
</body>
</html>

Anon7 - 2021