ช่วยดูที่ครับ คิดไม่ออก เรื่องระบบการจองห้องพัก

จากรูป คอลัมซ้ายสุดคือเลขห้อง แล้วตามด้วยจะนวนวันในเดือนนั้น สามารถเลือกดูการจองในแต่ละเดือนได้

จากรูปใช้วิธีวนลูปจำนวนห้องทั้งหมด และจำนวนวันในแต่ละเดือนมาแสดง

ถ้าหากมีการจอง ช่วงของวันจะเป็นสีน้ำเงิน หากมีลูกค้าพักอยู่จะเป็นสีแดง

โดย ตาราง bookings จะมีฟิลด์หลักที่จะคิวรี่ของมูลมาแสดงคือ roomnucus, status, date_bookin(dd-mm-yyyy) , date_bookout(dd-mm-yyyy)

status=1  คือจอง

status=2  คือเข้าพักแล้ว

status=3  คือเช็คเอาท์ไปแล้ว

คิดไม่ออกเลยครับว่าจะเขียนโปรแกรมยังไง คิดมาสามวันแล้ว หรือผมมองข้ามอะไรไป

ใครเก่งๆ ช่วยแนะนำแนวทางทีให้ทีนะครับ ขอบคุณมากๆครับ

โค้ดที่แสดงรูปครับ

 <?
             
$GoToDay = $_GET['txtDay'];//m/d/y

if (!empty($GoToDay)) {
  $StartDate=date("m/d/y",strtotime ("$GoToDay"));
} else if (empty($StartDate)) $StartDate=date("m/d/y");
echo WriteMonth($StartDate);

function WriteMonth($StartDate)
{
  $thaimonth=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม", "พฤศจิกายน","ธันวาคม");
 
  $WriteMonth="";
  $CurrentDate=date("m/1/y", strtotime ("$StartDate"));
  $noOfDays=(int)(date("t",strtotime ($CurrentDate)));
     
 $WriteMonth.="";
  $WriteMonth.="<h2 align='center'>";
  $WriteMonth.="<a href=\"?txtDay=".date("m/1/y", strtotime ("$CurrentDate last months"))."\"><font color=\"#6699cc\"> << </font></a><b><font color=\"#333\">".$thaimonth[date("m", strtotime ($StartDate))-1]." ".(date("Y",strtotime ($StartDate))+543);
  $WriteMonth.="</font>";
  $WriteMonth.="<a href=\"?txtDay=".date("m/1/y", strtotime ("$StartDate next months"))."\"><font color=\"#6699cc\"> >> </font></a>";
 
  $WriteMonth .="</h2>";
  return $WriteMonth;
}
 $CurrentDate=date("m/1/y", strtotime ("$StartDate"));
  $noOfDays=(int)(date("t",strtotime ($CurrentDate)));
?>
              
<table align="center" cellspacing="0" cellpadding="1">         
 <?
include "includes/connect.php";

$SQL_room= "SELECT * FROM room order by room_no asc" ;
$result_room=mysql_query($SQL_room);  

while($row=mysql_fetch_array($result_room)){

echo "<tr>";
echo "<td  style=\"border: solid 1px #666666\" align=\"center\" bgcolor=\"#00FFFF\">";

echo $room_no=$row[room_no];
echo "</td>";
               
              
 for($i=1; $i<=$noOfDays ;$i++)
{
                      
   echo "<td  style=\"border: solid 1px #666666;width: 19px; color:black\" align='center'>$i</td>";

                            
}//for
               
echo "</tr>";
}//while
?>
</table>

01 ต.ค. 2552 1 1,950

สรุป คือ อยากรู้ว่าวันไหนที่มีคนจอง หรือว่าเข้าพัก หรือเช็คเอาท์ไปแล้ว หรอคับ
แล้วถ้าเกิดจองวันที่ 1 - 10 เนี่ยแล้วเกิดคนจองมาวันที่ 3 - 8 คิดตามวันจองหรือวันพักคับ
#1
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^