⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ͳ

📁 一款用VB开发基于B/S模式的图书管理系统。 适用于大学课程设计。
💻
字号:
VERSION 5.00
Begin VB.Form 统计分析 
   Caption         =   "统计分析"
   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 经手人 
      Height          =   495
      Left            =   3960
      TabIndex        =   8
      Top             =   3960
      Width           =   2655
   End
   Begin VB.TextBox 图书名称 
      Height          =   495
      Left            =   3960
      TabIndex        =   5
      Top             =   3120
      Width           =   2655
   End
   Begin VB.TextBox 结果 
      Height          =   735
      Left            =   5400
      MultiLine       =   -1  'True
      TabIndex        =   3
      Top             =   5280
      Width           =   2175
   End
   Begin VB.CommandButton Command3 
      Caption         =   "利润分析"
      Height          =   615
      Left            =   9120
      TabIndex        =   2
      Top             =   3000
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "销售信息查询"
      Height          =   615
      Left            =   7440
      TabIndex        =   1
      Top             =   3960
      Width           =   2775
   End
   Begin VB.CommandButton Command1 
      Caption         =   "图书库存查询"
      Height          =   615
      Left            =   7200
      TabIndex        =   0
      Top             =   3000
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "经手人信息:"
      Height          =   255
      Left            =   2640
      TabIndex        =   7
      Top             =   4080
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "在此输入图书名称:"
      Height          =   255
      Left            =   2280
      TabIndex        =   6
      Top             =   3240
      Width           =   1575
   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            =   3720
      TabIndex        =   4
      Top             =   5520
      Width           =   1455
   End
End
Attribute VB_Name = "统计分析"
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=图书批发销售管理系统"
 
 Set rs = New ADODB.Recordset
 strsql = "select * from 图书信息 where 书名 = '" & Trim(图书名称.Text) & "'"
 rs.CursorLocation = adUseClient
 rs.Open strsql, conn, adOpenStatic, adLockReadOnly
 daima = rs("图书ISBN代码")

 strsql1 = "select sum(数量) from [入库/发货信息] where 交易类型='出货'and 图书ISBN代码='" & daima & "'"
 Set rs = New ADODB.Recordset
 rs.CursorLocation = adUseClient
 rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
 
strsql2 = "select sum(数量) from [入库/发货信息] where 交易类型='入货'and 图书ISBN代码='" & daima & "'"
Set rs1 = New ADODB.Recordset
 rs1.CursorLocation = adUseClient
 rs1.Open strsql2, conn, adOpenStatic, adLockReadOnly
 结果.Text = "这种书的库存还有" & Int(rs1.Fields(0)) - Int(rs.Fields(0)) & "本"
Exit Sub
fileerr:
MsgBox "输入错误或数据类型不符请重新输入!"
End Sub

Private Sub Command2_Click()
 On Error GoTo fileerr
 Set conn = New ADODB.Connection
 conn.Open "Driver={SQL Server};Server=4E42AEF0FABF4E9;database=图书批发销售管理系统"
 Set rs = New ADODB.Recordset
 strsql1 = "select count(*) from [入库/发货信息] where 经手人 = '" & Trim(经手人.Text) & "'"
 rs.CursorLocation = adUseClient
 rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
 Set rs1 = New ADODB.Recordset
 strsql2 = "select sum(金额) from [入库/发货信息] where 经手人 ='" & Trim(经手人.Text) & "'"
 rs1.CursorLocation = adUseClient
 rs1.Open strsql2, conn, adOpenStatic, adLockReadOnly
 结果.Text = "此人共经手" & Int(rs.Fields(0)) & "笔生意,总的交易金额为" & Int(rs1.Fields(0))
 Exit Sub
fileerr:
MsgBox "输入错误或数据类型不符请重新输入!"
 End Sub


Private Sub Command3_Click()
 On Error GoTo fileerr
 Set conn = New ADODB.Connection
 conn.Open "Driver={SQL Server};Server=4E42AEF0FABF4E9;database=图书批发销售管理系统"
 
 Set rs = New ADODB.Recordset
 strsql = "select * from 图书信息 where 书名 = '" & Trim(图书名称.Text) & "'"
 rs.CursorLocation = adUseClient
 rs.Open strsql, conn, adOpenStatic, adLockReadOnly
 daima = rs("图书ISBN代码")

 strsql1 = "select sum(数量) from [入库/发货信息] where 交易类型='出货'and 图书ISBN代码='" & daima & "'"
 Set rs = New ADODB.Recordset
 rs.CursorLocation = adUseClient
 rs.Open strsql1, conn, adOpenStatic, adLockReadOnly
 
 strsql3 = "select sum(金额) from [入库/发货信息] where 交易类型='出货'and 图书ISBN代码='" & daima & "'"
 Set rs2 = New ADODB.Recordset
 rs2.CursorLocation = adUseClient
 rs2.Open strsql3, conn, adOpenStatic, adLockReadOnly
 
strsql2 = "select sum(数量) from [入库/发货信息] where 交易类型='入货'and 图书ISBN代码='" & daima & "'"
Set rs1 = New ADODB.Recordset
 rs1.CursorLocation = adUseClient
 rs1.Open strsql2, conn, adOpenStatic, adLockReadOnly
 
 strsql4 = "select count(金额) from [入库/发货信息] where 交易类型='入货'and 图书ISBN代码='" & daima & "'"
 Set rs3 = New ADODB.Recordset
 rs3.CursorLocation = adUseClient
 rs3.Open strsql4, conn, adOpenStatic, adLockReadOnly
 
 结果.Text = "这种图书平均每本的利润为" & Int(rs2.Fields(0)) / Int(rs.Fields(0)) - Int(rs3.Fields(0)) / Int(rs1.Fields(0)) & "元。"
Exit Sub
fileerr:
MsgBox "输入错误或数据类型不符请重新输入!"
End Sub

Private Sub Command4_Click()
Unload Me
功能选择.Show

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -