<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../Task/TaskConfig.asp"-->
<!--#include file="../HSK_Cls/HSK.MemberCls.asp"-->
<!--#include file="../HSK_Cls/HSK.Label.CommonCls.asp"-->
<%
'****************************************************
' 提现与提现明细页 UPDate by 2010-11-29
'****************************************************
Dim KSCls
Set KSCls = New User_PingJia
KSCls.HSK_Run()
Set KSCls = Nothing

Class User_PingJia
        Private KS,KSUser
		Private CurrentPage,totalPut
		Private RS,MaxPerPage
		Private TempStr,SqlStr
		Private Sub Class_Initialize()
			MaxPerPage =20
		  Set KS=New PublicCls
		  Set KSUser = New UserCls
'		  Session(KS.SiteSN&"UserInfo") = Empty
		End Sub
        Private Sub Class_Terminate()
		 Set KS=Nothing
		 Set KSUser=Nothing
		 Call CloseConn()
		End Sub
		%>
		<!--#include file="../HSK_Cls/UserFunction.asp"-->
		<%
       Public Sub loadMain()

		IF Cbool(KSUser.UserLoginChecked)=false Then
		  Response.Write "<script>top.location.href='Login';</script>"
		  Exit Sub
		End If
		Call KSUser.Head()
		 If KS.S("page") <> "" Then
			  CurrentPage = CInt(KS.S("page"))
		Else
			  CurrentPage = 1
		End If
		%>
		<div class="tabs">	
			<ul>
				<li<%If KS.S("tab")="" then response.write " class='select'"%>><a href="User_PingJia.asp">来自接手方的评价</a></li>
				<li<%If KS.S("tab")="2" then response.write " class='select'"%>><a href="?Tab=2">来自发布方的评价</a></li>
      			<li<%If KS.S("tab")="3" then response.write " class='select'"%>><a href="?Tab=3">给他人评价</a></li>
<!--				<li><a href="?">被他人申诉情况</a></li>-->
			</ul>
		</div>
        
		<%
		Select Case KS.LoseHtml(KS.S("Action"))
		 Case "Reply"	Call DoReply()
		 Case Else  PingJiaList()
		End Select
	   End Sub

	   Sub DoReply()
	   	Dim ID,NameType,ReplyContent
		Dim Rs,sql
		ID = KS.ChkClng(KS.S("ID"))
		NameType = KS.ChkClng(KS.S("NameType"))
		ReplyContent = KS.LoseHtml(KS.S("ReplyContent"))
		IF KS.IsNul(ReplyContent) Then KS.AlertHintScript "解释内容不能为空！"
		IF ID<>0 And NameType<>0 Then
			IF NameType = 3 Then
				sql = "Select ReplyContent From PingJia Where UserName='" & KSUser.UserName & "' And ID=" & ID
			ElseIF NameType = 2 Then
				sql = "Select ReplyContent From PingJia Where FriendName='" & KSUser.UserName & "' And NameType=2 And ID=" & ID
			Else
				sql = "Select ReplyContent From PingJia Where FriendName='" & KSUser.UserName & "' And NameType=1 And ID=" & ID	
			End IF
			Set RS=Server.CreateObject("ADODB.RECORDSET")
			RS.Open sql,Conn,1,1
			If Not Rs.Eof Then
				Conn.Execute("UPDate PingJia Set ReplyContent='" & ReplyContent & "',ReplyDate="& SqlNowString &" Where ID=" & ID)
				KS.AlertHintScript "提交成功！"
			Else
				KS.AlertHintScript "抱歉！提交出错！"
			End If
			RS.Close
			Set Rs = Nothing
		Else
			KS.AlertHintScript "抱歉！提交参数有误！"
		End IF
	   End Sub

	   
	   Sub PingJiaList()
		Call KSUser.InnerLocation("查看信用评价")
%>
				<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="border">
					<tr class=titlename align=middle>
					  <td width=40 height="25">序号</td>
					  <td width=120>任务ID号</td>
					  <td width=80>任务区</td>
					  <td width=100><%
			  if KS.S("tab")="3" then
			  	  ks.echo "被评价人"
			  elseif KS.S("tab")="2" then
			  	  ks.echo "评价人(发布方)"
			  else
				  ks.echo "评价人(接手方)"
			  end if%></td>
					  <td width=60>评分</td>
					  <td width=80>评价时间</td>
					  <td width="">评价内容</td>
					  <td width=70>操作</td>
					</tr>
					<%  
						 Set RS=Server.CreateObject("ADODB.RECORDSET")
						 IF KS.CheckXSS(KS.R(KS.S("tab"))) = "3" Then
							 RS.Open "Select * From PingJia Where UserName='" & KSUser.UserName & "' Order By ID Desc",Conn,1,1
						 ElseIF KS.CheckXSS(KS.R(KS.S("tab"))) = "2" Then
							 RS.Open "Select * From PingJia Where FriendName='" & KSUser.UserName & "' And NameType=1 Order By ID Desc",Conn,1,1
						 Else
							 RS.Open "Select * From PingJia Where FriendName='" & KSUser.UserName & "' And NameType=2 Order By ID Desc",Conn,1,1
						 End IF
						 If RS.Bof And RS.Eof Then
								  Response.Write "<tr class='tdbg'><td align=center height=25 colspan=7 valign=top>还没有任何提现记录!</td></tr>"
							Else
									totalPut = RS.RecordCount
						
											If CurrentPage < 1 Then
												CurrentPage = 1
											End If
			
								If (CurrentPage - 1) * MaxPerPage > totalPut Then
									If (totalPut Mod MaxPerPage) = 0 Then
										CurrentPage = totalPut \ MaxPerPage
									Else
										CurrentPage = totalPut \ MaxPerPage + 1
									End If
								End If
			
								If CurrentPage = 1 Then
									Call ShowContent
								Else
									If (CurrentPage - 1) * MaxPerPage < totalPut Then
										RS.Move (CurrentPage - 1) * MaxPerPage
										Call ShowContent
									Else
										CurrentPage = 1
										Call ShowContent
									End If
								End If
				End If
						 %>
					
          </table>
		  </td>
		  </tr>
</table>
		  <%
		  Call KS.ShowPage(totalput, MaxPerPage, "", CurrentPage,false,true)%>
		  <%
  End Sub
    
  Sub ShowContent()
     on error resume next
     Dim I,totalmoney
     Do While Not rs.eof 
	%>
    <tr class=tdbg onMouseOver="this.className='tdbgmouseover'" onMouseOut="this.className='tdbg'">
      <td  class="splittd" align=middle><%=I+1%></td>
      <td  class="splittd" align=middle><%=rs("TaskID")%></td>
	  <td  class="splittd" align=middle><%=KS.C_C(rs("tid"),1)%></td>
      <td  class="splittd" align=middle><%
			  if KS.S("tab")="3" then
				  if KS.ChkClng(rs("NameType"))=1 then
					KS.Echo "接手人："
				  elseif KS.ChkClng(rs("NameType"))=2 then
					KS.Echo "发布人："
				  end if
			  end if%><%=rs("FriendName")%></td>
      <td  class="splittd" align=center><%
	IF KS.ChkClng(rs("HaoPing"))=1 Then KS.Echo "好评"
	IF KS.ChkClng(rs("ZhongPing"))=1 Then KS.Echo "中评"
	IF KS.ChkClng(rs("ChaPing"))=1 Then KS.Echo "差评"%></td>
      <td  class="splittd" align=center><%=rs("AddDate")%></td>
      <td  class="splittd" align=center><%=rs("Content")%><%if rs("ReplyContent")<>"" then KS.Echo "<br><span class='red'>解释内容：" & rs("ReplyContent")%></span>&nbsp;</td>
      <td  class="splittd" align=middle><%if Not KS.IsNul(rs("Content")) And KS.IsNul(rs("ReplyContent")) And DateDiff("d",rs("AddDate"),Now)<=2 then 
	  if KS.S("tab") = "" then KS.echo "<a href=""javascript:void(0)"" onclick=""show('?Action=Reply&NameType=2&ID="& rs("ID") &"')"" title=""评价后2天内可以回复解释"">我要解释</a>"
	  if KS.S("tab") = "2" then KS.echo "<a href=""javascript:void(0)"" onclick=""show('?Action=Reply&NameType=1&ID="& rs("ID") &"')"" title=""评价后2天内可以回复解释"">我要解释</a>"
	  if KS.S("tab") = "3" then KS.echo "<a href=""javascript:void(0)"" onclick=""show('?Action=Reply&NameType=3&ID="& rs("ID") &"')"" title=""评价后2天内可以回复解释"">我要解释</a>"
	  else
	  ks.echo "<font color=#C8C8C8>我要解释</font>"
	  end if%></td>
    </tr>
	<%
	I = I + 1
	RS.MoveNext
	If I >= MaxPerPage Then Exit Do
	loop
	%>
  </table>
<script type="text/javascript" src="/HSK_JS/HSK.box.js"></script>

<script type="text/javascript">
function check()
{
 var ReplyContent=$("#ReplyContent").val();
 var url=$("#url").val();
 if (url==''){
  alert('参数传递出错!');
  closeWindow();
 }
 if (ReplyContent==''){
   alert('请输入解释内容!');
   $("#ReplyContent").focus();
   return false;
 }
 location.href=url + "&ReplyContent=" + ReplyContent;
}
function show(url)
{
 new KesionPopup().popupTips("<img src='../images/user/log/106.gif'> 评价解释","请输入本次评价的解释内容(可输入255个字符)<br /><textarea name='ReplyContent' id='ReplyContent' style='width:340px;height:80px'></textarea><div style='text-align:center;margin:10px'><input type='button' onclick='return(check());' value=' 确 定 ' class='button'><input type='hidden' value="+url+" name='url' id='url'> <input type='button' value=' 取 消 ' onclick='closeWindow()' class='button'></div>",354,350);
}		 
</script>
<%
End Sub

End Class
%> 
