📄 sysaccountsubmit.asp
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
function submitComfirm()
dim connd
dim rsd
set connd=server.CreateObject("adodb.connection")
set rsd=server.CreateObject("adodb.recordset")
connd.Open connstring
rsd.Open "select * from sysaccount where used=1",connd,1,1
if not rsd.EOF and not rsd.BOF then
submitComfirm=rsd.recordcount
%>
<table width="100%" bgcolor=#FFFFFF cellspacing=0>
<tr align=center height=50>
<td class=title><div align="center">要生效该帐套,请先关闭已生效的帐套!</div></td>
</tr>
<tr align=center>
<td style="cursor:hand">
<img src="../images/button_cancel.gif" style="cursor:hand" border=0 language=javascript onclick="window.close();">
</td>
</tr>
</table>
<%
end if
set rsd=nothing
connd.Close
set connd=nothing
end function
%>
<%
if Request("SubmitName") = "sysaccount" then
dim conn
dim rs
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.Open connstring
rs.Open "select * from sysaccount where sysaccountid="&request("sysaccountid"),conn,2,3,1
if Request("SubmitType") = "used" then
if request("mod")="生效" then rs("used")=1
if request("mod")="失效" then rs("used")=0
elseif Request("SubmitType") = "complete" then
rs("complete")=1
sql="select * from InitialInventory where sysaccountid="&request("sysaccountid")
set rsq=conn.execute(sql)
if not rsq.eof then
do while not rsq.eof
sql="insert into product_location(SysAccountid,Productid,Locationid,Qty_On_Hand,AverageCost,Lastdate)values("&rsq("SysAccountId")&","&rsq("productid")&","&rsq("Locationid")&","&rsq("InitialQty")&","&rsq("CurrentCost")&",'"&now()&"')"
conn.execute(sql)
sql = "insert into MaterialTransaction(sysaccountid,TransactCode,polineid,orderlineid,TransactDate,Productid,Qty,Locationid,UserName,ReserveNotes,reason,cost) values(" & rsq("SysAccountId") & ",'期初库存',-1,-1,'" & Now() & "'," & rsq("productid") & "," & rsq("InitialQty") & "," & rsq("Locationid") & ",'" & Session("loginid") & "','期初库存','期初库存',"&rsq("CurrentCost")&")"
conn.execute(sql)
rsq.movenext
loop
end if
sql="select * from InitialFinance where sysaccountid="&request("sysaccountid")
set rsq=conn.execute(sql)
if not rsq.eof then
do while not rsq.eof
if rsq("financetype")="initialcollect" then
sql="select * from orderpayment where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid")
set rsq2=conn.execute(sql)
if rsq2.eof then
conn.execute("insert into orderpayment(SysAccountid,accountid,collectionstatus,invoicestatus,paymenttype,amount,createdate)values("&rsq("SysAccountId")&","&rsq("accountid")&",'未销','未销','期初应收',"&rsq("initialcollect")&",'"&date()&"')")
else
conn.execute("update orderpayment set collectionstatus='未销',invoicestatus='未销',paymenttype='期初应收',amount="&rsq("initialcollect")&",createdate='"&date()&"' where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid"))
end if
elseif rsq("financetype")="initialpay" then
sql="select * from popayment where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid")
set rsq2=conn.execute(sql)
if rsq2.eof then
conn.execute("insert into popayment(SysAccountid,accountid,paymentstatus,invoicestatus,paymenttype,amount,createdate)values("&rsq("SysAccountId")&","&rsq("accountid")&",'未销','未销','期初应付',"&rsq("initialpay")&",'"&date()&"')")
else
conn.execute("update popayment set paymentstatus='未销',invoicestatus='未销',paymenttype='期初应付',amount="&rsq("initialpay")&",createdate='"&date()&"' where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid"))
end if
elseif rsq("financetype")="initailinvoice" then
sql="select * from orderpayment where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid")
set rsq2=conn.execute(sql)
if rsq2.eof then
conn.execute("insert into orderpayment(SysAccountid,accountid,collectionstatus,invoicestatus,paymenttype,InvoiceAmount,createdate)values("&rsq("SysAccountId")&","&rsq("accountid")&",'未销','未销','期初应开票',"&rsq("initailinvoice")&",'"&date()&"')")
else
conn.execute("update orderpayment set collectionstatus='未销',invoicestatus='未销',InvoiceAmount="&rsq("initailinvoice")&",createdate='"&date()&"' where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid"))
end if
elseif rsq("financetype")="initailpoinvoice" then
sql="select * from popayment where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid")
set rsq2=conn.execute(sql)
if rsq2.eof then
conn.execute("insert into popayment(SysAccountid,accountid,paymentstatus,invoicestatus,paymenttype,InvoiceAmount,createdate)values("&rsq("SysAccountId")&","&rsq("accountid")&",'未销','未销','期初应收票',"&rsq("initailpoinvoice")&",'"&date()&"')")
else
conn.execute("update popayment set paymentstatus='未销',invoicestatus='未销',InvoiceAmount="&rsq("initailpoinvoice")&",createdate='"&date()&"' where accountid="&rsq("accountid")&" and sysaccountid="&request("sysaccountid"))
end if
end if
rsq.movenext
loop
end if
end if
rs.Update
set rs=nothing
conn.Close
set conn=nothing
%>
<script language=javascript>
window.opener.location.reload();
window.close();
</script>
<%
end if
%>
<title>帐套提交</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<Link href="../global.css" rel=stylesheet type=text/css>
<Script Language="javascript" >
function dosub()
{
form1.SubmitName.value = "sysaccount" ;
form1.SubmitType.value = "used" ;
form1.submit();
}
function dosub1()
{
form1.SettingChk.value = "completechk" ;
form1.submit();
}
function dosub2()
{
form1.SubmitName.value = "sysaccount" ;
form1.SubmitType.value = "complete" ;
form1.submit();
}
</Script>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<div align="center">
<form method="post" id=form1 name=form1>
<%
dim getrecord
if request("mod")="生效" then getrecord=submitComfirm()
if getrecord="" then
%>
<input type=hidden name="SubmitName" size=4 >
<input type=hidden name="SubmitType" size=4 >
<input type=hidden name="SettingChk" size=4 >
<table width="100%" bgcolor=#FFFFFF cellspacing=0>
<%if request("mod")="帐套设置完成" and request("SettingChk")<>"completechk" then%>
<tr>
<td><div align="left"><font color=red size=4><strong>警告:</strong></font>在正式按“确定”按钮之前,请仔细检查期初帐套的设置是否正确,尤其是数量、单价、金额等。
因为,一旦按了“确定”按钮,系统将不允许修改帐套的期初余额。若你已经按了“确定”按钮,且发现期初值有错误,您可以用盘 亏、盘盈方法进行调整。</div></td>
</tr>
<%end if%>
<%if request("SettingChk")="completechk" then%>
<tr align=center height=50>
<td class=title><div align="center">请再次确认完成吗?</div></td>
</tr>
<%end if%>
<%if request("SettingChk")<>"completechk" then%>
<tr align=center height=50>
<td class=title><div align="center">确信要<%=request("mod")%>吗?</div></td>
</tr>
<%end if%>
<tr align=center><td style="cursor:hand">
<%if request("mod")="生效" or request("mod")="失效" then%>
<a onclick="return dosub()"><img src="../images/button_confirm.gif"></a>
<%elseif request("mod")="帐套设置完成" and request("SettingChk")<>"completechk" then%>
<a onclick="return dosub1()"><img src="../images/button_confirm.gif"></a>
<%elseif request("SettingChk")="completechk" then%>
<a onclick="return dosub2()"><img src="../images/button_confirm.gif"></a>
<%end if%>
<img src="../images/button_cancel.gif" style="cursor:hand" border=0 language=javascript onclick="window.close();">
</td>
</tr>
</table>
<%end if%>
</form>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -