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

📄 base.cls

📁 金算盘软件代码
💻 CLS
📖 第 1 页 / 共 5 页
字号:

'当前期间开始日期
Public Property Let PeriodBegin(ByVal vData As String)
    mvarPeriodBegin = vData
End Property

Public Property Get PeriodBegin() As String
    PeriodBegin = Format(mvarPeriodBegin, "yyyy-MM-dd")
End Property

'当前期间结束日期
Public Property Let PeriodEnd(ByVal vData As String)
    mvarPeriodEnd = vData
End Property

Public Property Get PeriodEnd() As String
    PeriodEnd = Format(mvarPeriodEnd, "yyyy-MM-dd")
End Property

'在职人员个人缴纳比例
Public Property Get PersonRate() As Integer
    PersonRate = mintPersonRate
End Property
Public Property Let PersonRate(ByVal vData As Integer)
    mintPersonRate = vData
End Property

'单价小数位数
Public Property Get PriceDec() As Byte
    PriceDec = mvarPriceDec
End Property

Public Property Let PriceDec(ByVal vData As Byte)
    mvarPriceDec = vData
End Property

'数量小数位数
Public Property Get QuantityDec() As Byte
    QuantityDec = mvarQuantityDec
End Property

Public Property Let QuantityDec(ByVal vData As Byte)
    mvarQuantityDec = vData
End Property

'划入退休人员个人帐户比例
Public Property Get RetireRate() As Integer
    RetireRate = mintRetireRate
End Property
Public Property Let RetireRate(ByVal vData As Integer)
    mintRetireRate = vData
End Property

'单位为退休人员缴纳比例
Public Property Get ToRetire() As Integer
    ToRetire = mintToRetire
End Property
Public Property Let ToRetire(ByVal vData As Integer)
    mintToRetire = vData
End Property

'单位为在职人员缴纳比例
Public Property Get ToWorkRate() As Integer
    ToWorkRate = mintToWorkRate
End Property

Public Property Let ToWorkRate(ByVal vData As Integer)
    mintToWorkRate = vData
End Property

Public Property Get Trade() As String
    Trade = mstrTrade
End Property

Public Property Get VersionInfo() As String
    VersionInfo = mstrVersion
End Property

Public Property Let VersionInfo(ByVal New_Version As String)
    mstrVersion = New_Version
End Property

'版本类型(0=默认,1=教学版)
Public Property Get VersionType() As Byte
    VersionType = mbytVersionType
End Property

Public Property Let VersionType(ByVal New_VersionType As Byte)
    mbytVersionType = New_VersionType
End Property

Public Property Get UID() As String
    UID = mUID
End Property

'''''''''''''''''''''''''''''''''''''''''''''''''''
'                帐套类方法
'
'''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function BudgetIsOver(ByVal AccountID As Long, ByVal dNow As String, Optional ReturnVal As Double, Optional ReturnCurrVal As Double, Optional ReturnQuanVal As Double) As Boolean
  BudgetIsOver = False
End Function

Public Function IsOver(AccountID As Long, ByVal dNow As String, Optional lngCurrencyID As Long = 1, _
                Optional ByVal lnghWnd As Long = 0, Optional ByVal AccountName As String = "", _
                Optional ByVal AccountDirect As Integer = 0, Optional ByVal AccountIsDetail As Boolean = True) As Boolean
  'AccountDirect=1  借方
  '             =-1 贷方
  '             =0  借贷方
Dim dblAmount As Double, dblCurr As Double, dblQuan As Double
Dim dblAmount2 As Double, dblCurr2 As Double, dblQuan2 As Double
Dim blnOK As Boolean
Dim rstBudget As rdoResultset
Dim strBudgetName As String, strSql As String, strCond As String, strCond2 As String, strCond3 As String
Dim lngBudgetID As Long
Dim bytBudgetType As Byte
Dim bytType As Byte
Dim clsFomular As New BaseFunction
Dim dtmBegin As Date, dtmEnd As Date
Dim dBegin As String, dEnd As String
Dim intPeriod As Integer
Dim strAccountName As String
Dim strErrorMsg As String
Dim lngIsOver As Long
Dim lngDetailID() As Long
Dim strDetailID As String
Dim i As Long
  
If AccountName <> "" Then
  strAccountName = "科目“" & AccountName & "”"
Else
  strAccountName = ""
End If
strErrorMsg = ""
intPeriod = PeriodOfDate(dNow, dtmBegin, dtmEnd)
dBegin = Format$(dtmBegin, "yyyy-mm-dd")
dEnd = Format$(dtmEnd, "yyyy-mm-dd")

clsFomular.Init mvarBaseDB, mvarBaseDate, , OperatorID

strSql = "Select lngBudgetID,strBudgetName,bytBudgetType,bytType,blnIsNatualCurrency,blnIsOriginalCurrency,blnIsQuantity From Budget WHERE blnIsAlarm=1 AND bytType=0 "
Set rstBudget = mvarBaseDB.OpenResultset(strSql, rdOpenStatic)
If AccountIsDetail = False Then
    BillPublic.GetAccountDetailID AccountID, lngDetailID()
    strDetailID = "(-1"
    For i = 0 To UBound(lngDetailID)
        strDetailID = strDetailID & "," & lngDetailID(i)
    Next i
    strDetailID = strDetailID + ")"
End If
If AccountIsDetail = False Then
  strCond2 = "(Account.lngAccountID IN " & strDetailID & ") And Currencys.lngCurrencyID=" & lngCurrencyID
  strCond3 = "(Account.lngAccountID IN " & strDetailID & ") "
Else
  strCond2 = "Account.lngAccountID=" & AccountID & " And Currencys.lngCurrencyID=" & lngCurrencyID
  strCond3 = "Account.lngAccountID=" & AccountID
End If
    
IsOver = False
With rstBudget
    Do While Not .EOF
        lngBudgetID = !lngBudgetID
        strBudgetName = !strBudgetName
        bytBudgetType = !bytBudgetType '预算对象:1.实际发生额;2.借方发生额;3.贷方发生额;4.余额
        bytType = !bytType '0:财务预算;1:经营预算
        
        strCond = "Account.lngAccountID=" & AccountID & " And Currencys.lngCurrencyID=" & lngCurrencyID & _
                " And Budget.lngBudgetID=" & lngBudgetID
        If bytBudgetType = 1 Then
            If !blnIsNatualCurrency Then
                '本币实际发生额
                dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "折本位币", dtAmount, 1 Or ctCurrency, , 1, True)
                If dblAmount <> 0 Then
                    clsFomular.FormulaType = ftAccount
                    clsFomular.AccountCond = strCond3
                    dblAmount2 = clsFomular.AccountData("发生净额", dBegin, dEnd, strCond2, "折本位币", dtAmount, , 1 Or ctCurrency, , True)
                    If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                        strErrorMsg = strErrorMsg & "本币发生净额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                    End If
                End If
            End If
            If !blnIsOriginalCurrency Then
                '原币实际发生额
                dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "原币", dtAmount, 1 Or ctCurrency, , 1, True)
                If dblAmount <> 0 Then
                    clsFomular.FormulaType = ftAccount
                    clsFomular.AccountCond = strCond3
                    dblAmount2 = clsFomular.AccountData("发生净额", dBegin, dEnd, strCond2, "原币", dtAmount, , 1 Or ctCurrency, , True)
                    If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                        strErrorMsg = strErrorMsg & "原币发生净额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                    End If
                End If
            End If
            If !blnIsQuantity Then
                '数量实际发生额
                dblQuan = clsFomular.YSS2(dNow, dNow, strCond, "数量", dtQuantity, ctAccount Or ctCurrency, blnOK, 1, True)
                If dblQuan <> 0 Then
                    clsFomular.FormulaType = ftAccount
                    clsFomular.AccountCond = strCond3
                    dblQuan2 = clsFomular.AccountData("发生净额", dBegin, dEnd, strCond2, , dtQuantity, , ctAccount Or ctCurrency, , True)
                    If (dblQuan2 > dblQuan And dblQuan > 0) Or (dblQuan2 < dblQuan And dblQuan < 0) Then
                        strErrorMsg = strErrorMsg & "数量发生净额超过预算" & Format(Abs(dblQuan2) - Abs(dblQuan), GetFormat(mvarQuantityDec)) & "。" & Chr(13)
                    End If
                End If
            End If
        End If
        '-------------------------
        If bytBudgetType = 2 Then
            If !blnIsNatualCurrency Then
                '本币借方发生额
                If AccountDirect >= 0 Then
                    dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "折本位币", dtAmount, 1 Or ctCurrency, , 2, True)
                    If dblAmount <> 0 Then
                        clsFomular.FormulaType = ftAccount
                        clsFomular.AccountCond = strCond3
                        dblAmount2 = clsFomular.AccountData("借方发生额", dBegin, dEnd, strCond2, "折本位币", dtAmount, , , 1 Or ctCurrency, True)
                        If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                            strErrorMsg = strErrorMsg & "本币借方发生额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                        End If
                    End If
                End If
            End If
            If !blnIsOriginalCurrency Then
                '原币借方发生额
                If AccountDirect >= 0 Then
                    dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "原币", dtAmount, 1 Or ctCurrency, blnOK, 2, True)
                    If dblAmount <> 0 Then
                        clsFomular.FormulaType = ftAccount
                        clsFomular.AccountCond = strCond3
                        dblAmount2 = clsFomular.AccountData("借方发生额", dBegin, dEnd, strCond2, "原币", dtAmount, , , 1 Or ctCurrency, True)
                        If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                            strErrorMsg = strErrorMsg & "原币借方发生额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                        End If
                    End If
                End If
            End If
            If !blnIsQuantity Then
                '数量借方发生额
                If AccountDirect >= 0 Then
                    dblQuan = clsFomular.YSS2(dNow, dNow, strCond, "数量", dtQuantity, 1 Or ctCurrency, blnOK, 2, True)
                    If dblQuan <> 0 Then
                        clsFomular.FormulaType = ftAccount
                        clsFomular.AccountCond = strCond3
                        dblQuan2 = clsFomular.AccountData("借方发生额", dBegin, dEnd, strCond2, , dtQuantity, , , blnOK, True)
                        If (dblQuan2 > dblQuan And dblQuan > 0) Or (dblQuan2 < dblQuan And dblQuan < 0) Then
                            strErrorMsg = strErrorMsg & "数量借方发生额超过预算" & Format(Abs(dblQuan2) - Abs(dblQuan), GetFormat(mvarQuantityDec)) & "。" & Chr(13)
                        End If
                    End If
                End If
            End If
        End If
        '--------------------------
        If bytBudgetType = 3 Then
            If !blnIsNatualCurrency Then
                '本币贷方发生额
                If AccountDirect <= 0 Then
                    dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "折本位币", dtAmount, 1 Or ctCurrency, , 3, True)
                    If dblAmount <> 0 Then
                        clsFomular.FormulaType = ftAccount
                        clsFomular.AccountCond = strCond3
                        dblAmount2 = clsFomular.AccountData("贷方发生额", dBegin, dEnd, strCond2, "折本位币", dtAmount, , , 1 Or ctCurrency, True)
                        If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                            strErrorMsg = strErrorMsg & "本币贷方发生额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                        End If
                    End If
                End If
            End If
            If !blnIsOriginalCurrency Then
                '原币贷方发生额
                If AccountDirect <= 0 Then
                    dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "原币", dtAmount, 1 Or ctCurrency, , 3, True)
                    If dblAmount <> 0 Then
                        clsFomular.FormulaType = ftAccount
                        clsFomular.AccountCond = strCond3
                        dblAmount2 = clsFomular.AccountData("贷方发生额", dBegin, dEnd, strCond2, "原币", dtAmount, , , 1 Or ctCurrency, True)
                        If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                            strErrorMsg = strErrorMsg & "原币贷方发生额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                        End If
                    End If
                End If
            End If
            If !blnIsQuantity Then
                '数量贷方发生额
                If AccountDirect <= 0 Then
                    dblQuan = clsFomular.YSS2(dNow, dNow, strCond, "数量", dtQuantity, 1 Or ctCurrency, , 3, True)
                    If dblQuan <> 0 Then
                        clsFomular.FormulaType = ftAccount
                        clsFomular.AccountCond = strCond3
                        dblQuan2 = clsFomular.AccountData("贷方发生额", dBegin, dEnd, strCond2, , dtQuantity, , , 1 Or ctCurrency, True)
                        If (dblQuan2 > dblQuan And dblQuan > 0) Or (dblQuan2 < dblQuan And dblQuan < 0) Then
                            strErrorMsg = strErrorMsg & "数量贷方发生额超过预算" & Format(Abs(dblQuan2) - Abs(dblQuan), GetFormat(mvarQuantityDec)) & "。" & Chr(13)
                        End If
                    End If
                End If
            End If
        End If
        '---------------------------
        If bytBudgetType = 4 Then
            If !blnIsNatualCurrency Then
                '本币期末余额
                dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "折本位币", dtAmount, 1 Or ctCurrency, , 4, True)
                If dblAmount <> 0 Then
                    clsFomular.FormulaType = ftAccount
                    clsFomular.AccountCond = strCond3
                    dblAmount2 = clsFomular.AccountData("期末余额", dBegin, dEnd, strCond2, "折本位币", dtAmount, , , 1 Or ctCurrency, True)
                    If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                        strErrorMsg = strErrorMsg & "本币期末余额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                    End If
                End If
            End If
            If !blnIsOriginalCurrency Then
                '原币期末余额
                dblAmount = clsFomular.YSS2(dNow, dNow, strCond, "原币", dtAmount, 1 Or ctCurrency, , 4, True)
                If dblAmount <> 0 Then
                    clsFomular.FormulaType = ftAccount
                    clsFomular.AccountCond = strCond3
                    dblAmount2 = clsFomular.AccountData("期末余额", dBegin, dEnd, strCond2, "原币", dtAmount, , , 1 Or ctCurrency, True)
                    If (dblAmount2 > dblAmount And dblAmount > 0) Or (dblAmount2 < dblAmount And dblAmount < 0) Then
                        strErrorMsg = strErrorMsg & "原币期末余额超过预算" & Format(Abs(dblAmount2) - Abs(dblAmount), GetFormat(mvarNaturalCurDec)) & "。" & Chr(13)
                    End If
                End If
            End If
            If !blnIsQuantity Then
                '数量期末余额
                dblQuan = clsFomular.YSS2(dNow, dNow, strCond, "数量", dtQuantity, 1 Or ctCurrency, , 4, True)
                If dblQuan <> 0 Then
                    clsFomular.FormulaType = ftAccount
                    clsFomular.AccountCond = strCond3
                    dblQuan2 = clsFomular.AccountData("期末余额", dBegin, dEnd, strCond2, , dtQuantity, , , blnOK, True)
                    If (dblQuan2 > dblQuan And dblQuan > 0) Or (dblQuan2 < dblQuan And dblQuan < 0) Then
                        strErrorMsg = strErrorMsg & "数量期末余额超过预算" & Format(Abs(dblQuan2) - Abs(dblQuan), GetFormat(mvarQuantityDec)) & "。" & Chr(13)
                    End If
                End If
            End If
        End If
NextOne:
        .MoveNext
    Loop
End With
    If strErrorMsg <> "" Then
        lngIsOver = ShowMsg(lnghWnd, strAccountName & strErrorMsg & "    是否修改记帐凭证?", MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2, App.title)
        If lngIsOver <> IDNO Then
            IsOver = True

⌨️ 快捷键说明

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