<!--#include virtual="/includes/topofpage.asp"-->
<%	
Dim Page 
Page = "16"

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("conn_string")

If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("page") = "0") Then
	If Request.Form("Admin_Group_ID") <> "" Then
		Session("Admin_Group_ID") = Request.Form("Admin_Group_ID")
	End If
	
	If Session("Admin_Group_ID") = "" Then
		Session("Admin_Group_ID") = "0"
	End If
End If

Dim SQLName, RSName
SQLName = "get_entity_from_group @Group_ID='" & Session("Admin_Group_ID") & "'"
Set RSName=Conn.Execute(SQLName)

%>
<%
'Posting Variables on Save
If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("page") = Page) Then
	Dim i, Form_String, Sub_String, Room_Total
	Dim SQL, SQL_RM
	
	Form_String = Split(Request.Form, "&", -1)

    i=2
    Room_Total = 0
    Do while i < (Request.Form.Count)
		SQL = "Update_Attribute '" & Session("Admin_Group_ID") & "','"
		Sub_String = Split(Form_String(i), "=", -1)
		If Not (Sub_String(1) = "") Then
			SQL = SQL & Sub_String(0) & "','" & Sub_String(1) & "', '1'"
			Conn.Execute (SQL)
			Room_Total = Room_Total + Sub_String(1)
		End If
		i=i+1
    Loop 
    
    'Checking total number of room, and updating as required 
    If Not Room_Total = Enitiy_Room_Total Then
		SQL_RM = "Update_Attribute @Group_ID='" & Session("Admin_Group_ID") & "', @Att_ID = '503', @Variable='" & Room_Total & "', @Page='1'"
		'Response.Write(SQL_RM)
		Conn.Execute(SQL_RM)
	End If
    
    'Response.End
    If Request.Form("cont") = "1" Then Response.Redirect "default-lodging.asp"
    If Request.Form("cont") = "2" Then Response.Redirect "room-features_admin_list.asp"

End If
%>

<% ' Getting Header information for the page based on the group id
	Dim SQL2, RS2

	SQL2 = "get_entity_from_group @Group_ID='" & Session("Admin_Group_ID") & "'"
	
	Set RS2=Conn.Execute(SQL2)
 
	'Response.Write Session("Group_ID")
%>

<%' Getting total number of rooms entered for this Property
	Dim SQL3, RS3, Enitiy_Room_Total
	
	SQL3 = "Get_Attribute_Values @GroupID='" & Session("Admin_Group_ID") & "', @Att_ID = '503'" 'Att_ID is for Total Number of Guest Rooms
	
	Set RS3 = Conn.Execute(SQL3)
	
	
%>

<%' Getting data for page if avaiable for autofilling page
	Dim SQL4, RS4
	Dim Num_Room_Types, Rows, Cols, iRows, iCols
	Dim Rooms(1000) ' Must enter the max number of the att_ID to be displayed on this page
	
	SQL4="Get_Attribute_Values @GroupID='" & Session("Admin_Group_ID") & "', @Att_group_id='7'" 'Att_Group_ID = 7 displays only the Lodging-Accomodation-Types Attributes
	'Response.Write SQL4
	
	Set RS4 = Conn.Execute(SQL4)
		
	If Not RS4.EOF Then
		Num_Room_Types = RS4.GetRows() 'Builds Array from SQL Call
		
		Cols = Ubound(Num_Room_Types,1) ' Getting total number of Cols in Array (-1)  Array starts at xx(0,0,...)
		Rows = Ubound(Num_Room_Types,2) ' Getting total number of Rows in Array (-1)  Array starts at xx(0,0,...)
		
		For iRows = 0 to Rows
			Rooms(Int(Num_Room_Types(4,iRows)))=Num_Room_Types(3,iRows)
			'Response.Write Num_Room_Types(3,iRows) & "<br>"
			'Response.Write " -" & Rooms(Num_Room_Types(4,iRows)) & "-  " 
		Next
	End If
	
%>
<html>
<STYLE>
BODY {SCROLLBAR-FACE-COLOR: #5e5ebe; SCROLLBAR-HIGHLIGHT-COLOR: #5e5ebe; SCROLLBAR-SHADOW-COLOR: #5e5ebe; SCROLLBAR-3DLIGHT-COLOR: #5e5ebe; SCROLLBAR-ARROW-COLOR:  #6666CC; SCROLLBAR-TRACK-COLOR: #E3E3E3; SCROLLBAR-DARKSHADOW-COLOR: #666666; }
</STYLE>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Sub_Form(cont) {
form1.cont.value=cont;
form1.submit();

}

//-->
</script>
<link rel="stylesheet" href="../Style-sheets/standard-input-form.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/galley-text-indent.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/Lodging-display.css" type="text/css">
</head>

<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/icon-return-to-main-2.gif','images/icon-submit-changes-2.gif','images/icon-continue-wizard-2.gif')">
<form name="form1" method="post" action="">
<INPUT type="hidden" id=page name=page value="<%=Page%>">
<INPUT type="hidden" id=cont name=cont >
  <table width="525" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr> 
      <td width="338">&nbsp;</td>
      <td align="right" width="187">&nbsp;</td>
    </tr>
    <tr> 
      <td width="338" bgcolor="#5e5ebe" class="headline-ffffff" 

align="middle">  Manage Room Types</td>

      <td bgcolor="#5e5ebe" align="right" width="187"><A onmouseover="MM_swapImage('Image1','','images/icon-return-to-main-2.gif',1)" onmouseout=MM_swapImgRestore() href="default-lodging.asp"><IMG height=17 src="images/icon-return-to-main.gif" width=75 useMap=#returntomain border=0 name=Image1></A></td>
    </tr>
    <% If Not RSName.EOF Then %>
    <tr> 
      <td class="galley-text-indent" colspan="2"><%=RSName("Name")%>                   - <%=RSName("City")%>                     , 
        <%=RSName("State")%>&nbsp; <%=RSName("ZIP")%></td>
    </tr>
    <% Else %>
    <tr> 
      <td class="galley-text-indent-alert" colspan="2">No Entity Selected! Go 
        back and choose a location to edit from the dropdown menu.</td>
    </tr>
    <% End If %>
    <% RSName.Close %>
  </table>
  <table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
  
  <TR>
    <TD align=right class=manage-menu width=146>Total of</TD>
    <TD class=manage-menu noWrap width=275>&nbsp;
		<% ' Displaying total number of rooms on property
			If Not RS3.EOF Then
				Enitiy_Room_Total = RS3("Variable")
				Response.Write Enitiy_Room_Total & "&nbsp;&nbsp;&nbsp;&nbsp;Rooms on Property"
			Else
				Response.Write "N/A"
			End If
			RS3.Close		
		%>
	</TD>
  </TR>
  <TR>
    <TD class=manage-menu width=146 colSpan=2>&nbsp;</TD></TR>
    <tr> 
      <td width="146" class="manage-menu">Singles</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="411" size="4" <% If Rooms(411)> 0 Then Response.Write "Value='" & Rooms(411) & "'" Else Response.Write "Value='0'" End If %>>
        Total Inventory on Property</td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Double Singles</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="550" size="4" <% If Rooms(550)> 0 Then Response.Write "Value='" & Rooms(550) & "'" Else Response.Write "Value='0'" End If %>
     >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Single Doubles</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="412" size="4" <% If Rooms(412)> 0 Then Response.Write "Value='" & Rooms(412) & "'" Else Response.Write "Value='0'" End If %>
     >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu" height="27">Double Doubles</td>
      <td width="275" class="manage-menu" nowrap height="27"> 
        <input name="142" size="4" <% If Rooms(142)> 0 Then Response.Write "Value='" & Rooms(142) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Single Kings</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="413" size="4" <% If Rooms(413)> 0 Then Response.Write "Value='" & Rooms(413) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Double Kings</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="143" size="4" <% If Rooms(143)> 0 Then Response.Write "Value='" & Rooms(143) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Single Queens</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="414" size="4" <% If Rooms(414)> 0 Then Response.Write "Value='" & Rooms(414) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Double Queens</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="144" size="4" <% If Rooms(144)> 0 Then Response.Write "Value='" & Rooms(144) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Suites</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="435" size="4" <% If Rooms(435)> 0 Then Response.Write "Value='" & Rooms(435) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Apartments</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="551" size="4" <% If Rooms(551)> 0 Then Response.Write "Value='" & Rooms(551) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Condominiums</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="552" size="4" <% If Rooms(552)> 0 Then Response.Write "Value='" & Rooms(552) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Cottages</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="553" size="4" <% If Rooms(553)> 0 Then Response.Write "Value='" & Rooms(553) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="manage-menu">Houses</td>
      <td width="275" class="manage-menu" nowrap> 
        <input name="554" size="4" <% If Rooms(554)> 0 Then Response.Write "Value='" & Rooms(554) & "'" Else Response.Write "Value='0'" End If %> >
        Total Inventory on Property </td>
    </tr>
    <tr> 
      <td width="146" class="standard-input-form">&nbsp;</td>
      <td width="275" class="standard-input-form">&nbsp;</td>
    </tr>
  </table>
  <table width="525" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr bgcolor="#5e5ebe"> 
    <td align="right" width="49%"><A onmouseover="MM_swapImage('submitchanges','','images/icon-submit-changes-2.gif',1)" onmouseout=MM_swapImgRestore() href="javascript:Sub_Form('1');"><IMG height=15 src="images/icon-submit-changes.gif" width=200 border=0 name=submitchanges></A></td>
    <td width="51%"><A onmouseover="MM_swapImage('Image2','','images/icon-continue-wizard-2.gif',1)" onmouseout=MM_swapImgRestore() href="javascript:Sub_Form('2');"><IMG height=15 src="images/icon-continue-wizard.gif" width=150 useMap=#continue border=0 name=Image2></A></td>
  </tr>
  <tr> 
    <td width="49%">&nbsp;</td>
    <td width="51%">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
