<!--#include file="../Start.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

Dim ProductID
ProductID = PE_CLng(Trim(request("ProductID")))
If ProductID > 0 Then
    Response.Write "document.write('" & FormatNumber(GetPrice(), 2, vbTrue, vbFalse, vbTrue) & "');"
End If
Call CloseConn

Function GetPrice()
    Dim dblTruePrice, dblTempPrice
    dblTruePrice = 0
    UserLogined = CheckUserLogined()
    If UserLogined = True Then GetUser (UserName)
    Dim rs
    Set rs = Conn.Execute("select ProductType,Price,Price_Original,Price_Member,Price_Agent,BeginDate,EndDate from PE_Product where ProductID=" & ProductID & "")
    If Not (rs.BOF And rs.EOF) Then
        Select Case GroupType
        Case 0, 1 '未登录
            Select Case rs("ProductType")
            Case 1, 2, 4, 5
                dblTruePrice = rs("Price")
            Case 3
                If Date < rs("BeginDate") Or Date > rs("EndDate") Then
                    dblTruePrice = rs("Price_Original")
                Else
                    dblTruePrice = rs("Price")
                End If
            End Select
        Case 2, 3   '注册会员
            Select Case rs("ProductType")
            Case 1, 2
                If rs("Price_Member") > 0 Then '如果指定了会员价
                    dblTruePrice = rs("Price_Member")
                Else
                    dblTruePrice = rs("Price") * Discount_Member / 100
                End If
            Case 3
                If Date < rs("BeginDate") Or Date > rs("EndDate") Then
                    dblTempPrice = rs("Price_Original")
                Else
                    dblTempPrice = rs("Price")
                End If
                If rs("Price_Member") > 0 Then '如果指定了会员价
                    If rs("Price_Member") <= dblTempPrice Then
                        dblTruePrice = rs("Price_Member")
                    Else
                        dblTruePrice = dblTempPrice
                    End If
                Else
                    If PE_CLng(UserSetting(12)) = 1 Then '如可以享受折上折优惠
                        dblTruePrice = dblTempPrice * Discount_Member / 100
                    Else
                        If rs("Price_Original") * Discount_Member / 100 >= dblTempPrice Then
                            dblTruePrice = dblTempPrice
                        Else
                            dblTruePrice = rs("Price_Original") * Discount_Member / 100
                        End If
                    End If
                End If
            Case 4
                dblTruePrice = rs("Price")
            Case 5
                dblTempPrice = rs("Price")
                If rs("Price_Member") > 0 Then '如果指定了会员价
                    If rs("Price_Member") <= dblTempPrice Then
                        dblTruePrice = rs("Price_Member")
                    Else
                        dblTruePrice = dblTempPrice
                    End If
                Else
                    If PE_CLng(UserSetting(12)) = 1 Then '如可以享受折上折优惠
                        dblTruePrice = dblTempPrice * Discount_Member / 100
                    Else
                        If rs("Price_Original") * Discount_Member / 100 >= dblTempPrice Then
                            dblTruePrice = dblTempPrice
                        Else
                            dblTruePrice = rs("Price_Original") * Discount_Member / 100
                        End If
                    End If
                End If
            End Select
        Case 4  '代理商
            dblTempPrice = rs("Price")
            If rs("Price_Agent") > 0 Then '如果指定了代理价
                dblTruePrice = rs("Price_Agent")
            Else
                If Discount_Member = 100 Then
                    dblTruePrice = dblTempPrice
                Else
                    If PE_CLng(UserSetting(12)) = 1 Then '如可以享受折上折优惠
                        dblTruePrice = dblTempPrice * Discount_Member / 100
                    Else
                        If rs("Price_Original") * Discount_Member / 100 <= dblTempPrice Then
                            dblTruePrice = rs("Price_Original") * Discount_Member / 100
                        Else
                            dblTruePrice = dblTempPrice
                        End If
                    End If
                End If
            End If
        End Select
    End If
    GetPrice = dblTruePrice
End Function
%>
