📄 frmyj.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 frmyj
Caption = "月结信息"
ClientHeight = 4935
ClientLeft = 60
ClientTop = 345
ClientWidth = 6195
LinkTopic = "Form1"
Picture = "frmyj.frx":0000
ScaleHeight = 4935
ScaleWidth = 6195
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo2
Height = 300
Left = 4200
TabIndex = 7
Text = "Combo2"
Top = 840
Width = 855
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2760
TabIndex = 5
Text = "Combo1"
Top = 840
Width = 975
End
Begin MSFlexGridLib.MSFlexGrid msglist3
Height = 3015
Left = 120
TabIndex = 3
Top = 1440
Width = 5895
_ExtentX = 10398
_ExtentY = 5318
_Version = 393216
BackColor = 16744576
BackColorBkg = 12640511
End
Begin MSFlexGridLib.MSFlexGrid msglist2
Height = 3015
Left = 120
TabIndex = 2
Top = 1440
Width = 5895
_ExtentX = 10398
_ExtentY = 5318
_Version = 393216
BackColor = 16744576
BackColorBkg = 12640511
End
Begin MSFlexGridLib.MSFlexGrid msglist1
Height = 3015
Left = 120
TabIndex = 1
Top = 1440
Width = 5895
_ExtentX = 10398
_ExtentY = 5318
_Version = 393216
BackColor = 16744576
BackColorBkg = 12640511
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 0
Top = 0
Width = 6195
_ExtentX = 10927
_ExtentY = 1085
ButtonWidth = 3360
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 = " 水桶饮水机销售情况 "
Key = "stysj"
EndProperty
EndProperty
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "月"
Height = 255
Left = 5160
TabIndex = 8
Top = 960
Width = 495
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "年"
Height = 375
Left = 3840
TabIndex = 6
Top = 960
Width = 375
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请选择查询年月:"
Height = 375
Left = 1080
TabIndex = 4
Top = 840
Width = 1575
End
End
Attribute VB_Name = "frmyj"
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 txtsql As String
Dim msgtext As String
Dim mrc As ADODB.Recordset
txtsql = "select distinct 派工时间 as ym from pgd"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
Do While Not mrc.EOF
Combo1.AddItem Format(mrc!ym, "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())
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 dat1 As String
Dim dat2 As String
dat1 = Format(CDate(Combo1 & "-" & Combo2 & "-" & 1), "yy-mm-dd")
dat2 = Format(CDate(Combo1 & "-" & Combo2 & "-" & 30), "yy-mm-dd")
txtsql1 = "select 送水员,sum (数量) as 送水总数量 from pgd where 派工时间 between '" & dat1 & "'and '" & dat2 & "' group by 送水员"
Set mrc1 = ExecuteSQL(txtsql1, msgtext1)
If mrc1.EOF = False Then
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) & "", "yy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1) & ""
End Select
Next i
mrc1.MoveNext
Loop
End With
mrc1.Close
Else
MsgBox "目前没有销售信息!", vbOKOnly, "提示"
End If
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
Dim dat1 As String
Dim dat2 As String
dat1 = Format(CDate(Combo1 & "-" & Combo2 & "-" & 1), "yy-mm-dd")
dat2 = Format(CDate(Combo1 & "-" & Combo2 & "-" & 30), "yy-mm-dd")
txtsql2 = "select 水票名称,sum (数量) as 水票总数量,sum(总金额) as 销售总金额 from spxs where 销售日期 between '" & dat1 & "'and '" & dat2 & "' 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) & "", "yy-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
Dim dat1 As String
Dim dat2 As String
dat1 = Format(CDate(Combo1 & "-" & Combo2 & "-" & 1), "yy-mm-dd")
dat2 = Format(CDate(Combo1 & "-" & Combo2 & "-" & 30), "yy-mm-dd")
txtsql3 = "select 商品名,sum (数量) as 销售总数量,sum(总金额) as 销售总金额 from xsstysj where 购买日期 between '" & dat1 & "'and '" & dat2 & "' 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 + -