?? save_outward.asp
字號:
<%@ LANGUAGE="VBSCRIPT" %>
<%const title="確認數據"%>
<%
response.buffer=true
Response.Expires = 0
Response.CacheControl = "Private"
%>
<!-- #include file=../data/username.inc-->
<!-- #include file=../data/connect.asp-->
<!--#include file=../data/myPrg.asp-->
<head>
<meta http-equiv="Content-Type"content="text/html; charset=gb_2312-80">
<title><%=title%></title>
<link rel="stylesheet" type="text/css" href="../data/forum.css">
</head>
<body topmargin=0>
<%
newcompanyid = request("companyid")
if newcompanyid = "" then
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "alert(""請先選擇公司再做此步操作!"");"
Response.write "history.go(-1);"
Response.Write "</script>"
Response.End
elseif not isnumeric(newcompanyid) then
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "alert(""companyid必須為整數!"");history.go(-1);"
Response.Write "</script>"
Response.End
else
newcompanyid = cint(newcompanyid)
end if
inve_last_date = now()
arra = split(session("username"),";")
UserCompanyid = arra(0)
flag = arra(1)
User = arra(2)
userno = arra(4)
if flag > 4 then
call closedatabase
Response.End
end if
msg=""
dc_id = request("dc_id")
dc_id = replace(dc_id,"'","")
prod_id = request("smalllocation")
prod_id = replace(prod_id,"'","")
'出庫數量outw_no
outw_no = trim(Request.Form("outw_no"))
sql = "select inve_id,inve_maysent,inve_total from inventory where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_disabled = 0 and inve_companyid = "&newcompanyid&""
'Response.Write sql
'Response.End
set rs_inve = conn.execute(sql)
if not rs_inve.eof then
id = rs_inve("inve_id")
inve_maysent = rs_inve("inve_maysent")
inve_total = rs_inve("inve_total")
'response.write inve_total
'response.end
'填寫日期outw_date,日期consign_date,時間consign_time
'SRA號outw_sra,出庫方式outw_type
'目的地outw_where,takeman_id,時限要求yuji_time
'出庫摘要outw_beizu
outw_date = trim(Request.Form("outw_date"))
consign_date = trim(Request.Form("consign_date"))
consign_time = trim(Request.Form("consign_time"))
outw_sra = trim(Request.Form("outw_sra"))
outw_sra = replace(outw_sra,"'","’")
outw_type = request("outw_type")
outw_where = trim(Request.Form("outw_where"))
takeman_id = trim(Request.Form("takeman_id"))
takeman_id = replace(takeman_id,"'","’")
guest_code=Request.Form("guest_code")
guest_code = replace(guest_code,"'","’")
yuji_time = trim("2006-6-6 18:18")
outw_beizu = trim(Request("outw_beizu"))
outw_beizu = replace(outw_beizu,"'","’")
direct = request("direct")
'if isnumeric(direct) then
if direct = 1 then
direct = 1
inwa_take_address = Request.Cookies("take_address")
inwa_line_no = trim(Request.Cookies("line_no"))
if inwa_line_no = "" then inwa_line_no = " "
inwa_take_no = trim(Request.Cookies("take_no"))
if inwa_take_no = "" then inwa_take_no = " "
else
direct = 0
inwa_take_address = " "
inwa_line_no = " "
inwa_take_no = " "
end if
if cint(direct) = 0 then
if clng(inve_maysent) <= 0 then
rs_inve.close
set rs_inve = nothing
call closedatabase
Response.Write "<script language=javascript>"
response.write "alert(""現在的總庫存是 " & inve_total & " ,\n可分發數量是" & inve_maysent & " ,\n由于可分發數量不大于0 \n所以你不能做該產品的出庫操作!"");"
response.write "history.back();"
response.write "</script>"
response.end
end if
if (clng(outw_no) > clng(inve_maysent)) then
rs_inve.close
set rs_inve = nothing
call closedatabase
Response.Write "<script language=javascript>"
response.write "alert(""現在的總庫存是 " & inve_total & " \n可分發數量是 " & inve_maysent & " \n出庫數量是" & outw_no & "\n由于出庫數量大與可分發數量!\n所以你不能做該產品的出庫操作!"");"
response.write "history.back();"
response.write "</script>"
response.end
'msg = msg + "出庫數量不得大與可分發數量!<br>"
end if
end if
if outw_where = 0 then
msg = msg + "請選擇領貨人!<br>"
end if
if msg<>"" then
rs_inve.close
set rs_inve = nothing
call closedatabase
showerror(msg)
Response.End
else
'將相應的日期格式轉換成正確的日期格式
'并且將信息寫入到cookies中以便用戶在下次錄入時不必輸入
if outw_date = "" then outw_date = now()
if outw_yuji_time = "" then outw_yuji_time = now()
outw_date = replace(outw_date,":",":")
consign_date = replace(consign_date,":",":")
consign_time = replace(consign_time,":",":")
yuji_time = replace(yuji_time,":",":")
prod_flag = request("biglocation")
Response.Cookies("prod_flag") = prod_flag
Response.Cookies("dc_id") = dc_id
Response.Cookies("prod_id") = prod_id
Response.Cookies("outw_date") = outw_date
Response.Cookies("consign_date") = consign_date
Response.Cookies("consign_time") = consign_time
Response.Cookies("outw_sra") = outw_sra
Response.Cookies("info_type") = outw_type
Response.Cookies("outw_where") = outw_where
Response.Cookies("takeman_id") = takeman_id
Response.Cookies("yuji_time") = yuji_time
consign_datetime = consign_date&" "&consign_time
if takeman_id = "" then takeman_id = " "
if outw_beizu = "" then outw_beizu = " "
if trim(session("username")) = "" then
rs_inve.close
set rs_inve = nothing
call closedatabase
Response.Redirect "../user/defaut.asp"
Response.End
end if
'開始事務處理
'-------------
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from guest where guest_code='"&guest_code&"'", conn, 1, 3
if not rs.eof then
guest_id=rs("guest_id")
end if
rs.close
set rs=nothing
sql ="select * from outward where outw_sra = '"&outw_sra&"' and outw_companyid = "&newcompanyid&""
set rs_flag = conn.execute(sql)
if rs_flag.eof then
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from outward", conn, 1, 3
rs.AddNew
rs("outw_date")=outw_date
rs("outw_fact_date")=consign_date
rs("outw_sra")=outw_sra
rs("outw_dc_id")=dc_id
rs("outw_consign_date")=consign_datetime
rs("outw_take_address")=inwa_take_address
rs("outw_line_no")=inwa_line_no
rs("outw_take_no")=outw_no
rs("outw_service_man")=User
rs("outw_service_beizu")=outw_beizu
rs("outw_flag")=outw_flag
rs("outw_companyid")=newcompanyid
rs("outw_disabled")=0
rs("outw_dir_flag")=0
rs("attemper_flag")=0
rs("tiaoma_flag")=0
rs("stock_flag")=0
rs("cull_flag")=0
outwardid = rs("outw_id")
rs.Update
rs.close
sql = "insert into outward_detail(detail_outw_id,detail_guest_id,detail_prod_id,detail_no,detail_companyid,detail_date,detail_man,detail_io_flag) values("&outwardid&","&guest_id&","&prod_id&","&outw_no&","&newcompanyid&",'"&outw_date&"','"&User&"',0)"
conn.execute(sql)
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from outward_detail where detail_outw_id="&outwardid&"", conn, 1, 3
if not rs.eof then
detail_id=rs("detail_id")
end if
rs.close
set rs=nothing
'sql = "insert into detail_info(info_outw_id,info_takeman_id,info_yuji_time,info_order_beizu,info_order_man,info_detail_id) values("&outwardid&","&takeman_id&","&yuji_time&","&outw_beizu&",'"&user&"',"&detail_id&")"
'conn.execute(sql)
set rs_info=server.CreateObject("adodb.recordset")
rs_info.Open "select * from detail_info", conn, 1, 3
rs_info.AddNew
rs_info("info_outw_id")=outwardid
rs_info("info_takeman_id")=takeman_id
rs_info("info_yuji_time")=yuji_time
rs_info("info_order_beizu")=outw_beizu
rs_info("info_order_man")=user
rs_info("info_detail_id")=detail_id
rs_info.Update
rs_info.close
if outw_flag = 0 then 'o為等待
sql = "update inventory set inve_fenpei = inve_fenpei + " & outw_no & ",inve_last_date = '" & inve_last_date &"' where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0"
conn.execute(sql)
'lseif inwa_flag = 1 then
' sql = "update inventory set inve_ruku = inve_ruku + " & inwa_rec_no & ",inve_maysent = inve_maysent + " & inwa_rec_no & ",inve_total = inve_total +"&inwa_rec_no&",inve_last_date = '"&inve_last_date & "' where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0 "
' conn.execute(sql)
end if
'結束事務處理
'update語句-----更新"已分配數量"數據
if err.number <> 0 then
rs_flag.close
set rs_flag = nothing
rs_inve.close
set rs_inve = nothing
call closedatabase
response.write "<p>無法保存,數據庫操作出錯:" + err.description + "</p>"
Response.Write "<p>請稍后再試!</p>"
Response.End
end if
rs_flag.close
set rs_flag = nothing
rs_inve.close
set rs_inve = nothing
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "var myTime = new Date(); "
Response.Write "var timeNow = myTime.getTime();"
Response.Write "{if (confirm(""數據已確認,繼續進行該筆單子的出庫操作嗎?""))"
if direct = 0 then
Response.Write "window.location ='outward_2.asp?id="&outwardid&"&companyid="&newcompanyid&"&inward_second=yes&tt='+timeNow;"
elseif direct = 1 then
Response.Write "window.location ='outward_2.asp?id="&outwardid&"&companyid="&newcompanyid&"&inward_second=yes&direct=1&tt='+timeNow;"
end if
Response.Write "else "
Response.Write "{"
Response.Write "window.location ='outward.asp?companyid="&newcompanyid&"&tt='+timeNow;"
Response.Write "}"
Response.Write "}"
Response.Write "</script>"
Response.End
else
outwardid = rs_flag("outw_id")
cull_flag = rs_flag("cull_flag")
rs_flag.close
set rs_flag = nothing
rs_inve.close
set rs_inve = nothing
call closedatabase
if cull_flag = True then
Response.Write "<script language=javascript>"
Response.Write "alert(""由于該SRA的操作已完成,所以你不能進行派送操作!\n\n請在派送通知里填入其它的SRA號碼進行操作!"");"
Response.Write "history.back();"
Response.Write "</script>"
Response.End
end if
Response.Write "<script language=javascript>"
Response.Write "var myTime = new Date(); "
Response.Write "var timeNow = myTime.getTime();"
Response.Write "{if (confirm(""該SRA號碼已存在,將該筆單子追加到以前的入庫操作記錄中嗎?""))"
Response.Write "window.location ='outward_2.asp?id="&outwardid&"&companyid="&newcompanyid&"&database=yes&inward_second=yes&tt='+timeNow;"
Response.Write "else "
Response.Write "{alert(""注意:系統中已有該SRA號碼,請修改,以便將其錄入到系統中!!!"");"
Response.Write "history.go(-1);}"
Response.Write "}"
Response.Write "</script>"
Response.End
end if
end if
else
Response.Write "您沒有權限對這個數據進行操作<br>"
Response.Write "想要更多操作,請與管理員聯系<br>"
Response.Write "該產品可能尚未進行初始化!<br>"
Response.Write "<a href=javascript:history.go(-1);>后退</a>"
end if
rs_inve.close
set rs_inve = nothing
call closedatabase
%>
<!--#include file=../data/copyright.asp-->
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -