📄 qitachaxun.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form qitachaxun
Caption = "其它费用查询窗口"
ClientHeight = 6630
ClientLeft = 60
ClientTop = 345
ClientWidth = 9225
LinkTopic = "Form1"
ScaleHeight = 6630
ScaleWidth = 9225
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Left = 3360
TabIndex = 18
Top = 120
Width = 1935
End
Begin VB.ComboBox Combo2
Height = 300
Left = 960
TabIndex = 17
Top = 600
Width = 1695
End
Begin VB.ComboBox Combo3
Height = 300
Left = 3360
TabIndex = 16
Top = 600
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 375
Left = 6360
TabIndex = 15
Top = 360
Width = 1215
End
Begin VB.PictureBox Picture1
Height = 1095
Left = 120
ScaleHeight = 1035
ScaleWidth = 8475
TabIndex = 3
Top = 960
Width = 8535
Begin VB.Label Label12
Caption = "费 用"
Height = 375
Left = 7680
TabIndex = 14
Top = 600
Width = 615
End
Begin VB.Line Line8
X1 = 7560
X2 = 7560
Y1 = 480
Y2 = 1080
End
Begin VB.Label Label11
Caption = "项 目"
Height = 255
Left = 6600
TabIndex = 13
Top = 600
Width = 855
End
Begin VB.Line Line3
X1 = 1920
X2 = 8520
Y1 = 480
Y2 = 480
End
Begin VB.Label Label10
Caption = "车辆物品费"
Height = 255
Left = 6960
TabIndex = 12
Top = 120
Width = 1575
End
Begin VB.Line Line7
X1 = 6240
X2 = 6240
Y1 = 0
Y2 = 1080
End
Begin VB.Label Label9
Caption = "费 用"
Height = 255
Left = 5520
TabIndex = 11
Top = 600
Width = 735
End
Begin VB.Line Line6
X1 = 5280
X2 = 5280
Y1 = 480
Y2 = 1080
End
Begin VB.Label Label8
Caption = "项 目"
Height = 375
Left = 4320
TabIndex = 10
Top = 600
Width = 855
End
Begin VB.Label Label7
Caption = "保养费"
Height = 255
Left = 4680
TabIndex = 9
Top = 120
Width = 1215
End
Begin VB.Line Line5
X1 = 4080
X2 = 4080
Y1 = 0
Y2 = 1080
End
Begin VB.Label Label6
Caption = "费 用"
Height = 255
Left = 3360
TabIndex = 8
Top = 600
Width = 615
End
Begin VB.Line Line4
X1 = 3120
X2 = 3120
Y1 = 480
Y2 = 1080
End
Begin VB.Label Label5
Caption = "项 目"
Height = 255
Left = 2280
TabIndex = 7
Top = 600
Width = 735
End
Begin VB.Label Label4
Caption = "维修费"
Height = 375
Left = 2640
TabIndex = 6
Top = 120
Width = 735
End
Begin VB.Line Line2
X1 = 1920
X2 = 1920
Y1 = 0
Y2 = 1080
End
Begin VB.Label Label3
Caption = "过道费"
Height = 375
Left = 1080
TabIndex = 5
Top = 360
Width = 615
End
Begin VB.Line Line1
X1 = 840
X2 = 840
Y1 = 0
Y2 = 1080
End
Begin VB.Label Label2
Caption = "月 份"
Height = 255
Left = 240
TabIndex = 4
Top = 360
Width = 615
End
End
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 3975
Left = 120
TabIndex = 2
Top = 1800
Width = 8655
_ExtentX = 15266
_ExtentY = 7011
_Version = 393216
FixedCols = 0
End
Begin MSMask.MaskEdBox Mask
Height = 375
Left = 960
TabIndex = 1
Top = 120
Width = 735
_ExtentX = 1296
_ExtentY = 661
_Version = 393216
MaxLength = 5
Mask = "9999年"
PromptChar = "_"
End
Begin VB.Label Label15
Caption = "车型:"
Height = 255
Left = 2760
TabIndex = 21
Top = 240
Width = 615
End
Begin VB.Label Label14
Caption = "车 牌:"
Height = 255
Left = 240
TabIndex = 20
Top = 600
Width = 855
End
Begin VB.Label Label13
Caption = "司机:"
Height = 255
Left = 2760
TabIndex = 19
Top = 600
Width = 855
End
Begin VB.Label Label1
Caption = "日 期:"
Height = 255
Left = 240
TabIndex = 0
Top = 240
Width = 735
End
End
Attribute VB_Name = "qitachaxun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer
Dim result As Recordset
Dim sql As String
Private Sub Combo1_Click()
MSF.Clear
MSF.Rows = 2
MSF.FormatString = " |^ |^ |^ |^ |^ |^ |^ "
sql = "select * from cheliangmingcheng where 车型='" & Trim(Combo1.Text) & "'"
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
Do While Not result.EOF
Combo2.Text = Trim(result("车牌"))
Combo3.Text = Trim(result("司机"))
result.MoveNext
Loop
End If
result.Close
End Sub
Private Sub Command1_Click()
MSF.Clear
MSF.Rows = 2
MSF.FormatString = " |^ |^ |^ |^ |^ |^ |^ "
sql = "select * from qtfeiy where 日期 like '" & Trim(Mask.Text) & "%' and 车型='" & Trim(Combo1.Text) & "' order by 日期"
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
i = 1
Do While Not result.EOF
MSF.TextArray(i * MSF.Cols) = Mid(Trim(result("日期")), 6, 3)
' MSF.TextArray(i * MSF.Cols + 1) = Trim(result("路线"))
MSF.TextArray(i * MSF.Cols + 2) = Trim(result("维修费项目名称"))
MSF.TextArray(i * MSF.Cols + 3) = Trim(result("维修费费用"))
MSF.TextArray(i * MSF.Cols + 4) = Trim(result("保养费项目名称"))
MSF.TextArray(i * MSF.Cols + 5) = Trim(result("保养费费用"))
MSF.TextArray(i * MSF.Cols + 6) = Trim(result("车辆物品项目名称"))
MSF.TextArray(i * MSF.Cols + 7) = Trim(result("车辆物品费费用"))
MSF.MergeCol(5) = True
MSF.MergeCol(6) = True
MSF.Rows = MSF.Rows + 1
i = i + 1
result.MoveNext
Loop
End If
result.Close
sql = "select distinct 日期,实际 from guodaofei where 日期 like '" & Trim(Mask.Text) & "%' and 车型='" & Trim(Combo1.Text) & "' order by 日期"
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
i = 1
Do While Not result.EOF
' MsgBox Trim(MSF.TextArray(i * MSF.Cols))
If Mid(Trim(result("日期")), 6, 3) = Trim(MSF.TextArray(i * MSF.Cols)) And i < MSF.Rows - 1 Then
' MsgBox Mid(Trim(result("日期")), 6, 3)
MSF.TextArray(i * MSF.Cols + 1) = Trim(result("实际"))
i = i + 1
Else
result.MoveNext
End If
Loop
End If
result.Close
Dim s, s1, s2 As Double
For i = 1 To MSF.Rows - 2
s = s + Val(Trim(MSF.TextArray(i * MSF.Cols + 3)))
s1 = s1 + Val(Trim(MSF.TextArray(i * MSF.Cols + 5)))
s2 = s2 + Val(Trim(MSF.TextArray(i * MSF.Cols + 7)))
Next i
MSF.TextArray((MSF.Rows - 1) * MSF.Cols) = "合计"
MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 3) = s
MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 5) = s1
MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 7) = s2
MSF.MergeCells = flexMergeRestrictRows
MSF.MergeCol(0) = True
MSF.MergeCol(1) = True
End Sub
Private Sub Form_Load()
Move Screen.Width / 2 - qitachaxun.Width / 2, Screen.Height / 2 - qitachaxun.Height / 2
MSF.FormatString = " |^ |^ |^ |^ |^ |^ |^ "
Call aa
Set result = New Recordset
sql = "select * from cheliangmingcheng "
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
Do While Not result.EOF
Combo1.AddItem Trim(result("车型"))
result.MoveNext
Loop
End If
result.Close
Mask.Text = Format(Date, "yyyy年")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -