⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nvo_code_check.sru

📁 本程序根据国家技术监督局 GB/T 11714—1995《全国组织机构代码编制规则》修订版本的标准编写的一个判断组织机构代码合法性的程序
💻 SRU
字号:
$PBExportHeader$nvo_code_check.sru
forward
global type nvo_code_check from nonvisualobject
end type
end forward

global type nvo_code_check from nonvisualobject
end type
global nvo_code_check nvo_code_check

forward prototypes
public function string of_getai (string as_s, string as_ai[], string as_bi[])
public function boolean of_orgcode_chkcode (string as_orgcode, ref string as_chkcode)
public function boolean of_orgcode_check (string as_orgcode)
public function boolean of_id_check (string as_sfzh)
end prototypes

public function string of_getai (string as_s, string as_ai[], string as_bi[]);int i
string GetAi = ""
For i = 1 To 36
	If as_s = as_ai[i] Then
   	GetAi = as_bi[i]
      Exit
   End If
Next 
return GetAi


end function

public function boolean of_orgcode_chkcode (string as_orgcode, ref string as_chkcode);//
string  Wi[8]
string  ai[36] 	//ai = ("0" ,"1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
string  bi[36]		//bi=   ("0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35")
int i
    
Wi[1] = "3"
Wi[2] = "7"
Wi[3] = "9"
Wi[4] = "10"
Wi[5] = "5"
Wi[6] = "8"
Wi[7] = "4"
Wi[8] = "2"
    
For i = 1 To 36
	bi[i] = trim(string(i - 1))
   If i < 11 Then
		ai[i] = trim(string(i - 1))
   Else
      ai[i] = char(Asc("A") + (i - 11))
   End If
Next
        
int j 
int Sum
int ModResult
string s 
        
boolean lb_check = True
Sum = 0
as_orgcode = Trim(as_orgcode)
as_orgcode = Left(as_orgcode, 8)
If Len(as_orgcode) <> 8 Then
	lb_check = False
	return lb_check
End If
    
For j = 1 To 8
	s = of_GetAi(Mid(as_orgcode, j, 1), ai, bi)
	If S = "" Then
   	lb_check = False
      Exit
   End If
	Sum = Sum + integer(s) * integer(Wi[j])
Next
if lb_check=false then return false    
ModResult = mod(Sum,11)
If ModResult = 1 Then
	as_chkcode = "X"
ElseIf ModResult = 0 Then
	as_chkcode = "0"
Else
	s = string(11 - ModResult)
	as_chkcode = Mid(s, 1, 1) 
End If
return lb_check

end function

public function boolean of_orgcode_check (string as_orgcode);string ReChar
boolean lb_check
If of_orgcode_chkcode(Mid(as_orgcode, 1, 8), ReChar) Then
	If ReChar <> Mid(as_orgcode, 10, 1) Then
   	lb_check = False
   Else
      lb_check = True
   End If
End If
return lb_check


end function

public function boolean of_id_check (string as_sfzh);string ls_date

choose case len(as_sfzh)
		
	case 15
		if not isnumber(as_sfzh) then 
//			messagebox("提示错误","15位身份证号各位应为数字!")
			return false
		end if
		
		ls_date = mid(as_sfzh,7,6)
		if not isdate(left(ls_date,2)+"/"+mid(ls_date,3,2)+"/"+right(ls_date,2)) then
//			messagebox("提示错误","15位身份证号的第7到12位应为合法出生日期!")
			return false
		end if
	case 18
		ls_date = mid(as_sfzh,7,8)
		if not isdate(left(ls_date,4)+"/"+mid(ls_date,5,2)+"/"+right(ls_date,2)) then
//			messagebox("提示错误","18位身份证号的第7到14位应为合法出生日期!")
			return false
		end if
		if not (isnumber(right(as_sfzh,1)) or upper(right(as_sfzh,1)) = "X") then
//			messagebox("提示错误","18位身份证号的第最后一位应为数字或X!")
			return false
		end if
	case else
//		messagebox("提示错误","身份证号长度应为15或18位!")
		return false
end choose
	
return true
end function

on nvo_code_check.create
call super::create
TriggerEvent( this, "constructor" )
end on

on nvo_code_check.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -