<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<!-- #include file="../../user/boardmaster/inc/BoardMaster_Fun.asp"-->

<%
dim dbplus,connplus,plusstr,plusid
dbplus="kaoping.mdb"   '请改成您自己的数据库文件名
Set connplus = Server.CreateObject("ADODB.Connection")
plusstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(dbplus)
'如果你的服务器采用较老版本Access驱动，请用下面连接方法
'plusstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(dbplus)	
connplus.Open plusstr

response.buffer=true
'------------hero20000 修改 2003.3.5----------
    dim Gzdays,Gzlbt,Gzhmon,Gzwealth,Gzuserep,Gzusercp,Gzpower,Gzifmess,Gzjbgz
    Gzdays=7       '工资日间隔，每7天发放一次
    Gzjbgz=500     '版主的基本工资
    Gzlbt=100       '奖励工资所需工作积分底线
    gzhmon=100      '积分每增加多少涨一级工资
    gzwealth=50  '一级工资加多少钱
    gzifmess="1"   '发薪是否短信通知版主,0否1是
    
'------------按照你的实际需求修改以上参数-----

DEF_BBS_HomeUrl = "../../"
const npage = 2

GBL_CHK_TempStr=""
OpenDatabase
CheckUserOnline
GBL_CHK_TempStr = ""
CheckisBoardMasterFlag 
BBS_SiteHead DEF_SiteNameString &" - 版主评定",GBL_board_ID," >> 版主评定"
dim membername
membername=GBL_CHK_User

if request("action")="reset" and GBL_CHK_Flag=1 and membername <> "" then
   connplus.execute("delete * from [fuser]")
   Response.Redirect "viewmanage.asp"
end if

dim AbsentDay 		'失踪天数
dim RsB,RsU,RsL,RsX,RsF,Rstmp,Bcount,Bgzday,Btgz,savemoney,saveep,savecp,savepower
dim UserName,BoardName,userpower,Message,Counter,Bnumgz,Bnumlog,saveMessage
dim sql,rs,sqlplus,sqingjia,menu,qing,jia
menu=request.querystring("menu")
if menu="" then menu=0
select case menu
  case 3
    qing=3
    call pluspingding
  case 6
    qing=0
    call pluspingding
end select

sub pluspingding
if request.form("username")<>"" and request.form("username")=membername then
connplus.execute("update fuser set qingjia="&qing&" where username='"&membername&"'")
Response.Redirect "viewmanage.asp"
else
Response.Redirect "viewmanage.asp"
end if
end sub

Counter=0
set RsB=con.execute("select Boardname,Masterlist from [leadbbs_boards]")
sql="select DISTINCT LeadBBS_User.ID,LeadBBS_User.UserName,LeadBBS_User.userlevel,LeadBBS_User.lastdoingtime,LeadBBS_User.CachetValue,LeadBBS_SpecialUser.assort,LeadBBS_User.login_falsenum from LeadBBS_User,LeadBBS_SpecialUser where LeadBBS_SpecialUser.UserName=LeadBBS_User.UserName and LeadBBS_SpecialUser.assort=1 "
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open sql,con,1,3
%>
<table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableHeadString%></td></tr></table>
<table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=1 cellpadding=5 align=center bgcolor=<%=DEF_BBS_DarkColor%> class=TBone>
     <tr bgcolor=<%=DEF_BBS_LightDarkColor%>>
		<td valign=middle colspan=6 align=center height=25 class=TBHead><b>斑 竹 工 作 业 绩 公 示</b></td>
     </tr>
     <tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
		<td valign=middle colspan=6 align=left height=25 class=TableTitle2>◇版主工资说明： 为感谢各位版主对<%=DEF_SiteNameString%>的大力支持，本站每 <fotn color=red><%=gzdays%></font> 天对各版主进行积分奖励。<br>◇版主如有事无法登陆论坛，可以使用请假按钮进行请假。归来时，再点击取消请假即可恢复。<br>◇<u>工作积分</u>的值为：(版面维护次数)。<br>◇<u>实际给付工资</u>为：基本工资加上业绩工资。版主的基本工资为每版 <%=Gzjbgz%> 积分，工作积分超过 <%=Gzlbt%> 后给付业绩工资。<br>◇<u>业绩工资</u>的计算方法：版主的工作积分每提高 <%=gzhmon%> ，奖励积分 <%=gzwealth%> 。<br> 
		<% if GBL_CHK_Flag=1 then response.write "◇<a href=viewmanage.asp?action=reset><font color=red>站长注意：当你清空了站点管理日志时，请您立即点此链接重建版主工资数据</font></a>" %></td>
     </tr>
     <tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9 height=20>
		<td class=TopLighNav1 align="center">版主</td> 
    	        <td class=TopLighNav1 align="center">担任版块</td>
		<td class=TopLighNav1 align="center">发薪/登陆日</td>
		<td class=TopLighNav1 align="center">登陆</td>
		<td class=TopLighNav1 align="center">业绩/威望</td>
		<td class=TopLighNav1 align="center">预期工资/评语</td>
     </tr>
<%
do while not rs.eof
        AbsentDay=DateDiff("d",RestoreTime(Left(Rs("lastdoingtime"),8)),Now)
	userpower=Rs("CachetValue")
	set RsX=connplus.execute("select username,qingjia,lastinfo from [fuser] where username='"&rs(1)&"' ")
	if RsX.eof then
	jia=0
	else
	jia=RsX("qingjia")
	end if	
	if jia=3 then
	    Message="<font color=red>此版主已请假</font>"
	else
	if AbsentDay =< 1  then
		Message="<font face=Wingdings color=orange>v</font> 此版主工作比较认真负责"
	elseif AbsentDay =< 3  then
		Message="此版主 <font color=#ff0000>3</font> 天内有登录"
	elseif AbsentDay =< 7 then
		Message="<font color=#ff0000>注意:此版主已松散 5 天内有登录</font>"
		counter=counter+1
	elseif AbsentDay =< 15 then
		Message="<font color=#ff0000>警告:此版主已 "&AbsentDay&" 天没有工作</font>"
		counter=counter+1
	else
		Message="<font color=red>×</font> 此版主 <font color=#ff0000>严重失职</font>，将被考虑取消其职务"
	end if
	end if
        username=rs(1)

        BoardName=""
	Bcount=0
        dim i,masterlist
	do while not RsB.eof
           masterlist=split(RsB("masterlist"),",")
           for i=0 to ubound(masterlist)
	      if masterlist(i)=UserName then
		 Bcount=Bcount+1
		 if BoardName="" then
		    BoardName=RsB("Boardname")
		 else	
		    BoardName=BoardName&"<br>"&RsB("Boardname")
		 end if	
              end if
            next
	    RsB.movenext
   	 loop
  	RsB.movefirst
        if BoardName<>"" and jia=0 then
	   set RsF=connplus.execute("select * from [fuser] where username='"&Username&"' ")
           if RsF.eof then
              set Rstmp=con.execute("select count(*) from [leadbbs_log] where username='"&UserName&"'")
              connplus.execute("insert into fuser(username,FuLiDate,oldlogs,oldlogins) values('"&UserName&"',date()-1,"&Rstmp(0)&","&RestoreTime(Left(rs("lastdoingtime"),8))&")")
           end if

           set Rsl=con.execute("select count(*) from [leadbbs_log] where username='"&UserName&"'")
	   if RsF.eof then
	      Bnumgz=0
              Bnumlog=0
              Bgzday=(date()-1+gzdays)
           else
              Bnumgz=cint(Rsl(0)-Rsf("oldlogs"))
              Bnumlog=0
              Bgzday=(RsF("Fulidate")+gzdays)
           end if
      '积分计算公式
	   Btgz=(cint(Bnumlog*0.5)+Bnumgz)
	   if Btgz>Gzlbt then
	      savemoney=(((Btgz-Gzlbt)\Gzhmon)*Gzwealth+gzjbgz*Bcount)
	   elseif Btgz>0 then
	      savemoney=gzjbgz*Bcount
           else
	      savemoney=0
           end if

           if date()>=Bgzday and not RsF.eof and savemoney>0 then
	      savemessage="("&FormatDateTime(Rsf("Fulidate"),2)&"至"&FormatDateTime(Bgzday,2)&")：您的工作积分为("&Btgz&")，工资金额("&savemoney&")"
	      connplus.execute("update [fuser] set Fulidate=date(),oldlogs="&Rsl(0)&",oldlogins="&RestoreTime(Left(Rs("lastdoingtime"),8))&",lastinfo='"&savemessage&"' where username='"&Username&"'")
	      con.execute("update [leadbbs_user] set points=points+"&savemoney&" where username='"&Username&"'")
	      if gzifmess="1" then
		 savemessage=savemessage&"。论坛感谢您的支持，望再接再厉！此为系统信件，请勿回复。"
	    	 con.Execute("insert into leadbbs_infobox(touser,fromuser,title,content,sendtime,readflag) values('"&Username&"','"&DEF_SiteNameString&"','系统消息：您的工资','"&savemessage&"'," & GetTimeValue(Now()) & ",0)")
                 con.execute("update [leadbbs_user] set messageflag=1 where username='"&Username&"'")
              end if
           end if
          
         end if
%>
    <tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
        <td rowspan=2 class=tablebody2 align=center><a href=<%=DEF_BBS_HomeUrl%>User/LookUserInfo.asp?id=<%=Rs(0)%> target=_blank title="查看<%=htmlencode(UserName)%>的信息"><%if membername=username then%><%end if%><%=UserName%></a><%if membername=username then%><br><form name="form3" method="post" action="viewmanage.asp?menu=<%if jia=0 then%>3<%else%>6<%end if%>"><INPUT name=username size="20" value="<%=username%>" type=hidden><INPUT type=submit value=<%if jia=0 then%>我要请假<%else%>取消请假<%end if%> name=action></form><%end if%></td>
        <td rowspan=2 class=tablebody1 align=center><%=BoardName%></td>
        <td class=tablebody2 >发薪：<%=FormatDateTime(Bgzday,2)%></td>
        <td  class=tablebody1>本期：<%=Bnumlog%></td>
   	<td class=tablebody2>维护量：<%=Bnumgz%></td>
        <td class=tablebody1 height=21 valign=top><img src=<%=DEF_BBS_HomeUrl%>images/bf/face0.gif align=absmiddle alt=该版主上期工资<%if RsX.eof then 
        response.write "0"
        else
        response.write RsX("lastinfo")
        end if%>>积分：<%
         response.write "<b>"&Btgz&"</b>|"
         if jia=3 then
           response.write " <b><font color=red>此版主请假，薪水暂停发放</font></b>"
         elseif savemoney>0 then  
           response.write "工资：(<b><font color=red>"&savemoney&"</font></b>)"
         elseif AbsentDay<=gzdays then
           response.write "工资：(<b><font color=red>"&gzjbgz*Bcount&"</font></b>)"         
         else
           response.write " <b><font color=red>此版主本期被停薪</font></b>"
         end if
		 %></td>
     </tr>
     <tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
            <td class=tablebody2 >登陆：<%=FormatDateTime(RestoreTime(Left(Rs("lastdoingtime"),8)),2)%></td>
            <td  class=tablebody1 >失踪：<%=AbsentDay%></td>
    		<td class=tablebody2 >威　望：<%=userpower%></td>
            <td class=tablebody1 >评定：<%=Message%></td>
     </tr>
     <tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG1 >
            <td colspan=6 width=100% height=25></td>
     </tr>
<%    
rs.movenext
loop
rs.close
set rs=nothing
RsX.close
set RsX=nothing
%>
     <tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
	<td valign=middle colspan=6 align=center height=25 class=TableTitle2>◇ 共有 <font color=#ff0000><%=counter%></font> 位超过 7 天未登陆的版主 ◇ 请各位版主注意，超过 <FONT color=red>30</font> 天未登陆的版主将被取消其版主职务 ◇</td>
     </tr>
</table>
<%
If GBL_TableBottomString <> "" Then %><table width=<%=DEF_BBS_ScreenWidth%> border=0 cellspacing=0 cellpadding=0 align=center><tr><td><%=GBL_TableBottomString%></td></tr></table><% End If %>
<%
connplus.close
set connplus=nothing
closedatabase
SiteBottom 
If GBL_SiteBottomString <> "" Then Response.Write GBL_SiteBottomString
%>