📄 frmsellst.frm
字号:
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 MSDataGridLib.DataGrid DataGrid7
Bindings = "frmsellst.frx":0103
Height = 1695
Left = 120
TabIndex = 2
Top = 480
Width = 6375
_ExtentX = 11245
_ExtentY = 2990
_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 = -73560
TabIndex = 16
Top = 4200
Width = 1095
End
Begin VB.Label Label2
Caption = "销售总金额:"
Height = 375
Left = -73440
TabIndex = 15
Top = 4320
Width = 1095
End
Begin VB.Label Label3
Caption = "销售总金额:"
Height = 375
Left = -73440
TabIndex = 14
Top = 4320
Width = 1095
End
Begin VB.Label Label4
Caption = "销售总金额:"
Height = 375
Left = 1800
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()
Dim X0 As Long
Dim Y0 As Long
'让窗体居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
Dim sqlsell As String
Dim sqlcustotal 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
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.RecordSource = sqlsell
Adodc1.Refresh
DataGrid1.ReBind
If rs_check.EOF = True Then
Adodc2.RecordSource = sqlsell
Adodc2.Refresh
DataGrid2.ReBind
Text1.Text = 0
MsgBox "您今日没有销售!", vbOKOnly + vbInformation, "注意"
rs_check.Close
Exit Sub
End If
rs_check.Close
sqlcustotal = "select 客户名称,sum(总金额) as 各客户销售总金额 " _
& " from sell where 销售年 =" & inty & "and 销售月=" _
& intm & " and 销售日=" & intd & " group by 客户名称 "
rs_fctotal.Open sqlcustotal, conn, adOpenKeyset, adLockPessimistic
Adodc2.RecordSource = sqlcustotal
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
sqlcustotal = "select 客户名称,sum(总金额) as 各客户销售总金额 " _
& " from sell where 销售年 =" & inty & "and 销售月=" & intm _
& " group by 客户名称 "
rs_fctotal.Open sqlcustotal, conn, adOpenKeyset, adLockPessimistic
Adodc4.RecordSource = sqlcustotal
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
sqlcustotal = "select 客户名称,sum(总金额) as 各客户销售总金额 " _
& "from sell where 销售年 =" & inty & "and 销售月 between " & (intm - s) & " and " & intm & " group by 客户名称 "
rs_fctotal.Open sqlcustotal, conn, adOpenKeyset, adLockPessimistic
Adodc6.RecordSource = sqlcustotal
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
sqlcustotal = "select 客户名称,sum(总金额) as 各客户销售总金额 " _
& " from sell where 销售年 =" & inty & " group by 客户名称 "
rs_fctotal.Open sqlcustotal, conn, adOpenKeyset, adLockPessimistic
Adodc8.RecordSource = sqlcustotal
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 + -