iPort=1001
cValue=CVR_InitComm(iPort)
IF cValue<>1
MESSAGEBOX("打开端口失败!")
RETURN
ENDIF
WAIT WINDOW "请刷身份证……" NOWAIT NOCLEAR
LOCAL nSeconds
nSeconds=SECONDS()
DO WHILE .t.
cValue=CVR_Authenticate()
IF cValue=1
EXIT
ENDIF
=INKEY(0.1,"H")
IF SECONDS()-nSeconds>10
WAIT CLEAR
MESSAGEBOX("没有正确读卡!")
RETURN
ENDIF
ENDDO
WAIT CLEAR
I=CVR_Read_Content(4)
IF i=0
MESSAGEBOX("没有获取到相关信息,请重新扫描!")
ELSE
MFILE=ALLTRIM(FILETOSTR(SYS(2004)+"wz.txt"))
IF thisform.check2.Value=1
myear=left(ALLTRIM(MLINE(MFILE,4)),4)
mmonth=SUBSTR(ALLTRIM(MLINE(MFILE,4)),7,2)
mday=SUBSTR(ALLTRIM(MLINE(MFILE,4)),11,2)
gdata=ALLTRIM(thisform.nlxz.Value)
gyear=LEFT(gdata,4)
gmonth=SUBSTR(gdata,6,2)
gday=RIGHT(gdata,2)
IF VAL(gyear)>VAL(myear)
=MESSAGEBOX("年龄超限,不在报名范围内,请核实!",0+48+4096,"系统提示:")
RETURN
ENDIF
IF VAL(gyear)=VAL(myear) AND VAL(gmonth)>VAL(mmonth)
=MESSAGEBOX("年龄超限,不在报名范围内,请核实!",0+48+4096,"系统提示:")
RETURN
ENDIF
IF VAL(gyear)=VAL(myear) AND VAL(gmonth)=VAL(mmonth) AND VAL(gday)>VAL(mday)
=MESSAGEBOX("年龄超限,不在报名范围内,请核实!",0+48+4096,"系统提示:")
RETURN
ENDIF
ENDIF
sfz_flag=0
sfz_line=ALLTRIM(MLINE(MFILE,6))
IF LEN(sfz_line)<15
sfz=ALLTRIM(MLINE(MFILE,7))
sfz_flag=1
ELSE
r=0
FOR i=1 TO LEN(sfz_line)
temp_str=SUBSTR(sfz_line,i,1)
IF UPPER(temp_str) $ "1234567890X"
ELSE
r=1
ENDIF
ENDFOR
IF r>0
sfz=ALLTRIM(MLINE(MFILE,7))
sfz_flag=1
ELSE
sfz=ALLTRIM(MLINE(MFILE,6))
ENDIF
ENDIF