'*********************************************************
' browse 查询数据
'*********************************************************
Sub browse(filetype$,ele$,found%) 'ele$ 为编码 found% 为行数
cls
select filetype$
case "instock"
Open "A:instock.Txt" as #2
Field #2,20 as tm$,5 as sl$,2 as czy$,12 as dttm$
srch%=0
If ele$<>"" Then
s$=left$(ele$+" ",20)
srch%=Search(#2,tm$,s$,1)
Else
If found%>0 and found% srch%=found%
End If
End If
If srch%>0 Then
Get #2,srch%
cls
print tm$
print sl$
print czy$
print dttm$
Else
cls
screen 1,0
print "没有找到纪录!"
print
print "按任意键退出!"
wait 0,1
k$=Input$(1)
Exit sub
End If
Close #2
case "outstock"
Open "A:outstock.Txt" as #3
Field #3,20 as tm$,5 as sl$,10 as dj$,10 as je$,2 as czy$,12 as dttm$
srch%=0
If ele$<>"" Then
s$=left$(ele$+" ",20)
srch%=search(#3,tm$,s$,1)
Else
If found%>0 and found% srch%=found%
End If
End If
If srch%>0 Then
Get #3,srch%
cls
print tm$
print sl$
print dj$
print je$
print czy$
print dttm$
Else
cls
screen 1,0
print "没有找到纪录!"
print
print "按任意键退出!"
wait 0,1
k$=Input$(1)
Exit sub
End If
Close #3
case "kcstock"
Open "A:kcstock.Txt" as #1
Field #1, 20 as tm$, 20 as mc$, 10 as dj$, 5 as qc$, 5 as rk$, 5 as ck$, 5 as jy$, 12 as dttm$
fd%=0
If ele$<>"" Then
s$=left$(ele$+" ",20)
fd%=search(#1,tm$,s$,1)
Else
If found%>0 and found% fd%=found%
End If
End If
If fd%>0 Then
Get #1,fd%
cls
print tm$
print mc$
print dj$
print qc$
print rk$
print ck$
print jy$
print dttm$
Else
cls
screen 1,0
print "没有找到纪录!"
print
print "按任意键退出!"
wait 0,1
k$=Input$(1)
Exit sub
End If
Close #1
End Select
screen 1,0
locate 1,19: print "M1退出 ↑/↓上/下一条 F2删除 "
while 1
k$=Input$(1)
select k$
case chr$(27)'退出
Exit sub
case chr$(28)
browse(filetype$,ele$,found%-1)
Exit Sub
case chr$(29)
browse(filetype$,ele$,found%+1)
Exit Sub
case chr$(66)'删除
'call delete(filetype$,found%)
Exit Sub
End select
Wend
End Sub
'*****************************
' main
'*****************************
MAIN:
Cls
Out &H6080,1 '0:standard-size; 1:the small-size
screen 1,0
call browse("kcstock","",1)
ERRCOMM:
Cls
Beep 8
'Print "操作错误:"
'Print
'Print "按任意键退出";
'Wait 0,1
'k$=Input$(1)
End
阅读(2055) | 评论(0) | 转发(0) |