<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"),"SK300000402")))) 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_SalesOrders where SK_ShFeet=1 and OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=3 then
sql="SELECT * from SK_SalesOrders INNER JOIN SK_SystemUsers ON SK_SalesOrders.SK_SalesID=SK_SystemUsers.UsersID where SK_SalesOrders.SK_ShFeet=1 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SalesOrders.OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=4 then
sql="SELECT * from SK_SalesOrders INNER JOIN SK_SystemUsers ON SK_SalesOrders.SK_SalesID=SK_SystemUsers.UsersID where SK_SalesOrders.SK_ShFeet=1 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SalesOrders.OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=5 then
sql="SELECT * from SK_SalesOrders INNER JOIN SK_SystemUsers ON SK_SalesOrders.SK_SalesID=SK_SystemUsers.UsersID where SK_SalesOrders.SK_ShFeet=1 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_SalesOrders.OrdersID="&JCID(F("ID"))&""
elseif Session("Manager")=6 then
sql="SELECT * from SK_SalesOrders where SK_ShFeet=1 and SK_SalesID="&Session("UID")&" and OrdersID="&JCID(F("ID"))&""
end if
rs.Open sql,conn,1,1
if rs.eof and rs.bof then Call ReturnError4()

'Mod
if RQ("Action")="Mod" and F("ID")<>"" and F("S_ExpressNo")<>"" and F("S_ExpressID")<>"" and F("S_ExpressTotal")<>"" and F("S_ExpressTime")<>"" and F("S_ExpressToUsers")<>"" and F("S_ExpressAddress")<>"" then
Call ChkIsOuter()
set rs=server.createobject("adodb.recordset")
sql="select * from SK_SalesOrders where SK_ShFeet=1 and SK_Delivery=0 and OrdersID="&F("ID")&""
rs.open sql,conn,1,3
rs("SK_ExpressID")=NoCSSHackInput(F("S_ExpressID"))
rs("SK_ExpressNo")=NoCSSHackInput(F("S_ExpressNo"))
rs("SK_ExpressTotal")=NoCSSHackInput(F("S_ExpressTotal"))
rs("SK_ExpressTime")=NoCSSHackInput(F("S_ExpressTime"))
rs("SK_ExpressToUsers")=NoCSSHackInput(F("S_ExpressToUsers"))
rs("SK_ExpressToTel")=NoCSSHackInput(F("S_ExpressToTel"))
rs("SK_ExpressAddress")=NoCSSHackInput(F("S_ExpressAddress"))
rs("SK_ExpressContent")=NoCSSHackContent(F("S_ExpressContent"))
rs("SK_Delivery")="1"
rs("SK_Editor")=Session("UID")
rs("SK_Etime")=Now()
rs.Update
rs.Close 
set rs=Nothing

'Event Begin
if getconfig("SK_Event")=0 then
set rsEvent=server.createobject("adodb.recordset")
sqlEvent="select * from SK_SystemEvent"
rsEvent.open sqlEvent,conn,1,3
rsEvent.AddNew
rsEvent("SK_Title")="订单发货："&NoCSSHackInput(F("S_OrdersNo"))&""
rsEvent("SK_User")=Session("UserName")
rsEvent("SK_Time")=Now()
rsEvent("SK_IP")=request.ServerVariables("Remote_Addr")
rsEvent.Update
rsEvent.Close 
set rsEvent=Nothing
end if
'Event End
Call Returnokclose()
end if
%>
<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>
<script>
window.onbeforeunload = function()
{
if (document.body.offsetWidth-50 < event.VendX && event.VendY<0)
{
return "是否关闭当前窗口？关闭本窗口将放弃修改信息！";
}
}

function check(){
  if (document.thisForm.S_ExpressID.value=="")
  {
  alert("对不起,请选择快递公司！");
  document.thisForm.S_ExpressID.focus();
  return false;
  }
  if (document.thisForm.S_ExpressNo.value=="")
  {
  alert("对不起,发货单号不能为空！");
  document.thisForm.S_ExpressNo.focus();
  return false;
  }
  if (document.thisForm.S_ExpressTotal.value=="")
  {
  alert("对不起,发货费用不能为空！");
  document.thisForm.S_ExpressTotal.focus();
  return false;
  }
  if (document.thisForm.S_ExpressTime.value=="")
  {
  alert("对不起,发货日期不能为空！");
  document.thisForm.S_ExpressTime.focus();
  return false;
  }
  if (document.thisForm.S_ExpressToUsers.value=="")
  {
  alert("对不起,收件人不能为空！");
  document.thisForm.S_ExpressToUsers.focus();
  return false;
  }
  if (document.thisForm.S_ExpressToTel.value=="")
  {
  alert("对不起,收件人联系电话不能为空！");
  document.thisForm.S_ExpressToTel.focus();
  return false;
  }
  if (document.thisForm.S_ExpressAddress.value=="")
  {
  alert("对不起,收件地址！");
  document.thisForm.S_ExpressAddress.focus();
  return false;
  }
}
</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>

<form name="thisForm" id="form1" method="post" action="?Action=Mod">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6">

<tr>
  <td width="14%" class="SK_Text2">关联客户</td>
  <td 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>
  <td width="13%" class="SK_Text2">订单编号</td>
  <td width="40%" class="SK_Text1"><%=Rs("SK_OrdersNo")%></td>
</tr>
<tr>
  <td class="SK_Text2">快递公司</td>
  <td class="SK_Text1"><select name="S_ExpressID">
<option value="" <%if Rs("SK_ExpressID")="" OR Rs("SK_ExpressID")="0" Then%>selected<%end if%>>---请选择---</option>
<%
set RsExpress=Server.Createobject("adodb.recordset")
RsExpress.open "SELECT * from SK_Express",conn,1,1
for Express=1 to RsExpress.recordcount
selected=""
if Rs("SK_ExpressID")=RsExpress("ExpressID") then selected="selected='selected'"
response.Write("<option "&selected&" value="&RsExpress("ExpressID")&">"&RsExpress("SK_Company")&"</option>")
RsExpress.movenext
next
RsExpress.close
set RsExpress=Nothing
%>
</select> <font color=red>*</font></td>
  <td class="SK_Text2">发货单号</td>
  <td class="SK_Text1"><input name="S_ExpressNo" type="text" size="15" value="<%=Rs("SK_ExpressNo")%>"> <font color=red>*</font></td>
</tr>
<tr>
  <td class="SK_Text2">发货费用</td>
  <td class="SK_Text1"><input name="S_ExpressTotal" type="text" size="10" value="<%=Rs("SK_ExpressTotal")%>"> <font color=red>*</font></td>
  <td class="SK_Text2">发货日期</td>
  <td class="SK_Text1"><input name="S_ExpressTime" type="text" size="12" value="<%=Rs("SK_ExpressTime")%>" onClick="new Calendar().show(this);" readOnly /></td>
</tr>
<tr>
  <td class="SK_Text2">收件人名</td>
  <td class="SK_Text1"><input name="S_ExpressToUsers" type="text" size="15" value="<%=Rs("SK_ExpressToUsers")%>"></td>
  <td class="SK_Text2">联系电话</td>
  <td class="SK_Text1"><input name="S_ExpressToTel" type="text" size="15" value="<%=Rs("SK_ExpressToTel")%>"></td>
</tr>
<tr>
  <td valign="top" class="SK_Text2">收件地址</td>
  <td colspan="3" class="SK_Text1"><input name="S_ExpressAddress" type="text" size="50" value="<%=Rs("SK_ExpressAddress")%>"></td>
</tr>

<tr>
  <td valign="top" class="SK_Text2">发货备注</td>
  <td colspan="3" class="SK_Text1"><IFRAME ID="eWebEditor1" SRC="<%=getconfig("SK_EditorPath")%>/ewebeditor.htm?id=S_ExpressContent&style=mini" FRAMEBORDER="0" SCROLLING="no" WIDTH="600" HEIGHT="200"></IFRAME>
<input type="hidden" name="S_ExpressContent" value="<%=Rs("SK_ExpressContent")%>"></td>
</tr>

<tr>
<td colspan="4" class="SK_Text">
<input type="hidden" name="ID" value="<%=rs("OrdersID")%>">
<INPUT class="button1" type="submit" onClick="return check();"  value=" 发货 "> 
<input type="button" value=" 关闭 " onClick="window.opener.location.reload();window.close();" class="button1" /></td>
</tr>
</table>
</form>

</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>