<%@language=vbscript codepage=936 %>
<%
Option Explicit
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

%>
<!--#include file="../conn.asp"-->
<%
Call OpenConn
Dim ProductID
Dim rs, iStocks
ProductID = Trim(request("ProductID"))
If IsNumeric(ProductID) Then
    ProductID = CLng(ProductID)
Else
    ProductID = 0
End If
If ProductID > 0 Then
    Set rs = Conn.Execute("select Stocks,OrderNum from PE_Product where ProductID=" & ProductID & "")
    If rs.BOF And rs.EOF Then
        iStocks = 0
    Else
        iStocks = rs(0) - rs(1)
        If iStocks < 0 Then iStocks = 0
    End If
    rs.Close
    Set rs = Nothing
Else
    iStocks = 0
End If

Response.Write "document.write('" & iStocks & "');"
Call CloseConn
%>
