?? frmgetout.frm
字號:
VERSION 5.00
Begin VB.Form FrmGetOut
BorderStyle = 3 'Fixed Dialog
Caption = "商品出庫"
ClientHeight = 4380
ClientLeft = 45
ClientTop = 330
ClientWidth = 5295
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4380
ScaleWidth = 5295
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 3000
TabIndex = 12
Top = 3600
Width = 975
End
Begin VB.CommandButton Command1
Caption = "商品出庫"
Height = 375
Left = 1440
TabIndex = 11
Top = 3600
Width = 1095
End
Begin VB.Frame Frame1
Caption = "商品出庫"
Height = 3375
Left = 0
TabIndex = 0
Top = 0
Width = 5175
Begin VB.ComboBox CB_GoodClass
Height = 300
Left = 1680
TabIndex = 5
Top = 480
Width = 2175
End
Begin VB.ComboBox CB_GoodName
Height = 300
Left = 1680
TabIndex = 4
Top = 1080
Width = 2175
End
Begin VB.TextBox txtAmount
Height = 270
Left = 1680
TabIndex = 3
Top = 1680
Width = 1335
End
Begin VB.TextBox txtReason
Height = 375
Left = 1680
TabIndex = 2
Top = 2160
Width = 2295
End
Begin VB.TextBox txtPerson
Height = 270
Left = 1680
TabIndex = 1
Top = 2760
Width = 1815
End
Begin VB.Label Label1
Caption = "請選擇商品類別:"
Height = 375
Left = 120
TabIndex = 10
Top = 480
Width = 1575
End
Begin VB.Label Label2
Caption = "請選擇商品:"
Height = 255
Left = 480
TabIndex = 9
Top = 1080
Width = 1335
End
Begin VB.Label Label3
Caption = "出庫數(shù)量:"
Height = 375
Left = 480
TabIndex = 8
Top = 1680
Width = 975
End
Begin VB.Label Label4
Caption = "出庫原因:"
Height = 255
Left = 480
TabIndex = 7
Top = 2280
Width = 975
End
Begin VB.Label Label5
Caption = "經(jīng)手人:"
Height = 495
Left = 480
TabIndex = 6
Top = 2760
Width = 1095
End
End
End
Attribute VB_Name = "FrmGetOut"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
'Download by http://www.codefans.net
Attribute VB_Exposed = False
Private Sub CB_GoodClass_Click()
Dim goodClassId As Integer
Dim sql As String
Dim goodNameRs As ADODB.Recordset
Dim itemCount As Integer
goodClassId = getClassIdByName(Me.CB_GoodClass.Text)
sql = "select goodName from goodInfo where goodClassId = " & goodClassId
Set goodNameRs = cn.Execute(sql) '查詢該類別下的所有商品名稱
itemCount = Me.CB_GoodName.ListCount - 1
While itemCount >= 0
Me.CB_GoodName.RemoveItem itemCount
itemCount = itemCount - 1
Wend
While Not goodNameRs.EOF '
Me.CB_GoodName.AddItem goodNameRs("goodName")
goodNameRs.MoveNext
Wend
End Sub
Private Sub Command1_Click()
Dim sql As String
Dim stock As Integer '保存某個商品的庫存
Dim stockRs As ADODB.Recordset
If Me.CB_GoodClass.Text = "" Then
MsgBox "請選擇商品類別信息", vbOKOnly
Exit Sub
End If
If Me.CB_GoodName.Text = "" Then
MsgBox "請選擇商品名稱", vbOKOnly
Exit Sub
End If
If Me.txtAmount.Text = "" Then
MsgBox "請輸入入庫數(shù)量"
Exit Sub
End If
If Me.txtReason.Text = "" Then
MsgBox "請輸入入庫原因信息!"
Exit Sub
End If
If Me.txtPerson.Text = "" Then
MsgBox "請輸入經(jīng)手人信息!"
Exit Sub
End If
sql = "select stock from goodInfo where goodName = '" & Me.CB_GoodName.Text & "'"
Call check_condatabase
Set stockRs = cn.Execute(sql)
stock = CInt(stockRs("stock")) '取得該商品的庫存量
If stock < CInt(Me.txtAmount.Text) Then
MsgBox "對不起,你輸入的出庫數(shù)量超過了該商品的庫存!"
Exit Sub
End If
sql = "update goodInfo set stock = stock - " & CInt(Me.txtAmount.Text) & " where goodName = '" & Me.CB_GoodName.Text & "'"
cn.Execute (sql) '首先減少該商品的庫存量
sql = "insert into getOutInfo(goodName,goodClassName,goodAmount,outTime,reason,person,operator) values ('"
sql = sql & Me.CB_GoodName.Text & "','"
sql = sql & Me.CB_GoodClass.Text & "',"
sql = sql & CInt(Me.txtAmount.Text) & ",'"
sql = sql & Year(Date) & "-" & Month(Date) & "-" & Day(Date) & "','"
sql = sql & Me.txtReason.Text & "','"
sql = sql & Me.txtPerson.Text & "','"
sql = sql & username & "')"
cn.Execute (sql) '將出庫信息記錄到系統(tǒng)中
MsgBox "商品出庫成功!"
Me.txtAmount.Text = ""
Me.txtReason.Text = ""
Me.txtPerson.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim goodClassRs As ADODB.Recordset
Dim sql As String
Call check_condatabase
sql = "select goodClassName from goodClass"
Set goodClassRs = cn.Execute(sql)
While Not goodClassRs.EOF
Me.CB_GoodClass.AddItem goodClassRs("goodClassName")
goodClassRs.MoveNext
Wend
End Sub
Private Sub txtAmount_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Me.txtReason.SetFocus
End If
End Sub
Private Sub txtPerson_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Command1_Click
End If
End Sub
Private Sub txtReason_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Me.txtPerson.SetFocus
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -