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


VERSION 5.00 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Begin VB.Form frmJSJ  
   Caption         =   "计算机设置" 
   ClientHeight    =   4410 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   7230 
   Icon            =   "frmJSJ.frx":0000 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4410 
   ScaleWidth      =   7230 
   StartUpPosition =   1  '所有者中心 
   Begin VB.Frame Frame1  
      Caption         =   "设置计计算机" 
      Height          =   3255 
      Left            =   120 
      TabIndex        =   7 
      Top             =   120 
      Visible         =   0   'False 
      Width           =   6975 
      Begin VB.TextBox Text1  
         Height          =   375 
         Index           =   3 
         Left            =   1800 
         TabIndex        =   15 
         Top             =   2160 
         Width           =   2895 
      End 
      Begin VB.TextBox Text1  
         BackColor       =   &H80000003& 
         Height          =   375 
         Index           =   2 
         Left            =   1800 
         Locked          =   -1  'True 
         TabIndex        =   14 
         Top             =   1680 
         Width           =   2895 
      End 
      Begin VB.TextBox Text1  
         Height          =   375 
         Index           =   1 
         Left            =   1800 
         TabIndex        =   13 
         Top             =   1200 
         Width           =   2895 
      End 
      Begin VB.TextBox Text1  
         BackColor       =   &H80000011& 
         Height          =   375 
         Index           =   0 
         Left            =   1800 
         Locked          =   -1  'True 
         TabIndex        =   12 
         Top             =   720 
         Width           =   2895 
      End 
      Begin VB.Label Label4  
         Caption         =   "收费标准:" 
         Height          =   255 
         Left            =   840 
         TabIndex        =   11 
         Top             =   2280 
         Width           =   975 
      End 
      Begin VB.Label Label3  
         Caption         =   "IP地址:" 
         Height          =   255 
         Left            =   840 
         TabIndex        =   10 
         Top             =   1800 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "名称:" 
         Height          =   255 
         Left            =   840 
         TabIndex        =   9 
         Top             =   1320 
         Width           =   855 
      End 
      Begin VB.Label Label1  
         Caption         =   "机号:" 
         Height          =   255 
         Left            =   840 
         TabIndex        =   8 
         Top             =   840 
         Width           =   975 
      End 
   End 
   Begin VB.PictureBox Picture1  
      BorderStyle     =   0  'None 
      Height          =   615 
      Left            =   0 
      ScaleHeight     =   615 
      ScaleWidth      =   7095 
      TabIndex        =   1 
      Top             =   3480 
      Width           =   7095 
      Begin VB.CommandButton Command6  
         Caption         =   "关闭" 
         Height          =   375 
         Left            =   6120 
         TabIndex        =   16 
         Top             =   120 
         Width           =   975 
      End 
      Begin VB.CommandButton Command5  
         Caption         =   "记费标准" 
         Height          =   375 
         Left            =   4920 
         TabIndex        =   6 
         Top             =   120 
         Width           =   975 
      End 
      Begin VB.CommandButton Command4  
         Caption         =   "保存" 
         Enabled         =   0   'False 
         Height          =   375 
         Left            =   3720 
         TabIndex        =   5 
         Top             =   120 
         Width           =   975 
      End 
      Begin VB.CommandButton Command3  
         Caption         =   "删除" 
         Height          =   375 
         Left            =   2520 
         TabIndex        =   4 
         Top             =   120 
         Width           =   975 
      End 
      Begin VB.CommandButton Command2  
         Caption         =   "添加" 
         Height          =   375 
         Left            =   1320 
         TabIndex        =   3 
         Top             =   120 
         Width           =   975 
      End 
      Begin VB.CommandButton Command1  
         Caption         =   "修改" 
         Height          =   375 
         Left            =   120 
         TabIndex        =   2 
         Top             =   120 
         Width           =   975 
      End 
   End 
   Begin MSComctlLib.ListView ListView1  
      Height          =   855 
      Left            =   600 
      TabIndex        =   0 
      Top             =   360 
      Width           =   1455 
      _ExtentX        =   2566 
      _ExtentY        =   1508 
      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        =   4 
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         Text            =   "机号" 
         Object.Width           =   2540 
      EndProperty 
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   1 
         Text            =   "名称" 
         Object.Width           =   2540 
      EndProperty 
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   2 
         Text            =   "IP地址" 
         Object.Width           =   2540 
      EndProperty 
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}  
         SubItemIndex    =   3 
         Text            =   "上机费用" 
         Object.Width           =   2540 
      EndProperty 
   End 
End 
Attribute VB_Name = "frmJSJ" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim olda As Long 
 
Private Sub Command1_Click() 
If Command1.Caption = "修改" Then 
With frmMain.Data1.Recordset 
 .MoveFirst 
 .Move ListView1.SelectedItem.Index - 1 
 For i = 0 To 3 
  Text1(i).Text = .Fields(i) & "" 
 Next i 
 Frame1.Visible = True 
 ListView1.Visible = False 
 .MoveFirst 
 .Move olda 
End With 
 Command4.Enabled = True 
 Command1.Caption = "放弃" 
  
Else 
 Frame1.Visible = False 
 ListView1.Visible = True 
 Command1.Caption = "修改" 
 Command4.Enabled = False 
 Command2.Enabled = True 
End If 
End Sub 
 
Private Sub Command2_Click() 
'添加 
Dim sjscount As Long 
sjscount = GetSetting("网吧记费器", "reg", "机器数", 10) 
If sjscount <= frmMain.Data1.Recordset.RecordCount Then 
 MsgBox "您所使用的版权不能再加机器了!", vbCritical 
 Exit Sub 
End If 
Command2.Enabled = False 
Command1.Caption = "放弃" 
Text1(0).Text = frmMain.Data1.Recordset.RecordCount + 1 
Text1(1).Text = frmMain.Data1.Recordset.RecordCount + 1 & "号机" 
For i = 2 To 3 
Text1(i) = "" 
Next i 
Frame1.Visible = True 
ListView1.Visible = False 
Command4.Enabled = True 
End Sub 
 
Private Sub Command3_Click() 
'删除 
With frmMain.Data1.Recordset 
 .MoveFirst 
 .Move ListView1.SelectedItem.Index - 1 
 If .Fields("状态") = "Y" Or .Fields("状态") = "P" Then 
  MsgBox "由于当前计算机处于记费状态,所以不能删除!", vbCritical, "提示" 
  Exit Sub 
 End If 
 If MsgBox("确实要删除: " & .Fields("名称") & " 吗?", vbYesNo + vbDefaultButton2 + vbQuestion, "提示") = vbNo Then 
  .MoveFirst 
  .Move olda 
  Exit Sub 
 End If 
.Delete 
.MoveFirst 
  frmMain.ListView1.ListItems.Clear 
   
 
  For i = 1 To .RecordCount 
  .Edit 
   If .Fields("名称") = .Fields("机号") & "号机" Then .Fields("名称") = CStr(.AbsolutePosition + 1) & "号机" 
   .Fields("机号") = .AbsolutePosition + 1 
   
  .Update 
   Select Case .Fields("状态").Value 
    Case "Y" 
     st = 3 
    Case "N" 
     st = 2 
    Case "P" 
     st = 4 
    Case "S" 
     st = 5 
   End Select 
   frmMain.ListView1.ListItems.Add i, , frmMain.Data1.Recordset.Fields("名称").Value, st, st 
   frmMain.FlashListView (i) 
   .MoveNext 
  Next i 
  
 .MoveFirst 
 .Move olda 
  ListView1.ListItems.Clear 
  Form_Load 
 
End With 
End Sub 
 
Private Sub Command4_Click() 
'保存 
On Error Resume Next 
With frmMain.Data1.Recordset 
 If Command2.Enabled Then 
  .MoveFirst 
  .Move ListView1.SelectedItem.Index - 1 
  .Edit 
  For i = 0 To 3 
   .Fields(i) = Text1(i) 
  Next i 
  .Update 
  .MoveFirst 
  .Move olda 
 Else '如果是添加 
   .AddNew 
  For i = 0 To 3 
   .Fields(i) = Text1(i) 
  Next i 
  .Fields("状态") = "N" 
  .Update 
  frmMain.ListView1.ListItems.Clear 
  .MoveFirst 
  For i = 1 To .RecordCount 
   Select Case .Fields("状态").Value 
    Case "Y" 
     st = 3 
    Case "N" 
     st = 2 
    Case "P" 
     st = 4 
    Case "S" 
     st = 5 
   End Select 
    frmMain.ListView1.ListItems.Add i, , frmMain.Data1.Recordset.Fields("名称").Value, st, st 
   frmMain.FlashListView (i) 
   .MoveNext 
  Next i 
 End If 
 .MoveFirst 
 .Move olda 
 
End With 
  Command1_Click 
  ListView1.ListItems.Clear 
  Form_Load 
 
End Sub 
 
Private Sub Command5_Click() 
'输入请的记费标准 
nn = Val(InputBox("请输入新的记费标准:", "提示")) 
If nn > 0 Then 
  If MsgBox("确实要将所有机器的记费标准改为:" & vbCrLf & nn & " 元/小时吗?", vbQuestion + vbYesNo + vbDefaultButton2, "提示") = vbYes Then 
   With frmMain.Data1.Recordset 
    .MoveFirst 
    For i = 1 To .RecordCount 
     .Edit 
     .Fields("单位费用") = nn 
     .Update 
     .MoveNext 
    Next i 
    .MoveFirst 
    .Move olda 
    ListView1.ListItems.Clear 
    Form_Load 
   End With 
  End If 
  
End If 
End Sub 
 
Private Sub Command6_Click() 
Unload Me 
End Sub 
 
Private Sub Form_Load() 
On Error Resume Next 
With frmMain.Data1.Recordset 
 olda = .AbsolutePosition 
  .MoveFirst 
 For i = 1 To .RecordCount 
   ListView1.ListItems.Add i, , .Fields("机号") 
   ListView1.ListItems(i).SubItems(1) = .Fields("名称") 
   ListView1.ListItems(i).SubItems(2) = .Fields("IP") & "" 
   ListView1.ListItems(i).SubItems(3) = .Fields("单位费用") 
    
   .MoveNext 
 Next i 
 .MoveFirst 
 .Move olda 
End With 
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 Text1_KeyPress(Index As Integer, KeyAscii As Integer) 
If Chr(KeyAscii) Like "[!0-9.]" And (Not KeyAscii = 8) And Index = 3 Then KeyAscii = 0 
 
End Sub