private_fun.asp

来自「Activity——活动管理模块 Analyse——分析模块 Client—」· ASP 代码 · 共 32 行

ASP
32
字号

<%
''库存物品数量、金额合计
Function showstock(id,kind)
  ''如果产品编号为空,则设置为0
	if id="" then
	    id=0
	end if
  ''如果要求统计的类型为空,则设置为0,即入库统计	
	if kind="" then
	   kind=0
	 end if 
	 
	dim rec
	set rec = server.createobject("adodb.recordset")
	''通过聚合函数中的SUM计算出要求统计类型中的产品总数量和金额
	sql_show= "select sum(stockProductnum) as totalnum, sum(stockProductnum*stockProductPrice) as totalmoney from stock where stockProductId="&id &" and stocksort="&kind
	rec.open sql_show,conn,3
	if not rec.eof then
	''如果没有符合条件的记录,则返回全部为0
	   if isnull(rec("totalmoney")) then 
	       showstock="0,0"
	    else
	      showstock=rec("totalnum")&","
	      showstock=showstock&rec("totalmoney")
		end if
	else
	     showstock="0,0"
	end if
	set rec=nothing
End Function
%>

⌨️ 快捷键说明

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