📄 frm_dt_xh.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frm_dt_xh
Caption = "地图销毁管理"
ClientHeight = 2475
ClientLeft = 60
ClientTop = 345
ClientWidth = 5895
Icon = "frm_dt_xh.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2475
ScaleWidth = 5895
StartUpPosition = 1 '所有者中心
Begin VB.ComboBox Combo5
Height = 300
Left = 45
Style = 2 'Dropdown List
TabIndex = 17
Top = 2115
Visible = 0 'False
Width = 1185
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1215
Style = 2 'Dropdown List
TabIndex = 13
Top = 2115
Visible = 0 'False
Width = 1230
End
Begin VB.CommandButton Command2
Caption = "关闭(&C)"
Height = 375
Left = 4620
TabIndex = 4
Top = 2025
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定(&E)"
Height = 375
Left = 3240
TabIndex = 3
Top = 2025
Width = 1215
End
Begin VB.Frame Frame1
Caption = "地图销毁"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1860
Left = 135
TabIndex = 0
Top = 45
Width = 5655
Begin VB.ComboBox Combo4
Height = 300
Left = 2880
Style = 2 'Dropdown List
TabIndex = 15
Top = 1290
Width = 810
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
Height = 300
ItemData = "frm_dt_xh.frx":1272
Left = 1035
List = "frm_dt_xh.frx":1274
Style = 2 'Dropdown List
TabIndex = 12
Top = 360
Width = 4425
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 270
Index = 0
Left = 1035
MaxLength = 5
TabIndex = 8
Top = 1305
Width = 810
End
Begin VB.ComboBox Combo2
Appearance = 0 'Flat
Height = 300
Left = 1035
Locked = -1 'True
Style = 1 'Simple Combo
TabIndex = 1
Text = "Combo2"
Top = 825
Width = 1320
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 270
Index = 2
Left = 4635
Locked = -1 'True
TabIndex = 2
Top = 1305
Width = 810
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 315
Left = 3825
TabIndex = 9
Top = 795
Width = 1635
_ExtentX = 2884
_ExtentY = 556
_Version = 393216
Format = 24510464
CurrentDate = 37630
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "最大数为:"
ForeColor = &H000000C0&
Height = 180
Left = 180
TabIndex = 16
Top = 1620
Width = 810
End
Begin VB.Label label1
AutoSize = -1 'True
Caption = "销毁方式:"
Height = 180
Index = 5
Left = 2025
TabIndex = 14
Top = 1350
Width = 810
End
Begin VB.Label label1
AutoSize = -1 'True
Caption = "销毁时间:"
Height = 180
Index = 2
Left = 2970
TabIndex = 11
Top = 855
Width = 810
End
Begin VB.Label label1
AutoSize = -1 'True
Caption = "销毁数量:"
Height = 180
Index = 3
Left = 180
TabIndex = 10
Top = 1350
Width = 810
End
Begin VB.Label label1
AutoSize = -1 'True
Caption = "经 办 人:"
Height = 180
Index = 4
Left = 3780
TabIndex = 7
Top = 1350
Width = 810
End
Begin VB.Label label1
AutoSize = -1 'True
Caption = "地图规格:"
Height = 180
Index = 1
Left = 180
TabIndex = 6
Top = 885
Width = 810
End
Begin VB.Label label1
AutoSize = -1 'True
Caption = "地图名称:"
Height = 180
Index = 0
Left = 180
TabIndex = 5
Top = 420
Width = 810
End
End
End
Attribute VB_Name = "frm_dt_xh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim adoPrimaryRS As Recordset
Dim adoPrimaryRS1 As Recordset
Dim adoPrimaryRS2 As Recordset
Dim db As Connection
Private Sub Combo1_Click()
Combo2.ListIndex = Combo1.ListIndex
Combo3.ListIndex = Combo1.ListIndex
Combo5.ListIndex = Combo1.ListIndex
Label2.Caption = "最大数为: " & Combo5.Text
End Sub
Private Sub Command1_Click()
On Error GoTo err_41:
If Val(Text1(0).Text) <> 0 Then
ii = MsgBox("确认销毁数为" & Val(Text1(0).Text), vbYesNo, "提示")
If ii = vbYes Then
If Val(Text1(0).Text) > Val(Combo5.Text) Then
Text1(0).Text = Combo5.Text
MsgBox "销毁值超过库存,系统自动处理为全部库存", vbOKOnly, "提示"
End If
Set adoPrimaryRS1 = New Recordset
adoPrimaryRS1.Open "select * from s_xhjl ", db, adOpenStatic, adLockOptimistic
With adoPrimaryRS1
.AddNew
adoPrimaryRS1("地图名称") = Combo1.Text
adoPrimaryRS1("规格") = Combo2.Text
adoPrimaryRS1("销毁数") = Val(Text1(0).Text)
adoPrimaryRS1("经办人") = Text1(2).Text
adoPrimaryRS1("销毁时间") = DTPicker1.Value
adoPrimaryRS1("销毁方式") = Combo4.Text
.Update
End With
Set adoPrimaryRS2 = New Recordset
adoPrimaryRS2.Open "select 编号,销毁数,库存数 from jb where 编号='" & Combo3.Text & "'", db, adOpenStatic, adLockOptimistic
If adoPrimaryRS2.RecordCount = 1 Then
With adoPrimaryRS2
xhl = adoPrimaryRS2("销毁数") + Val(Text1(0).Text)
kcl = adoPrimaryRS2("库存数") - Val(Text1(0).Text)
adoPrimaryRS2("库存数") = kcl
adoPrimaryRS2("销毁数") = xhl
.Update
End With
End If
MsgBox "本次销毁:" & Val(Text1(0).Text) & Chr(13) & Chr(10) _
& "销毁总数:" & xhl & Chr(13) & Chr(10) _
& "库存数为:" & kcl & Chr(13) & Chr(10), vbExclamation
Unload Me
Me.Show
End If
Else
MsgBox "销毁数量不能为0", vbInformation, "重新输入"
End If
Exit Sub
err_41:
adoPrimaryRS1.CancelUpdate
adoPrimaryRS2.CancelUpdate
MsgBox Err.Description, vbExclamation
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error GoTo err_42:
Text1(2).Text = gz_user
Combo4.AddItem "化浆", 0
Combo4.AddItem "焚烧", 1
Combo4.AddItem "碎纸", 2
Combo4.ListIndex = 0
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & fullpath("mdb\mapdata.lbl")
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select m_dt.地图名称,比例尺,地图类型,m_dt.编号,库存数 from m_dt,jb where jb.编号=m_dt.编号 AND 库存数>0 order by m_dt.编号", db, adOpenStatic, adLockOptimistic
If adoPrimaryRS.RecordCount > 0 Then
With adoPrimaryRS
For i = 0 To .RecordCount - 1
Combo1.AddItem adoPrimaryRS("地图名称"), i
Combo2.AddItem adoPrimaryRS("比例尺") & adoPrimaryRS("地图类型"), i
Combo3.AddItem adoPrimaryRS("编号"), i
Combo5.AddItem adoPrimaryRS("库存数"), i
.MoveNext
Next i
Combo1.ListIndex = 0
End With
Else
MsgBox "没有地图可以销毁", vbExclamation, "提示"
Command1.Enabled = False
End If
adoPrimaryRS.Close
Exit Sub
err_42:
MsgBox Err.Description, vbExclamation
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If Index = 0 Then
strValid = "0123456789"
If KeyAscii > 26 Then
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -