<%

Dim Page 
Page = "52"

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

If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("page") = Page) Then

    If Request.Form("cont") = "1" Then Response.Redirect "default.asp"
    If Request.Form("cont") = "2" Then Response.Redirect "package-create-8.asp"

End If


Function PCase(strInput)
    Dim iPosition 
    Dim iSpace 
    Dim strOutput 

    iPosition = 1

    Do While InStr(iPosition, strInput, " ", 1) <> 0
            iSpace = InStr(iPosition, strInput, " ", 1)
            strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))
            strOutput = strOutput & LCase(Mid(strInput, iPosition + 1, iSpace - iPosition))
            iPosition = iSpace + 1
    Loop

    strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))
    strOutput = strOutput & LCase(Mid(strInput, iPosition + 1))

    PCase = strOutput
End Function

Function FCurrency(Amount)

	Amount = Replace(Replace(FormatCurrency(Amount, 2, -1, 0, -1), "$", ""), ",", "")
	FCurrency = Amount

End Function

%>
<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 Sub_Form (cont)
{
  form1.cont.value=cont
  form1.submit();
}

function formatPerc(perc1) {
	var perc = perc1 * .01;
	return perc;
}

function formatPrice(value) {

    value = "" + value;
    var deci = 0;
    var precision = 2;

    if (value.substring(0, 1) == '.' || value.substring(0, 2) == '0.' || value.substring(0, 3) == '00.') deci = 1;

    var whole = "" + Math.round(value * Math.pow(10, precision));
    var decPoint = whole.length - precision;
    if(decPoint != 0) {
        result = whole.substring(0, decPoint);
        result += ".";
        result += whole.substring(decPoint, whole.length);
    } else  {
        result = whole;
    }
    
    if (deci == 1) result = "." + result;

    return result;
}

function markitup (itemtype, item, package) {

	var first = 'P' + package;
	var second = first + '_' + itemtype;
	var markup = second + '_Markup' + item;
	var total = second + '_Total' + item;
	var cost = second + '_Cost' + item;

	objitemtotal	= MM_findObj(total);
	objitemcost	= MM_findObj(cost);
	objitemmarkup	= MM_findObj(markup);

	var itemamount = parseFloat(objitemcost.value);
	var itemmarkup = parseFloat(formatPerc(objitemmarkup.value));

	var itemtotal = itemamount * itemmarkup;

	objitemtotal.value = formatPrice(itemamount + itemtotal);

}

function priceRefresh() {

  var i, args=priceRefresh.arguments; 

  var package = args[0];
  var markup;
  var itemobj;
  var subtotal = 0;
  var tax = 0;
  var total = 0;
  var nightly = 0;
  
  objsubtotal = MM_findObj('subtotal' + package);
  objtax = MM_findObj('tax' + package);
  objtotal = MM_findObj('total' + package);
  objnightly = MM_findObj('nightly' + package);
  
  var num_nights = parseInt(form1.Num_Nights.value);

  for (i=1; i<=(args.length -2); i+=2) {
	objitemtotal = MM_findObj(args[i]);
	objitemtaxrate = MM_findObj(args[i+1]);
	
	itemtotal = formatPrice(objitemtotal.value);
	itemtaxrate = parseFloat(objitemtaxrate.value);

	itemtax = formatPrice(parseFloat(itemtotal * itemtaxrate));
	tax = formatPrice(parseFloat(parseFloat(tax) + parseFloat(itemtax)));

	subtotal = formatPrice(parseFloat(parseFloat(subtotal) + parseFloat(itemtotal)));
  } 

  total = formatPrice(parseFloat(parseFloat(subtotal) + parseFloat(tax)));
  nightly = formatPrice(parseFloat(parseFloat(total) / num_nights));
	
  objsubtotal.value = subtotal;
  objtax.value = tax;
  objtotal.value = total;
  objnightly.value = nightly;

}
//-->
</script>
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/arrivares.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/standard-input-form.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="package-create-8.asp">
<INPUT type="hidden" id=page name=page value="<%=Page%>">
<INPUT type="hidden" id=cont name=cont value="">
<%
For Each item in Request.Form
  If Not UCase(item) = "PAGE" And Not UCase(item) = "CONT" Then
	For each value in Request.Form(item)
%>		<input type="hidden" name="<%=item%>" value="<%=value%>">
<%
	Next
  End If
Next
%>
<br>
<table width="525" border="0" cellspacing="0" cellpadding="2" align="center">
  <tr bgcolor="#5e5ebe">
    <td width="467" align="center" class="headline-ffffff" bgcolor="#5e5ebe
">Package 
      Item Pricing</td>
    <td bgcolor="#5e5ebe" align="right" width="58"><a href="javascript:;" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','images/icon-return-to-main-2.gif',1)" onClick="MM_goToURL('parent','default.asp');return document.MM_returnValue"><img src="images/icon-return-to-main.gif" width="75" height="17" usemap="#returntomain" border="0" name="Image1"></a></td>
  </tr>
  <tr> 
    <td width="467" class="sm-hdln"><%= Request("Package_Name") & " - " & Request("Package_Type") %></td>
    <td width="58" class="sm-hdln">&nbsp;</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
      <td width="467">&nbsp;</td>
      <td align="right" width="58">&nbsp;</td>
  </tr>
</table>

<%

	Dim Amount
	Dim Hotel_Group
	Dim Count, Item_Array
	Dim First_Run
	Dim Tax, Tax_Rate
	
	Count = 1
	Item_Array = ""

	For each Room_Item in Request.Form("Room_Items")

		'Death to Taxes
		Tax = 0
		Tax_Rate = 0
		Amount = 0
		First_Run = True
		
		'Set Item Array to blank... fixes damn priceRefresh problem!! :)
		Item_Array = ""		

		Set RSList = Conn.Execute("Get_Lodging_List_ID_From_Item_Smart @Item_ID='" & Room_Item & "'")
		
		Hotel_Group = Request.Form("Room_Item_Group" & Room_Item)
		Room_Occupancy = Int(Request.Form("Room_Item_Occ" & Room_Item))
		Room_Name = Request.Form("Room_Item_Name" & Room_Item)
		Room_Quantity = Int(Request.Form("Num_Rooms"))

		Room_Cost = FCurrency(Request.Form("Room_Item_Cost" & Room_Item))
		Room_Nights = Int(Request.Form("Num_Nights"))
		Room_Rate = FCurrency(Room_Cost * Room_Quantity * Room_Nights)		
		
		Room_List_ID = RSList("Inventory_List_ID")
		Lodging_Name = Request.Form("Lodging_Name" & Hotel_Group)
		Stay = Request.Form("pdurname" & Request.Form("Package_Duration_ID"))

		SQLTax = "Get_Tax_Costs_Lodging @Inventory_List_ID='" & Room_List_ID & "', @Cost='" & Room_Rate & "'"
'Response.Write SQLTax
		Set RSTax = Conn.Execute(SQLTax)

		Room_Tax = FCurrency(RSTax("Total_Tax"))
		Room_Tax_Rate = RSTax("Total_Rate")	
		Tax_Rate = CCur(Tax_Rate + CCur(Room_Tax_Rate))
'Response.Write ("Tax: " & Room_Rate & ":" & Room_Tax_Rate & "<br>")

		Tax = FCurrency(CCur(Tax) + CCur(RSTax("Total_Tax")))
		Amount = FCurrency(Amount + Room_Rate)

		Set RSList = Nothing		
%>
<input type="hidden" name="Packages" value="<%=Count%>">
<input type="hidden" name="Room_Item_Package<%=Room_Item%>" value="<%=Count%>">
<input type="hidden" name="P<%=Count%>_Room_Item_Tax<%=Room_Item%>" id="P<%=Count%>_Room_Item_Tax<%=Room_Item%>" value="<%=Room_Tax_Rate%>">

<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
      <td bgcolor="#5e5ebe
">&nbsp;</td>
      <td colspan="4" class="headline-ffffff" bgcolor="#5e5ebe
"><%= Request("Package_Name") %>: Package #<%= Count %></td>
    </tr>
    <tr>
		<td colspan="5" bgcolor="#777799" text="#ffffff"><table border="0" cellspacing="0" cellpadding="0" width="100%">
		 <tr><td width="30%">&nbsp;</td><td align="right" class="manage-menu"><font color="#e3e3e3" size="1">Effective Date: <input type="text" name="Effective_Date<%=Count%>" value="<%= FormatDateTime(Date(),2)%>" size="10" class="input-box">&nbsp;</td>
		 <td align="right" class="manage-menu"><font color="#e3e3e3" size="1">Expiry Date: <input type="text" name="Expire_Date<%=Count%>" value="" size="10" class="input-box">&nbsp;</td>
		 </tr></table></td>
    </tr>
    <tr bgcolor="#777799"> 
      <td colspan="5" height="2"><img src="images/shim.gif" size="2" height="2"></td>
    </tr>
    <tr>
      <td width="10" bgcolor="#CCCCCC">&nbsp;</td>
      <td width="298" class="standard-input-form-small" bgcolor="#CCCCCC">Selected Items</td>
      <td width="69" align="center" bgcolor="#E6EEFF" class="standard-input-form-small">Single Cost</td>
      <td width="63" align="center" bgcolor="#BBDDFF" class="standard-input-form-small">Total Cost</td>
      <td width="60" class="standard-input-form-small" align="center" bgcolor="#CCCCCC">Markup % </td>
    </tr>
    <tr> 
      <td></td>
      <td colspan="4" class="standard-input-form">&nbsp;</td>
    </tr>
    <tr bgcolor="#e7e7e7"> 
      <td></td>
      <td colspan="4" class="standard-input-form" height="13">&nbsp;<%= PCase(Lodging_Name) %> -</td>
    </tr>
    <tr bgcolor="#cccccc">
      <td></td>
      <td colspan="4" align="left" class="manage-menu"><font size="2">&nbsp;&nbsp;&nbsp;<%= Room_Name %></font></td>
    </tr>
    <tr>
      <td></td>
      <td class="standard-input-form"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Occupancy: <%= Room_Occupancy %> | <%= Room_Nights %> Night(s) | <%= Room_Quantity %> Room(s) &nbsp;&nbsp;&nbsp;</font></div></td>
      <td bgcolor="#E6EEFF" class="input-box" height="13" align="center"><%= Room_Cost %></td>
      <td bgcolor="#BBDDFF" class="input-box" height="13" align="center"><input type="text" name="P<%=Count%>_Room_Item_Cost<%=Room_Item%>" value="<%= Room_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center;" size="12" class="roomdetails-plain"></td>
      <td height="13" align="center" bgcolor="#CCCCCC"><input type="text" name="P<%=Count%>_Room_Item_Markup<%=Room_Item%>" size="2" class="input-box" onKeyUp="markitup('Room_Item', '<%=Room_Item%>', '<%=Count%>');"><input type="text" name="P<%=Count%>_Room_Item_Total<%=Room_Item%>" value="<%= Room_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center; vertical-align:top;" size="6" class="roomdetails-plain">
      </td>
    </tr>
<%
	If First_Run = True Then
		Item_Array = Item_Array & "'P" & Count & "_Room_Item_Total" & Room_Item & "'"
		Item_Array = Item_Array & ", 'P" & Count & "_Room_Item_Tax" & Room_Item & "'"
		First_Run = False
	Else
		Item_Array = Item_Array & ", 'P" & Count & "_Room_Item_Total" & Room_Item & "'"
		Item_Array = Item_Array & ", 'P" & Count & "_Room_Item_Tax" & Room_Item & "'"
	End If



	Prev_Name = ""

For each Item in Request.Form("Items_" & Hotel_Group)
	Item_Item_Name = Request.Form("Item_ItemName" & Item)
	Item_Name = Request.Form("Item_Name" & Item)
	Item_Cost = FCurrency(Request.Form("Item_Cost" & Item))
	Item_Quantity = Int(Request.Form("Item_Quantity" & Item))
	Item_Rate = FCurrency(Item_Cost * Item_Quantity)
	Item_Group = Request.Form("Item_Group" & Item)
	
	Amount = FCurrency(Amount + CCur(Att_Cost * Att_Quantity))

	SQLTax = "Get_Tax_Costs_Merchandise @Inventory_List_ID='" & Item & "', @Cost='" & Item_Rate & "'"
	Set RSTax = Conn.Execute(SQLTax)

	Item_Tax = FCurrency(RSTax("Total_Tax"))
	Tax = FCurrency(CCur(Tax) + CCur(RSTax("Total_Tax")))
	
	Item_Tax_Rate = RSTax("Total_Rate")	
	Tax_Rate = CCur(Tax_Rate + CCur(Item_Tax_Rate))
'Response.Write ("Tax: " & Item_Rate & ":" & Item_Tax_Rate & "<br>")

%>
<% If Not UCase(Prev_Name) = UCase(Item_Name) Then %>
    <tr> 
      <td></td>
      <td colspan="4" class="event-date-sm">&nbsp;</td>
    </tr>
    <tr bgcolor="#e7e7e7"> 
	  <td></td>
      <td colspan="4" class="standard-input-form" height="13"><table border="0" cellspacing="0" cellpadding="0" width="100%"><td align="left" class="standard-input-form">&nbsp;<%= Item_Name %> -</td><td align="right" class="manage-menu"><font size="1"><!--<input type="radio" name="logo<%=Count%>" value="<%=Hotel_Group%>"> Display Logo?&nbsp;</font>--></td></tr></table></td>
    </tr>
<% End If %>
    <tr bgcolor="#CCCCCC"> 
      <td></td>
      <td colspan="4" height="13" class="manage-menu"><font size="2">&nbsp;&nbsp;&nbsp;<%= Item_Item_Name %></font>    
    </tr>
    <tr> 
      <td><input type="hidden" name="P<%=Count%>_Item_Tax<%=Item%>" id ="P<%=Count%>_Item_Tax<%=Item%>" value="<%= Item_Tax_Rate %>"></td>
      <td class="standard-input-form" height="13"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity: <%= Item_Quantity %>&nbsp;&nbsp;&nbsp;</font></div></td>
      <td bgcolor="#E6EEFF" class="input-box" height="13" align="center"><%= Item_Cost %></td>
      <td bgcolor="#BBDDFF" class="input-box" height="13" align="center"><input type="text" name="P<%=Count%>_Item_Cost<%=Item%>" value="<%= Item_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center;" size="12" class="roomdetails-plain"></td>
      <td height="13" align="center" bgcolor="#CCCCCC"> 
        <input type="text" name="P<%=Count%>_Item_Markup<%=Item%>"  size="2" class="input-box" onKeyUp="markitup('Item', '<%=Item%>', '<%=Count%>');"><input type="text" name="P<%=Count%>_Item_Total<%=Item%>" value="<%= Item_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center; vertical-align:top;" size="6" class="roomdetails-plain">
      </td>
    </tr>
<%
	Prev_Name = ITem_Name
	Item_Array = Item_Array & ", 'P" & Count & "_Item_Total" & Item & "'"
	Item_Array = Item_Array & ", 'P" & Count & "_Item_Tax" & Item & "'"
Next

	Prev_Name = ""

For each Att_Item in Request.Form("Att_Items")
	Att_Item_Name = Request.Form("Att_ItemName" & Att_Item)
	Att_Name = Request.Form("Att_Name" & Att_Item)
	Att_Cost = FCurrency(Request.Form("Att_Cost" & Att_Item))
	Att_Quantity = Int(Request.Form("Att_Quantity" & Att_Item))
	Att_Rate = FCurrency(Att_Cost * Att_Quantity)
	Att_Group = Request.Form("Att_Group" & Att_Item)
	
	Amount = FCurrency(Amount + CCur(Att_Cost * Att_Quantity))

	SQLTax = "Get_Tax_Costs_Merchandise @Inventory_List_ID='" & Att_Item & "', @Cost='" & Att_Rate & "'"
	Set RSTax = Conn.Execute(SQLTax)

	Att_Tax = FCurrency(RSTax("Total_Tax"))
	Tax = FCurrency(CCur(Tax) + CCur(RSTax("Total_Tax")))
	
	Att_Tax_Rate = RSTax("Total_Rate")	
	Tax_Rate = CCur(Tax_Rate + CCur(Att_Tax_Rate))
'Response.Write ("Tax: " & Att_Rate & ":" & Att_Tax_Rate & "<br>")

%>
<% If Not UCase(Prev_Name) = UCase(Att_Name) Then %>
    <tr> 
      <td></td>
      <td colspan="4" class="event-date-sm">&nbsp;</td>
    </tr>
    <tr bgcolor="#e7e7e7"> 
	  <td></td>
      <td colspan="4" class="standard-input-form" height="13"><table border="0" cellspacing="0" cellpadding="0" width="100%"><td align="left" class="standard-input-form">&nbsp;<%= PCase(Att_Name) %> -</td><td align="right" class="manage-menu"><font size="1"><input type="radio" name="logo<%=Count%>" value="<%=Att_Group%>"> Display Logo?&nbsp;</font></td></tr></table></td>
    </tr>
<% End If %>
    <tr bgcolor="#CCCCCC"> 
      <td></td>
      <td colspan="4" height="13" class="manage-menu"><font size="2">&nbsp;&nbsp;&nbsp;<%= Att_Item_Name %></font>    
    </tr>
    <tr> 
      <td><input type="hidden" name="P<%=Count%>_Att_Item_Tax<%=Att_Item%>" id ="P<%=Count%>_Att_Item_Tax<%=Att_Item%>" value="<%= Att_Tax_Rate %>"></td>
      <td class="standard-input-form" height="13"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity: <%= Att_Quantity %>&nbsp;&nbsp;&nbsp;</font></div></td>
      <td bgcolor="#E6EEFF" class="input-box" height="13" align="center"><%= Att_Cost %></td>
      <td bgcolor="#BBDDFF" class="input-box" height="13" align="center"><input type="text" name="P<%=Count%>_Att_Item_Cost<%=Att_Item%>" value="<%= Att_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center;" size="12" class="roomdetails-plain"></td>
      <td height="13" align="center" bgcolor="#CCCCCC"> 
        <input type="text" name="P<%=Count%>_Att_Item_Markup<%=Att_Item%>"  size="2" class="input-box" onKeyUp="markitup('Att_Item', '<%=Att_Item%>', '<%=Count%>');"><input type="text" name="P<%=Count%>_Att_Item_Total<%=Att_Item%>" value="<%= Att_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center; vertical-align:top;" size="6" class="roomdetails-plain">
      </td>
    </tr>
<%
	Prev_Name = Att_Name
	Item_Array = Item_Array & ", 'P" & Count & "_Att_Item_Total" & Att_Item & "'"
	Item_Array = Item_Array & ", 'P" & Count & "_Att_Item_Tax" & Att_Item & "'"
Next


Prev_Name = ""
For each Merch_Item in Request.Form("Merch_Items")
	Merch_Item_Name = Request.Form("Merch_ItemName" & Merch_Item)
	Merch_Name = Request.Form("Merch_Name" & Merch_Item)
	Merch_Cost = FCurrency(Request.Form("Merch_Cost" & Merch_Item))
	Merch_Quantity = Int(Request.Form("Merch_Quantity" & Merch_Item))
	Merch_Rate = FCurrency(Merch_Cost * Merch_Quantity)
	Merch_Group = Request.Form("Merch_Group" & Merch_Item)
	
	Amount = FCurrency(Amount + CCur(Merch_Cost * Merch_Quantity))

	SQLTax = "Get_Tax_Costs_Merchandise @Inventory_List_ID='" & Merch_Item & "', @Cost='" & Merch_Rate & "'"
	Set RSTax = Conn.Execute(SQLTax)

	Merch_Tax = FCurrency(RSTax("Total_Tax"))
	Tax = FCurrency(CCur(Tax) + CCur(RSTax("Total_Tax")))
	
	Merch_Tax_Rate = RSTax("Total_Rate")	
	Tax_Rate = CCur(Tax_Rate + CCur(Merch_Tax_Rate))
'Response.Write ("Tax: " & Merch_Rate & ":" & Merch_Tax_Rate & "<br>")

%>
<% If Not UCase(Prev_Name) = UCase(Merch_Name) Then %>
    <tr> 
      <td></td>
      <td colspan="4" class="event-date-sm">&nbsp;</td>
    </tr>
    <tr bgcolor="#e7e7e7"> 
	  <td></td>
      <td colspan="4" class="standard-input-form" height="13"><table border="0" cellspacing="0" cellpadding="0" width="100%"><td align="left" class="standard-input-form">&nbsp;<%= PCase(Merch_Name) %> -</td><td align="right" class="manage-menu"><font size="1"><input type="radio" name="logo<%=Count%>" value="<%=Merch_Group%>"> Display Logo?&nbsp;</font></td></tr></table></td>
    </tr>
<% End If %>
    <tr bgcolor="#CCCCCC"> 
      <td></td>
      <td colspan="4" height="13" class="manage-menu"><font size="2">&nbsp;&nbsp;&nbsp;<%= Merch_Item_Name %></font>    
    </tr>
    <tr> 
      <td><input type="hidden" name="P<%=Count%>_Merch_Item_Tax<%=Merch_Item%>" id ="P<%=Count%>_Merch_Item_Tax<%=Merch_Item%>" value="<%= Merch_Tax_Rate %>"></td>
      <td class="standard-input-form" height="13"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity: <%= Merch_Quantity %>&nbsp;&nbsp;&nbsp;</font></div></td>
      <td bgcolor="#E6EEFF" class="input-box" height="13" align="center"><%= Merch_Cost %></td>
      <td bgcolor="#BBDDFF" class="input-box" height="13" align="center"><input type="text" name="P<%=Count%>_Merch_Item_Cost<%=Merch_Item%>" value="<%= Merch_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center;" size="12" class="roomdetails-plain"></td>
      <td height="13" align="center" bgcolor="#CCCCCC"> 
        <input type="text" name="P<%=Count%>_Merch_Item_Markup<%=Merch_Item%>"  size="2" class="input-box" onKeyUp="markitup('Merch_Item', '<%=Merch_Item%>', '<%=Count%>');"><input type="text" name="P<%=Count%>_Merch_Item_Total<%=Merch_Item%>" value="<%= Merch_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center; vertical-align:top;" size="6" class="roomdetails-plain">
      </td>
    </tr>
<%
	Prev_Name = Merch_Name
	Item_Array = Item_Array & ", 'P" & Count & "_Merch_Item_Total" & Merch_Item & "'"
	Item_Array = Item_Array & ", 'P" & Count & "_Merch_Item_Tax" & Merch_Item & "'"
Next


%>
<% Prev_Name = ""
For each Food_Bev_Item in Request.Form("Food_Bev_Items")
	Food_Bev_Item_Name = Request.Form("Food_Bev_ItemName" & Food_Bev_Item)
	Food_Bev_Name = Request.Form("Food_Bev_Name" & Food_Bev_Item)
	Food_Bev_Cost = FCurrency(Request.Form("Food_Bev_Cost" & Food_Bev_Item))
	Food_Bev_Quantity = Int(Request.Form("Food_Bev_Quantity" & Food_Bev_Item))
	Food_Bev_Rate = FCurrency(Food_Bev_Cost * Food_Bev_Quantity)
	Food_Bev_Group = Request.Form("Food_Bev_Group" & Food_Bev_Item)
	Amount = FCurrency(Amount + CCur(Food_Bev_Cost * Food_Bev_Quantity))

	SQLTax = "Get_Tax_Costs_Merchandise @Inventory_List_ID='" & Food_Bev_Item & "', @Cost='" & Food_Bev_Rate & "'"
	Set RSTax = Conn.Execute(SQLTax)

	Food_Bev_Tax = FCurrency(RSTax("Total_Tax"))
	Tax = FCurrency(CCur(Tax) + CCur(RSTax("Total_Tax")))

	Food_Bev_Tax_Rate = RSTax("Total_Rate")	
	Tax_Rate = CCur(Tax_Rate + CCur(Food_Bev_Tax_Rate))
'Response.Write ("Tax: " & Food_Bev_Rate & ":" & Food_Bev_Tax_Rate & "<br>")

%>
<% If Not UCase(Prev_Name) = UCase(Food_Bev_Name) Then %>
    <tr> 
      <td></td>
      <td colspan="4" class="standard-input-form">&nbsp;</td>
    </tr>
    <tr bgcolor="#e7e7e7"> 
      <td></td>
      <td colspan="4" class="standard-input-form" height="13"><table border="0" cellspacing="0" cellpadding="0" width="100%"><td align="left" class="standard-input-form">&nbsp;<%= PCase(Food_Bev_Name) %> -</td><td align="right" class="manage-menu"><!--<font size="1"><input type="radio" name="logo<%=Count%>" value="<%=Food_Bev_Group%>"> Display Logo?&nbsp;</font>--></td></tr></table></td>
    </tr>
<% End If %>
    <tr bgcolor="#CCCCCC"> 
      <td></td>
      <td colspan="4" height="13" class="manage-menu"><font size="2" color="#000099">&nbsp;&nbsp;&nbsp;<%= Food_Bev_Item_Name %></font>    
    </tr>
    <tr> 
      <td><input type="hidden" name="P<%=Count%>_Food_Bev_Item_Tax<%=Food_Bev_Item%>" id="P<%=Count%>_Food_Bev_Item_Tax<%=Food_Bev_Item%>" value="<%= Food_Bev_Tax_Rate %>"></td>
      <td class="standard-input-form" height="13"><div align="right" class="manage-menu"><font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity: <%= Food_Bev_Quantity %>&nbsp;&nbsp;&nbsp;</font></div></td>
      <td bgcolor="#E6EEFF" class="input-box" height="13" align="center"><%= Food_Bev_Cost %></td>
      <td bgcolor="#BBDDFF" class="input-box" height="13" align="center"><input type="text" name="P<%=Count%>_Food_Bev_Item_Cost<%=Food_Bev_Item%>" value="<%= Food_Bev_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center;" size="12" class="roomdetails-plain"></td>
      <td height="13" align="center" bgcolor="#CCCCCC"><input type="text" name="P<%=Count%>_Food_Bev_Item_Markup<%=Food_Bev_Item%>" size="2" class="input-box" onKeyUp="markitup('Food_Bev_Item', '<%=Food_Bev_Item%>', '<%=Count%>');"><input type="text" name="P<%=Count%>_Food_Bev_Item_Total<%=Food_Bev_Item%>" value="<%= Food_Bev_Rate %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; text-align:center; vertical-align:top;" size="6" class="roomdetails-plain"></td>
    </tr>
<%
	Prev_Name = Food_Bev_Name
	Item_Array = Item_Array & ", 'P" & Count & "_Food_Bev_Item_Total" & Food_Bev_Item & "'"
	Item_Array = Item_Array & ", 'P" & Count & "_Food_Bev_Item_Tax" & Food_Bev_Item & "'"
Next

%>
    <tr> 
      <td colspan="4" class="event-date-sm">&nbsp;</td>
      <td class="event-date-sm" align="center" bgcolor="#e3e3e3"><a onClick="priceRefresh('<%=Count%>', <%=Item_Array%>)" style="{cursor:hand; text-decoration:none; background-color:#e3e3e3;}" class="event-date-sm">Refresh Pricing</a></td>
    </tr>
    <tr> 
      <td></td>
      <td colspan="4" class="event-date-sm">&nbsp;</td>
    </tr>
    <tr> 
      <td></td>
      <td class="standard-input-form">&nbsp;Sub Total:</td>
      <td>&nbsp;</td>
      <td class="standard-input-form" align="right">$&nbsp;</td>
      <td><input type="text" name="subtotal<%=Count%>" value="<%= Amount %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none;" size="12" class="roomdetails-plain"></td>
    </tr>
<!--
    <tr> 
      <td></td>
      <td class="standard-input-form">&nbsp;Room Tax:</td>
      <td>&nbsp;</td>
      <td class="standard-input-form" align="right">$&nbsp;</td>
      <td><input type="text" name="roomtax<%=Count%>" value="1 dollah" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; " size="12" class="roomdetails-plain"></td>
    </tr>
-->
    <tr> 
      <td></td>
      <td class="standard-input-form">&nbsp;Total Tax:</td>
      <td>&nbsp;</td>
      <td class="standard-input-form" align="right">$&nbsp;</td>
      <td><input type="text" name="tax<%=Count%>" value="<%= Tax %>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; text-decoration: none; " size="12" class="roomdetails-plain"></td>
    </tr>
<%

Total = FCurrency(CCur(Amount) + CCur(Tax))
Nightly = FCurrency(CCur(CCur(Total) / Room_Nights))

%>
    <tr bgcolor="#BFBFCC"> 
      <td></td>
      <td class="standard-input-form">&nbsp;&nbsp;&nbsp; - Package Total:</td>
      <td class="input-box" align="center">&nbsp;</td>
      <td class="standard-input-form" align="right">$&nbsp;</td>
      <td class="standard-input-form"><input type="text" name="total<%=Count%>" value="<%=Total%>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; font-weight: bold; text-decoration: none; " size="12" class="roomdetails-plain">&nbsp;</td>
    </tr>
    <tr bgcolor="#BFBFCC"> 
      <td></td>
      <td class="standard-input-form">&nbsp;&nbsp;&nbsp; - Nightly Cost:</td>
      <td class="input-box" align="center">&nbsp;</td>
      <td class="standard-input-form" align="right">$&nbsp;</td>
      <td class="standard-input-form"><input type="text" name="nightly<%=Count%>" value="<%= Nightly%>" readonly style="border-style:none; background-color:transparent; color:#000099; font-family: Helvetica, sans-serif; font-size:10px; font-style: normal; font-weight: bold; text-decoration: none; " size="12" class="roomdetails-plain">&nbsp;</td>
    </tr>
    <tr> 
      <td bgcolor="#ffffff"></td>
      <td colspan="4" bgcolor="#ffffff">&nbsp;</td>
    </tr>
    <tr> 
      <td bgcolor="#ffffff"></td>
      <td colspan="4" bgcolor="#ffffff">&nbsp;</td>
    </tr>
  </table>

<%	Count = Count + 1
	Next
%>

<table width="525" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr bgcolor="#5e5ebe">
    <td align="right" width="49%" height="18"><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%" height="18"><a href="javascript:Sub_Form('2');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','images/icon-continue-wizard-2.gif',1)" target="content"><img src="images/icon-continue-wizard.gif" width="150" height="15" 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>
