📄 frmck.frm
字号:
VERSION 5.00
Begin VB.Form frmCK
BorderStyle = 0 'None
Caption = " 登 录"
ClientHeight = 5145
ClientLeft = 2790
ClientTop = 3150
ClientWidth = 3720
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 343
ScaleMode = 3 'Pixel
ScaleWidth = 248
ShowInTaskbar = 0 'False
Begin VB.TextBox Text1
ForeColor = &H80000006&
Height = 270
Left = 1440
TabIndex = 5
Top = 2872
Width = 1815
End
Begin VB.ComboBox Cmb1
Height = 300
Left = 1320
TabIndex = 4
Top = 540
Width = 2295
End
Begin VB.ComboBox Cmb2
Height = 300
Left = 1320
TabIndex = 3
Top = 1020
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "办理出库"
Height = 495
Left = 360
TabIndex = 2
Top = 4440
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 495
Left = 2040
TabIndex = 1
Top = 4440
Width = 1095
End
Begin VB.TextBox Text2
ForeColor = &H80000006&
Height = 735
Left = 1440
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 3360
Width = 1815
End
Begin VB.Image imgTitleLeft
Height = 450
Left = 8520
Picture = "frmCK.frx":0000
Top = 0
Width = 285
End
Begin VB.Image imgTitleRight
Height = 450
Left = 8880
Picture = "frmCK.frx":074A
Top = 0
Width = 285
End
Begin VB.Image imgWindowBottomLeft
Height = 450
Left = 9240
Picture = "frmCK.frx":0E94
Top = 0
Width = 285
End
Begin VB.Image imgWindowBottom
Height = 450
Left = 8880
Picture = "frmCK.frx":15DE
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowLeft
Height = 450
Left = 9240
Picture = "frmCK.frx":1D28
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowRight
Height = 450
Left = 9600
Picture = "frmCK.frx":2472
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Image imgWindowBottomRight
Height = 450
Left = 9600
Picture = "frmCK.frx":2BBC
Top = 0
Width = 285
End
Begin VB.Image imgTitleMain
Height = 450
Left = 8520
Picture = "frmCK.frx":3306
Stretch = -1 'True
Top = 480
Width = 285
End
Begin VB.Label lblTitle
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出库"
BeginProperty Font
Name = "Arial"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 240
Left = 9480
TabIndex = 18
Top = 1080
Width = 420
End
Begin VB.Image imgTitleClose
Height = 195
Left = 9960
Picture = "frmCK.frx":3A50
Top = 360
Width = 195
End
Begin VB.Image imgTitleMinimize
Height = 195
Left = 9960
Picture = "frmCK.frx":3C9A
Top = 720
Width = 195
End
Begin VB.Image imgTitleHelp
Height = 195
Left = 9960
Picture = "frmCK.frx":3EE4
Top = 0
Width = 195
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "配件类型:"
ForeColor = &H00FF0000&
Height = 255
Left = 360
TabIndex = 17
Top = 600
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "配件名称:"
ForeColor = &H00FF0000&
Height = 255
Left = 360
TabIndex = 16
Top = 1080
Width = 735
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "目前库存量"
ForeColor = &H00FF0000&
Height = 180
Left = 1740
TabIndex = 15
Top = 1920
Width = 900
End
Begin VB.Label LabNum
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 180
Left = 2880
TabIndex = 14
Top = 1920
Width = 105
End
Begin VB.Line Line1
BorderColor = &H00FFC0C0&
BorderWidth = 3
X1 = 0
X2 = 248
Y1 = 152
Y2 = 152
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出库数量"
ForeColor = &H00FF0000&
Height = 180
Left = 480
TabIndex = 13
Top = 2880
Width = 720
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "单 价"
ForeColor = &H00FF0000&
Height = 255
Left = 360
TabIndex = 12
Top = 1920
Width = 615
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "规格型号"
ForeColor = &H00FF0000&
Height = 255
Left = 360
TabIndex = 11
Top = 1620
Width = 855
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "出库物资详细资料"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 255
Left = 840
TabIndex = 10
Top = 2400
Width = 1695
End
Begin VB.Label LabModel
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 180
Left = 1320
TabIndex = 9
Top = 1650
Width = 90
End
Begin VB.Label LabDW
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 180
Left = 3240
TabIndex = 8
Top = 1920
Width = 90
End
Begin VB.Label LabDJ
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 180
Left = 1320
TabIndex = 7
Top = 1920
Width = 330
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备 注"
ForeColor = &H00FF0000&
Height = 180
Left = 600
TabIndex = 6
Top = 3600
Width = 450
End
End
Attribute VB_Name = "frmCK"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim TotolNums As Integer
Private Sub Cmb1_Click()
Set_Init1
End Sub
Private Sub Cmb2_Click()
If Cmb1.Text = "" Then
MsgBox "请先选择类别!"
Exit Sub
End If
Set_Init2
End Sub
Private Sub Command1_Click()
If Val(Text1.Text) <= 0 Or Text1.Text = "" Then
MsgBox "请输出出库数量!"
Exit Sub
End If
If Cmb2.Text = "" Then
MsgBox "请选择出库配件名称!"
Exit Sub
End If
Dim a As Integer
a = MsgBox("********你确定此操作吗?**********" & vbCrLf _
& "材料名称:" & Cmb2.Text & vbCrLf _
& "原库存量:" & LabNum.Caption & LabDW.Caption & vbCrLf _
& "本次出库:" & Text1.Text & LabDW.Caption & " 单价:" & LabDJ.Caption & "元" & vbCrLf _
, vbExclamation + vbOKCancel + vbApplicationModal, "提示")
If a = 1 Then
sSql = "SELECT * FROM 配件库存表 where 配件名称 = '" & CStr(Cmb2.Text) & "'"
Rs.Open sSql, db, adOpenKeyset, adLockOptimistic, adCmdText
TotolNums = Rs.Fields("数量") - Val(Text1.Text)
If TotolNums < 0 Then
MsgBox "出库数量不对,超过库存量!"
Rs.Close
Exit Sub
Else
Rs!数量 = TotolNums
Rs.Update
Rs.Close
End If
sSql = "SELECT * FROM 出库物资"
Rs.Open sSql, db, adOpenKeyset, adLockOptimistic, adCmdText
Rs.AddNew
Rs!出库单号 = Bill
Rs!配件名称 = Cmb2.Text
Rs!规格型号 = LabModel.Caption
Rs!单位 = LabDW.Caption
Rs!数量 = Text1.Text
Rs!单价 = LabDJ.Caption
Rs!金额 = Val(Text1.Text) * Val(LabDJ.Caption)
If Text2.Text = "" Then Rs!备注 = "-" Else Rs!备注 = Text2.Text
Rs.Update
Rs.Close
MsgBox "入库成功!"
FrmCKList.Show
Unload Me
End If
If a = 2 Then Exit Sub
End Sub
Private Sub Command2_Click()
FrmCKList.Show
Unload Me
End Sub
Private Sub Form_Load()
MakeWindow Me
' AlwaysOnTop Me, True
Me.Top = MDIFrmMain.Height / 2 - Me.Height / 2 - 1000
Me.Left = MDIFrmMain.Width / 2 - Me.Width / 2
Set Rs = New Recordset
Set_Init
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim MyStr As String
MyStr = "临沂长安物贸库存管理由天海星天海工作室开发"
MDIFrmMain.MovingText1.MsgChar = MyStr
End Sub
Private Sub imgTitleClose_Click()
Unload Me
End Sub
Private Sub imgTitleLeft_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMain_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub imgTitleMinimize_Click()
Me.WindowState = 1
End Sub
Private Sub imgTitleRight_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub lblTitle_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
DoDrag Me
End Sub
Private Sub Set_Init()
Dim i As Integer
On Error GoTo DataErr
sSql = "SELECT 分类 FROM 配件分类表"
Rs.Open sSql, db, adOpenKeyset, adLockOptimistic, adCmdText
Cmb1.Clear
Do While Not Rs.EOF
Cmb1.AddItem Rs.Fields(0)
Rs.MoveNext
Loop
Rs.Close
Exit Sub
DataErr:
MsgBox Err.Description
End Sub
Private Sub Set_Init1()
Dim i As Integer
On Error GoTo DataErr
sSql = "SELECT ID, 配件名称,规格型号,分类,单位,单价,数量 FROM 配件库存表 WHERE 分类 = '" & CStr(Cmb1.Text) & "'"
Rs.Open sSql, db, adOpenKeyset, adLockOptimistic, adCmdText
Cmb2.Clear
Do While Not Rs.EOF
Cmb2.AddItem Rs.Fields("配件名称")
Rs.MoveNext
Loop
Rs.Close
Exit Sub
DataErr:
MsgBox Err.Description
End Sub
Private Sub Set_Init2()
Dim i As Integer
On Error GoTo DataErr
sSql = "SELECT ID,配件名称,规格型号,分类,单位,单价,数量 FROM 配件库存表 WHERE 配件名称 = '" & CStr(Cmb2.Text) & "'"
Rs.Open sSql, db, adOpenKeyset, adLockOptimistic, adCmdText
If Not Rs.EOF Then
LabModel = Rs.Fields("规格型号")
LabDW = Rs.Fields("单位")
LabDJ = Rs.Fields("单价")
LabNum.Caption = Rs.Fields("数量")
End If
Rs.Close
Exit Sub
DataErr:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -