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

📄 frmcashflowcard.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
        cmdCashFlow(2).Visible = False
        Show intModal
    End If
End Sub


Private Function CodeIsUsed(ByVal lngID As Long) As Boolean
    Dim strFname As String
    strFname = "lngETSettingID"
    
    CodeIsUsed = True
    If CheckIDUsed("VoucherCashFlow", strFname, lngID) Then Exit Function
   
    CodeIsUsed = False
End Function

Public Function DelCard(lngID As Long, Optional ByVal lnghWnd As Long = 0) As Boolean
    Dim recTemp As rdoResultset
    Dim strSql As String
    Dim blnExec As Boolean
    
    DelCard = False
    If Not CheckIDUsed("ETSetting", "lngETSettingID", lngID) Then
        Exit Function
    End If
    
    If CodeIsUsed(lngID) Then
        ShowMsg lnghWnd, "该现金流量项目已经有业务发生,不允许删除!", _
                    vbExclamation + MB_TASKMODAL, "删除现金流量项目"
        Exit Function
    End If
    If ShowMsg(lnghWnd, "你确实要删除该现金流量项目吗?", _
                  vbQuestion + vbYesNo + MB_TASKMODAL, "删除现金流量项目") = vbNo Then Exit Function
    strSql = "DELETE   FROM ETSetting WHERE lngETSettingID=" & lngID
    blnExec = gclsBase.ExecSQL(strSql)
    'If blnExec = True Then gclsSys.SendMessage Me.hWnd, msgTaxType
    DelCard = blnExec
End Function
Private Function InitCard(Optional strName As String = "") As Boolean
    Dim recCashFlow As rdoResultset
    Dim strSql As String
   
    InitCard = True
    If Not mblnIsNew Then
        strSql = "SELECT * FROM ETSetting WHERE lngETSettingID=" & mlngCashFlowID
        Set recCashFlow = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
        If recCashFlow.EOF Then
            ShowMsg 0, "当前现金流量项目不存在,不能修改!", _
                    vbExclamation + MB_TASKMODAL, Caption
            Unload Me
            InitCard = False
            Exit Function
        Else
            mstrCashFlowName = recCashFlow!strETSettingName
            txtCashFlow(0).Text = mstrCashFlowName
            mstrCashFlowNO = recCashFlow!strETSettingNO
            txtCashFlow(1).Text = mstrCashFlowNO
        End If
        recCashFlow.Close
    Else
        txtCashFlow(0).Text = strName
        txtCashFlow(1).Text = ""
        txtCashFlow(0).SelStart = 0
        txtCashFlow(0).SelLength = StrLen(txtCashFlow(0).Text)
        mstrCashFlowName = strName
        mstrCashFlowNO = ""
    End If
End Function

Private Sub txtCashFlow_Change(Index As Integer)
    
    If ContainErrorChar(txtCashFlow(Index).Text, "'|") Then
       BKKEY txtCashFlow(Index).hwnd
       Exit Sub
    End If
    If Index = 0 Then
       mstrCashFlowName = Trim(txtCashFlow(Index).Text)
    Else
       If Len(txtCashFlow(Index).Text) > 4 Then
          BKKEY txtCashFlow(Index).hwnd
          Exit Sub
       End If
       mstrCashFlowNO = Trim(txtCashFlow(Index).Text)
    End If
End Sub

Private Sub txtCashFlow_GotFocus(Index As Integer)
    txtCashFlow(Index).Tag = txtCashFlow(Index).Text
End Sub

Private Sub txtCashFlow_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    If mblnIsFirst Then
       mblnIsFirst = False
       Exit Sub
    End If
    mblnIsChanged = True
End Sub

Private Sub txtCashFlow_LostFocus(Index As Integer)
    If txtCashFlow(Index).Tag = txtCashFlow(Index).Text Then Exit Sub
       
    Select Case Index
           Case 0
                mstrCashFlowName = Trim(txtCashFlow(Index).Text)
           Case 1
                mstrCashFlowNO = Trim(txtCashFlow(Index).Text)
    End Select
End Sub

Private Sub txtCashFlow_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    mblnIsChanged = True
End Sub
Private Function DesineIsRight() As Boolean
         
         DesineIsRight = False
         If txtCashFlow(0).Text = "" Then
             ShowMsg 0, "现金流量项目名称不能为空!", vbExclamation + MB_TASKMODAL, Caption
             txtCashFlow(0).SelStart = 0
             txtCashFlow(0).SelLength = StrLen(txtCashFlow(0).Text)
             txtCashFlow(0).SetFocus
             Exit Function
         End If
         If txtCashFlow(1).Text = "" Then
             ShowMsg 0, "行次不能为空!", vbExclamation + MB_TASKMODAL, Caption
             txtCashFlow(1).SelStart = 0
             txtCashFlow(1).SelLength = StrLen(txtCashFlow(1).Text)
             txtCashFlow(1).SetFocus
             Exit Function
         End If
         
         If InStr(1, txtCashFlow(0).Text, "'") <> 0 Then
            ShowMsg 0, "现金流量项目名称不能有‘'’符号!", vbExclamation + MB_TASKMODAL, Caption
            txtCashFlow(0).SelStart = 0
            txtCashFlow(0).SelLength = StrLen(txtCashFlow(0).Text)
            txtCashFlow(0).SetFocus
            Exit Function
         ElseIf InStr(1, txtCashFlow(0).Text, "|") <> 0 Then
            ShowMsg 0, "现金流量项目名称不能有‘|’符号!", vbExclamation + MB_TASKMODAL, Caption
            txtCashFlow(0).SelStart = 0
            txtCashFlow(0).SelLength = StrLen(txtCashFlow(0).Text)
            txtCashFlow(0).SetFocus
            Exit Function
         End If
         If Len(txtCashFlow(0).Text) > 50 Then
             ShowMsg 0, "现金流量项目名称太长!", vbExclamation + MB_TASKMODAL, Caption
             txtCashFlow(0).SelStart = 0
             txtCashFlow(0).SelLength = StrLen(txtCashFlow(0).Text)
             txtCashFlow(0).SetFocus
             Exit Function
         End If
         If Len(txtCashFlow(1).Text) > 4 Then
             ShowMsg 0, "行次太长!", vbExclamation + MB_TASKMODAL, Caption
             txtCashFlow(1).SelStart = 0
             txtCashFlow(1).SelLength = StrLen(txtCashFlow(1).Text)
             txtCashFlow(1).SetFocus
             Exit Function
         End If
         DesineIsRight = True
End Function

Private Function SaveCard() As Boolean
        Dim strSql As String
        Dim recTemp As rdoResultset
        Dim blnExec As Boolean
        Dim lngCashFlowID As Long
        Dim lngItemOrderRow As Long
         
        lngCashFlowID = mlngCashFlowID
        SaveCard = False
        If mblnIsChanged = False Then
           Unload Me
           Exit Function
        End If
        If Not DesineIsRight() Then Exit Function
        
        strSql = "SELECT * FROM ETSetting WHERE strETSettingName='" & mstrCashFlowName _
                  & "' AND lngETSettingID NOT LIKE " & mlngCashFlowID
        Set recTemp = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
        If recTemp.EOF = False Then
           ShowMsg 0, "该现金流量项目已存在", vbExclamation + MB_TASKMODAL, Caption
           txtCashFlow(0).SetFocus
           recTemp.Close
           Exit Function
        ElseIf mblnIsNew Then
           strSql = "select Max(lngItemOrder) from ETSetting where strETSettingType='3'"
           Set recTemp = gclsBase.BaseDB.OpenResultset(strSql, rdOpenDynamic)
           If Not recTemp.EOF Then
              lngItemOrderRow = Format(recTemp.rdoColumns(0), "@;0") + 1
           Else
              lngItemOrderRow = 1
           End If
           recTemp.Close
           strSql = "INSERT INTO ETSetting (strETSettingType,strETSettingName,strETSettingNO,lngitemorder) VALUES ('3','" & _
                     mstrCashFlowName & "','" & mstrCashFlowNO & "'," & lngItemOrderRow & ")"
           blnExec = gclsBase.ExecSQL(strSql)
           If Not blnExec Then
              lngCashFlowID = 0
           Else
              strSql = "SELECT Max(lngETSettingID) AS MaxID FROM ETSetting "
              Set recTemp = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
              If Not recTemp.EOF Then
                 lngCashFlowID = recTemp!maxID
              Else
                 lngCashFlowID = 0
              End If
           End If
        Else
           strSql = "UPDATE ETSetting SET strETSettingName='" & mstrCashFlowName _
                    & "',strETSettingNO='" & mstrCashFlowNO & _
                    "' where lngETSettingID=" & mlngCashFlowID
           blnExec = gclsBase.ExecSQL(strSql)
        End If
        
        If blnExec = True Then
           SaveCard = True
           mblnIsChanged = False
           'gclsSys.SendMessage CStr(Me.hWnd), Message.msgTaxType
        End If
        mlngCashFlowID = lngCashFlowID
        
End Function

⌨️ 快捷键说明

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