统计每位教师每周上课节数,并保存到word打印输出
如何统计每位老师每周上课节数如何根据教师名单jsmd.dbf、学校日课总表rkzb201803.dbf和教师仼课表jsrkb.dbf自动统计出每位教师每周课时数,并生成到word文档打印输出
scgrkb.rar
(46.15 KB)
CLOSE DATABASES * CREATE CURSOR jskb (nj c(6), bj c(7), jsxm c(8), kc c(6)) USE jsrkb IN 0 SELECT jsrkb SCAN FOR i = 3 TO FCOUNT() ckc = FIELD(i) IF NOT EMPTY(EVALUATE("jsrkb." + ckc)) INSERT INTO jskb VALUES (jsrkb.nj, jsrkb.bj, EVALUATE("jsrkb." + ckc), ckc) ENDIF ENDFOR ENDSCAN *!* SELECT jskb *!* BROWSE * CREATE CURSOR rkzb (nj c(6), bj c(7), kc c(6), jsxm c(8)) USE rkzb201803 IN 0 SELECT rkzb201803 SCAN FOR i = 3 TO FCOUNT() ckc = FIELD(i) INSERT INTO rkzb VALUES (rkzb201803.nj, rkzb201803.bj, EVALUATE("rkzb201803." + ckc), "") ENDFOR ENDSCAN SELECT rkzb INDEX on nj + bj + kc TAG fh SELECT jskb SET RELATION TO nj + bj + kc INTO rkzb SET SKIP TO rkzb SCAN REPLACE jsxm WITH jskb.jsxm IN rkzb ENDSCAN SET RELATION TO SET SKIP TO SELECT rkzb SET ORDER TO *!* BROWSE * SELECT jsxm, COUNT(*) 周上课节数 FROM rkzb GROUP BY jsxm
CLOSE DATABASES SET COLLATE TO "MACHINE" USE jsrkb ALIAS rk USE rkzb201803 ALIAS xq IN 0 SELECT xq INDEX ON nj+bj TAG nb =AFIELDS(azd) LOCAL aa[ALEN(azd,1)] FOR i=1 TO ALEN(azd,1) aa[i]=azd[i,1] ENDFOR CREATE CURSOR kcb (nj c(6),bj c(8),xm c(8),km c(10),lb c(6)) SELECT rk FOR i=3 TO FCOUNT("rk") czdm=ALLTRIM(FIELD(i,"rk")) SCAN cnj=ALLTRIM(nj) cbj=ALLTRIM(bj) cxm=EVALUATE(czdm) IF NOT EMPTY(cxm) IF SEEK(cnj+cbj,"xq")=.T. SELECT xq SCATTER TO bb FOR ii=3 TO FCOUNT() IF ALLTRIM(bb[ii])==czdm INSERT INTO kcb VALUES (cnj,cbj,cxm,bb[ii],aa[ii]) ENDIF ENDFOR ENDIF ENDIF ENDSCAN ENDFOR SELECT *,SPACE(2) 星期,SPACE(1) 节次 FROM kcb INTO CURSOR cx READWRITE REPLACE ALL 星期 WITH SUBSTR("一二三四五",(VAL(SUBSTR(lb,5,1))-1)*2+1,2),节次 WITH SUBSTR(lb,6,1) CREATE CURSOR ctemp (午别 c(4),节次 c(1)) INSERT INTO ctemp VALUES ("上午","1") INSERT INTO ctemp VALUES ("上午","2") INSERT INTO ctemp VALUES ("上午","3") INSERT INTO ctemp VALUES ("下午","4") INSERT INTO ctemp VALUES ("下午","5") INSERT INTO ctemp VALUES ("下午","6") SELECT 午别,ctemp.节次,xm FROM (select DISTINCT xm FROM cx) aa,ctemp ORDER BY 3,1 INTO ARRAY ajc CREATE CURSOR kcap (午别 c(4),节次 c(1),xm c(8),一 c(20),二 c(20),三 c(20),四 c(20),五 c(20)) APPEND FROM ARRAY ajc INDEX on xm+节次 TO sy SELECT cx SET RELATION TO xm+节次 INTO kcap SCAN REPLACE (cx.星期) WITH cx.nj-cx.bj-cx.km IN kcap ENDSCAN SELECT kcap BROWSE