【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了RMTOPBGDS.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form RMTOPBGDS
Caption = "产品销售排行榜"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 345
ClientWidth = 5775
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 5775
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "查询"
Height = 2775
Left = 120
TabIndex = 0
Top = 120
Width = 5600
Begin VB.TextBox LB51
Height = 270
Left = 960
TabIndex = 16
Top = 1800
Width = 975
End
Begin VB.TextBox LB52
Height = 270
Left = 2280
TabIndex = 15
Top = 1800
Width = 975
End
Begin VB.CommandButton BTN_SEA2
Caption = "
查询金额排行"
Height = 500
Left = 3840
TabIndex = 14
Top = 840
Width = 1500
End
Begin VB.TextBox LB42
Height = 270
Left = 2280
TabIndex = 12
Top = 1440
Width = 975
End
Begin VB.TextBox LB41
Height = 270
Left = 960
TabIndex = 10
Top = 1440
Width = 975
End
Begin VB.CommandButton BTN_QUT
Caption = "关闭"
Height = 500
Left = 3840
TabIndex = 9
Top = 2040
Width = 1500
End
Begin VB.TextBox LB31
Height = 270
Left = 960
TabIndex = 5
Top = 1080
Width = 975
End
Begin VB.CommandButton BTN_CLR
Caption = "清除"
Height = 500
Left = 3840
TabIndex = 4
Top = 1440
Width = 1500
End
Begin VB.TextBox LB21
Height = 270
Left = 960
TabIndex = 3
Top = 720
Width = 975
End
Begin
VB.TextBox LB11
Height = 270
Left = 960
TabIndex = 2
Top = 360
Width = 975
End
Begin VB.CommandButton BTN_SEA1
Caption = "查询数量排行"
Height = 500
Left = 3840
TabIndex = 1
Top = 240
Width = 1500
End
Begin VB.Label Label4
Caption = "产品单价"
Height = 195
Left = 120
TabIndex = 18
Top = 1845
Width = 795
End
Begin VB.Label Label3
Caption = "°"
Height = 195
Left = 2040
TabIndex = 17
Top = 1845
Width = 315
End
Begin VB.Label Label2
Caption = "°"
Height = 195
Left = 2040
TabIndex = 13
Top = 1478
Width = 315
End
Begin VB.Label Label1
Caption = "销售日期"
Height = 195
Left = 120
TabIndex = 11
Top = 1485
Width = 795
End
Begin VB.Label Label9
Caption = "产品分类"
Height = 195
Left = 120
TabIndex = 8
Top = 1125
Width = 795
End
Begin VB.Label Label8
Caption = "供应厂商"
Height = 195
Left = 120
TabIndex = 7
Top = 758
Width = 795
End
Begin VB.Label Label7
Caption = "收银台"
Height = 195
Left = 120
TabIndex = 6
Top = 398
Width = 795
End
End
End
Attribute VB_Name = "RMTOPBGDS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public CN As New ADODB.Connection, RS As New ADODB.Recordset
Public SQL As String
Const DBPATH = "./POS.MDB"
Const ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
Private Sub BTN_CLR_Click()
LB11.Text = ""
LB21.Text = ""
LB31.Text = ""
LB41.Text = ""
LB42.Text = ""
LB51.Text = ""
LB52.Text = ""
End Sub
Private Sub BTN_QUT_Click()
Unload RMTOPBGDS
End Sub
Private Sub BTN_SEA1_Click()
DR_TOPBGDS.Sections("ReportHeader").Controls("LB_TITLE").Caption = RMTOPBGDS.Caption
S = "SELECT TOP 10 SUM(POSB.BGCNT) AS BGCNT, POSB.BGENO, BGDS.BGNAM, SUM(POSB.BGCOS) AS BGCOS, SUM(POSB.BGCOT) AS BGCOT FROM POSA, POSB, BGDS "
S = S & "WHERE POSA.PAENO = POSB.PAENO "
S = S & " AND POSB.BGENO = BGDS.BGENO "
If (LB11.Text <> "") Then S = S & " AND POSA.PAIDE = '" + LB11.Text + "' "
If (LB21.Text <> "") Then S = S & " AND BGDS.BSENO = '" + LB21.Text + "' "
If (LB31.Text <> "") Then S = S & " AND BGDS.BGKIN = '" + LB31.Text + "' "
If (LB41.Text <> "") And (LB42.Text <> "") Then S = S & " AND ( BGPST >= '" + LB41.Text + "' AND BGPST <='" + LB42.Text + "' ) "
If (LB41.Text <> "") And (LB42.Text = "") Then S = S & " AND BGPST >= '" + LB41.Text + "' "
If (LB41.Text = "") And (LB42.Text <> "") Then S = S & " AND BGPST <= '" + LB42.Text + "' "
If (LB51.Text <> "") And (LB52.Text <> "") Then S = S & " AND ( BGDS.BGCOS >= '" + LB51.Text + "' AND BGDS.BGCOS <='" + LB52.Text + "' ) "
If (LB51.Text <> "") And (LB52.Text = "") Then S = S & " AND BGDS.BGCOS >= '" + LB51.Text + "' "
If (LB51.Text = "") And (LB52.Text <> "") Then S = S & " AND BGDS.BGCOS <= '" + LB52.Text + "' "
S = S & "GROUP BY POSB.BGENO, BGDS.BGNAM "
S = S & "ORDER BY 1 DESC "
RS.Open S, ConnString, , , adCmdText
Set DR_TOPBGDS.DataSource = RS
DR_TOPBGDS.Sections("DETAIL").Controls("TEXT1").DataField = "BGENO"
DR_TOPBGDS.Sections("DETAIL").Controls("TEXT2").DataField = "BGNAM"
DR_TOPBGDS.Sections("DETAIL").Controls("TEXT3").DataField = "BGCNT"
DR_TOPBGDS.Sections("DETAIL").Controls("TEXT4").DataField = "BGCOS"
DR_TOPBGDS.Sections("DETAIL").Controls("TEXT5").DataField = "BGCOT"
DR_TOPBGDS.Show vbModal
RS.Close
End Sub
Private Sub BTN_SEA2_Click()
DR_TOPBGDS.Sections("ReportHeader").Controls("LB_TITLE").Caption = RMTOPBGDS.Caption
S = "SELECT TOP 10 SUM(POSB.BGCOT) AS BGCOT, POSB.BGENO, BGDS.BGNAM, SUM(POSB.BGCNT) AS BGCNT, SUM(POSB.BGCOS) AS BGCOS FROM POSA, POSB, BGDS "
S = S & "WHERE POSA.PAENO = POSB.PAENO "
S = S & " AND POSB.BGENO = BGDS.BGENO "
If (LB11.Text <> "") Then S = S & " AND POSA.PAIDE = '" +