?? frmsellgoods.frm
字號(hào):
VERSION 5.00
Begin VB.Form frmSellgoods
BackColor = &H00FFFFFF&
BorderStyle = 3 'Fixed Dialog
Caption = "添加銷貨信息"
ClientHeight = 5955
ClientLeft = 45
ClientTop = 435
ClientWidth = 7425
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmSellgoods.frx":0000
ScaleHeight = 5955
ScaleWidth = 7425
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text15
Height = 375
Left = 3720
TabIndex = 31
Top = 4440
Width = 735
End
Begin VB.TextBox Text14
Height = 375
Left = 2640
TabIndex = 29
Top = 4440
Width = 735
End
Begin VB.TextBox Text13
Height = 375
Left = 1560
TabIndex = 27
Top = 4440
Width = 735
End
Begin VB.TextBox Text12
Height = 375
Left = 1560
TabIndex = 10
Top = 3840
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "清空重添"
Height = 495
Left = 4320
TabIndex = 5
Top = 5040
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "銷售"
Height = 495
Left = 1920
TabIndex = 4
Top = 5040
Width = 1215
End
Begin VB.TextBox Text11
Height = 375
Left = 5040
TabIndex = 3
Top = 3240
Width = 2055
End
Begin VB.TextBox Text10
Height = 375
Left = 1560
TabIndex = 25
Top = 3240
Width = 1815
End
Begin VB.TextBox Text9
Height = 375
Left = 3720
TabIndex = 24
Top = 2520
Width = 735
End
Begin VB.TextBox Text8
Height = 375
Left = 2640
TabIndex = 23
Top = 2520
Width = 735
End
Begin VB.TextBox Text7
Height = 375
Left = 1560
TabIndex = 22
Top = 2520
Width = 735
End
Begin VB.TextBox Text6
Height = 375
Left = 5160
TabIndex = 8
Top = 1800
Width = 1815
End
Begin VB.TextBox Text5
Height = 375
Left = 1560
TabIndex = 6
Top = 1800
Width = 1815
End
Begin VB.TextBox Text4
Height = 375
Left = 5160
TabIndex = 7
Top = 1080
Width = 1815
End
Begin VB.TextBox Text3
Height = 375
Left = 1560
TabIndex = 0
Top = 1080
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
Left = 5160
TabIndex = 2
Top = 360
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 1
Top = 360
Width = 1815
End
Begin VB.Label Label17
BackStyle = 0 'Transparent
Caption = "銷售時(shí)間:"
Height = 255
Left = 480
TabIndex = 33
Top = 4560
Width = 975
End
Begin VB.Label Label16
BackStyle = 0 'Transparent
Caption = "秒"
Height = 255
Left = 4560
TabIndex = 32
Top = 4560
Width = 255
End
Begin VB.Label Label15
BackStyle = 0 'Transparent
Caption = "分"
Height = 255
Left = 3480
TabIndex = 30
Top = 4560
Width = 255
End
Begin VB.Label Label14
BackStyle = 0 'Transparent
Caption = "時(shí)"
Height = 255
Left = 2400
TabIndex = 28
Top = 4560
Width = 255
End
Begin VB.Label Label13
BackStyle = 0 'Transparent
Caption = "數(shù)量:"
Height = 255
Left = 4200
TabIndex = 26
Top = 3360
Width = 975
End
Begin VB.Label Label12
BackStyle = 0 'Transparent
Caption = "總金額:"
Height = 255
Left = 480
TabIndex = 21
Top = 3960
Width = 855
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Caption = "業(yè)務(wù)員編號(hào):"
Height = 255
Left = 480
TabIndex = 20
Top = 3360
Width = 1215
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "日"
Height = 255
Left = 4560
TabIndex = 19
Top = 2640
Width = 255
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "月"
Height = 255
Left = 3480
TabIndex = 18
Top = 2640
Width = 255
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "年"
Height = 375
Left = 2400
TabIndex = 17
Top = 2640
Width = 255
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "銷售日期"
Height = 495
Left = 480
TabIndex = 16
Top = 2640
Width = 1215
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "單價(jià):"
Height = 495
Left = 4080
TabIndex = 15
Top = 1920
Width = 1215
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "型號(hào):"
Height = 255
Left = 480
TabIndex = 14
Top = 1920
Width = 735
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "生產(chǎn)廠商:"
Height = 495
Left = 4080
TabIndex = 13
Top = 1200
Width = 1215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "商品名稱:"
Height = 255
Left = 480
TabIndex = 12
Top = 1200
Width = 975
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "商品編號(hào):"
Height = 495
Left = 4080
TabIndex = 11
Top = 480
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "銷貨編號(hào):"
Height = 255
Left = 480
TabIndex = 9
Top = 480
Width = 975
End
End
Attribute VB_Name = "frmSellgoods"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_goods As New ADODB.Recordset
Dim rs_sell As New ADODB.Recordset
Dim str_goods As String
Dim str_sell As String
Dim numgoods As Integer
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "請(qǐng)?zhí)顚戜N貨編號(hào)!", vbOKOnly + vbInformation, "注意"
Text1.SetFocus
Exit Sub
ElseIf Text2.Text = "" Then
MsgBox "請(qǐng)?zhí)顚懮唐肪幪?hào)!", vbOKOnly + vbInformation, "注意"
Text2.SetFocus
Exit Sub
End If
str_goods = "select * from goods where 商品編號(hào)='" & Text2.Text & "'"
rs_goods.Open str_goods, cnn, adOpenStatic, adLockOptimistic
If rs_goods.EOF = True Then
MsgBox "對(duì)不起,此商品型號(hào)已無(wú)貨!請(qǐng)選擇其他型!", vbOKOnly + vbInformation, "注意"
rs_goods.Close
Exit Sub
End If
rs_goods.Close
If Text11.Text = "" Then
MsgBox "請(qǐng)?zhí)顚戜N貨數(shù)量!", vbOKOnly + vbInformation, "注意"
Text11.SetFocus
Exit Sub
End If
Text12.Text = Val(Text6.Text) * Val(Text11.Text)
'下面是對(duì)銷售表進(jìn)行入庫(kù)操作!
str_sell = "select * from sell where 銷貨編號(hào)='" & Text1.Text & "'"
rs_sell.Open str_sell, cnn, adOpenStatic, adLockOptimistic
If rs_sell.EOF = True Then
rs_sell.AddNew
rs_sell.Fields("銷貨編號(hào)") = Text1.Text
rs_sell.Fields("商品編號(hào)") = Text2.Text
rs_sell.Fields("商品名稱") = Text3.Text
rs_sell.Fields("生產(chǎn)廠商") = Text4.Text
rs_sell.Fields("型號(hào)") = Text5.Text
rs_sell.Fields("單價(jià)") = Text6.Text
rs_sell.Fields("銷售年") = Text7.Text
rs_sell.Fields("銷售月") = Text8.Text
rs_sell.Fields("銷售日") = Text9.Text
rs_sell.Fields("業(yè)務(wù)員編號(hào)") = Text10.Text
rs_sell.Fields("數(shù)量") = Val(Text11.Text)
rs_sell.Fields("總金額") = Val(Text12.Text)
rs_sell.Fields("銷售時(shí)") = Text13.Text
rs_sell.Fields("銷售分") = Text14.Text
rs_sell.Fields("銷售秒") = Text15.Text
rs_sell.Update
rs_sell.Close
Else
MsgBox "此銷貨編號(hào)已存在,請(qǐng)重添!", vbOKOnly + vbInformation, "注意"
Text1.Text = ""
Text1.SetFocus
rs_sell.Close
Exit Sub
End If
'下面是對(duì)商品庫(kù)存表的減貨操作!
str_goods = "select * from goods where 商品編號(hào)='" & Text2.Text & "'"
rs_goods.Open str_goods, cnn, adOpenStatic, adLockOptimistic
numgoods = rs_goods.Fields("數(shù)量")
rs_goods.Fields("數(shù)量") = numgoods - Val(Text11.Text)
rs_goods.Update
rs_goods.Close
MsgBox "銷售成功!", vbOKOnly + vbExclamation, "注意"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
End Sub
Private Sub Form_Load()
Text7.Text = Year(Date)
Text8.Text = Month(Date)
Text9.Text = Day(Date)
Text10.Text = strs
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
Text15.Enabled = False
End Sub
Private Sub Text11_Change()
If Text6.Text <> "" Then
Text12.Text = Val(Text6.Text) * Val(Text11.Text)
End If
End Sub
Private Sub Text12_Change()
Text13.Text = Val(Hour(Time))
Text14.Text = Val(Minute(Time))
Text15.Text = Val(Second(Time))
End Sub
Private Sub Text2_Change()
str_goods = "select * from goods where 商品編號(hào)='" & Text2.Text & "'"
rs_goods.Open str_goods, cnn, adOpenStatic, adLockOptimistic
Text3.Text = rs_goods.Fields("商品名稱")
Text4.Text = rs_goods.Fields("生產(chǎn)廠商")
Text5.Text = rs_goods.Fields("型號(hào)")
Text6.Text = rs_goods.Fields("銷貨價(jià)")
rs_goods.Close
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -