毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

物流运输管理系统 第2页

更新时间:2010-2-12:  来源:毕业论文
物流运输管理系统 第2页
4.3 新增运单管理表单
新建FRMTRAFFICADD表单
用来增加物流系统的新接待业务
在新增运单管理模块中,用户输入车号、车类型、品名、发货日期、发站、到站、发货人、收货人、货物类型、重量、运输费用等各个信息,自动在表单下面出现合计信息。
 
新增运单窗体的控件及属性取值如下:
控件 属性 属性取值
Frame Name Frame1
 Caption 运单费用
Labe3 Name Labe3
 Caption 品名
Text Name txtItem
commandbutton Name cmdAdd
 Caption 新增
commandbutton Name cmdExit
 Caption 取消
代码如下:
Private Sub Form_Load()
/***************设置窗体的宽高************************/
    Me.Top = 0
    Me.Left = 0
    Me.Width = MainForm.Width * 0.8
    Me.Height = MainForm.Height * 0.7
    '取得最大ID
    Dim inum As Integer     
    Dim strsql As String
    Dim DB As New clsDataBase
    Dim rs As New ADODB.Recordset
    strsql = "SELECT MAX(ID) AS MAXID FROM TRAFFIC"
    Set rs = sys.DB.OpenRecordSet(strsql)// 从数库中的TRAFFIC表中取出//最大的ID值,并且rs为返回值
    If Not IsNull(rs(0)) Then  //ID最大值在第一列
        ID = rs(0) + 1   //将最大值加1,便是现在的最大值
    Else
        ID = 0
    End If
    txtId.Text = ID
    '初始化车类型
    cmbTrainType.AddItem ("高边")
    cmbTrainType.ItemData(0) = 0
    cmbTrainType.AddItem ("蓬车")
    cmbTrainType.ItemData(1) = 1
    cmbTrainType.ListIndex = 0
    '初始化货物类型
    cmbProductType.AddItem ("包装")
    cmbProductType.ItemData(0) = 0
    cmbProductType.AddItem ("散装")
    cmbProductType.ItemData(1) = 1
    cmbProductType.ListIndex = 0
    '初始化品名
    strsql = "SELECT * FROM PRODUCT"  //strsql为一张表
    Set rs = sys.DB.OpenRecordSet(strsql) //rs放一张表,此时rs指//向第一列
    If Not (rs.BOF) Or (rs.EOF) Then  //如果当前的rs所指的列在第一//列和最后一列之间的话
        inum = 0
        Do While Not rs.EOF    //当rs所指的值不是取后一条数据时
            cmbProductName.AddItem (rs("NAME"))//把当前列名为NAME的值添加到cmbProductName里
            cmbProductName.ItemData(inum) = rs("ID") //把当前列的ID赋给cmbProductName.ItemData(inum)
            rs.MoveNext //让rs指向下一条
            inum = inum + 1
        Loop  //循环 当rs.EOF为TRUE时,说明到最后一行了,跳出循环
    End If
    If cmbProductName.ListIndex <> -1 Then  //判断cmbProductName
//是否为空
        cmbProductName.ListIndex = 0
    Else
        cmbProductName.ListIndex = -1
    End If
/********************下面的与上面这段基本是一样的***************/
    '初始化发站
    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
            cmbSendStation.AddItem (rs("NAME"))
            cmbSendStation.ItemData(inum) = rs("ID")
            rs.MoveNext
            inum = inum + 1
        Loop
    End If
    If cmbSendStation.ListIndex <> -1 Then
        cmbSendStation.ListIndex = 0
    Else
        cmbSendStation.ListIndex = -1
    End If
    '初始化到站
    strsql = "SELECT * FROM STATION  ORDER BY NAME DESC"
    Set rs = sys.DB.OpenRecordSet(strsql)
    If Not (rs.BOF) Or (rs.EOF) Then
        inum = 0
        Do While Not rs.EOF
            cmbReceiveStation.AddItem (rs("NAME"))
            cmbReceiveStation.ItemData(inum) = rs("ID")
            rs.MoveNext
            inum = inum + 1
        Loop
    End If
    If cmbReceiveStation.ListIndex <> -1 Then
        cmbReceiveStation.ListIndex = 0
    Else
        cmbReceiveStation.ListIndex = -1
    '初始化发货人
    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
            cmbSender.AddItem (rs("NAME"))
            cmbSender.ItemData(inum) = rs("ID")
            rs.MoveNext
            inum = inum + 1
        Loop
    End If
    If cmbSender.ListIndex <> -1 Then
        cmbSender.ListIndex = 0
    Else
        cmbSender.ListIndex = -1
    End If
   '初始化收货人
    strsql = "SELECT * FROM CLIENT  ORDER BY NAME DESC"
    Set rs = sys.DB.OpenRecordSet(strsql)
    If Not (rs.BOF) Or (rs.EOF) Then
        inum = 0
        Do While Not rs.EOF
            cmbReceiver.AddItem (rs("NAME"))
            cmbReceiver.ItemData(inum) = rs("ID")
            rs.MoveNext
            inum = inum + 1
        Loop
    End If
    If cmbReceiver.ListIndex <> -1 Then
        cmbReceiver.ListIndex = 0
    Else
        cmbReceiver.ListIndex = -1
    End If
    dtpDateNum.Value = Date
End Sub
'合计
Private Sub MakeTotal()
    txtTotal.Text = sys.TextToNum(txtBasicCarriage.Text) + sys.TextToNum(txtLocalCarriage.Text) + sys.TextToNum(txtServeCharge.Text) - sys.TextToNum(txtFavourabile.Text) + sys.TextToNum(txtLoadCharge.Text) + sys.TextToNum(txtShortCarriage.Text) + sys.TextToNum(txtStorageCharge.Text) + sys.TextToNum(txtClearCharge.Text)
    If sys.TextToNum(txtWeight.Text) <> 0 Then
        txtAvg.Text = FormatNumber(sys.TextToNum(txtTotal.Text / txtWeight.Text), 2) //把sys.TextToNum(txtTotal.Text / txtWeight.Text)
//格式化为小数点后两位小数点的数
    Else
        txtAvg.Text = 0
    End If
End Sub
'检查表单数据
Private Function CheckForm() As Boolean
    CheckForm = False
    If txtCarNum.Text = "" Then
        MsgBox "车号不能为空!"
        txtCarNum.SetFocus
    ElseIf cmbProductName.Text = "" Then
        MsgBox "品名不能为空!"
        cmbProductName.SetFocus
    ElseIf cmbSendStation.Text = "" Then
        MsgBox "发站不能为空!"
        cmbSendStation.SetFocus
    ElseIf cmbReceiveStation.Text = "" Then
        MsgBox "到站不能为空!"
        cmbReceiveStation.SetFocus
    ElseIf txtWeight.Text = "" Then
        MsgBox "重量不能为空!"
        txtWeight.SetFocus
    ElseIf txtBasicCarriage.Text = "" Then
        MsgBox "国铁运费不能为空!"
        txtBasicCarriage.SetFocus
    ElseIf txtServeCharge.Text = "" Then
        MsgBox "服务费不能为空!"
        txtServeCharge.SetFocus
    Else
        CheckForm = True
    End If
End Function
Private Sub Form_Unload(Cancel As Integer)
    If frmTraffic.Visible = True Then
        Call frmTraffic.query  //调用frmTraffic模块中的函数query 

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页

物流运输管理系统 第2页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。