下面是我的代码,乱码的部分是繁体汉字,这样经过FOR循环后,本来要显示两条记录,但是只显示最后一条记录!麻烦帮我看看那里出错了,实在是找不到了!
LOCAL
x, a, b, i, tf, la, kong, m, production , dattotle , totlenum, yearnum, monthnum, worknum,kong,c1year,c2month,c3day,c4,c5,rq
SELECT ("TPAGE4")
tf = 100
i = 0
x = 0
la = 0
kong= space(0)
SELECT ("TPAGE3")
i = reccount()
totlenum = 0
yearnum = 0
monthnum = 0
FOR x = 1 TO i
SELECT ("TPAGE3")
GOTO x
IF kong<>alltrim(tpage3.s2)
tf = 0
la = 0
b
= 0
c1year = 0
c2month = 0
c3day = 0
c4 = 0
c5 = 0
worknum = 0
yearnum = year(tpage3.s11)
messagebox(tpage3.s2,str(yearnum))
monthnum = month(tpage3.s11)
messagebox(tpage3.s2,str(monthnum))
SELECT * FROM jpcorp!?紅︽ㄆ句 WHERE ?紅︽ㄆ句.??=yearnum AND ?紅︽ㄆ句.る?=monthnum INTO CURSOR TEMP
select temp
dattotle = reccount()
USE IN temp
if!used("?紅︽ㄆ句")
USE d:\jpcorp\data\?紅︽ㄆ句
else
select ?紅︽ㄆ句
messagebox("","匡拒??紅︽ㄆ菌")
endif
set order to ?るら
rq = alltrim(str(year(tpage3.s11)))+"/"+alltrim(str(month(tpage3.s11)))+"/"+alltrim(str(day(tpage3.s11)))
?
IF seek(rq)
la = recno()
ELSE
messagebox("禬??紅︽ㄆ句戈?郎?絛瞅, ╰参礚猭璸衡,叫?絋﹚龄!")
EXIT
ENDIF
SELECT ("TPAGE3")
c3day= day(tpage3.s11)
totlenum = tpage3.s6
ELSE
exit
totlenum = tpage3.s6
ENDIF
SELECT ("TPAGE4")
APPEND BLANK
REPLACE tpage4.s3 WITH
totlenum
REPLACE tpage4.s2 WITH
tpage3.s5
REPLACE tpage4.s1 WITH
tpage3.s4
REPLACE tpage4.s35 WITH
tpage3.s1
DO WHILE totlenum>0
select ?紅︽ㄆ句
GOTO la
worknum = iif(alltrim(?紅︽ㄆ句.痁?)=="そヰ", 0, iif(alltrim(?紅︽ㄆ句.痁?)=="?痁", 1, 2))
c1year = ?紅︽ㄆ句.??
c2month = ?紅︽ㄆ句.る?
c3day= ?紅︽ㄆ句.ら戳
SELECT ("TPAGE4")
REPLACE tpage4.s36 WITH c1year
REPLACE tpage4.s37 WITH c2month
SELECT * FROM TPAGE7 WHERE alltrim(tpage7.s1)=alltrim(tpage3.s5) INTO CURSOR TEMP99
IF reccount()==0
= messagebox("тぃ??
"+alltrim(tpage3.s5)+"
?戈?, ╰参盢氨ゎ箇︳")
EXIT
ELSE
production = iif(worknum==0, 0, iif(worknum==1, temp99.s2, temp99.s3))
ENDIF
IF int(production*1.05 )>=totlenum .AND. totlenum>=production
thisform.a41.f5(c3day, totlenum)
totlenum = 0
?
la=la+1
tf = 0
ELSE
IF tf=0
IF totlenum>=production
thisform.a41.f5(c3day, production)
totlenum = totlenum-production
la=la+1
tf = 0
ELSE
thisform.a41.f5(c3day, totlenum)
tf = 100-int((totlenum/production)*100)
totlenum = totlenum-totlenum
tf= tf+0
la=la+0
ENDIF
ELSE
IF totlenum>=int((production*tf)/100)
thisform.a41.f5(c3day, int((production*tf)/100))
totlenum = totlenum-int((production*tf)/100)
la=la+1
tf = 0
ELSE
thisform.a41.f5(c3day, totlenum)
b = 100-int((totlenum/int((production*tf)/100))*100)
totlenum = totlenum-totlenum
tf =tf -b
la=la+0
ENDIF
ENDIF
ENDIF
ENDDO
endfor
SELECT ("TPAGE4")
tableupdate()
SELECT ("TPAGE4")
GOTO TOP
RELEASE WINDOW