|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在实现ERP等高端的ASP应用时,用户需要提供核心的经营资料,需要ASP商有很高的信用度。楼上说交互性不好,太牵强了吧。在微软提供的一套框架中,利用asp做网站,开发效率高,使用人数少,减少不必要的开销。交互性是互动方式,是有开发人员决定的。存储历程|纪录集|一时表|示例以下是ASP代码:
<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>
<!--#includefile="../conn.asp"-->
<!--#includefile="adovbs.inc"-->
<!--#includefile="../inc/check_login.asp"-->
<!--#includefile="pagecls.asp"-->
<%CheckUserPower"100009",Session("EmpPower")%>
<%
dimdeptname,empname,fyear
deptname=Trim(Request("deptname"))
empname=Trim(Request("empname"))
fyear=Trim(Request("fyear"))
iffyear=""then
fyear=2006
endif
Setconn=Server.CreateObject("ADODB.Connection")
Setrs=Server.CreateObject("ADODB.Recordset")
conn.openconnstr
’ifdeptname=""andempname=""then
’sql="HD_CK_XSHZ"&fyear&""
’conn.execute(sql)
’endif
%>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<title>发卖出库表.</title>
<linkhref="../style.CSS"rel="stylesheet"type="text/css">
<scriptlanguage="javascript">
functionexportExcel(hd_zlb){
if(typeof(EXPORT_OBJECT)!="object"){
document.body.insertAdjacentHTML("afterBegin","<OBJECTstyle=’display:none’classid=clsid:0002E510-0000-0000-C000-000000000046id=EXPORT_OBJECT></Object>");
}
with(EXPORT_OBJECT){
DataType="HTMLData";
HTMLData=hd_zlb.outerHTML;
try{
ActiveSheet.Export("C:华达发卖出库一览表.xls",0);
alert(’乐成导出EXCEL表格!’);
}
catch(e){
alert(’导出EXCEL表格失利,请断定已安装Excel2000(或更高版本),而且没翻开同名xls文件’);
}
}
}
</script>
</head>
<body>
<tablewidth="100%"border="0"cellspacing="0"cellpadding="0">
<formname="form1"method="post"action="list_loading.asp">
<tr>
<td><selectname="fyear">
<optionvalue="2005"<%iffyear=2005thenresponse.write"selected"%>>2005年</option>
<optionvalue="2006"<%iffyear=2006thenresponse.write"selected"%>>2006年</option>
<optionvalue="2007"<%iffyear=2007thenresponse.write"selected"%>>2007年</option>
</select>
<!--#includefile="dept_cls.asp"-->
<inputtype="submit"name="Submit"value="查询"></td>
<td>
<inputtype="hidden"name="filename"value="list_sale_out.asp">
</td>
<td><divalign="right">
<inputname="button"type="button"value="导出EXCEL表格...">
</div></td>
</tr>
</form>
</table>
<%
functionformatcur(cur,v)
ifv=0then
ifcur=0then
formatcur="<fontcolor=’#cccccc’>-</font>"
else
v9=cur&""
va=len(v9)
ifva<4then
v2=v9
else
yi=Fix(va/3)
y2=(yi+1)*3
t1=3-(y2-va)+1
ifyiva/3then
e2=""
fori=1toyi
v2=","&Mid(v9,t1+3*(i-1),3)
e2=e2+v2
next
v2=Mid(v9,1,(va-3*yi))&e2
else
e2=""
fory=2toyi
v2=","&Mid(v9,(y-1)*3+1,3)
e2=e2+v2
next
v2=Mid(v9,1,3)&e2
endif
endif
formatcur=v2
endif
else
ifcur=0then
formatcur="<fontcolor=’#cccccc’>-</font>"
else
formatcur=FormatCurrency(cur)
endif
endif
endfunction
response.writefyear
SetCmd=server.CreateObject("Adodb.Command")
Cmd.ActiveConnection=conn
Cmd.CommandText="HD_CK_XSHZ"
Cmd.CommandType=4
cmd.prepared=true
Cmd.Parameters.AppendCmd.CreateParameter("fyear",adInteger,1,2,fyear)
Cmd.Parameters.AppendCmd.CreateParameter("deptname",adVarChar,adParamInput,50,""&deptname&"")
Cmd.Parameters.AppendCmd.CreateParameter("empname",adVarChar,adParamInput,50,""&empname&"")
setrs=Cmd.execute
ifdeptname""thenresponse.write"<fontcolor=red>你查询的"&fyear&"年度"&deptname&">>"&empname&"的相干发卖出库信息以下:</font>"
%>
<tablewidth="100%"border="0"cellpadding="2"cellspacing="1"bgcolor="#999999"id="hd_zlb"style="word-break:break-all;border-collapse:collapse">
<tr>
<tdbgcolor="#666666"><fontcolor="#FFFFFF">ID</font></td>
<tdbgcolor="#666666"><fontcolor="#FFFFFF">公司称号</font></td>
<%ifdeptname=""then%>
<tdbgcolor="#666666"><fontcolor="#FFFFFF">发卖部门</font></td>
<%endif
ifempname=""then%>
<tdbgcolor="#666666"><fontcolor="#FFFFFF">营业员</font></td>
<%endif%>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">算计</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">1月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">2月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">3月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">4月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">5月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">6月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">7月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">8月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">9月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">10月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">11月</font></td>
<tdnowrapbgcolor="#666666"><fontcolor="#FFFFFF">12月</font></td>
</tr>
<%
dims,totals
dimm1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12
m1=0
m2=0
m3=0
m4=0
m5=0
m6=0
m7=0
m8=0
m9=0
m10=0
m11=0
m12=0
totals=0
s=0
whilenotrs.eof
m1=m1+rs("m1")
m2=m2+rs("m2")
m3=m3+rs("m3")
m4=m4+rs("m4")
m5=m5+rs("m5")
m6=m6+rs("m6")
m7=m7+rs("m7")
m8=m8+rs("m8")
m9=m9+rs("m9")
m10=m10+rs("m10")
m11=m11+rs("m11")
m12=m12+rs("m12")
totals=totals+rs("total")
ifinstr(FormatSQLstr(session("deptpower")),trim(rs("fdeptname")))>0then
%>
<trbgcolor="#FFFFFF">
<td><nobr><%=s%></nobr></td>
<td><nobr><%=rs("fcompanyname")%></nobr></td>
<%ifdeptname=""then%>
<tdnowrap><nobr><%=rs("fdeptname")%></nobr></td>
<%endif
ifempname=""then%>
<tdnowrap><nobr><%=rs("fempname")%></nobr></td>
<%endif%>
<tdnowrapbgcolor="#efefef">
<divalign="right"><fontcolor="#FF0000"><nobr><%=formatcur(rs("total"),0)%></nobr></font></div></td>
<tdnowrap><divalign="right"><nobr><%=formatcur(rs("m1"),0)%></nobr></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><nobr><%=formatcur(rs("m2"),0)%></nobr></div></td>
<tdnowrap><divalign="right"><nobr><%=formatcur(rs("m3"),0)%></nobr></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><nobr><%=formatcur(rs("m4"),0)%></nobr></div></td>
<tdnowrap><divalign="right"><nobr><%=formatcur(rs("m5"),0)%></nobr></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><nobr><%=formatcur(rs("m6"),0)%></nobr></div></td>
<tdnowrap><divalign="right"><nobr><%=formatcur(rs("m7"),0)%></nobr></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><nobr><%=formatcur(rs("m8"),0)%></nobr></div></td>
<tdnowrap><divalign="right"><nobr><%=formatcur(rs("m9"),0)%></nobr></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><nobr><%=formatcur(rs("m10"),0)%></nobr></div></td>
<tdnowrap><divalign="right"><nobr><%=formatcur(rs("m11"),0)%></nobr></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><nobr><%=formatcur(rs("m12"),0)%></nobr></div></td>
</tr>
<%
endif
rs.movenext
s=s+1
wend
rs.close
setrs=nothing
conn.close
setconn=nothing
SetCmd=Nothing
%>
<trbgcolor="#FFFFFF">
<tdcolspan="2"><strong>算计:</strong></td>
<%ifdeptname=""then%>
<td></td>
<%endif
ifempname=""then%>
<td></td>
<%endif%>
<tdnowrapbgcolor="#efefef">
<divalign="right"><fontcolor="#FF0000"><%=formatcur(totals,0)%></font></div></td>
<tdnowrap><divalign="right"><%=formatcur(m1,0)%></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><%=formatcur(m2,0)%></div></td>
<tdnowrap><divalign="right"><%=formatcur(m3,0)%></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><%=formatcur(m4,0)%></div></td>
<tdnowrap><divalign="right"><%=formatcur(m5,0)%></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><%=formatcur(m6,0)%></div></td>
<tdnowrap><divalign="right"><%=formatcur(m7,0)%></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><%=formatcur(m8,0)%></div></td>
<tdnowrap><divalign="right"><%=formatcur(m9,0)%></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><%=formatcur(m10,0)%></div></td>
<tdnowrap><divalign="right"><%=formatcur(m11,0)%></div></td>
<tdnowrapbgcolor="#efefef"><divalign="right"><%=formatcur(m12,0)%></div></td>
</tr>
</table>
</body>
</html>
以下是存储历程代码:
CREATEPROCEDUREHD_CK_XSHZ
(
@fyearint,
@deptnamevarchar(50),
@empnamevarchar(50)
)
AS
setnocounton
begin
--按月份、型号汇总,创建发卖出库单表
createtable#ck1(fyearint,fperiodint,fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),famtrefnumeric)
insertinto#ck1
selectl.fyear,l.fperiod,l.fcompanyname,l.fdeptname,fempname,sum(l.fsumamtref)
fromvw_com_saleinoutlwherel.fyear=@fyearand(l.fcompanyname’别的客户’)
groupbyl.fcompanyname,l.fdeptname,l.fempname,l.fyear,l.fperiod
orderbyfcompanyname,fperiod
--按月份创建一时表
createtable#month1(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m1int)
insertinto#month1selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=1
createtable#month2(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m2int)
insertinto#month2selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=2
createtable#month3(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m3int)
insertinto#month3selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=3
createtable#month4(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m4int)
insertinto#month4selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=4
createtable#month5(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m5int)
insertinto#month5selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=5
createtable#month6(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m6int)
insertinto#month6selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=6
createtable#month7(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m7int)
insertinto#month7selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=7
createtable#month8(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m8int)
insertinto#month8selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=8
createtable#month9(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m9int)
insertinto#month9selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=9
createtable#month10(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m10int)
insertinto#month10selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=10
createtable#month11(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m11int)
insertinto#month11selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=11
createtable#month12(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),m12int)
insertinto#month12selectfcompanyname,fdeptname,fempname,famtreffrom#ck1wherefperiod=12
--创建商品发卖明细一览表
createtable#hd_ckhzj(fcompanynamevarchar(100),fdeptnamevarchar(20),fempnamevarchar(20),Totalint,
m1int,m2int,m3int,m4int,m5int,m6int,m7int,m8int,m9int,m10int,m11int,m12int)
insertinto#hd_ckhzjselect#ck1.fcompanyname,#ck1.fdeptname,#ck1.fempname,sum(#ck1.famtref),
isnull((selectm1from#month1wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm2from#month2wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm3from#month3wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm4from#month4wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm5from#month5wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm6from#month6wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm7from#month7wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm8from#month8wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm9from#month9wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm10from#month10wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm11from#month11wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0),
isnull((selectm12from#month12wherefcompanyname=#ck1.fcompanynameandfdeptname=#ck1.fdeptnameandfempname=#ck1.fempname),0)
from#ck1
groupbyfcompanyname,fdeptname,fempname
orderbyfcompanyname
if(@deptname’’and@empname=’’)
select*from#hd_ckhzjwherefdeptname=@deptnameorderbytotaldesc
elseif(@deptname’’and@empname’’)
select*from#hd_ckhzjwherefdeptname=@deptnameandfempname=@empnameorderbytotaldesc
else
select*from#hd_ckhzjorderbytotaldesc
end
GO
帮助用户快速实现各种应用服务,ASP商有整合各方面资源的能力,可在短期内为用户提供所需的解决方案。例如,典型的ERP安装,如果要在客户端安装的话需要半年到二年的时间,但是美国的一些ASP商如USI和CORIO能在90—120天内提供ERP应用方案。 |
|