Qtp generates an 18-digit ID card with a birthdate of the current year, month, day, and old year. The last four digits are random.

Source: Internet
Author: User

Function getnewidcard (byval old)
'-- Input parameter --
'Old in int, -- the two-digit age generated. The default value is 19 years.
'-- Output parameter --
'Getnewidcard -- 18-digit random ID card. The birthdate is the current year, month, and old year, and the last four are random.
'---------------------------------------------------------------
'-- Module name: getnewidcard
'-- Description: generate an 18-digit random ID card. The birthday is the current year, month, day, old year, and the last four are random.
'---------------------------------------------------------------
'-- Modify
'-- Modification date:
'-- Modify content:
'-----------------------------------------------------------------


'-- Input parameter judgment. If it is null, the default value is 18.
If old = "" then
Old = 19
End if

Dim I, S, WI, WF, result
Dim idcard17
Dim today

'-- Generates the specified yymmdd based on the current date.
Today = Date
Yymmdd = (Year (today)-old) & right ("0" & month (today), 2) & right ("0" & Day (today), 2)

'-- Generate a three-digit random number
Serrnd = int (900 * RND + 100)

'-- Combined into 17 ID card numbers
Idcard17 = "230202" & yymmdd & serrnd

'-- Generate ID card verification code
Wi = Split)
WF = Split (", X)

S = 0
For I = 0 to ubound (WI)

S = CINT (WI (I) * CINT (mid (idcard17, I + 1, 1) + S

Next
'-- Combine them into 18-digit ID cards
Getnewidcard = idcard17 & WF (CINT (S mod 11 )))

End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.