?? guodaofeiinputb.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 guodaofeiinputb
Caption = "過道費輸入窗口"
ClientHeight = 7350
ClientLeft = 60
ClientTop = 345
ClientWidth = 8415
LinkTopic = "Form1"
ScaleHeight = 7350
ScaleWidth = 8415
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Left = 960
TabIndex = 10
Top = 600
Width = 1695
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3600
TabIndex = 9
Top = 600
Width = 1335
End
Begin VB.ComboBox Combo3
Height = 300
Left = 5760
TabIndex = 8
Top = 600
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "查 詢"
Height = 495
Left = 2880
TabIndex = 7
Top = 6600
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "保 存"
Height = 495
Left = 1680
TabIndex = 6
Top = 6600
Width = 1215
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 375
Left = 1080
TabIndex = 5
Top = 2280
Visible = 0 'False
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 4200
TabIndex = 4
Top = 120
Width = 1095
End
Begin MSMask.MaskEdBox Mask
Height = 375
Left = 1080
TabIndex = 2
Top = 120
Width = 1095
_ExtentX = 1931
_ExtentY = 661
_Version = 393216
MaxLength = 8
Mask = "9999年99月"
PromptChar = "_"
End
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 5175
Left = 240
TabIndex = 0
Top = 1080
Width = 7095
_ExtentX = 12515
_ExtentY = 9128
_Version = 393216
FixedCols = 0
AllowUserResizing= 3
End
Begin VB.Label Label11
Caption = "車型:"
Height = 375
Left = 480
TabIndex = 13
Top = 720
Width = 615
End
Begin VB.Label Label12
Caption = "車牌:"
Height = 255
Left = 2880
TabIndex = 12
Top = 720
Width = 615
End
Begin VB.Label Label13
Caption = "司機:"
Height = 255
Left = 5280
TabIndex = 11
Top = 720
Width = 855
End
Begin VB.Label Label2
Caption = "過道費實際金額:"
Height = 375
Left = 2520
TabIndex = 3
Top = 240
Width = 1575
End
Begin VB.Label Label1
Caption = "日 期:"
Height = 255
Left = 360
TabIndex = 1
Top = 240
Width = 735
End
End
Attribute VB_Name = "guodaofeiinputb"
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()
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
sql = "select * from guodaofei where 日期='" & Trim(Mask.Text) & "' and 車型='" & Trim(Combo1.Text) & "' "
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
Text1.Text = Trim(result("實際"))
Else
Text1.Text = 0
End If
result.Close
MSF.Clear
Text2.Visible = False
MSF.FormatString = "^ 路 線 |^ 次數 |^ 單次計費標準 |^ 金 額 "
MSF.Rows = 15
End Sub
Private Sub Command1_Click()
If MsgBox("確認保存嗎?", vbYesNo, "警告") = vbYes Then
For i = 1 To MSF.Rows - 1
If Trim(MSF.TextArray(i * MSF.Cols)) <> "" And Trim(MSF.TextArray(i * MSF.Cols + 1)) <> "" And Trim(MSF.TextArray(i * MSF.Cols + 2)) <> "" Then
sql = "select * from guodaofei where 日期='" & Trim(Mask.Text) & "' and 路線='" & Trim(MSF.TextArray(i * MSF.Cols)) & "' and 車型='" & Trim(Combo1.Text) & "' and 車牌='" & Trim(Combo2.Text) & "'"
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.Close
sql = "delete from guodaofei where 日期='" & Trim(Mask.Text) & "' and 路線='" & Trim(MSF.TextArray(i * MSF.Cols)) & "' and 車型='" & Trim(Combo1.Text) & "' and 車牌='" & Trim(Combo2.Text) & "' "
result.Open sql, con, adOpenStatic, adLockOptimistic
Else
result.Close
End If
sql = "insert into guodaofei values('" & Trim(Mask.Text) & "','" & Trim(MSF.TextArray(i * MSF.Cols)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 1)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 2)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 3)) & "','" & Trim(MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 3)) & "','" & Trim(Text1.Text) & "','" & Trim(Combo1.Text) & "','" & Trim(Combo2.Text) & "','" & Trim(Combo3.Text) & "')"
result.Open sql, con, adOpenStatic, adLockOptimistic
End If
Next i
MsgBox "保存結束"
End If
End Sub
Private Sub Command2_Click()
guodaofei.Show 1
' sql = "select * from guodaofei where 日期='" & Trim(Mask.Text) & "' "
' result.Open sql, con, adOpenStatic, adLockOptimistic
'
' If result.RecordCount <> 0 Then
' Text1.Text = Trim(result("實際"))
' result.MoveFirst
' i = 1
' Do While Not result.EOF
' MSF.TextArray(i * MSF.Cols) = Trim(result("路線"))
' MSF.TextArray(i * MSF.Cols + 1) = Trim(result("次數"))
' MSF.TextArray(i * MSF.Cols + 2) = Trim(result("單次計費標準"))
' MSF.TextArray(i * MSF.Cols + 3) = Trim(result("金額"))
' i = i + 1
' result.MoveNext
' Loop
' End If
' result.Close
' Dim s As Double
' For i = 1 To MSF.Rows - 2
' s = s + Val(Trim(MSF.TextArray(i * MSF.Cols + 3)))
' Next i
' MSF.TextArray((MSF.Rows - 1) * MSF.Cols) = "合計"
' MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 3) = s
End Sub
Private Sub Form_Load()
Mask.Text = Format(Date, "yyyy年mm月")
Move Screen.Width / 2 - guodaofeiinputb.Width / 2, Screen.Height / 2 - guodaofeiinputb.Height / 2
MSF.FormatString = "^ 路 線 |^ 次數 |^ 單次計費標準 |^ 金 額 "
MSF.Rows = 15
For i = 1 To MSF.Rows - 1
MSF.RowHeight(i) = 350
Next i
MSF.TextArray((MSF.Rows - 1) * MSF.Cols) = "合計"
Call aa
Set result = New Recordset
' sql = "select * from guodaofei where 日期='" & Trim(Mask.Text) & "' "
' result.Open sql, con, adOpenStatic, adLockOptimistic
'
' If result.RecordCount <> 0 Then
' ' Text1.Text = Trim(result("實際"))
' result.MoveFirst
' i = 1
' Do While Not result.EOF
' MSF.TextArray(i * MSF.Cols) = Trim(result("路線"))
' MSF.TextArray(i * MSF.Cols + 1) = Trim(result("次數"))
' MSF.TextArray(i * MSF.Cols + 2) = Trim(result("單次計費標準"))
' MSF.TextArray(i * MSF.Cols + 3) = Trim(result("金額"))
' i = i + 1
' result.MoveNext
' Loop
' End If
' result.Close
' Dim s As Double
' For i = 1 To MSF.Rows - 2
' s = s + Val(Trim(MSF.TextArray(i * MSF.Cols + 3)))
' Next i
' MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 3) = s
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
End Sub
Private Sub Mask_Change()
Text1.Text = ""
MSF.Clear
MSF.FormatString = "^ 路 線 |^ 次數 |^ 單次計費標準 |^ 金 額 "
MSF.Rows = 15
End Sub
Private Sub MSF_Click()
Text2.Visible = True
Text2.SetFocus
Text2.Text = Trim(MSF.TextArray(MSF.Row * MSF.Cols + MSF.Col))
Text2.Top = MSF.Top + MSF.CellTop
Text2.Left = MSF.Left + MSF.CellLeft
Text2.Width = MSF.CellWidth
End Sub
Private Sub Text2_Change()
MSF.Text = Text2.Text
Dim s As Double
If MSF.Col = 2 Then
MSF.TextArray(MSF.Row * MSF.Cols + 3) = Val(Trim(MSF.TextArray(MSF.Row * MSF.Cols + 1))) * Val(Trim(MSF.TextArray(MSF.Row * MSF.Cols + 2)))
For i = 1 To MSF.Rows - 2
s = s + Val(Trim(MSF.TextArray(i * MSF.Cols + 3)))
Next i
MSF.TextArray((MSF.Rows - 1) * MSF.Cols + 3) = s
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -