📄 form9.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form9
BorderStyle = 3 'Fixed Dialog
Caption = "历史....."
ClientHeight = 7335
ClientLeft = 45
ClientTop = 330
ClientWidth = 8745
Icon = "Form9.frx":0000
LinkTopic = "Form9"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 7335
ScaleWidth = 8745
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command3
Caption = "删 除"
Height = 435
Left = 6330
TabIndex = 12
Top = 540
Width = 795
End
Begin VB.CommandButton Command2
Caption = "导 出"
Height = 435
Left = 5520
TabIndex = 10
Top = 540
Width = 795
End
Begin VB.TextBox Text1
Height = 375
Left = 1260
TabIndex = 9
Top = 540
Width = 1905
End
Begin VB.CheckBox Check1
Caption = "车 牌"
Height = 375
Index = 1
Left = 60
TabIndex = 8
Tag = "cph"
Top = 510
Width = 1185
End
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 435
Left = 7140
TabIndex = 7
Top = 540
Width = 795
End
Begin VB.CheckBox Check1
Caption = "起止时间"
Height = 375
Index = 0
Left = 60
TabIndex = 1
Tag = "rcsj"
Top = 60
Width = 1185
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Form9.frx":1472
Height = 6255
Left = 0
TabIndex = 0
Top = 1080
Width = 8715
_ExtentX = 15372
_ExtentY = 11033
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "详细"
ColumnCount = 6
BeginProperty Column00
DataField = "CPH"
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 = "CPS"
Caption = "车牌颜色"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "CLLY"
Caption = "车辆来源"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "RCSJ"
Caption = "入场时间"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column04
DataField = "CCSJ"
Caption = "出场时间"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "XFSJ"
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
Locked = -1 'True
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
BeginProperty Column02
EndProperty
BeginProperty Column03
EndProperty
BeginProperty Column04
EndProperty
BeginProperty Column05
EndProperty
EndProperty
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 285
Left = 1290
TabIndex = 2
Top = 60
Width = 1755
_ExtentX = 3096
_ExtentY = 503
_Version = 393216
CustomFormat = "yyyy-mm-dd"
Format = 66715648
CurrentDate = 37260
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 285
Left = 3180
TabIndex = 3
Top = 60
Width = 1125
_ExtentX = 1984
_ExtentY = 503
_Version = 393216
CustomFormat = "hh:nn:ss"
Format = 66715650
CurrentDate = 37260
End
Begin MSComCtl2.DTPicker DTPicker3
Height = 285
Left = 4830
TabIndex = 4
Top = 60
Width = 1785
_ExtentX = 3149
_ExtentY = 503
_Version = 393216
CustomFormat = "yyyy-mm-dd"
Format = 66715648
CurrentDate = 37260
End
Begin MSComCtl2.DTPicker DTPicker4
Height = 285
Left = 6720
TabIndex = 5
Top = 60
Width = 1125
_ExtentX = 1984
_ExtentY = 503
_Version = 393216
Format = 66715650
CurrentDate = 37260
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 7500
Top = 90
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_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 = "Adodc1"
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.Label Label2
Alignment = 2 'Center
BackColor = &H000000FF&
BorderStyle = 1 'Fixed Single
Caption = "等待操作......"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 585
Left = 3180
TabIndex = 11
Top = 450
Width = 2325
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "-"
BeginProperty Font
Name = "宋体"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 840
Left = 4350
TabIndex = 6
Top = -210
Width = 435
End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SQl As String
Private Sub Command1_Click()
Dim i As Integer
Dim RS As New ADODB.Recordset
Dim Ks As Double
SQl = ""
If Check1(0).Value = 1 Then SQl = " and rcsj between '" & format(DTPicker1.Value, "yyyy年mm月dd日") & format(DTPicker2.Value, "hh时nn分") & "' and '" & format(DTPicker3.Value, "yyyy年mm月dd日") & format(DTPicker4.Value, "hh时nn分") & "'"
If Check1(1).Value = 1 Then SQl = SQl & " and cph='" & Text1.Text & "'"
If SQl <> "" Then SQl = " where " & Mid(SQl, 5)
Adodc1.RecordSource = "select cph,cps,clly,rcsj,ccsj,xfsj from ls " & SQl & " ORDER BY CPH,RCSJ"
Adodc1.Refresh
RS.CursorLocation = adUseClient
RS.Open "select xfsj from ls " & SQl, Cn, 1, 3
Ks = 0
Do While Not RS.EOF
Ks = Ks + Val(RS("xfsj"))
RS.MoveNext
Loop
RS.Close
Label2.Caption = "总消费 " & Ks & " 小时"
End Sub
Private Sub Command2_Click()
Dim F As New FileSystemObject
Dim Ks As Double
Dim Xl As Object
Dim K As New Excel.Application
Dim RS As New ADODB.Recordset
Dim i As Integer, j As Integer
F.CopyFile App.Path & "\file\表格2.xls", App.Path & "\tmp\表格2" & format(Date, "YYYY_MM") & ".xls"
Set Xl = K.Workbooks.Open(App.Path & "\tmp\表格2" & format(Date, "YYYY_MM") & ".xls")
RS.CursorLocation = adUseClient
RS.Open "select cph,cps,clly,rcsj,ccsj,xfsj from ls " & SQl, Cn, 1, 3
i = 4
j = 1
Do While Not RS.EOF
For j = 1 To 6
Xl.Worksheets(1).Cells(i, j).Value = RS(j - 1)
Next
i = i + 1
RS.MoveNext
Loop
RS.Close
RS.Open "select xfsj from ls " & SQl, Cn, 1, 3
Ks = 0
Do While Not RS.EOF
Ks = Ks + Val(RS("xfsj"))
RS.MoveNext
Loop
Xl.Worksheets(1).Cells(i + 1, 1).Value = "合计"
Xl.Worksheets(1).Cells(i + 1, 6).Value = Ks
RS.Close
If MsgBox("是否现在打开" & App.Path & "\tmp\表格2" & format(Date, "YYYY_MM") & ".xls", 1 + vbExclamation, "系统提示") = vbOK Then
Xl.Application.Visible = True
Else
Xl.Application.Quit
End If
End Sub
Private Sub Command3_Click()
If MsgBox("确实删除", 1 + 32, "系统提示") = vbOK Then
Cn.Execute "delete from ls " & SQl
Command1_Click
End If
End Sub
Private Sub Form_Load()
Me.Left = (MDIForm1.Width - Me.Width) / 2
Me.Top = (MDIForm1.Height - Me.Height) / 2 - 1000
Me.Show
Adodc1.ConnectionString = Cn.ConnectionString
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -