<!--#include virtual="/includes/topofpage.asp"-->
<!--#include file="includes/Pagefunctions.asp"--> 
<%

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

Dim Num_Assign 
Num_Assign = 5 


' Product Types
'
' Inventory_Type_ID
'
'1	Lodging	Lodging Inventory Type for Motel and Hotels
'2	Merchandise	For Item, tickets, etc
'3	Lodging Items	Lodging Item IDs
'4	Merchandise Items	Merchandise Item IDs

Admin_Realm = Request("Admin_Realm")
Entity_Group_ID = Request("Entity_Group_ID")

If Admin_Realm = "" Then Admin_Realm = Session("Admin_Realm")
If Entity_Group_ID = "" Then Entity_Group_ID = Session("Entity_Group_ID")
If Entity_Group_ID = "" Then Entity_Group_ID = "6071"

For Each Package in Request("Packages")

	Room_Item = Request("P" & Package & "_Room_Item")
'	Package = Int(Request.Form("Room_Item_Package" & Room_Item))
	Package_Name = Request.Form("Package_Name")
	Package_Type_ID = Request.Form("P" & Package & "_Package_Type_ID")
	Package_Duration_ID = Request.Form("P" & Package & "_Package_Duration_ID")
	Marketing_Headline = Request.Form("Marketing_Headline")
	Short_Description = Request.Form("Short_Description")
	Long_Description = Request.Form("Long_Description")
	People_Ratio = Request.Form("People_Ratio")
	Time_Share = Request.Form("Time_Share")

	Package_Cost = Request.Form("total" & Package)
	Daily_Cost = Request.Form("Daily" & Package)
	Override_Cost = Request("P" & Package & "_Override_Cost")
	Lowest_Cost = Request("P" & Package & "_Lowest_Cost")

	Package_City = Request.Form("City")
	Package_State = Request.Form("State")
	Package_Country = Request.Form("Country")

	Num_Adults = Request.Form("P" & Package & "_Adults")
	Num_Guests = Request.Form("P" & Package & "_Guests")
	Num_Days = Int(Request.Form("P" & Package & "_Days"))

	Lodging = Request.Form("Lodging")
	Tickets = Request.Form("Tickets")
	Food_Bev = Request.Form("Food_Bev")
	Transport = Request.Form("Transport")

	Disabled = Request.Form("Disabled" & Package)
	Budget = Request.Form("Budget" & Package)

	Item_Logo_Group = Request.Form("logo" & Package)
	
	Effective_Date = Request.Form("Effective_Date" & Package)
	Expire_Date = Request.Form("Expire_Date" & Package)
	
	If Trim(Effective_Date) = "" Then 
		Effective_Date = "NULL"
	Else
		Effective_Date = "'" & Effective_Date & "'"
	End If
	
	If Trim(Expire_Date) = "" Then 
		Expire_Date = "NULL"
	Else
		Expire_Date = "'" & Expire_Date & "'"
	End If

	Inventory_Type_ID = 3 'Lodging Item IDs, not List ID's
	Status = 1 ' Active Package Item

	Room_Group = Request.Form("Room_Item_Group" & Room_Item)
	Lodging_Name = Request.Form("Lodging_Name" & Room_Group)	

	Rate_Occupancy = Int(Request.Form("Room_Item_ROcc" & Room_Item))
	Max_Occupancy = Int(Request.Form("Room_Item_MOcc" & Room_Item))

	Room_Name = Request.Form("Room_Item_Name" & Room_Item)
	Room_Quantity = Int(Request("P" & Package & "_Room_Item_Quantity" & Room_Item))
	Room_Markup = Request.Form("P" & Package & "_Room_Item_Markup" & Room_Item)
	
	If Trim(Room_Markup) = "" Then Room_Markup = "0"

	If Package_Cost = "" Then 
		Package_Cost = "NULL"
	Else
		Package_Cost = "" & Package_Cost & ""
	End If

	If Daily_Cost = "" Then 
		Daily_Cost = "NULL"
	Else
		Daily_Cost = "" & Daily_Cost & ""
	End IF

	If Lowest_Cost = "" Then 
		Lowest_Cost = "NULL"
	Else
		Lowest_Cost = "" & Lowest_Cost & ""
	End IF


	If Override_Cost = "" Then 
		Override_Cost = "NULL"
	Else
		Override_Cost = "" & Override_Cost & ""
	End IF

	SQL = "[Avante].[dbo].[Update_Package] "
	SQL = SQL & "	@Package_Name ='" & FormatSpecText(Package_Name) & "',"
	SQL = SQL & "	@Package_Type_ID ='" & Package_Type_ID & "',"
	SQL = SQL & "	@Package_Duration_ID ='" & Package_Duration_ID & "',"
	SQL = SQL & "	@Package_Headline ='" & FormatSpecText(Marketing_Headline) & "',"
	SQL = SQL & "	@Package_Desc ='" & FormatSpecText(Short_Description) & "',"
	SQL = SQL & "	@Package_Desc_Detail = '" & FormatSpecText(Long_Description) & "',"
	SQL = SQL & "	@People_Ratio = '" & People_Ratio & "',"
	SQL = SQL & "	@Num_Adults ='" & Num_Adults & "',"
	SQL = SQL & "	@Num_Guests = '" & Num_Guests & "',"
	SQL = SQL & "	@Num_Days = '" & Num_Days & "',"
	SQL = SQL & "	@Lodging = '" & Lodging & "',"
	SQL = SQL & "	@Tickets = '" & Tickets & "',"
	SQL = SQL & "	@Food_Bev = '" & Food_Bev & "',"
	SQL = SQL & "	@Transportation = '" & Transport & "',"
	SQL = SQL & "	@Disabled = '" & Disabled & "',"
	SQL = SQL & "	@Budget = '" & Budget & "',"
	SQL = SQL & "	@Effective_Date = " & Effective_Date & ","
	SQL = SQL & "	@Expire_Date = " & Expire_Date & ","
	SQL = SQL & "	@Realm_ID = '" & Admin_Realm & "',"
	SQL = SQL & "	@Group_ID = '" & Entity_Group_ID & "',"
	SQL = SQL & "	@Item_Logo_Group = '" & Item_Logo_Group & "',"
	SQL = SQL & "	@Package_City = '" & Package_City & "',"
	SQL = SQL & "	@Package_State = '" & Package_State & "',"
	SQL = SQL & "	@Package_Country = '" & Package_Country & "',"
	SQL = SQL & "	@Time_Share = '" & Time_Share & "', "
	SQL = SQL & "	@Package_Cost = " & Package_Cost & ","
	SQL = SQL & "	@Daily_Cost = " & Daily_Cost & ","
 	SQL = SQL & "	@Override_Cost =" & Override_Cost & ","
 	SQL = SQL & "	@Lowest_Cost =" & Lowest_Cost & ","

	If Not Ref_ID = "" Then
	 	SQL = SQL & "	@Ref_ID ='" & Ref_ID & "',"
	End If


	SQL = Mid(SQL, 1, Len(SQL) - 1)
	Response.Write(SQL & "<br><br>")
	Set RSPackage = Conn.Execute(SQL)
	
	Package_ID = RSPackage("Package_ID")
	'Package_ID = Package

	If Ref_ID = "" Then Ref_ID = Package_ID
	
	SQL = "[Avante].[dbo].[Update_Package_Detail] "
	SQL = SQL & "	@Package_ID ='" & Package_ID & "',"
	SQL = SQL & "	@Group_ID ='" & Room_Group & "',"
	SQL = SQL & "	@Quantity ='" & Room_Quantity & "',"
	SQL = SQL & "	@Inventory_ID ='" & Room_Item & "',"
	SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
	SQL = SQL & "	@Markup ='" & Room_Markup & "',"
	SQL = SQL & "	@Status ='" & Status & "'"
	Response.Write (SQL & "<br><br>")
	Set RSPackage = Conn.Execute(SQL)
	Detail_ID = RSPackage("Detail_ID")

	For each Item in Request.Form("Items_" & Room_Group)
	   If Not Request("P" & Package & "_Item_Quantity" & Item) = "" Then

		Item_Group = Request.Form("Item_Group" & Item)
		Item_Quantity = Int(Request("P" & Package & "_Item_Quantity" & Item))
		Item_Markup = Request.Form("P" & Package & "_Item_Markup" & Item)
		Status = 1
		Inventory_Type_ID = 2
		
		If Trim(Item_Markup) = "" Then Item_Markup = "0"

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Item_Group & "',"
		SQL = SQL & "	@Quantity ='" & Item_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Item_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	   End If
	Next
			
	For each Att_Item in Request.Form("Att_Items")
	   If Not Request("P" & Package & "_Att_Item_Quantity" & Att_Item) = "" Then
		Att_Group = Request.Form("Att_Group" & Att_Item)
		Att_Quantity = Int(Request("P" & Package & "_Att_Item_Quantity" & Att_Item))
		Att_Markup = Request.Form("P" & Package & "_Att_Item_Markup" & Att_Item)
		Status = 1
		Inventory_Type_ID = 2
		
		If Trim(Att_Markup) = "" Then Att_Markup = "0"

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Att_Group & "',"
		SQL = SQL & "	@Quantity ='" & Att_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Att_Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Att_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	   End If
	Next

	For each Merch_Item in Request.Form("Merch_Items")
	   If Not Request("P" & Package & "_Merch_Item_Quantity" & Merch_Item) = "" Then
		Merch_Group = Request.Form("Merch_Group" & Merch_Item)
		Merch_Quantity = Int(Request("P" & Package & "_Merch_Item_Quantity" & Merch_Item))
		Merch_Markup = Request.Form("P" & Package & "_Merch_Item_Markup" & Merch_Item)
		Status = 1
		Inventory_Type_ID = 2
		
		If Trim(Merch_Markup) = "" Then Merch_Markup = "0"

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Merch_Group & "',"
		SQL = SQL & "	@Quantity ='" & Merch_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Merch_Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Merch_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	   End If
	Next

	For each Food_Bev_Item in Request.Form("Food_Bev_Items")
	   If Not Request("P" & Package & "_Food_Bev_Item_Quantity" & Food_Bev_Item) = "" Then
		Food_Bev_Group = Request.Form("Food_Bev_Group" & Food_Bev_Item)
		Food_Bev_Quantity = Int(Request("P" & Package & "_Food_Bev_Item_Quantity" & Food_Bev_Item))
		Food_Bev_Markup = Request.Form("P" & Package & "_Food_Bev_Item_Markup" & Food_Bev_Item)
		
		If Trim(Food_Bev_Markup) = "" Then Food_Bev_Markup = "0"
		
		Status = 1
		Inventory_Type_ID = 2

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Food_Bev_Group & "',"
		SQL = SQL & "	@Quantity ='" & Food_Bev_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Food_Bev_Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Food_Bev_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")		
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	   End If
	Next




' start of attachment processing

	
	If Not First_Run = True Then
		Add_Back = First_Run
		First_Run = True
	End If
	Item_Array = ""

	  For ACount = 1 to Num_Assign
	
		If Not Request("Attach_Name_" & Package & "_" & ACount) = "" Then
			Attach_Name = Request("Attach_Name_" & Package & "_" & ACount)
			Attach_Head = Request("Attach_Head_" & Package & "_" & ACount)
			Attach_Desc = Request("Attach_Desc_" & Package & "_" & ACount)
			Attach_Package_Type = Request("Attach_Package_Type_" & Package & "_" & ACount)
			Attach_Type = Request("Attach_Type_" & Package & "_" & ACount)
			Item_Logo_Group = Request("Logo" & Package & "_" & ACount)
			'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 & "'")
			Room_Item = Request("P" & Package & "_Room_Item")		
	
			Room_Group = Request.Form("Room_Item_Group" & Room_Item)
			Rate_Occupancy = Int(Request.Form("Room_Item_ROcc" & Room_Item))
			Max_Occupancy = Int(Request.Form("Room_Item_MOcc" & Room_Item))
			Room_Name = Request.Form("Room_Item_Name" & Room_Item)
	
			Room_Quantity = Request("P" & Package & "_A" & ACount & "_Room_Item_Quantity" & Room_Item)
			Room_Markup = Request("P" & Package & "_A" & ACount & "_Room_Item_Markup" & Room_Item)

			Package_Cost = Request.Form("total" & Package & "_A" & ACount)
			Daily_Cost = Request.Form("Daily" & Package & "_A" & ACount)
			Override_Cost = Request("P" & Package & "_A" & ACount & "_Override_Cost")
			Lowest_Cost = Request("P" & Package & "_A" & ACount & "_Lowest_Cost")

			Tax_Cost = Request("tax" & Package & "_A" & ACount )
			
			Num_Guests = "1"
			Num_Adults = "0"
			Num_Days = Int(Request.Form("P" & Package & "_A" & ACount & "_Days"))

			
			Effective_Date = Request.Form("Effective_Date" & Package & "_A" & ACount)
			Expire_Date = Request.Form("Expire_Date" & Package & "_A" & ACount)

			If Trim(Effective_Date) = "" Then 
				Effective_Date = "NULL"
			Else
				Effective_Date = "'" & Effective_Date & "'"
			End If
		
			If Trim(Expire_Date) = "" Then 
				Expire_Date = "NULL"
			Else
				Expire_Date = "'" & Expire_Date & "'"
			End If

			If Trim(Room_Markup) = "" Then Room_Markup = "0"


			If Package_Cost = "" Then 
				Package_Cost = "NULL"
			Else
				Package_Cost = "" & Package_Cost & ""
			End If
		
			If Daily_Cost = "" Then 
				Daily_Cost = "NULL"
			Else
				Daily_Cost = "" & Daily_Cost & ""
			End IF
			
			If Lowest_Cost = "" Then 
				Lowest_Cost = "NULL"
			Else
				Lowest_Cost = "" & Lowest_Cost & ""
			End IF
		
		
			If Override_Cost = "" Then 
				Override_Cost = "NULL"
			Else
				Override_Cost = "" & Override_Cost & ""
			End IF
		


	SQL = "[Avante].[dbo].[Update_Package] "
	SQL = SQL & "	@Parent_Package_ID ='" & Package_ID & "',"
	SQL = SQL & "	@Map_Type_ID ='" & Attach_Type & "',"
	SQL = SQL & "	@Package_Name ='" & FormatSpecText(Attach_Name) & "',"
	If Not Trim(Attach_Package_Type) = "" Then
		SQL = SQL & "	@Package_Type_ID ='" & Attach_Package_Type & "',"
	End If
	SQL = SQL & "	@Package_Headline ='" & FormatSpecText(Attach_Head) & "',"
	SQL = SQL & "	@Package_Desc ='" & FormatSpecText(Attach_Desc) & "',"
	SQL = SQL & "	@Num_Adults ='" & Num_Adults & "',"
	SQL = SQL & "	@Num_Guests ='" & Num_Guests & "',"
	SQL = SQL & "	@Num_Days = '" & Num_Days & "',"
	SQL = SQL & "	@Disabled = '" & Disabled & "',"
	SQL = SQL & "	@Effective_Date = " & Effective_Date & ","
	SQL = SQL & "	@Expire_Date = " & Expire_Date & ","
	SQL = SQL & "	@Realm_ID = '" & Admin_Realm & "',"
	SQL = SQL & "	@Group_ID = '" & Entity_Group_ID & "',"
	SQL = SQL & "	@Item_Logo_Group = '" & Item_Logo_Group & "',"
	SQL = SQL & "	@Package_City = '" & Package_City & "',"
	SQL = SQL & "	@Package_State = '" & Package_State & "',"
	SQL = SQL & "	@Package_Country = '" & Package_Country & "',"
	SQL = SQL & "	@Package_Cost = " & Package_Cost & ","
	SQL = SQL & "	@Daily_Cost = " & Daily_Cost & ","
 	SQL = SQL & "	@Override_Cost =" & Override_Cost & ","
 	SQL = SQL & "	@Lowest_Cost =" & Lowest_Cost & ","

	If Not Ref_ID = "" Then
	 	SQL = SQL & "	@Ref_ID ='" & Ref_ID & "',"
	End IF

	SQL = Mid(SQL, 1, Len(SQL) - 1)

	Response.Write(SQL & "<br><br>")
	Set RSPackage = Conn.Execute(SQL)
	
	Sub_Package_ID = RSPackage("Package_ID")
	'Sub_Package_ID = ACount
	
	If Not Trim(Room_Quantity) = "" Then
			
			Room_List_ID = RSList("Inventory_List_ID")
			Lodging_Name = Request.Form("Lodging_Name" & Room_Group)
			Stay = Request.Form("pdurname" & Request.Form("Package_Duration_ID"))


	
			SQL = "[Avante].[dbo].[Update_Package_Detail] "
			SQL = SQL & "	@Package_ID ='" & Sub_Package_ID & "',"
			SQL = SQL & "	@Group_ID ='" & Room_Group & "',"
			SQL = SQL & "	@Quantity ='" & Room_Quantity & "',"
			SQL = SQL & "	@Inventory_ID ='" & Room_Item & "',"
			SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
			SQL = SQL & "	@Markup ='" & Room_Markup & "',"
			SQL = SQL & "	@Status ='" & Status & "'"
			Response.Write (SQL & "<br><br>")
			Set RSPackage = Conn.Execute(SQL)
			Detail_ID = RSPackage("Detail_ID")
	
	End If
	
		Prev_Name = ""
	
	For each Item in Request.Form("Items_" & Room_Group)
	   If Not Request("P" & Package & "_A" & ACount & "_Item_Quantity" & Item) = "" Then
	
		Item_Item_Name = Request.Form("Item_ItemName" & Item)
		Item_Name = Request.Form("Item_Name" & Item)
		Item_Quantity = Int(Request("P" & Package & "_A" & ACount & "_Item_Quantity" & Item))
		Item_Group = Request.Form("Item_Group" & Item)
		Item_Markup = Request.Form("P" & Package & "_Item_Markup" & Item)

		Status = 1
		Inventory_Type_ID = 2
		
		If Trim(Item_Markup) = "" Then Item_Markup = "0"

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Sub_Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Item_Group & "',"
		SQL = SQL & "	@Quantity ='" & Item_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Item_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	    End If
	Next
	
		Prev_Name = ""
	
	For each Att_Item in Request.Form("Att_Items")
	   If Not Request("P" & Package & "_A" & ACount & "_Att_Item_Quantity" & Att_Item) = "" Then
		Att_Item_Name = Request.Form("Att_ItemName" & Att_Item)
		Att_Name = Request.Form("Att_Name" & Att_Item)
		Att_Quantity = Int(Request("P" & Package & "_A" & ACount & "_Att_Item_Quantity" & Att_Item))
		Att_Group = Request.Form("Att_Group" & Att_Item)
		Att_Markup = Request.Form("P" & Package & "_Att_Item_Markup" & Att_Item)

		Status = 1
		Inventory_Type_ID = 2
		
		If Trim(Att_Markup) = "" Then Att_Markup = "0"

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Sub_Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Att_Group & "',"
		SQL = SQL & "	@Quantity ='" & Att_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Att_Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Att_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	
	   End If
	Next
	

	For each Merch_Item in Request.Form("Merch_Items")
	      If Not Request("P" & Package & "_A" & ACount & "_Merch_Item_Quantity" & Merch_Item) = "" Then
		Merch_Item_Name = Request.Form("Merch_ItemName" & Merch_Item)
		Merch_Name = Request.Form("Merch_Name" & Merch_Item)
		Merch_Quantity = Int(Request("P" & Package & "_A" & ACount & "_Merch_Item_Quantity" & Merch_Item))
		Merch_Group = Request.Form("Merch_Group" & Merch_Item)
 		Merch_Markup = Request.Form("P" & Package & "_Merch_Item_Markup" & Merch_Item)

		Status = 1
		Inventory_Type_ID = 2
		
		If Trim(Merch_Markup) = "" Then Merch_Markup = "0"

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Sub_Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Merch_Group & "',"
		SQL = SQL & "	@Quantity ='" & Merch_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Merch_Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Merch_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	
	    End If
	Next
	
	
	

	For each Food_Bev_Item in Request.Form("Food_Bev_Items")
	      If Not Request("P" & Package & "_A" & ACount & "_Food_Bev_Item_Quantity" & Food_Bev_Item) = "" Then
		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_Quantity = Int(Request("P" & Package & "_A" & ACount & "_Food_Bev_Item_Quantity" & Food_Bev_Item))
		Food_Bev_Group = Request.Form("Food_Bev_Group" & Food_Bev_Item)
		Food_Bev_Markup = Request.Form("P" & Package & "_Food_Bev_Item_Markup" & Food_Bev_Item)
		
		If Trim(Food_Bev_Markup) = "" Then Food_Bev_Markup = "0"
		
		Status = 1
		Inventory_Type_ID = 2

		SQL = "[Avante].[dbo].[Update_Package_Detail] "
		SQL = SQL & "	@Package_ID ='" & Sub_Package_ID & "',"
		SQL = SQL & "	@Group_ID ='" & Food_Bev_Group & "',"
		SQL = SQL & "	@Quantity ='" & Food_Bev_Quantity & "',"
		SQL = SQL & "	@Inventory_ID ='" & Food_Bev_Item & "',"
		SQL = SQL & "	@Inventory_Type_ID ='" & Inventory_Type_ID & "',"
		SQL = SQL & "	@Markup ='" & Food_Bev_Markup & "',"
		SQL = SQL & "	@Status ='" & Status & "'"
		Response.Write (SQL & "<br><br>")		
		Set RSPackage = Conn.Execute(SQL)
		Detail_ID = RSPackage("Detail_ID")
	
	    End If
	Next
	
	
	
	   End If
	  Next
	First_Run = Add_Back

' end of attachment processing

Next

Session("default_page") = "default-packages.asp"
Response.Redirect Session("default_page")

%>

<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>Packages Created</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--
<%
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%>">
		<%=item%> : <%=value%><br>
<%
	Next
  End If
Next
%>
-->
</body>
</html>
