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

📄 frmacountbook.frm

📁 金算盘软件代码
💻 FRM
📖 第 1 页 / 共 5 页
字号:
Private marrPeriod() As Variant
Private mblnDiff As Boolean
Private mblnAlign  As Boolean
Private mstrCond As String           '表头栏目对应的条件
Private mblnHeadChange As Boolean    '表头设置是否改变
Private mlngPageAlign As Long        '页号显示对齐方式
Private mblnFirstLoad As Boolean

Private mblnLockHead As Boolean
Private mintDateIndex As Integer     '日期表头对应的Index
Private mstrOldDate As String
Private mblnPrint As Boolean         '是否处于打印状态
Private mblnRefresh As Boolean       '是否自动刷新

Private mblnCancelPrint As Boolean
Private mblnInto As Boolean
Private mintProduct As Integer

'''''''''''''''''''''''''''''
'
'         数据组织
'
'''''''''''''''''''''''''''''

Private Function GetPeriod(ByVal tYear As Integer, ByVal tMonth As Integer, ByVal tDay As Integer) As Integer
   Dim dNow As Date
   Dim intCount As Integer
     
     On Error GoTo ErrHandle
     dNow = Format(CStr(tYear) & "-" & CStr(tMonth) & "-" & CStr(tDay), "YYYY-MM-DD")
     For intCount = 1 To UBound(marrPeriod)
         If dNow >= marrPeriod(intCount, 3) And dNow <= marrPeriod(intCount, 4) Then
            GetPeriod = marrPeriod(intCount, 2)
            Exit Function
         End If
     Next intCount
     Exit Function
ErrHandle:
End Function

Private Sub InitTotalColumn()
  Dim intCount As Integer
  
   With mclsReportSet
       ReDim mlngDayTotal(.Columns)
       ReDim mlngDayAll(.Columns)
       ReDim mlngNowTotal(.Columns)
       ReDim mlngNowAll(.Columns)
   End With
End Sub

'本日合计、本日累计
Private Sub AddDayTotal(Optional ByVal AddRow As Integer = 0)
  Dim intCol As Integer
  Dim strName As String
  Dim strQuantityFormat As String
  
   strQuantityFormat = GetDec(2)
   With grdAcntBook
       .Redraw = False
       If AddRow = 0 Then
           .AddItem ""
           AddRow = .Rows - 1
       Else
           .AddItem "", AddRow
       End If
       If mintRemarkCol > 0 Then
           .TextMatrix(AddRow, mintRemarkCol) = "本日合计"
           .TextMatrix(AddRow, mintMonthCol) = Format(mstrMonth, "00")
           .TextMatrix(AddRow, mintDayCol) = Format(mstrDay, "00")
           If mintAmountBanCol > -1 Then
              .TextMatrix(AddRow, mintAmountBanCol) = Format(.TextMatrix(AddRow - 1, mintAmountBanCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
           End If
           If mintQuantityBanCol > -1 Then
              .TextMatrix(AddRow, mintQuantityBanCol) = .TextMatrix(AddRow - 1, mintQuantityBanCol)
           End If
           If mintCurrencyBanCol > -1 Then
              .TextMatrix(AddRow, mintCurrencyBanCol) = .TextMatrix(AddRow - 1, mintCurrencyBanCol)
              If mstrCurName <> "" Then
                 .TextMatrix(AddRow, mintCurrencyBanCol) = Format(.TextMatrix(AddRow, mintCurrencyBanCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
              End If
           End If
           If mintDirectCol > -1 Then
              .TextMatrix(AddRow, mintDirectCol) = .TextMatrix(AddRow - 1, mintDirectCol)
           End If
           For intCol = 1 To .Cols - 1
                 If mlngDayTotal(intCol) <> "Err" And mlngDayTotal(intCol) <> "" Then
                      '单价不用合计(委托加工商品帐的数量也不用合计)
                      strName = mclsReportSet.ColumnDesc(intCol + 1)
                      If InStr(1, strName, "单价") = 0 And InStr(1, strName, "对方科目") = 0 And _
                         Not (mclsReportSet.ViewId = 176 And InStr(1, strName, "数量") <> 0) Then
                         .TextMatrix(AddRow, intCol) = IIf(mlngDayTotal(intCol) <> 0, mlngDayTotal(intCol), "")
                         If InStr(1, strName, "原币") = 0 And (InStr(1, strName, "本币") <> 0 Or InStr(1, strName, "借方金额") <> 0 Or InStr(1, strName, "贷方金额") <> 0 _
                             Or InStr(1, strName, "原值增加") <> 0 Or InStr(1, strName, "原值减少") <> 0 _
                             Or InStr(1, strName, "累计折旧增加") <> 0 Or InStr(1, strName, "累计折旧减少") <> 0) Then
                             .TextMatrix(AddRow, intCol) = Format(.TextMatrix(AddRow, intCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
                         End If
                         If InStr(1, strName, "原币") <> 0 And mstrCurName <> "" Then
                             .TextMatrix(AddRow, intCol) = Format(.TextMatrix(AddRow, intCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
                         End If
                         If InStr(1, strName, "数量") <> 0 Then
                             .TextMatrix(AddRow, intCol) = Format(.TextMatrix(AddRow, intCol), strQuantityFormat)
                         End If
                      End If
                      mlngDayTotal(intCol) = 0
                 End If
           Next intCol
           .RowData(AddRow) = 1
       End If
       .Redraw = True
   End With
   
End Sub

Private Sub SetDirect(ByVal intRow As Integer, Optional ByVal curBalance As Double = -1, Optional ByVal tRow As Long, Optional ByVal tCol As Long)
   If mintDirectCol > 0 Then
        
        '进销差价帐
        If mclsReportSet.ViewId = 681 Then
           grdAcntBook.TextMatrix(intRow, mintDirectCol) = "贷"
           Exit Sub
        End If
        If curBalance <> 0 Then
            If mclsReportSet.Direct = 0 Then
                If curBalance > 0 Then
                    grdAcntBook.TextMatrix(intRow, mintDirectCol) = "借"
                Else
                    grdAcntBook.TextMatrix(intRow, mintDirectCol) = "贷"
                    grdAcntBook.TextMatrix(tRow, tCol) = Abs(curBalance)
                    If mintCurrencyBanCol > -1 And tRow = 0 Then
                        grdAcntBook.TextMatrix(tRow, mintCurrencyBanCol) = Abs(grdAcntBook.TextMatrix(tRow, mintCurrencyBanCol))
                    End If
                    If mintQuantityBanCol > -1 And tRow = 0 Then
                        grdAcntBook.TextMatrix(tRow, mintQuantityBanCol) = Abs(grdAcntBook.TextMatrix(tRow, mintQuantityBanCol))
                    End If
                End If
            Else
                If mblnVirtual Then
                    Select Case mclsReportSet.Direct
                       Case 1
                          grdAcntBook.TextMatrix(intRow, mintDirectCol) = "借"
                       Case -1
                          grdAcntBook.TextMatrix(intRow, mintDirectCol) = "贷"
                    End Select
                Else
                    Select Case mintDirect
                       Case 1
                          grdAcntBook.TextMatrix(intRow, mintDirectCol) = "借"
                       Case -1
                          grdAcntBook.TextMatrix(intRow, mintDirectCol) = "贷"
                       Case 0
                          If curBalance > 0 Then
                              grdAcntBook.TextMatrix(intRow, mintDirectCol) = "借"
                          Else
                              grdAcntBook.TextMatrix(intRow, mintDirectCol) = "贷"
                              grdAcntBook.TextMatrix(tRow, tCol) = Abs(curBalance)
                          End If
                    End Select
                End If
            End If
        Else
            If Not (mintAmountBanCol > -1 And (mintCurrencyBanCol = tCol Or mintQuantityBanCol = tCol)) Then
               grdAcntBook.TextMatrix(intRow, mintDirectCol) = "平"
            End If
        End If
   End If
End Sub

'当前合计、当前累计
Private Sub AddPeriodEnd(Optional ByVal AddRow As Integer = 0, Optional blnLast As Boolean = False, _
                         Optional blnEnd As Boolean = False, Optional blnBegin As Boolean = False)
  Dim intCol As Integer
  Dim strName As String
  Dim strTotal As String, strSum As String
  Dim strQuantityFormat As String
  Dim IsMonth As Boolean
  
   If gclsBase.PeriodIsClosed(mintYear, Val(mstrMonth), IsMonth) Then
      If IsMonth Then
         strTotal = "本月合计"
      Else
         strTotal = "本期合计"
      End If
      strSum = "本年累计"
   Else
      strTotal = "当前合计"
      strSum = "当前累计"
   End If
   strQuantityFormat = GetDec(2)
  
   With grdAcntBook
       .Redraw = False
       
       If AddRow = 0 Then
           .AddItem ""
           AddRow = .Rows - 1
       Else
           .AddItem "", AddRow
       End If
       If blnEnd Then
         If mintRemarkCol > 0 Then
             .TextMatrix(AddRow, mintRemarkCol) = "过次页"
         End If
         If mintAmountBanCol > 0 Then
            .TextMatrix(AddRow, mintAmountBanCol) = Format(.TextMatrix(AddRow - 1, mintAmountBanCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
         End If
         If mintQuantityBanCol > 0 Then
            .TextMatrix(AddRow, mintQuantityBanCol) = .TextMatrix(AddRow - 1, mintQuantityBanCol)
         End If
         If mintCurrencyBanCol > 0 Then
            .TextMatrix(AddRow, mintCurrencyBanCol) = .TextMatrix(AddRow - 1, mintCurrencyBanCol)
            If mstrCurName <> "" Then
               .TextMatrix(AddRow, mintCurrencyBanCol) = Format(.TextMatrix(AddRow, mintCurrencyBanCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
            End If
         End If
         If (mintAmountBanCol > 0 And mintDirectCol > -1) Or (mclsReportSet.ViewId = 681 And mintCurrencyBanCol > 0 And mintDirectCol > -1) Then
              .TextMatrix(AddRow, mintDirectCol) = .TextMatrix(AddRow - 1, mintDirectCol)
         End If
         Exit Sub
       End If
       
       If blnBegin Then
           If mintRemarkCol > 0 Then
           .TextMatrix(AddRow, mintRemarkCol) = "承前页"
           End If
           If mintAmountBanCol > 0 Then
              .TextMatrix(AddRow, mintAmountBanCol) = Format(.TextMatrix(AddRow - 2, mintAmountBanCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
           End If
           If mintQuantityBanCol > 0 Then
              .TextMatrix(AddRow, mintQuantityBanCol) = .TextMatrix(AddRow - 2, mintQuantityBanCol)
           End If
           If mintCurrencyBanCol > 0 Then
              .TextMatrix(AddRow, mintCurrencyBanCol) = .TextMatrix(AddRow - 2, mintCurrencyBanCol)
              If mstrCurName <> "" Then
                 .TextMatrix(AddRow, mintCurrencyBanCol) = Format(.TextMatrix(AddRow, mintCurrencyBanCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
              End If
           End If
           If (mintAmountBanCol > 0 And mintDirectCol > -1) Or (mclsReportSet.ViewId = 681 And mintCurrencyBanCol > 0 And mintDirectCol > -1) Then
                .TextMatrix(AddRow, mintDirectCol) = .TextMatrix(AddRow - 2, mintDirectCol)
           End If
           Exit Sub
       End If
       
       If mintRemarkCol > 0 Then
           .TextMatrix(AddRow, mintRemarkCol) = strTotal
           .TextMatrix(AddRow, mintMonthCol) = Format(mstrMonth, "00")
           If mintAmountBanCol > 0 Then
              .TextMatrix(AddRow, mintAmountBanCol) = Format(.TextMatrix(AddRow - 1, mintAmountBanCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
           End If
           If mintQuantityBanCol > 0 Then
              .TextMatrix(AddRow, mintQuantityBanCol) = .TextMatrix(AddRow - 1, mintQuantityBanCol)
           End If
           If mintCurrencyBanCol > 0 Then
              .TextMatrix(AddRow, mintCurrencyBanCol) = .TextMatrix(AddRow - 1, mintCurrencyBanCol)
              If mstrCurName <> "" Then
                 .TextMatrix(AddRow, mintCurrencyBanCol) = Format(.TextMatrix(AddRow, mintCurrencyBanCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
              End If
           End If
           If (mintAmountBanCol > 0 And mintDirectCol > -1) Or (mclsReportSet.ViewId = 681 And mintCurrencyBanCol > 0 And mintDirectCol > -1) Then
                .TextMatrix(AddRow, mintDirectCol) = .TextMatrix(AddRow - 1, mintDirectCol)
           End If
           .RowData(AddRow) = 1
           For intCol = 3 To .Cols - 1
                 If mlngNowTotal(intCol) <> "Err" And mlngNowTotal(intCol) <> "" Then
                      '单价不用合计(委托加工商品帐的数量也不用合计)
                      strName = mclsReportSet.ColumnDesc(intCol + 1)
                      If InStr(1, strName, "单价") = 0 And InStr(1, strName, "对方科目") = 0 And _
                         Not (mclsReportSet.ViewId = 176 And InStr(1, strName, "数量") <> 0) Then
                         .TextMatrix(AddRow, intCol) = IIf(mlngNowTotal(intCol) <> 0, mlngNowTotal(intCol), "")
                         If InStr(1, strName, "原币") = 0 And (InStr(1, strName, "本币") <> 0 Or InStr(1, strName, "借方金额") <> 0 _
                            Or InStr(1, strName, "贷方金额") <> 0 _
                            Or InStr(1, strName, "原值增加") <> 0 Or InStr(1, strName, "原值减少") <> 0 _
                            Or InStr(1, strName, "累计折旧增加") <> 0 Or InStr(1, strName, "累计折旧减少") <> 0) Then
                             .TextMatrix(AddRow, intCol) = Format(.TextMatrix(AddRow, intCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
                         End If
                         If InStr(1, strName, "原币") <> 0 And mstrCurName <> "" Then
                             .TextMatrix(AddRow, intCol) = Format(.TextMatrix(AddRow, intCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
                         End If
                         If InStr(1, strName, "数量") <> 0 Then
                             .TextMatrix(AddRow, intCol) = Format(.TextMatrix(AddRow, intCol), strQuantityFormat)
                         End If
                      End If

⌨️ 快捷键说明

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