JSGS.PRG
上传用户:hbmaozhan
上传日期:2013-01-31
资源大小:1007k
文件大小:3k
源码类别:

企业管理

开发平台:

VFP

  1.  ON KEY
  2.  SELE 1
  3.  GOTO BOTTOM
  4.  endrecn = RECNO()
  5.  endzd = FCOUNT()
  6.  GOTO TOP
  7.  SELE 2
  8.  SELE 3
  9.  DO WHILE  .NOT. EOF()
  10.       rh = h
  11.       rl = l
  12.       rysf = ysf
  13.       rgs = gs
  14.       rh1 = h1
  15.       rl1 = l1
  16.       rh2 = h2
  17.       rl2 = l2
  18.       SELE 1
  19.       x = 0
  20.       SELE 1
  21.       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')
  22.            IF rh>endrecn .OR. rh1>endrecn .OR. rh2>endrecn
  23.                 ?? CHR(7)
  24.                 WAIT WINDOW '行'+STR(rh, 2, 0)+'公式超长!'
  25.            ENDI
  26.            IF rl>endzd .OR. rl1>endzd .OR. rl2>endzd
  27.                 ?? CHR(7)
  28.                 WAIT WINDOW '行'+STR(rh, 2, 0)+'公式超宽!'
  29.            ENDI
  30.            IF rh1<>rh2 .AND. rl1<>rl2
  31.                 WAIT WINDOW '行'+STR(rh, 2, 0)+'列'+STR(rl, 2, 0)+'公式取数范围无法确定!'
  32.            ENDI
  33.       ELSE
  34.            DO CASE
  35.                 CASE rgs='SUM'
  36.                      IF rh1=rh2 .AND. rl1<>rl2
  37.                           jsq = rl1
  38.                           GOTO rh1
  39.                           DO WHILE jsq<=rl2
  40.                                zd1 = FIELD(jsq)
  41.                                x=x+&zd1
  42.                                jsq = jsq+1
  43.                           ENDD
  44.                      ELSE
  45.                           GOTO rh1
  46.                           zd1 = FIELD(rl1)
  47.                           DO WHILE RECNO()<=rh2
  48.                                x=x+&zd1
  49.                                SKIP
  50.                           ENDD
  51.                      ENDI
  52.                 CASE rgs='DED'
  53.                      IF rh1=rh2 .AND. rl1<>rl2
  54.                           jsq = rl1
  55.                           GOTO rh1
  56.                           DO WHILE jsq<=rl2
  57.                                zd1 = FIELD(jsq)
  58.                                x=x-&zd1
  59.                                jsq = jsq+1
  60.                           ENDD
  61.                      ELSE
  62.                           GOTO rh1
  63.                           zd1 = FIELD(rl1)
  64.                           DO WHILE RECNO()<=rh2
  65.                                x=x-&zd1
  66.                                SKIP
  67.                           ENDD
  68.                      ENDI
  69.                 CASE rgs='DIV'
  70.                      GOTO rh1
  71.                      zd1 = FIELD(rl1)
  72.                      x=&zd1
  73.                      GOTO rh2
  74.                      zd1 = FIELD(rl2)
  75.                      if &zd1<>0
  76.                           x=x/&zd1
  77.                      ELSE
  78.                           x = 0
  79.                      ENDI
  80.            ENDC
  81.            GOTO rh
  82.            zd = FIELD(rl)
  83.            DO CASE
  84.                 CASE rysf='='
  85.                      repl &zd with x
  86.                 CASE rysf='+'
  87.                      repl &zd with &zd+x
  88.                 CASE rysf='-'
  89.                      repl &zd with &zd-x
  90.                 CASE rysf='*'
  91.                      repl &zd with &zd*x
  92.                 CASE rysf='/'
  93.                      IF x<>0
  94.                           repl &zd with &zd/x
  95.                      ELSE
  96.                           ?? CHR(7)
  97.                           WAIT WINDOW '行'+STR(rh, 1, 2)+'除法运算出错!'
  98.                      ENDI
  99.            ENDC
  100.       ENDI
  101.       SELE 3
  102.       SKIP
  103.  ENDD
  104.  ON KEY LABEL ESCape do Rquit
  105.  RETU
  106. *