主题:恳请老师帮我看一个程序的代码!
这是一个打印程序,是从VF3.0升级到VFP6.0的,按打印按钮的后,出现“文件没有打开”,不知问题出在那里?请老师赐教:
PUBLIC Y , M , D , A1 , A2 , A3 , A4 , A5 , A6 , A7 , F( FCOUNT() )
FOR K = 1 TO FCOUNT()
F( K ) = PADL(FIELD(K),8)
ENDFOR
USE
A1 = '输入'
A2 = ''
A3 = '完毕!按退出键返回...'
A4 = '数据库中无记录!'
A5 = '按任一键继续....'
A6 = '该单位未建立!'
A7 = '正在打印...'
RQ = DTOC(DATE(),1)
Y = SUBSTR(RQ,1,4)
M = SUBSTR(RQ,5,2)
D = SUBSTR(RQ,7,2)
USE IN 2 GZ2 ORDER 1
USE IN 1 GZ1
DO WHILE .T.
@ 0,0 CLEAR to 20,70
@ 1 , 16 SAY '请使用宽行打印纸!' COLO RGB(0,0,255,) &A13
@ 5 , 20 GET L1 FUNC '*C 生成汇总库(\<K)' DEFA .T. COLO RGB(0,0,255,255,255,255) &A12
@ 7 , 20 SAY '打印标题:' COLO RGB(64,0,0,) &A12
@ 7 , col()+1 GET DWM DEFAULT '公司企管人事部' COLO RGB(0,255,255,255,255,255) &A12
@ 17.5, 40 GET XZ DEFAULT 1 SIZE 2 ,10 , 1 FUNCTION '*H \?退出(\<0);打印(\<+)' COLO RGB(0,0,255,) &A12
READ CYCLE
IF XZ = 1
CLOSE DATABASES
RELEASE WINDOW
RETURN
ENDIF
IF L1
L1 = .F.
USE GZ1 ORDER 1
D4 = FIELD(4)
D5 = FIELD(5)
D6 = FIELD(6)
D7 = FIELD(7)
D8 = FIELD(8)
D9 = FIELD(9)
D10 = FIELD(10)
D11 = FIELD(11)
D12 = FIELD(12)
D13 = FIELD(13)
D14 = FIELD(14)
D15 = FIELD(15)
D16 = FIELD(16)
D17 = FIELD(17)
D18 = FIELD(18)
D19 = FIELD(19)
D20 = FIELD(20)
D21 = FIELD(21)
D22 = FIELD(22)
D23 = FIELD(23)
D24 = FIELD(24)
TOTA TO HZ ON 单位编号 FIEL &D4,&D5,&D6,&D7,&D8,&D9,&D10,&D11,&D12,&D13,&D14,&D15,&D16, &D17,&D18,&D19,&D20,&D21,&D22,&D23,&D24
@ 9 , 20 SAY '汇总库已生成!' COLO RGB(255,0,0,255,255,255) &A12
ENDIF
IF .NOT. FILE('HZ.DBF')
@ 9 , 20 SAY '汇总数据库不存在!' &A12
WA = INKEY(1)
L1 = .T.
LOOP
ENDIF
HX = REPLICATE('—',49)
DWM1 = ALLTRIM(DWM)
@ 11 , 20 SAY A7 &A12
USE IN 2 GZ2 ORDER 1
SELECT 3
USE HZ
SET RELATION TO 单位编号 INTO B
SET DEVICE TO PRINTER
@ PROW() + 5 , 0 SAY ' '
@ PROW()+1,50 SAY '&Y.年&M.月&D.日 &DWM1 工资汇总表' FONT '黑体',12
@ PROW()+2, 0 SAY HX+HX FONT '黑体',9
@ PROW()+1, 0 SAY FIEL(2,2)+'│'+FIEL(4)+'│'+' '+F(5)+'│ '+F(6)+'│'+F(7)+'│'+F(8)+'│ '+F(9) +'│'+F(10)+'│'+F(11)+'│ '+F(12)+'│'+F(13)+'│ '+F(14)+'│'+F(15)+'│'+F(16)+'│' &NT7
@ PROW(),PCOL() SAY ' '+F(17)+'│'+F(18)+'│'+F(19)+'│'+F(20)+'│'+F(21)+'│'+F(22)+'│' +F(23)+'│ '+F(24) &NT7
@ PROW()+1, 0 SAY HX+HX FONT '黑体',9
DO WHILE .NOT. EOF()
SCATTER TO V
P3 = B.单位名称
P4 = STR(V(4),5)
P5 = STR(V(5),9,2)
P6 = STR(V(6),10,2)
P7 = STR(V(7),9,2)
P8 = STR(V(8),9,2)
P9 = STR(V(9),9,2)
P10 = STR(V(10),9,2)
P11 = STR(V(11),9,2)
P12 = STR(V(12),10,2)
P13 = STR(V(13),9,2)
P14 = STR(V(14),10,2)
P15 = STR(V(15),9,2)
P16 = STR(V(16),9,2)
P17 = STR(V(17),9,2)
P18 = STR(V(18),9,2)
P19 = STR(V(19),9,2)
P20 = STR(V(20),9,2)
P21 = STR(V(21),9,2)
P22 = STR(V(22),9,2)
P23 = STR(V(23),9,2)
P24 = STR(V(24),10,2)
@ PROW()+1,0 SAY '&P3 &P4 &P5 &P6 &P7 &P8 &P9 &P10 &P11 &P12 &P13 &P14 &P15 &P16 &P17 &P18 &P19' &NT7
@ PROW(),PCOL() SAY ' &P20 &P21 &P22 &P23 &P24 ' &NT7
SKIP
ENDDO
@ PROW()+1,0 SAY HX+HX FONT '黑体',9
SELECT 3
SUM ALL TO ARRAY T
DIMENSION T( 32 )
II = AINS(T,3)
T4 = STR(T(4),5)
T5 = STR(T(5),10,2)
T6 = STR(T(6),10,2)
T7 = STR(T(7),9,2)
T8 = STR(T(8),9,2)
T9 = STR(T(9),10,2)
T10 = STR(T(10),9,2)
T11 = STR(T(11),9,2)
T12 = STR(T(12),10,2)
T13 = STR(T(13),9,2)
T14 = STR(T(14),10,2)
T15 = STR(T(15),9,2)
T16 = STR(T(16),9,2)
T17 = STR(T(17),9,2)
T18 = STR(T(18),9,2)
T19 = STR(T(19),9,2)
T20 = STR(T(20),8,2)
T21 = STR(T(21),9,2)
T22 = STR(T(22),9,2)
T23 = STR(T(23),9,2)
T24 = STR(T(24),10,2)
@ PROW()+1,0 SAY '合 计 '+' &T4 &T5 &T6 &T7 &T8 &T9 &T10 &T11 &T12 &T13 &T14 &T15 &T16 &T17 &T18 &T19' &NT7
@ PROW(), PCOL()+0.6 SAY +' &T20 &T21 &T22 &T23 &T24' &NT7
@ PROW()+1,0 SAY HX+HX FONT '黑体',9
@ PROW()+1,2 SAY '单位主管:'+SPAC(40)+'劳动工资:'+SPAC(40)+'制表人:' &A10
SELECT 4
USE LOGIN
@ PROW(),PCOL() SAY 姓名 &A14
@ PROW() + 1 , 0 SAY ' '
EJECT
SET PRINTER OFF
SET DEVICE TO SCREEN
@ 13.2 , 20 SAY '打印' + A3 &A12
WAIT ''
ENDDO
PUBLIC Y , M , D , A1 , A2 , A3 , A4 , A5 , A6 , A7 , F( FCOUNT() )
FOR K = 1 TO FCOUNT()
F( K ) = PADL(FIELD(K),8)
ENDFOR
USE
A1 = '输入'
A2 = ''
A3 = '完毕!按退出键返回...'
A4 = '数据库中无记录!'
A5 = '按任一键继续....'
A6 = '该单位未建立!'
A7 = '正在打印...'
RQ = DTOC(DATE(),1)
Y = SUBSTR(RQ,1,4)
M = SUBSTR(RQ,5,2)
D = SUBSTR(RQ,7,2)
USE IN 2 GZ2 ORDER 1
USE IN 1 GZ1
DO WHILE .T.
@ 0,0 CLEAR to 20,70
@ 1 , 16 SAY '请使用宽行打印纸!' COLO RGB(0,0,255,) &A13
@ 5 , 20 GET L1 FUNC '*C 生成汇总库(\<K)' DEFA .T. COLO RGB(0,0,255,255,255,255) &A12
@ 7 , 20 SAY '打印标题:' COLO RGB(64,0,0,) &A12
@ 7 , col()+1 GET DWM DEFAULT '公司企管人事部' COLO RGB(0,255,255,255,255,255) &A12
@ 17.5, 40 GET XZ DEFAULT 1 SIZE 2 ,10 , 1 FUNCTION '*H \?退出(\<0);打印(\<+)' COLO RGB(0,0,255,) &A12
READ CYCLE
IF XZ = 1
CLOSE DATABASES
RELEASE WINDOW
RETURN
ENDIF
IF L1
L1 = .F.
USE GZ1 ORDER 1
D4 = FIELD(4)
D5 = FIELD(5)
D6 = FIELD(6)
D7 = FIELD(7)
D8 = FIELD(8)
D9 = FIELD(9)
D10 = FIELD(10)
D11 = FIELD(11)
D12 = FIELD(12)
D13 = FIELD(13)
D14 = FIELD(14)
D15 = FIELD(15)
D16 = FIELD(16)
D17 = FIELD(17)
D18 = FIELD(18)
D19 = FIELD(19)
D20 = FIELD(20)
D21 = FIELD(21)
D22 = FIELD(22)
D23 = FIELD(23)
D24 = FIELD(24)
TOTA TO HZ ON 单位编号 FIEL &D4,&D5,&D6,&D7,&D8,&D9,&D10,&D11,&D12,&D13,&D14,&D15,&D16, &D17,&D18,&D19,&D20,&D21,&D22,&D23,&D24
@ 9 , 20 SAY '汇总库已生成!' COLO RGB(255,0,0,255,255,255) &A12
ENDIF
IF .NOT. FILE('HZ.DBF')
@ 9 , 20 SAY '汇总数据库不存在!' &A12
WA = INKEY(1)
L1 = .T.
LOOP
ENDIF
HX = REPLICATE('—',49)
DWM1 = ALLTRIM(DWM)
@ 11 , 20 SAY A7 &A12
USE IN 2 GZ2 ORDER 1
SELECT 3
USE HZ
SET RELATION TO 单位编号 INTO B
SET DEVICE TO PRINTER
@ PROW() + 5 , 0 SAY ' '
@ PROW()+1,50 SAY '&Y.年&M.月&D.日 &DWM1 工资汇总表' FONT '黑体',12
@ PROW()+2, 0 SAY HX+HX FONT '黑体',9
@ PROW()+1, 0 SAY FIEL(2,2)+'│'+FIEL(4)+'│'+' '+F(5)+'│ '+F(6)+'│'+F(7)+'│'+F(8)+'│ '+F(9) +'│'+F(10)+'│'+F(11)+'│ '+F(12)+'│'+F(13)+'│ '+F(14)+'│'+F(15)+'│'+F(16)+'│' &NT7
@ PROW(),PCOL() SAY ' '+F(17)+'│'+F(18)+'│'+F(19)+'│'+F(20)+'│'+F(21)+'│'+F(22)+'│' +F(23)+'│ '+F(24) &NT7
@ PROW()+1, 0 SAY HX+HX FONT '黑体',9
DO WHILE .NOT. EOF()
SCATTER TO V
P3 = B.单位名称
P4 = STR(V(4),5)
P5 = STR(V(5),9,2)
P6 = STR(V(6),10,2)
P7 = STR(V(7),9,2)
P8 = STR(V(8),9,2)
P9 = STR(V(9),9,2)
P10 = STR(V(10),9,2)
P11 = STR(V(11),9,2)
P12 = STR(V(12),10,2)
P13 = STR(V(13),9,2)
P14 = STR(V(14),10,2)
P15 = STR(V(15),9,2)
P16 = STR(V(16),9,2)
P17 = STR(V(17),9,2)
P18 = STR(V(18),9,2)
P19 = STR(V(19),9,2)
P20 = STR(V(20),9,2)
P21 = STR(V(21),9,2)
P22 = STR(V(22),9,2)
P23 = STR(V(23),9,2)
P24 = STR(V(24),10,2)
@ PROW()+1,0 SAY '&P3 &P4 &P5 &P6 &P7 &P8 &P9 &P10 &P11 &P12 &P13 &P14 &P15 &P16 &P17 &P18 &P19' &NT7
@ PROW(),PCOL() SAY ' &P20 &P21 &P22 &P23 &P24 ' &NT7
SKIP
ENDDO
@ PROW()+1,0 SAY HX+HX FONT '黑体',9
SELECT 3
SUM ALL TO ARRAY T
DIMENSION T( 32 )
II = AINS(T,3)
T4 = STR(T(4),5)
T5 = STR(T(5),10,2)
T6 = STR(T(6),10,2)
T7 = STR(T(7),9,2)
T8 = STR(T(8),9,2)
T9 = STR(T(9),10,2)
T10 = STR(T(10),9,2)
T11 = STR(T(11),9,2)
T12 = STR(T(12),10,2)
T13 = STR(T(13),9,2)
T14 = STR(T(14),10,2)
T15 = STR(T(15),9,2)
T16 = STR(T(16),9,2)
T17 = STR(T(17),9,2)
T18 = STR(T(18),9,2)
T19 = STR(T(19),9,2)
T20 = STR(T(20),8,2)
T21 = STR(T(21),9,2)
T22 = STR(T(22),9,2)
T23 = STR(T(23),9,2)
T24 = STR(T(24),10,2)
@ PROW()+1,0 SAY '合 计 '+' &T4 &T5 &T6 &T7 &T8 &T9 &T10 &T11 &T12 &T13 &T14 &T15 &T16 &T17 &T18 &T19' &NT7
@ PROW(), PCOL()+0.6 SAY +' &T20 &T21 &T22 &T23 &T24' &NT7
@ PROW()+1,0 SAY HX+HX FONT '黑体',9
@ PROW()+1,2 SAY '单位主管:'+SPAC(40)+'劳动工资:'+SPAC(40)+'制表人:' &A10
SELECT 4
USE LOGIN
@ PROW(),PCOL() SAY 姓名 &A14
@ PROW() + 1 , 0 SAY ' '
EJECT
SET PRINTER OFF
SET DEVICE TO SCREEN
@ 13.2 , 20 SAY '打印' + A3 &A12
WAIT ''
ENDDO