www.pudn.com > netserver.zip > frmKeHuGL.frm


VERSION 5.00 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Begin VB.Form frmKeHuGL  
   Caption         =   "客户管理" 
   ClientHeight    =   4650 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   9210 
   Icon            =   "frmKeHuGL.frx":0000 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4650 
   ScaleWidth      =   9210 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.PictureBox Picture1  
      BorderStyle     =   0  'None 
      Height          =   615 
      Left            =   720 
      ScaleHeight     =   615 
      ScaleWidth      =   6855 
      TabIndex        =   1 
      Top             =   3840 
      Width           =   6855 
      Begin VB.CommandButton Command5  
         Caption         =   "关闭窗口" 
         Height          =   375 
         Left            =   5400 
         TabIndex        =   29 
         Top             =   120 
         Width           =   1095 
      End 
      Begin VB.CommandButton Command1  
         Caption         =   "添加客户" 
         Height          =   375 
         Left            =   120 
         TabIndex        =   5 
         Top             =   120 
         Width           =   1095 
      End 
      Begin VB.CommandButton Command2  
         Caption         =   "修改客户" 
         Height          =   375 
         Left            =   1440 
         TabIndex        =   4 
         Top             =   120 
         Width           =   1095 
      End 
      Begin VB.CommandButton Command3  
         Caption         =   "删除用户" 
         Height          =   375 
         Left            =   2760 
         TabIndex        =   3 
         Top             =   120 
         Width           =   1095 
      End 
      Begin VB.CommandButton Command4  
         Caption         =   "保存设置" 
         Enabled         =   0   'False 
         Height          =   375 
         Left            =   4080 
         TabIndex        =   2 
         Top             =   120 
         Width           =   1095 
      End 
   End 
   Begin MSComctlLib.ListView ListView1  
      Height          =   1815 
      Left            =   6000 
      TabIndex        =   0 
      Top             =   3000 
      Width           =   3735 
      _ExtentX        =   6588 
      _ExtentY        =   3201 
      View            =   3 
      LabelEdit       =   1 
      LabelWrap       =   -1  'True 
      HideSelection   =   -1  'True 
      FullRowSelect   =   -1  'True 
      GridLines       =   -1  'True 
      _Version        =   393217 
      ForeColor       =   -2147483640 
      BackColor       =   -2147483643 
      BorderStyle     =   1 
      Appearance      =   1 
      NumItems        =   11 
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         Text            =   "编号" 
         Object.Width           =   1658 
      EndProperty 
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   1 
         Text            =   "客户姓名" 
         Object.Width           =   1658 
      EndProperty 
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   2 
         Text            =   "证件" 
         Object.Width           =   1482 
      EndProperty 
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   3 
         Text            =   "证件号码" 
         Object.Width           =   2540 
      EndProperty 
      BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   4 
         Text            =   "电话" 
         Object.Width           =   1658 
      EndProperty 
      BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   5 
         Text            =   "呼机" 
         Object.Width           =   1658 
      EndProperty 
      BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   6 
         Text            =   "手机" 
         Object.Width           =   1834 
      EndProperty 
      BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   7 
         Text            =   "E-Mail" 
         Object.Width           =   2540 
      EndProperty 
      BeginProperty ColumnHeader(9) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   8 
         Text            =   "消费额" 
         Object.Width           =   1658 
      EndProperty 
      BeginProperty ColumnHeader(10) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   9 
         Text            =   "消费次数" 
         Object.Width           =   1658 
      EndProperty 
      BeginProperty ColumnHeader(11) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   10 
         Text            =   "最后一次时间" 
         Object.Width           =   2540 
      EndProperty 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "修改客户资料:" 
      Height          =   3495 
      Left            =   120 
      TabIndex        =   6 
      Top             =   120 
      Visible         =   0   'False 
      Width           =   9015 
      Begin VB.TextBox Text1  
         BackColor       =   &H80000003& 
         Height          =   270 
         Index           =   9 
         Left            =   6120 
         Locked          =   -1  'True 
         TabIndex        =   28 
         Top             =   2280 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   7 
         Left            =   6120 
         TabIndex        =   27 
         Top             =   1680 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   6 
         Left            =   1440 
         TabIndex        =   26 
         Top             =   1680 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   5 
         Left            =   6120 
         TabIndex        =   25 
         Top             =   1200 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   4 
         Left            =   1440 
         TabIndex        =   24 
         Top             =   1200 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   3 
         Left            =   6120 
         TabIndex        =   23 
         Top             =   720 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   2 
         Left            =   1440 
         TabIndex        =   22 
         Top             =   720 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         BackColor       =   &H80000003& 
         Height          =   270 
         Index           =   0 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   21 
         Top             =   360 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         Height          =   270 
         Index           =   1 
         Left            =   6120 
         TabIndex        =   20 
         Top             =   360 
         Width           =   2655 
      End 
      Begin VB.TextBox Text1  
         BackColor       =   &H80000003& 
         Height          =   270 
         Index           =   10 
         Left            =   2040 
         Locked          =   -1  'True 
         TabIndex        =   19 
         Top             =   2880 
         Width           =   2055 
      End 
      Begin VB.TextBox Text1  
         BackColor       =   &H80000003& 
         Height          =   270 
         Index           =   8 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   18 
         Top             =   2280 
         Width           =   2655 
      End 
      Begin VB.Label Label11  
         Caption         =   "最后一次上机时间:" 
         Height          =   375 
         Left            =   360 
         TabIndex        =   17 
         Top             =   2880 
         Width           =   1935 
      End 
      Begin VB.Label Label10  
         Caption         =   "消费次数:" 
         Height          =   375 
         Left            =   5040 
         TabIndex        =   16 
         Top             =   2280 
         Width           =   1215 
      End 
      Begin VB.Label Label9  
         Caption         =   "总消费额:" 
         Height          =   375 
         Left            =   360 
         TabIndex        =   15 
         Top             =   2280 
         Width           =   1095 
      End 
      Begin VB.Label Label8  
         Caption         =   "E-Mail" 
         Height          =   375 
         Left            =   5040 
         TabIndex        =   14 
         Top             =   1800 
         Width           =   1095 
      End 
      Begin VB.Label Label7  
         Caption         =   "手机:" 
         Height          =   375 
         Left            =   360 
         TabIndex        =   13 
         Top             =   1800 
         Width           =   735 
      End 
      Begin VB.Label Label6  
         Caption         =   "呼机:" 
         Height          =   255 
         Left            =   5040 
         TabIndex        =   12 
         Top             =   1320 
         Width           =   975 
      End 
      Begin VB.Label Label5  
         Caption         =   "电话:" 
         Height          =   375 
         Left            =   360 
         TabIndex        =   11 
         Top             =   1320 
         Width           =   1095 
      End 
      Begin VB.Label Label4  
         Caption         =   "证件编号:" 
         Height          =   375 
         Left            =   5040 
         TabIndex        =   10 
         Top             =   840 
         Width           =   975 
      End 
      Begin VB.Label Label3  
         Caption         =   "证件名称:" 
         Height          =   375 
         Left            =   360 
         TabIndex        =   9 
         Top             =   840 
         Width           =   1095 
      End 
      Begin VB.Label Label2  
         Caption         =   "客户姓名:" 
         Height          =   375 
         Left            =   5040 
         TabIndex        =   8 
         Top             =   360 
         Width           =   1095 
      End 
      Begin VB.Label Label1  
         Caption         =   "客户编号:" 
         Height          =   255 
         Left            =   360 
         TabIndex        =   7 
         Top             =   360 
         Width           =   1095 
      End 
   End 
End 
Attribute VB_Name = "frmKeHuGL" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click() 
On Error Resume Next 
If Command1.Caption = "放弃添加" Then 
 ListView1.Visible = True 
 Frame1.Visible = False 
 Command2.Enabled = True 
 Command3.Enabled = True 
 Command4.Enabled = False 
 Command1.Caption = "添加客户" 
 Exit Sub 
End If 
Command2.Enabled = False 
'ListView1.Visible = False 
Frame1.Visible = True 
ListView1.Visible = False 
With frmMain.Data9.Recordset 
 
Dim anum As Long, olda As Long, findIt As Boolean 
olda = .AbsolutePosition 
 
anum = 0 
Do 
 findIt = False 
 anum = anum + 1 
 .MoveFirst 
 For i = 1 To .RecordCount 
  If Val(.Fields("编号")) = anum Then findIt = True 
  
 .MoveNext 
 Next i 
 If findIt = False Then Exit Do 
Loop 
Text1(0).Text = CStr(anum) 
For i = 1 To 8 - Len(CStr(anum)) 
 Text1(0).Text = "0" + Text1(0).Text 
Next i 
.MoveFirst 
.Move olda 
End With 
For i = 1 To 10 
Text1(i).Text = "" 
Next i 
Text1(1).SetFocus 
Command1.Caption = "放弃添加" 
Command3.Enabled = False 
Command4.Enabled = False 
End Sub 
 
Private Sub Command2_Click() 
If Command2.Caption = "放弃修改" Then 
 ListView1.Visible = True 
 Frame1.Visible = False 
 Command4.Enabled = False 
 Command1.Enabled = True 
 Command3.Enabled = True 
 Command2.Caption = "修改客户" 
  Else 
 Command1.Enabled = False 
 Command3.Enabled = False 
 Command4.Enabled = False 
 Command2.Caption = "放弃修改" 
 ListView1.Visible = False 
 Frame1.Visible = True 
End If 
End Sub 
 
Private Sub Command3_Click() 
'删除客户 
On Error Resume Next 
With frmMain.Data9.Recordset 
  .MoveFirst 
  .Move ListView1.SelectedItem.Index - 1 
  frmMain.Data6.Recordset.MoveFirst 
  For i = 1 To frmMain.Data6.Recordset.RecordCount 
    If .Fields("编号") = frmMain.Data6.Recordset.Fields("客户编号") Then 
     MsgBox "不能删除当前客户,因为还有该客户还有储金卡!", vbCritical 
     Exit Sub 
    End If 
    frmMain.Data6.Recordset.MoveNext 
  Next i 
  If MsgBox("确定要删除客户:" & .Fields("编号"), vbQuestion + vbOKCancel) = vbOK Then 
   .Delete 
   Form_Load 
  End If 
 
 
End With 
End Sub 
 
Private Sub Command4_Click() 
'保存设置 
On Error Resume Next 
With frmMain.Data9.Recordset 
  .MoveFirst 
  .Move ListView1.SelectedItem.Index - 1 
  If Command1.Caption = "放弃添加" Then 
    .AddNew 
    Command1.Caption = "添加客户" 
    Else 
    Command2.Caption = "修改客户" 
    .Edit 
  End If 
  For i = 0 To 7 
   .Fields(i) = Text1(i).Text 
  Next i 
  .Update 
  Form_Load 
  ListView1.Visible = True 
  Frame1.Visible = False 
  Command1.Enabled = True 
  Command2.Enabled = True 
  Command3.Enabled = True 
End With 
End Sub 
 
Private Sub Command5_Click() 
Unload Me 
End Sub 
 
Private Sub Form_Load() 
On Error Resume Next 
ListView1.ListItems.Clear 
With frmMain.Data9.Recordset 
 .MoveFirst 
 For i = 1 To .RecordCount 
    ListView1.ListItems.Add i, , .Fields(0) 
       
      For j = 1 To 9 
       ListView1.ListItems(i).SubItems(j) = .Fields(j) 
      Next j 
       ListView1.ListItems(i).SubItems(10) = Format(.Fields(10), "yyyy年m月d日hh:nn") 
   .MoveNext 
 Next i 
End With 
ListView1_ItemClick ListView1.ListItems(1) 
End Sub 
 
Private Sub Form_Resize() 
On Error Resume Next 
ListView1.Move 30, 10, Me.Width - 150, Me.Height - 1200 
Picture1.Top = ListView1.Top + ListView1.Height + 100 
Picture1.Left = (Me.Width - Picture1.Width) / 2 
 
End Sub 
 
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem) 
On Error Resume Next 
With frmMain.Data9.Recordset 
    .MoveFirst 
    .Move Item.Index - 1 
    For i = 0 To 9 
      Text1(i).Text = .Fields(i) 
     
    Next i 
   Text1(10).Text = Format(.Fields(10), "yyyy年m月d日hh:nn") 
 
End With 
End Sub 
 
Private Sub Text1_Change(Index As Integer) 
Command4.Enabled = True 
End Sub