
程序代码:
select distinct 项目 from B表 into array axm
select distinct 部门车间 from B表 into array acj
lcstr="项目 c(50),合计 n(10,2)"
for i=1 to alen(acj,1)
lcstr=lcstr+","+alltrim(acj[i,1])+" n(10,2)"
endfor
create cursor b2 (&lcstr)
append from array axm
index on 项目 tag xm
select B表
set relation to 项目 into b2
scan
replace (B表.部门车间) with evaluate(B表.部门车间)+B表.数量 in b2
endscan
set relation to
select b2
set order to
* 行合计
lnsum=""
for i=3 to fcount()
lnsum=lnsum+"+"+field(i)
endfor
replace all 合计 with &lnsum
* 列合计
insert into b2 (项目) values ("合计")
for i=2 to fcount()
sum evaluate(field(i)) to lhj
replace record reccount() (field(i)) with lhj
endfor
browse
图片附件: 游客没有浏览图片的权限,请
登录 或
注册