⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classhotel.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
📖 第 1 页 / 共 5 页
字号:
	  TempPrice = 0
	  TempIndex = 0
	  BookPriceInfo = Hotel_CheckInDate
	  For i = 1 To RowCount
		 TempBeginDate = rsPrice(2)
		 TempEndDate = rsPrice(3)		 
		 UsePrice = rsPrice(1)
		 
		 If TempPrice <> UsePrice And i>1 Then		    
		    BookPriceInfo = BookPriceInfo &","& EL_Common.FormatDate(TempPrevDate)
			BookPriceInfo = BookPriceInfo &","& TempPrice
			TempIndex = 0
			If TempPrevDate = DateAdd("d", -1, CheckOutDate) Then Exit For
			BookPriceInfo = BookPriceInfo &"$"& EL_Common.FormatDate(DateAdd("d", 1, TempPrevDate))
		 End If
		 
		 For j = TempBeginDate To TempEndDate
			If j >= CheckInDate And j < CheckOutDate Then
			   TempIndex = TempIndex + 1
			   TempPrevDate = j
		    End If
		 Next
		 
		 If TempEndDate >= CheckOutDate Then
		    BookPriceInfo = BookPriceInfo &","& EL_Common.FormatDate(TempPrevDate)
			BookPriceInfo = BookPriceInfo &","& UsePrice
		 Else
		    TempPrice = UsePrice			
		 End If
		 
		 If i < RowCount Then rsPrice.MoveNext
	  Next
	  rsPrice.Close()
	  Set rsPrice = Nothing
	  Set PriceCmd = Nothing
	  
	  GetBookPriceInfo = BookPriceInfo	  
   End Function 
   
   Private Function ConfirmPriceList(ByVal HotelID, ByVal RoomID, ByVal Rooms, TotalPrice)
      Dim PriceCmd, rsPrice, RowCount, i, j
	  Dim CheckInDate, CheckOutDate, ReturnString
	  Dim Night, PriceIcon, RoomItemName, RoomItemUnit
	  
	  TotalPrice = 0
	  CheckInDate = CDate(Hotel_CheckInDate)
	  CheckOutDate = CDate(Hotel_CheckOutDate)
	  
	  PriceIcon = EL_Common.Lang("BaseConfig.PriceIcon", "&#xFFE5;")
	  Night = EL_Common.Lang("Hotel.Night", "晚")
	  RoomItemName = EL_Common.Lang("Hotel.RoomItemName", "房间")
	  RoomItemUnit = EL_Common.Lang("Hotel.RoomItemUnit", "个")
	  
	  Call EL_Common.InitCommand(PriceCmd, "EL_SP_GetHotelRoomPrice")
	  With PriceCmd
	    .Parameters.Append .CreateParameter("RETURN", 2, 4)
		.Parameters.Append .CreateParameter("@RoomID", 3, 1, 4, RoomID)
		.Parameters.Append .CreateParameter("@HotelID", 3, 1, 4, HotelID)
		.Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		.Parameters.Append .CreateParameter("@BeginDate", 135, 1, 8, CheckInDate)
		.Parameters.Append .CreateParameter("@EndDate", 135, 1, 8, CheckOutDate)
		Set rsPrice = .Execute()
	  End With
	  rsPrice.Close()
	  RowCount = PriceCmd(0)
	  If RowCount = 0 Then	     
		 TotalPrice = 0
	     ConfirmPriceList = "<li style='color:red'>"& EL_Common.Lang("Hotel.Error8", "读取房价数据失败,不能预订") &"</li>"
		 EL_Common.ShowErrorMsg(EL_Common.Lang("Hotel.Error9", "房价数据不全,请缩小预订日期范围"))
		 Call ApplicationTerminate()
		 Set rsPrice = Nothing
		 Set PriceCmd = Nothing
		 Exit Function
	  End If
	  rsPrice.Open()
	  Dim TempBeginDate, TempEndDate
	  Dim TempIndex, TempPrice, TempPrice2, TempPrevDate, TempTotalPrice
	  ReturnString = "<li>&nbsp;&nbsp;&nbsp;&nbsp"& Replace(Hotel_CheckInDate, "-", "/") &" - "
	  TempPrice = 0
	  TempIndex = 0
	  For i = 1 To RowCount
	     TempPrice2 = rsPrice(1)
		 TempBeginDate = rsPrice(2)
		 TempEndDate = rsPrice(3)
		 
		 If TempPrice <> TempPrice2 And i>1 Then		    
			TempTotalPrice = TempIndex * EL_Common.ELClng(TempPrice) * Rooms
			TotalPrice = TotalPrice + TempTotalPrice
		    ReturnString = ReturnString & Replace(EL_Common.FormatDate(TempPrevDate), "-", "/")  &":  "& PriceIcon & TempPrice
			ReturnString = ReturnString &" x "& TempIndex & Night &" x "& Rooms & RoomItemUnit & RoomItemName &" = "& PriceIcon & TempTotalPrice
			ReturnString = ReturnString &"</li>"
			TempIndex = 0
			If TempPrevDate = DateAdd("d", -1, CheckOutDate) Then Exit For
			ReturnString = ReturnString &"<li><b>+</b>&nbsp&nbsp&nbsp;"& Replace(EL_Common.FormatDate(DateAdd("d", 1, TempPrevDate)), "-", "/") &" - "
		 End If 
		 
		 For j = TempBeginDate To TempEndDate
			If j >= CheckInDate And j < CheckOutDate Then
			   TempIndex = TempIndex + 1
			   TempPrevDate = j
		    End If
		 Next
		 
		 If TempEndDate >= CheckOutDate Then
		    TempTotalPrice = TempIndex * EL_Common.ELClng(TempPrice2) * Rooms
			TotalPrice = TotalPrice + TempTotalPrice
		    ReturnString = ReturnString & Replace(EL_Common.FormatDate(TempPrevDate), "-", "/")  &":  "& PriceIcon & TempPrice2
			ReturnString = ReturnString &" x "& TempIndex & Night &" x "& Rooms & RoomItemUnit & RoomItemName &" = "& PriceIcon & TempTotalPrice
			ReturnString = ReturnString &"</li>"
		 Else
		    TempPrice = TempPrice2			
		 End If
		 		  
		 If i<RowCount Then rsPrice.MoveNext
	  Next
	  rsPrice.Close()
	  Set rsPrice = Nothing
	  Set PriceCmd = Nothing
	  
	  If TempEndDate < CheckOutDate Then
		 TotalPrice = 0
	     ReturnString = "<li style='color:red'>"& EL_Common.Lang("Hotel.Error9", "房价数据不全,请缩小预订日期范围") &"</li>"
		 EL_Common.ShowErrorMsg(EL_Common.Lang("Hotel.Error9", "房价数据不全,请缩小预订日期范围"))
		 Call ApplicationTerminate()
	  End If
	  TotalPrice = EL_Common.ELRound(TotalPrice)
	  ConfirmPriceList = ReturnString
   End Function
   
   Private Function Label_ArrHotelRoom(ByVal HTML, ByVal HotelID)
      Dim Match, Matches, ReturnString, Cols, Temp
	  Dim TempString, MatchString
	  Dim HotelRoomCmd, rsHotelRoom, RoomCount, i, ItemHTML
	  Dim PriceIcon, BookButtonText
	  
	  PriceIcon = EL_Common.Lang("BaseConfig.PriceIcon", "&#xFFE5;")
	  BookButtonText = EL_Common.Lang("BaseConfig.BookButtonText", "预订")
	  CommonRegExp.Pattern = "\[ArrHotelRoom\][\w\W]*\[\/ArrHotelRoom\]"        
      Set Matches = CommonRegExp.Execute(HTML)
	  ReturnString = HTML
	  For Each Match in Matches	
		 MatchString = Match.Value
		 MatchString = EL_Common.ReplaceText(MatchString, "\[ArrHotelRoom\]", "")
		 MatchString = EL_Common.ReplaceText(MatchString, "\[\/ArrHotelRoom\]", "")	
		 Call EL_Common.InitCommonCmd(HotelRoomCmd, rsHotelRoom, "EL_HotelRoom", "*", "ChannelID="& ChannelID &" And HotelID="& HotelID)
		 rsHotelRoom.Close()
		 RoomCount = HotelRoomCmd(0)
		 If RoomCount = 0 Then
		    Temp = ""
		 Else				
			rsHotelRoom.Open()		
		    For i = 1 To RoomCount
			   ItemHTML = ""	
			   ItemHTML = EL_Common.RegExpStaticLabel(MatchString, "{$Arr_RoomID}", rsHotelRoom("RoomID"))	   
			   ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_RoomName}", EL_Common.ServerHTMLEncode(rsHotelRoom("RoomName")))		   
			   ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_MarketPrice}", PriceIcon & rsHotelRoom("MarketPrice"))
			   ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_BookButton}", "<input type='button' value='"& BookButtonText &"' class='bookbutton' onClick=""onBooking('"& rsHotelRoom("RoomID") &"')""/>")
			   ItemHTML = Label_ArrRoomPictrue(ItemHTML, EL_Common.PictrueURL(rsHotelRoom("DefaultPictrue"), EL_Channel.FilePath))
			   ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_PriceList}", ArrPriceList(HotelID, rsHotelRoom("RoomID")))
			   ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_Remark}", rsHotelRoom("Remark"))
			   ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_Breakfast}", EL_Common.ServerHTMLEncode(rsHotelRoom("Breakfast")))
			   Temp = Temp & ItemHTML &"<br>"
			   If i<RoomCount Then rsHotelRoom.MoveNext
			Next
			rsHotelRoom.Close()
		 End if
		 Set rsHotelRoom = Nothing
		 Set HotelRoomCmd = Nothing
		 ReturnString = Replace(ReturnString, Match.Value, Temp)
      Next	  
	  
	  Set Matches = Nothing
	  Label_ArrHotelRoom = ReturnString
   End Function      
   
   Private Function ArrPriceList(ByVal HotelID, ByVal RoomID)
      Dim PriceCmd, rsPrice, RowCount, i, j
	  Dim wi, ArrWeek(7), DayNum, PriceIcon, NullPrice
	  Dim ObjectPrice, ReturnString, This_CheckOutDate, CheckInDate, CheckOutDate
	  
	  CheckInDate = CDate(Hotel_CheckInDate)
	  CheckOutDate = CDate(Hotel_CheckOutDate)
	  DayNum = DateDiff("d", CheckInDate, CheckOutDate)
	  This_CheckOutDate = DateAdd("d", -1, CheckOutDate)
	  
	  PriceIcon = EL_Common.Lang("BaseConfig.PriceIcon", "&#xFFE5;")
	  NullPrice = EL_Common.Lang("BaseConfig.NullPrice", "<span style='color:#CC0000'>×</span>")
	  wi = EL_Common.Lang("Hotel.Week.wi", "第{$WeekIndex}周")
	  ArrWeek(1) = EL_Common.Lang("Hotel.Week.w1", "周日")
	  ArrWeek(2) = EL_Common.Lang("Hotel.Week.w2", "周一")
	  ArrWeek(3) = EL_Common.Lang("Hotel.Week.w3", "周二")
	  ArrWeek(4) = EL_Common.Lang("Hotel.Week.w4", "周三")
	  ArrWeek(5) = EL_Common.Lang("Hotel.Week.w5", "周四")
	  ArrWeek(6) = EL_Common.Lang("Hotel.Week.w6", "周五")
	  ArrWeek(7) = EL_Common.Lang("Hotel.Week.w7", "周六")
	  
	  Call EL_Common.InitCommand(PriceCmd, "EL_SP_GetHotelRoomPrice")
	  With PriceCmd
	    .Parameters.Append .CreateParameter("RETURN", 2, 4)
		.Parameters.Append .CreateParameter("@RoomID", 3, 1, 4, RoomID)
		.Parameters.Append .CreateParameter("@HotelID", 3, 1, 4, HotelID)
		.Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		.Parameters.Append .CreateParameter("@BeginDate", 135, 1, 8, CheckInDate)
		.Parameters.Append .CreateParameter("@EndDate", 135, 1, 8, CheckOutDate)
		Set rsPrice = .Execute()
	  End With
	  rsPrice.Close()
	  RowCount = PriceCmd(0)	  
	  Set ObjectPrice = Server.CreateObject ("Scripting.Dictionary")	
	  ObjectPrice.CompareMode = 1  
	  If RowCount > 0 Then
		 Dim TempBeginDate, TempEndDate, TempPrice
		 rsPrice.Open()
		 For i = 1 To RowCount
		    TempPrice = rsPrice(1)
		    TempBeginDate = rsPrice(2)
			TempEndDate = rsPrice(3)
			For j = TempBeginDate To TempEndDate
			   If j >= CheckInDate And j < CheckOutDate Then
			      ObjectPrice.Add j, PriceIcon & TempPrice
			   End If
			Next
		    If i<RowCount Then rsPrice.MoveNext
		 Next
		 rsPrice.Close()
		 If TempEndDate<CheckOutDate Then
		    For i = DateAdd("d", 1, TempEndDate) To This_CheckOutDate
			   ObjectPrice.Add i, NullPrice
			Next
		 End If		 
	  Else
	     For i = CheckInDate To CheckOutDate
		    ObjectPrice.Add i, NullPrice
		 Next
	  End If
	  Set rsPrice = Nothing
	  Set PriceCmd = Nothing
	  
	  ReturnString = "<table width='' border='0' cellpadding='0' cellspacing='1' class='roompricelist'><tr>"
	  ReturnString = ReturnString &"<td class='roompricelisttitle'>"& Hotel_CheckInDate &" 至 "& Hotel_CheckOutDate &"</td>"
	  For i = 0 To DayNum-1
	     If i>=7 Then Exit For
	     ReturnString = ReturnString &"<td class='roompricelistweek'>"& ArrWeek(WeekDay(DateAdd("d", i, Hotel_CheckInDate))) &"</td>"
	  Next
	  ReturnString = ReturnString &"</tr><tr>"
	  
	  '价格列表
	  Dim WeekIndex
	  WeekIndex = 1
	  j = 1
	  For i = CheckInDate To This_CheckOutDate	 
	     If DayNum>7 And (j Mod 7)=1 Then 
		    ReturnString = ReturnString &"<td class='roompricelisttitle'>"& EL_Common.ReplaceText(wi, "\{\$WeekIndex\}", WeekIndex) &"</td>"
		 ElseIf j = 1 Then
		    ReturnString = ReturnString &"<td class='roompricelisttitle'>"& EL_Common.ReplaceText(wi, "\{\$WeekIndex\}", WeekIndex) &"</td>"
		 End If
		 
		 ReturnString = ReturnString &"<td class='roompricelistitems' title='"& i &"'>"& ObjectPrice.Item(i) &"</td>"
		 If (j Mod 7) = 0 And j<DayNum Then
		    WeekIndex = WeekIndex + 1
			ReturnString = ReturnString &"</tr><tr>"
		 End If
		 j = j + 1
	  Next
	  If DayNum>7 And ((j-1) Mod 7)>0 Then
	     For i = 1 To 7-((j-1) Mod 7)
	        ReturnString = ReturnString &"<td class='roompricelisti

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -