按日历统计数据
各位老师:原表ffff为按日历记录请假情况,num为编号,ny为年月,j1-j31为日历想得到gg表的结果,即某编号人员从某年月的几号至某年月的几号并统计合计数。
(只统计填写“探”的结果)用vfp6.0
谢谢!!!
附件
555.rar
(649 Bytes)
能实现吗?
[此贴子已经被作者于2023-7-6 23:15编辑过]
close all use ffff go top scan scatter fields j1,j2,j3,j4,j5,j6,j7,j8,j9,j10,j11,j12,j13,j14,j15,j16,j17,j18,j19,j20,j21,j22,j23,j24,j25,j26,j27,j28,j29,j30,j31 to arr && 修改此处,可以限定统计日期范围 nNum = 0 zjs = alen(arr) for i = 1 to zjs if [探] $ arr(m.i) nNum = 1 + nNum endif endfor replace 备注 with alltrim(str(nNum)) endscan select ffff browse
[此贴子已经被作者于2023-7-7 06:22编辑过]
USE ffff SCAN SCATTER TO arr ret = "" ds = 0 sd = ASCAN(arr,"探 ") ns = sd DO WHILE BETWEEN(ns,1,ALEN(arr)) DO WHILE arr[ns]=="探 " ds = ds+1 ns = ns+1 ENDDO ret = ret + "," + PADL(sd-2,2,"0") + "-" + PADL(ns-3,2,"0") sd = ASCAN(arr,"探 ",ns) ns = sd ENDDO ? arr[1],arr[2], SUBSTR(ret,2), ds ENDSCAN
CLOSE DATABASES USE gg IN 0 ZAP SELECT DISTINCT num FROM ffff INTO CURSOR temp SCAN SELECT * FROM ffff WHERE num = temp.num ORDER BY num, ny INTO CURSOR temp1 lncnt = 0 SCAN FOR ln = 3 TO FCOUNT() - 1 IF ALLTRIM(EVALUATE(FIELD(ln))) == "探" lncnt = lncnt + 1 IF lncnt = 1 lcny = TRANSFORM(ny) + PADL(SUBSTR(FIELD(ln), 2), 2, "0") ENDIF lcny1 = TRANSFORM(ny) + PADL(SUBSTR(FIELD(ln), 2), 2, "0") ENDIF ENDFOR ENDSCAN lcny = CTOD(CHRTRAN("abcd-ef-gh", 'abcdefgh', lcny)) lcny1 = CTOD(CHRTRAN("abcd-ef-gh", 'abcdefgh', lcny1)) INSERT INTO gg VALUES (temp.num, lcny, lcny1, lncnt) ENDSCAN SELECT gg BROWSE
[此贴子已经被作者于2023-7-7 11:44编辑过]