📄 frmalltotal.frm
字号:
VERSION 5.00
Object = "{8099FCC2-0A81-11D2-BAA4-04F205C10000}#1.0#0"; "Vsflex6.ocx"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmAllTotal
Caption = "销售分析"
ClientHeight = 5910
ClientLeft = 60
ClientTop = 345
ClientWidth = 10110
LinkTopic = "Form2"
ScaleHeight = 5910
ScaleWidth = 10110
StartUpPosition = 3 'Windows Default
Begin VB.ComboBox cmdSeason
Height = 315
Left = 5220
TabIndex = 16
Top = 630
Width = 1365
End
Begin VB.ComboBox cmdBrand
Height = 315
Left = 3150
TabIndex = 14
Top = 630
Width = 1455
End
Begin VB.ComboBox cmdSex
Height = 315
Left = 900
TabIndex = 12
Top = 630
Width = 1545
End
Begin VB.CommandButton cmdPrint
Caption = "打印"
Height = 375
Left = 9180
TabIndex = 11
Top = 180
Width = 825
End
Begin VB.OptionButton Option2
Caption = "库存"
Height = 195
Left = 7290
TabIndex = 10
Top = 180
Width = 825
End
Begin VB.OptionButton Option1
Caption = "销售"
Height = 195
Left = 6570
TabIndex = 9
Top = 180
Width = 735
End
Begin VB.TextBox Text1
Height = 375
Left = 5220
TabIndex = 7
Top = 180
Width = 735
End
Begin VSFlex6Ctl.vsFlexGrid vsFlexGrid1
Height = 4695
Left = 180
TabIndex = 5
Top = 1080
Width = 9735
_cx = 17171
_cy = 8281
_ConvInfo = -1
Appearance = 1
BorderStyle = 1
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MousePointer = 0
BackColor = -2147483643
ForeColor = -2147483640
BackColorFixed = -2147483633
ForeColorFixed = -2147483630
BackColorSel = -2147483635
ForeColorSel = -2147483634
BackColorBkg = -2147483636
BackColorAlternate= -2147483643
GridColor = -2147483633
GridColorFixed = -2147483632
TreeColor = -2147483632
FloodColor = 192
SheetBorder = -2147483642
FocusRect = 1
HighLight = 1
AllowSelection = -1 'True
AllowBigSelection= -1 'True
AllowUserResizing= 0
SelectionMode = 0
GridLines = 1
GridLinesFixed = 2
GridLineWidth = 1
Rows = 1
Cols = 10
FixedRows = 1
FixedCols = 1
RowHeightMin = 0
RowHeightMax = 0
ColWidthMin = 0
ColWidthMax = 0
ExtendLastCol = 0 'False
FormatString = ""
ScrollTrack = 0 'False
ScrollBars = 3
ScrollTips = 0 'False
MergeCells = 0
MergeCompare = 0
AutoResize = -1 'True
AutoSizeMode = 0
AutoSearch = 0
MultiTotals = -1 'True
SubtotalPosition= 1
OutlineBar = 0
OutlineCol = 0
Ellipsis = 0
ExplorerBar = 0
PicturesOver = 0 'False
FillStyle = 0
RightToLeft = 0 'False
PictureType = 0
TabBehavior = 0
OwnerDraw = 0
Editable = 0 'False
ShowComboButton = -1 'True
WordWrap = 0 'False
TextStyle = 0
TextStyleFixed = 0
OleDragMode = 0
OleDropMode = 0
DataMode = 0
VirtualData = -1 'True
DataMember = ""
End
Begin VB.CommandButton Command1
Caption = "刷新"
Height = 375
Left = 8280
TabIndex = 4
Top = 180
Width = 825
End
Begin MSComCtl2.DTPicker date1
Height = 375
Left = 900
TabIndex = 2
Top = 180
Width = 1545
_ExtentX = 2725
_ExtentY = 661
_Version = 393216
Format = 23658497
CurrentDate = 36584
End
Begin MSComCtl2.DTPicker date2
Height = 375
Left = 3150
TabIndex = 3
Top = 180
Width = 1455
_ExtentX = 2566
_ExtentY = 661
_Version = 393216
Format = 23658497
CurrentDate = 36584
End
Begin VB.Label Label7
Caption = "季节"
Height = 285
Left = 4680
TabIndex = 17
Top = 630
Width = 465
End
Begin VB.Label Label6
Caption = "品牌"
Height = 285
Left = 2610
TabIndex = 15
Top = 630
Width = 465
End
Begin VB.Label Label5
Caption = "鞋类"
Height = 285
Left = 360
TabIndex = 13
Top = 630
Width = 465
End
Begin VB.Label Label4
Caption = "名"
Height = 285
Left = 6030
TabIndex = 8
Top = 180
Width = 285
End
Begin VB.Label Label3
Caption = "前"
Height = 285
Left = 4680
TabIndex = 6
Top = 180
Width = 375
End
Begin VB.Label Label2
Caption = "到"
Height = 285
Left = 2610
TabIndex = 1
Top = 180
Width = 465
End
Begin VB.Label Label1
Caption = "日期"
Height = 285
Left = 360
TabIndex = 0
Top = 180
Width = 555
End
End
Attribute VB_Name = "frmAllTotal"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdPrint_Click()
Dim rst As Recordset
'Set rst = New Recordset
'cn.CommandTimeout = 30000
'rst.Open "UPDATE Shop_Stock_Trans" _
' & " SET Price = - Price, Discount = - Discount, S340 = - S340, S345 = - S345, S350 = - S350," _
' & " S355 = - S355, S360 = - S360, S365 = - S365, S370 = - S370, S375 = - S375, " _
' & " S380 = - S380, S385 = - S385, S390 = - S390, S395 = - S395, S400 = - S400," _
' & " S405 = - S405, S410 = - S410, S415 = - S415, S420 = - S420, S425 = - S425, " _
' & " S430 = - S430, S435 = - S435, S440 = - S440, S445 = - S445, S450 = - S450," _
' & " S455 = - S455, S460 = - S460, S465 = - S465, S470 = - S470, " _
' & " [Count] = -[Count]" _
' & " WHERE (Type = '销售') AND ([Count] > 0)", cn, adOpenStatic, adLockOptimistic
End Sub
Private Sub Command1_Click()
Me.MousePointer = 11
Dim rst As Recordset, rstArea As Recordset, str1 As String, strWhere As String
'On Error Resume Next
strWhere = "1=1"
If Me.cmdSex.Text = "男" Then
strWhere = strWhere & " and Left(OrderCode, 1) = '1'"
End If
If Me.cmdSex.Text = "女" Then
strWhere = strWhere & " and Left(OrderCode, 1) = '0'"
End If
If Me.cmdBrand.Text <> "*" Then
strWhere = strWhere & " and BrandChina='" & Me.cmdBrand.Text & "'"
End If
If Me.cmdSeason.Text <> "*" Then
strWhere = strWhere & " and SeasonName='" & Me.cmdSeason.Text & "'"
End If
Set rst = New Recordset
'top " & Me.Text1.Text & "
str1 = "Select top " & Me.Text1.Text & " OrderName as 产品名称,Sum(-[Count]) as 合计 "
Set rstArea = New Recordset
rstArea.Open "Select Code,Name From Area1", cn, adOpenForwardOnly
Do Until rstArea.EOF
str1 = str1 & ",SUM(CASE WHEN LEFT(Address, 6) = '" & rstArea![Code] & "' THEN -[COUNT] ELSE 0 END) AS '" & rstArea![Name] & "' "
rstArea.MoveNext
Loop
If Me.Option1.Value = True Then
str1 = str1 & " From Shop_Stock_Trans LEFT OUTER JOIN v_order_list ON Shop_Stock_Trans.OrderCode = v_order_list.FullCode" _
& " WHERE " & strWhere & " and Type = '销售' and date>='" & Format(Me.date1.Value, "YYYY-MM-DD") & "' and date<='" & Format(Me.date2.Value, "YYYY-MM-DD") & "' Group by OrderName Order By Sum(-[Count]) Desc "
Else
str1 = str1 & " From Shop_Stock LEFT OUTER JOIN order_list ON Shop_Stock.OrderCode = order_list.FullCode" _
& " where " & strWhere & " Group by OrderName Order By Sum(-[Count]) Desc "
End If
'MsgBox str1
rst.Open str1, cn, adOpenStatic, adLockReadOnly
Set Me.vsFlexGrid1.DataSource = rst
Me.MousePointer = 0
End Sub
Private Sub Form_Load()
Me.date1.Value = Date
Me.date2.Value = Date
Me.Option1.Value = True
Me.Text1.Text = 100
Dim rst As Recordset
Set rst = New Recordset
rst.Open "Select BrandChina From Order_Brand ", cn, adOpenForwardOnly
With rst
Me.cmdBrand.AddItem "*"
Do Until .EOF
Me.cmdBrand.AddItem ![BrandChina]
.MoveNext
Loop
End With
Set rst = New Recordset
rst.Open "Select SeasonName From Order_Season ", cn, adOpenForwardOnly
With rst
Me.cmdSeason.AddItem "*"
Do Until .EOF
Me.cmdSeason.AddItem ![SeasonName]
.MoveNext
Loop
End With
Me.cmdSex.AddItem "*"
Me.cmdSex.AddItem "男"
Me.cmdSex.AddItem "女"
Me.cmdSex = "*"
Me.cmdBrand.Text = "*"
Me.cmdSeason.Text = "*"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -