📄 commfunction.inc
字号:
rsupdate.open "update popayment set receivedamount="&tempamount&" where paymentid="&paymentid,connupdate,2,3,1
end if
set rsupdate=nothing
connupdate.close
set connupdate=nothing
end function
function convertcurrency(money)
dim str(9)
str(0)="零"
str(1)="壹"
str(2)="贰"
str(3)="叁"
str(4)="肆"
str(5)="伍"
str(6)="陆"
str(7)="柒"
str(8)="捌"
str(9)="玖"
aa=money
hh=formatnumber(aa,2,-1)
aa=replace(hh,".","")
aa=replace(aa,",","")
for i=1 to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: k= mynum&"分"
case 2: k= mynum&"角"
case 3: k= mynum&"元"
case 4: k= mynum&"拾"
case 5: k= mynum&"佰"
case 6: k= mynum&"仟"
case 7: k= mynum&"万"
case 8: k= mynum&"拾"
case 9: k= mynum&"佰"
case 10: k= mynum&"仟"
end select
m=m&k
next
convertcurrency=m
end function
function getscheduledate(smonth)
dim connection
set connection=server.CreateObject("adodb.connection")
connection.Open connstring
if smonth="" then
strmonth=month(date())
else
strmonth=smonth
end if
set rs=connection.Execute("select scheduledate from schedule where AssignedTo='"&session("loginid")&"' or Creator='"&Session("loginid")&"' or AssignedTo in(select userid from v_userreportto_all where reportto='"&session("loginid")&"') and month(ScheduleDate)="&strmonth)
do while not rs.eof
str=str&rs("scheduledate")&","
rs.movenext
loop
set rs=nothing
connection.Close
set connection=nothing
getscheduledate=str
end function
function getmaxavailable(productid)
dim connmax
set connmax=server.CreateObject("adodb.connection")
connmax.Open connstring
set rsmax=connmax.Execute("select qty_on_hand,qty_rsvd from v_inventoryall where nonnet=0 and productid="&productid)
if not rsmax.eof then
maxqty=rsmax("qty_on_hand")-rsmax("qty_rsvd")
else
maxqty=0
end if
set rsmax=nothing
connmax.Close
set connmax=nothing
getmaxavailable=maxqty
end function
function getlocationmaxavailable(productid,locationid)
dim connlocmax
set connlocmax=server.CreateObject("adodb.connection")
connlocmax.Open connstring
'response.write "select qty_on_hand,qty_rsvd from v_product_location where productid="&productid&" and locationid="&locationid
'response.end
set rslocmax=connlocmax.Execute("select qty_on_hand,qty_rsvd from v_product_location where productid="&productid&" and locationid="&locationid)
if not rslocmax.eof then
maxqty=rslocmax("qty_on_hand")-rslocmax("qty_rsvd")
else
maxqty=0
end if
set rslocmax=nothing
connlocmax.Close
set connlocmax=nothing
getlocationmaxavailable=maxqty
end function
function getmaxnonnetavailable(productid)
dim connmax2
set connmax2=server.CreateObject("adodb.connection")
connmax2.Open connstring
set rsmax2=connmax2.Execute("select qty_on_hand,qty_rsvd from v_inventoryall where nonnet=1 and productid="&productid)
if not rsmax2.eof then
maxqty=rsmax2("qty_on_hand")-rsmax2("qty_rsvd")
else
maxqty=0
end if
set rsmax2=nothing
connmax2.Close
set connmax2=nothing
getmaxnonnetavailable=maxqty
end function
function getreserveqty(lineid)
dim connrsvd
set connrsvd=server.CreateObject("adodb.connection")
connrsvd.Open connstring
set rsrsvd=connrsvd.Execute("select qty from orderreserve where status='保留同意'and orderlineid="&lineid)
if not rsrsvd.eof then
rsvdqty=rsrsvd("qty")
else
rsvdqty=0
end if
set rsrsvd=nothing
connrsvd.Close
set connrsvd=nothing
getreserveqty=rsvdqty
end function
function getcondition(selmethod,selcondition,seq)
select case selmethod
case "省份"
if selcondition<>"" then
str=" and province1id="&selcondition
end if
session("reportfield"&seq)="province1"
case "联系人省份"
if selcondition<>"" then
str=" and province1id="&selcondition
end if
session("reportfield"&seq)="province"
case "行业"
if selcondition<>"" then
str=" and industryid="&selcondition
end if
session("reportfield"&seq)="industry"
case "客户类型"
if selcondition<>"" then
str=" and accounttypeid="&selcondition
end if
session("reportfield"&seq)="accounttype"
case "区域"
if selcondition<>"" then
str=" and territoryid="&selcondition
end if
session("reportfield"&seq)="territory"
case "销售来源类型"
if selcondition<>"" then
str=" and sourceid="&selcondition
end if
session("reportfield"&seq)="source"
case "国家"
if selcondition<>"" then
str=" and countryid="&selcondition
end if
session("reportfield"&seq)="country"
case "运货方式"
if selcondition<>"" then
str=" and ShipViaidid="&selcondition
end if
session("reportfield"&seq)="ShipVia"
case "货币"
if selcondition<>"" then
str=" and CurrencyCodeid="&selcondition
end if
session("reportfield"&seq)="CurrencyCode"
case "付款方式"
if selcondition<>"" then
str=" and Termid="&selcondition
end if
session("reportfield"&seq)="Term"
end select
getcondition=str
end function
function getrecordcount(tablename,where)
dim connrc
dim rsrc
set connrc=server.createobject("adodb.connection")
connrc.open connstring
set rsrc=connrc.execute("select count(*) as counts from "&tablename&" "&where)
returnvalue=rsrc("counts")
rsrc.close
set rsrc=nothing
connrc.close
set connrc=nothing
end function
%>
<%
function AddImg(TheId) %>
<input type=hidden id=<%response.write TheId%>>
<img width=16 height=16 src='../Images/show-calendar.gif' onClick='opencalendar_C("<%response.write TheId%>")'>
<% end function%>
<%
function DeleteComfirm(tablename,fieldname,fieldvalue)
dim typevale
dim connd
dim rsd
set connd=server.CreateObject("adodb.connection")
set rsd=server.CreateObject("adodb.recordset")
connd.Open connstring
if tablename="dealprocess" then
rsd.open "select top 1 * from dealstage where "&fieldname&" = '"&fieldvalue&"'", connd,1,1
typevalue="销售流程"
elseif tablename="quote" then
rsd.open "select top 1 * from quoteline where "&fieldname&" = '"&fieldvalue&"'", connd,1,1
typevalue="报价单"
elseif tablename="order" then
rsd.open "select top 1 * from orderline where "&fieldname&" = '"&fieldvalue&"'", connd,1,1
typevalue="合同"
elseif tablename="delivery" then
rsd.open "select top 1 * from deliveryline where "&fieldname&" = '"&fieldvalue&"'", connd,1,1
typevalue="发货单"
elseif tablename="expense" then
rsd.open "select top 1 * from expenseline where "&fieldname&" = '"&fieldvalue&"'", connd,1,1
typevalue="费用"
end if
if not rsd.EOF and not rsd.BOF then
DeleteComfirm=rsd.recordcount
%>
<tr align=center height=50>
<td class=title><div align="center">该<font color=red><%=typevalue%></font>下有明细,请先删除明细!</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>
<%
end if
set rsd=nothing
connd.Close
set connd=nothing
end function
%>
<%
function checkandgetsysaccountid()
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 complete=1 and used=1", conn,1,1
if rs.EOF and rs.BOF then
Response.Write "<script language=javascript>alert('帐套未建立,不能使用该功能!');"&"</script>"
Response.Write "<script language=javascript>history.go(-1);"&"</script>"
Response.End
else
checkandgetsysaccountid=rs("sysaccountid")
end if
set rs=nothing
conn.Close
set conn=nothing
end function
function getsysaccount(systype)
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 complete=1 and used=1", conn,1,1
if rs.EOF and rs.BOF then
getsysaccount="帐套未建立"
else
if systype="sysaccount" then
getsysaccount=rs("sysaccount")
elseif systype="sysaccountid" then
getsysaccount=rs("sysaccountid")
end if
end if
set rs=nothing
conn.Close
set conn=nothing
end function
%>
<%
function AddPopupMenu1(bEdit,bDelete,bDelivery,bPrint,bRsvdapprove,bRsvdreject,bRsvddelete,bActive,_
editUrl, _
deleteUrl,_
deliveryUrl, _
printUrl,_
rsvdapproveUrl, _
rsvdrejectUrl,_
rsvddeleteUrl, _
MenuName)%>
<!-- Popup Menu -->
<%if not bActive then%>
<div id="<%response.write MenuName%>" class=clsMenu LANGUAGE=javascript onmouseout="return HideMenu('<%response.write MenuName%>')" onmousemove="return JustShowMenu('<%response.write MenuName%>')">
<table>
<% if bEdit then %>
<tr><td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
onclick="return MenuItem_onclick('<%response.write editUrl%>','resizable=yes, scrollbars=yes, left= 40, top=40, menubar=no, location=no, toolbar=no ,,width=750, height=500')">编辑</td>
</tr>
<% end if %>
<% if bDelete then %>
<tr><td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
onclick="return MenuItem_onclick('<%response.write deleteUrl%>','resizable=no, scrollbars=no, left= 300, top=220, menubar=no, location=no, toolbar=no ,width=300, height=200')">删除</td>
</tr>
<% end if %>
<% if bDelivery then %>
<tr>
<td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
onclick="return MenuItem_onclick('<%response.write deliveryUrl%>','resizable=yes, scrollbars=yes, left= 40, top=40, menubar=no, location=no, toolbar=no ,width=750, height=500')">发货单</td>
</tr>
<% end if %>
<% if bPrint then %>
<tr><td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
onclick="return MenuItem_onclick('<%response.write printUrl%>','resizable=yes, scrollbars=yes, left= 300, top=220, menubar=no, location=no, toolbar=no ,width=300, height=200')">打印</td>
</tr>
<% end if %>
<% if bRsvdapprove then %>
<tr><td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
onclick="return MenuItem_onclick('<%response.write rsvdapproveUrl%>','resizable=yes, scrollbars=yes, left= 40, top=40, menubar=no, location=no, toolbar=no ,width=750, height=500')">审批</td>
</tr>
<% end if %>
<% if bRsvdreject then %>
<tr><td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
onclick="return MenuItem_onclick('<%response.write rsvdrejectUrl%>','resizable=yes, scrollbars=yes, left= 40, top=40, menubar=no, location=no, toolbar=no ,width=750, height=500')">拒绝</td>
</tr>
<% end if %>
<% if bRsvddelete then %>
<tr><td class=clsMenuItem LANGUAGE=javascript
onmouseover="return MenuItem_onmouseover(this)"
onmouseout="return MenuItem_onmouseout(this)"
onmousedown="return MenuItem_onmousedown(this)"
onmouseup="return MenuItem_onmouseup(this)"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -