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

📄 form6.frm

📁 根据MS Proxy的日志文件进行计费的程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form FeeFrm 
   AutoRedraw      =   -1  'True
   Caption         =   "数据表"
   ClientHeight    =   5070
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5910
   LinkTopic       =   "Form1"
   ScaleHeight     =   5070
   ScaleWidth      =   5910
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command1 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4170
      TabIndex        =   9
      Top             =   4200
      Width           =   1530
   End
   Begin VB.TextBox Count2Time 
      Height          =   375
      Left            =   2760
      TabIndex        =   8
      Top             =   2790
      Width           =   1950
   End
   Begin VB.TextBox Count2Date 
      Height          =   375
      Left            =   2760
      TabIndex        =   7
      Top             =   2190
      Width           =   1950
   End
   Begin VB.TextBox CountTime 
      Height          =   375
      Left            =   2760
      TabIndex        =   6
      Top             =   1350
      Width           =   1950
   End
   Begin VB.TextBox CountDate 
      Height          =   375
      Left            =   2760
      TabIndex        =   5
      Top             =   750
      Width           =   1950
   End
   Begin VB.CommandButton start 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2310
      TabIndex        =   0
      Top             =   4215
      Width           =   1530
   End
   Begin VB.Line Line4 
      BorderColor     =   &H80000000&
      DrawMode        =   14  'Copy Pen
      X1              =   900
      X2              =   5115
      Y1              =   405
      Y2              =   405
   End
   Begin VB.Line Line3 
      BorderColor     =   &H80000006&
      X1              =   5085
      X2              =   5085
      Y1              =   3600
      Y2              =   360
   End
   Begin VB.Line Line2 
      BorderColor     =   &H80000006&
      X1              =   915
      X2              =   5115
      Y1              =   3615
      Y2              =   3615
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000000&
      DrawMode        =   14  'Copy Pen
      X1              =   915
      X2              =   930
      Y1              =   390
      Y2              =   3615
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "终止日期"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   1605
      TabIndex        =   4
      Top             =   2190
      Width           =   960
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "起始日期"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   1605
      TabIndex        =   3
      Top             =   750
      Width           =   960
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "起始时间"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   1605
      TabIndex        =   2
      Top             =   1350
      Width           =   960
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "终止时间"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   1605
      TabIndex        =   1
      Top             =   2790
      Width           =   960
   End
End
Attribute VB_Name = "FeeFrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim PTime As Long '指示处理机所用时间 long 类型可以支持最长24.85天的一次连接
Dim LTime As Date '指示产生log记录的时间

Dim i As Integer
Dim Sub_Error As Boolean

Dim TimeFeePrice As Long '时间计费价格
Dim TimeCountRate As Long '时间计费因子
'ProcessingTime
Dim SendFeePrice As Long '发送计费价格
Dim RecvdFeePrice As Long '接收计费价格
Dim IPTimePrice As Long 'IP时间计费

Dim db As Database '数据库定义
Dim IPDataRs As Recordset 'IP地址段表
Dim TimeDataRs As Recordset '时间段表
Dim GroupDataRs As Recordset '组用户表
Dim ProxyDataRs As Recordset '主计费记录表
Dim OutDataRs As Recordset '计费结果输出表
Dim Fee_Type As Integer '记录类型

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Count2Date_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Not IsDate(Count2Date.Text) Then
        MsgBox "计费截止日期不是合法日期值", vbOKOnly + vbExclamation, "输入非法"
        Sub_Error = True
    Else
        Count2Time.SetFocus
    End If
End If
End Sub

Private Sub Count2Time_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Not IsDate(Count2Time.Text) Then
        MsgBox "计费截止时间不是合法时间值", vbOKOnly + vbExclamation, "输入非法"
        Sub_Error = True
    Else
        start.SetFocus
    End If
End If
End Sub

Private Sub CountDate_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Not IsDate(CountDate.Text) Then
        MsgBox "计费开始日期不是合法日期值", vbOKOnly + vbExclamation, "输入非法"
        Sub_Error = True
    Else
        CountTime.SetFocus
    End If
End If
End Sub

Private Sub CountTime_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Not IsDate(CountTime.Text) Then
        MsgBox "计费开始时间不是合法时间值", vbOKOnly + vbExclamation, "输入非法"
        Sub_Error = True
    Else
        Count2Date.SetFocus
    End If
End If
End Sub

Private Sub Form_Load()
Set db = OpenDatabase("d:\wsm\wsm.mdb")
Sub_Error = False '程序开始时置为非错误状态
CountDate.Text = GetSetting(appname:="wsm", Section:="startup", _
                Key:="date", Default:="")
CountTime.Text = GetSetting(appname:="wsm", Section:="startup", _
                Key:="time", Default:="")
Count2Date.Text = GetSetting(appname:="wsm", Section:="end", _
                Key:="date", Default:="")
Count2Time.Text = GetSetting(appname:="wsm", Section:="end", _
                Key:="time", Default:="")
End Sub

Private Sub start_Click()
Call CountDate_KeyPress(13)
Call CountTime_KeyPress(13)
Call Count2Date_KeyPress(13)
Call Count2Time_KeyPress(13)
If Not Sub_Error Then
    '如果以前没有发生过错误,说明四个值为日期类型,因此可以继续以下比较操作
    If CDate(CountDate.Text) > CDate(Count2Date.Text) Then
        MsgBox "开始计费的日期迟于截止日期", vbOKOnly + vbExclamation, "输入非法"
        Sub_Error = True
    End If
    If CDate(CountDate.Text) = CDate(Count2Date.Text) And _
       CDate(CountTime.Text) > CDate(Count2Time.Text) Then
        MsgBox "开始计费的时间迟于截止时间", vbOKOnly + vbExclamation, "输入非法"
        Sub_Error = True
    End If
End If
If Sub_Error = True Then Exit Sub

SaveSetting "wsm", "startup", "date", CountDate.Text
SaveSetting "wsm", "startup", "time", CountTime.Text
SaveSetting "wsm", "end", "date", Count2Date.Text
SaveSetting "wsm", "end", "time", Count2Time.Text

Set OutDataRs = db.OpenRecordset("output", dbOpenTable)
If OutDataRs.RecordCount > 0 Then
    OutDataRs.MoveFirst
    Do
        OutDataRs.Delete
        OutDataRs.MoveNext
    Loop While Not OutDataRs.EOF
End If
OutDataRs.Close
Call FeeCount
End Sub

Private Sub FeeCount()
Dim RecordNumber As Integer
Set ProxyDataRs = db.OpenRecordset("proxy", dbOpenSnapshot)
If ProxyDataRs.RecordCount = 0 Then
    MsgBox "记录文件为空", vbOKOnly, "查询失败"
    Exit Sub
End If
ProxyDataRs.MoveFirst
Do While (Not ProxyDataRs.EOF)
'如果在两个界限之间,则计费。0510-5800185-8005周小姐
    If DTCompare(CDate(CountDate.Text), CDate(CountTime.Text), _
            ProxyDataRs.Fields("logdate"), ProxyDataRs.Fields("logtime")) = 2 And _
        DTCompare(CDate(Count2Date.Text), CDate(Count2Time.Text), _
            ProxyDataRs.Fields("logdate"), ProxyDataRs.Fields("logtime")) = 1 _
    Then
        RecordNumber = RecordNumber + 1
        SignIPFee (ProxyDataRs.Fields("DestHostIP"))
        PTime = CLng(ProxyDataRs.Fields("Processingtime"))

⌨️ 快捷键说明

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