<!--#include virtual="/includes/topofpage.asp"-->
<%' Setting Page Variables, and Session Variables on Start up.
	Dim Page 
	Page = "19"

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

	'Setting Session Variables
	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

		'Dim Date_Required_Flag
		'Date_Required_Flag = 0

		If Session("Start_Date_Day") = "" Then
			If Request.Form("Start_Day") <> "" Then
				Session("Start_Date_Day") = Request.Form("Start_Day")
				Session("Start_Date_Month") = Request.Form("Start_Month")
				Session("Start_Date_Year") = Request.Form("Start_Year")
				Session("Start_Date") = "" & Session("Start_Date_Month") & "/" & Session("Start_Date_Day") & "/" & Session("Start_Date_Year") & ""
				
				Session("End_Date_Day") = Request.Form("End_Day")
				Session("End_Date_Month") = Request.Form("End_Month")
				Session("End_Date_Year") = Request.Form("End_Year")
				Session("End_Date") = Session("End_Date_Month") & "/" & Session("End_Date_Day") & "/" & Session("End_Date_Year")
			'Else
			'	Date_Required_Flag = 1
				'Response.Write "Please select a date range"
				'Response.Write "Link=MM_openBrWindow('Warning_Date_Required.htm','','scrollbars=no,resizable=no,width=200, height=200')"
				'MM_openBrWindow('Warning_Date_Required.htm','','scrollbars=no,resizable=no,width=200, height=200')
			End If
		End If
	End If	
	'Getting Property Name and Adddress
	Dim SQLName, RSName
	SQLName = "get_entity_from_group @Group_ID='" & Session("Admin_Group_ID") & "'"
	Set RSName=Conn.Execute(SQLName)

%>

<%' Getting Lodging Rooms for Table Definition
	Dim SQL1, RS1, Item_ID(), Room_Type(), Amenity(), Total_On_Prop(), ii, Room_Packages, Count	

	SQL1="Execute Get_Lodging_Rooms @Group_ID='" & Session("Admin_Group_ID") & "'"
	Set RS1 = Conn.Execute(SQL1)
	
	ii=250
	ReDim Item_ID(ii), Room_Type(ii), Amenity(ii), Total_On_Prop(ii)
	
	ii=0
	If Not RS1.EOF Then
		ii=0
		Do While Not rs1.eof
			ii=ii+1
			Item_ID(ii)=RS1("Item_Id")
			Room_Type(ii)=RS1("Att_Desc")
			Amenity(ii)=RS1("Name")
			Total_On_Prop(ii)=RS1("Total_On_Prop")
			'**** Debug Code****
			'	Response.Write ii & " "
			'	Response.Write Item_ID(ii) & " "
			'	Response.Write Room_Type(ii) & " "
			'	Response.Write Amenity(ii) & " "
			'	Response.Write Total_On_Prop(ii) & "<BR> "
			'**** End Debug ****
			RS1.MoveNext
		Loop
		Room_Packages=ii
		'**** Debug Code****
		'Response.Write ii & " "
		'Response.Write Room_Packages & " "
		'For ii=1 to Room_Packages
		'		Response.Write ii & " "
		'		Response.Write Item_ID(ii) & " "
		'		Response.Write Room_Type(ii) & " "
		'		Response.Write Amenity(ii) & " "
		'		Response.Write Total_On_Prop(ii) & "<BR> "
		'Next
		'**** End Debug ****
	End If
%>
<%'Posting Variables on Save
	If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("page") = Page) Then
		
		Realm = Session("Admin_Realm")
		
		'Response.Write "Posting Debug Code <BR>"
		'Response.Write "ii:" & ii & "<BR>"
		
		Dim i, Form_String, Sub_String, Room_Total, Amenity_Package, Attribute_ID, Assigned_Rooms
		Dim SQL, TextField
		
		Form_String = Split(Request.Form, "&", -1)
		
		Dim Item, Allocated, Alarm
		Dim SingleNet, SingleClub, SingleWeb, SinglePref					
		'Dim DoubleNet, DoubleClub, DoubleWeb, DoublePref								
	
		If ii > 0 Then
			'Response.Write "*******************<BR>"				

			For i = 1 to Room_Packages
				'Response.Write (i & "<br>")

					'Item
					    Item = Item_ID(i)

					' Allocated
						TextField = "Allocated" & i
						Allocated = Request.Form(TextField)

					'Alarm
						TextField = "Alarm" & i
						Alarm = Request.Form(TextField)

					' --
					'SingleNet
						TextField = "SingleNet" & i
						SingleNet = Request.Form(TextField)
					'SingleClub
						TextField = "SingleClub" & i
						SingleClub = Request.Form(TextField)
					'SingleWeb
						TextField = "SingleWeb" & i
						SingleWeb = Request.Form(TextField)
					'SinglePref					
						TextField = "SinglePref" & i
						SinglePref = Request.Form(TextField)

					' --
					'DoubleNet
					'	TextField = "DoubleNet" & i
					'	DoubleNet = Request.Form(TextField)
					'DoubleClub
					'	TextField = "DoubleClub" & i
					'	DoubleClub = Request.Form(TextField)
					'DoubleWeb
					'	TextField = "DoubleWeb" & i
					'	DoubleWeb = Request.Form(TextField)
					'DoublePref
					'	TextField = "DoublePref" & i
					'	DoublePref = Request.Form(TextField)

				'Response.Write Allocated & " - " & Alarm & "<BR>"						
				'If Sub_String(1) = "" Then
				'	Response.Write "xx"
				'Else
				'	Response.Write Sub_String(1) & " "
				'End If

				
				'Sub_String = Split(Form_String(i), "=", -1)
				'Amenity_Package = Split(Sub_String(0), "a", -1)
				'Attribute_ID = Split(Amenity_Package(0), "r", -1)
				'Assigned_Rooms = Sub_String(1)
				
				'If (Sub_String(1) = "") Then
				'	Assigned_Rooms = "0"	
				'End If	
						
		SQL = "Add_Inventory_Lodging @Item_ID = '" & Item & "', "
		SQL = SQL & "@Start_Date = '" & Session("Start_Date") & "', @End_Date = '" & Session("End_Date") & "', "
		SQL = SQL & "@Allocation = '" & Allocated & "', @Alarm = '" & Alarm & "', @Realm = '" & Realm & "', "

		'Net
		If SingleNet = "" Then 
			SQL = SQL & "@Rate_SNGL = Null, "
		Else
			SQL = SQL & "@Rate_SNGL = " & SingleNet & ", "
		End If
			
		'If DoubleNet = "" Then
		'	SQL = SQL & "@Rate_DBL = Null, "
		'Else
		'	SQL = SQL & "@Rate_DBL = " & DoubleNet & ", "
		'End If

		'Club
		If SingleClub = "" Then	
			SQL = SQL & "@Cost_Club_SNGL = Null, "
		Else
			SQL = SQL & "@Cost_Club_SNGL = " & SingleClub & ", "
		End If
					
		'If DoubleClub = "" Then
		'	SQL = SQL & "@Cost_Club_DBL = Null, "
		'Else
		'	SQL = SQL & "@Cost_Club_DBL = " & DoubleClub & ", "
		'End If
				
		'Web
		If SingleWeb = "" Then		
			SQL = SQL & "@Cost_Web_SNGL = Null, "
		Else
			SQL = SQL & "@Cost_Web_SNGL = " & SingleWeb & ", "
		End If
			
		'If DoubleWeb = "" Then
		'	SQL = SQL & "@Cost_Web_DBL = Null, "
		'Else
		'	SQL = SQL & "@Cost_Web_DBL = " & DoubleWeb & ", "
		'End If

		'SingleNet, SingleClub, SingleWeb, SinglePref					
		'DoubleNet, DoubleClub, DoubleWeb, DoublePref

		If SinglePref = "" Then
			SQL = SQL & "@Cost_Pref_SNGL = Null"
		Else
			SQL = SQL & "@Cost_Pref_SNGL = " & SinglePref & " "
		End If

		'If DoublePref = "" Then
		'	SQL = SQL & "@Cost_Pref_DBL = Null"
		'Else
		'	SQL = SQL & "@Cost_Pref_DBL = " & DoublePref & " "
		'End If
				Conn.Execute (SQL)
				'Response.Write SQL & "<BR><BR>"

		    Next 
				'Response.Write "*******************<BR>"
	    End If
	    ' Linking to the next page
	    If Request.Form("cont") = "1" Then Response.Redirect "default.asp"
	    If Request.Form("cont") = "2" Then Response.Redirect "calendar.asp"

	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 MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Sub_Form (cont)
{
  form1.cont.value=cont
  form1.submit();
}
//-->
</script>
<link rel="stylesheet" href="../Style-sheets/manage-menu-bold.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">
</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')">
<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">Room Allocations - Initial Load</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.asp"><IMG height=17 src="images/icon-return-to-main.gif" width=75 useMap=#returntomain border=0 name=Image1></A></td>
    </tr>
    <% If RSName.EOF Then %>
    <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>
    <% Else %>
    <tr> 
      <td class="galley-text-indent" colspan="2"><%=RSName("Name")%>             - <%=RSName("City")%>              , 
        <%=RSName("State")%>&nbsp; <%=RSName("ZIP")%></td>
    </tr>
    <% RSName.Close %>
    
    <% ' Checking if a Date is available for assigning rooms
		If Session("Start_Date_Month") ="" Then 
	%>
		<tr> 
		  <td class="galley-text-indent-alert" colspan="2">No Date Range Selected, Date required for this page!  Please return to Define Reservation Window and define the beginning and end dates for these rooms.</td>
		</tr>
	<% ' Checking for Date for Assigning Rooms - If Date is avaialbe
		Else
	%>
    
  </table>
<%If ii > 0 Then %>
  <table width="481" border="0" cellspacing="0" cellpadding="2" align="center">
    <%For Count = 1 to Room_Packages %>
    <tr bgcolor="#cccccc"> 
      <td colspan="2" class="manage-menu-bold" height="9"><%Response.Write Room_Type(count)%>       / <%=Amenity(Count)%></td>
    </tr>
    <tr> 
      <td colspan="2" class="manage-menu"  valign="top"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr align="middle" bgcolor="#003399"> 
            <td colspan="3" class="headline-ffffff">Add 
            Inventory for Date Range <%Response.Write Session("Start_Date_Month")%>                          /<%Response.Write Session("Start_Date_Day")%>                          /<%Response.Write Session("Start_Date_Year")%>                            - <%Response.Write Session("End_Date_Month")%>                          /<%Response.Write Session("End_Date_Day")%>                          /<%Response.Write Session("End_Date_Year")%></td>
          </tr>
          <tr align="middle"> 
            <td width="23%" class="manage-menu">Property Total</td>
            <td width="17%" class="manage-menu">Allocated</td>
            <td width="15%" class="manage-menu">Alarm Level</td>
          </tr>
          <tr align="middle"> 
            <td width="23%" class="manage-menu"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=Total_On_Prop(Count)%></font></td>
            <td width="17%"> 
              <input name="Allocated<%=Count%>" size="4" >
            </td>
            <td width="15%"> 
              <input name="Alarm<%=Count%>" size="4" >
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#cccccc">
          <tr align="middle"> 
            <td class="sm-hdln" width="24%" >&nbsp;</td>
            <td class="sm-hdln" width="16%" >Net</td>
            <td class="sm-hdln" width="15%" >Club</td>
            <td class="sm-hdln" width="19%" >Web</td>
            <td class="sm-hdln" width="26%" >Preferred</td>
          </tr>
          <tr> 
            <td width="24%" class="manage-menu" >Single</td>
            <td width="16%" class="input-box" align="middle" > 
              <input name="SingleNet<%=Count%>" size="5" class="input-box" >
            </td>
            <td width="15%" class="input-box" align="middle" > 
              <input name="SingleClub<%=Count%>" size="5" class="input-box" >
            </td>
            <td width="19%" class="input-box" align="middle" > 
              <input name="SingleWeb<%=Count%>" size="5" class="input-box" >
            </td>
            <td width="26%" class="input-box" align="middle" > 
              <input name="SinglePref<%=Count%>" size="5" class="input-box" >
            </td>
          </tr><!--
          <tr> 
            <td width="24%" class="manage-menu" >DBL</td>
            <td width="16%" class="input-box" align="middle" > 
              <input name="DoubleNet<%=Count%>" size="5" class="input-box" >
            </td>
            <td width="15%" class="input-box" align="middle" > 
              <input name="DoubleClub<%=Count%>" size="5" class="input-box" >
            </td>
            <td width="19%" class="input-box" align="middle" > 
              <input name="DoubleWeb<%=Count%>" size="5" class="input-box" >
            </td>
            <td width="26%" class="input-box" align="middle" > 
              <input name="DoublePref<%=Count%>" size="5" class="input-box" >
            </td>
          </tr>-->
        </table>
      <P>&nbsp;</P>
      </td>
    </tr>
    <%Next%>
  </table>
  <% Else  %>
    <table width="481" border="0" cellspacing="0" cellpadding="2" align="center">
      <tr> 
		<td class="galley-text-indent-alert" colspan="2" ><CENTER>Property Has No Rooms Assigned! Please Go back and Create Room Definitions for this Property.</CENTER></td>
	  </tr>
	</table>
  <% End If 'End of Checking for RS1.EOF %>
  <% End If ' End Checking for Date for Assigning Rooms  %>
  <% End If 'End of check if Entity Selected%>
  <table width="525" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr bgcolor="#5e5ebe"> 
 <!-- -->
      <td align="right" width="49%" bgcolor="#5e5ebe">
		<a href="javascript:Sub_Form('1');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('submitchanges','','images/icon-submit-changes-2.gif',1)">
			<img src="images/icon-submit-changes.gif" width="200" height="15" name="submitchanges" border="0">
		</a>
	  </td>
      <td width="51%">
		<a href="javascript:Sub_Form('2');" onmouseover="MM_swapImage('Image2','','images/icon-continue-wizard-2.gif',1)"  onmouseout=MM_swapImgRestore()>
			<img src="images/icon-continue-wizard.gif" width="150" height="15" usemap="#continue" border="0" name="Image2">
		</a>
	  </td>

 <!-- -->
 <!-- 
      <td align="right" width="49%" bgcolor="#5e5ebe">
		<A onmouseover="MM_swapImage('submitchanges','','images/icon-submit-changes-2.gif',1)" onclick="MM_goToURL('parent','default.asp');return document.MM_returnValue" onmouseout=MM_swapImgRestore() href="javascript:;" >
			<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)" onclick="MM_goToURL('parent','room-rate-allocation_initial.asp');return document.MM_returnValue" onmouseout=MM_swapImgRestore() href="javascript:;" >
			<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>
<%
Set Conn = Nothing
%>