⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainwin.frm

📁 汽车维修管理软件。其中包含三个编辑控件。
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.MDIForm MainWin 
   BackColor       =   &H80000009&
   ClientHeight    =   6210
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   9270
   Picture         =   "MainWin.frx":0000
   StartUpPosition =   3  '窗口缺省
   WindowState     =   2  'Maximized
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   5835
      Width           =   9270
      _ExtentX        =   16351
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin VB.Menu FILS 
      Caption         =   "文件(&F)"
      Begin VB.Menu FILE_LOGON 
         Caption         =   "重新注册"
      End
      Begin VB.Menu FILE_LINE1 
         Caption         =   "-"
      End
      Begin VB.Menu FILE_NEWDATA 
         Caption         =   "新建年度数据"
      End
      Begin VB.Menu FILE_LINE2 
         Caption         =   "-"
      End
      Begin VB.Menu EXITSYSTEM 
         Caption         =   "退出"
      End
   End
   Begin VB.Menu EDITDOC 
      Caption         =   "设置(&E)"
      Begin VB.Menu INV_DOC 
         Caption         =   "存货配件档案"
      End
      Begin VB.Menu REP_DOC 
         Caption         =   "维修项目档案"
      End
      Begin VB.Menu EMP_DOC 
         Caption         =   "维修人员档案"
      End
   End
   Begin VB.Menu WORK 
      Caption         =   "维修情况(&W)"
      Begin VB.Menu WORK_REPAIR 
         Caption         =   "维修车辆及维修项目录入"
      End
      Begin VB.Menu WORK_RESET_END 
         Caption         =   "取消完工"
      End
   End
   Begin VB.Menu VIEW_PRINT 
      Caption         =   "业务查询及打印(&V)"
      Begin VB.Menu VIEW_PRINT_REPSUM 
         Caption         =   "维修业务汇总"
      End
      Begin VB.Menu VIEW_PRINT_INVSUM 
         Caption         =   "存货出库汇总"
      End
      Begin VB.Menu VIEW_LINE1 
         Caption         =   "-"
      End
      Begin VB.Menu VIEW_PRINT_INVSUB 
         Caption         =   "存货出库明细帐"
      End
   End
   Begin VB.Menu COUNT 
      Caption         =   "维修提成计算(&C)"
   End
   Begin VB.Menu HELP 
      Caption         =   "帮助(&H)"
      Begin VB.Menu HELP_ABOUT 
         Caption         =   "关于"
      End
   End
End
Attribute VB_Name = "MainWin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public WithEvents m_InvViwe As InputView
Attribute m_InvViwe.VB_VarHelpID = -1
Public WithEvents m_RepViwe As InputView
Attribute m_RepViwe.VB_VarHelpID = -1
Public WithEvents m_WorkView As WorkView
Attribute m_WorkView.VB_VarHelpID = -1
Public WithEvents m_EmpInput As EmpInput
Attribute m_EmpInput.VB_VarHelpID = -1

Private Sub EMP_DOC_Click()
If m_EmpInput Is Nothing Then
   Set m_EmpInput = New EmpInput
   m_EmpInput.Show
End If
End Sub

Private Sub EXITSYSTEM_Click()
Unload Me
End
End Sub

Private Sub FILE_LOGON_Click()

Dim t_logonDlg As LogonDlg
Set t_logonDlg = New LogonDlg
If t_logonDlg.DoModal() = ReturnCode.RC_OK Then
   g_Provider = "Microsoft.Jet.OLEDB.4.0"

   g_DataSource = App.Path & "\" & t_logonDlg.DataName
   Set g_Conn = New ADODB.Connection
   With g_Conn
        .Provider = g_Provider
        .CommandTimeout = 7
        .ConnectionTimeout = 10
        .Open g_DataSource
   End With
   
   Set t_logonDlg = Nothing
   If Not (m_InvViwe Is Nothing) Then Unload m_InvViwe
   If Not (m_RepViwe Is Nothing) Then Unload m_RepViwe
   If Not (m_WorkView Is Nothing) Then Unload m_WorkView
   If Not (m_EmpInput Is Nothing) Then Unload m_EmpInput
   MainWin.Show
Else
   Unload Me
   Set t_logonDlg = Nothing
End If
End Sub

Private Sub FILE_NEWDATA_Click()
Dim t_conn As ADODB.Connection
Dim NewConn As ADODB.Connection
Dim re As ADODB.Recordset
Dim t_Year As Long
Dim newRe As ADODB.Recordset
Set t_conn = New ADODB.Connection
Set re = New ADODB.Recordset
With t_conn
        .Provider = g_Provider
        .CommandTimeout = 7
        .ConnectionTimeout = 10
        .Open App.Path & "\CMSystem.mdb"
End With
Set re = t_conn.Execute("SELECT MAX(mYear) FROM DataYear")
If Not (re.BOF And re.EOF) Then
   t_Year = re.Fields(0).Value
   
   If MsgBox("是否确实要建立" & CStr(t_Year + 1) & "年度数据", vbInformation Or vbOKCancel, "") = vbOK Then
      Load ProgressWin
      ProgressWin.Show , Me
      FileCopy App.Path & "\DataModel.mdb", App.Path & "\Data" & CStr(t_Year + 1) & ".mdb"
      ProgressWin.Value = 10
      
      t_conn.Close
      t_conn.Open App.Path & "\Data" & CStr(t_Year) & ".mdb"
      Set re = t_conn.Execute("SELECT * FROM InvType")
      Set NewConn = New ADODB.Connection
      With NewConn
          .Provider = g_Provider
          .CommandTimeout = 7
          .ConnectionTimeout = 10
          .Open App.Path & "\Data" & CStr(t_Year + 1) & ".mdb"
      End With
   
      Set newRe = New ADODB.Recordset
      newRe.CursorLocation = adUseClient
      newRe.Open "SELECT * FROM InvType", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 20
      Set re = t_conn.Execute("SELECT * FROM Employees")
      newRe.Close
      newRe.Open "SELECT * FROM Employees", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Fields(2).Value = re.Fields(2).Value
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 30
      Set re = t_conn.Execute("SELECT * FROM Inventory")
      newRe.Close
      newRe.Open "SELECT * FROM Inventory", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Fields(2).Value = re.Fields(2).Value
         newRe.Fields(3).Value = re.Fields(3).Value
         newRe.Fields(4).Value = re.Fields(4).Value
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 40
      Set re = t_conn.Execute("SELECT * FROM RepairItem")
      newRe.Close
      newRe.Open "SELECT * FROM RepairItem", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Fields(2).Value = re.Fields(2).Value
         newRe.Fields(3).Value = re.Fields(3).Value
         
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 50
      Set re = t_conn.Execute("SELECT * FROM WorkMain WHERE EndFlag=FALSE")
'复制未完工数据
      newRe.Close
      newRe.Open "SELECT * FROM WorkMain", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Fields(2).Value = re.Fields(2).Value
         newRe.Fields(3).Value = re.Fields(3).Value
         newRe.Fields(4).Value = re.Fields(4).Value
         newRe.Fields(5).Value = re.Fields(5).Value
         newRe.Fields(6).Value = re.Fields(6).Value
         newRe.Fields(7).Value = re.Fields(7).Value
         newRe.Fields(8).Value = re.Fields(8).Value
         newRe.Fields(9).Value = re.Fields(9).Value
         newRe.Fields(10).Value = re.Fields(10).Value
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 70
      Set re = t_conn.Execute("SELECT * FROM WorkSub_1 WHERE MainId IN (SELECT AutoId FROM WorkMain WHERE EndFlag=FALSE)")
      newRe.Close
      newRe.Open "SELECT * FROM WorkSub_1", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Fields(2).Value = re.Fields(2).Value
         newRe.Fields(3).Value = re.Fields(3).Value
         newRe.Fields(4).Value = re.Fields(4).Value
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 80
      Set re = t_conn.Execute("SELECT * FROM WorkSub_2 WHERE MainId IN (SELECT AutoId FROM WorkMain WHERE EndFlag=FALSE)")
      newRe.Close
      newRe.Open "SELECT * FROM WorkSub_2", NewConn, adOpenDynamic, adLockOptimistic
      While Not re.EOF
         newRe.AddNew
         newRe.Fields(0).Value = re.Fields(0).Value
         newRe.Fields(1).Value = re.Fields(1).Value
         newRe.Fields(2).Value = re.Fields(2).Value
         newRe.Fields(3).Value = re.Fields(3).Value
         newRe.Fields(4).Value = re.Fields(4).Value
         newRe.Fields(5).Value = re.Fields(5).Value
         newRe.Update
         re.MoveNext
      Wend
      ProgressWin.Value = 90
      t_conn.Close
      Set NewConn = Nothing
      t_conn.Open App.Path & "\CMSystem.mdb"
   '  MsgBox "INSERT INTO DataYear (mYear) VALUES ('" & CStr(t_Year + 1) & "')"
      t_conn.Execute "INSERT INTO DataYear (mYear) VALUES ('" & CStr(t_Year + 1) & "')", , adExecuteNoRecords
       
      Set newRe = Nothing
      ProgressWin.Value = 100
      Unload ProgressWin
      MsgBox "年度数据建立成功", vbInformation Or vbOKOnly, "信息"
    End If
End If
Set re = Nothing
Set t_conn = Nothing
End Sub

Private Sub HELP_ABOUT_Click()
Dim dlg As frmAbout
Set dlg = New frmAbout
dlg.Show vbModal
Set dlg = Nothing
End Sub

Private Sub INV_DOC_Click()
Dim InputDlg As InventoryDlg
If m_InvViwe Is Nothing Then
   Set InputDlg = New InventoryDlg
   Set m_InvViwe = New InputView
   m_InvViwe.ShowViwe InputDlg, _
   "SELECT a.Code as 编号,a.Name as 名称,a.Unit as 单位,b.TypeName as 类型 FROM Inventory as a ,InvType as b WHERE b.Id=a.Type"
End If
End Sub


Private Sub m_EmpInput_EndWindow()
Set m_EmpInput = Nothing
End Sub

Private Sub m_InvViwe_EndWindow()
If Not m_InvViwe Is Nothing Then
   Set m_InvViwe = Nothing
End If
End Sub

Private Sub m_RepViwe_EndWindow()
If Not m_RepViwe Is Nothing Then
   Set m_RepViwe = Nothing
End If
End Sub

Private Sub m_WorkView_EndWindow()
If Not m_WorkView Is Nothing Then
   Set m_WorkView = Nothing
End If
End Sub

'类型= CASE
'WHEN 0 THEN '主料' WHEN 1 THEN '附料' END
Private Sub MDIForm_Load()

End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
Set g_Conn = Nothing
End Sub

Private Sub REP_DOC_Click()
Dim InputDlg As RepairDlg
If m_RepViwe Is Nothing Then
   Set InputDlg = New RepairDlg
   Set m_RepViwe = New InputView
   m_RepViwe.ShowViwe InputDlg, _
        "SELECT Code as 维修编号,Name as 维修名称, Rate as 提成比例 FROM RepairItem"
End If
End Sub

Private Sub WORK_REPAIR_Click()
If m_WorkView Is Nothing Then
   Set m_WorkView = New WorkView
   m_WorkView.Show
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -