📄 poconvert.asp
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
Dim objcheck
Set objcheck=Server.CreateObject("SmartSales.CheckFunction")
objcheck.CheckUserFunction "po","add"
set objcheck=nothing
'取参数
dim connpara
set connpara=server.CreateObject("adodb.connection")
connpara.Open connstring
set rspara=connpara.Execute("select * from parameter where type='po'")
if request("pono")<>"" then
dim conn
dim rs
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.Open connstring
if request("id")="" then
rs.Open "select top 1 * from po order by poid desc",conn,2,3,1
x=1
for l=1 to rspara("len")'生成编号后缀
x=x*10
next
if not rs.EOF then
x=x+rs("poid")+1
else
x=x+1
end if
rs.AddNew
rs("creator")=session("loginid")
rs("createdate")=now()
rs("pono")=rspara("prefix")&right(x,len(x)-1)
rs("sysaccountid")=getsysaccount("sysaccountid")
else
rs.Open "select * from po where poid="&request("id"),conn,2,3,1
rs("lastmoddate")=now()
rs("lastmoduser")=session("loginid")
end if
rs("approvedate")=null
rs("approver")=null
rs("status")="初始"
rs("accountid")=request("account")
rs("Contactid")=request("Contact")
rs("Term")=request("Term")
rs("ShipVia")=request("ShipVia")
rs("CurrencyCode")=request("CurrencyCode")
rs("poDate")=request("poDate")
rs("Owner")=request("Owner")
'rs("TotalAmount")=request("TotalAmount")
rs("termline")=request("termline")
rs("description")=request("description")
rs.Update
rs.Close
rs.Open "select poid from po order by poid desc",conn,1,1
strpoid=rs("poid")
rs.Close
rs.Open "select * from poline",conn,2,3,1
dim bline
bline=false
set rsq=connpara.Execute("select * from v_poapply where poapplyno='"&request("poapplyno")&"'")
do while not rsq.eof
bline=true'判断是否有poline
rs.AddNew
rs("poid")=strpoid
rs("productid")=rsq("productid")
rs("qty")=rsq("poqty")
rs("price")=rsq("poprice")
rs("expecteddate")=rsq("deliverydate")
rs("ConfirmedDate")=rsq("deliverydate")
rs("amount")=csng(rsq("poqty"))*csng(rsq("poprice"))
'rs("slipno")=request("slipno"&i)
rs("issuedqty")=0
rs("poapplyid")=rsq("poapplyid")
rs("description")="预定合同:"&rsq("ordernum")&" "&rsq("descriptions")
rs.Update
rsq.movenext
loop
if bline then
rs.Close
rs.Open "select sum(amount) as totalamount from poline where poid="&strpoid,conn,1,1
strtotalamount=rs("totalamount")
else
strtotalamount=0
end if
rs.Close
rs.Open "update po set totalamount="&strtotalamount&" where poid="&strpoid,conn,2,3,1
set rs=nothing
conn.Close
set conn=nothing
%>
<script language=javascript>
window.opener.location.reload();
window.close();
</script>
<%
else
set rsq=connpara.Execute("select * from v_poapply where poapplyno='"&request("poapplyno")&"'")
if rsq.EOF then
response.write "<br><br><br><LINK href='../global.css' rel=stylesheet type=text/css>"
response.Write "<div align=center>"
response.Write "<FONT SIZE=2 class=title>"
response.write "<img src=../images/jg.gif>"
response.write "没有找到产品明细"
response.write "</div>"
response.end
else
set rsq2=connpara.Execute("select poapplyid from poline where poapplyid in(select poapplyid from poapply where poapplyno='"&request("poapplyno")&"')")
'Response.Write "select poapplyid from poline where poapplyid in(select poapplyid from poapply where poapplyno='"&request("poapplyno")&"')"
'Response.End
if not rsq2.eof then
response.write "<br><br><br><LINK href='../global.css' rel=stylesheet type=text/css>"
response.Write "<div align=center>"
response.Write "<FONT SIZE=2 class=title>"
response.write "<img src=../images/jg.gif>"
response.write "已经转换过,不能转换"
response.write "</div>"
response.end
end if
temppoaccountid=rsq("poaccountid")
do while not rsq.EOF
if temppoaccountid<>rsq("poaccountid") then
response.write "<br><br><br><LINK href='../global.css' rel=stylesheet type=text/css>"
response.Write "<div align=center>"
response.Write "<FONT SIZE=2 class=title>"
response.write "<img src=../images/jg.gif>"
response.write "供应商不同,不能转换"
response.write "</div>"
response.end
end if
rsq.MoveNext
loop
rsq.movefirst
end if
straccount=temppoaccountid
straccountname=getfieldvalue("account","accountid",temppoaccountid,"account")
strpono="自动生成"
strcontact=-1
strowner=session("loginid")
strownername=session("username")
strpodate=date()
strexpiredate=date()+10
'取标准条款
set rsterm=connpara.execute("select * from userdefine where closed=0 and definetype='采购条款'")
m=3
do while not rsterm.eof
strtermline=strtermline&m&"、"&replace(rsterm("description"),chr(10),"")&chr(10)
m=m+1
rsterm.movenext
loop
%>
<HTML><HEAD><TITLE>采购</TITLE>
<LINK href="../global.css" rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
function save(){
if (form1.accountname.value==''){
alert('请选择供应商');
form1.accountname.focus();
return;
}
form1.submit();
}
</script>
<script language="JavaScript">
function window_onload()
{
window.moveTo(-2,-2);
window.resizeTo(screen.availWidth, screen.availHeight);
}
function clearmodel(i){
var productname='product'+i+'name';
window.document.all(productname).innerHTML='bbb';
}
</script>
<body bgcolor="#ffffff" onload="window_onload()">
<form name=form1 method="post" id=form1>
<table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="35%" height="25"><b><strong><font size="2"></font></strong></b><strong><font size="2" class=title><b>转换采购</b></font></strong></td>
<td><div align="left" style="cursor:hand">
<a onclick="save();"><img src="../images/button_save.gif"></a>
<a onClick="window.close();"><img src="../images/button_cancel.gif"></a></div></td>
</tr>
<tr >
<td height="16" colspan="3" background="../images/title.gif"> </td>
</tr>
<tr>
<td height=4 colspan="2"></td>
</tr>
</table>
<table width="100%" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF">
<tr bgcolor="white">
<td width="10%" bgcolor="DEDFDE"> <div align="center">采购单号</div></td>
<td width="15%" bgcolor="EFEFEF" > <input name=pono type=text value="<%=strpono%>" size="18" readonly></td>
<td width="10%" bgcolor="DEDFDE" ><div align="center">采购日期</div></td>
<td width="15%" bgcolor="efefef" ><input name=podate type=text value="<%=strpodate%>" size="10"></td>
<td width="10%" bgcolor="DEDFDE"> <div align="center"></div></td>
<td width="15%" bgcolor="EFEFEF"></td>
<td width="10%" bgcolor="DEDFDE"><div align="center">采购员</div></td>
<td width="15%" bgcolor="EFEFEF"> <input name="owner" type="hidden" size="8" value="<%=strowner%>">
<input name="ownername" type="text" size="8" value="<%=strownername%>" readonly>
<input type="button" name="bnowner" onClick="JavaScript:opensubwin2('form1','owner')" value=... class=black></td>
</tr>
<tr bgcolor="white">
<td width="10%" nowrap bgcolor="DEDFDE"> <div align="center">供应商</div></td>
<td colspan="5" bgcolor="EFEFEF"> <input name="account" type="hidden" size="8" value="<%=straccount%>">
<input name="accountname" type="text" size="35" value="<%=straccountname%>" readonly>
<input type="hidden" name="bnaccount" onClick="JavaScript:opensubwin2('form1','account')" value=... class=black>
<input type=hidden name=cancelaccount onClick="javascript:form1.account.value=-1;form1.accountname.value='';" value="C" class=black>
<div align="center"></div></td>
<td width="10%" bgcolor="DEDFDE"><div align="center">联系人</div></td>
<td width="15%" bgcolor="EFEFEF"> <input name="contact" type="hidden" size="8" value="<%=strcontact%>">
<input name="contactname" type="text" size="8" value="<%=strcontactname%>" readonly>
<input type="button" name="bncontact" onClick="JavaScript:if(form1.account.value!=-1){opensubwinwithsearch('../contact/SelectAccountContact.asp','form1','contact','accountid',form1.account.value)}else{alert('请先选择供应商')}" value=... class=black></td>
</tr>
<tr bgcolor="white">
<td width="10%" bgcolor="DEDFDE" > <div align="center">运货方式</div></td>
<td width="15%" bgcolor="EFEFEF"> <select name=shipvia size=0>
<option value=-1></option>
<%getdefine "运货方式",strshipvia%>
</select></td>
<td width="10%" bgcolor="DEDFDE"><div align="center">货币</div></td>
<td width="15%" bgcolor="efefef"><select name=currencycode>
<option value=-1></option>
<%getdefine "货币",strcurrencycode%>
</select></td>
<td width="10%" bgcolor="DEDFDE"> <div align="center">付款方式</div></td>
<td width="15%" bgcolor="EFEFEF"> <select name=term>
<option value=-1></option>
<%getdefine "付款方式",strterm%>
</select></td>
<td width="10%" bgcolor="DEDFDE"><div align="center">金额</div></td>
<td width="15%" bgcolor="EFEFEF"><%=strTotalAmount%></td>
</tr>
<tr bgcolor="white">
<td width="10%" bgcolor="DEDFDE" > <div align="center">描述</div></td>
<td colspan="3" bgcolor="EFEFEF"> <textarea name="description" cols="45" rows="4"><%=strdescription%></textarea>
</td>
<td bgcolor="DEDFDE"><div align="center">采购条款</div></td>
<td colspan="3" bgcolor="EFEFEF"><textarea name="termline" cols="45" rows="4"><%=strtermline%></textarea></td>
</tr>
</table>
<input type=hidden name=poapplyno value=<%=request.QueryString("poapplyno")%>>
</form>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><strong><font size="2"><b><font class="title">采购明细</font></b></font></strong></td>
</tr>
<tr>
<td height=2 colspan="2" bgcolor="#4A699C"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="DECFAD">
<tr valign="middle" bgcolor="efefef">
<td width="5%" height="15" align=center>序号</td>
<td width="8%" height=15 align=center>货号</td>
<td height="15" align=center>型号</td>
<td width="5%" height="15" align=center>申请量</td>
<td width="5%" align=center>订货量</td>
<td width="8%" height="15" align=center>价格</td>
<td width="8%" height="15" align=center>合同号</td>
<td width="8%" height="15" align=center>客户</td>
<td width="5%" height="15" align=center>合同量</td>
<td width="8%" height="15" align=center>合同货期</td>
<td width="8%" height="15" align=center>预计货期</td>
<td width="8%" height="15" align=center>销售员</td>
<td width="8%" height="15" align=center>备注</td>
</tr>
<%i=1
do while not rsq.EOF%>
<tr bgcolor="#FFFFFF">
<td align=center><%=i%></td>
<td align=center height=18><%=rsq("productcode")%></td>
<td align=center><%=rsq("model")%></td>
<td align=center><%=rsq("poapplyqty")%></td>
<td align=center><%=rsq("poqty")%></td>
<td align=center><%=rsq("poprice")%></td>
<td align=center><%=rsq("ordernum")%></td>
<td align=center><%=rsq("accountname")%></td>
<td align=center><%=rsq("orderqty")%></td>
<td align=center><%=rsq("shipdate")%></td>
<td align=center><%=rsq("deliverydate")%></td>
<td align=center><%=rsq("ownername")%></td>
<td align=center><%=rsq("descriptions")%></td>
</tr>
<%
i=i+1
rsq.MoveNext
loop
rsq.Close
set rsq=nothing
connpara.Close
set connpara=nothing
%>
</table>
<%
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -