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

企业管理

开发平台:

VFP

  1.  DO WHILE .T.
  2.       pd1 = kmdm
  3.       SET COLOR TO RB+/B
  4.       @ 0, 0 CLEAR TO 3, 28
  5.       @ 1, 1 SAY '请输入科目号码:' GET pd1 PICTURE '999999999'
  6.       READ
  7.       DO qp
  8.       pd = TRIM(pd1)
  9.       pd = LTRIM(pd)
  10.       IF LEN(pd)<>7 .AND. LEN(pd)<>9 .AND. LEN(pd)<>3
  11.            ? CHR(7)
  12.            SET COLOR TO BG+/RB
  13.            @ 0, 0 CLEAR TO 3, 28
  14.            @ 1, 5 SAY '请输入明细科目号码!'
  15.            pd = INKEY(0)
  16.            DO qp
  17.            LOOP
  18.       ENDI
  19.       SELE 2
  20.       s = 0
  21.       pd1 = SUBSTR(pd, 1, 3)
  22.       LOCA ALL FOR pd$kmdm .AND. LEN(LTRIM(TRIM(pd)))=LEN(LTRIM(TRIM(kmdm)))
  23.       IF  .NOT. EOF()
  24.            DO WHILE .T.
  25.                 pd2 = kmdm
  26.                 pd2 = LTRIM(TRIM(pd2))
  27.                 x = LEN(pd2)
  28.                 pd3 = '0000'
  29.                 SKIP
  30.                 IF  .NOT. EOF()
  31.                      pd3 = kmdm
  32.                 ENDI
  33.                 SKIP -1
  34.                 pd3 = LTRIM(TRIM(pd3))
  35.                 pd4 = SUBSTR(pd3, 1, x)
  36.                 s = RECNO()
  37.                 IF pd2=pd4 .AND. LEN(pd3)<>LEN(pd2)
  38.                      @ 23, 40 SAY '           '
  39.                      @ 23, 40 SAY pd
  40.                      DO zzkm-1
  41.                      SET COLOR TO
  42.                      @ 23, 40 SAY pd
  43.                      DO qp
  44.                      @ 23, 30 SAY '          '
  45.                      IF x=27
  46.                           EXIT
  47.                      ENDI
  48.                 ELSE
  49.                      EXIT
  50.                 ENDI
  51.            ENDD
  52.            IF x=27
  53.                 LOOP
  54.            ENDI
  55.            mc = kmmc
  56.            x = jhd
  57.            pd1 = LTRIM(TRIM(kmdm))
  58.            pd1 = SUBSTR(pd1, 1, 3)
  59.            SELE 1
  60.            REPL mxkm WITH mc
  61.            REPL kmdm WITH pd
  62.            REPL jhd WITH x
  63.            SELE 2
  64.            LOCA ALL FOR pd1$kmdm .AND. LEN(LTRIM(TRIM(pd1)))=LEN(LTRIM(TRIM(kmdm)))
  65.            mc = kmmc
  66.            SELE 1
  67.            REPL zzkm WITH mc
  68.            SELE 2
  69.            pd = slbz
  70.            IF pd='2'
  71.                 SELE 1
  72.                 REPL slbz WITH '2'
  73.            ENDI
  74.            EXIT
  75.       ELSE
  76.            SET COLOR TO BG+/RB
  77.            @ 0, 0 CLEAR TO 3, 28
  78.            @ 1, 3 SAY '无此科目. 按InSert=增加,'
  79.            @ 2, 3 SAY '      其他=重输?'
  80.            pd = INKEY(0)
  81.            DO qp
  82.            IF pd<>22
  83.                 LOOP
  84.            ELSE
  85.                 DO WHILE .T.
  86.                      pd = '          '
  87.                      SET COLOR TO RB+/B
  88.                      @ 0, 0 CLEAR TO 3, 28
  89.                      @ 1, 0 SAY '请输入新的科目码:' GET pd PICTURE '999999999'
  90.                      READ
  91.                      DO qp
  92.                      pd = TRIM(pd)
  93.                      pd = LTRIM(pd)
  94.                      xx = pd
  95.                      IF 7<>LEN(pd) .AND. 9<>LEN(pd)
  96.                           SET COLOR TO BG+/RB
  97.                           ?? CHR(7)
  98.                           @ 0, 0 CLEAR TO 3, 28
  99.                           @ 1, 1 SAY ' 编号不正确,应是7或9个数字'
  100.                           @ 2, 5 SAY '    按任意键继续......'
  101.                           i = INKEY(0)
  102.                           DO qp
  103.                           LOOP
  104.                      ENDI
  105.                      SELE 2
  106.                      IF LEN(pd)>3
  107.                           pd1 = SUBSTR(pd, 1, 3)
  108.                           LOCA ALL FOR pd1$kmdm .AND. LEN(LTRIM(TRIM(pd1)))=LEN(LTRIM(TRIM(kmdm)))
  109.                           IF EOF()
  110.                                ?? CHR(7)
  111.                                SET COLOR TO RB+/B
  112.                                @ 0, 0 CLEAR TO 3, 28
  113.                                @ 1, 7 SAY '没有上级科目!'
  114.                                @ 2, 5 SAY '按任意键继续......'
  115.                                i = INKEY(0)
  116.                                LOOP
  117.                           ENDI
  118.                           IF LEN(pd)>7
  119.                                pd1 = SUBSTR(pd, 1, 7)
  120.                                LOCA ALL FOR pd1$kmdm .AND. LEN(LTRIM(TRIM(pd1)))=LEN(LTRIM(TRIM(kmdm)))
  121.                                IF EOF()
  122.                                     ?? CHR(7)
  123.                                     SET COLOR TO RB+/B
  124.                                     @ 0, 0 CLEAR TO 3, 28
  125.                                     @ 1, 7 SAY '没有上级科目!'
  126.                                     @ 2, 5 SAY '按任意键继续......'
  127.                                     i = INKEY(0)
  128.                                     LOOP
  129.                                ENDI
  130.                           ENDI
  131.                      ENDI
  132.                      LOCA ALL FOR pd$kmdm
  133.                      a1 = 1
  134.                      IF  .NOT. EOF()
  135.                           pd = 'F'
  136.                           SET COLOR TO RB+/B
  137.                           @ 0, 0 CLEAR TO 3, 28
  138.                           @ 1, 5 SAY '此码科目库原已建立,'
  139.                           @ 2, 5 SAY '是否输入新的号码?'
  140.                           @ 3, 5 SAY ' Y=是,其他=否?' GET pd
  141.                           READ
  142.                           DO qp
  143.                           IF pd='Y' .OR. pd='y'
  144.                                LOOP
  145.                           ELSE
  146.                                a1 = 0
  147.                                EXIT
  148.                           ENDI
  149.                      ENDI
  150.                      APPE BLANK
  151.                      GOTO BOTTOM
  152.                      REPL kmdm WITH xx
  153.                      REPL rq WITH rq1
  154.                      IF 3<LEN(xx)
  155.                           pd = SUBSTR(xx, 1, 3)
  156.                           LOCA ALL FOR pd$kmdm .AND. SUBSTR(kmdm, 1, 3)=pd
  157.                           pd = slbz
  158.                           x = jhd
  159.                           GOTO BOTTOM
  160.                           REPL slbz WITH pd
  161.                           REPL jhd WITH x
  162.                           SELE 1
  163.                           REPL slbz WITH pd
  164.                           REPL kmdm WITH xx
  165.                           REPL jhd WITH x
  166.                           SELE 2
  167.                      ENDI
  168.                      DO WHILE .T.
  169.                           mc = '                    '
  170.                           SET COLOR TO RB+/B
  171.                           @ 0, 0 CLEAR TO 3, 28
  172.                           @ 1, 1 SAY '请输入新增的科目名称:'
  173.                           @ 2, 1 SAY ' ' GET mc
  174.                           READ
  175.                           pd = ' '
  176.                           @ 3, 1 SAY '确认了吗?  Y=是,其他=否!' GET pd
  177.                           READ
  178.                           DO qp
  179.                           IF pd='Y' .OR. pd='y'
  180.                                EXIT
  181.                           ENDI
  182.                      ENDD
  183.                      REPL kmmc WITH mc
  184.                      IF 7>=LEN(xx)
  185.                           SELE 1
  186.                           REPL mxkm WITH mc
  187.                           pd = SUBSTR(xx, 1, 3)
  188.                           SELE 2
  189.                           LOCA ALL FOR pd$kmdm .AND. SUBSTR(kmdm, 1, 3)=pd
  190.                           pd = kmmc
  191.                           SELE 1
  192.                           REPL zzkm WITH pd
  193.                      ENDI
  194.                      IF 3=LEN(xx)
  195.                           DO km-2
  196.                           SET COLOR TO RB+/B
  197.                           @ 0, 0 CLEAR TO 3, 28
  198.                           @ 1, 0 SAY '新增科目帐户是否数量金额式的?'
  199.                           pd = ' '
  200.                           @ 2, 3 SAY ' Y=是,其他=否?' GET pd
  201.                           READ
  202.                           DO qp
  203.                           IF pd='Y' .OR. pd='y'
  204.                                SELE 2
  205.                                SKIP -1
  206.                                REPL slbz WITH '2'
  207.                                SKIP 1
  208.                                REPL slbz WITH '2'
  209.                                SELE 1
  210.                                REPL slbz WITH '2'
  211.                           ENDI
  212.                      ENDI
  213.                      SET COLOR TO BG+/B
  214.                      @ 0, 0 CLEAR TO 3, 28
  215.                      @ 1, 6 SAY '正在进行数据整理,'
  216.                      @ 2, 6 SAY '请稍候 ... ... '
  217.                      SELE 2
  218.                      SORT ON kmdm TO cwkmk%.dbf
  219.                      USE
  220.                      ERAS cwkmk.dbf
  221.                      RENA cwkmk%.dbf TO cwkmk.dbf
  222.                      USE cwkmk
  223.                      SELE 1
  224.                      DO qp
  225.                      EXIT
  226.                 ENDD
  227.            ENDI
  228.       ENDI
  229.       IF a1<>0
  230.            EXIT
  231.       ENDI
  232.  ENDD
  233.  RETU
  234. *