JSGS.PRG
资源名称:jq_report.ARJ [点击查看]
上传用户:xue7720
上传日期:2013-01-31
资源大小:1240k
文件大小:2k
源码类别:
行业应用
开发平台:
VFP
- *JSgs.prg 报表公式运算
- *on key
- sele 1
- go bott
- endrecn=recn()
- endzd=fcount()
- go top
- sele 2
- sele 3
- go top
- do whil !eof()
- Rh=h
- Rl=l
- Rysf=ysf
- Rgs=gs
- Rh1=h1
- Rl1=l1
- Rh2=h2
- Rl2=l2
- sele 1
- x=0
- sele 1
- if RH>endrecn .or. rl>endzd .or. Rh1>endrecn .or. Rh2>endrecn;
- .or. Rl1>endzd .or. Rl2>endzd .or. (rh1<>rh2 .and. rl1<>rl2 .and. Rgs<>'DIV')
- if RH>endrecn .or. Rh1>endrecn .or. Rh2>endrecn
- ?? chr(7)
- wait '行'+str(rh,2,0)+'公式超长!' window
- endif
- if Rl>endzd .or. Rl1>endzd .or. Rl2>endzd
- ?? chr(7)
- wait '行'+str(rh,2,0)+'公式超宽!' window
- endif
- if rh1<>rh2 .and. rl1<>rl2
- wait '行'+str(rh,2,0)+'列'+str(rl,2,0)+'公式取数范围无法确定!' window
- endif
- else
- *************** 行相等,列不等
- DO CASE
- CASE Rgs='SUM'
- if Rh1=Rh2 .and. Rl1<>Rl2
- jsq=rl1
- go rh1
- do whil jsq<=Rl2
- zd1=field(jsq)
- x=x+&zd1
- jsq=jsq+1
- enddo
- else
- ***** 列相等,行不等
- go rh1
- zd1=field(Rl1)
- do whil recn()<=rh2
- x=x+&zd1
- skip
- enddo
- endif
- CASE RGS='DED'
- if Rh1=Rh2 .and. Rl1<>Rl2
- jsq=rl1
- go rh1
- do whil jsq<=Rl2
- zd1=field(jsq)
- x=x-&zd1
- jsq=jsq+1
- enddo
- else
- ***** 列相等,行不等
- go rh1
- zd1=field(Rl1)
- do whil recn()<=rh2
- x=x-&zd1
- skip
- enddo
- endif
- CASE RGS='DIV'
- go Rh1
- zd1=field(Rl1)
- x=&zd1
- go Rh2
- zd1=field(rl2)
- if &zd1<>0
- x=x/&zd1
- else
- x=0
- endif
- endcase
- ***********************************
- go Rh
- zd=field(Rl)
- do case
- case Rysf='='
- repl &zd with x
- case Rysf='+'
- repl &zd with &zd+x
- case Rysf='-'
- repl &zd with &zd-x
- case Rysf='*'
- repl &zd with &zd*x
- case Rysf='/'
- if x<>0
- repl &zd with &zd/x
- else
- * ?? chr(7)
- * wait "行"+str(Rh,1,2)+"除法运算出错!" window
- endif
- endcase
- endif
- sele 3
- skip
- enddo
- on key label ESCape do Rquit
- retu