⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 js.asp

📁 一个学校的医务管理
💻 ASP
字号:
<!--#include file="conn1.asp"-->
<%
s1=request("submit1")
s2=request("submit2")
jsyear=mid(request("year"),4)             '所选择的年份
jsmonthy=request("monthy")         '所选择的月份

if  s1<>"" then
'---------------------------------------------------------
if int(jsyear)=int(mid(date(),4,1)) then
	if int(jsmonthy)>int(mid(date(),6,2)) then 
	    response.write("<body bgcolor='#d6dff7' align='center'>")
		response.write("<br><br><br><br>")
		response.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对不起,还不到此月份的结算日期呢!")
		response.write("</body>")
		response.end
	end if
end if
 if int(jsyear)>int(mid(date(),4,1)) then
	response.write("<body bgcolor='#d6dff7' align='center'>")
	response.write("<br><br><br><br>")
	response.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对不起,还不到此月份的结算日期呢!")
	response.write("</body>")
	response.end
end if
y=0
cnt1=0
cnt2=0
sql="select top 1 * from js"
rs=conn.execute(sql)
u=rs("unit")
if u="1" then
	sql="select * from yw order by rdate"
	set rs1=server.CreateObject("adodb.recordset")
	rs1.open sql,conn,1,1
	if not rs1.eof then
		dt=mid(rs1("rdate"),1,5)
		sql="update js set unit='2' where yname='1'"
		conn.execute sql
	end if
	sql="select distinct(yname),unit from yw where rdate like '%"& dt &"%'"
	set rs2=server.CreateObject("adodb.recordset")
	rs2.open sql,conn,1,1
	if not rs2.eof then
		do while not rs2.eof 
			sql="select * from yw where rdate like'%"& dt &"%' and yname='"&rs2("yname")&"'"
			set rs3=server.CreateObject("adodb.recordset")
			rs3.open sql,conn,1,1
		   if not rs3.eof then
				do while not rs3.eof
					cnt1=cnt1+int(rs3("cnt"))
					rs3.movenext
				loop
			end if
			yname=rs2("yname")
			unit=rs2("unit")
			sql="select * from yck where yname='"& yname &"'and  ydate like'%"&dt&"%'"
			set rs4=server.CreateObject("adodb.recordset")
			rs4.open sql,conn,1,1
			if not rs4.eof then
				do while not rs4.eof 
					cnt2=cnt2+rs4("cnt")
				rs4.movenext
				loop
			end if
			js1=int(cnt1)-int(cnt2)
			if mid(dt,4,1)=0 then
				mo=mid(dt,5,1)
			else
				mo=mid(dt,4,2)
			end if
			sql="insert into js(yname,unit,lastjs,j,c,js,monthy,year)values('"& yname &"','"& unit &"','0','"& cnt1 &"','"& cnt2&"','"& js1 &"','"& mo &"','"& mid(dt,2,1) &"')"
			conn.execute sql
		   rs2.movenext
	   loop
	set rs=nothing
	end if
	u=2
end if

if u="2" then
	sql="select * from js order by monthy desc "
	set rs5=server.CreateObject("adodb.recordset")
	rs5.open sql,conn,1,1
	y=0
	if not rs5.eof then
		do while not rs5.eof 
			if y<int(rs5("year")) then
			y=int(rs5("year"))
			mn=int(rs5("monthy"))
			end if
			if mn<int(rs5("monthy")) then
	        y=int(rs5("year"))
			mn=rs5("monthy")
			end if
		rs5.movenext
		loop
	end if

	if trim(y)=trim(jsyear) then
	     mon=mn

		do while int(mon)<int(jsmonthy)

			call js(y,int(mon)+1)

			mon=mon+1
		loop
	end if
	if y<int(jsyear) then
	     mon=mn
		do while mon<12
			call js(jsyear,int(mon)+1)
			mon=mon+1
		loop
		mon=1
		do while mon<int(jsmonthy)
			call js(int(jsyear)+1,int(mon)+1)
			mon=mon+1
		loop	
	end if	
end if
sql="delete * from js where lastjs='0' and j='0' and c='0' and js='0'"
conn.execute(sql)
response.Redirect "ywjs.asp?y="& jsyear &"&m="& jsmonthy 
sub js(y,m)
	sql="select distinct(yname),unit from yw"
	set rs6=server.createobject("adodb.recordset")
	rs6.open sql,conn,1,1
	if not rs6.eof then
		do while not rs6.eof 
				m1=int(m)-1
			sql="select * from js where yname='"&rs6("yname")&"' and monthy like '%"&m1&"%' and year ='"&y&"'"
			set rs7=server.createobject("adodb.recordset")
			rs7.open sql,conn,1,1
			if not rs7.eof then
				lastjs=rs7("js")
			else
				lastjs=0
			end if
			if int(m)<10 then
			  m1="0"&int(m)
			  else
			  m1=m
			end if
			sql="select * from yw where rdate like'%"&y&"-"&m1&"%' and yname='"&rs6("yname")&"'"
			set rs8=server.CreateObject("adodb.recordset")
			rs8.open sql,conn,1,1
            
		   if not rs8.eof then
                            cn1=0
				do while not rs8.eof
					cn1=cn1+int(rs8("cnt"))
					rs8.movenext
				loop
			end if
			sql="select * from yck where yname='"& rs6("yname") &"'and  ydate like'%"&y&"-"&m1&"%'"
			set rs9=server.CreateObject("adodb.recordset")
			rs9.open sql,conn,1,1
			cn2=0
			if not rs9.eof then
				do while not rs9.eof 
					cn2=cn2+rs9("cnt")
				rs9.movenext
				loop
			end if
			js1=lastjs+int(cn1)-int(cn2)
			sql="insert into js(yname,unit,lastjs,j,c,js,monthy,year)values('"& rs6("yname") &"','"& rs6("unit") &"','"& lastjs &"','"& cn1 &"','"& cn2&"','"& js1 &"','"& m &"','"& y &"')"
			conn.execute sql
		rs6.movenext
		loop
	end if
end sub
'--------------------------------------
else
'-------------------------
if int(jsyear)=int(mid(date(),4,1)) then
	if int(jsmonthy)>int(mid(date(),6,2)) then 
	    response.write("<body bgcolor='#d6dff7' align='center'>")
		response.write("<br><br><br><br>")
		response.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对不起,还不到此月份的结算日期呢!")
		response.write("</body>")
		response.end
	end if
end if
 if int(jsyear)>int(mid(date(),4,1)) then
	response.write("<body bgcolor='#d6dff7' align='center'>")
	response.write("<br><br><br><br>")
	response.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对不起,还不到此月份的结算日期呢!")
	response.write("</body>")
	response.end
end if
y=0
cnt1=0
cnt2=0
sql="delete * from js "
conn.execute sql
sql="insert into js(yname,unit,lastjs,j,c,js,monthy,year)values('1','1','1','1','1','1','1','1')"
conn.execute sql
sql="select top 1 * from js"
rs=conn.execute(sql)
u=rs("unit")
if u="1" then
	sql="select * from yw order by rdate"
	set rs1=server.CreateObject("adodb.recordset")
	rs1.open sql,conn,1,1
	if not rs1.eof then
		dt=mid(rs1("rdate"),1,5)
		sql="update js set unit='2' where yname='1'"
		conn.execute sql
	end if
	sql="select distinct(yname),unit from yw where rdate like '%"& dt &"%'"
	set rs2=server.CreateObject("adodb.recordset")
	rs2.open sql,conn,1,1
	if not rs2.eof then
		do while not rs2.eof 
			sql="select * from yw where rdate like'%"& dt &"%' and yname='"&rs2("yname")&"'"
			set rs3=server.CreateObject("adodb.recordset")
			rs3.open sql,conn,1,1
		   if not rs3.eof then
                           cnt1=0
				do while not rs3.eof
					cnt1=cnt1+int(rs3("cnt"))
					rs3.movenext
				loop
			end if
			yname=rs2("yname")
			unit=rs2("unit")
			sql="select * from yck where yname='"& yname &"'and  ydate like'%"&dt&"%'"
			set rs4=server.CreateObject("adodb.recordset")
			rs4.open sql,conn,1,1
			tt="1"
			if not rs4.eof then
                              int cnt2=0
				do while not rs4.eof 
                    cnnt=cint(rs4("cnt"))
					cnt2=cnt2+cnnt
				rs4.movenext
				loop
			end if
			js1=int(cnt1)-int(cnt2)
			if mid(dt,4,1)=0 then
				mo=mid(dt,5,1)
			else
				mo=mid(dt,4,2)
			end if
			sql="insert into js(yname,unit,lastjs,j,c,js,monthy,year)values('"& yname &"','"& unit &"','0','"& cnt1 &"','"& cnt2&"','"& js1 &"','"& mo &"','"& mid(dt,2,1) &"')"
			conn.execute sql
		   rs2.movenext
	   loop
	set rs=nothing
	end if
	u=2
end if

if u="2" then
	sql="select * from js order by monthy desc "
	set rs5=server.CreateObject("adodb.recordset")
	rs5.open sql,conn,1,1
	y=0
	if not rs5.eof then
		do while not rs5.eof 
			if y<int(rs5("year")) then
			y=int(rs5("year"))
			mn=int(rs5("monthy"))
			end if
			if mn<int(rs5("monthy")) then
	        y=int(rs5("year"))
			mn=rs5("monthy")
			end if
		rs5.movenext
		loop
	end if

	if trim(y)=trim(jsyear) then
	     mon=mn

		do while int(mon)<int(jsmonthy)

			call js(y,int(mon)+1)

			mon=mon+1
		loop
	end if
	if y<int(jsyear) then
	     mon=mn
		do while mon<12
			call js(jsyear,int(mon)+1)
			mon=mon+1
		loop
		mon=1
		do while mon<int(jsmonthy)
			call js(int(jsyear)+1,int(mon)+1)
			mon=mon+1
		loop	
	end if	
end if
sql="delete * from js where lastjs='0' and j='0' and c='0' and js='0'"
conn.execute(sql)
response.Redirect "ywjs.asp?y="& jsyear &"&m="& jsmonthy 
sub js(y,m)
	sql="select distinct(yname),unit from yw"
	set rs6=server.createobject("adodb.recordset")
	rs6.open sql,conn,1,1
	if not rs6.eof then
		do while not rs6.eof 
				m1=int(m)-1
			sql="select * from js where yname='"&rs6("yname")&"' and monthy like '%"&m1&"%' and year ='"&y&"'"
			set rs7=server.createobject("adodb.recordset")
			rs7.open sql,conn,1,1
			if not rs7.eof then
				lastjs=rs7("js")
			else
				lastjs=0
			end if
			if int(m)<10 then
			  m1="0"&int(m)
			  else
			  m1=m
			end if
			sql="select * from yw where rdate like'%"&y&"-"&m1&"%' and yname='"&rs6("yname")&"'"
			set rs8=server.CreateObject("adodb.recordset")
			rs8.open sql,conn,1,1
            cn1=0
		   if not rs8.eof then
				do while not rs8.eof
					cn1=cn1+int(rs8("cnt"))
					rs8.movenext
				loop
			end if
			sql="select * from yck where yname='"& rs6("yname") &"'and  ydate like'%"&y&"-"&m1&"%'"
			set rs9=server.CreateObject("adodb.recordset")
			rs9.open sql,conn,1,1
			cn2=0
			if not rs9.eof then
				do while not rs9.eof 
					cn2=cn2+rs9("cnt")
				rs9.movenext
				loop
			end if
			js1=lastjs+int(cn1)-int(cn2)
			sql="insert into js(yname,unit,lastjs,j,c,js,monthy,year)values('"& rs6("yname") &"','"& rs6("unit") &"','"& lastjs &"','"& cn1 &"','"& cn2&"','"& js1 &"','"& m &"','"& y &"')"
			conn.execute sql
		rs6.movenext
		loop
	end if
end sub
'-----------------------
end if
%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>结算</title>
</head>

<body>

</body>
</html>

⌨️ 快捷键说明

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