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

📄 frmbanreport.frm

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

Private Sub OneDirect()
  Dim lngRow As Long, intCol  As Integer, intCount As Integer, intTotal As Integer
  Dim intBeginDebit As Integer, intBeginCredit As Integer
  Dim intEndDebit As Integer, intEndCredit As Integer
  Dim intAccount As Integer, intDirect As Integer
  Dim dblDebit As Double, dblCredit As Double, dblTotalDebit As Double, dblTotalCredit As Double
    'marrTotalRow
    For intCol = 1 To mclsReportSet.Columns
        If InStr(mclsReportSet.ColumnDesc(intCol), "期初") <> 0 And InStr(mclsReportSet.ColumnDesc(intCol), "借方") <> 0 Then
           intBeginDebit = intCol - 1
        End If
        If InStr(mclsReportSet.ColumnDesc(intCol), "期初") <> 0 And InStr(mclsReportSet.ColumnDesc(intCol), "贷方") <> 0 Then
           intBeginCredit = intCol - 1
        End If
        If InStr(mclsReportSet.ColumnDesc(intCol), "期末") <> 0 And InStr(mclsReportSet.ColumnDesc(intCol), "借方") <> 0 Then
           intEndDebit = intCol - 1
        End If
        If InStr(mclsReportSet.ColumnDesc(intCol), "期末") <> 0 And InStr(mclsReportSet.ColumnDesc(intCol), "贷方") <> 0 Then
           intEndCredit = intCol - 1
        End If
        If InStr(mclsReportSet.ColumnDesc(intCol), "科目编码") <> 0 Then
           intAccount = intCol - 1
        End If
    Next intCol
    
    With grdAcntBook
        For lngRow = 0 To .Rows - 2
           '** IF 1 **
           If .RowData(lngRow) <> 1 And .RowHeight(lngRow) <> 0 Then
              intDirect = IIf(mcolDirect.Item(.TextMatrix(lngRow, intAccount)) = "借", 1, -1)
              
              '期初
              If IsNumeric(.TextMatrix(lngRow, intBeginDebit)) Then
                 dblDebit = CDbl(.TextMatrix(lngRow, intBeginDebit))
              Else
                 dblDebit = 0
              End If
              If IsNumeric(.TextMatrix(lngRow, intBeginCredit)) Then
                 dblCredit = CDbl(.TextMatrix(lngRow, intBeginCredit))
              Else
                 dblCredit = 0
              End If
              
              If (dblDebit <> 0 And dblCredit <> 0) Or (intDirect = 1 And dblCredit <> 0) Or (intDirect = -1 And dblDebit <> 0) Then
                    If intDirect = 1 Then
                       .TextMatrix(lngRow, intBeginDebit) = dblDebit - dblCredit
                       .TextMatrix(lngRow, intBeginCredit) = 0
                    Else
                       .TextMatrix(lngRow, intBeginDebit) = 0
                       .TextMatrix(lngRow, intBeginCredit) = dblCredit - dblDebit
                    End If
                    For intCount = 1 To UBound(marrTotalRow)
                       If marrTotalRow(intCount) > lngRow Then
                          
                          If intDirect = 1 Then
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intBeginCredit)) Then
                                 dblTotalCredit = CDbl(.TextMatrix(marrTotalRow(intCount), intBeginCredit))
                              Else
                                 dblTotalCredit = 0
                              End If
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intBeginDebit)) Then
                                 dblTotalDebit = CDbl(.TextMatrix(marrTotalRow(intCount), intBeginDebit))
                              Else
                                 dblTotalDebit = 0
                              End If
                              .TextMatrix(marrTotalRow(intCount), intBeginCredit) = dblTotalCredit - dblCredit
                              .TextMatrix(marrTotalRow(intCount), intBeginDebit) = dblTotalDebit - dblCredit
                              If IsNumeric(.TextMatrix(.Rows - 1, intBeginDebit)) Then
                                 .TextMatrix(.Rows - 1, intBeginDebit) = .TextMatrix(.Rows - 1, intBeginDebit) - dblCredit
                              Else
                                 .TextMatrix(.Rows - 1, intBeginDebit) = -dblCredit
                              End If
                              If IsNumeric(.TextMatrix(.Rows - 1, intBeginCredit)) Then
                                 .TextMatrix(.Rows - 1, intBeginCredit) = .TextMatrix(.Rows - 1, intBeginCredit) - dblCredit
                              Else
                                 .TextMatrix(.Rows - 1, intBeginCredit) = -dblCredit
                              End If
                          
                          Else
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intBeginDebit)) Then
                                 dblTotalDebit = CDbl(.TextMatrix(marrTotalRow(intCount), intBeginDebit))
                              Else
                                 dblTotalDebit = 0
                              End If
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intBeginCredit)) Then
                                 dblTotalCredit = CDbl(.TextMatrix(marrTotalRow(intCount), intBeginCredit))
                              Else
                                 dblTotalCredit = 0
                              End If
                              .TextMatrix(marrTotalRow(intCount), intBeginDebit) = dblTotalDebit - dblDebit
                              .TextMatrix(marrTotalRow(intCount), intBeginCredit) = dblTotalCredit - dblDebit
                              If IsNumeric(.TextMatrix(.Rows - 1, intBeginDebit)) Then
                                 .TextMatrix(.Rows - 1, intBeginDebit) = .TextMatrix(.Rows - 1, intBeginDebit) - dblDebit
                              Else
                                 .TextMatrix(.Rows - 1, intBeginDebit) = -dblDebit
                              End If
                              If IsNumeric(.TextMatrix(.Rows - 1, intBeginCredit)) Then
                                 .TextMatrix(.Rows - 1, intBeginCredit) = .TextMatrix(.Rows - 1, intBeginCredit) - dblDebit
                              Else
                                 .TextMatrix(.Rows - 1, intBeginCredit) = -dblDebit
                              End If
                          
                          End If
                          Exit For
                       End If
                    Next intCount
              End If
              
              '期末
              If IsNumeric(.TextMatrix(lngRow, intEndDebit)) Then
                 dblDebit = CDbl(.TextMatrix(lngRow, intEndDebit))
              Else
                 dblDebit = 0
              End If
              If IsNumeric(.TextMatrix(lngRow, intEndCredit)) Then
                 dblCredit = CDbl(.TextMatrix(lngRow, intEndCredit))
              Else
                 dblCredit = 0
              End If
              If (dblDebit <> 0 And dblCredit <> 0) Or (intDirect = 1 And dblCredit <> 0) Or (intDirect = -1 And dblDebit <> 0) Then
                    If intDirect = 1 Then
                       .TextMatrix(lngRow, intEndDebit) = dblDebit - dblCredit
                       .TextMatrix(lngRow, intEndCredit) = 0
                    Else
                       .TextMatrix(lngRow, intEndDebit) = 0
                       .TextMatrix(lngRow, intEndCredit) = dblCredit - dblDebit
                    End If
                    For intCount = 1 To UBound(marrTotalRow)
                       If marrTotalRow(intCount) > lngRow Then
                          
                          If intDirect = 1 Then
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intEndCredit)) Then
                                 dblTotalCredit = CDbl(.TextMatrix(marrTotalRow(intCount), intEndCredit))
                              Else
                                 dblTotalCredit = 0
                              End If
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intEndDebit)) Then
                                 dblTotalDebit = CDbl(.TextMatrix(marrTotalRow(intCount), intEndDebit))
                              Else
                                 dblTotalDebit = 0
                              End If
                              .TextMatrix(marrTotalRow(intCount), intEndCredit) = dblTotalCredit - dblCredit
                              .TextMatrix(marrTotalRow(intCount), intEndDebit) = dblTotalDebit - dblCredit
                              If IsNumeric(.TextMatrix(.Rows - 1, intEndDebit)) Then
                                 .TextMatrix(.Rows - 1, intEndDebit) = .TextMatrix(.Rows - 1, intEndDebit) - dblCredit
                              Else
                                 .TextMatrix(.Rows - 1, intEndDebit) = -dblCredit
                              End If
                              If IsNumeric(.TextMatrix(.Rows - 1, intEndCredit)) Then
                                 .TextMatrix(.Rows - 1, intEndCredit) = .TextMatrix(.Rows - 1, intEndCredit) - dblCredit
                              Else
                                 .TextMatrix(.Rows - 1, intEndCredit) = -dblCredit
                              End If
                          
                          Else
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intEndDebit)) Then
                                 dblTotalDebit = CDbl(.TextMatrix(marrTotalRow(intCount), intEndDebit))
                              Else
                                 dblTotalDebit = 0
                              End If
                              If IsNumeric(.TextMatrix(marrTotalRow(intCount), intEndCredit)) Then
                                 dblTotalCredit = CDbl(.TextMatrix(marrTotalRow(intCount), intEndCredit))
                              Else
                                 dblTotalCredit = 0
                              End If
                              .TextMatrix(marrTotalRow(intCount), intEndDebit) = dblTotalDebit - dblDebit
                              .TextMatrix(marrTotalRow(intCount), intEndCredit) = dblTotalCredit - dblDebit
                              If IsNumeric(.TextMatrix(.Rows - 1, intEndDebit)) Then
                                 .TextMatrix(.Rows - 1, intEndDebit) = .TextMatrix(.Rows - 1, intEndDebit) - dblDebit
                              Else
                                 .TextMatrix(.Rows - 1, intEndDebit) = -dblDebit
                              End If
                              If IsNumeric(.TextMatrix(.Rows - 1, intEndCredit)) Then
                                 .TextMatrix(.Rows - 1, intEndCredit) = .TextMatrix(.Rows - 1, intEndCredit) - dblDebit
                              Else
                                 .TextMatrix(.Rows - 1, intEndCredit) = -dblDebit
                              End If
                          
                          End If
                          Exit For
                       End If
                    Next intCount
              End If
           '** END OF IF 1 **
           End If
        Next lngRow
    
            If Not Utility.ArrIsEmpty(marrTotalRow) Then
        For intTotal = 1 To UBound(marrTotalRow)
           lngRow = marrTotalRow(intTotal)
           If lngRow = .Rows - 1 Then
              Exit For
           End If
           '** IF 1 **
           If .RowHeight(lngRow) <> 0 Then
              intDirect = mcolTypeDirect.Item(marrAccountType(intTotal))
              '期初
              If IsNumeric(.TextMatrix(lngRow, intBeginDebit)) Then
                 dblDebit = CDbl(.TextMatrix(lngRow, intBeginDebit))
              Else
                 dblDebit = 0
              End If
              If IsNumeric(.TextMatrix(lngRow, intBeginCredit)) Then
                 dblCredit = CDbl(.TextMatrix(lngRow, intBeginCredit))
              Else
                 dblCredit = 0
              End If

              If (dblDebit <> 0 And dblCredit <> 0) Or (intDirect = 1 And dblCredit <> 0) Or (intDirect = -1 And dblDebit <> 0) Then
                    If intDirect = 1 Then
                       .TextMatrix(lngRow, intBeginDebit) = dblDebit - dblCredit
                       .TextMatrix(lngRow, intBeginCredit) = 0
                    Else
                       .TextMatrix(lngRow, intBeginDebit) = 0
                       .TextMatrix(lngRow, intBeginCredit) = dblCredit - dblDebit
                    End If

                    If intDirect = 1 Then
                        If IsNumeric(.TextMatrix(.Rows - 1, intBeginDebit)) Then
                           .TextMatrix(.Rows - 1, intBeginDebit) = .TextMatrix(.Rows - 1, intBeginDebit) - dblCredit
                        Else
                           .TextMatrix(.Rows - 1, intBeginDebit) = -dblCredit
                        End If
                        If IsNumeric(.TextMatrix(.Rows - 1, intBeginCredit)) Then
                           .TextMatrix(.Rows - 1, intBeginCredit) = .TextMatrix(.Rows - 1, intBeginCredit) - dblCredit
                        Else
                           .TextMatrix(.Rows - 1, intBeginCredit) = -dblCredit
                        End If
                    Else
                        If IsNumeric(.TextMatrix(.Rows - 1, intBeginDebit)) Then
                           .TextMatrix(.Rows - 1, intBeginDebit) = .TextMatrix(.Rows - 1, intBeginDebit) - dblDebit
                        Else
                           .TextMatrix(.Rows - 1, intBeginDebit) = -dblDebit
                        End If
                        If IsNumeric(.TextMatrix(.Rows - 1, intBeginCredit)) Then
                           .TextMatrix(.Rows - 1, intBeginCredit) = .TextMatrix(.Rows - 1, intBeginCredit) - dblDebit
                        Else
                           .TextMatrix(.Rows - 1, intBeginCredit) = -dblDebit
                        End If
                    End If
              End If

              '期末
              If IsNumeric(.TextMatrix(lngRow, intEndDebit)) Then
                 dblDebit = CDbl(.TextMatrix(lngRow, intEndDebit))
              Else
                 dblDebit = 0
              End If
              If IsNumeric(.TextMatrix(lngRow, intEndCredit)) Then
                 dblCredit = CDbl(.TextMatrix(lngRow, intEndCredit))
              Else
                 dblCredit = 0
              End If
              If (dblDebit <> 0 And dblCredit <> 0) Or (intDirect = 1 And dblCredit <> 0) Or (intDirect = -1 And dblDebit <> 0) Then
                    If intDirect = 1 Then
                       .TextMatrix(lngRow, intEndDebit) = dblDebit - dblCredit
                       .TextMatrix(lngRow, intEndCredit) = 0
                    Else
                       .TextMatrix(lngRow, intEndDebit) = 0
                       .TextMatrix(lngRow, intEndCredit) = dblCredit - dblDebit
                    End If

                    If intDirect = 1 Then
                        If IsNumeric(.TextMatrix(.Rows - 1, intEndDebit)) Then
                           .TextMatrix(.Rows - 1, intEndDebit) = .TextMatrix(.Rows - 1, intEndDebit) - dblCredit
                        Else
                           .TextMatrix(.Rows - 1, intEndDebit) = -dblCredit
                        End If
                        If IsNumeric(.TextMatrix(.Rows - 1, intEndCredit)) Then
                           .TextMatrix(.Rows - 1, intEndCredit) = .TextMatrix(.Rows - 1, intEndCredit) - dblCredit
                        Else
                           .TextMatrix(.Rows - 1, intEndCredit) = -dblCredit
                        End If
                    Else
                        If IsNumeric(.TextMatrix(.Rows - 1, intEndDebit)) Then
                           .TextMatrix(.Rows - 1, intEndDebit) = .TextMatrix(.Rows - 1, intEndDebit) - dblDebit
                        Else
                           .TextMatrix(.Rows - 1, intEndDebit) = -dblDebit
                        End If
                        If IsNumeric(.TextMatrix(.Rows - 1, intEndCredit)) Then
                           .TextMatrix(.Rows - 1, intEndCredit) = .TextMatrix(.Rows - 1, intEndCredit) - dblDebit
                        Else
                           .TextMatrix(.Rows - 1, intEndCredit) = -dblDebit
                        End If
                    End If
              End If
           '** END OF IF 1 **
           End If
        Next intTotal
            End If
    End With
End Sub

'是否可统计凭证号
Private Function CanValNo(ByVal strCond As String) As Boolean
    ModifyCondPer strCond, "Voucher.blnIsVoid"
    ModifyCondPer strCond, "1-Voucher.lngPostID"
    ModifyCondPer strCond, "VoucherType.strVoucherTypeCode"
    ModifyCondPer strCond, "cDate(Voucher.strDate)"
    ModifyCondPer strCond, "cDate(Voucher.strDate)"
    ModifyCondPer strCond, UCase("VoucherType.lngVoucherTypeID")
    
    strCond = UCase(strCond)
    strCond = strReplace(strCond, "AND", "")
    strCond = strReplace(strCond, "OR", "")
    strCond = strReplace(strCond, "(", "")
    strCond = strReplace(strCond, ")", "")
    strCond = strReplace(strCond, "VOUCHERTYPE.LNGVOUCHERTYPEID IN", "")
    strCond = strReplace(strCond, " ", "")
    If Trim(strCond) = "" Or IsNumeric(strCond) Then
       CanValNo = True
       cmdMiss.Enabled = True
    Else
       CanValNo = False
       cmdMiss.Enabled = False
    End If
End Function

Private Sub AddTypeTotal()
  Dim intTR As Integer, intTC As Integer, intCount As Integer
  Dim strSql As String
  Dim rstAccountType As rdoResultset, colAccountType As Collection
  Dim blnZero As Boolean
  Dim intLack As Integer
  
    If Utility.ArrIsEmpty(marrTotalRow) Then
       Exit Sub
    End If
    If mclsReportSet.ColumnDesc(1) <> "科目编码" Then
       Exit Sub
    End If
    strSql = "Select intDirection,lngAccountTypeID,strAccountTypeName From AccountType Order By lngAccountTypeID"
    Set rstAccountType = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
    
    Set colAccountType = New Collection
    Set mcolTypeDirect = New Collection
    
    With rstAccountType
       Do While Not .EOF
          colAccountType.Add .rdoColumns("strAccountTypeName").Value, CStr(.rdoColumns("lngAccountTypeID").Value)
          mcolTypeDirect.Add .rdoColumns("intDirection").Value, CStr(.rdoColumns("lngAccountTypeID").Value)
          .MoveNext
       Loop
    End With
    
    With grdAcntBook
       For intTR = 1 To UBound(marrTotalRow)
           blnZero = True
     

⌨️ 快捷键说明

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