📄 frmrj.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmRJ
Caption = "日结信息"
ClientHeight = 5730
ClientLeft = 60
ClientTop = 345
ClientWidth = 6150
LinkTopic = "Form1"
Picture = "frmRJ.frx":0000
ScaleHeight = 5730
ScaleWidth = 6150
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo3
Height = 300
Left = 4560
TabIndex = 7
Text = "Combo3"
Top = 840
Width = 615
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3360
TabIndex = 6
Text = "Combo2"
Top = 840
Width = 735
End
Begin MSFlexGridLib.MSFlexGrid msglist3
Height = 4095
Left = 0
TabIndex = 5
Top = 1440
Width = 6135
_ExtentX = 10821
_ExtentY = 7223
_Version = 393216
BackColor = 16744576
BackColorBkg = 8438015
End
Begin MSFlexGridLib.MSFlexGrid msglist2
Height = 4095
Left = 0
TabIndex = 4
Top = 1440
Width = 6135
_ExtentX = 10821
_ExtentY = 7223
_Version = 393216
BackColor = 16744576
BackColorBkg = 8438015
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 3
Top = 0
Width = 6150
_ExtentX = 10848
_ExtentY = 1085
ButtonWidth = 3519
ButtonHeight = 926
Appearance = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 3
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 送水员情况 "
Key = "ss"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 水票销售情况 "
Key = "sp"
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 水桶饮水机销售情况 "
EndProperty
EndProperty
End
Begin MSFlexGridLib.MSFlexGrid msglist1
Height = 4095
Left = 0
TabIndex = 2
Top = 1440
Width = 6135
_ExtentX = 10821
_ExtentY = 7223
_Version = 393216
BackColor = 16744576
BackColorBkg = 8438015
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1920
TabIndex = 1
Text = "Combo1"
Top = 840
Width = 975
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "日"
Height = 375
Left = 5280
TabIndex = 10
Top = 960
Width = 495
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "月"
Height = 375
Left = 4200
TabIndex = 9
Top = 960
Width = 375
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "年"
ForeColor = &H00000000&
Height = 375
Left = 3000
TabIndex = 8
Top = 960
Width = 255
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请选择查询年月日:"
Height = 375
Left = 120
TabIndex = 0
Top = 840
Width = 1695
End
End
Attribute VB_Name = "frmRJ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim msgtext1 As String
Dim txtsql1 As String
Dim mrc1 As ADODB.Recordset
Dim msgtext2 As String
Dim txtsql2 As String
Dim mrc2 As ADODB.Recordset
Dim msgtext3 As String
Dim txtsql3 As String
Dim mrc3 As ADODB.Recordset
Private Sub Form_Load()
Dim j As Integer
Dim i As Integer
Dim txtsql As String
Dim msgtext As String
Dim mrc As ADODB.Recordset
txtsql = "select distinct 派工时间 as yearid from pgd"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
Do While Not mrc.EOF
Combo1.AddItem Format(mrc!yearid, "yyyy")
mrc.MoveNext
Loop
Combo1.ListIndex = 0
Else
Combo1.Text = Year(Now())
End If
mrc.Close
For j = 1 To 12
Combo2.AddItem j
Next j
Combo2.Text = Month(Now())
For i = 1 To 31
Combo3.AddItem i
Next i
Combo3.Text = Day(Now())
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
msglist1.Visible = True
msglist2.Visible = False
msglist3.Visible = False
ShowTitle1
ShowData1
Case 2
msglist1.Visible = False
msglist2.Visible = True
msglist3.Visible = False
ShowTitle2
ShowData2
Case 3
msglist1.Visible = False
msglist2.Visible = False
msglist3.Visible = True
ShowTitle3
ShowData3
End Select
End Sub
Private Sub ShowData1()
Dim i As Integer
Dim dat As String
dat = Format(CDate(Combo1 & "-" & Combo2 & "-" & Combo3), "yy-mm-dd")
txtsql1 = "select 送水员,sum (数量) as 送水总数量 from pgd where 派工时间 = '" & dat & "' group by 送水员"
Set mrc1 = ExecuteSQL(txtsql1, msgtext1)
With msglist1
.Rows = 1
Do While Not mrc1.EOF
.Rows = .Rows + 1
For i = 1 To mrc1.Fields.Count
Select Case mrc1.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc1.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1) & ""
End Select
Next i
mrc1.MoveNext
Loop
End With
mrc1.Close
End Sub
'显示Grid表头
Private Sub ShowTitle1()
Dim i As Integer
With msglist1
.Cols = 3
.TextMatrix(0, 1) = "送水员"
.TextMatrix(0, 2) = "送水总数量"
'设置单元大小
.ColWidth(0) = 300
.ColWidth(1) = 1000
.ColWidth(2) = 2000
End With
End Sub
Private Sub ShowData2()
Dim i As Integer
Dim dat As String
dat = Format(CDate(Combo1 & "-" & Combo2 & "-" & Combo3), "yy-mm-dd")
txtsql2 = "select 水票名称,sum (数量) as 水票总数量,sum(总金额) as 销售总金额 from spxs where 销售日期 = '" & dat & "' group by 水票名称"
Set mrc2 = ExecuteSQL(txtsql2, msgtext2)
With msglist2
.Rows = 1
Do While Not mrc2.EOF
.Rows = .Rows + 1
For i = 1 To mrc2.Fields.Count
Select Case mrc2.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc2.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc2.Fields(i - 1) & ""
End Select
Next i
mrc2.MoveNext
Loop
End With
mrc2.Close
End Sub
'显示Grid表头
Private Sub ShowTitle2()
Dim i As Integer
With msglist2
.Cols = 4
.TextMatrix(0, 1) = "水票名称"
.TextMatrix(0, 2) = "送水总数量"
.TextMatrix(0, 3) = "总金额"
'设置单元大小
.ColWidth(0) = 300
.ColWidth(1) = 1000
.ColWidth(2) = 2000
End With
End Sub
Private Sub ShowData3()
Dim i As Integer
Dim dat As String
dat = Format(CDate(Combo1 & "-" & Combo2 & "-" & Combo3), "yy-mm-dd")
txtsql3 = "select 商品名,sum (数量) as 销售总数量,sum(总金额) as 销售总金额 from xsstysj where 购买日期 ='" & dat & "' group by 商品名"
Set mrc3 = ExecuteSQL(txtsql3, msgtext3)
With msglist3
.Rows = 1
Do While Not mrc3.EOF
.Rows = .Rows + 1
For i = 1 To mrc3.Fields.Count
Select Case mrc3.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc3.Fields(i - 1) & "", "yy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc3.Fields(i - 1) & ""
End Select
Next i
mrc3.MoveNext
Loop
End With
mrc3.Close
End Sub
'显示Grid表头
Private Sub ShowTitle3()
Dim i As Integer
With msglist3
.Cols = 4
.TextMatrix(0, 1) = "商品名"
.TextMatrix(0, 2) = "总数量"
.TextMatrix(0, 3) = "总金额"
'设置单元大小
.ColWidth(0) = 300
.ColWidth(1) = 1000
.ColWidth(2) = 2000
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -