📄 frm_hpty.frm
字号:
End
Begin VB.Label Label25
Caption = "客户电话"
Height = 255
Left = 90
TabIndex = 42
Top = 1080
Width = 825
End
Begin VB.Label Label8
Caption = "托运单号"
Height = 225
Left = 135
TabIndex = 17
Top = 375
Width = 900
End
Begin VB.Label Label2
Caption = "客户名称"
Height = 210
Left = 90
TabIndex = 7
Top = 720
Width = 855
End
Begin VB.Label Label1
Caption = "承运货物"
Height = 255
Index = 1
Left = 2430
TabIndex = 4
Top = 735
Width = 855
End
Begin VB.Label Label1
Caption = "申请单号"
Height = 255
Index = 0
Left = 2490
TabIndex = 2
Top = 360
Width = 855
End
End
Begin VB.Label Label22
Caption = "验收人"
Height = 255
Left = 3960
TabIndex = 58
Top = 5805
Width = 690
End
Begin VB.Label Label21
Caption = "验收日期"
Height = 210
Left = 1575
TabIndex = 57
Top = 5805
Width = 825
End
Begin VB.Label Lbl_Num
Height = 210
Left = 7860
TabIndex = 6
Top = 5805
Width = 2370
End
End
Attribute VB_Name = "Frm_Hpty"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Dim itmX As ListItem '定义一个ListItem对象
Private Sub Cbx_fkfs_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(19).SetFocus
End If
End Sub
Private Sub Cmd_Select_Click()
frm_T_Sqdxx.Left = 3350
frm_T_Sqdxx.Top = 3100
frm_T_Sqdxx.Show 1
' frm_T_Sqdxx.DataGrid1.SetFocus
End Sub
Private Sub Form_Load()
Call RefreshData
Call LoadFile
For i = 1 To 21 '锁定文本框,禁止输入内容
Text1(i).Locked = True
Next i
AdoRs.Open "select * from tb_Goods_tyd order by tyd_tydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Lbl_Num.Caption = "当前数据表中共有 " & AdoRs.RecordCount & " 条记录"
End If
AdoRs.Close
Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub ListView1_Click()
AdoRs.Open "select * from tb_Goods_tyd where tyd_tydh='" & ListView1.SelectedItem & "' order by tyd_tydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Call DataLoad '调用显示数据的事件过程
End If
AdoRs.Close '关闭数据集对象
AdoRs1.Open "select * from tb_Goods_khys where khys_tydh='" & ListView1.SelectedItem & "'", Cnn, adOpenKeyset
If AdoRs1.RecordCount > 0 Then
Txt_ysrq.Text = AdoRs1.Fields("khys_ysrq")
Txt_ysr.Text = AdoRs1.Fields("khys_ysr")
Else
Txt_ysrq.Text = ""
Txt_ysr.Text = ""
End If
AdoRs1.Close
Call ShowData '调用数据刷新的事件过程
Call DBGCon
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Call Tbr_cortrol(Tbr_xxcz, False)
For i = 0 To 21
Text1(i).Locked = False
Text1(i).Text = ""
Next i
Text1(0).SetFocus
Check1.Value = 0
'根据日期产生流水账号
AdoRs.Open "select * from tb_Goods_tyd where tyd_tydh like '%" + Format(Date, "yyyymmdd") + "%' order by tyd_tydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
Txt_id.Text = Val(AdoRs.Fields("tyd_tydh")) + 1
Else
Txt_id.Text = Format(Date, "yyyymmdd") & "00001"
End If
AdoRs.Close
Case 2 '删除信息
Call Deletes
Case 3 '修改信息
Call Edits
Case 4 '保存信息
Call Saves
Case 5
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 1 To 21
Text1(i).Text = ""
Text1(1).SetFocus
Next i
Case 6 '添加货物
TStrs = Txt_id.Text
Frm_Tyhwgl.Cmd_Del.Enabled = False
Frm_Tyhwgl.Show 1
Case 7 '删除货物
TStrs = Txt_id.Text
Frm_Tyhwgl.Cmd_Add.Enabled = False
Frm_Tyhwgl.Cmd_Save.Enabled = False
Frm_Tyhwgl.Show 1
Case 8
Unload Me
End Select
End Sub
Private Sub Text1_Change(Index As Integer)
If Index = 17 Then
Text1(20).Text = Val(Text1(17).Text) + Val(Text1(18).Text)
ElseIf Index = 18 Then
Text1(20).Text = Val(Text1(17).Text) + Val(Text1(18).Text)
End If
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = 13 Then
If Index = 0 Then
Call Cmd_Select_Click
Exit Sub
ElseIf Index = 18 Then
Cbx_fkfs.SetFocus
Exit Sub
End If
End If
If KeyCode = 38 Then
If Index = 16 Then
Cbx_fkfs.SetFocus
Exit Sub
End If
End If
If Index < 22 And KeyCode = 38 Then Text1(Index - 1).SetFocus
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(0).Text = "" Or Text1(1).Text = "" Or Text1(2).Text = "" Or Text1(5).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
AdoRs.Open "select * from tb_Goods_tyd where tyd_tydh='" + Txt_id.Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该信息已经存在", 48, "提示信息"
AdoRs.Close
Else
AdoRs.Close
c = MsgBox("确认保存信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into tb_Goods_tyd values('" & Txt_id & "','" & Text1(0) _
& "','" & Text1(1) & "','" & Text1(2) & "','" & Text1(3) & "','" _
& Text1(4) & "','" & Text1(5) & "','" & Text1(6) & "','" & Text1(7) _
& "','" & Text1(8) & "','" & Text1(9) & "','" & Text1(10) & "','" & Text1(11) & "','" & Text1(12) _
& "','" & Text1(13) & "','" & Text1(14) & "','" & Text1(15) & "'," & Text1(16) _
& "," & Text1(17) & "," & Text1(18) & ",'" & Cbx_fkfs & "'," & Text1(19) & "," & Text1(20) & ",'0','" & Text1(21) & "')")
MsgBox "数据保存成功", 64, "提示信息"
Call RefreshData
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE tb_Goods_tyd SET tyd_tydh='" + Txt_id + "',tyd_sqdh='" + Text1(0) + "',tyd_khmc='" + Text1(1) + "',tyd_cyhw='" + Text1(2) + "',tyd_khdh='" _
+ Text1(3) + "',tyd_khlxr='" + Text1(4) + "',tyd_cydw='" + Text1(5) + "',tyd_cydwdh='" + Text1(6) + "',tyd_cydwlxr='" + Text1(7) + "',tyd_shdw='" + Text1(8) + "',tyd_shdwdh='" + Text1(9) + "',tyd_shdwlxr='" + Text1(10) + "',tyd_shdz='" + Text1(11) + "',tyd_cysj='" _
+ Text1(12) + "',tyd_jszh='" + Text1(13) + "',tyd_clbh='" + Text1(14) + "',tyd_sjsj='" + Text1(15) + "',tyd_bxje=" + Text1(16) + ",tyd_bxf=" + Text1(17) + ",tyd_yf=" + Text1(18) _
+ ",tyd_fkfs='" + Cbx_fkfs + "',tyd_fyhj=" + Text1(20) + ",tyd_yffy=" + Text1(19) + ",tyd_bz='" + Text1(21) + "' where tyd_tydh='" + Txt_id.Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
StrId = Txt_id.Text
StrTitle = Text1(2).Text
Call joinRZ
Else
' AdoRs.Close
End If
End Sub
Private Sub LoadFile()
On Error Resume Next
AdoRs.Open "select * from tb_Goods_tyd", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Call DataLoad
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("Delete tb_Goods_tyd from tb_Goods_tyd where tyd_tydh='" + Txt_id.Text + "'")
Call RefreshData
End If
For i = 0 To 21
Text1(i).Text = ""
Next i
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Lbl_Num.Caption = "当前数据表中共有 " & AdoRs.RecordCount & " 条记录"
End Sub
Private Sub Txt_id_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = 13 Then
AdoRs.Open "select * from tb_Goods_tyd where tyd_tydh='" + Txt_id.Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Call DataLoad
End If
AdoRs.Close
End If
For i = 0 To 21
Text1(i).Locked = False
Next i
End Sub
Private Sub RefreshData()
AdoRs.Open "select * from tb_Goods_tyd order by tyd_tydh", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveFirst
ListView1.ListItems.Clear
ListView1.Enabled = True
AdoRs.MoveFirst
Do While AdoRs.EOF = False
key = AdoRs.Fields("tyd_tydh")
Set itmX = ListView1.ListItems.Add(, , key, 1)
AdoRs.MoveNext
Loop
Else
ListView1.Enabled = False
End If
AdoRs.Close
End Sub
Private Sub ShowData()
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_Goods_hwzx where hwzx_sqdh='" + Txt_id.Text + "' order by hwzx_hwid"
Adodc1.Refresh
End Sub
Private Sub DBGCon()
Dgr_Sjll.Columns(0).Caption = "货物编号"
Dgr_Sjll.Columns(1).Caption = "货物名称"
Dgr_Sjll.Columns(3).Caption = "重量"
Dgr_Sjll.Columns(4).Caption = "物件数量"
Dgr_Sjll.Columns(0).Width = 800
Dgr_Sjll.Columns(1).Width = 1100
Dgr_Sjll.Columns(3).Width = 800
Dgr_Sjll.Columns(4).Width = 800
Dgr_Sjll.Columns(2).Visible = False
End Sub
Private Sub DataLoad()
Txt_id.Text = AdoRs.Fields(0)
Text1(0).Text = AdoRs.Fields(1)
Text1(1).Text = AdoRs.Fields(2)
Text1(2).Text = AdoRs.Fields(3)
Text1(3).Text = AdoRs.Fields(4)
Text1(4).Text = AdoRs.Fields(5)
Text1(5).Text = AdoRs.Fields(6)
Text1(6).Text = AdoRs.Fields(7)
Text1(7).Text = AdoRs.Fields(8)
Text1(8).Text = AdoRs.Fields(9)
Text1(9).Text = AdoRs.Fields(10)
Text1(10).Text = AdoRs.Fields(11)
Text1(11).Text = AdoRs.Fields(12)
Text1(12).Text = AdoRs.Fields(13)
Text1(13).Text = AdoRs.Fields(14)
Text1(14).Text = AdoRs.Fields(15)
Text1(15).Text = AdoRs.Fields(16)
Text1(16).Text = AdoRs.Fields(17)
Text1(17).Text = AdoRs.Fields(18)
Text1(18).Text = AdoRs.Fields(19)
Cbx_fkfs.Text = AdoRs.Fields(20)
Text1(19).Text = AdoRs.Fields(21)
Text1(20).Text = AdoRs.Fields(22)
Check1.Value = AdoRs.Fields(23)
Text1(21).Text = AdoRs.Fields(24)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -