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

📄 frmerrtable.frm

📁 这是一个Web短信平台后台部分中的预付费管理系统,采用SQL Server数据库,主要是对短信服务的注册用户进得后台充值预付费管理。用到了第三方控件 VideoSoft Active Controls
💻 FRM
📖 第 1 页 / 共 5 页
字号:
                    Set rstCustomers = GetRecordSet(cnnConnection, strQry)
                    
                    rstCustomers!Cmoney = rstCustomers!Cmoney + Val(txtNmoney(1).Text)
                    
                    If rstCustomers!Cmoney > 0 Then
                    
                        If SelectRate = 0 Then
                        
                            rstCustomers!SendableNum = -1
                            rstCustomers!SendFlag = 0
                            rstCustomers.Update
                            
                        Else
                        
                            rstCustomers!SendableNum = Int(rstCustomers!Cmoney / SelectRate)
                            
                            If rstCustomers!SendableNum = 0 Then
                                rstCustomers!SendFlag = 1
                            Else
                                rstCustomers!SendFlag = 0
                            End If
                            
                            rstCustomers.Update
                            
                        End If
                        
                    Else
                    
                        rstCustomers!SendFlag = 1
                        rstcusomers!SendableNum = 0
                        rstCustomers.Update
                        
                    End If
                    
                    '插入入费单操作记录
                    strQry = "insert into RFDorig(UserID,RFdate,Money,OperID,Status,JFtype,ID,OperTime,FLname) values('" & txtUserID(1).Text & "','" & dtpDate(1).Value & "'," & txtNmoney(1).Text & ",'" & strOperatorID & "',0,0,'" & txtTableID(1).Text & "','" & Now & "','" & txtFL(1).Text & "')"
                    cnnConnection.Execute strQry
                    
                    With frmErrRep!Gridbrowser
                    
                        .TextMatrix(.RowSel, 6) = ""
                        .TextMatrix(.RowSel, 7) = ""
                        .TextMatrix(.RowSel, 8) = "0"
                        
                    End With
                    
                End If
                
                '设置用户的短信管理权限
                Call SetRight(txtUserID(1).Text)
                
                cnnConnection.CommitTrans
                
                With frmErrRep!Gridbrowser
                
                    .TextMatrix(.RowSel, 1) = txtUserID(1).Text
                    .TextMatrix(.RowSel, 2) = txtUserName(1).Text
                    .TextMatrix(.RowSel, 4) = dtpDate(1).Value
                    .TextMatrix(.RowSel, 5) = txtFL(1).Text
                    .TextMatrix(.RowSel, 3) = txtNmoney(1).Text
                    .TextMatrix(.RowSel, 9) = txtCmoney(1).Text
                    .TextMatrix(.RowSel, 11) = Trim(Str(Me.JFquan))
                    .TextMatrix(.RowSel, 12) = Trim(Str(Me.JFunit))
                    .TextMatrix(.RowSel, 10) = ""
                    
                End With
                
            End If
            
        '错单与更正单的状态相同(有效单,无效单)
        Else
            If chkDel.Value = 0 Then
                
                cnnConnection.BeginTrans
                
                '将原来的入费单置为错单
                Call SetOldTable
                
                '更正单用户的计费方式为包月方式
                If m_SelectFLtype = 1 Then
                
                    strQry = "update RFDconf set Status=0 ,UserID='" & txtUserID(1).Text & "',RFdate='" & dtpDate(1).Value & "',money=" & txtNmoney(1).Text & ",StartDate='" & dtpStart(1).Value & "',EndDate='" & dtpEnd(1).Value & "',FLname='" & txtFL(1).Text & "',JFtype=1  where ID='" & txtTableID(0).Text & "'"
                    cnnConnection.Execute strQry
                    
                    strQry = "select TotalMoney,SendableNum,SendFlag from MsgJF Where UserID='" & txtUserID(0).Text & "'"
                    Set rstCustomers = GetRecordSet(cnnConnection, strQry)
                    
                    '恢复错单用户(包月用户)原来的计费设置
                    strQry = "select top 1 * from RFDconf where UserID='" & txtUserID(0).Text & "' and status=0 order by EndDate DESC"
                    Set tmprstCustomers = GetRecordSet(cnnConnection, strQry)
                
                    rstCustomers!TotalMoney = rstCustomers!TotalMoney - Val(txtNmoney(0).Text)
                
                    If tmprstCustomers.RecordCount <> 0 Then
                
                        strQry = "update JFsetting set StartDate='" & tmprstCustomers!StartDate & "',EndDate='" & tmprstCustomers!EndDate & "' where UserID='" & txtUserID(0).Text & "'"
                        cnnConnection.Execute strQry
                    
                        If DateValue(Now) >= tmprstCustomers!StartDate And DateValue(Now) <= tmprstCustomers!EndDate Then
                            rstCustomers!SendableNum = -1
                            rstCustomers!SendFlag = 0
                        Else
                            rstCustomers!SendableNum = 0
                            rstCustomers!SendFlag = 1
                        End If
                    
                    Else
                    
                        rstCustomers!SendableNum = 0
                        rstCustomers!SendFlag = 1
                        strQry = "update JFsetting set StartDate=Null,EndDate=Null where UserID='" & txtUserID(0).Text & "'"
                        cnnConnection.Execute strQry
                        
                    
                    End If
                    
                    rstCustomers.Update
                    
                    '设置更正单用户(包月用户)的计费设置
                    strQry = "select * from MsgJF where UserID='" & txtUserID(1).Text & "'"
                    Set rstCustomers = GetRecordSet(cnnConnection, strQry)
                    
                    rstCustomers!TotalMoney = rstCustomers!TotalMoney + Val(txtNmoney(1).Text)
                    
                    If DateValue(Now) >= dtpStart(1).Value And DateValue(Now) <= dtpEnd(1).Value Then
                        rstCustomers!SendableNum = -1
                        rstCustomers!SendFlag = 0
                    Else
                        rstCustomers!SendableNum = 0
                        rstCustomers!SendFlag = 1
                    End If
                    
                    rstCustomers.Update
                
                    strQry = "update JFsetting set StartDate='" & dtpStart(1).Value & "',EndDate='" & dtpEnd(1).Value & "' where UserID='" & txtUserID(1).Text & "'"
                    cnnConnection.Execute strQry
                    
                    '插入入费单操作记录
                    strQry = "insert into RFDorig(UserID,RFdate,Money,OperID,Status,JFtype,ID,OperTime,StartDate,EndDate,FLname) values('" & txtUserID(1).Text & "','" & dtpDate(1).Value & "'," & txtNmoney(1).Text & ",'" & strOperatorID & "',0,1,'" & txtTableID(1).Text & "','" & Now & "','" & dtpStart(1).Value & "','" & dtpEnd(1).Value & "','" & txtFL(1).Text & "')"
                    cnnConnection.Execute strQry
                    
                    With frmErrRep!Gridbrowser
                    
                        .TextMatrix(.RowSel, 6) = dtpStart(1).Value
                        .TextMatrix(.RowSel, 7) = dtpEnd(1).Value
                        .TextMatrix(.RowSel, 8) = "1"
                        
                    End With
                    
                '更正单用户的计费方式为单条方式
                Else
                    
                    strQry = "update RFDconf set Status=0 ,UserID='" & txtUserID(1).Text & "',RFdate='" & dtpDate(1).Value & "',money=" & txtNmoney(1).Text & ",StartDate=Null,EndDate=Null,FLname='" & txtFL(1).Text & "',JFtype=0  where ID='" & txtTableID(0).Text & "'"
                    cnnConnection.Execute strQry
                    
                    strQry = "select TotalMoney,SendableNum,SendFlag from MsgJF Where UserID='" & txtUserID(0).Text & "'"
                    Set rstCustomers = GetRecordSet(cnnConnection, strQry)
                    
                    '恢复错单用户(包月用户)原来的计费设置
                    strQry = "select top 1 * from RFDconf where UserID='" & txtUserID(0).Text & "' and status=0 order by EndDate DESC"
                    Set tmprstCustomers = GetRecordSet(cnnConnection, strQry)
                
                    rstCustomers!TotalMoney = rstCustomers!TotalMoney - Val(txtNmoney(0).Text)
                
                    If tmprstCustomers.RecordCount <> 0 Then
                
                        strQry = "update JFsetting set StartDate='" & tmprstCustomers!StartDate & "',EndDate='" & tmprstCustomers!EndDate & "' where UserID='" & txtUserID(0).Text & "'"
                        cnnConnection.Execute strQry
                    
                        If DateValue(Now) >= tmprstCustomers!StartDate And DateValue(Now) <= tmprstCustomers!EndDate Then
                            rstCustomers!SendableNum = -1
                            rstCustomers!SendFlag = 0
                        Else
                            rstCustomers!SendableNum = 0
                            rstCustomers!SendFlag = 1
                        End If
                    
                    Else
                        
                        rstCustomers!SendableNum = 0
                        rstCustomers!SendFlag = 1
                        strQry = "update JFsetting set StartDate=Null,EndDate=Null where UserID='" & txtUserID(0).Text & "'"
                        cnnConnection.Execute strQry
                    
                    End If
                    
                    rstCustomers.Update
                    
                    '设置更正单用户(单条用户)的计费设置
                    strQry = "select * from MsgJF where UserID='" & txtUserID(1).Text & "'"
                    Set rstCustomers = GetRecordSet(cnnConnection, strQry)
                    
                    rstCustomers!Cmoney = rstCustomers!Cmoney + Val(txtNmoney(1).Text)
                    
                    If rstCustomers!Cmoney > 0 Then
                    
                        If SelectRate = 0 Then
                        
                            rstCustomers!SendableNum = -1
                            rstCustomers!SendFlag = 0
                            rstCustomers.Update
                            
                        Else
                            
                            rstCustomers!SendableNum = Int(rstCustomers!Cmoney / SelectRate)
                            
                            If rstCustomers!SendableNum = 0 Then
                                rstCustomers!SendFlag = 1
                            Else
                                rstCustomers!SendFlag = 0
                            End If
                            
                            rstCustomers.Update
                            
                        End If
                        
                    Else
                    
                        rstCustomers!SendFlag = 1
                        rstCustomers!SendableNum = 0
                        rstCustomers.Update
                        
                    End If
                    
                    '插入入费单操作记录
                    strQry = "insert into RFDorig(UserID,RFdate,Money,OperID,Status,JFtype,ID,OperTime,FLname) values('" & txtUserID(1).Text & "','" & dtpDate(1).Value & "'," & txtNmoney(1).Text & ",'" & strOperatorID & "',0,0,'" & txtTableID(1).Text & "','" & Now & "','" & txtFL(1).Text & "')"
                    cnnConnection.Execute strQry
                    
                    With frmErrRep!Gridbrowser
                    
                        .TextMatrix(.RowSel, 6) = ""
                        .TextMatrix(.RowSel, 7) = ""
                        .TextMatrix(.RowSel, 8) = "0"
                        
                    End With
                
                End If
                
                With frmErrRep!Gridbrowser
                
                    .TextMatrix(.RowSel, 1) = txtUserID(1).Text
                    .TextMatrix(.RowSel, 2) = txtUserName(1).Text
                    .TextMatrix(.RowSel, 4) = dtpDate(1).Value
                    .TextMatrix(.RowSel, 5) = txtFL(1).Text
                    .TextMatrix(.RowSel, 3) = txtNmoney(1).Text
                    .TextMatrix(.RowSel, 9) = txtCmoney(1).Text
                    .TextMatrix(.RowSel, 11) = Trim(Str(Me.JFquan))
                    .TextMatrix(.RowSel, 12) = Trim(Str(Me.JFunit))
                    .TextMatrix(.RowSel, 10) = ""
                    
                End With
                
                Call SetRight(txtUserID(1).Text)
                
                cnnConnection.CommitTrans
                
            End If
            
        End If
        
    '错单用户的计费方式为单条
    Else
        
        '错单与更正单的状态不相同(有效单,无效单)
        If m_RFDstatus <> chkDel.Value Then
            
            '错单为有效,更正单为无效
            If chkDel.Value = 1 Then
            
                cnnConnection.BeginTrans
                
                '将原来的入费单置为错单
                Call SetOldTable
                
                strQry = "update RFDconf set Status=1 where ID='" & txtTableID(0).Text & "'"
                cnnConnection.Execute strQry
                
                '将错单用户(单条用户)的计费恢复到上次入费的设置
                strQry = "select * from MsgJF where UserID='" & txtUserID(0).Text & "'"
                Set rstCustomers = GetRecordSet(cnnConnection, strQry)
                    
                rstCustomers!Cmoney = rstCustomers!Cmoney - Val(txtNmoney(0).Text)
                    
                If rstCustomers!Cmoney > 0 Then
                
                    If SelectRate = 0 Then
                    
                        rstCustomers!SendableNum = -1
                        rstCustomers!SendFlag = 0
                        rstCustomers.Update
                        
                    Else
                    
                        rstCustomers!SendableNum = Int(rstCustomers!Cmoney / SelectRate)
                        
                        If rstCustomers!SendableNum = 0 Then
                            rstCustomers!SendFlag = 1
                        Else
                            rstCustomers!SendFlag = 0
                        End If
                        
                        rstCustomers.Update
                        
                    End If
                    
                Else
                
                    rstCustomers!SendFlag = 1
                    rstCustomers!SendableNum = 0
                    rstCustomers.Update
                    
                End If
                
                '插入入费单操作记录
                strQry = "insert into RFDorig(UserID,RFdate,Money,OperID,Status,JFtype,ID,OperTime,FLname) values('" & txtUserID(0).Text & "','" & dtpDate(0).Value & "'," & txtNmoney(0).Text & ",'" & strOperatorID & "',2,0,'" & txtTableID(0).Text & "','" & Now & "','" & txtFL(0).Text & "')"
                cnnConnection.Execute strQry
                
                With frmErrRep!Gridbrowser

⌨️ 快捷键说明

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