📄 frmsellquery.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1575
Left = 6600
TabIndex = 7
Top = 1560
Width = 375
End
Begin VB.Label Label2
Caption = "销售排行"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1575
Left = 120
TabIndex = 6
Top = 1440
Width = 375
End
Begin VB.Label Label1
Caption = "销售概况"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 255
Left = 600
TabIndex = 5
Top = 0
Width = 1335
End
End
Begin VB.PictureBox ChartBox
BackColor = &H8000000A&
Height = 5895
Left = 120
ScaleHeight = 5835
ScaleWidth = 10035
TabIndex = 0
Top = 360
Width = 10095
Begin MSChart20Lib.MSChart ChartSeason
Height = 3135
Left = 6600
OleObjectBlob = "frmSellQuery.frx":0000
TabIndex = 9
Top = 0
Width = 3375
End
Begin MSChart20Lib.MSChart ChartDate
Height = 2775
Left = 0
OleObjectBlob = "frmSellQuery.frx":2348
TabIndex = 10
Top = 3000
Width = 9975
End
Begin MSChart20Lib.MSChart ChartBrand
Height = 3135
Left = 3360
OleObjectBlob = "frmSellQuery.frx":3D54
TabIndex = 8
Top = 0
Width = 3375
End
Begin MSChart20Lib.MSChart ChartAddress
Height = 3135
Left = 0
OleObjectBlob = "frmSellQuery.frx":5F43
TabIndex = 12
Top = 0
Width = 3495
End
End
Begin MSComctlLib.TabStrip TabType
Height = 6375
Left = 0
TabIndex = 11
Top = 0
Width = 10335
_ExtentX = 18230
_ExtentY = 11245
_Version = 393216
BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628}
NumTabs = 2
BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "数据"
Key = "Data"
ImageVarType = 2
EndProperty
BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "图表"
Key = "Chart"
ImageVarType = 2
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmSellQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
Dim Rst1 As New ADODB.Recordset, i As Long, s As String, j As Long
Dim rst2 As New ADODB.Recordset
Me.Show
DoEvents
Me.MousePointer = 11
s = QuickTranArray(1)
' MsgBox s
Rst1.Open s, GetConnect, adOpenStatic, adLockReadOnly
Set Me.GridPH.DataSource = Rst1
Me.GridPH.ColWidth(0) = 0
Me.GridPH.Cell(flexcpText, 0, 0) = "产品代号"
Me.GridPH.Cell(flexcpText, 0, 1) = "产品"
Me.GridPH.Cell(flexcpText, 0, 2) = "数量"
Me.GridPH.ColWidth(1) = 4500
Me.GridPH.ColWidth(2) = 800
Rst1.Close
s = QuickTranArray(2)
Me.Caption = QuickTranArray(6)
Debug.Print s
Rst1.Open s, GetConnect, adOpenStatic, adLockReadOnly
j = 0
For i = 1 To 8
Me.GridJW.Cell(flexcpText, i - 1, 1) = Rst1.Fields("Price" & i).Value
j = j + IIf(IsNull(Rst1.Fields("Price" & i).Value), 0, Rst1.Fields("Price" & i).Value)
Next
For i = 1 To 8
Me.GridJW.Cell(flexcpText, i - 1, 2) = Format(IIf(j = 0, 0, Rst1.Fields("Price" & i).Value / j * 100), "##0.00") & "%"
Next
'MsgBox s
Me.GridJW.Cell(flexcpText, 0, 0) = "200元以下"
Me.GridJW.Cell(flexcpText, 1, 0) = "201-250元"
Me.GridJW.Cell(flexcpText, 2, 0) = "251-300元"
Me.GridJW.Cell(flexcpText, 3, 0) = "301-350元"
Me.GridJW.Cell(flexcpText, 4, 0) = "351-400元"
Me.GridJW.Cell(flexcpText, 5, 0) = "401-450元"
Me.GridJW.Cell(flexcpText, 6, 0) = "451-500元"
Me.GridJW.Cell(flexcpText, 7, 0) = "500元以上"
Me.GridJW.ColWidth(0) = 1000
Me.GridJW.ColWidth(1) = 750
Me.GridJW.ColWidth(2) = 800
j = 0
Me.GridGK.Cell(flexcpText, 1, 0) = Rst1![Value]
Me.GridGK.Cell(flexcpText, 1, 1) = -Rst1![Total]
For i = 1 To 5
Me.GridGK.Cell(flexcpText, 1, i + 1) = IIf(IsNull(Rst1.Fields("season0" & i).Value), 0, Rst1.Fields("season0" & i).Value)
j = j + IIf(IsNull(Rst1.Fields("season1" & i).Value), 0, Rst1.Fields("season1" & i).Value)
Next
Me.GridGK.Cell(flexcpText, 1, 7) = j
Me.GridGK.Cell(flexcpText, 0, 0) = "总售量"
Me.GridGK.Cell(flexcpText, 0, 1) = "总售价"
Me.GridGK.Cell(flexcpText, 0, 2) = "春鞋"
Me.GridGK.Cell(flexcpText, 0, 3) = "凉鞋"
Me.GridGK.Cell(flexcpText, 0, 4) = "秋鞋"
Me.GridGK.Cell(flexcpText, 0, 5) = "冬靴"
Me.GridGK.Cell(flexcpText, 0, 6) = "休闲鞋"
Me.GridGK.Cell(flexcpText, 0, 7) = "男鞋"
'==========================================================================
Me.ChartSeason.ColumnCount = 6
Me.ChartSeason.RowCount = 1
'Me.ChartSeason.TitleText = "分季节销售分析"
Me.ChartSeason.Plot.LocationRect.Min.Set 0, 0
Me.ChartSeason.Plot.LocationRect.Max.Set Me.ChartSeason.Width * 2 / 3, Me.ChartSeason.Height
For i = 1 To 6
Me.ChartSeason.Column = i
Me.ChartSeason.Row = 1
' Me.ChartSeason.Legend.Font.Size = 4
'Me.ChartSeason.Legend.VtFont.Size = 8
'Me.ChartSeason.Legend.Location.LocationType = VtChLocationTypeRight
Select Case i
Case 1
Me.ChartSeason.ColumnLabel = "春"
Case 2
Me.ChartSeason.ColumnLabel = "夏"
Case 3
Me.ChartSeason.ColumnLabel = "秋"
Case 4
Me.ChartSeason.ColumnLabel = "冬"
Case 5
Me.ChartSeason.ColumnLabel = "休闲"
Case 6
Me.ChartSeason.ColumnLabel = "男"
End Select
Me.ChartSeason.Data = Val(Me.GridGK.Cell(flexcpText, 1, i + 1))
Debug.Print Me.ChartSeason.Data
Next
'==========================================================================
Me.ChartBrand.ColumnCount = 10
Me.ChartBrand.RowCount = 1
Me.ChartBrand.Plot.LocationRect.Min.Set 0, 0
Me.ChartBrand.Plot.LocationRect.Max.Set Me.ChartBrand.Width * 2 / 3, Me.ChartBrand.Height
For i = 1 To 10
If i = 10 Then
s = "A"
Else
s = i
End If
Me.ChartBrand.Column = i
Me.ChartBrand.Data = IIf(IsNull(Rst1.Fields("Brand" & s)), 0, Rst1.Fields("Brand" & s))
rst2.Open "select * from Order_Brand Where BrandCode='" & s & "'", GetConnect, adOpenForwardOnly, adLockReadOnly
If rst2.EOF Then
Me.ChartBrand.ColumnLabel = "其它"
Else
Me.ChartBrand.ColumnLabel = rst2![BrandChina]
End If
rst2.Close
Next
'==========================================================================
Rst1.Close
Rst1.Open QuickTranArray(4), GetConnect, adOpenStatic, adLockReadOnly
Me.ChartAddress.ColumnCount = Rst1.RecordCount
If Rst1.RecordCount > 0 Then
Rst1.MoveFirst
For i = 1 To Rst1.RecordCount
Me.ChartAddress.Column = i
Me.ChartAddress.Data = Rst1![Count]
Me.ChartAddress.ColumnLabel = IIf(IsNull(Rst1![AddressName]), "", Rst1![AddressName])
Rst1.MoveNext
Next
End If
Me.ChartAddress.RowLabel = QuickTranArray(3)
Rst1.Close
Me.ChartAddress.Plot.LocationRect.Min.Set 0, 0
Me.ChartAddress.Plot.LocationRect.Max.Set Me.ChartAddress.Width * 2 / 3, Me.ChartAddress.Height
Rst1.Open QuickTranArray(5), GetConnect, adOpenStatic, adLockReadOnly
Me.ChartDate.ColumnCount = Rst1.RecordCount
If Rst1.RecordCount > 0 Then
Rst1.MoveFirst
For i = 1 To Rst1.RecordCount
Me.ChartDate.Column = i
Me.ChartDate.Data = Rst1![Count]
Me.ChartDate.ColumnLabel = Rst1![Date]
Rst1.MoveNext
Next
End If
Rst1.Close
On Error Resume Next
For i = 1 To Me.GridPH.Rows - 1
For j = 1 To Me.GridPH.Cols - 1
If i Mod 2 = 0 Then
Me.GridPH.Cell(flexcpBackColor, i, j) = &HE3FBFB '&HBEE4E1
Else
Me.GridPH.Cell(flexcpBackColor, i, j) = &HBEE4E1 '&HC0EEC0 '&HE3FBFB
End If
Next
Next
For i = 0 To Me.GridJW.Rows - 1
For j = 1 To Me.GridJW.Cols - 1
If i Mod 2 = 0 Then
Me.GridJW.Cell(flexcpBackColor, i, j) = &HE3FBFB '&HBEE4E1
Else
Me.GridJW.Cell(flexcpBackColor, i, j) = &HBEE4E1 '&HC0EEC0 '&HE3FBFB
End If
Next
Next
For i = 0 To Me.GridGK.Cols - 1
If i Mod 2 = 0 Then
Me.GridGK.Cell(flexcpBackColor, 1, i) = &HE3FBFB '&HBEE4E1
Else
Me.GridGK.Cell(flexcpBackColor, 1, i) = &HBEE4E1 '&HC0EEC0 '&HE3FBFB
End If
Next
Me.MousePointer = 0
' Me.ChartBrand.Plot.View3d
End Sub
Private Sub TabType_Click()
If Me.TabType.Tabs("Data").Selected Then
Me.DataBox.Visible = True
Me.ChartBox.Visible = False
Else
Me.ChartBox.Visible = True
Me.DataBox.Visible = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -