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

📄 frmcjkgl.frm

📁 包含网吧管理服务器和客户端
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmCJKGL 
   Caption         =   "储金卡管理"
   ClientHeight    =   4740
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7035
   Icon            =   "frmCJKGL.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4740
   ScaleWidth      =   7035
   StartUpPosition =   2  '屏幕中心
   Begin VB.PictureBox Picture1 
      BorderStyle     =   0  'None
      Height          =   615
      Left            =   360
      ScaleHeight     =   615
      ScaleWidth      =   6615
      TabIndex        =   0
      Top             =   3840
      Width           =   6615
      Begin VB.CommandButton Command6 
         Caption         =   "关闭窗口"
         Height          =   375
         Left            =   5400
         TabIndex        =   26
         Top             =   120
         Width           =   1095
      End
      Begin VB.CommandButton Command4 
         Caption         =   "保存设置"
         Enabled         =   0   'False
         Height          =   375
         Left            =   4080
         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 Command2 
         Caption         =   "修改储金卡"
         Height          =   375
         Left            =   1440
         TabIndex        =   2
         Top             =   120
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "添加储金卡"
         Height          =   375
         Left            =   120
         TabIndex        =   1
         Top             =   120
         Width           =   1095
      End
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   1815
      Left            =   3600
      TabIndex        =   5
      Top             =   3600
      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        =   8
      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           =   1658
      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            =   "剩余金额"
         Object.Width           =   2540
      EndProperty
   End
   Begin VB.Frame Frame1 
      Caption         =   "修改储金卡:"
      Height          =   3255
      Left            =   120
      TabIndex        =   6
      Top             =   120
      Visible         =   0   'False
      Width           =   6855
      Begin VB.CommandButton Command5 
         Caption         =   "自动生成一个卡号"
         Height          =   375
         Left            =   3600
         TabIndex        =   25
         Top             =   360
         Width           =   1815
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   4560
         Locked          =   -1  'True
         Style           =   2  'Dropdown List
         TabIndex        =   24
         Top             =   1800
         Width           =   1575
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000003&
         Height          =   270
         Index           =   7
         Left            =   1440
         Locked          =   -1  'True
         TabIndex        =   23
         Top             =   2760
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000003&
         Height          =   270
         Index           =   6
         Left            =   4560
         Locked          =   -1  'True
         TabIndex        =   22
         Top             =   2280
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000003&
         Height          =   270
         Index           =   5
         Left            =   1440
         Locked          =   -1  'True
         TabIndex        =   21
         Top             =   2280
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000003&
         Height          =   270
         Index           =   4
         Left            =   1440
         Locked          =   -1  'True
         TabIndex        =   20
         Top             =   1800
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Index           =   3
         Left            =   1440
         TabIndex        =   19
         Top             =   1320
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Index           =   2
         Left            =   4560
         TabIndex        =   18
         Top             =   840
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Index           =   1
         Left            =   1440
         TabIndex        =   17
         Top             =   840
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H80000003&
         Height          =   270
         Index           =   0
         Left            =   1440
         Locked          =   -1  'True
         MaxLength       =   9
         TabIndex        =   16
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label9 
         Caption         =   "客户姓名:"
         Height          =   255
         Left            =   3600
         TabIndex        =   15
         Top             =   1800
         Width           =   1095
      End
      Begin VB.Label Label8 
         Caption         =   "剩余金额:"
         Height          =   255
         Left            =   240
         TabIndex        =   14
         Top             =   2760
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "上机次数:"
         Height          =   255
         Left            =   3600
         TabIndex        =   13
         Top             =   2280
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "已用机时:"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   2280
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "客户编号:"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1800
         Width           =   1335
      End
      Begin VB.Label Label4 
         Caption         =   "密码:"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   1320
         Width           =   1095
      End
      Begin VB.Label Label3 
         Caption         =   "总机时:"
         Height          =   375
         Left            =   3600
         TabIndex        =   9
         Top             =   840
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "总金额:"
         Height          =   375
         Left            =   240
         TabIndex        =   8
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "卡号:"
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmCJKGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
On Error Resume Next
With frmMain.Data9.Recordset
 .MoveFirst
 .Move Combo1.ItemData(Combo1.ListIndex)
 Text1(4).Text = .Fields("编号")
End With
End Sub

Private Sub Command1_Click()
 If Command1.Caption = "放弃添加" Then
 Combo1.Locked = True
 Command1.Caption = "添加储金卡"
 Command2.Enabled = True
 Command3.Enabled = True
 Command4.Enabled = False
 Command4.Enabled = False
 ListView1.Visible = True
 Frame1.Visible = False
 Command5.Enabled = False
 Else
 For i = 0 To 7
  Text1(i) = ""
 Next i
 Command1.Caption = "放弃添加"
 Command2.Enabled = False
 Command3.Enabled = False
 Command4.Enabled = False
 Command5.Enabled = True
 Combo1.Locked = False
 ListView1.Visible = False
 Frame1.Visible = True
 Command5.Enabled = True
 Command5_Click
 End If
End Sub

Private Sub Command2_Click()

If Command2.Caption = "放弃修改" Then
 ListView1.Visible = True
 Frame1.Visible = False
 Command2.Caption = "修改储金卡"
 Command1.Enabled = True
 Command3.Enabled = True
 Command4.Enabled = False
 Command5.Enabled = False
Else
 Command2.Caption = "放弃修改"
 ListView1.Visible = False
 Frame1.Visible = True
 Command1.Enabled = False
 Command3.Enabled = False
 Command4.Enabled = False
 Command5.Enabled = False
End If
End Sub

Private Sub Command3_Click()
'删除卡
On Error Resume Next
With frmMain.Data6.Recordset
 .MoveFirst
 .Move ListView1.SelectedItem.Index - 1
 If MsgBox("确定要删除当前卡吗?" & vbCrLf & "卡号" & .Fields("卡号"), vbQuestion + vbOKCancel) = vbOK Then
   .Delete
   Form_Load
 End If
End With
End Sub

Private Sub Command4_Click()
'保存
On Error Resume Next
With frmMain.Data6.Recordset
 .MoveFirst
 .Move ListView1.SelectedItem.Index - 1
    If Text1(4) = "" Or Text1(1) = "" Or Text1(2) = "" Or Text1(3) = "" Then
     MsgBox "你所添加的资料不全,请你确认输入!", vbCritical
     Exit Sub
    End If
   If Command1.Caption = "放弃添加" Then
      .AddNew
      Command1.Caption = "添加储金卡"
     Else
      Command2.Caption = "修改储金卡"
      .Edit
   End If
   For i = 0 To 4
     .Fields(i) = Text1(i)
   Next i
    .Fields(7) = Text1(7)
   .Update
    Form_Load
    ListView1.Visible = True
    Frame1.Visible = False
End With

     Command1.Enabled = True
     Command2.Enabled = True
     Command3.Enabled = True
     Command4.Enabled = False
     Command5.Enabled = False
     Combo1.Locked = True

End Sub

Private Sub Command5_Click()
'随机生成卡号
On Error Resume Next
Dim cardNum As Long, findIt As Boolean
With frmMain.Data6.Recordset
aa = .AbsolutePosition
findIt = True
Do
Randomize Timer
cardNum = Int(Rnd * 1000000000)
.MoveFirst
findIt = False
For i = 1 To .RecordCount
  If cardNum = Val(.Fields("卡号")) Then
   findIt = True
  End If
  .MoveNext
Next i
Loop While findIt = True

.MoveFirst
.Move aa
End With
Text1(0).Text = CStr(cardNum)


End Sub

Private Sub Command6_Click()
Unload Me
End Sub

Private Sub Form_Load()
On Error Resume Next
ListView1.ListItems.Clear
With frmMain.Data6.Recordset
 .MoveFirst
 For i = 1 To .RecordCount
    ListView1.ListItems.Add i, , .Fields(0)
      
      For j = 1 To 7
       ListView1.ListItems(i).SubItems(j) = .Fields(j)
      Next j
       ListView1.ListItems(i).SubItems(3) = "********"
   .MoveNext
 Next i
End With

With frmMain.Data9.Recordset
 .MoveFirst
 For i = 1 To .RecordCount
    Combo1.AddItem .Fields("客户姓名")
    Combo1.ItemData(Combo1.NewIndex) = .AbsolutePosition
   .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.Data6.Recordset
   .MoveFirst
   .Move Item.Index - 1
   For i = 0 To 7
     Text1(i) = .Fields(i)
   Next i
End With
With frmMain.Data9.Recordset
   .MoveFirst
 For i = 1 To .RecordCount
  If .Fields("编号") = frmMain.Data6.Recordset.Fields("客户编号") Then
   Combo1.Text = .Fields("客户姓名")
  End If
  .MoveNext
 Next i
End With
Command4.Enabled = False
End Sub

Private Sub Text1_Change(Index As Integer)
On Error Resume Next
Command4.Enabled = True
If Index = 1 Then
  With frmMain.Data6.Recordset
   .MoveFirst
   .Move ListView1.SelectedItem.Index - 1

  If Command1.Caption = "放弃添加" Then
    Text1(7).Text = Text1(1)
   Else
    Text1(7).Text = Val(Text1(1)) - .Fields("总金额") + .Fields("金额")
  End If
  End With
End If
End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If Index <= 2 Then
If Chr(KeyAscii) Like "[!0-9.]" And (Not KeyAscii = 8) Then KeyAscii = 0
End If
End Sub

⌨️ 快捷键说明

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