www.pudn.com > jq_gongzi.ARJ > GZBDY.PRG


*************************** 
* .\GZBDY.PRG 
*************************** 
use set 
RDWMC = DW 
GZB1MC = MC 
skip  
GZB2MC = MC 
skip  
GZB3MC = MC 
skip  
GZB4MC = MC 
use  
?? chr(7) 
@ 12 , 51 say '→ 真的打印吗(Y/N)?' 
I = inkey(0) 
if I<>89 and I<>121 
  return  
endif  
NF = 0 
YF = 0 
set color to 
@ 5 , 8 clear to 10 , 35 
@ 7 , 13 say '年' 
@ 7 , 10 get NF picture '@z 99' 
@ 7 , 17 get YF picture '@z 99' 
@ 7 , 20 say '月份工资' 
read  
YC = 1 
?? chr(7) 
@ 5 , 8 clear to 10 , 35 
@ 7 , 10 say '从第几页开始打印?' 
@ 8 , 18 get YC picture '@z 99' valid YC>=1 
read  
select 1 
use &gzbwj 
count all to CRECN 
select 2 
use  
erase gzb_1.dbf 
select 1 
copy to gzb_1 structure extended 
select 2 
use gzb_1 
count all to XMS 
select 1 
if ((YC-1)*19+1)>CRECN 
  return  
else  
  go ((YC-1)*19+1) 
endif  
select 2 
go top 
select 2 
PD = 1 
BS = 1 
YS = 1 
XMK = 'xm1' 
H = 0 
LEN = 0 
go 2 
HC = 0 
do while  not eof() 
  LEN = FIELD_LEN 
  P = FIELD_NAME 
  P = trim(P) 
  LEN1 = len(P) 
  LEN = max(LEN,LEN1) 
  HC = HC+LEN+2 
  skip  
enddo  
do while .t. 
  do while .t. 
    if sys(13)<>'READY' 
      ?? chr(7) 
      set color to 
      @ 5 , 8 clear to 10 , 35 
      set color to w+/b 
      @ 4 , 5 clear to 9 , 33 
      X1 = 4 
      X2 = 9 
      Y1 = 5 
      Y2 = 31 
      do box-1 
      @ 6 , 9 say '打印机尚未准备好!' 
      @ 7 , 9 say '准备好后按任意键......' 
      I = inkey(0) 
    else  
      set color to 
      @ 5 , 8 clear to 10 , 35 
      set color to w+/b 
      @ 4 , 5 clear to 9 , 33 
      X1 = 4 
      X2 = 9 
      Y1 = 5 
      Y2 = 31 
      do box-1 
      set color to w+/b 
      @ 6 , 8 clear to 8 , 30 
      @ 6 , 9 say '正在打印工资表名册!' 
      @ 7 , 13 say '请稍候......' 
      exit  
    endif  
  enddo  
  set printer on 
  set device to printer 
  set console off 
  JSQ = 1 
  ? '' 
  ? '' 
  ? '' 
  ? '                                                                 工; 
        资      表  ' 
  ? ' ' 
  @ prow()+1 , 1 say RDWMC 
  do case 
  case GZBWJ='gzb1' 
    @ prow() , 20 say GZB1MC 
  case GZBWJ='gzb2' 
    @ prow() , 20 say GZB2MC 
  case GZBWJ='gzb3' 
    @ prow() , 20 say GZB3MC 
  case GZBWJ='gzb4' 
    @ prow() , 20 say GZB4MC 
  endcase  
  @ prow() , 60 say NF picture '@z 99' 
  @ prow() , 63 say '年' 
  @ prow() , 66 say YF picture '@z 99' 
  @ prow() , 69 say '月份工资' 
  @ prow() , 110 say '第' 
  @ prow() , 113 say YC picture '99' 
  @ prow() , 116 say '页' 
  PD = 1 
  ? '' 
  do while PD<=HC 
    @ prow() , PD say '-' 
    PD = PD+1 
  enddo  
  ? '' 
  select 1 
  do while  not eof() 
    select 2 
    go 2 
    do while  not eof() 
      LEN = FIELD_LEN 
      P = FIELD_NAME 
      P = trim(P) 
      LEN1 = len(P) 
      LEN = max(LEN,LEN1) 
      do case 
      case LEN=1 
        PIC = "pict'X'" 
      case LEN=2 
        PIC = "pict'XX'" 
      case LEN=3 
        PIC = "pict'XXX'" 
      case LEN=4 
        PIC = "pict'XXXX'" 
      case LEN=5 
        PIC = "pict'XXXXX'" 
      case LEN=6 
        PIC = "pict'XXXXXX'" 
      case LEN=7 
        PIC = "pict'XXXXXXX'" 
      case LEN=8 
        PIC = "pict'XXXXXXXX'" 
      case LEN=9 
        PIC = "pict'XXXXXXXXX'" 
      case LEN=10 
        PIC = "pict'XXXXXXXXXX'" 
      endcase  
      @ prow(),pcol()+2 say field_name &pic 
      skip  
      H = H+LEN 
    enddo  
    ? '' 
    H = 0 
    select 2 
    go 2 
    H = -1 
    LEN = 0 
    do while  not eof() 
      XMK = FIELD_NAME 
      P = FIELD_NAME 
      LEN = FIELD_LEN 
      DEC = FIELD_DEC 
      P = trim(P) 
      LEN1 = len(P) 
      LEN = max(LEN,LEN1) 
      select 1 
      do case 
      case LEN=1 
        PIC = "pict'9'" 
      case LEN=2 
        PIC = "pict'99'" 
      case LEN=3 
        if DEC=0 
          PIC = "pict'999'" 
        else  
          PIC = "pict'9.9'" 
        endif  
      case LEN=4 
        if DEC=0 
          PIC = "pict'9999'" 
        else  
          if DEC=1 
            PIC = "pict'99.9'" 
          else  
            PIC = "pict'9.99'" 
          endif  
        endif  
      case LEN=5 
        if DEC=0 
          PIC = "pict'99999'" 
        else  
          if DEC=1 
            PIC = "pict'999.9'" 
          else  
            PIC = "pict'99.99'" 
          endif  
        endif  
      case LEN=6 
        if DEC=0 
          PIC = "pict'999999'" 
        else  
          if DEC=1 
            PIC = "pict'9999.9'" 
          else  
            PIC = "pict'999.99'" 
          endif  
        endif  
      case LEN=7 
        if DEC=0 
          PIC = "pict'9999999'" 
        else  
          if DEC=1 
            PIC = "pict'99999.9'" 
          else  
            PIC = "pict'9999.99'" 
          endif  
        endif  
      case LEN=8 
        if DEC=0 
          PIC = "pict'99999999'" 
        else  
          if DEC=1 
            PIC = "pict'999999.9'" 
          else  
            PIC = "pict'99999.99'" 
          endif  
        endif  
      case LEN=9 
        if DEC=0 
          PIC = "pict'999999999'" 
        else  
          if DEC=1 
            PIC = "pict'9999999.9'" 
          else  
            PIC = "pict'999999.99'" 
          endif  
        endif  
      case LEN=10 
        if DEC=0 
          PIC = "pict'9999999999'" 
        else  
          if DEC=1 
            PIC = "pict'99999999.9'" 
          else  
            PIC = "pict'9999999.99'" 
          endif  
        endif  
      endcase  
      @ prow(),pcol()+2 say &xmk &pic 
      H = H+LEN 
      select 2 
      skip  
    enddo  
    select 1 
    skip  
    PD = 1 
    ? '' 
    do while PD<=HC 
      @ prow() , PD say '-' 
      PD = PD+1 
    enddo  
    ? '' 
    JSQ = JSQ+1 
    if JSQ=20 
      YC = YC+1 
      set printer off 
      set device to screen 
      set console on 
      ?? chr(7) 
      set color to 
      @ 5 , 8 clear to 10 , 35 
      set color to w+/b 
      @ 4 , 5 clear to 9 , 33 
      X1 = 4 
      X2 = 9 
      Y1 = 5 
      Y2 = 31 
      do box-1 
      @ 6 , 9 say '换页,按Esc键退出打印!' 
      @ 7 , 9 say '按其他键继续打印......' 
      I = inkey(0) 
      if I=27 
        go bottom 
        skip  
      endif  
      exit  
    endif  
  enddo  
  if eof() 
    exit  
  endif  
enddo  
? '       企业主管:                    财务主管:                        ; 
     复核:                               制表:' 
? ' ' 
set color to 
close all 
erase gzb_1.dbf 
set printer off 
set device to screen 
set console on 
return