⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄

📁 这是一个航空公司用来计算货物运价的系统。
💻
📖 第 1 页 / 共 2 页
字号:
         Top             =   600
         Width           =   975
      End
      Begin VB.Label Label7 
         Caption         =   "代理人(承运人):"
         Height          =   255
         Left            =   3720
         TabIndex        =   18
         Top             =   248
         Width           =   1695
      End
      Begin VB.Label Label6 
         Caption         =   "总运单号:"
         Height          =   255
         Left            =   240
         TabIndex        =   16
         Top             =   248
         Width           =   975
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "转档"
      Height          =   375
      Left            =   6840
      TabIndex        =   14
      Top             =   840
      Width           =   855
   End
   Begin VB.CommandButton Command3 
      Caption         =   "打印"
      Height          =   375
      Left            =   5640
      TabIndex        =   13
      Top             =   840
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "预览"
      Height          =   375
      Left            =   6840
      TabIndex        =   12
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查询"
      Height          =   375
      Left            =   5640
      TabIndex        =   11
      Top             =   240
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "查询条件"
      Height          =   1215
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5175
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   255
         Left            =   3120
         TabIndex        =   9
         Top             =   720
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   450
         _Version        =   393216
         Format          =   23658497
         CurrentDate     =   36526
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   255
         Left            =   960
         TabIndex        =   8
         Top             =   720
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   450
         _Version        =   393216
         Format          =   23658497
         CurrentDate     =   36526
      End
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   3360
         TabIndex        =   6
         Top             =   360
         Width           =   1215
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1800
         TabIndex        =   4
         Top             =   360
         Width           =   495
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   960
         TabIndex        =   2
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "至"
         Height          =   255
         Left            =   2760
         TabIndex        =   10
         Top             =   720
         Width           =   255
      End
      Begin VB.Label Label4 
         Caption         =   "时间:"
         Height          =   255
         Left            =   360
         TabIndex        =   7
         Top             =   720
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "航班号:"
         Height          =   255
         Left            =   2640
         TabIndex        =   5
         Top             =   375
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "至"
         Height          =   255
         Left            =   1560
         TabIndex        =   3
         Top             =   368
         Width           =   375
      End
      Begin VB.Label Label1 
         Caption         =   "航线:"
         Height          =   255
         Left            =   360
         TabIndex        =   1
         Top             =   368
         Width           =   615
      End
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ey0, ey1, cy As Boolean '变量ey标识究竟有没有更改过数据【其中ey1标识对运价收入的修改】,cy标识数据是否已经重新计算过数据
Dim wg, wl, sum, n, yj As Variant '定义wg,wl(wg为实际计费重量,wl为临界重量),sum为最终运价,n为初步运价
Dim cur1, cur2, cur3, cur4, cur5, cur6, cur7, cur8, cur9 As Variant 'cur1~cur9用来记录M~3000九个级别的运价信息
Dim ax, ay, bx, by As Variant 'ax,ay,bx,by作为四个中间数据寄存器

Private Sub Command1_Click()
Dim dep, dest, fltno As String
Dim dat0, dat1 As Date
dep = Trim(Text1.Text)
dest = Trim(Text2.Text)
fltno = Trim(Text3.Text)
dat0 = DTPicker1.Value
dat1 = DTPicker2.Value
'判断时间的正确性
If dat1 < dat0 Then
MsgBox ("错误!您所输入的终止时间比起始时间要早!!")
Else
'进行数据查询操作
    Dim Rst As ADODB.Recordset
    Dim x As Object
    Set x = CreateObject("db_yunjia.REC")
    Set Rst = x.sel1(Trim(Text1.Text), Trim(Text2.Text), Trim(Text3.Text), DTPicker1.Value, DTPicker2.Value)
    Set x = Nothing
    ListView1.ListItems.Clear
    If Rst Is Nothing Then Exit Sub
    
        If IsRstEmpty(Rst) Then
            Exit Sub
        End If
        ADOFillLvw Rst, Me.ListView1, True
    End If
End Sub

Private Sub Command5_Click()
'首先判断数据是否已经被改动
If ey0 Or ey1 Then
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    '从数据库中获取相关的数据记录
    Dim Rst As ADODB.Recordset
    Dim x As Object
    Dim dfj As String
    Set x = CreateObject("db_yunjia.REC")
    Set Rst = x.sel2(DTPicker3.Value, Trim(Text6.Text), Trim(Text7.Text), Trim(Text8.Text), Trim(Text5.Text))
    dfj = x.sel3(DTPicker3.Value, Trim(Text6.Text), Trim(Text7.Text), Trim(Text8.Text), Trim(Text5.Text))
    Dim dj As Variant
    If IsNumeric(Text13.Text) <> True Then
        MsgBox ("错误!您所输入的计费重量数据格式有误!!")
        Text13.SetFocus
    ElseIf IsNumeric(Text14.Text) <> True Then
        MsgBox ("错误!您所输入的销售运价数据格式有误!!")
        Text14.SetFocus
    Else
        If IsRstEmpty(Rst) Then
            MsgBox ("找不到适合您需要的运价!!")
        Else
            '**********************************************
            '从新进行运价计算,其中Rst.Fields(0)~Rst.Fields(8)
            '未该项目的九个运价数据
            '**********************************************
            '说明存在合适的运价,则重新进行数据的计算
            '进行判断,如果仅仅是对运价的修改,则需要作以番比较
            Dim yjjg, jflag As String
            yjjg = jsyj(Rst.Fields(0), Rst.Fields(1), Rst.Fields(2), Rst.Fields(3), Rst.Fields(4), Rst.Fields(5), Rst.Fields(6), Rst.Fields(7), Rst.Fields(8), Trim(Str(Rst.Fields(9))), Val(dfj), Val(Text13.Text))
            jflag = Split(yjjg, "#")(3)
            If Val(dfj) > 0 And Trim(Rst.Fields(9)) = "1" Then
                dj = Val(dfj)
            Else
                dj = 1
            End If
            If ey1 Then '判断是否是修改的销售运价部分
                If jflag = "a" Then '判断系统返回的是否是M运价
                '如果时,则直接采用修改过的销售运价作为实际运费
                    Text15.Text = Format(Val(Text14.Text) * dj, "###0.00")
                Else '否则只需要将计费重量与销售运价相乘即可
                    Text15.Text = Format(Val(Text13.Text) * Val(Text14.Text) * dj, "###0.00")
                End If
            Else '不是,则重新取出数据进行计算
                '否则,直接进行数据计算即可以了
                Text15.Text = Format(Val(Split(yjjg, "#")(0)), "###0.00")
                Text13.Text = Format(Val(Split(yjjg, "#")(1)), "###0.00")
                Text14.Text = Format(Val(Split(yjjg, "#")(2)), "###0.00")
            End If
        End If
    End If
    Set x = Nothing
    ey0 = False
    ey1 = False
    Text13.Enabled = True
    Text14.Enabled = True
    Text5.Enabled = True
    Text8.Enabled = True
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
End If
End Sub

Private Sub Command6_Click()
If ey0 Or ey1 Then '如果数据经过了改动、而且重新进行过数据计算,则存储数据
    '调用数据计算方法
    Call Command5_Click
End If
'定义数据更新SQL语句
Dim u0 As String
u0 = "update tbl_fare_lf set carrier='" & Trim(Text5.Text) & "',goodscode='" & Trim(Text8.Text) & "',jweight='" & Trim(Text13.Text) & "',yfare='" & Trim(Text14.Text) & "',fare='" & Trim(Text15.Text) & "'"
Dim y As Object
Set y = CreateObject("db_yunjia.REC")
If y.INS0(u0) Then
    MsgBox ("恭喜,数据存储完毕!!")
    Call Command1_Click
Else
    MsgBox ("抱歉,数据库更新失败!!")
End If
cy = False
End Sub

Private Sub Command7_Click()
'判断数据是否已经更改过
If ey0 Or ey1 Or cy Then
    Dim Msg, Style, Title, Response As String
    Msg = "您已经更改过数据,需要保存修改吗??"   ' 定义信息。
    Style = vbYesNoCancel + vbQuestion + vbDefaultButton2   ' 定义按钮。
    Title = "系统提示"   ' 定义标题。
    Response = MsgBox(Msg, Style, Title)
        If Response = vbYes Then
            '调用数据存储过程
            Call Command5_Click
            u0 = "update tbl_fare_lf set carrier='" & Trim(Text5.Text) & "',goodscode='" & Trim(Text8.Text) & "',jweight='" & Trim(Text13.Text) & "',yfare='" & Trim(Text14.Text) & "',fare='" & Trim(Text15.Text) & "'"
            Dim y As Object
            Set y = CreateObject("db_yunjia.REC")
            If y.INS0(u0) Then
            End If
            Unload Form3
            Form4.Show
        ElseIf Response = vbNo Then
        Unload Form3
        Form4.Show
        Else
        '不作任何操作
        End If
Else
    Unload Form3
    Form4.Show
End If
End Sub

Private Sub Form_Load()
'首先未两个标识性布尔变量赋值为false
ey0 = False
ey1 = False
cy = False
    Dim Rst As ADODB.Recordset
    Dim x As Object
    Set x = CreateObject("db_yunjia.REC")
    Set Rst = x.sel1(Trim(Text1.Text), Trim(Text2.Text), Trim(Text3.Text), DTPicker1.Value, DTPicker2.Value)
    Set x = Nothing
    If Rst Is Nothing Then Exit Sub
    If IsRstEmpty(Rst) Then
        Exit Sub
    End If
    ADOFillLvw Rst, Me.ListView1, True
End Sub
'将数据结果显示在下面的文本框中
Private Sub listview1_ItemClick(ByVal Item As MSComctlLib.ListItem)
'首先判断记录是否为空
If Me.ListView1.ListItems.Count = 0 Then Exit Sub
If Item Is Nothing Then Exit Sub
'给每一个文本框赋值
        Me.Text16.Text = Trim(Item.Text)
        Me.Text4.Text = Trim(Item.SubItems(1))
        Me.Text5.Text = Trim(Item.SubItems(2))
        Me.Text6.Text = Trim(Item.SubItems(3))
        Me.Text7.Text = Trim(Item.SubItems(4))
        Me.Text8.Text = Trim(Item.SubItems(9))
        Me.Text9.Text = Trim(Item.SubItems(7))
        Me.Text10.Text = Trim(Item.SubItems(11))
        Me.Text11.Text = Trim(Item.SubItems(8))
        Me.Text12.Text = Trim(Item.SubItems(10))
        Me.Text13.Text = Trim(Item.SubItems(13))
        Me.Text14.Text = Format(Item.SubItems(14), "###0.00")
        yj = Val(Text14.Text)
        Me.Text15.Text = Format(Item.SubItems(15), "###0.00")
        DTPicker3.Value = Item.SubItems(6)
        Text13.Enabled = True
        Text14.Enabled = True
        Text5.Enabled = True
        Text8.Enabled = True
'将编辑标识变量置为否
ey0 = False
ey1 = False
cy = False
End Sub

Private Sub Text13_Change() '数据如果有过改动,则对ey赋值为真
ey0 = True
cy = True
Text14.Enabled = False
End Sub

Private Sub Text14_Change() '数据如果有过改动,则对ey赋值为真
ey1 = True
cy = True
Text13.Enabled = False
Text5.Enabled = False
Text8.Enabled = False
End Sub

Private Sub Text5_Change() '数据如果有过改动,则对ey赋值为真
ey0 = True
cy = True
Text14.Enabled = False
End Sub

Private Sub Text8_Change() '数据如果有过改动,则对ey赋值为真
ey0 = True
cy = True
Text14.Enabled = False
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -