物流运输管理系统 第3页
End If
End Sub
Private Sub txtBasicCarriage_Change()
Call MakeTotal //调用本模块中的函数MakeTotal
End Sub
Private Sub txtClearCharge_Change()
Call MakeTotal
End Sub
Private Sub txtFavourabile_Change()
Call MakeTotal
End Sub
Private Sub txtLoadCharge_Change()
Call MakeTotal
End Sub
Private Sub txtLocalCarriage_Change()
Call MakeTotal
End Sub
Private Sub txtServeCharge_Change()
Call MakeTotal
End Sub
Private Sub txtShortCarriage_Change()
Call MakeTotal
End Sub
Private Sub txtStorageCharge_Change()
Call MakeTotal
End Sub
Private Sub txtWeight_Change()
Call MakeTotal
End Sub
4.4 查看运单表单
新建FRMTRAFFIC表单,查看运单表单,用来查询、浏览、修改和删除所接受的物流业务。选择表单可以浏览、修改和删除运单单据。
查看运单窗体的控件及属性取值如下:
控件 属性 属性取值
Label Name lblTitle
Caption 查看运单
Commandbutton Name cmdmodify
Caption 修改
Commandbutton Name cmddelete
Caption 删除
Commandbutton Name Command4
Caption 查询
代码如下:
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
Me.Width = MainForm.Width * 0.8
Me.Height = MainForm.Height * 0.7
Call query
End Sub
Public Sub query(Optional ByVal strsql As String = "SELECT * FROM TRAFFIC ORDER BY ID DESC")
'查询运单
Dim inum As Integer
Dim rs As New ADODB.Recordset
ReDim arrTraffic(8, 0)
'禁止向前,向后翻页
cmdForWard.Enabled = False
cmdNext.Enabled = False
Set rs = sys.DB.OpenRecordSet(strsql)
rs.PageSize = 50
If Not (rs.BOF) Or (rs.EOF) Then
'计算翻页
MaxPage = rs.PageCount - 1
total = rs.RecordCount
NowPage = 0
'取出记录集
inum = 0
Do While Not rs.EOF
ReDim Preserve arrTraffic(8, inum)// 重新定义arrTraffic为//8行inum列
arrTraffic(0, inum) = rs.Fields("ID") //取ID的值赋给第//1行,第inum列,下面的以此类推
arrTraffic(1, inum) = rs.Fields("CARNUM")
arrTraffic(2, inum) = rs.Fields("DATENUM")
arrTraffic(3, inum) = rs.Fields("PRODUCTNAME")
arrTraffic(4, inum) = rs.Fields("SENDSTATION")
arrTraffic(5, inum) = rs.Fields("RECEIVESTATION")
arrTraffic(6, inum) = rs.Fields("SENDER")
arrTraffic(7, inum) = rs.Fields("WEIGHT")
arrTraffic(8, inum) = rs.Fields("TOTAL")
inum = inum + 1
rs.MoveNext //指向下一列
Loop
'初始化品名
ReDim arrProduct(1, 0) //初始化一个二位数组
strsql = "SELECT * FROM PRODUCT" // strsql为PRODUCT表
Set rs = sys.DB.OpenRecordSet(strsql)//数据库中查询这个表,结果返回rs
If Not (rs.BOF) Or (rs.EOF) Then
inum = 0
Do While Not rs.EOF
ReDim Preserve arrProduct(1, inum)
arrProduct(0, inum) = rs("ID")
arrProduct(1, inum) = rs("NAME")
rs.MoveNext
inum = inum + 1
Loop
End If
'初始化车站
ReDim arrstation(1, 0)
strsql = "SELECT * FROM STATION ORDER BY NAME"
Set rs = sys.DB.OpenRecordSet(strsql)
If Not (rs.BOF) Or (rs.EOF) Then
inum = 0
Do While Not rs.EOF
ReDim Preserve arrstation(1, inum)
arrstation(0, inum) = rs("ID")
arrstation(1, inum) = rs("NAME")
rs.MoveNext
inum = inum + 1
Loop
End If
'初始化客户
ReDim arrclient(1, 0)
strsql = "SELECT * FROM CLIENT ORDER BY NAME"
Set rs = sys.DB.OpenRecordSet(strsql)
If Not (rs.BOF) Or (rs.EOF) Then
inum = 0
Do While Not rs.EOF
ReDim Preserve arrclient(1, inum)
arrclient(0, inum) = rs("ID")
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页