<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Web25_RoomState.aspx.cs" Inherits="Web25175_Hotel2.Web.Manage.Web25_RoomState" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>房态</title>
<link href="web25_roomState.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/Web25175_Hotel2.v1.1.js" type="text/javascript"></script>
</head>
<body>
<!--M:-->
<script type="text/javascript">
document.oncontextmenu = function() {
    return false;
}
document.onclick = function() {
    hide();
}
var OrderID = null;
var RoomID = null;
var isorder = false;
var IDs = "";
function show(obj) {
    isorder = false;
    var pos = uiGetPos(obj);
    RoomID = obj.getAttribute("id");
    var state = obj.getAttribute("state");
    var menu = uiGet("menu");
    menu.style.top = pos.y + 30 + "px";
    menu.style.left = pos.x + "px";
    menu.style.display = "block";

    uiGet("menu1").style.display = "none";
    uiGet("menu2").style.display = "none";
    uiGet("menu3").style.display = "none";
    uiGet("menu4").style.display = "none";
    uiGet("menu5").style.display = "none";
    uiGet("menu6").style.display = "none";
    uiGet("menu7").style.display = "none";
    uiGet("menu8").style.display = "none";
    switch (state) {
    case "占用房":
        uiGet("menu2").style.display = "block";
        uiGet("menu3").style.display = "block";
        uiGet("menu5").style.display = "block";
        uiGet("menu6").style.display = "block";
        uiGet("menu7").style.display = "block";
        uiGet("menu8").style.display = "block";
        break;
    case "空房":
        uiGet("menu1").style.display = "block";
        uiGet("menu4").style.display = "block";
        break;
    case "预订房":
        uiGet("menu1").style.display = "block";
        uiGet("menu4").style.display = "block";
        isorder = true;
        break;
    }
    uiGet("menu3").style.display = "block";
}

function _open_(title, url, width, height) {
    if (isorder && title == '散客开单') {
        uiWindow("此房间预订情况", '', "Web25_RoomState_YD_Window.aspx?RoomID=" + RoomID, 430, 220);
    } else {
        uiWindow(title, '', url + "?RoomID=" + RoomID + "&OrderID=" + OrderID + "&IDs=" + IDs, width, height);
    }
}
function _open_room_(v_roomid) {
    uiWindow("此房间预订情况", '', "Web25_RoomState_KD.aspx?RoomID=" + v_roomid, 700, 500); 
}
function hide() {
    var menu = uiGet("menu");
    menu.style.display = "none";
}
function _RoomIn(RoomID) {
    uiGet("RoomIn").src = "Web25_RoomIn_Left.aspx?RoomID=" + RoomID;
}

function GetChkID() {
    IDs = "";
    var chks = uiGetTag(uiGet("room"), "input");
    if (chks != null) {
        for (i = 0; i < chks.length; i++) {
            if (chks[i].getAttribute("type") == "checkbox" && chks[i].checked == true) {
                IDs += chks[i].value + ",";
            }
        }
    }
}
function showInfo(RoomID, obj) {
    var value = obj.getAttribute("value");
    var pos = uiGetPos(obj);
    var url = "Web25_RoomState_page.aspx?RoomID=" + RoomID + "&t=" + new Date();
    uiAjaxGet(url,
    function(e) {
        var data = eval("(" + e + ")");
        var htm = "<h3>消费明细</h3>";
        htm += "<table class='table'>";
        htm += "<tr>";
        htm += "<th width='100'>房间</th>";
        htm += "<th width='100'>消费项目</th>";
        htm += "<th width='60'>消费数量</th>";
        htm += "<th width='60'>消费单价</th>";
        htm += "<th width='60'>已收款</th>";
        htm += "</tr>";
        for (i = 0; i < data.Rows.length; i++) {
            var row = data.Rows[i];
           if (value == row.RoomCode) {
            htm += "<tr class='tr'>";
            }else{
               htm += "<tr>";
            }
            if (value != row.RoomCode) {
                htm += "<td width='100'>" + row.RoomCode + "</td>";
            } else {
                htm += "<td width='100'><font color=red><b>" + row.RoomCode + "</b></font></td>";
            }
            htm += "<td width='100'>" + row.Name + "</td>";
            htm += "<td width='60'>" + row.Number + "</td>";
            htm += "<td width='60'>" + row.Price.toFixed(2) + "</td>";
            htm += "<td width='60'>" + row.Deposit.toFixed(2) + "</td>";
            htm += "</tr>";
        }
        htm += "</table>";
        var div = uiGet("roomInfo");
        div.style.display = "none";
        div.innerHTML = htm;
        if (data.Rows.length > 0) div.style.display = "block";
        div.style.left = pos.x + 100 + "px";
        div.style.top = pos.y + "px";
    })
}
function HideInfo() {
    var div = uiGet("roomInfo");
    div.style.display = "none";
}

</script>
<form id="form1" runat="server">
  <div id='main'>
    <div id="lt">
      <h3>住宿信息</h3>
      <iframe src="Web25_RoomIn_Left.aspx" style="width:135px; height: 274px;" scrolling="no" frameborder="0" name="RoomIn" id="RoomIn"></iframe>
      <h3>总房态</h3>
      <ul class="room">
        <li class="r1">房间总数：
          <asp:Label ID="r_Total" runat="server"></asp:Label>
        </li>
        <li class="r1">
            <asp:RadioButton ID="rb_Room_Sort_BySort" runat="server" Checked="True" GroupName="rb_Room_Sort" Text="默认排序" />
        </li>
        <li class="r1">
          <asp:RadioButton ID="rb_Room_Sort_ByRoomCode" runat="server" GroupName="rb_Room_Sort" Text="按房间号码" />
        </li>
        <li class="r2">空房：
          <asp:Label ID="r_1" runat="server"></asp:Label>
        </li>
        <li class="r3">占用房：
          <asp:Label ID="r_2" runat="server"></asp:Label>
        </li>
        <li class="r4">预订房：
          <asp:Label ID="r_3" runat="server"></asp:Label>
        </li>
        <li class="r5">停用房：
          <asp:Label ID="r_4" runat="server"></asp:Label>
        </li>
        <li class="r6">打扫房：
          <asp:Label ID="r_5" runat="server"></asp:Label>
        </li>
        <li class="r7">合并
        </li>
      </ul>
    </div>
    <div style="padding:8px;" id='rt'>
      <asp:LinkButton ID="btnOrder" runat="server" OnClick="btnOrder_Click"></asp:LinkButton>
      <asp:LinkButton ID="btnBind" runat="server" OnClick="btnBind_Click"></asp:LinkButton>
      <asp:HiddenField ID="txtRoomType" runat="server" />
      <div class="tabs">
        <ul>
          <li>
            <asp:LinkButton ID="rptbtn" runat="server" OnClick="rptbtn_Click" CommandArgument='' CssClass=''>
              <div>全部</div>
            </asp:LinkButton>
          </li>
          <asp:Repeater ID="rptRoomType" runat="server">
            <ItemTemplate>
              <li>
                <asp:LinkButton ID="rptbtn" runat="server" OnClick="rptbtn_Click" CommandArgument='<%#Eval("ID") %>'>
                  <div><%#Eval("Name") %> </div>
                </asp:LinkButton>
              </li>
            </ItemTemplate>
          </asp:Repeater>
        </ul>
        <div class="c"></div>
      </div>
      <div class="room" id="room">
        <ul>
          <asp:Repeater ID="rptRoom" runat="server">
            <ItemTemplate>
              <li oncontextmenu="show(this)" id="<%#Eval("ID") %>" state='<%#Eval("State") %>' onclick='_RoomIn("<%#Eval("ID") %>")' onmouseover='showInfo(<%#Eval("ID") %>,this)' onmouseout='HideInfo()' value='<%#Eval("Code") %>'>
                <div class="c_<%# getState(Eval("State")) %>" style="position:relative" ondblclick='<%# (Eval("State").ToString())=="空房"?"_open_room_("+(Eval("ID").ToString())+");return false;":"return false;" %>'>
                  <div class="state"><input name="chkID" type="checkbox" value='<%#Eval("Code") %>' onclick='GetChkID()' />  <%#Eval("State") %></div>
                  <div class="content"><%#Eval("Code") %></div>
                  <div style="position:absolute; top:10px; left:10px;"><%# RoomTime(Eval("Code").ToString())?"<img src='images/zhongdian.gif' />":"" %></div>
                  <div style="position:absolute; top:55px; left:0px;"><%# GetMainRoomCode(Eval("Code").ToString())!="" ?"<div class='hb'>"+GetMainRoomCode(Eval("Code").ToString())+"</div>" : ""%></div>
                </div>
              </li>
            </ItemTemplate>
          </asp:Repeater>
          <% if(this.rptRoom.Items.Count==0) {%>
          <li style="line-height:25px; height:25px; color:Red; font-size:12px; text-align:center">暂无房间</li>
          <%} %>
        </ul>
        <div class="c"></div>
      </div>
      <div id="menu">
        <ul>
          <li id="menu1">
            <div onclick="_open_('散客开单','Web25_RoomState_KD.aspx',700,500)">散客开单</div>
          </li>
          <li id="menu8">
            <div onclick="_open_('增加收款/消费','Web25_RoomConsume.aspx',600,430)">增加收款/消费</div>
          </li>
          <li>
            <div class="line">-</div>
          </li>
          <li id="menu2">
            <div onclick="_open_('更换房间','Web25_RoomState_ChangeRoom.aspx',500,250)">更换房间</div>
          </li>
          <li id="menu3">
            <div onclick="_open_('更改房态','Web25_RoomState_ChangeState.aspx',500,250)">更改房态</div>
          </li>
          <li>
            <div class="line">-</div>
          </li>
          <li id="menu6">
            <div onclick="_open_('合并账单','Web25_RoomMerge.aspx',460,430)">合并账单</div>
          </li>
          <li id="menu7">
            <div onclick="_open_('拆分账单','Web25_RoomSplit.aspx',520,430)">拆分账单</div>
          </li>
          <li>
            <div class="line">-</div>
          </li>
          <li id="menu4">
            <div onclick="_open_('宾客预订','Web25_RoomState_YD.aspx',800,300)">宾客预订</div>
          </li>
          <li id="menu5">
            <div onclick="_open_('结账','Web25_RoomState_Checkout.aspx',820,450)">结账</div>
          </li>
        </ul>
      </div>
    </div>
  </div>
  <div style="height:5px;width:1400px;">&nbsp;</div>
</form>
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>
    <div id="roomInfo" style="display:none"></div>
</body>
</html>
<script type="text/javascript">
var winHeight = document.documentElement.offsetHeight;
var w = parseInt(winHeight);
if (w < 800) w = 800;
uiGet("lt").style.height = w + "px";
</script>

