📄 frmsellst.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frmsellst.frx":0103
Height = 1455
Left = 120
TabIndex = 12
Top = 600
Width = 6255
_ExtentX = 11033
_ExtentY = 2566
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {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
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
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label1
Caption = "进货总金额:"
Height = 375
Left = 960
TabIndex = 16
Top = 4200
Width = 1095
End
Begin VB.Label Label2
Caption = "进货总金额:"
Height = 375
Left = -73920
TabIndex = 15
Top = 4200
Width = 1095
End
Begin VB.Label Label3
Caption = "进货总金额:"
Height = 375
Left = -73560
TabIndex = 14
Top = 4200
Width = 1095
End
Begin VB.Label Label4
Caption = "销售总金额:"
Height = 375
Left = -73200
TabIndex = 13
Top = 4080
Width = 1095
End
End
End
Attribute VB_Name = "frmsellst"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_activate()
'让窗体居中
Call MakeCenter(Me)
Dim sqlsell As String
Dim sqlfctotal As String '各品牌销售总金额
Dim sqltotal As String '销售总金额
Dim inty As Integer
Dim intm As Integer
Dim intd As Integer
inty = Year(Date)
intm = Month(Date)
intd = Day(Date)
Dim rs_check As New ADODB.Recordset
Dim rs_fctotal As New ADODB.Recordset
Dim rs_total As New ADODB.Recordset
rs_check.CursorLocation = adUseClient
rs_fctotal.CursorLocation = adUseClient
rs_total.CursorLocation = adUseClient
Adodc1.ConnectionString = connStr
'Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = connStr
'Set DataGrid2.DataSource = Adodc2
Adodc3.ConnectionString = connStr
'Set DataGrid3.DataSource = Adodc3
Adodc4.ConnectionString = connStr
'Set DataGrid4.DataSource = Adodc4
Adodc5.ConnectionString = connStr
'Set DataGrid5.DataSource = Adodc5
Adodc6.ConnectionString = connStr
'Set DataGrid6.DataSource = Adodc6
Adodc7.ConnectionString = connStr
'Set DataGrid7.DataSource = Adodc7
Adodc8.ConnectionString = connStr
'Set DataGrid8.DataSource = Adodc8
Select Case SSTabsell.Tab
Case 0 '今日销售选项卡
SSTabsell.TabEnabled(0) = True
SSTabsell.TabEnabled(1) = False
SSTabsell.TabEnabled(2) = False
SSTabsell.TabEnabled(3) = False
sqlsell = "select * from sell where 销售年 =" _
& inty & " and 销售月=" & intm & " and 销售日=" & intd _
& " order by 生产厂商,总金额 desc"
rs_check.Open sqlsell, conn, adOpenKeyset, adLockPessimistic
'Adodc1.ConnectionString = connStr
Adodc1.RecordSource = sqlsell
Adodc1.Refresh
'Set DataGrid1.DataSource = Adodc1
DataGrid1.ReBind
If rs_check.EOF = True Then
'Adodc2.ConnectionString = connStr
Adodc2.RecordSource = sqlsell
Adodc2.Refresh
'Set DataGrid2.DataSource = Adodc2
DataGrid2.ReBind
Text1.Text = 0
MsgBox "您今日没有销售!", vbOKOnly + vbInformation, "注意"
rs_check.Close
Exit Sub
End If
rs_check.Close
sqlfctotal = "select 生产厂商,sum(总金额) as 各厂商销售总金额 " _
& " from sell where 销售年 =" & inty & "and 销售月=" _
& intm & " and 销售日=" & intd & " group by 生产厂商 "
rs_fctotal.Open sqlfctotal, conn, adOpenKeyset, adLockPessimistic
Adodc2.RecordSource = sqlfctotal
Adodc2.Refresh
DataGrid2.ReBind
rs_fctotal.Close
sqltotal = "select sum(总金额) as 销售总金额 from sell where " _
& " 销售年 =" & inty & "and 销售月=" & intm & "and 销售日=" & intd
rs_total.Open sqltotal, conn, adOpenKeyset, adLockPessimistic
Text1.Text = rs_total.Fields(0)
rs_total.Close
Case 1
SSTabsell.TabEnabled(0) = False
SSTabsell.TabEnabled(1) = True
SSTabsell.TabEnabled(2) = False
SSTabsell.TabEnabled(3) = False
sqlsell = "select * from sell where 销售年 =" & inty _
& "and 销售月=" & intm & " order by 生产厂商,总金额 desc"
rs_check.Open sqlsell, conn, adOpenKeyset, adLockPessimistic
Adodc3.RecordSource = sqlsell
Adodc3.Refresh
DataGrid3.ReBind
If rs_check.EOF = True Then
Adodc4.RecordSource = sqlsell
Adodc4.Refresh
DataGrid4.ReBind
Text2.Text = 0
MsgBox "您本月没有销售!", vbOKOnly + vbInformation, "注意"
rs_check.Close
Exit Sub
End If
rs_check.Close
sqlfctotal = "select 生产厂商,sum(总金额) as 各厂商销售总金额 " _
& " from sell where 销售年 =" & inty & "and 销售月=" & intm _
& " group by 生产厂商 "
rs_fctotal.Open sqlfctotal, conn, adOpenKeyset, adLockPessimistic
Adodc4.RecordSource = sqlfctotal
Adodc4.Refresh
DataGrid4.ReBind
rs_fctotal.Close
sqltotal = "select sum(总金额) as 销售总金额 from sell where " _
& "销售年 =" & inty & "and 销售月=" & intm
rs_total.Open sqltotal, conn, adOpenKeyset, adLockPessimistic
Text2.Text = rs_total.Fields(0)
rs_total.Close
Case 2
SSTabsell.TabEnabled(0) = False
SSTabsell.TabEnabled(1) = False
SSTabsell.TabEnabled(2) = True
SSTabsell.TabEnabled(3) = False
Dim s As Integer
s = intm Mod 3
If s = 0 Then s = 3
sqlsell = "select * from sell where 销售年 =" & inty _
& " and 销售月 between " & (intm - s) & " and " & intm & " order by 生产厂商,总金额 desc"
rs_check.Open sqlsell, conn, adOpenKeyset, adLockPessimistic
Adodc5.RecordSource = sqlsell
Adodc5.Refresh
DataGrid5.ReBind
If rs_check.EOF = True Then
Adodc6.RecordSource = sqlsell
Adodc6.Refresh
DataGrid6.ReBind
Text3.Text = 0
MsgBox "您本季度没有销售!", vbOKOnly + vbInformation, "注意"
rs_check.Close
Exit Sub
End If
rs_check.Close
sqlfctotal = "select 生产厂商,sum(总金额) as 各厂商销售总金额 " _
& "from sell where 销售年 =" & inty & "and 销售月 between " & (intm - s) & " and " & intm & " group by 生产厂商 "
rs_fctotal.Open sqlfctotal, conn, adOpenKeyset, adLockPessimistic
Adodc6.RecordSource = sqlfctotal
Adodc6.Refresh
DataGrid6.ReBind
rs_fctotal.Close
sqltotal = "select sum(总金额) as 销售总金额 from sell where " _
& " 销售年 =" & inty & "and 销售月 between " & (intm - s) _
& " and " & intm
rs_total.Open sqltotal, conn, adOpenKeyset, adLockPessimistic
Text3.Text = rs_total.Fields(0)
rs_total.Close
Case 3
SSTabsell.TabEnabled(0) = False
SSTabsell.TabEnabled(1) = False
SSTabsell.TabEnabled(2) = False
SSTabsell.TabEnabled(3) = True
sqlsell = "select * from sell where 销售年 =" & inty _
& " order by 生产厂商,总金额 desc"
rs_check.Open sqlsell, conn, adOpenKeyset, adLockPessimistic
Adodc7.RecordSource = sqlsell
Adodc7.Refresh
DataGrid7.ReBind
If rs_check.EOF = True Then
Adodc8.RecordSource = sqlsell
Adodc8.Refresh
DataGrid8.ReBind
Text4.Text = 0
MsgBox "您本年度没有销售!", vbOKOnly + vbInformation, "注意"
rs_check.Close
Exit Sub
End If
rs_check.Close
sqlfctotal = "select 生产厂商,sum(总金额) as 各厂商销售总金额 " _
& " from sell where 销售年 =" & inty & " group by 生产厂商 "
rs_fctotal.Open sqlfctotal, conn, adOpenKeyset, adLockPessimistic
Adodc8.RecordSource = sqlfctotal
Adodc8.Refresh
DataGrid8.ReBind
rs_fctotal.Close
sqltotal = "select sum(总金额) as 销售总金额 from sell where " _
& " 销售年 =" & inty
rs_total.Open sqltotal, conn, adOpenKeyset, adLockPessimistic
Text4.Text = rs_total.Fields(0)
rs_total.Close
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -