Public function getPricePAX(priceid, itemid, persons)
dim i

getPricePAX = 0
for i=0 to UBound(pricepax_priceid)
  if CLng(pricepax_priceid(i)) = CLng(priceid) And _
  	CLng(pricepax_itemid(i)) = CLng(itemid) And _
	CInt(pricepax_persons(i)) >= CInt(persons) then
    getPricePAX = pricepax_price(i)
    exit function
  end if
next

end function

Public function getPriceType(pricepp)

  if pricepp = 1 then
    getPriceType = "PP"
  elseif pricepp = 2 or pricepp = 3 then
    getPriceType = "PAX"
  else
    getPriceType = "LOT"
  end if

end function

Public function htlClassName(classid)

for i=0 to UBound(htlClasses.id)
  if htlClasses.id(i) = classid then
    htlClassName = htlClasses.name(i)
    exit function
  end if
next
  htlClassName = "*"

end function

Public function htlRoomName(roomid, itemid)

for i=0 to UBound(rmhtl_id)
  if rmhtl_id(i) = roomid and rmhtl_itemid(i) = itemid then
    htlRoomName = rmhtl_name(i)
    exit function
  end if
next
  htlRoomName = "*"

end function

Public Function fnGetLZeroNumber(intNumber)

	If CInt(intNumber) < 10 Then
		fnGetLZeroNumber = "0" & CStr(intNumber)
	Else
		fnGetLZeroNumber = CStr(intNumber)
	End If
	
End Function

Public Function fnGetFullWDay(DayNum, bolSpread)
Dim strWDay
    Select Case DayNum
        Case 1
            If bolSpread Then
                strWDay = "M o n d a y"
            Else
                strWDay = "Monday"
            End If
        Case 2
            If bolSpread Then
                strWDay = "T u e s d a y"
            Else
                strWDay = "Tuesday"
            End If
        Case 3
            If bolSpread Then
                strWDay = "W e d n e s d a y"
            Else
               strWDay = "Wednesday"
            End If
        Case 4
            If bolSpread Then
                strWDay = "T h u r s d a y"
            Else
                strWDay = "Thursday"
            End If
        Case 5
            If bolSpread Then
                strWDay = "F r i d a y"
            Else
                strWDay = "Friday"
            End If
        Case 6
            If bolSpread Then
                strWDay = "S a t u r d a y"
            Else
                strWDay = "Saturday"
            End If
        Case 7
            If bolSpread Then
                strWDay = "S u n d a y"
            Else
                strWDay = "Sunday"
            End If
    End Select
    
    fnGetFullWDay = strWDay

End Function

Public function fnGetCoachPrice(coachid, timeid, cityid)
dim i, tmpPrice

tmpPrice = 0

for i = 0 to ubound(coachp_id)
 if clng(coachp_coachid(i)) = clng(coachid) _
 	and clng(coachp_timeid(i)) = clng(timeid) _
	and clng(coachp_cityid(i)) = clng(cityid) then
	if csng(coachp_price(i)) > csng(tmpPrice) then tmpPrice = csng(coachp_price(i))
 end if
next
fnGetCoachPrice = csng(tmpPrice)

end function

Public function fnGetGuidePrice(timeid)
dim i

fnGetGuidePrice=0
for i=0 to ubound(coacht_id)
 if clng(coacht_id(i)) = clng(timeid) then
	fnGetGuidePrice = coacht_gprice(i)
 end if
next

end function

Public function fnGetCoachName(coachid)
dim i
for i=0 to ubound(coach_id)
 if cint(coach_id(i)) = cint(coachid) then
	fnGetCoachName = coach_name(i)
 end if
next

end function

Public function MyDate(srcdate)
dim myday, mymonth

 myday=Day(srcdate)
 if len(myday)=1 then myday="0" & myday
 mymonth=Month(srcdate)
 if len(mymonth)=1 then mymonth="0" & mymonth

 MyDate = myday & "." & mymonth & "." & Right(Year(srcdate),2)

end function

Public function fnGetHtlPortage(htlid)
dim i
for i=0 to ubound(xhtl_itemid)
 if clng(xhtl_itemid(i)) = clng(htlid) then
	fnGetHtlPortage = xhtl_port(i)
	exit function
 else
 	fnGetHtlPortage = 0
 end if
next
end function

Public function fnGetHtlGRPPers(htlid)
dim i
for i=0 to ubound(xhtl_itemid)
 if clng(xhtl_itemid(i)) = clng(htlid) then
	fnGetHtlGRPPers = xhtl_grpprs(i)
	exit function
 else
 	fnGetHtlGRPPers = 0
 end if
next
end function

Public function fnGetHtlGRPRms(htlid)
dim i
for i=0 to ubound(xhtl_itemid)
 if clng(xhtl_itemid(i)) = clng(htlid) then
	fnGetHtlGRPRms = xhtl_grprms(i)
	exit function
 else
 	fnGetHtlGRPRms = 0
 end if
next
end function

Public function fnGetFullDate(dmyDate)
	fnGetFullDate = MonthName(Mid(dmyDate,4,2)) & " " & Left(dmyDate,2) & ", 20" & Right(dmyDate,2)
end function

'' AGLAS 13.10.2004
Public function HotelPriceDate(xDate)
dim sRet
dim strMonth

	strMonth = Array("", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")

	sRet = Day(xDate)
	if Len(sRet) = 1 then
		sRet = "0" & sRet
	end if
	sRet = sRet & strMonth(Month(xDate))
	sRet = sRet & Right(Year(xDate), 2)

	HotelPriceDate = sRet

end function

