?? 貨物出庫.frm
字號:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form 貨物出庫
BorderStyle = 1 'Fixed Single
Caption = "貨物出庫"
ClientHeight = 5355
ClientLeft = 45
ClientTop = 435
ClientWidth = 7815
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5355
ScaleWidth = 7815
StartUpPosition = 2 '屏幕中心
Visible = 0 'False
Begin VB.TextBox txt7
Height = 375
Left = 3240
TabIndex = 19
Text = "Text1"
Top = 3360
Visible = 0 'False
Width = 1215
End
Begin VB.TextBox txt1
Height = 375
Left = 1440
TabIndex = 8
Top = 1320
Width = 1455
End
Begin VB.TextBox txt2
Height = 375
Left = 1455
TabIndex = 7
Top = 2820
Width = 1455
End
Begin VB.TextBox txt3
Height = 375
Left = 1455
TabIndex = 6
Top = 3660
Width = 1455
End
Begin VB.TextBox txt4
Height = 1335
Left = 5280
TabIndex = 5
Top = 2760
Width = 1815
End
Begin VB.CommandButton cmdAdd
Caption = "確定出庫"
Default = -1 'True
Height = 330
Left = 1200
TabIndex = 4
Top = 4440
Width = 1530
End
Begin VB.CommandButton cmdExit
Caption = "退 出"
Height = 330
Left = 5760
TabIndex = 3
Top = 4440
Width = 1530
End
Begin VB.CommandButton cmdFresh
Caption = "刷 新"
Height = 330
Left = 3480
TabIndex = 2
Top = 4440
Width = 1530
End
Begin VB.TextBox txt5
Height = 375
Left = 5280
TabIndex = 1
Top = 1320
Width = 1695
End
Begin VB.TextBox txt6
Height = 375
Left = 1440
TabIndex = 0
Top = 2040
Width = 1455
End
Begin MSComCtl2.DTPicker DT_RegeditDate
Height = 330
Left = 5280
TabIndex = 9
Top = 2040
Width = 1785
_ExtentX = 3149
_ExtentY = 582
_Version = 393216
CustomFormat = "yyy-MM-dd"
Format = 21364736
CurrentDate = 37111
End
Begin VB.Label Label23
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "貨物出庫"
BeginProperty Font
Name = "宋體"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000E&
Height = 495
Left = 2160
TabIndex = 18
Top = 240
Width = 3255
End
Begin VB.Label lblNowDate
Caption = "今天日期:"
BeginProperty DataFormat
Type = 0
Format = "gg yyyy""斥"" M""巋"" d""老"""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 4680
TabIndex = 17
Top = 840
Width = 2415
End
Begin VB.Label Label9
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "貨物名稱:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 16
Top = 1440
Width = 1455
End
Begin VB.Label Label8
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "倉管員:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 15
Top = 2880
Width = 1455
End
Begin VB.Label Label12
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "出庫數量:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 14
Top = 3720
Width = 1455
End
Begin VB.Label Label_Type
Alignment = 1 'Right Justify
BackColor = &H80000013&
BackStyle = 0 'Transparent
Caption = "出庫人:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 13
Top = 2040
Width = 1455
End
Begin VB.Label Label1
Caption = "備 注:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4320
TabIndex = 12
Top = 2880
Width = 855
End
Begin VB.Label Label2
Caption = "出庫時間:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4080
TabIndex = 11
Top = 2160
Width = 1335
End
Begin VB.Label Label3
Caption = "貨物編碼:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4080
TabIndex = 10
Top = 1440
Width = 1455
End
End
Attribute VB_Name = "貨物出庫"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdAdd_Click()
kucun_panduan
End Sub
Private Sub cmdAddType_Click()
frmType.Show
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Initial_Add()
Dim Rst As New ADODB.Recordset
Me.txt1.Text = ""
Me.txt2.Text = ""
Me.txt3.Text = ""
Me.txt5.Text = ""
Me.txt4.Text = ""
Me.txt6.Text = ""
Me.lblNowDate.Caption = "今天日期: " & Format(Date, "yyyy年m月d日")
Me.DT_RegeditDate.Value = Date
End Sub
Private Sub cmdFresh_Click()
Initial_Add
End Sub
Private Sub Form_Load()
On Error GoTo ErrorExit
Me.cmdAdd.Default = True
Initial_Add
Exit Sub
End
ErrorExit:
MsgBox Err.Description, vbCritical, Me.Caption
End Sub
Private Function SuppInfo_Add() As Boolean
Dim Rst As New ADODB.Recordset
Dim strSQL As String
Dim intRst As Integer
SuppInfo_Add = False
If CheckFaceIsOk = False Then
Exit Function
End If
strSQL = "SELECT * FROM 出庫 where 編號 =" & Me.txt5.Text & ""
Rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
Rst.AddNew
Rst.Fields("名稱").Value = Me.txt1.Text
Rst.Fields("出庫時間").Value = Me.DT_RegeditDate.Value
Rst.Fields("倉管員").Value = Me.txt2.Text
Rst.Fields("出庫數量").Value = Me.txt3.Text
Rst.Fields("編號").Value = Me.txt5.Text
Rst.Fields("出庫人").Value = Me.txt6.Text
If Me.txt4.Text = "" Then
Rst.Fields("備注").Value = "無"
Else
Rst.Fields("備注").Value = Me.txt4.Text
End If
Rst.Update
MsgBox "新的貨物出庫信息添加成功!", vbInformation, "操作成功-"
Set Rst = Nothing
kucun_Add
SuppInfo_Add = False
Exit Function
End Function
Private Function CheckFaceIsOk() As Boolean
Dim intText As Integer
Dim strText As String
CheckFaceIsOk = True
If Me.txt1 = "" Then
MsgBox "貨物名稱不能為空!", vbCritical, Me.Caption
Me.txt1.SetFocus
CheckFaceIsOk = False
Exit Function
End If
If Me.txt5 = "" Then
MsgBox "貨物編號不能為空!", vbCritical, Me.Caption
Me.txt5.SetFocus
CheckFaceIsOk = False
Exit Function
End If
If Me.txt2 = "" Then
MsgBox "倉管員不能為空!", vbCritical, Me.Caption
Me.txt2.SetFocus
CheckFaceIsOk = False
Exit Function
End If
If Me.txt3 = "" Then
MsgBox "出庫數量不能為空!", vbCritical, Me.Caption
Me.txt3.SetFocus
CheckFaceIsOk = False
Exit Function
End If
If Me.txt6.Text = "" Then
MsgBox "出庫人不能為空!", vbCritical, Me.Caption
Me.txt6.SetFocus
CheckFaceIsOk = False
Exit Function
End If
For intText = 1 To Len(Me.txt5.Text)
strText = Asc(Mid(Me.txt5.Text, intText, 1))
If strText < 48 Or strText > 57 Then
MsgBox "請用數字填寫貨物編號!", vbCritical, Me.Caption
Me.txt5.Text = ""
Me.txt5.SetFocus
CheckFaceIsOk = False
Exit Function
End If
Next
For intText = 1 To Len(Me.txt3.Text)
strText = Asc(Mid(Me.txt3.Text, intText, 1))
If strText < 48 Or strText > 57 Then
MsgBox "請用數字填寫出庫數量!", vbCritical, Me.Caption
Me.txt3.Text = ""
Me.txt3.SetFocus
CheckFaceIsOk = False
Exit Function
End If
Next
End Function
Private Function kucun_Add() As Boolean
Dim Rst As New ADODB.Recordset
Dim strCheck As String
Dim strSQL As String
Dim strItem As String
kucun_Add = False
If CheckFaceIsOk = False Then
Exit Function
End If
If Me.txt1.Text <> "" Then
strCheck = " 名稱 LIKE '" & Me.txt1.Text & "'"
If Me.txt5.Text <> "" Then
strCheck = " 編號 LIKE '" & Me.txt5.Text & "'"
End If
End If
strSQL = "select * from 庫存"
If strCheck <> "" Then
strSQL = strSQL & " where " & strCheck
End If
Rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
Me.txt7.Text = Rst.Fields("庫存總量").Value
Me.txt7.Text = Val(Me.txt7.Text) - Val(Me.txt3.Text)
Rst.Fields("庫存總量").Value = Me.txt7.Text
Rst.Update
Set Rst = Nothing
Initial_Add
kucun_Add = False
Exit Function
End Function
Private Function kucun_panduan() As Boolean
Dim Rst As New ADODB.Recordset
Dim strCheck As String
Dim strSQL As String
Dim strItem As String
kucun_panduan = False
If CheckFaceIsOk = False Then
Exit Function
End If
If Me.txt1.Text <> "" Then
strCheck = " 名稱 LIKE '" & Me.txt1.Text & "'"
If Me.txt5.Text <> "" Then
strCheck = " 編號 LIKE '" & Me.txt5.Text & "'"
End If
End If
strSQL = "select * from 庫存"
If strCheck <> "" Then
strSQL = strSQL & " where " & strCheck
End If
Rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
If Rst.RecordCount = 0 Then
MsgBox "無庫存!", vbCritical, Me.Caption
Exit Function
Else
Me.txt7.Text = Rst.Fields("庫存總量").Value
If Val(Me.txt7.Text) < Val(Me.txt3.Text) Then
MsgBox "庫存不足!", vbCritical, Me.Caption
Me.txt3.Text = ""
Me.txt3.SetFocus
Else
Set Rst = Nothing
SuppInfo_Add
End If
End If
Set Rst = Nothing
kucun_panduan = False
Exit Function
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -