?? frmshow.frm
字號:
VERSION 5.00
Begin VB.Form frmshow
Caption = "銷售"
ClientHeight = 5325
ClientLeft = 60
ClientTop = 345
ClientWidth = 7215
LinkTopic = "Form1"
ScaleHeight = 5325
ScaleWidth = 7215
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text8
Height = 375
Left = 2280
TabIndex = 17
Top = 3360
Width = 1815
End
Begin VB.TextBox Text7
Height = 375
Left = 2280
TabIndex = 15
Top = 2640
Width = 1815
End
Begin VB.TextBox Text6
Height = 375
Left = 5160
TabIndex = 12
Top = 1800
Width = 1695
End
Begin VB.TextBox Text5
Height = 375
Left = 1560
TabIndex = 11
Top = 1800
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
Locked = -1 'True
TabIndex = 5
Top = 360
Width = 1695
End
Begin VB.TextBox Text2
Height = 375
Left = 5160
Locked = -1 'True
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.TextBox Text3
Height = 375
Left = 1560
Locked = -1 'True
TabIndex = 3
Top = 1080
Width = 1695
End
Begin VB.TextBox Text4
Height = 375
Left = 5160
Locked = -1 'True
TabIndex = 2
Top = 1080
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "賣出"
Height = 495
Left = 240
TabIndex = 1
Top = 4440
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 1800
TabIndex = 0
Top = 4440
Width = 1215
End
Begin VB.Label Label8
Caption = "購 買 日 期:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 16
Top = 3360
Width = 1455
End
Begin VB.Label Label7
Caption = "顧 客 名 稱:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 14
Top = 2640
Width = 1455
End
Begin VB.Label Label6
Caption = "供 應 商 :"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 13
Top = 1080
Width = 1335
End
Begin VB.Label Label5
Caption = "賣 出 件 數:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 10
Top = 1800
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 = 255
Left = 120
TabIndex = 9
Top = 360
Width = 1455
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 = 3600
TabIndex = 8
Top = 360
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 = 375
Left = 120
TabIndex = 7
Top = 1080
Width = 1455
End
Begin VB.Label Label4
Caption = "銷 售 人 員:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 6
Top = 1800
Width = 1455
End
End
Attribute VB_Name = "frmshow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim yy As Double
Private Sub Command1_Click()
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set adoguke = New ADODB.Recordset
adoguke.Open "select * from 顧客 ", conn, adOpenStatic, adLockOptimistic
If Len(aa) > 0 Then
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set ado = New ADODB.Recordset
ado.Open "select * from 公司業務情況 where 型號和名稱='" & Trim(aa) & "'", conn, 3, 2
If Val(Text5.Text) > 0 And IsNumeric(Text5.Text) Then
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統"
Set adoch = New ADODB.Recordset
adoch.Open "select * from 用戶注冊 where 姓名='" & Trim(Text6.Text) & "'", conn, 3, 2
If adoch.RecordCount = 0 Then
HXFYN = MsgBox("對不起,您不是我部門的工作人員!", vbDefaultButton1, "信息提示")
Exit Sub
Else
HXFYN = MsgBox("是否賣出此產品!?", 36, "信息提示")
If HXFYN = vbYes Then
If ado("庫存量") < Val(Text5.Text) Then
yy = ado("庫存量")
HXFYN = MsgBox("對不起,您要產品數量不夠!您是否全買下這些產品!", vbYesNo + vbExclamation, "系統提示")
If HXFYN = vbYes Then
chen = ado("價格") * ado("庫存量")
ado("備注") = ado("備注") & Text6.Text & "于" & Str(Now) & "賣出產品" & ado("庫存量") & "件" & "金額為" & Str(chen) & "元" & " "
ado("庫存量") = 0
Else
Exit Sub
End If
Else
ado("庫存量") = ado("庫存量") - Val(Text5.Text)
chen = ado("價格") * Val(Text5.Text)
ado("備注") = ado("備注") & Text6.Text & "于" & Str(Now) & "賣出產品" & Str(Val(Text5.Text)) & "件" & "金額為" & Str(chen) & "元" & " "
End If
If Not IsDate(Text8) Then
MsgBox "請正確輸入日期!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
Text8 = Format((Text8), "yyyy-mm-dd")
End If
ado.Update
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set adoch = New ADODB.Recordset
adoch.Open "select * from 統計 where 姓名='" & Trim(Text6.Text) & "'", conn, 3, 2
adoch("業績") = adoch("業績") + chen
adoch.Update
adoguke.AddNew
adoguke.Fields("型號與名稱") = Text1.Text
adoguke.Fields("購買件數") = Text5.Text
adoguke.Fields("銷售人員") = Text6.Text
adoguke.Fields("顧客名稱") = Text7.Text
adoguke.Fields("購買日期") = Text8.Text
adoguke.Update
adoguke.Close
MsgBox "交易成功!!:)", vbDefaultButton1 + vbExclamation, "祝賀"
Unload Me
Else
MsgBox "操作未成功", vbDefaultButton1, "信息提示"
Exit Sub
End If
End If
End If
End If
If cc > 0 Then
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set ado = New ADODB.Recordset
ado.Open "select * from 公司業務情況 where 價格=" & Val(Trim(cc)), conn, 3, 2
Set adoch = New ADODB.Recordset
adoch.Open "select * from 用戶注冊 where 姓名='" & Trim(Text6.Text) & "'", conn, 3, 2
If adoch.RecordCount = 0 Then
HXFYN = MsgBox("對不起,您不是我部門的工作人員!", vbDefaultButton1 + vbExclamation, "信息提示")
Exit Sub
Else
If Len(Text6.Text) > 0 Then
HXFYN = MsgBox("是否賣出此產品!?", 36, "信息提示")
If HXFYN = vbYes Then
If ado("庫存量") < Val(Text5.Text) Then
hxf = MsgBox("對不起,您要產品數量不夠!您是否全買下這些產品?", vbYesNo + vbExclamation, "系統提示")
If hxf = vbYes Then
chen = ado("價格") * ado("庫存量")
ado("備注") = ado("備注") & Text6.Text & "于" & Str(Now) & "賣出產品" & ado("庫存量") & "件" & "金額為" & Str(chen) & "元" & " "
ado("庫存量") = 0
Else
Exit Sub
End If
Else
ado("庫存量") = ado("庫存量") - Text5.Text
chen = ado("價格") * Val(Text5.Text)
ado("備注") = ado("備注") & Text6.Text & "于" & Str(Now) & "賣出產品" & Str(Val(Text5.Text)) & "件" & "金額為" & Str(chen) & "元" & " "
End If
ado.Update
If Not IsDate(Text8) Then
MsgBox "請正確輸入日期!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
Text8 = Format((Text8), "yyyy-mm-dd")
End If
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set adoch = New ADODB.Recordset
adoch.Open "select * from 統計 where 姓名='" & Trim(Text6.Text) & "'", conn, 3, 2
adoch("業績") = adoch("業績") + chen
adoch.Update
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set adoguke = New ADODB.Recordset
adoguke.Open "select * from 顧客 ", conn, adOpenStatic, adLockOptimistic
adoguke.AddNew
adoguke.Fields("型號和名稱") = Text1.Text
adoguke.Fields("件數") = Text5.Text
adoguke.Fields("銷售人員") = Text6.Text
adoguke.Fields("顧客名稱") = Text7.Text
adoguke.Fields("購買日期") = Text8.Text
adoguke.Update
adoguke.Close
MsgBox "交易成功!!:)", vbDefaultButton1 + vbExclamation, "祝賀"
Unload Me
Else
MsgBox "操作未成功", vbDefaultButton1 + vbExclamation, "信息提示"
Exit Sub
End If
End If
End If
End If
ado.Close
adoch.Close
'Unload Me
End Sub
Private Sub Command2_Click()
'ado.Close
MsgBox "操作未成功", vbDefaultButton1 + vbExclamation, "信息提示"
Unload Me
End Sub
Private Sub Form_Load()
If Len(aa) > 0 Then
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set ado = New ADODB.Recordset
ado.Open "select * from 公司業務情況 where 型號和名稱='" & Trim(aa) & "'", conn, 3, 2
Text1.Text = ado("型號和名稱")
Text2.Text = ado("價格")
Text3.Text = ado("庫存量")
Text4.Text = ado("供應商")
End If
If cc > 0 Then
Set conn = New ADODB.Connection
conn.Open "DSN=電腦經營系統", ";pwd=14813808"
Set ado = New ADODB.Recordset
ado.Open "select * from 公司業務情況 where 價格=" & Trim(cc), conn, 3, 2
Text1.Text = ado("型號和名稱")
Text2.Text = ado("價格")
Text3.Text = ado("庫存量")
Text4.Text = ado("供應商")
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -