?? inward_prod_no_edit.asp
字號:
<%@ LANGUAGE="VBSCRIPT" %>
<%
response.buffer=true
Response.Expires = 0
Response.CacheControl = "Private"
%>
<%const title="入庫詳細信息修改"%>
<!-- #include file=../data/username.inc-->
<!-- #include file=../data/connect.asp-->
<!--#include file=../data/myPrg.asp-->
<html>
<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" onload="javascript:self.moveTo(0,0)">
<%
if isempty(session("username")) then
call closedatabase
Response.Write "請重新登入!"
Response.End
end if
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
arra = split(session("username"),";")
UserCompanyid = arra(0)
flag = arra(1)
User = arra(2)
userno = arra(4)
detail_id = request("idetail_id")
if not isnumeric(detail_id) then
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "alert(""ID必須為數字!"");"
Response.write "history.go(-1);"
Response.Write "</script>"
Response.End
end if
ziti_flag = request("ziti_flag")
if flag > 4 then
call closedatabase
Response.End
end if
if Request.ServerVariables("REQUEST_METHOD")="POST" then
dim detail_no_now
dim prod_id_now
detail_no_now = clng(trim(request("detail_no")))
prod_id_now = clng(Request("prod_id"))
sql = "select * from inward_detail where idetail_id = "&detail_id&" "
set rs_xx = conn.execute(sql)
if not rs_xx.eof then
inwa_id = rs_xx("idetail_inwa_id")
sql = "select * from inward where inwa_id = "&inwa_id&" "
set rs_delete = conn.execute(sql)
if not rs_delete.eof then
dc_id = rs_delete("inwa_dc_id")
if clng(detail_no_now) = 0 then
sql ="select * from inward_edit "
set rs_edit = server.CreateObject("adodb.recordset")
rs_edit.Open sql,conn,3,3
rs_edit.AddNew
rs_edit("inwa_id") = inwa_id
rs_edit("inwa_date_old") = rs_delete("inwa_date")
rs_edit("inwa_fact_date_old") = rs_delete("inwa_fact_date")
rs_edit("inwa_fact_date_now") = now()
rs_edit("inwa_sia_old") = rs_delete("inwa_sia")
rs_edit("inwa_dc_id") = rs_delete("inwa_dc_id")
rs_edit("inwa_type_old") = rs_delete("inwa_type")
rs_edit("inwa_yuji_time_old") = rs_delete("inwa_yuji_time")
rs_edit("inwa_contact_old") = rs_delete("inwa_contact")
rs_edit("inwa_ser_beizu") = rs_delete("inwa_ser_beizu")
rs_edit("inwa_flag") = rs_delete("inwa_flag")
rs_edit("inwa_companyid") = rs_delete("inwa_companyid")
rs_edit("inwa_disabled") = rs_delete("inwa_disabled")
rs_edit("inwa_dir_flag") = rs_delete("inwa_dir_flag")
rs_edit("inwa_take_address_old") = rs_delete("inwa_take_address")
rs_edit("inwa_line_no_old") = rs_delete("inwa_line_no")
rs_edit("inwa_take_no_old") = rs_delete("inwa_take_no")
rs_edit("inattemper") = rs_delete("inattemper")
rs_edit("tiaoma_flag") = rs_delete("tiaoma_flag")
rs_edit("inwa_operate_old") = rs_delete("inwa_operate")
rs_edit("inwa_operate_now") = User
rs_edit.Update
rs_edit.Close
set rs_edit = nothing
end if
else
rs_delete.close
set rs_delete = nothing
rs_xx.close
set rs_xx = nothing
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "alert(""該記錄已經被刪除,請確認!"");"
Response.Write "{opener.location.reload();window.close();}"
Response.Write "</script>"
Response.End
end if
rs_delete.close
set rs_delete = nothing
prod_id = rs_xx("idetail_prod_id")
detail_no = rs_xx("idetail_no")
detail_rec_no = rs_xx("idetail_rec_no")
no = clng(detail_no_now) - clng(detail_no)
'記錄刪除的數據
sql = "select * from inward_detail_edit "
set rs_and = server.CreateObject("adodb.recordset")
rs_and.Open sql,conn,3,3
rs_and.AddNew
rs_and("idetail_id") = rs_xx("idetail_id")
rs_and("idetail_inwa_id") = inwa_id
rs_and("idetail_prod_id_old") = rs_xx("idetail_prod_id")
rs_and("idetail_prod_id_now") = prod_id_now
rs_and("idetail_no_old") = rs_xx("idetail_no")
rs_and("idetail_no_now") = detail_no_now
rs_and("idetail_rec_no_old") = rs_xx("idetail_rec_no")
'rs_and("idetail_rec_no_now") = 0
rs_and("idetail_date_old") = rs_xx("idetail_date")
rs_and("idetail_man_old") = rs_xx("idetail_man")
rs_and("idetail_rec_beizu_old") = rs_xx("idetail_rec_beizu")
if isdate(rs_xx("idetail_rec_date")) then
rs_and("idetail_rec_date_old") = rs_xx("idetail_rec_date")
end if
rs_and("idetail_rec_man_old") = rs_xx("idetail_rec_man")
rs_and("idetail_rec_idcard_old") = rs_xx("idetail_rec_idcard")
rs_and("idetail_rec_operate_old") = rs_xx("idetail_rec_operate")
if isdate(rs_xx("idetail_rec_fact_date")) then
rs_and("idetail_rec_fact_date_old") = rs_xx("idetail_rec_fact_date")
end if
rs_and("idetail_flag") = rs_xx("idetail_flag")
rs_and("edit_operate_man") = User
rs_and("edit_operate_fact_date") = now()
rs_and.Update
rs_and.Close
set rs_and = nothing
if cstr(prod_id) <> cstr(prod_id_now) then
sql = "update inventory set inve_ruku = inve_ruku - "&detail_rec_no&", inve_zaitu = inve_zaitu - "&detail_no&" + "&detail_rec_no&",inve_maysent = inve_maysent - "&detail_rec_no&" ,inve_total = inve_total - "&detail_no&" where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0"
conn.execute(sql)
sql = "delete from inward_detail where idetail_id = "&detail_id&" "
conn.execute(sql)
if clng(detail_no_now) > 0 then
sql = "insert into inward_detail(idetail_inwa_id,idetail_prod_id,idetail_no,idetail_rec_no,idetail_date,idetail_man,idetail_io_flag,idetail_flag) values("&inwa_id&","&prod_id_now&","&detail_no_now&",0,'"&now()&"','"&User&"',0,0)"
conn.execute(sql)
sql = "update inward set inwa_flag = 0 where inwa_id = "&inwa_id&" "
conn.execute(sql)
'o為在途
sql = "update inventory set inve_zaitu = inve_zaitu + " & detail_no_now & ",inve_total = inve_total + " & detail_no_now & ",inve_last_date = '" & inve_last_date &"' where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id_now&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0 "
conn.execute(sql)
end if
else
'未修改產品名稱,即未選擇其它類別(沒有做改動)
if clng(detail_no_now) >= clng(detail_rec_no) then
sql = "update inventory set inve_zaitu = inve_zaitu + "&no&",inve_total = inve_total + "&no&" where inve_dc_id = "&dc_id&" and inve_prod_id = "&prod_id&" and inve_companyid = "&newcompanyid&" and inve_disabled = 0"
conn.execute(sql)
if clng(detail_no_now) > 0 then
sql = "update inward_detail set idetail_flag = 0,idetail_no = "&clng(detail_no_now)&" where idetail_id = "&detail_id&" "
conn.execute(sql)
sql = "update inward set inwa_flag = 0 where inwa_id = "&inwa_id&" "
conn.execute(sql)
else
sql = "delete inward_detail where idetail_id = "&detail_id&" "
conn.execute(sql)
sql = "select * from inward_detail where idetail_inwa_id = "&inwa_id&" "
set rs_dd = conn.execute(sql)
if rs_dd.eof then
sql = "delete from inward where inwa_id = "&inwa_id&" "
conn.execute(sql)
end if
rs_dd.close
set rs_dd = nothing
end if
else
rs_xx.close
set rs_xx = nothing
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "{alert(""已經簽收的數量為 "&detail_rec_no&",但現修改的數量小于簽收數量,所以不能修改!"");history.back();}"
Response.Write "</script>"
Response.End
end if
end if
end if
rs_xx.close
set rs_xx = nothing
call closedatabase
Response.Write "<script language=javascript>"
Response.Write "{alert(""數據修改成功!"");opener.location.reload();window.close();}"
Response.Write "</script>"
Response.End
else
sql = "select * from inward_detail where idetail_id = "&detail_id&" "
set rs_xx = conn.execute(sql)
if not rs_xx.eof then
%>
<form action="inward_prod_no_edit.asp" method="POST" name="output1">
<table align=center width=100% cellspacing='0' cellpadding='0' bordercolorlight='#000000'bordercolordark='#FFFFFF'bgcolor='#DADBFC' border="1">
<tr>
<td colspan=4 align=center bgcolor=red><b><font color=yellow>入庫記錄詳細信息一覽</font></b></td>
</tr>
<%
prod_id = rs_xx("idetail_prod_id")
detail_no = rs_xx("idetail_no")
Response.Write "<tr bgcolor=green>"
Response.Write "<td width=""15%""><b><font color=white> 產品信息:</font></b></td>"
Response.Write "<td width=""35%"">"
Response.Write "<b><font color=white> 產品</font></b></td>"
Response.Write "<td width=""50%"">"
Response.Write "<b><font colspan=""2"" color=white> 數量</font></b></td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width=""25%""> </td>"
Response.Write "<td width=""35%"">"
Response.Write "<select name=""prod_id"" onkeydown=""javascript:if(event.keyCode==13)event.keyCode=9"">"
if ziti_flag = 0 then
sql = "select * from product where prod_dir_flag = 0 and prod_flag = (select prod_flag from product where prod_companyid = "&newcompanyid&" and prod_id = "&prod_id&")"
elseif ziti_flag = 1 then
sql = "select * from product where prod_dir_flag = 1 and prod_flag = (select prod_flag from product where prod_companyid = "&newcompanyid&" and prod_id = "&prod_id&")"
end if
sql = sql + " order by prod_no asc "
set rs_prod = conn.execute(sql)
do while not rs_prod.eof
prod_id_table = rs_prod("prod_id")
prod_no = rs_prod("prod_no")
prod_type = rs_prod("prod_type")
prod_danwei = rs_prod("prod_danwei")
prod_pinming = rs_prod("prod_pinming")
prod_danjia = rs_prod("prod_danjia")
if prod_id = prod_id_table then
Response.Write "<option value="&prod_id_table&" selected>"&prod_no &" " & prod_type &" " & prod_danwei &" " & prod_pinming &" " & prod_weight &" " & prod_volume&"</option>"
else
Response.Write "<option value="&prod_id_table&">"&prod_no &" " & prod_type &" " & prod_danwei &" " & prod_pinming &" " & prod_weight &" " & prod_volume&"</option>"
end if
rs_prod.movenext
loop
rs_prod.close
set rs_prod = nothing
Response.Write "</select>"
Response.Write "</td>"
Response.Write "<td colspan=2 width=""40%"">"
response.write "<input style=""font-size:9pt;width=120;BORDER-TOP-WIDTH: 1px;BORDER-BOTTOM-WIDTH: 2px;BORDER-LEFT-WIDTH: 1px;BORDER-RIGHT-WIDTH: 2px"" type=textbox name='detail_no' value='"&detail_no&"' maxlength=15 onkeydown=""javascript:if(event.keyCode==13)event.keyCode=9"">"
Response.Write "</td>"
'Response.Write "</td>"
Response.Write "</tr>"
rs_xx.close
set rs_xx = nothing
%>
<input type=hidden name=ziti_flag value=<%=ziti_flag%>>
<input type=hidden name=idetail_id value=<%=detail_id%>>
<input type=hidden name=companyid value=<%=newcompanyid%>>
<tr bgcolor=white>
<td colspan="5"><br><br>
<center>
<input class=buttonface type=button onclick="datacheck()" name=ok value=修改>
</center>
<br><br>
</tr>
</table>
</form>
<%
else
Response.Write "可能該數據已經被他人刪除,請刷新主頁面!"
rs_xx.close
set rs_xx = nothing
end if
call closedatabase
%>
<br><br>
<script language=vbscript>
<!--
Sub datacheck()
if trim(output1.detail_no.value)=empty then
msgbox "「數量」不得為空白!", 64, "請輸入數量!"
document.output1.detail_no.focus()
Exit Sub
End if
if not isnumeric(trim(output1.detail_no.value)) then
msgbox "「數量」必須為數字!", 64, "請輸入數量!"
document.output1.detail_no.focus()
Exit Sub
End if
if trim(output1.detail_no.value) = "0" then
if msgbox("由于數量為 0 ,所以這將刪除該產品記錄! 按[確 定]刪除,按[取 消]放棄!",1) = 2 then
document.output1.detail_no.focus()
Exit Sub
end if
End if
output1.Submit
End Sub
-->
</script>
<%
end if
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -