程序代码:
Local lcBkkm,lcBkkm1,lcKddm,lcStr Store "" To lcBkkm,lcBkkm1,lcKddm,lcStr Create Cursor Tj (考点代码 C(5),科目 C(10)) Select * From ls2 Into Cursor Temp Scan For lnI=1 To Alines(Abkkm,Alltrim(报考科目),",") Insert Into Tj Values (Temp.报名点代码,Abkkm[lnI]) If Not Alltrim(Abkkm[lnI])$lcBkkm lcBkkm=lcBkkm+Iif(Empty(lcBkkm),"",",")+Alltrim(Abkkm[lnI])+" N(4)" lcBkkm1=lcBkkm1+Iif(Empty(lcBkkm1),"",",")+Alltrim(Abkkm[lnI]) && 报考科目内容 EndIf EndFor Endscan Create Cursor Tjb (考点代码 C(5),&lcBkkm,小计 N(5)) Select 考点代码,科目,Count(*) 人数 From Tj Group By 1,2 Into Cursor Temp Scan If Alltrim(考点代码)==lcKddm Else Insert Into Tjb (考点代码) Values (Temp.考点代码) EndIf Replace (temp.科目) With temp.人数 For Alltrim(考点代码)==Alltrim(Temp.考点代码) In Tjb lcKddm=Alltrim(考点代码) Endscan For lnI=1 To Alines(Abkkm,lcBkkm1,",") lcStr=lcStr+Iif(Empty(lcStr),"",",")+"Sum("+Abkkm[lnI]+")" Endfor Insert Into Tjb Select "合计",&lcStr,0 From Tjb lcStr="" Select Tjb For lnI=2 To Fcount()-1 lcStr=lcStr+Field(lnI)+Iif(lnI<Fcount()-1,"+","") EndFor Replace All (Field(Fcount())) With Evaluate(lcStr) Browse这段代码速度快
[ 本帖最后由 sdta 于 2014-5-23 17:51 编辑 ]
坚守VFP最后的阵地