📄 frmdzly.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmDZLY
Caption = "单证领用"
ClientHeight = 6195
ClientLeft = 60
ClientTop = 345
ClientWidth = 9645
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 6195
ScaleWidth = 9645
Begin VB.Frame Frame3
Height = 6060
Left = 7215
TabIndex = 2
Top = 0
Width = 2400
Begin VB.ComboBox findbt
Height = 300
ItemData = "frmDZLY.frx":0000
Left = 540
List = "frmDZLY.frx":0002
TabIndex = 18
Text = "ID"
Top = 2895
Width = 1620
End
Begin VB.TextBox findnr
Height = 300
Left = 540
TabIndex = 17
Top = 3300
Width = 1620
End
Begin VB.CommandButton Command4
Caption = "查找"
Height = 450
Left = 675
TabIndex = 16
Top = 4065
Width = 1410
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 450
Left = 600
TabIndex = 15
Top = 2025
Width = 1410
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 450
Left = 600
TabIndex = 14
Top = 1320
Width = 1410
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 450
Left = 600
TabIndex = 13
Top = 630
Width = 1410
End
End
Begin VB.Frame Frame2
Height = 3405
Left = 45
TabIndex = 1
Top = 2670
Width = 7155
Begin MSFlexGridLib.MSFlexGrid MSFLGDZ
Height = 3075
Left = 120
TabIndex = 12
Top = 210
Width = 6960
_ExtentX = 12277
_ExtentY = 5424
_Version = 393216
Cols = 7
FormatString = "单证编号 |单证名称 |领用数量|领用日期 |保险公司 "
End
End
Begin VB.Frame Frame1
Height = 2655
Left = 45
TabIndex = 0
Top = 15
Width = 7170
Begin VB.ComboBox BXGS
Height = 300
Left = 1245
TabIndex = 19
Top = 2010
Width = 5625
End
Begin MSComCtl2.DTPicker LYRQ
Height = 300
Left = 4680
TabIndex = 11
Top = 1230
Width = 2175
_ExtentX = 3836
_ExtentY = 529
_Version = 393216
Format = 57081857
CurrentDate = 38931
End
Begin VB.TextBox LYSL
Height = 300
Left = 1245
TabIndex = 10
Top = 1230
Width = 2175
End
Begin VB.TextBox DZMC
Height = 300
Left = 4680
TabIndex = 9
Top = 465
Width = 2175
End
Begin VB.TextBox DZBH
Height = 300
Left = 1245
TabIndex = 8
Top = 465
Width = 2175
End
Begin VB.Label Label5
Caption = "保险公司"
Height = 420
Left = 420
TabIndex = 7
Top = 2070
Width = 1080
End
Begin VB.Label Label4
Caption = "领用日期"
Height = 420
Left = 3795
TabIndex = 6
Top = 1260
Width = 960
End
Begin VB.Label Label3
Caption = "领用数量"
Height = 420
Left = 420
TabIndex = 5
Top = 1297
Width = 1125
End
Begin VB.Label Label2
Caption = "单证名称"
Height = 420
Left = 3750
TabIndex = 4
Top = 525
Width = 975
End
Begin VB.Label Label1
Caption = "单证编号"
Height = 420
Left = 420
TabIndex = 3
Top = 525
Width = 990
End
End
End
Attribute VB_Name = "frmDZLY"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
On Error GoTo ErrHandle
rs.Open "select * from dzly where dzbh='" & DZBH & "'", gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
If MsgBox("单证编号为:" & DZBH & "的记录已经存在,是否修改?", vbYesNo, "系统提问") = vbNo Then
Exit Sub
Else
gCnn.Execute "update dzly set dzmc='" & DZMC & "',lysl=" & Val(LYSL) & ",lyrq='" & LYRQ & "',bxgs='" & BXGS & "' where dzbh='" & DZBH & "'"
End If
Else
gCnn.Execute "insert into dzly(dzbh,dzmc,lysl,lyrq,bxgs,czy)values('" & DZBH & "','" & DZMC & "'," & Val(LYSL) & ",'" & LYRQ & "','" & BXGS & "','" & gUser & "')"
End If
MsgBox "保存成功!!"
ClearTxt
Call Form_Load
Exit Sub
ErrHandle:
MsgBox Err.Description, vbCritical, "系统提示"
End Sub
Private Sub Command2_Click()
If MsgBox("确定删除单证编号为:" & DZBH & "的记录?", vbYesNo, "x系统提示") = vbNo Then
Exit Sub
Else
gCnn.Execute "delete from dzly where dzbh='" & DZBH & "'"
End If
MsgBox "删除成功"
ClearTxt
Call Form_Load
End Sub
Private Sub ClearTxt()
DZBH = ""
DZMC = ""
LYSL = ""
BXGS = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim strsql As String
strsql = "select * from VIEWDZLY"
If Trim(findbt) <> "" And Trim(findnr) <> "" Then
strsql = strsql & " where " & findbt & " like '%" & findnr & "%'"
End If
rs.Open strsql, gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
Call FillFLG(findbt, findnr)
End If
End Sub
Private Sub FillFLG(CODE1 As String, CODE2 As String)
Dim rs As ADODB.Recordset
Dim strsql As String
Dim i As Long
Set rs = New ADODB.Recordset
strsql = "select * from VIEWDZLY"
If Trim(CODE1) <> "" And Trim(CODE2) <> "" Then
strsql = strsql & " where " & CODE1 & " like '%" & CODE2 & "%'"
End If
' strsql = strsql & " where " & CODE1 & " like '%" & CODE2 & "%'"
rs.Open strsql, gCnn, adOpenStatic, adLockReadOnly
MSFLGDZ.Rows = rs.RecordCount + 1
For i = 1 To rs.RecordCount
MSFLGDZ.TextMatrix(i, 0) = rs("单证编号")
MSFLGDZ.TextMatrix(i, 1) = rs("单证名称")
MSFLGDZ.TextMatrix(i, 2) = rs("单证数量")
MSFLGDZ.TextMatrix(i, 3) = rs("领用日期")
MSFLGDZ.TextMatrix(i, 4) = rs("保险公司")
rs.MoveNext
Next
End Sub
Private Sub Form_Load()
If Me.WindowState = 0 Then Me.Move 0, 0, 9765, 6600
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim strsql As String
Dim i As Long
rs.Open "select * from VIEWDZLY", gCnn, adOpenStatic, adLockReadOnly
findbt.Clear
For i = 0 To rs.Fields.count - 1
findbt.AddItem rs.Fields(i).name
Next
findbt.Text = "ID"
If rs.State = 1 Then rs.Close
rs.Open "select * from dzly", gCnn, adOpenStatic, adLockReadOnly
MSFLGDZ.Rows = rs.RecordCount + 1
For i = 1 To rs.RecordCount
MSFLGDZ.TextMatrix(i, 0) = rs("dzbh")
MSFLGDZ.TextMatrix(i, 1) = rs("dzmc")
MSFLGDZ.TextMatrix(i, 2) = rs("lysl")
MSFLGDZ.TextMatrix(i, 3) = rs("lyrq")
MSFLGDZ.TextMatrix(i, 4) = rs("bxgs")
rs.MoveNext
Next
If rs.State = 1 Then rs.Close
strsql = "select * from BXGS"
rs.Open strsql, gCnn, adOpenStatic, adLockReadOnly
For i = 0 To rs.RecordCount - 1
BXGS.AddItem rs("MC")
BXGS.ItemData(i) = rs("id")
rs.MoveNext
Next
LYRQ = Date
Command2.Enabled = False
End Sub
Private Sub MSFLGDZ_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from dzly where dzbh='" & Trim(MSFLGDZ.TextMatrix(MSFLGDZ.Row, 0)) & "'", gCnn, adOpenStatic, adLockReadOnly
If Not rs.EOF Then
DZBH = rs("dzbh")
DZMC = rs("dzmc")
LYSL = rs("lysl")
LYRQ = rs("lyrq")
BXGS = rs("bxgs")
End If
Command2.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -