📄 form8.frm
字号:
Begin VB.Line Line1
X1 = 0
X2 = 8760
Y1 = 4800
Y2 = 4800
End
Begin VB.Label Label7
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000E&
Height = 240
Left = 4320
TabIndex = 7
Top = 240
Width = 120
End
Begin VB.Label Label6
BackColor = &H80000001&
Height = 615
Left = 0
TabIndex = 6
Top = 0
Width = 8775
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 4800
Top = 7440
Width = 1335
_ExtentX = 2355
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label5
BackColor = &H80000001&
Caption = " 查询"
ForeColor = &H8000000E&
Height = 255
Left = 480
TabIndex = 4
Top = 2520
Width = 1815
End
Begin VB.Label Label4
BackColor = &H80000001&
Caption = " 年销售统计"
ForeColor = &H8000000E&
Height = 255
Left = 480
TabIndex = 3
Top = 2040
Width = 1815
End
Begin VB.Label Label3
BackColor = &H80000001&
Caption = " 季度销售统计"
ForeColor = &H8000000E&
Height = 255
Left = 480
TabIndex = 2
Top = 1560
Width = 1815
End
Begin VB.Label Label2
BackColor = &H80000001&
Caption = " 月销售统计"
ForeColor = &H8000000E&
Height = 255
Left = 480
TabIndex = 1
Top = 1080
Width = 1815
End
Begin VB.Label Label1
BackColor = &H80000001&
Caption = " 当日销售统计"
ForeColor = &H8000000E&
Height = 255
Left = 480
TabIndex = 0
Top = 600
Width = 1815
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim pp As String
Dim nx As String
Dim xh As String
Dim s As Integer
Dim m As Long
Dim ss As Long
Dim ll As Long
Dim mth As Integer
Dim j As Integer
Dim Data As Variant
Private Sub Combo1_Click()
If Combo1.Text = "曲线" Then
MSChart1.chartType = VtChChartType2dLine
End If
If Combo1.Text = "方条" Then
MSChart1.chartType = VtChChartType2dBar
End If
If Combo1.Text = "3D方条" Then
MSChart1.chartType = VtChChartType2dStep
End If
If Combo1.Text = "区域" Then
MSChart1.chartType = VtChChartType2dPie
End If
If Combo1.Text = "拼图" Then
MSChart1.chartType = VtChChartType2dArea
End If
End Sub
Private Sub Command1_Click()
Adodc2.RecordSource = "SELECT * FROM 利润表 where 时间='" + Str(Date) + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount = 0 Then
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("日利润") = ss
Adodc2.Recordset.Fields("时间") = Date
Adodc2.Recordset.Update
Exit Sub
End If
ll = Adodc2.Recordset.Fields("日利润")
ll = ll + ss
Adodc2.Recordset.Fields("日利润") = ll
Adodc2.Recordset.Update
Command1.Enabled = False
End Sub
Private Sub Form_Load()
Adodc2.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=管理系统"
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=管理系统"
Frame1.Left = 3120
Frame1.Height = 6975
Frame1.Top = 240
Frame1.Width = 8775
Frame2.Left = 3120
Frame2.Height = 6975
Frame2.Top = 240
Frame2.Width = 8775
Form8.Top = 0
Form8.Left = 0
Form8.Width = Me.Width
Form8.Height = Me.Height
End Sub
Private Sub Label1_Click()
Frame2.Visible = False
Frame1.Visible = True
Label7.Caption = Str(Date) + " 的销售统计"
a = MsgBox("此操作每天您只能操作一次,您确定要统计吗?", vbYesNo, "警示!")
If a = vbNo Then
Exit Sub
End If
Command1.Enabled = True
Adodc1.RecordSource = "SELECT * FROM 统计表 where 日期='" + Str(Date) + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "今天的销售额为0!!"
Exit Sub
End If
Set DataGrid1.DataSource = Adodc1
Adodc2.RecordSource = "SELECT sum(交易额) as 总交易额 FROM 交易表 where 日期='" + Str(Date) + "'"
Adodc2.Refresh
Text1.Text = Adodc2.Recordset.Fields("总交易额")
m = Adodc2.Recordset.Fields("总交易额")
Adodc2.RecordSource = "SELECT sum(交易额) as 总交易额 FROM 交易表 where 日期='" + Str(Date) + "'"
Adodc2.Refresh
s = Adodc1.Recordset.RecordCount
For i = 1 To s
pp = Adodc1.Recordset.Fields("品牌")
nx = Adodc1.Recordset.Fields("类型")
xh = Adodc1.Recordset.Fields("型号")
Adodc1.Recordset.MoveNext
Adodc2.RecordSource = "SELECT * FROM 货存表 where 品牌='" + pp + "'and 类型='" + nx + "'and 型号='" + xh + "'"
Adodc2.Refresh
s = s + Adodc2.Recordset.Fields("进价")
ss = m - s
If ss < 0 Then
Label9.ForeColor = &HFF&
Label9.Caption = "亏损:"
ss = Abs(ss)
Text2.Text = ss
ss = m - s
Else
Label9.ForeColor = &H0&
Label9.Caption = "盈利:"
Text2.Text = ss
End If
Next i
Exit Sub
End Sub
Private Sub Label13_Click()
Adodc2.RecordSource = "SELECT * FROM 统计表"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount = o Then
MsgBox "没有任何数据记录!!"
Exit Sub
End If
'Data = MSChart1.ChartData
If Adodc2.Recordset.EOF Then
Adodc2.Recordset.MoveLast
End If
Do While Not Adodc2.Recordset.EOF
Adodc2.Recordset.MoveNext
Set MSChart1.DataSource = Adodc2
Loop
End Sub
Private Sub Label2_Click()
Frame2.Visible = True
Frame1.Visible = False
Label11.Caption = Str(Month(Date)) + " 月份的销售统计"
End Sub
Private Sub Label3_Click()
Frame2.Visible = True
Frame1.Visible = False
mth = Month(Date)
If mth >= 1 And mth >= 3 Then
j = 1
End If
If mth >= 4 And mth <= 6 Then
j = 2
End If
If mth >= 7 And mth <= 9 Then
j = 3
End If
If mth >= 10 And mth <= 12 Then
j = 4
End If
Label11.Caption = "第" + Str(j) + " 季度的销售统计"
End Sub
Private Sub Label4_Click()
Frame2.Visible = True
Frame1.Visible = False
Label11.Caption = Str(Year(Date)) + " 年的销售统计"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -