📄 workview.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form WorkView
Caption = "维修车辆及维修项目录入"
ClientHeight = 6135
ClientLeft = 60
ClientTop = 345
ClientWidth = 6660
MDIChild = -1 'True
ScaleHeight = 6135
ScaleWidth = 6660
WindowState = 2 'Maximized
Begin MSComctlLib.Toolbar Toolbar
Align = 1 'Align Top
Height = 630
Left = 0
TabIndex = 0
Top = 0
Width = 6660
_ExtentX = 11748
_ExtentY = 1111
ButtonWidth = 820
ButtonHeight = 953
AllowCustomize = 0 'False
Appearance = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 10
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "预览"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 4
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "增加"
ImageIndex = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
ImageIndex = 4
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
ImageIndex = 5
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 4
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "过滤"
ImageIndex = 6
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 4
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSComctlLib.ImageList ImageList
Left = 0
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 15
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 6
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "WorkView.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "WorkView.frx":0542
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "WorkView.frx":0A84
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "WorkView.frx":0FC6
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "WorkView.frx":1418
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "WorkView.frx":152A
Key = ""
EndProperty
EndProperty
End
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 5415
Left = 0
TabIndex = 1
Top = 600
Width = 6615
_ExtentX = 11668
_ExtentY = 9551
_Version = 393216
FixedCols = 0
BackColorFixed = -2147483639
BackColorBkg = 16777215
AllowBigSelection= 0 'False
FocusRect = 2
SelectionMode = 1
AllowUserResizing= 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Attribute VB_Name = "WorkView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Event EndWindow()
Private m_CommandText As String
Private m_TableData As ADODB.Recordset
Private WithEvents Dlg As WorkDlg
Attribute Dlg.VB_VarHelpID = -1
Private Sub dlg_ChangeSum(ByVal Id As Long, ByVal sum As Double)
Dim i As Long
For i = 1 To Grid.Rows - 1
If CStr(Id) = Grid.TextMatrix(i, 0) Then
Grid.TextMatrix(i, 8) = FormatNumber(sum)
Exit For
End If
Next i
End Sub
Private Sub dlg_Update()
RefreshReCode
DrawTable
'Grid.FillStyle = flexFillRepeat
'Grid.CellAlignment = 4
ShowData
End Sub
Private Sub Form_Load()
m_CommandText = "SELECT w.AutoId as 单据号,w.CarCode as 车号,w.CarType as 车型,w.Company as 送修单位,w.Phone as 电话," _
& "w.StartDate as 送修日期,w.EndDate as 完工日期,e.Name as 维修人员,w.RepairSum as 维修金额,w.InventorySum as 耗用存货金额" _
& " FROM WorkMain as w,Employees as e WHERE w.EmpId=e.AutoId AND EndFlag=0"
'MsgBox m_CommandText
'Exit Sub
RefreshReCode
DrawTable
ShowData
End Sub
Private Sub Form_Resize()
Grid.Top = Toolbar.Height + 10
Grid.Height = Me.Height - Toolbar.Top - 1050
Grid.Width = Me.Width - 120
Grid.Left = 5
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_TableData = Nothing
RaiseEvent EndWindow
End Sub
Private Sub Grid_DblClick()
Set Dlg = New WorkDlg
Dlg.DoModal PM_EDIT, "AutoId=" & Trim$(Grid.TextMatrix(Grid.Row, 0))
Set Dlg = Nothing
End Sub
Private Sub Toolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Case 2
' PrintViwe
Case 4 'Add
Set Dlg = New WorkDlg
Dlg.DoModal PM_ADD
Case 5 'Edit
Set Dlg = New WorkDlg
Dlg.DoModal PM_EDIT, "AutoId=" & Trim$(Grid.TextMatrix(Grid.Row, 0))
Case 6 'Delete
' Case 8 'Find
Case 10 'Exit
Unload Me
End Select
Set Dlg = Nothing
End Sub
Private Sub DrawTable()
Dim i As Integer
Grid.Cols = m_TableData.Fields.COUNT
Grid.Rows = 1
Grid.Row = 0
Grid.RowHeight(0) = 400
For i = 0 To m_TableData.Fields.COUNT - 1
Grid.ColAlignment(i) = 5
Grid.Col = i
Grid.Text = m_TableData.Fields(i).Name
Next i
End Sub
Private Sub ShowData()
Dim X As Long, Y As Long
Dim DataText As String
If Not (m_TableData.BOF And m_TableData.EOF) Then
m_TableData.MoveFirst
End If
Y = 1
While Not m_TableData.EOF
Grid.Rows = Y + 1
' Grid.Row = y
For X = 0 To m_TableData.Fields.COUNT - 1
If IsNumeric(m_TableData.Fields(X).Value) Then
If m_TableData.Fields(X).Type = adDouble Then
DataText = FormatNumber(m_TableData.Fields(X).Value)
Else
DataText = CStr(m_TableData.Fields(X).Value)
End If
Else
DataText = m_TableData.Fields(X).Value
End If
' Grid.Col = x
' Grid.CellAlignment = vbAlignLeft ' Or vbAlignBottom
Grid.TextMatrix(Y, X) = DataText
If Grid.ColWidth(X) < TextWidth(DataText) Then Grid.ColWidth(X) = TextWidth(DataText) + 1000
' MsgBox TextWidth(DataText)
Next X
m_TableData.MoveNext
Y = Y + 1
Wend
End Sub
Private Sub RefreshReCode()
If g_Conn Is Nothing Then
Set g_Conn = New ADODB.Connection
With g_Conn
.Provider = g_Provider
.CommandTimeout = 7
.ConnectionTimeout = 10
.Open g_DataSource
End With
End If
If g_Conn.State = adStateClosed Then
g_Conn.Open g_DataSource
End If
Set m_TableData = g_Conn.Execute(m_CommandText)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -