📄
字号:
Width = 615
End
Begin VB.Label Label12
Caption = "1000:"
Height = 255
Left = 3000
TabIndex = 24
Top = 360
Width = 615
End
Begin VB.Label Label11
Caption = "500:"
Height = 255
Left = 600
TabIndex = 22
Top = 2160
Width = 615
End
Begin VB.Label Label10
Caption = "300:"
Height = 255
Left = 600
TabIndex = 20
Top = 1800
Width = 615
End
Begin VB.Label Label9
Caption = "100:"
Height = 255
Left = 600
TabIndex = 18
Top = 1440
Width = 615
End
Begin VB.Label Label8
Caption = "45:"
Height = 255
Left = 600
TabIndex = 16
Top = 1080
Width = 855
End
Begin VB.Label Label7
Caption = "N:"
Height = 255
Left = 720
TabIndex = 13
Top = 720
Width = 375
End
Begin VB.Label Label6
Caption = "M:"
Height = 255
Left = 720
TabIndex = 12
Top = 360
Width = 255
End
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1695
Left = 120
TabIndex = 0
Top = 120
Width = 7935
Begin VB.TextBox Text16
Height = 270
Left = 2760
TabIndex = 50
Top = 660
Width = 615
End
Begin VB.TextBox Text15
Height = 270
Left = 1200
TabIndex = 48
Top = 660
Width = 615
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 5640
TabIndex = 10
Top = 1080
Width = 1335
End
Begin VB.TextBox Text2
Height = 270
Left = 1200
TabIndex = 9
Top = 1080
Width = 2175
End
Begin VB.OptionButton Option3
Caption = "指定"
Height = 255
Left = 6600
TabIndex = 6
Top = 360
Width = 855
End
Begin VB.OptionButton Option2
Caption = "等级"
Height = 255
Left = 5760
TabIndex = 5
Top = 360
Width = 855
End
Begin VB.OptionButton Option1
Caption = "普货"
Height = 255
Left = 4920
TabIndex = 4
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Left = 1200
TabIndex = 2
Top = 240
Width = 2175
End
Begin VB.Label Label4
Caption = "到达站:"
Height = 255
Left = 2040
TabIndex = 49
Top = 720
Width = 735
End
Begin VB.Label Label5
Caption = "代 理 人: (承运人)"
Height = 495
Left = 240
TabIndex = 8
Top = 1080
Width = 1095
End
Begin VB.Label Label3
Caption = "起 始 站:"
Height = 255
Left = 240
TabIndex = 7
Top = 720
Width = 975
End
Begin VB.Label Label2
Caption = "运价类型:"
Height = 255
Left = 3960
TabIndex = 3
Top = 360
Width = 1215
End
Begin VB.Label Label1
Caption = "货物编码:"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 975
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'###########################################################
'# 作者:blue #
'# 日期:2000-12-22 #
'# 网址:http://www.52read.com #
'# 【世纪书城】提供各种文学作品和电脑教程,包括ASP、 #
'# PHP、WML、JSP等数十种类别,是您学习娱乐的好地方 #
'###########################################################
Dim ey, cy As Boolean '定义全局布尔变量,标识数据的修改和存储
Dim dlr, gfrom, gto, gno, gtype As String
Private Sub Command1_Click()
'正确,执行SQL查询语句
'查询,将结果显示在listview控件中
Dim yjlx As Integer
Dim Rst As ADODB.Recordset
Dim x As Object
ey = False
cy = False
'得到运价类型数据
If Option1.Value Then
yjlx = 1
End If
If Option2.Value Then
yjlx = 2
End If
If Option3.Value Then
yjlx = 3
End If
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text17.Text = ""
Set x = CreateObject("db_yunjia.REC")
Set Rst = x.sel0(Trim(Text1.Text), Trim(Str(yjlx)), Trim(Text15.Text), Trim(Text16.Text), Trim(Text2.Text))
Set x = Nothing
lvwPrice.ListItems.Clear
If Rst Is Nothing Then Exit Sub
If IsRstEmpty(Rst) Then
Exit Sub
End If
ADOFillLvw Rst, Me.lvwPrice, True
'End If
End Sub
Private Sub Command2_Click()
If ey = False Then '数据未被更改过,直接存储数据
Unload Form1
Form4.Show
Else '数据已经被更改过了,提示用户是否需要保存被修改过的信息
Dim Msg, Style, Title, Response As String
Msg = "您已经改动了该条记录,您确信要放弃修改吗?" ' 定义信息。
Style = vbYesNoCancel + vbQuestion + vbDefaultButton2 ' 定义按钮。
Title = "系统提示" ' 定义标题。
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then '需要保存则生成保存数据的SQL语句并执行,关闭窗口
Unload Form1
Form4.Show
ElseIf Response = vbNo Then '不需要保存数据,则直接关闭窗口
'首先调用存储过程,存储数据
'*********************************
'数据库存储过程的调用
'*********************************
Dim cur1, cur2, cur3, cur4, cur5, cur6, cur7, cur8, cur9 As Currency 'cur1~cur9为M~3000九个级别的运价数据
If ey Then '判断数据是否被修改过,如果被修改过,则要进行数据存储
'首先对数据的合法性进行必要的验证,只有通过了验证的数据才能最终进行数据存储操作
If IsNumeric(Text3.Text) <> True And Text3.Text <> "" Then
MsgBox ("请在此输入正确的M运价!!")
Text3.Text = ""
Text3.SetFocus
ElseIf IsNumeric(Text4.Text) <> True And Text4.Text <> "" Then
MsgBox ("请在此输入正确的N运价!!")
Text4.Text = ""
Text4.SetFocus
ElseIf IsNumeric(Text5.Text) <> True And Text5.Text <> "" Then
MsgBox ("请在此输入正确的45Kg运价!!")
Text5.Text = ""
Text5.SetFocus
ElseIf IsNumeric(Text6.Text) <> True And Text6.Text <> "" Then
MsgBox ("请在此输入正确的100Kg运价!!")
Text6.Text = ""
Text6.SetFocus
ElseIf IsNumeric(Text7.Text) <> True And Text7.Text <> "" Then
MsgBox ("请在此输入正确的300Kg运价!!")
Text7.Text = ""
Text7.SetFocus
ElseIf IsNumeric(Text8.Text) <> True And Text8.Text <> "" Then
MsgBox ("请在此输入正确的500Kg运价!!")
Text8.Text = ""
Text8.SetFocus
ElseIf IsNumeric(Text9.Text) <> True And Text9.Text <> "" Then
MsgBox ("请在此输入正确的1000Kg运价!!")
Text9.Text = ""
Text9.SetFocus
ElseIf IsNumeric(Text10.Text) <> True And Text10.Text <> "" Then
MsgBox ("请在此输入正确的2000Kg运价!!")
Text10.Text = ""
Text10.SetFocus
ElseIf IsNumeric(Text11.Text) <> True And Text11.Text <> "" Then
MsgBox ("请在此输入正确的3000Kg运价!!")
Text11.Text = ""
Text11.SetFocus
ElseIf IsNumeric(Text14.Text) <> True And Text14.Text <> "" Then
MsgBox ("请在此输入正确等级附加率!!")
Text14.Text = ""
Text14.SetFocus
Else '正确情况
cur1 = Val(Text3.Text)
cur2 = Val(Text4.Text)
cur3 = Val(Text5.Text)
cur4 = Val(Text6.Text)
cur5 = Val(Text7.Text)
cur6 = Val(Text8.Text)
cur7 = Val(Text9.Text)
cur8 = Val(Text10.Text)
cur9 = Val(Text11.Text)
'----------首先判断数据的合法性------------
If Option5.Value Then '等级商品运价
'等级商品运价的条件是M~3000九个等级数据均为空,只有等级百分比不为空
If Text12.Text = "" Then
MsgBox ("请在此输入货物编码!!")
Text12.Text = ""
Text12.SetFocus
ElseIf Text14.Text = "" Or IsNumeric(Text14.Text) <> True Then
MsgBox ("请在此输入正确的附加百分比!!")
Text14.Text = ""
Text14.SetFocus
Else '输入的等级商品运价信息正确
'**********进行数据存储操作***********
Dim x0 As Object
Set x0 = CreateObject("db_yunjia.REC")
If x0.up0(Trim(Text3.Text), Trim(Text4.Text), Trim(Text5.Text), Trim(Text6.Text), Trim(Text7.Text), Trim(Text8.Text), Trim(Text9.Text), Trim(Text10.Text), Trim(Text11.Text), Trim(Text12.Text), Trim(Text13.Text), Trim(Text14.Text), Trim(Text17.Text), Trim(gtype)) Then
Else
MsgBox ("数据更新失败,请重新操作!!")
End If
cy = True '将存储标识变量置为真
ey = False '将改动标识变量重新置为false
End If
Else '普通商品运价或指定商品运价
'普货或指定商品的cur3~cur7均不为空
If Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Then '45~1000Kg级别之间有一项数据为空
MsgBox ("45~1000Kg这几个等级数据不能为空!!")
Text5.SetFocus
ElseIf (Text10.Text = "" And Text11.Text <> "") Or (Text10.Text <> "" And Text11.Text = "") Then
MsgBox ("2000,3000Kg这两个重量级别的运价只能同时为空或同事赋值!!")
Text10.SetFocus
Else
'进一步判断这些数据的合法性,主要是cur2~cur9这几个数据是逐步缩小的
If cur2 <> 0 And cur2 < cur3 Then 'N出错
MsgBox ("您所输入的N运价有误!!")
Text4.Text = ""
Text4.SetFocus
ElseIf (cur2 <> 0 And cur3 > cur2) Or cur3 < cur4 Then '45Kg出错了
MsgBox ("您所输入的45Kg级运价有误!!")
Text5.Text = ""
Text5.SetFocus
ElseIf cur4 > cur3 Or cur4 < cur5 Then '100Kg出错了
MsgBox ("您所输入的100Kg级运价有误!!")
Text6.Text = ""
Text6.SetFocus
ElseIf cur5 > cur4 Or cur5 < cur6 Then '300kg出错了
MsgBox ("您所输入的300Kg级运价有误!!")
Text7.Text = ""
Text7.SetFocus
ElseIf cur6 > cur5 Or cur6 < cur7 Then '500kg出错了
MsgBox ("您所输入的500Kg级运价有误!!")
Text8.Text = ""
Text8.SetFocus
ElseIf cur7 > cur6 Or cur7 < cur8 Then '1000kg出错了
MsgBox ("您所输入的1000Kg级运价有误!!")
Text9.Text = ""
Text9.SetFocus
ElseIf cur8 > cur7 Or cur8 < cur9 Then '2000kg出错了
MsgBox ("您所输入的2000Kg级运价有误!!")
Text10.Text = ""
Text10.SetFocus
ElseIf cur9 > cur8 Then '3000Kg出错了
MsgBox ("您所输入的3000Kg级运价有误!!")
Text11.Text = ""
Text11.SetFocus
ElseIf Text12.Text = "" Then
MsgBox ("请在此输入货物编码!!")
Text12.Text = ""
Text12.SetFocus
ElseIf Text13.Text = "" Then
MsgBox ("请在此输入代理商编码!!")
Text13.Text = ""
Text13.SetFocus
Else '输入的普货或指定商品运价信息正确
'调用存储过程存储数据。
'*********************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -