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

📄 z

📁 财务分析 财财务分析务分析
💻
📖 第 1 页 / 共 3 页
字号:
         Call bbyl(True)
      Case "dy"                                            '打 印
        Call bbyl(False)
      Case "cx"                                            '查 询
        Call BalFx(strItem)
        If mySeachForm.bSeach = True Then
            Call FormInit
        End If
      Case "bz"                                            '帮 助
        Call F1bz
      Case "fh"                                            '退 出
        Unload Me
    Case "xx"
        Call Form_Load
   End Select
End Sub
Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
    If DEBUG_FLAG = False Then On Error Resume Next
    Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
    Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
    Bbxbtgs = 1                                          '报 表 小 标 题 行 数
    Bbbwhgs = 0                                          '报 表 表 尾 行 数
    ReDim Bbxbt(1 To Bbxbtgs)
    ReDim bbxbtzzxs(1 To Bbxbtgs)
    If Bbbwhgs <> 0 Then
        ReDim Bbbwh(1 To Bbbwhgs)
        ReDim Bbbwhzzxs(1 To Bbbwhgs)
    End If
    Bbzbt = ReportTitle
  
  
    If strItem = "cwfx_BalJds" Then
        Bbxbt(1) = "查询日期" & Space(2) & lab_Fxq.Caption & lab_fx.Caption & Space(20) & lab_Bjq.Caption & lab_bj.Caption
    Else
        Bbxbt(1) = "查询日期" & Space(2) & lab_Fxq.Caption & lab_fx.Caption & Space(20) & lab_Bjq.Caption & lab_bj.Caption & Space(20) & Label_Bfb.Caption
    End If

    bbxbtzzxs(1) = 0                                    '报表行组织形式(0-居左 1-居中 2-居右)
    Call Scyxsjb(CxbbGrid)                               '生成报表数据
    Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
    If Not bbylte Then
        Unload DY_Tybbyldy
    End If
End Sub

Private Sub FormatHead()
    If DEBUG_FLAG = False Then On Error Resume Next
    itype = intType
    Select Case intType '(窗体变量)
        Case 0 '月
            iBeginMonth = Val(Right(strBegin, 2))
            iEndMonth = Val(Right(strEnd, 2))
            iYear = Xtyear
        Case 1 '季
            iBeginMonth = Val(Right(strBegin, 2)) '此数据减2就是起始月
            iEndMonth = Val(Right(strEnd, 2)) '此数据减2就是起始月
            iYear = Xtyear
        Case 2 '年
            'iBeginMonth = Val(strBegin)
            'iEndMonth = Val(strEnd)
            iYear = Val(strBegin)
            iExYear = Val(strEnd)
    End Select
    
End Sub

Private Sub GetBalZiChan()
    If DEBUG_FLAG = False Then On Error Resume Next
    '填充资产类项目
    Dim iRow As Integer
    Set Rs = Cw_DataEnvi.DataConnect.Execute("select * from cwfx_BalanceInitial where LeftOrRight=1")
    
    iWriteRows = Rs.RecordCount - 1 '循环写入行数
    
    With CxbbGrid
        iRow = .FixedRows
        Do Until Rs.EOF
            .AddItem ""
            .TextMatrix(iRow, Sydz("001", GridStr(), Szzls)) = RTrim(Rs!comment)
            .RowHeight(iRow) = Sjhgd
            Rs.MoveNext
            iRow = iRow + 1
        Loop
    End With
End Sub
Private Sub GetBalFuZhai()
    If DEBUG_FLAG = False Then On Error Resume Next
    '填充负债类项目
    Dim iRow As Integer
    '--------------------
    Dim sigWidth As Single
    Dim sigHeight As Single
    '---------------------
    Set Rs = Cw_DataEnvi.DataConnect.Execute("select * from cwfx_BalanceInitial where LeftOrRight=0")
    
    iWriteRows = Rs.RecordCount - 1 '循环写入行数
    
    With CxbbGrid
        sigWidth = .ColWidth(1)
        sigHeight = .RowHeight(1)
        
        .Cols = .Cols + 1
        .ColAlignment(.Cols - 1) = flexAlignLeftCenter
        .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
        .ColWidth(.Cols - 1) = sigWidth
        .RowHeight(.Cols - 1) = sigHeight
        .TextMatrix(0, .Cols - 1) = "负债"
        
        iRow = .FixedRows
        Do Until Rs.EOF
            If .Rows < iRow Then .AddItem ""
            .TextMatrix(iRow, .Cols - 1) = RTrim(Rs!comment)
            .RowHeight(iRow) = Sjhgd
            Rs.MoveNext
            iRow = iRow + 1
        Loop
    End With
End Sub

Private Sub AddGridCol()
    If DEBUG_FLAG = False Then On Error Resume Next
    Dim item As Integer
    Dim i As Integer
    
    iWriteCols = 0 '循环写入写数置0
    
    Select Case itype
        Case 0 '月
            If iBeginMonth > iEndMonth Then
                item = iBeginMonth
                iBeginMonth = iEndMonth
                iEndMonth = item
            End If
            
            For i = iBeginMonth To iEndMonth
                iWriteCols = iWriteCols + 1
                With CxbbGrid
                    .Cols = .Cols + 1
                    .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
                    .ColAlignment(.Cols - 1) = 6
                    .ColFormat(.Cols - 1) = "#,##0.00"
                    .ColWidth(.Cols - 1) = COL_WIDTH
                    .TextMatrix(.FixedRows - 1, .Cols - 1) = CStr(Xtyear) & DATE_FIX & Format(i, "00") & ""
                    
                End With
            Next
        Case 1 '季
        
            If iBeginMonth > iEndMonth Then
                item = iBeginMonth
                iBeginMonth = iEndMonth
                iEndMonth = item
            End If
        
            For i = iBeginMonth To iEndMonth Step 3
            
                iWriteCols = iWriteCols + 1
                
                With CxbbGrid
                    .Cols = .Cols + 1
                    .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
                    .ColWidth(.Cols - 1) = COL_WIDTH
                    .ColAlignment(.Cols - 1) = 6
                    .ColFormat(.Cols - 1) = "#,##0.00"
                    .TextMatrix(.FixedRows - 1, .Cols - 1) = CStr(Xtyear) & DATE_FIX & Format(CStr(i - 2), "00") & "-" & CStr(Xtyear) & DATE_FIX & Format(CStr(i), "00") & ""
                End With
            Next
        Case 2 '年
            If iYear > iExYear Then
                item = iYear
                iYear = iExYear
                iExYear = item
            End If
            
            For i = iExYear To iYear
            
                iWriteCols = iWriteCols + 1
            
                With CxbbGrid
                    .Cols = .Cols + 1
                    .FixedAlignment(.Cols - 1) = flexAlignCenterCenter
                    .ColWidth(.Cols - 1) = COL_WIDTH
                    .ColAlignment(.Cols - 1) = 6
                    .ColFormat(.Cols - 1) = "#,##0.00"
                    .TextMatrix(.FixedRows - 1, .Cols - 1) = CStr(i) & "年"
                End With
            Next
    End Select
    
End Sub
'=================写数据到表格===========================================
Private Sub FillGrid()
    If DEBUG_FLAG = False Then On Error Resume Next
    Dim iRow As Integer
    Dim iCol As Integer
    Dim dbl_Return As Double
    Dim dbl_BaseValue As Double '本期数据
    Dim dbl_OldValue As Double '上期数据
   
    For iCol = GridStarCol To GridStarCol + iWriteCols - 1
        iRow = CxbbGrid.FixedRows
        With Rs
            If Not (.EOF And .BOF) Then
                .MoveFirst
                Do Until .EOF
                   ' DoEvents
                    If IsNull(!comment) = False Then
                        If iRow > CxbbGrid.Rows Then CxbbGrid.AddItem ""
                        Select Case strItem
                            Case "cwfx_BalJds" '绝对数分析
                                Label_Bfb.Visible = False
                                dbl_Return = TimeClass(Trim(!item), iCol)
                                CxbbGrid.TextMatrix(iRow, iCol) = IIf(dbl_Return = 0, "", dbl_Return)
                            Case "cwfx_BalDj" '定基分析
                                Label_Bfb.Visible = True
                                dbl_OldValue = TimeClass(Trim(!item), iCol)
                                If iCol = GridStarCol Then '如果为起始列,则基数据为本期数据
                                    dbl_BaseValue = dbl_OldValue
                                    CxbbGrid.RowData(iRow) = dbl_OldValue '并保存基数据
                                Else '取保存的基数据为比较数据
                                    dbl_BaseValue = CxbbGrid.RowData(iRow)
                                End If
                                If dbl_BaseValue <> 0 Then
                                    dbl_Return = Format((dbl_OldValue / dbl_BaseValue * 100), "#,##0.##")
                                    CxbbGrid.TextMatrix(iRow, iCol) = IIf(dbl_Return = 0, "", CStr(dbl_Return))
                                Else
                                    CxbbGrid.TextMatrix(iRow, iCol) = ""
                                End If
                                dbl_BaseValue = dbl_OldValue
                            Case "cwfx_BalHb" '环比
                                Label_Bfb.Visible = True
                                dbl_OldValue = TimeClass(Trim(!item), iCol)
                                If iCol = GridStarCol Then '如果为起始列,则基数据为本期数据
                                    dbl_BaseValue = dbl_OldValue
                                    CxbbGrid.RowData(iRow) = dbl_OldValue '并保存基数据
                                Else
                                    'dbl_BaseValue = CxbbGrid.RowData(GridStarCol)
                                    dbl_BaseValue = CxbbGrid.RowData(iRow)
                                End If
                                'If dbl_BaseValue <> 0 Then
                                If dbl_OldValue <> 0 And dbl_BaseValue = 0 Then
                                    CxbbGrid.TextMatrix(iRow, iCol) = "100"
                                ElseIf dbl_OldValue <> 0 And dbl_BaseValue <> 0 Then
                                    dbl_Return = (dbl_OldValue / dbl_BaseValue * 100) ', "#,##0.##")
                                    CxbbGrid.TextMatrix(iRow, iCol) = CStr(IIf(dbl_Return = 0, "", CStr(dbl_Return)))
                                ElseIf dbl_OldValue = 0 And dbl_BaseValue = 0 Then
                                    CxbbGrid.TextMatrix(iRow, iCol) = ""
                                ElseIf dbl_OldValue = 0 And dbl_BaseValue <> 0 Then
                                    CxbbGrid.TextMatrix(iRow, iCol) = ""
                                End If
                                CxbbGrid.RowData(iRow) = dbl_OldValue
                        End Select
                    End If
                    
                    iRow = iRow + 1
                    .MoveNext
                Loop
            End If
        End With
    Next iCol
   
End Sub

Private Function TimeClass(ByVal ItemClass As String, ByVal iCol As Integer) As Double
    If DEBUG_FLAG = False Then On Error Resume Next
    Dim iTemMonthBegin As Integer
    Dim iTemMonthEnd As Integer
    Dim iTemYear As Integer
    If DEBUG_FLAG = True Then
'        If ItemClass = "累计折旧" Then Stop
    End If
    Select Case itype
        Case 0 '月
            iTemYear = Xtyear
            iTemMonthBegin = Val(Right(CxbbGrid.TextMatrix(CxbbGrid.FixedRows - 1, iCol), 2))
            iTemMonthEnd = iTemMonthBegin
            TimeClass = myclsBal.GetPeriodValue(ItemClass, iTemMonthEnd, iTemYear)
        Case 1 '季
            iTemYear = Xtyear
            iTemMonthBegin = Val(Right(CxbbGrid.TextMatrix(CxbbGrid.FixedRows - 1, iCol), 2))
            iTemMonthEnd = iTemMonthBegin
            TimeClass = myclsBal.GetPeriodValue(ItemClass, iTemMonthEnd, iTemYear)
        Case 2 '年
            iTemYear = Val(CxbbGrid.TextMatrix(CxbbGrid.FixedRows - 1, iCol))
            TimeClass = myclsBal.GetPeriodValue(ItemClass, 12, iTemYear)
    End Select
End Function
'========================================================================

⌨️ 快捷键说明

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