<!--#include file="../Inc/Conn.asp" -->
<!--#include file="../Inc/SK.Session.asp" -->
<!--#include file="../Inc/SK.Funtion.asp" -->
<%if Not (Getconfig("SK_Finance")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK700000000") AND JudgePopedomTF(Session("UserName"),"SK700000902")))) then Call ReturnError()%>
<%
Dim i,str2

'导出员工借款信息到Excel开始
Response.Buffer = True 
Response.ContentType = "application/vnd.ms-excel" 
SaveFilename=replace(replace(replace(now,":","")," ",""),"/","")
Thead="Reim_"
Response.AddHeader "content-disposition", "inline; filename = "&Thead&SaveFilename&".xls"

Response.Write("<table width=""100%"" align=""center"" cellpadding=""3"" cellspacing=""1"" border=""1"">"&VBCrlf)
Response.Write("<tr bgcolor=""#E8E8E8"">"&VBCrlf)
Response.Write("<td width=""12%""><b>借款类别</b></td>")
Response.Write("<td width=""9%""><b>借款主题</b></td>")
Response.Write("<td width=""9%""><b>借款日期</b></td>")
Response.Write("<td width=""9%""><b>借款金额</b></td>")
Response.Write("<td width=""9%""><b>审核状态</b></td>")
Response.Write("<td width=""9%""><b>审核人员</b></td>")
Response.Write("<td width=""9%""><b>审核时间</b></td>")
Response.Write("<td width=""10%""><b>审核备注</b></td>")
Response.Write("<td width=""5%""><b>借款状态</b></td>")
Response.Write("<td width=""5%""><b>财务人员</b></td>")
Response.Write("<td width=""5%""><b>借款时间</b></td>")
Response.Write("<td width=""5%""><b>借款人员</b></td>")
Response.Write("<td width=""5%""><b>创建人员</b></td>")
Response.Write("<td width=""5%""><b>新建时间</b></td>")
Response.Write("</tr>"&VBCrlf)

Set RS = Server.CreateObject("ADODB.Recordset")
if F("id")="" then
sql="select * from SK_OfficeBorrow where SK_ShFeet=1 and SK_Del=0"
RS.Open Sql,Conn,1,1
if rs.bof and rs.eof then Call ReturnError4()
K=0
while not Rs.eof
K=K+1
Response.Write("<tr bgcolor=FFFFFF>"&VBCrlf)
'-----------------------------------------
set RsPay=server.createobject("adodb.recordset")
SqlPay="select * from SK_SystemCategory where SK_Di=14 and CategoryID="&Rs("SK_Di")&""
RsPay.open SqlPay,conn,1,1
Response.write"<td align=left>"&RsPay("SK_Name")&"</td>"
RsPay.close
Set RsPay=Nothing
Response.Write("<td align=left>"&Rs("SK_Title")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Atime")&"</td>")
Response.write"<td align=center><font color=blue>"&formatnumber(Rs("SK_Amount"),2)&"</font></td>"
if Rs("SK_ShFeet")=0 then 
Response.Write("<td align=left><font color=""#009999"">未审核</font></td>")
elseif Rs("SK_ShFeet")=1 then
Response.Write("<td align=left><font color=""#0066FF"">已通过</font></td>")
elseif Rs("SK_ShFeet")=2 then
Response.Write("<td align=left><font color=""red"">未通过</font></td>")
end if
set RsShUID=server.createobject("adodb.recordset")
SqlShUID="select * from SK_SystemUsers where UsersID="&Rs("SK_ShUID")&""
RsShUID.open SqlShUID,conn,1,1
Response.Write("<td align=left>"&RsShUID("SK_OName")&"</td>")
Response.Write("<td align=left>"&Rs("SK_ShTime")&"</td>")
RsShUID.close
Set RsShUID=Nothing
if Rs("SK_SHContent")<>"" then
Response.Write("<td align=left>"&Rs("SK_SHContent")&"</td>")
else
Response.Write("<td align=left></td>")
end if
if Rs("SK_Feet")=0 then
Response.Write("<td align=left><font color=red>未借款</font></td>")
else
Response.Write("<td align=left><font color=blue>已借款</font></td>")
end if
set RsFinUID=server.createobject("adodb.recordset")
SqlFinUID="select * from SK_SystemUsers where UsersID="&Rs("SK_FinUID")&""
RsFinUID.open SqlFinUID,conn,1,1
Response.Write("<td align=left>"&RsFinUID("SK_OName")&"</td>")
Response.Write("<td align=left>"&Rs("SK_FinTime")&"</td>")
RsFinUID.close
Set RsFinUID=Nothing
set RsBUsers=server.createobject("adodb.recordset")
SqlBUsers="select * from SK_SystemUsers where UsersID="&Rs("SK_SalesID")&""
RsBUsers.open SqlBUsers,conn,1,1
Response.Write("<td align=left>"&RsBUsers("SK_OName")&"</td>")
RsBUsers.close
Set RsBUsers=Nothing
Response.Write("<td align=left>"&Rs("SK_Addor")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Time")&"</td>")
'------------------------------------------
Response.Write("</tr>"&VBCrlf)
rs.movenext
wend

elseif F("id")<>"" then '当选择有ID时输出数据开始
str2=split(F("id"),",")
for i=0 to ubound(str2)
Set Rs = Server.CreateObject("ADODB.Recordset")
sql="select * from SK_OfficeBorrow where SK_ShFeet=1 and SK_Del=0 and BorrowID="&trim(str2(i))
RS.Open Sql,Conn,1,1
Response.Write("<tr bgcolor=FFFFFF>"&VBCrlf)
'-----------------------------------------
set RsPay=server.createobject("adodb.recordset")
SqlPay="select * from SK_SystemCategory where SK_Di=14 and CategoryID="&Rs("SK_Di")&""
RsPay.open SqlPay,conn,1,1
Response.write"<td align=left>"&RsPay("SK_Name")&"</td>"
RsPay.close
Set RsPay=Nothing
Response.Write("<td align=left>"&Rs("SK_Title")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Atime")&"</td>")
Response.write"<td align=center><font color=blue>"&formatnumber(Rs("SK_Amount"),2)&"</font></td>"
if Rs("SK_ShFeet")=0 then 
Response.Write("<td align=left><font color=""#009999"">未审核</font></td>")
elseif Rs("SK_ShFeet")=1 then
Response.Write("<td align=left><font color=""#0066FF"">已通过</font></td>")
elseif Rs("SK_ShFeet")=2 then
Response.Write("<td align=left><font color=""red"">未通过</font></td>")
end if
set RsShUID=server.createobject("adodb.recordset")
SqlShUID="select * from SK_SystemUsers where UsersID="&Rs("SK_ShUID")&""
RsShUID.open SqlShUID,conn,1,1
Response.Write("<td align=left>"&RsShUID("SK_OName")&"</td>")
Response.Write("<td align=left>"&Rs("SK_ShTime")&"</td>")
RsShUID.close
Set RsShUID=Nothing
if Rs("SK_SHContent")<>"" then
Response.Write("<td align=left>"&Rs("SK_SHContent")&"</td>")
else
Response.Write("<td align=left></td>")
end if
if Rs("SK_Feet")=0 then
Response.Write("<td align=left><font color=red>未借款</font></td>")
else
Response.Write("<td align=left><font color=blue>已借款</font></td>")
end if
set RsFinUID=server.createobject("adodb.recordset")
SqlFinUID="select * from SK_SystemUsers where UsersID="&Rs("SK_FinUID")&""
RsFinUID.open SqlFinUID,conn,1,1
Response.Write("<td align=left>"&RsFinUID("SK_OName")&"</td>")
Response.Write("<td align=left>"&Rs("SK_FinTime")&"</td>")
RsFinUID.close
Set RsFinUID=Nothing
set RsBUsers=server.createobject("adodb.recordset")
SqlBUsers="select * from SK_SystemUsers where UsersID="&Rs("SK_SalesID")&""
RsBUsers.open SqlBUsers,conn,1,1
Response.Write("<td align=left>"&RsBUsers("SK_OName")&"</td>")
RsBUsers.close
Set RsBUsers=Nothing
Response.Write("<td align=left>"&Rs("SK_Addor")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Time")&"</td>")
'------------------------------------------
Response.Write("</tr>"&VBCrlf)
next
end if '当选择有ID时输出数据结束

Response.Write("</table>")

Call CloseDB()
'导出员工借款到Excel结束
%>