<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="../Inc/Conn.asp" -->
<!--#include file="../Inc/SK.Session.asp" -->
<!--#include file="../Inc/SK.Funtion.asp" -->
<%if Not (Getconfig("SK_Sales")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK300000000") AND JudgePopedomTF(Session("UserName"),"SK300000700")))) then Call ReturnError()%>
<%
if not isnumeric(JCID(F("ID"))) then Call ReturnError10()
set rs=server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql="SELECT * from SK_SalesReturns where ReturnsID="&JCID(F("ID"))&""
elseif Session("Manager")=3 then
sql="SELECT * from SK_SalesReturns where ReturnsID="&JCID(F("ID"))&""
elseif Session("Manager")=4 then
sql="SELECT * from SK_SalesReturns where ReturnsID="&JCID(F("ID"))&""
elseif Session("Manager")=5 then
sql="SELECT * from SK_SalesReturns where ReturnsID="&JCID(F("ID"))&""
elseif Session("Manager")=6 then
sql="SELECT * from SK_SalesReturns where SK_SalesID="&Session("UID")&" AND ReturnsID="&JCID(F("ID"))&""
end if
rs.Open sql,conn,1,1
if rs.eof and rs.bof then Call ReturnError4()
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>查看产品订单退货</title>
<META http-equiv=Page-Enter content=SKCRM>
<META http-equiv=Page-Exit content=SKCRM>
<META content="MSHTML 6.00.3790.2858" name=GENERATOR>
<LINK href="../images/style.css" type=text/css rel=stylesheet>
<script language="javascript" src="../Inc/Check.js"></script>
<script language="javascript" src="../Inc/Calendar.js"></script>
<script language="javascript" src="../Inc/jquery.js"></script>
<SCRIPT language=javascript src="../inc/Openwin.js"></SCRIPT>
<style type="text/css">
<!--
body {
margin: 5px 0px 5px 0px;
overflow-x: hidden;
}
-->
</style>
</head>
<body>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<TBODY>
<tr>
<td class="SK_Td_Top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="25"><img src="../images/tab_03.gif" width="12" height="25" /></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" valign="middle">查看产品订单退货</td>
<td width="54%"></td>
</tr>
</table></td>
<td width="16"><img src="../images/tab_07.gif" width="16" height="25" /></td>
</tr>
</table></td>
</tr>
<tr>
<td>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" background="../images/tab_12.gif"></td>
<td>

<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6">
<tr>
  <td width="12%" class="SK_Text2">关联订单</td>
  <td width="33%" class="SK_Text1"><%
set rsOrders=server.createobject("adodb.recordset")
sqlOrders="select * from SK_SalesOrders where OrdersID="&Rs("SK_OrderID")&""
rsOrders.open sqlOrders,conn,1,1
if rsOrders.eof and rsOrders.bof then Call ReturnError21()
Response.write""&RsOrders("SK_OrdersNo")&""
RsOrders.close
set RsOrders=Nothing
%></td>
  <td width="12%" class="SK_Text2">关联客户</td>
  <td width="43%" class="SK_Text1"><%
set rsClient=server.createobject("adodb.recordset")
sqlClient="select * from SK_Client where ClientID="&Rs("SK_ClientID")&""
rsClient.open sqlClient,conn,1,1
if rsClient.eof and rsClient.bof then Call ReturnError13()
Response.write""&RsClient("SK_Wname")&""
RsClient.close
Set RsClient=Nothing
%></td>
</tr>
<tr>
  <td class="SK_Text2">退货日期</td>
  <td class="SK_Text1"><%=Rs("SK_Atime")%></td>
  <td class="SK_Text2">退货原因</td>
  <td class="SK_Text1"><%
set rsDi=server.createobject("adodb.recordset")
sqlDi="select * from SK_SystemCategory where SK_Di=46 and CategoryID="&Rs("SK_Di")&""
rsDi.open sqlDi,conn,1,1
Response.write"<font color=blue>"&RsDi("SK_Name")&"</font>"
RsDi.close
set RsDi=Nothing
%></td>
</tr>
<tr>
  <td class="SK_Text2">退货状态</td>
  <td class="SK_Text1"><% 
Response.write"<font color=blue>"
if Rs("SK_Feet")=0 then
Response.write"计划退货"
elseif Rs("SK_Feet")=1 then
Response.write"已经退货"
elseif Rs("SK_Feet")=2 then
Response.write"申请入库"
elseif Rs("SK_Feet")=3 then
Response.write"已经入库"
end if
Response.write"</font>"
%></td>
  <td class="SK_Text2">&nbsp;</td>
  <td class="SK_Text1"></td>
</tr>
<tr>
  <td valign="top" class="SK_Text2">退货备注</td>
  <td colspan="3" valign="top" class="SK_FContent"><%=Rs("SK_ReContent")%></td>
</tr>
<%
'自定义选项开始
set RsOptions=server.createobject("adodb.recordset")
sqlOptions="SELECT * from SK_SalesOptions where SK_Di=6 and SK_ShowOnForm=0 Order by SK_OrderID asc"
RsOptions.Open sqlOptions,conn,1,1
if RsOptions.bof and RsOptions.eof then
else
%>
<tr>
<td colspan="4" class="SK_Title1">自定义选项</td>
</tr>
<tr>
<td colspan="4" class="SK_Text1">
<%
Response.write"<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""1"">"
for Optionsi=1 to RsOptions.recordCount '变量i从1循环到数据库中的全部记录数 
if (Optionsi mod 2 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr>" 
end if
Response.write"<td class=""SK_Text2"" width=""12%"">"&RsOptions("SK_Title")&"</td><td class=""SK_Text1"">"

Set rs1=Server.CreateObject("ADODB.RecordSet") 
sql1="SELECT * from SK_SalesOptionsDetail where SK_OptionsID="&RsOptions("FieldID")&" and OptionsDetailID="&rs(""&RsOptions("SK_FieldName")&"")&"" 
rs1.Open sql1,conn,1,1
Response.write""&rs1("SK_OName")&""
rs1.close
set rs1=Nothing

Response.write"</td>"
if (Optionsi mod 2 = 0) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "</tr>" 
end if 
RsOptions.movenext 
next 
Response.write"</table>"
%></td>
</tr>
<%
end if
RsOptions.close
set RsOptions=Nothing
'自定义选项结束
'自定义字段开始
set RsFields=server.createobject("adodb.recordset")
sqlFields="SELECT * from SK_SalesFields where SK_Di=6 and SK_ShowOnForm=0 Order by SK_OrderID asc"
RsFields.Open sqlFields,conn,1,1
if RsFields.bof and RsFields.eof then
else
%>
<tr>
<td colspan="4" class="SK_Title1">自定义字段</td>
</tr>
<tr>
<td colspan="4" class="SK_Text1">
<%
Response.write"<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""1"">"
for Fieldsi=1 to RsFields.recordCount '变量i从1循环到数据库中的全部记录数 
if (Fieldsi mod 2 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr>" 
end if
Response.write"<td class=""SK_Text2"" width=""12%"">"&RsFields("SK_Title")&"</td><td class=""SK_Text1"">"&Rs(""&RsFields("SK_FieldName")&"")&"</td>"
if (Fieldsi mod 2 = 0) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "</tr>" 
end if 
RsFields.movenext
next 
Response.write"</table>"
%></td>
</tr>
<%
end if
RsFields.close
set RsFields=Nothing
'自定义字段结束
%>
<tr>
  <td colspan="4" class="SK_Title1">其他信息</td>
</tr>
<tr>
  <td valign="top" class="SK_Text2">业务人员</td>
  <td class="SK_Text1"><%
set RsSales=server.createobject("adodb.recordset")
SqlSales="select * from SK_SystemUsers where UsersID="&RS("SK_SalesID")&""
RsSales.open SqlSales,conn,1,1
Response.write""&RsSales("SK_OName")&""
RsSales.close
Set RsSales=Nothing
%></td>
  <td class="SK_Text2">&nbsp;</td>
  <td class="SK_Text1">&nbsp;</td>
</tr>
<tr>
  <td valign="top" class="SK_Text2">创建人员</td>
  <td class="SK_Text1"><%=Rs("SK_Addor")%></td>
  <td class="SK_Text2">新建时间</td>
  <td class="SK_Text1"><%=Rs("SK_Time")%></td>
</tr>
<%if Rs("SK_Editor")<>"0" then%>
<tr>
  <td valign="top" class="SK_Text2">修改人员</td>
  <td class="SK_Text1"><%
set RsClientEditor=server.createobject("adodb.recordset")
SqlClientEditor="select * from SK_SystemUsers where UsersID="&Rs("SK_Editor")&""
RsClientEditor.open SqlClientEditor,conn,1,1
Response.write"<font color=#999999>"&RsClientEditor("SK_OName")&"</font>"
RsClientEditor.close
Set RsClientEditor=Nothing
%></td>
  <td class="SK_Text2">修改时间</td>
  <td class="SK_Text1"><%=Rs("SK_ETime")%></td>
</tr>
<%end if%>

<tr>
  <td colspan="4" class="SK_Title1">产品退货明细</td>
</tr>
<tr>
<td colspan="4" valign="top" class="SK_Text">

<!--产品列表开始-->
<%
Dim RsDetail,J
set RsDetail=Server.createobject("adodb.recordset")
sqlDetail="select * from SK_SalesReturnsDetail where SK_ReturnsID="&Rs("ReturnsID")&" order by ReturnsDetailID asc"
RsDetail.open sqlDetail,conn,1,1
if RsDetail.bof and RsDetail.eof then 
Call ReturnError8()
else
%>
<TABLE width="100%" border=1 align="center" cellPadding=1 cellSpacing=0 borderColor=#ffffff borderColorLight=#dfdfdf borderColorDark=#ffffff>
 <tr>
  <th width="36%" class="Pheadtd">产品名称</th>
   <th width="23%" class="Pheadtd">数量</th>
   <th width="20%" class="Pheadtd">单价</th>
   <th width="21%" class="Pheadtd">金额</th>
   </tr>
<%
For J = 1 To RsDetail.recordcount
set rsProduct=server.createobject("adodb.recordset")
sqlProduct="select * from SK_Product where ProID="&RsDetail("SK_ProID")&""
rsProduct.open sqlProduct,conn,1,1
set RsUnit=server.createobject("adodb.recordset")

SqlUnit="select * from SK_SystemCategory where SK_Di=161 and CategoryID="&rsProduct("SK_Unit")&""
RsUnit.open SqlUnit,conn,1,1
%>
<tr>
  <td class="Ptetd"><%=RsProduct("SK_ProName")%></td>
  <td class="Ptetd"><%=RsDetail("SK_Total")%> / <%=RsUnit("SK_Name")%></td>
  <td class="Ptetd"><%=formatnumber(RsDetail("SK_Price"),2)%></td>
  <td class="Ptetd"><%=formatnumber(RsDetail("SK_Price")*RsDetail("SK_Total"),2)%></td>
  </tr>
<%
RsUnit.close
Set RsUnit=Nothing

rsProduct.close
RsDetail.movenext
next
%>
<tr>
  <td colspan="3" class="Ptetd">合计</td>
  <td class="Ptetd"><%
set RsAG=server.createobject("adodb.recordset")
SqlAG="select sum(SK_Total*SK_Price) as AG from SK_SalesReturnsDetail where SK_ReturnsID="&Rs("ReturnsID")&""
RsAG.open SqlAG,Conn,1,1
Response.write"<font color=blue>"&formatnumber(RsAG("AG"),2)&"</font>"
RsAG.close
set RsAG=Nothing
%></td>
  </tr>
</table>
<%
end if
RsDetail.close
Set RsDetail=Nothing
%>
<!--产品列表结束--></td>
</tr>

<tr>
<td colspan="4" class="SK_Text">
<%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK300000704") then%>
<input type="button" value=" 导出 " class="button1" onClick="location.href='SK.ExcelProReturnedDetail.asp?ID=<%=Rs("ReturnsID")%>'">
<%end if%>
<input type="button" value=" 打印 " class="button1" onClick="location.href='SK.PrintProReturned.asp?ID=<%=Rs("ReturnsID")%>'">
<input type="button" value=" 关闭 " onClick="window.close();" class="button1" /></td>
</tr>
</table>

</td>
<td width="8" background="../images/tab_15.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="SK_Td_Foot">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" height="20"><img src="../images/tab_18.gif" width="12" height="20" /></td>
<td width="98%" class="SK_Td_Page"></td>
<td width="1%"><img src="../images/tab_20.gif" width="16" height="20" /></td>
</tr>
</table>

</td>
</tr>
</TBODY>
</table>
</body>
<%
Call CloseDB()
%>
</html>