📄 publicfunction.inc
字号:
<%
<!--
'---------------------------------------------------------------------
'功能:生成主码 求系统中按
' 8位年月日+4位顺序号,顺序号由0001开始
' 规则生成主码的12字符串主码的当前最大主码值
'参数:
' 1,TStr_TableName:求主码的表名
' 2,TStr_KeyField:主码列名
'返回值:
' 1,当前列的最大主码
'--------------------------------------------------------------------
Function GetNewID(TStr_TableName,TStr_KeyField)
Dim DBConn,Rs,LStr_Sql,LStr_Today,LInt_MaxValue
'***取得后台服务器日期字符串***
LStr_Today=CStr(Year(Date()))
If Month(Date())>9 Then
LStr_Today=LStr_Today&CStr(Month(Date()))
Else
LStr_Today=LStr_Today&"0"+CStr(Month(Date()))
End If
If Day(Date())>9 Then
LStr_Today=LStr_Today&CStr(Day(Date()))
Else
LStr_Today=LStr_Today&"0"+CStr(Day(Date()))
End If
'***取得最大系列号***
Set DBConn=Server.CreateObject("ADODB.Connection")
'DBConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=CMSTest;Data Source=FileServer","sa",""
DBconn.Open Application("Connection2_ConnectionString")
LStr_Sql= "SELECT Convert(Integer,Max(SubString(" & TStr_KeyField &",9,4))) AS MaxValue"
LStr_Sql=LStr_Sql+" FROM " & TStr_TableName
LStr_Sql=LStr_Sql+" WHERE SubString(" &TStr_KeyField &",1,8)='" &LStr_Today &"'"
Set Rs=Server.CreateObject("ADODB.Recordset")
Rs.Open LStr_Sql,DBConn
'***生成新主码***
If Rs.EOF And Rs.BOF Then
GetNewID=LStr_Today&"0001"
Else
If IsNull(Rs("MaxValue")) Then
GetNewID=LStr_Today&"0001"
Else
LInt_MaxValue=Rs("MaxValue")+1
If LInt_MaxValue<10 Then
GetNewID=LStr_Today&"000"&LInt_MaxValue
Else
If LInt_MaxValue>=10 AND LInt_MaxValue<100 Then
GetNewID=LStr_Today&"00"&LInt_MaxValue
Else
If LInt_MaxValue>=100 AND LInt_MaxValue<1000 Then
GetNewID=LStr_Today&"0"&LInt_MaxValue
Else
GetNewID=LStr_Today&LInt_MaxValue
End If
End If
End If
End If
End If
Rs.Close
DBConn.Close
Set Rs=Nothing
Set DBConn=Nothing
End Function
%>
<%
<!--
'---------------------------------------------------------------------
'功能:求明细的当前最大编号值+1
'参数:
' 1,TStr_TableName:表名
' 2,TStr_KeyField:主健列名
' 3,TStr_DetailField:明细列名
' 4,TStr_KeyID:主健编号
'返回值:
' 1,当前明细的当前最大编号值+1
'--------------------------------------------------------------------
Function GetDetailID(TStr_TableName,TStr_KeyField,TStr_KeyID,TStr_DetailField)
Dim DBConn,Rs,LStr_Sql,LStr_Today,LInt_MaxValue
'***取得最大系列号***
Set DBConn=Server.CreateObject("ADODB.Connection")
'DBConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=CMS;Data Source=FileServer","sa",""
DBconn.Open Application("Connection2_ConnectionString")
LStr_Sql= "SELECT Max("& Trim(TStr_DetailField) &") AS MaxValue FROM "& TStr_TableName
LStr_Sql=LStr_Sql+" WHERE "& TStr_KeyField &"='"& TStr_KeyID &"'"
Set Rs=Server.CreateObject("ADODB.Recordset")
Rs.Open LStr_Sql,DBConn
'***生成新主码***
If Rs.EOF And Rs.BOF Then
GetDetailID=1
Else
If IsNull(Rs("MaxValue")) Then
GetDetailID=1
Else
GetDetailID=Rs("MaxValue")+1
End If
End If
Rs.Close
DBConn.Close
Set Rs=Nothing
Set DBConn=Nothing
End Function
%>
<%
<!--
'---------------------------------------------------------------------
'功能:根据帐号查询职工编号、职工姓名、职工类别、区域编号、区域名称、
'部门编号、部门名称、地区编号、地区名称
'
'参数:
' 1,Gs_Account:str,帐号
'返回值:
' 1,Gs_StaffID 职工编号
' 2,Gs_StafferName 职工姓名
' 3,Gs_StafferType 职工类别
' 4,Gs_AgenID 区域编号
' 5,Gs_AgenName 区域名称
' 6,Gs_DepartID 部门编号
' 7,Gs_DepartName 部门名称
' 8,Gs_RegionID 地区编号
' 9,Gs_RegionName 地区名称
'作者:易江波,2001,06,10
'---------------------------------------------------------------------
Function GetPuliceInfo(Gs_Account)
Dim DBConn,Rs_Right,Str_Right,Rs_info,Str_info
Set DBConn=Server.CreateObject("ADODB.Connection")
Set Rs_Right=server.CreateObject("adodb.recordset")
DBconn.Open Application("Connection2_ConnectionString")
Str_Right="select B.Stf_ID,"
Str_Right=Str_Right+" B.Stf_Name,"
Str_Right=Str_Right+" B.Stf_Type "
Str_Right=Str_Right+" from Right_User as r,Basic_Staffer as B"
Str_Right=Str_Right+" where r.Stf_ID=B.Stf_ID and r.Rit_uid='" & Gs_Account& "'"
Rs_Right.open Str_Right,DBconn,1,2
If Not (Rs_Right.Eof AND Rs_Right.BOF) Then
Session("Gs_StaffID")=Trim(Rs_Right("Stf_ID"))
Session("Gs_StafferName")=Trim(Rs_Right("Stf_Name"))
Session("Gs_StafferType")=Trim(Rs_Right("Stf_Type"))
'If Trim(Rs_Right("Stf_Type"))="区域职工" Then
' Str_info="select s.Agn_ID,A.Agn_Name,R.Rgn_ID,R.Rgn_Name"
' Str_info=Str_info+" from Basic_StafferAgn as S ,Basic_Agency as A ,Basic_Region as R"
' Str_info=Str_info+" where S.Agn_ID=A.Agn_ID"
' Str_info=Str_info+" and A.Agn_ID=R.Rgn_ID"
' Str_info=Str_info+" and S.Stf_ID="&Rs_Right("Stf_ID")
' Rs_info.open Str_info,DBconn,1,2
' Session("Gs_AgenID")=Trim(Rs_info("Agn_ID"))
' Session("Gs_AgenName")=Trim(Rs_info("Agn_Name"))
' Session("Gs_RegionID")=Trim(Rs_info("Rgn_ID"))
' Session("Gs_RegionName")=Trim(Rs_info("Rgn_Name")0
'Else
' Str_info="select D.Dpt_ID,D.Dpt_Name from Basic_StafferAgn as S,Basic_StafferHO as H, Basic_Dept as D"
' Str_info=Str_info+" where s.Stf_ID=H.Stf_ID and H.Dpt_ID=D.Dpt_ID"
' Str_info=Str_info+" and s.Stf_ID ="&Rs_Right("Stf_ID")
' Rs_info.open Str_info,DBconn,1,2
' Session("Gs_DepartID")=Trim(Rs_info("Dpt_ID"))
' Session("Gs_DepartName")=Trim(Rs_info("Dpt_Name"))
'End If
'Rs_info.Close
End If 'if not Rs_Right.eof then
Rs_Right.Close
DBConn.Close
Set DBConn=Nothing
End Function
Function a(x)
a=x
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -