📄 frm_hpys.frm
字号:
Begin VB.Label Label1
Caption = "客户验收编号"
Height = 240
Index = 0
Left = 2775
TabIndex = 2
Top = 375
Width = 1155
End
End
Begin MSDataGridLib.DataGrid Dgr_Sjll
Bindings = "Frm_Hpys.frx":DF84
Height = 1515
Left = 1575
TabIndex = 21
Top = 2730
Width = 6030
_ExtentX = 10636
_ExtentY = 2672
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Lbl_Num
Height = 210
Left = 4980
TabIndex = 6
Top = 4320
Width = 2460
End
End
Attribute VB_Name = "Frm_Hpys"
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_Tydxx.Left = 6200
frm_T_Tydxx.Top = 4000
TydBs = "YS"
frm_T_Tydxx.Show 1
' frm_T_Sqdxx.DataGrid1.SetFocus
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(3).SetFocus
End If
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Call RefreshData
Call LoadFile
Call DBGCon
For i = 1 To 5
Text1(i).Locked = True
Next i
AdoRs.Open "select * from tb_Goods_khys order by khys_id", 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_khys where khys_id='" & ListView1.SelectedItem & "' order by khys_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
On Error Resume Next
Txt_id.Text = AdoRs.Fields(0)
Text1(0).Text = AdoRs.Fields(1)
Text1(1).Text = AdoRs.Fields(3)
DT1.Value = AdoRs.Fields(4)
Text1(2).Text = AdoRs.Fields(2)
Text1(3).Text = AdoRs.Fields(5)
Text1(4).Text = AdoRs.Fields(6)
Text1(5).Text = AdoRs.Fields(7)
End If
AdoRs.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 5
Text1(i).Locked = False
Text1(i).Text = ""
Next i
Text1(0).SetFocus
AdoRs.Open "select * from tb_Goods_khys where khys_id like '%" + Format(Date, "yyyymmdd") + "%' order by khys_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
Txt_id.Text = Val(AdoRs.Fields("khys_id")) + 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 = 0 To 5
Text1(i).Text = ""
Text1(1).SetFocus
Next i
Case 6
Unload Me
End Select
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If Index = 1 Then
If KeyCode = 13 Then
Cmd_Select_Click
Exit Sub
End If
End If
If Index = 2 Then
If KeyCode = 13 Then
DT1.SetFocus
Exit Sub
End If
End If
If Index = 3 Then
If KeyCode = 38 Then
DT1.SetFocus
Exit Sub
End If
End If
If Index = 5 Then
If KeyCode = 13 Then
Call Saves
Exit Sub
End If
End If
If Index < 5 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(2).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
AdoRs.Open "select * from tb_Goods_khys where khys_id='" + 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_khys values('" & Txt_id & "','" & Text1(0) _
& "','" & Text1(2) & "','" & Text1(1) & "','" & STR(DT1.Value) & "','" _
& Text1(3) & "','" & Text1(4) & "','" & Text1(5) & "')")
Set AdoRs = Cnn.Execute("UPDATE tb_Goods_tyd SET tyd_sfys=1 where tyd_tydh='" + Text1(1).Text + "'")
Call ShowData
Call RefreshData
Call DBGCon
MsgBox "数据保存成功", 64, "提示信息"
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
On Error Resume Next
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE tb_Goods_khys SET khys_id='" + Txt_id.Text + "',khys_ysbh='" + Text1(0) + "',khys_khmc='" + Text1(1) + "',khys_tydh='" + Text1(2) + "',khys_ysrq='" _
+ STR(DT1.Value) + "',khys_ysdw='" + Text1(3) + "',khys_ysr='" + Text1(4) + "',khys_bzxx='" + Text1(5) + "' where khys_id='" + Txt_id.Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
StrId = Txt_id.Text
StrTitle = Text1(1).Text
Call joinRZ
Else
End If
Call DBGCon
End Sub
Private Sub LoadFile()
On Error Resume Next
AdoRs.Open "select * from tb_Goods_khys", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Txt_id.Text = AdoRs.Fields(0)
Text1(0).Text = AdoRs.Fields(1)
Text1(1).Text = AdoRs.Fields(3)
DT1.Value = AdoRs.Fields(4)
Text1(2).Text = AdoRs.Fields(2)
Text1(3).Text = AdoRs.Fields(5)
Text1(4).Text = AdoRs.Fields(6)
Text1(5).Text = AdoRs.Fields(7)
End If
AdoRs.Close
ShowData
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("Delete tb_Goods_khys from tb_Goods_khys where khys_id='" + Txt_id.Text + "'")
Call RefreshData
End If
For i = 0 To 5
Text1(i).Text = ""
Next i
Call ShowData
Call DBGCon
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_khys where khys_id='" + Txt_id.Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Txt_id.Text = AdoRs.Fields(0)
Text1(0).Text = AdoRs.Fields(1)
Text1(1).Text = AdoRs.Fields(3)
DT1.Value = AdoRs.Fields(4)
Text1(2).Text = AdoRs.Fields(2)
Text1(3).Text = AdoRs.Fields(5)
Text1(4).Text = AdoRs.Fields(6)
Text1(5).Text = AdoRs.Fields(7)
End If
For i = 0 To 5
Text1(i).Locked = False
Next i
AdoRs.Close
End If
End Sub
Private Sub RefreshData()
AdoRs.Open "select * from tb_Goods_khys order by khys_id", 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("khys_id")
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_khys order by khys_id"
Adodc1.Refresh
End Sub
Private Sub DBGCon()
Dgr_Sjll.Columns(0).Caption = "编号"
Dgr_Sjll.Columns(1).Caption = "客户验收编号"
Dgr_Sjll.Columns(2).Caption = "客户名称"
Dgr_Sjll.Columns(3).Caption = "托运单号"
Dgr_Sjll.Columns(4).Caption = "验收日期"
Dgr_Sjll.Columns(5).Caption = "验收单位"
Dgr_Sjll.Columns(6).Caption = "验收人"
Dgr_Sjll.Columns(7).Caption = "备注信息"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -