VFP如何编写打印考场号表单
考场号门牌打印说明
准考证号为11位03020100401,0302县区;01考区;004考场;01座号
每个考场30人,尾场不够30人的场需要单独将最后一个考生的准考证号提出来加入30.dbf中.
要求:
每个考场的门牌上要有第几考场,起始准考证号-结束准考证号
(考场号和起始结束准考证号如何提)?
替换考点名称,如果有8个考点01-08,用从一中到8中的名称替换如何替换
一个一个的是这样吧repl all for kddm=”01” kdmc with “市一中”,怎么一下替换8个?
[解决办法]
假设所有考生都在同一个考区,生成准考证号的代码如下:
过程GenerateExamCerti中用到数据库表Student,设表中最少有字段:学号(字符型,长度根据实际情况设定),准考证号(字符型,长度为11)。参数nCountOfStudents是考生人数。
PROCEDURE GenerateExamCerti
LPARAMETERS nCountOfStudents
LOCAL i,j,k,m,CountyRegion,ExamRegion,ExamRoom,SeatNo
CountyRegion= "0302 "
ExamRegion= "01 "
i=INT(nCountOfStudents/30)
j=MOD(nCountOfStudents,30)
SELECT 1
USE Student IN 1
DO WHILE !EOF()
FOR k=1 TO i
FOR m=1 TO 30
REPLACE 准考证号 WITH CountyRegion+ExamRegion+IIF(k> 99,STR(k,3),IIF(k> 9, "0 "+STR(k,2), "00 "+STR(k,1)))+IIF(m> 9,STR(m,2), "0 "+STR(m,1))
SKIP
ENDFOR
ENDFOR
FOR m=1 TO j
REPLACE 准考证号 WITH CountyRegion+ExamRegion+IIF(i+1> 99,STR(i+1,3),IIF(i+1> 9, "0 "+STR(i+1,2), "00 "+STR(i+1,1)))+IIF(m> 9,STR(m,2), "0 "+STR(m,1))
SKIP
ENDFOR
ENDDO
USE
ENDPROC
提取考场号门牌的代码如下:
其中参数cExamCerti是准考证号,类型为字符型。
过程中使用到一个数据库表ExamRoom,其中至少有字段:教室编号(字符型),考场号(字符型,长度为3),起始号(字符型,长度为11),结束号(字符型,长度为11)
PROCEDURE GetExamRoomLable
LPARAMETERS nRoomCount,nCountOfStudents
LOCAL n,CountyRegion,ExamRegion,ExamRoom,SeatNo
CountyRegion= "0302 "
ExamRegion= "01 "
i=INT(nCountOfStudents/30)
j=MOD(nCountOfStudents,30)
n=1
SELECT 2
USE ExamRoom IN 2
DO WHILE !EOF(2) AND n <=i+1
REPLACE 考场号 WITH IIF(n> 99,STR(n,3),IIF(n> 9, "0 "+STR(n,2), "00 "+STR(n,1))), 起始号 WITH CountyRegion+ExamRegion+IIF(n> 99,STR(n,3),IIF(n> 9, "0 "+STR(n,2), "00 "+STR(n,1)))+ "01 ", 结束号 WITH CountyRegion+ExamRegion+IIF(n> 99,STR(n,3),IIF(n> 9, "0 "+STR(n,2), "00 "+STR(n,1)))+IIF(n> i,IIF(j> 9,STR(j,2), "0 "+STR(j,1)), "30 ")
n=n+1
SKIP
ENDDO
USE
ENDPROC
替换考点名称的主要代码如下:
DO CASE
CASE 考点= "01 "
ReplaceExamSite= "市一中 "
CASE 考点= "02 "
ReplaceExamSite= "市二中 "
CASE 考点= "03 "
ReplaceExamSite= "市三中 "
CASE 考点= "04 "
ReplaceExamSite= "市四中 "
CASE 考点= "05 "
ReplaceExamSite= "市五中 "
CASE 考点= "06 "
ReplaceExamSite= "市六中 "
CASE 考点= "07 "
ReplaceExamSite= "市七中 "
OTHERWISE
ReplaceExamSite= "市八中 "
ENDCASE
REPLACE 考点 WITH ReplaceExamSite