📄 frm_季度汇总.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomct2.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "Msadodc.OCX"
Object = "{715CBE0F-4F50-46EF-B009-CACED3A5C865}#3.0#0"; "gregn3.dll"
Begin VB.Form Frm_季度汇总
Caption = "季度汇总"
ClientHeight = 6150
ClientLeft = 60
ClientTop = 345
ClientWidth = 10350
KeyPreview = -1 'True
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6150
ScaleWidth = 10350
WindowState = 2 'Maximized
Begin VB.ComboBox cmbjd
Height = 300
ItemData = "frm_季度汇总.frx":0000
Left = 2880
List = "frm_季度汇总.frx":0002
Style = 2 'Dropdown List
TabIndex = 6
Top = 240
Width = 1455
End
Begin VB.CommandButton CmdOut
Caption = "输出(&O)"
Height = 330
Left = 6600
TabIndex = 4
Top = 240
Width = 960
End
Begin MSAdodcLib.Adodc Adocp
Height = 375
Left = 1440
Top = 2040
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "产品"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adogx
Height = 330
Left = 6120
Top = 2280
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "工序"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton CmdPrint
Caption = "打印(&P)"
Height = 330
Left = 5640
TabIndex = 3
Top = 240
Width = 960
End
Begin VB.CommandButton CmdExit
Caption = "退出(&X)"
Height = 330
Left = 7560
TabIndex = 2
Top = 240
Width = 960
End
Begin VB.CommandButton Cmdfind
Caption = "查询(&Q)"
Height = 330
Left = 4680
TabIndex = 1
Top = 240
Width = 960
End
Begin grproLibCtl.GRDisplayViewer grdvRate
Height = 5370
Left = 240
TabIndex = 0
Top = 720
Width = 9975
BorderStyle = 1
ShowHeader = -1 'True
ShowFooter = -1 'True
LeftGap = 0
RightGap = 0
TopGap = 0
BottomGap = 0
GridTitle3D = 0 'False
Resortable = 0 'False
ResortCaseSensitive= 0 'False
ResortDefaultAsc= -1 'True
End
Begin MSComCtl2.DTPicker DTPfrom
Height = 330
Left = 960
TabIndex = 7
Top = 240
Width = 975
_ExtentX = 1720
_ExtentY = 582
_Version = 393216
CustomFormat = "yyyy 年"
Format = 24838147
UpDown = -1 'True
CurrentDate = 38952
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "年:"
Height = 180
Left = 360
TabIndex = 8
Top = 315
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "季度:"
Height = 180
Left = 2280
TabIndex = 5
Top = 315
Width = 540
End
End
Attribute VB_Name = "Frm_季度汇总"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strcnn As New ADODB.Connection
Dim WithEvents Report As grproLibCtl.GridppReport
Attribute Report.VB_VarHelpID = -1
Dim rsfind As New ADODB.Recordset
Dim strgxname, strRpt As String
Dim strf() As String
Private Sub Cmdexit_Click()
Unload Me
End Sub
Private Sub CmdFind_Click()
Dim strsql As String
Dim strYf1 As String
Dim strYf2 As String
Dim strYf3 As String
If Len(cmbjd.Text) = 4 Then
strYf1 = Format(DTPfrom.Value, "yy") & Format(cmbjd.ListIndex * 3 + 1, "00")
strYf2 = Format(DTPfrom.Value, "yy") & Format(cmbjd.ListIndex * 3 + 2, "00")
strYf3 = Format(DTPfrom.Value, "yy") & Format(cmbjd.ListIndex * 3 + 3, "00")
Else
MsgBox "请选择季度", , "系统提示"
Exit Sub
End If
'日期范围
strsql = "select a.用户编号,a.姓名, a.本月水电费 as 水电费1 ,a.欠款 as 应缴1, a.本月交费 as 实缴1,a.上月欠费 as 欠费1 " & _
",b.本月水电费 as 水电费2,b.欠款 as 应缴2, b.本月交费 as 实缴2,b.上月欠费 as 欠费2 ,c.本月水电费 as 水电费3,c.欠款 as 应缴3, " & _
"c.本月交费 as 实缴3,c.上月欠费 as 欠费3 FROM f_sdfcount('" & strYf1 & "') a inner join f_sdfcount('" & strYf2 & "') b on a.用户编号=b.用户编号 " & _
" inner join f_sdfcount('" & strYf3 & "') c on a.用户编号=c.用户编号 "
Debug.Print strsql
With rsfind
If .State = adStateOpen Then .Close
.Open strsql, strcnn, adOpenKeyset, adLockReadOnly
If .RecordCount = 0 Then
MsgBox "在您查询的用户的用户记录在数据库中未能查询到!", , "系统提示"
' Report.DetailGrid.Recordset.Empty
grdvRate.Stop
Report.Clear
grdvRate.Refresh
Exit Sub
End If
End With
grdvRate.Stop
Report.Clear
Report.LoadFromFile App.Path & "\模板\季度统计.grf"
Report.ControlByName("title").AsStaticBox.Text = Format(DTPfrom.Value, "yyyy") & "年" & Trim(cmbjd.Text) & "水电费统计"
Report.ControlByName("m1").AsStaticBox.Text = Str(Trim(cmbjd.ListIndex * 3 + 1)) & "月"
Report.ControlByName("m2").AsStaticBox.Text = Str(Trim(cmbjd.ListIndex * 3 + 2)) & "月"
Report.ControlByName("m3").AsStaticBox.Text = Str(Trim(cmbjd.ListIndex * 3 + 3)) & "月"
Report.DetailGrid.Recordset.SkipQuery = True
grdvRate.Stop
grdvRate.Report = Report
grdvRate.Start
Start True
End Sub
Private Sub CmdOut_Click()
Report.ExportDirect gretXLS, App.Path, True
End Sub
Private Sub CmdPrint_Click()
Report.PrintPreview True
End Sub
Private Sub Form_Load()
Dim rsrpt As New ADODB.Recordset
Dim strsql As String
'frm_main.Toolbar1.Visible = False
If strcnn.State = adStateOpen Then strcnn.Close
strcnn.Open cnn
Set Report = New grproLibCtl.GridppReport
'Report.LoadFromFile App.Path & "\模板\季度汇总.grf"
' grdvRate.Report = Report
' grdvRate.Refresh
'DTPfrom.Value = Format(Now() - 31, "yyyy 年 MM月")
'DTpto.Value = Format(Now(), "yyyy 年 MM月")
DTPfrom.Value = Now()
With cmbjd
.AddItem "第一季度", 0
.AddItem "第二季度", 1
.AddItem "第三季度", 2
.AddItem "第四季度", 3
End With
Cmdfind.Enabled = True
CmdPrint.Enabled = False
'grdvRate.Refresh
Start False
End Sub
Private Sub Form_Resize()
If Me.WindowState <> vbMinimized Then grdvRate.Move 0, grdvRate.top, ScaleWidth, ScaleHeight - grdvRate.top
End Sub
Private Sub Report_FetchRecord(pEof As Boolean)
If rsfind.State = adStateOpen Then GRFetchRecordFromRecordset Report, rsfind
End Sub
Private Function Start(isCanUse As Boolean) 'iscanuse 是真时是初始状态,添加按钮可用
Me.KeyPreview = isCanUse
Cmdfind.Enabled = True
CmdPrint.Enabled = isCanUse
CmdExit.Enabled = True
CmdOut.Enabled = isCanUse
End Function
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Or KeyCode = vbKeyRight Then keybd_event 9, 0, 0, 0
If KeyCode = vbKeyLeft Then
keybd_event 9, 1, 1, 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -