?? ?
字號(hào):
VERSION 5.00
Begin VB.Form 統(tǒng)計(jì)分析
Caption = "統(tǒng)計(jì)分析"
ClientHeight = 3120
ClientLeft = 60
ClientTop = 420
ClientWidth = 4680
LinkTopic = "Form4"
ScaleHeight = 3120
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.CommandButton Command4
Caption = "返 回"
Height = 615
Left = 5280
TabIndex = 9
Top = 7560
Width = 1575
End
Begin VB.TextBox 經(jīng)手人
Height = 495
Left = 3960
TabIndex = 8
Top = 3960
Width = 2655
End
Begin VB.TextBox 圖書(shū)名稱(chēng)
Height = 495
Left = 3960
TabIndex = 5
Top = 3120
Width = 2655
End
Begin VB.TextBox 結(jié)果
Height = 735
Left = 5400
MultiLine = -1 'True
TabIndex = 3
Top = 5280
Width = 2175
End
Begin VB.CommandButton Command3
Caption = "利潤(rùn)分析"
Height = 615
Left = 9120
TabIndex = 2
Top = 3000
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "銷(xiāo)售信息查詢(xún)"
Height = 615
Left = 7440
TabIndex = 1
Top = 3960
Width = 2775
End
Begin VB.CommandButton Command1
Caption = "圖書(shū)庫(kù)存查詢(xún)"
Height = 615
Left = 7200
TabIndex = 0
Top = 3000
Width = 1335
End
Begin VB.Label Label3
Caption = "經(jīng)手人信息:"
Height = 255
Left = 2640
TabIndex = 7
Top = 4080
Width = 1095
End
Begin VB.Label Label2
Caption = "在此輸入圖書(shū)名稱(chēng):"
Height = 255
Left = 2280
TabIndex = 6
Top = 3240
Width = 1575
End
Begin VB.Label Label1
Caption = "查詢(xún)結(jié)果顯示:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3720
TabIndex = 4
Top = 5520
Width = 1455
End
End
Attribute VB_Name = "統(tǒng)計(jì)分析"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strsql As String
Dim daima As String
Dim strsql1 As String
Dim strsql2 As String
Dim strsql3 As String
Dim strsql4 As String
Private Sub Command1_Click()
On Error GoTo fileerr
Set conn = New ADODB.Connection
conn.Open "Driver={SQL Server};Server=4E42AEF0FABF4E9;database=圖書(shū)批發(fā)銷(xiāo)售管理系統(tǒng)"
Set rs = New ADODB.Recordset
strsql = "select * from 圖書(shū)信息 where 書(shū)名 = '" & Trim(圖書(shū)名稱(chēng).Text) & "'"
rs.CursorLocation = adUseClient
rs.Open strsql, conn, adOpenStatic, adLockReadOnly
daima = rs("圖書(shū)ISBN代碼")
strsql1 = "select sum(數(shù)量) from [入庫(kù)/發(fā)貨信息] where 交易類(lèi)型='出貨'and 圖書(shū)ISBN代碼='" & daima & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
strsql2 = "select sum(數(shù)量) from [入庫(kù)/發(fā)貨信息] where 交易類(lèi)型='入貨'and 圖書(shū)ISBN代碼='" & daima & "'"
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
rs1.Open strsql2, conn, adOpenStatic, adLockReadOnly
結(jié)果.Text = "這種書(shū)的庫(kù)存還有" & Int(rs1.Fields(0)) - Int(rs.Fields(0)) & "本"
Exit Sub
fileerr:
MsgBox "輸入錯(cuò)誤或數(shù)據(jù)類(lèi)型不符請(qǐng)重新輸入!"
End Sub
Private Sub Command2_Click()
On Error GoTo fileerr
Set conn = New ADODB.Connection
conn.Open "Driver={SQL Server};Server=4E42AEF0FABF4E9;database=圖書(shū)批發(fā)銷(xiāo)售管理系統(tǒng)"
Set rs = New ADODB.Recordset
strsql1 = "select count(*) from [入庫(kù)/發(fā)貨信息] where 經(jīng)手人 = '" & Trim(經(jīng)手人.Text) & "'"
rs.CursorLocation = adUseClient
rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
Set rs1 = New ADODB.Recordset
strsql2 = "select sum(金額) from [入庫(kù)/發(fā)貨信息] where 經(jīng)手人 ='" & Trim(經(jīng)手人.Text) & "'"
rs1.CursorLocation = adUseClient
rs1.Open strsql2, conn, adOpenStatic, adLockReadOnly
結(jié)果.Text = "此人共經(jīng)手" & Int(rs.Fields(0)) & "筆生意,總的交易金額為" & Int(rs1.Fields(0))
Exit Sub
fileerr:
MsgBox "輸入錯(cuò)誤或數(shù)據(jù)類(lèi)型不符請(qǐng)重新輸入!"
End Sub
Private Sub Command3_Click()
On Error GoTo fileerr
Set conn = New ADODB.Connection
conn.Open "Driver={SQL Server};Server=4E42AEF0FABF4E9;database=圖書(shū)批發(fā)銷(xiāo)售管理系統(tǒng)"
Set rs = New ADODB.Recordset
strsql = "select * from 圖書(shū)信息 where 書(shū)名 = '" & Trim(圖書(shū)名稱(chēng).Text) & "'"
rs.CursorLocation = adUseClient
rs.Open strsql, conn, adOpenStatic, adLockReadOnly
daima = rs("圖書(shū)ISBN代碼")
strsql1 = "select sum(數(shù)量) from [入庫(kù)/發(fā)貨信息] where 交易類(lèi)型='出貨'and 圖書(shū)ISBN代碼='" & daima & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
strsql3 = "select sum(金額) from [入庫(kù)/發(fā)貨信息] where 交易類(lèi)型='出貨'and 圖書(shū)ISBN代碼='" & daima & "'"
Set rs2 = New ADODB.Recordset
rs2.CursorLocation = adUseClient
rs2.Open strsql3, conn, adOpenStatic, adLockReadOnly
strsql2 = "select sum(數(shù)量) from [入庫(kù)/發(fā)貨信息] where 交易類(lèi)型='入貨'and 圖書(shū)ISBN代碼='" & daima & "'"
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
rs1.Open strsql2, conn, adOpenStatic, adLockReadOnly
strsql4 = "select count(金額) from [入庫(kù)/發(fā)貨信息] where 交易類(lèi)型='入貨'and 圖書(shū)ISBN代碼='" & daima & "'"
Set rs3 = New ADODB.Recordset
rs3.CursorLocation = adUseClient
rs3.Open strsql4, conn, adOpenStatic, adLockReadOnly
結(jié)果.Text = "這種圖書(shū)平均每本的利潤(rùn)為" & Int(rs2.Fields(0)) / Int(rs.Fields(0)) - Int(rs3.Fields(0)) / Int(rs1.Fields(0)) & "元。"
Exit Sub
fileerr:
MsgBox "輸入錯(cuò)誤或數(shù)據(jù)類(lèi)型不符請(qǐng)重新輸入!"
End Sub
Private Sub Command4_Click()
Unload Me
功能選擇.Show
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -