?? index.asp
字號:
<!--#include file="conn.asp"-->
<%
On Error Resume next
response.charset="GB2312"
session.codepage=936
call admintop()
%>
<title>56770 藥品管理系統</title>
<SCRIPT LANGUAGE=javascript>
var tt='start';
var ii='start';
function turnit(ss,bb) {
if (ss.style.display=="none") {
if(tt!='start') tt.style.display="none";
if(ii!='start') ii.src="";
ss.style.display="";
tt=ss;
ii=bb;
bb.src="";
}
else {
ss.style.display="none";
bb.src="";
}
}
</SCRIPT>
<%
'if session("admin_name")<>"" then
' adminflag()
'else
dim action, s_id
s_id=request("s_id")
action=request("action")
select case action
'--------------------------------
case "update"
p_kucun=CLng(request.form("p_kucun"))
upkucun=CLng(request.form("upkucun"))
p_type=CLng(request.form("p_type"))
s_id=request("s_id")
if request.form("p_kucun")="" then
response.write "<script>alert('沒有輸入要操作的庫存數量');window.document.location.href='"&request.servervariables("HTTP_REFERER")&"';</script>"
response.End()
else
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from 56770_product where p_id="&s_id, conn, 1, 3
ykucun=cint(rs("p_kucun"))
rs.close:Set rs=Nothing
If upkucun=0 Then
if ykucun<p_kucun Then
response.write "<script>alert('沒有那么多庫存!"&ykucun&"');window.document.location.href='"&request.servervariables("HTTP_REFERER")&"';</script>"
response.End()
End If
End If
If upkucun=0 Then
Set rs=conn.execute("select * from [56770_product] where p_id="&s_id&"")
If p_type=0 Then
buy_price=rs("p_price")
Else
buy_price=rs("p_pfprice")
End If
day1=Now()
conn.execute("insert into [56770_pro_log](p_id,p_name,p_sort,p_price,p_cbprice,p_count,p_sj)values("&s_id&",'"&rs("p_name")&"','"&rs("p_sort")&"',"&rs("p_price")&","&rs("p_cbprice")&","&p_kucun&",'"&Replace(day1," 上午","")&"')")
sql= "update [56770_product] set p_kucun=p_kucun-"&p_kucun&" where p_id="&s_id&""
ElseIf upkucun=1 Then
sql= "update [56770_product] set p_kucun=p_kucun+"&p_kucun&" where p_id="&s_id&""
ElseIf upkucun=2 Then
sql= "update [56770_product] set p_kucun=p_kucun+"&p_kucun&",p_count=p_count+"&p_kucun&" where p_id="&s_id
Else
sql= "update [56770_product] set p_kucun=p_kucun-"&p_kucun&",p_count=p_count-"&p_kucun&" where p_id="&s_id
End If
'response.write sql
response.write sql1
conn.execute (sql)
response.Redirect request.servervariables("HTTP_REFERER")
response.end
end If
end select
%>
<table border="0" cellspacing="1" cellpadding="0" height="0" align=center width="98%" bgcolor="#183789">
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center" width="100%">
<tr>
<td height=15 align=center colspan=15 class=classtop>56770 藥品管理系統</td>
</tr>
<form name=form2 method=post action=index.asp>
<tr >
<td class="classtd" align="center" colspan=2>庫存總額:<strong><font color=red>
<%Set rs=conn.execute("select p_cbprice,p_kucun from [56770_product]")
If rs.eof Then
sumprice="0"
Else
Do While Not rs.eof
sumprice=sumprice+(rs("p_cbprice")*rs("p_kucun"))
rs.movenext
Loop
End If
rs.close:Set rs=Nothing
response.write FormatNumber(sumprice,2)
%> 元</font></strong>
</td>
<td class="classtd" align="center">
<select name="anclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
<option selected>--快速跳轉--</option>
<option value=index.asp>查看全部藥品</option>
<option value=query.asp>查看銷售明細</option>
<%set rs=conn.execute("select s_id,s_name from [56770_sort] order by s_paixu desc")
if not rs.eof then
do while not rs.eof
%>
<option value="?s_name=<%=server.urlencode(Trim(rs("s_name")))%>"><%=rs("s_name")%></option>
<%rs.movenext
loop
end if
rs.close:set rs=nothing
%>
</select></td>
<td class="classtd" colspan="5" align=right>分類:
<select name=s_name style="height:18px;">
<option value="0">全部分類</option>
<%set rs=conn.execute("select s_id,s_name from [56770_sort] order by s_paixu desc")
if not rs.eof then
do while not rs.eof
%>
<option value="<%=Trim(rs("s_name"))%>"><%=rs("s_name")%></option>
<%rs.movenext
loop
end if
rs.close:set rs=nothing
%></select> 檢索關鍵詞:
<input name="gjc" size="25" class=form>
<input type=submit name=tiaojian value=" 查 詢 " class=button> </td>
</tr></form>
</table>
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center" width="100%">
<%
s_name=replace(request("s_name"),"'","’")
gjc=replace(request("gjc"),"'","’")
set rs=server.CreateObject("adodb.recordset")
sql="select * from 56770_product where p_name<>''"
if s_name<>"0" And s_name<>"" then sql=sql&" and p_sort like '%"&s_name&"%'"
If gjc<>"" Then sql=sql&" and (p_name like '%"&gjc&"%' or p_bianma like '%"&gjc&"%' or p_chandi like '%"&gjc&"%' or p_guige like '%"&gjc&"%' or p_price like '%"&gjc&"%' or p_yaochang like '%"&gjc&"%' or p_jinhuoshang like '%"&gjc&"%')"
sql=sql&" order by p_id desc"
'response.write sql
rs.open sql,conn, 1, 1
%>
<tr class=classtop1>
<td height="15" align="center" width="15%"><img src=database/images/t1.gif>品名</td>
<td height="15" align="center" width="10%">編碼</td>
<td height="15" align="center" width="10%">類別</td>
<td height="15" align="center" width="5%">規格</td>
<td height="15" align="center" width="5%">單位</td>
<td height="15" align="center" width="6%">產地</td>
<td height="15" align="center" width="6%">零售</td>
<td height="15" align="center" width="6%">批發</td>
<td height="15" align="center" width="6%">進價</td>
<td height="15" align="center" width="5%">總數</td>
<td height="15" align="center" width="5%">庫存</td>
<td height="15" align="center" width="10%"><img src=database/images/user.gif>供應商</td>
<td height="15" align="center" width="15%">廠家</td>
</tr>
<%if rs.eof and rs.bof then
response.write "還沒有數據,請添加!"
Else
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=20
rs.AbsolutePage=pagecount
do while not rs.eof%>
<tr>
<form name="form1" method="post" action='index.asp?action=update&s_id=<%=rs("p_id")%>'>
<td class="classtd" id=tag<%=rs("p_id")%> style='CURSOR: hand' onclick=turnit(Content<%=rs("p_id")%>,tag<%=rs("p_id")%>); language=JScript>
<img src=database/images/+.gif>
<%=Replace(rs("p_name"),gjc,"<font color=red>"&gjc&"</font>")%>
</td>
<td class="classtd">
<%=Replace(rs("p_bianma"),gjc,"<font color=red>"&gjc&"</font>")%>
</td>
<td class="classtd" align="center" >
<%=rs("p_sort")%>
</td>
<td class="classtd" align="center">
<%=Replace(rs("p_guige"),gjc,"<font color=red>"&gjc&"</font>")%>
</td>
<td class="classtd" align="center" >
<%=rs("p_danwei")%>
</td>
<td class="classtd" align="center">
<%=Replace(rs("p_chandi"),gjc,"<font color=red>"&gjc&"</font>")%>
</td>
<td class="classtd" align="center">
<%=Replace(FormatNumber(rs("p_price"),2),gjc,"<font color=red>"&gjc&"</font>")%>
</td>
<td class="classtd" align="center">
<strong><%=FormatNumber(rs("p_pfprice"),2)%></strong>
</td>
<td class="classtd" align="center">
<%=FormatNumber(rs("p_cbprice"),2)%>
</td>
<td class="classtd" align="center">
<%=rs("p_count")%>
</td>
<td class="classtd" align="center">
<%=rs("p_kucun")%>
</td>
<td class="classtd" align="center">
<%=Replace(rs("p_jinhuoshang"),gjc,"<font color=red>"&gjc&"</font>")%>
</td>
<td class="classtd"> <%=rs("p_yaochang")%>
</td>
</tr>
<tr>
<td colspan="13" align="right" height="25" id=Content<%=rs("p_id")%> style='DISPLAY: none'>
<table>
<tr><td width="30%">庫存總額:<%=formatnumber(rs("p_cbprice"),2)%>×<%=rs("p_kucun")%>(<%=rs("p_danwei")%>)=<%=formatnumber(rs("p_cbprice")*rs("p_kucun"),2)%></td>
<td width="70%" align="center">
銷售類別:<input type=radio value=0 name=p_type checked>零售 <input type=radio value=1 name=p_type>批發
庫存操作:<input type="type" name="p_kucun" value="1" size="4" onkeyup="value=value.replace(/[^\d\.]/g,'');">
<input type=radio value=0 name=upkucun checked>減少 <input type=radio value=1 name=upkucun>補錯增加 <input type=radio value=2 name=upkucun>增加 <input type=radio value=3 name=upkucun>補錯減少
<input type="submit" name="Submit" value="確定" >
</td></tr>
</table>
</td>
</tr>
</form>
<%
rs.movenext
i=i+1
if i>=rs.pagesize then exit do
loop
%>
<form action="index.asp?gjc=<%=gjc%>&s_name=<%=s_name%>" method="post">
<tr class=classfooter><td height="25" align="center" colspan=15>
<div align="center"> 共有數據 <b><%=rs.recordcount%></b> 條, 頁次: <b><font color=red><%=pagecount%></font>/<%=rs.pagecount%></b>,
當前從第
<%
if pagecount<=1 then
response.write "<font color=red>1</font>"
else
response.write "<font color=red>" & pagecount*rs.pagesize-rs.pagesize+1 & "</font>"
end if
%>
條開始。
<% if pagecount=1 and rs.pagecount<>pagecount and rs.pagecount<>0 then%>
<a href="?gjc=<%=gjc%>&s_name=<%=s_name%>&page=<%=cstr(pagecount+1)%>">下一頁</a>
<% end if %>
<% if rs.pagecount>1 and rs.pagecount=pagecount then %>
<a href="?gjc=<%=gjc%>&s_name=<%=s_name%>&page=<%=cstr(pagecount-1)%>">上一頁</a>
<%end if%>
<% if pagecount<>1 and rs.pagecount<>pagecount then%>
<a href="?gjc=<%=gjc%>&s_name=<%=s_name%>&page=<%=cstr(pagecount-1)%>">上一頁</a> <a href="?gjc=<%=gjc%>&s_name=<%=s_name%>&page=<%=cstr(pagecount+1)%>">下一頁</a>
<% end if%>
直接到第
<select name="page">
<%for i=1 to rs.pagecount%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>頁
<input type="submit" name="go" value="跳轉" class=button>
</div>
</td>
</form>
</tr>
<%
End If
rs.close
set rs=Nothing
%>
<tr><td align=center height=25 colspan=15>[<a href="admin/default.asp">系統管理</a>]</td></tr>
</table>
</td></tr>
</table>
<%'end if%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -