?? frmstatistic.frm
字號:
VERSION 5.00
Begin VB.Form Frmstatistic
BorderStyle = 1 'Fixed Single
Caption = "運營統(tǒng)計"
ClientHeight = 4995
ClientLeft = 1740
ClientTop = 2025
ClientWidth = 4500
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4995
ScaleWidth = 4500
Begin VB.CommandButton cmdcancel
Caption = "取 消"
Height = 375
Left = 2760
TabIndex = 14
Top = 4320
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "確 定"
Height = 375
Left = 1320
TabIndex = 13
Top = 4320
Width = 1215
End
Begin VB.Frame Frame1
Caption = "運營信息"
Height = 3735
Left = 240
TabIndex = 0
Top = 240
Width = 3975
Begin VB.TextBox txtitem
Height = 375
Index = 3
Left = 1320
TabIndex = 12
Top = 3120
Width = 2415
End
Begin VB.TextBox txtitem
Height = 375
Index = 2
Left = 1320
TabIndex = 11
Top = 2520
Width = 2415
End
Begin VB.TextBox txtitem
Height = 375
Index = 1
Left = 1320
TabIndex = 10
Top = 1920
Width = 2415
End
Begin VB.TextBox txtitem
Height = 375
Index = 0
Left = 1320
TabIndex = 9
Top = 1320
Width = 2415
End
Begin VB.ComboBox Cobdriver
Height = 300
Left = 1320
TabIndex = 8
Top = 840
Width = 2415
End
Begin VB.ComboBox Cobid
Height = 300
Left = 1320
TabIndex = 7
Top = 360
Width = 2415
End
Begin VB.Label Label6
Caption = "各項開支(元):"
Height = 255
Left = 120
TabIndex = 6
Top = 3240
Width = 1335
End
Begin VB.Label Label5
Caption = "行程(公里):"
Height = 255
Left = 120
TabIndex = 5
Top = 2640
Width = 1095
End
Begin VB.Label Label4
Caption = "結(jié)束時間:"
Height = 375
Left = 120
TabIndex = 4
Top = 2040
Width = 975
End
Begin VB.Label Label3
Caption = "開始時間:"
Height = 375
Left = 120
TabIndex = 3
Top = 1440
Width = 975
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "司 機:"
Height = 255
Left = 120
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "牌 照:"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "Frmstatistic"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim txtchange As Boolean '標志修改時內(nèi)容是否已經(jīng)被修改
Dim mrc As ADODB.Recordset
Public txtsql As String
Private Sub cmdcancel_Click()
If gintsMode = 2 Then
If txtchange And CmdOK.Enabled Then
If MsgBox("數(shù)據(jù)已經(jīng)修改,是否保存修改?", vbOKCancel + vbExclamation, "警告") = vbOK Then
Call cmdok_Click
End If
End If
End If
Unload Me
End Sub
Private Sub cmdok_Click()
Dim txtcount As Integer
Dim tmsg As String
Dim msgtext As String
If cobid.Text = "" Then
MsgBox "車輛牌照不能為空,請選擇車輛牌照", vbOKOnly + vbExclamation, "警告"
cobid.SetFocus
Exit Sub
End If
If Cobdriver.Text = "" Then
MsgBox "司機姓名不能為空,請選擇司機名稱", vbOKOnly + vbExclamation, "警告"
Cobdriver.SetFocus
Exit Sub
End If
For txtcount = 0 To 1
If Trim(txtitem(txtcount)) = "" Then
MsgBox "運營的開始和結(jié)束時間不能為空", vbOKOnly + vbExclamation, "警告"
txtitem(txtcount).SetFocus
Exit Sub
If Not IsDate(txtitem(txtcount)) Then
MsgBox "請輸入時間格式:yyyy-mm-dd !", vbOKOnly + vbExclamation, "警告"
txtitem(txtcount).SetFocus
Exit Sub
Else
txtitem(txtcount) = Format(txtitem(txtcount), "yyyy-mm-dd")
End If
End If
Next txtcount
' If Trim(txtitem(2) & "") = "" Then
' txtitem(2) = Null
' Else
If Not IsNumeric(txtitem(2)) Then
MsgBox "對不起,您輸入的不是數(shù)據(jù),請重新輸入 !", vbOKOnly + vbExclamation, "警告"
txtitem(2).SetFocus
Exit Sub
' End If
End If
' If Trim(txtitem(3) & "") = "" Then
' txtitem(3) = Null
' Else
If Not IsNumeric(txtitem(3)) Then
MsgBox "對不起,您輸入的不是數(shù)據(jù),請重新輸入 !", vbOKOnly + vbExclamation, "警告"
txtitem(3).SetFocus
Exit Sub
' End If
End If
If gintsMode = 1 Then
txtsql = "select * from statistic"
Set mrc = ExecuteSQL(txtsql, msgtext)
mrc.AddNew
mrc.Fields(0) = Trim(cobid.Text)
mrc.Fields(1) = Trim(Cobdriver.Text)
For txtcount = 0 To 3
mrc.Fields(txtcount + 2) = Trim(txtitem(txtcount))
Next txtcount
mrc.Update
mrc.Close
MsgBox "添加運營信息成功,按確定繼續(xù)添加", vbOKOnly + vbExclamation, "添加"
End If
If gintsMode = 2 Then
'txtsql = "delete from statistic where yy_id='" & Trim(cobid.Text) & "' and yy_bdate='" & txtitem(0) & "'"
txtsql = "delete from statistic where yy_id='" & Trim(frmstatisticlist.msglist.TextMatrix(frmstatisticlist.msglist.Row, 1)) & "' and yy_bdate='" & Trim(frmstatisticlist.msglist.TextMatrix(frmstatisticlist.msglist.Row, 3)) & "'"
ExecuteSQL txtsql, msgtext
txtsql = "select * from statistic"
Set mrc = ExecuteSQL(txtsql, msgtext)
mrc.AddNew
mrc.Fields(0) = Trim(cobid.Text)
mrc.Fields(1) = Trim(Cobdriver.Text)
For txtcount = 0 To 3
mrc.Fields(txtcount + 2) = Trim(txtitem(txtcount))
Next txtcount
mrc.Update
mrc.Close
MsgBox "修改信息成功", vbOKOnly + vbExclamation, "修改"
flagsEdit = True
End If
If gintsMode = 1 Then
cobid.Text = ""
Cobdriver.Text = ""
For txtcount = 0 To 3
txtitem(txtcount) = ""
Next txtcount
End If
If gintsMode = 2 Then
Unload Me
If flagsEdit Then
Unload frmstatisticlist
End If
frmstatisticlist.txtsql = "" '重新載入數(shù)據(jù)
frmstatisticlist.Show
End If
End Sub
Private Sub Cobdriver_Change()
txtchange = True
End Sub
Private Sub cobid_Change()
txtchange = True
End Sub
Private Sub Form_Load()
Dim txtcount As Integer
Dim msgtext As String
Me.Left = 5310
Me.Top = 1695
If gintsMode = 1 Then
Me.Caption = Me.Caption & "添加"
txtsql = "select DISTINCT cl_id from vehicle"
'txtsql = "select * from vehicle"
Set mrc = ExecuteSQL(txtsql, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cobid.AddItem Trim(mrc!cl_id)
'Cobdriver.AddItem Trim(mrc!yy_driver)
mrc.MoveNext
Loop
'Cobid.ListIndex = 0
End If
' mrc.Close
txtsql = "select DISTINCT sj_name from driver"
Set mrc = ExecuteSQL(txtsql, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
Cobdriver.AddItem Trim(mrc!sj_name)
'Cobdriver.AddItem Trim(mrc!yy_driver)
mrc.MoveNext
Loop
' Cobdriver.ListIndex = 0
End If
'' Else
'' MsgBox "無任何運營信息", vbOKOnly + vbExclamation, "警告"
'' cmdok.Enabled = False
'' Exit Sub
''End If
mrc.Close
End If
If gintsMode = 2 Then
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
With mrc
If (.Fields(0) & "") <> "" Then
cobid.Text = .Fields(0)
End If
If (.Fields(1) & "") <> "" Then
Cobdriver.Text = .Fields(1)
End If
For txtcount = 0 To 3
If (.Fields(txtcount + 2) & "") <> "" Then
txtitem(txtcount) = .Fields(txtcount + 2)
End If
Next txtcount
End With
' Cobid.Enabled = False
End If
mrc.Close
Me.Caption = Me.Caption & "修改"
' End If
txtsql = "select DISTINCT cl_id from vehicle"
'txtsql = "select * from vehicle"
Set mrc = ExecuteSQL(txtsql, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cobid.AddItem Trim(mrc!cl_id)
'Cobdriver.AddItem Trim(mrc!yy_driver)
mrc.MoveNext
Loop
'Cobid.ListIndex = 0
End If
' mrc.Close
txtsql = "select DISTINCT sj_name from driver"
Set mrc = ExecuteSQL(txtsql, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
Cobdriver.AddItem Trim(mrc!sj_name)
'Cobdriver.AddItem Trim(mrc!yy_driver)
mrc.MoveNext
Loop
'' Cobdriver.ListIndex = 0
End If
mrc.Close
txtchange = False
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
txtchange = True
End Sub
Private Sub txtitem_Change(Index As Integer)
txtchange = True
End Sub
Private Sub txtitem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -