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

📄 -

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 4 页
字号:
Dim Sjhgd As Double                      '网格数据行高度
Dim Sfxshjwg As Boolean                  '是否显示合计网格
Dim GridBoolean() As Boolean             '网格列信息(布尔型)
Dim GridStr()  As String                 '网格列信息(字符型)
Dim GridInt() As Integer                 '网格列信息(整型)
Dim Szzls As Integer                     '数组总列数(网格列数-1)


Private Sub Form_Resize()                '根据窗体大小来调整网格,标题栏大小(Fixed)
    On Error Resume Next
    With CxbbGrid
        .Width = Me.Width - 160
        .Height = Me.Height - .Top - 400
    End With
    With Pic_Title
        .Width = Me.Width - 160
    End With
    
    GsToolbar.Left = Me.Width - GsToolbar.Width - 140

End Sub

Private Sub Form_Load()                                                   '窗体装出
  
    '调出打印页面设置窗体
    ReportTitle = "出库单汇总表"
    XtReportCode = "Chhs_OutBillSum"
    Load Dyymctbl
      
    '调整标题栏及网格、格式工具条位置(Fixed)
    Pic_Title.Left = 40
    Pic_Title.Top = SzToolbar.Top + SzToolbar.Height - 10
    CxbbGrid.Left = Pic_Title.Left
    CxbbGrid.Top = Pic_Title.Top + Pic_Title.Height + 20
     
    '调 出 网 格(Fixed)
    GridCode = "Chhs_OutBillSum"
    Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
      
    Qslz = GridInf(1)
    Sjhgd = GridInf(2)
    Sfxshjwg = GridInf(7)
    Szzls = CxbbGrid.Cols - 1
    
End Sub

Private Sub Form_Unload(Cancel As Integer)                                  '窗体卸载

    '卸载条件窗体
    Tjfx_OutBillSumCond.UnloadCheck.Value = 1
    Unload Tjfx_OutBillSumCond
    
    '卸载打印页面设置窗体
    Unload Dyymctbl

End Sub

Private Sub CxbbGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)           '网格列发生移动时自动交换网格索引信息
    Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
End Sub

Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)                '网格格式调整(Fixed)
  
    Select Case Button.Key
        Case "bcgs"                                          '保存表格格式
            Call Bcwggs(CxbbGrid, GridCode, GridStr())
        Case "hfmrgs"                                        '恢复默认格式
            Call Hfmrgs(CxbbGrid, GridCode, GridStr())
        Case "szxsxm"                                        '设置显示项目
            Call Szxsxm(CxbbGrid, GridCode)
            With CxbbGrid
                If GridCode = "Chhs_OutBillSum1" Then
                    For Jsqte = Sydz("005", GridStr(), .Cols - 1) + 1 To .Cols - 3 Step 3
                        .ColHidden(Jsqte) = .ColHidden(Sydz("003", GridStr(), Szzls))
                        .ColHidden(Jsqte + 1) = .ColHidden(Sydz("004", GridStr(), Szzls))
                        .ColHidden(Jsqte + 2) = .ColHidden(Sydz("005", GridStr(), Szzls))
                    Next Jsqte
                End If
            End With
    End Select

End Sub

Private Sub Sub_GridHead(SumCondIndex As Integer)            '网格表头调整(汇总条件索引)
Dim Rectemp As Recordset
Dim RecTempFz As New ADODB.Recordset
Dim Coljsq As Integer

    
    If Not Lab_Title(0).Tag = GridCode Then
        
        '更新双表头
        GridCode = Lab_Title(0).Tag
        Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
        Qslz = GridInf(1)
        Sjhgd = GridInf(2)
        Sfxshjwg = GridInf(7)
        Szzls = CxbbGrid.Cols - 1
        
        If GridCode = "Chhs_OutBillSum1" Then
        
            '更新双表头
            Set Rectemp = Cw_DataEnvi.DataConnect.Execute("select inoutclassname from gy_inoutclass where inoutflag=0 order by inoutclasscode")
            If Not Rectemp.EOF Then
                
                With CxbbGrid
                    Coljsq = .Cols
                    .Cols = .Cols + Rectemp.RecordCount * 3
                    Do While Not Rectemp.EOF
                        For Jsqte = 0 To 2
                            .TextMatrix(0, Coljsq + Jsqte) = Trim(Rectemp.Fields("inoutclassname") & "")
                            .ColAlignment(Coljsq + Jsqte) = 6
                            .FixedAlignment(Coljsq + Jsqte) = flexAlignCenterCenter
                            If Jsqte = 0 Then
                                .TextMatrix(1, Coljsq + Jsqte) = "数量"
                                .ColFormat(Coljsq + Jsqte) = .ColFormat(Sydz("003", GridStr(), .Cols - 1))
                                .ColWidth(Coljsq + Jsqte) = .ColWidth(Sydz("003", GridStr(), .Cols - 1))
                                .ColHidden(Coljsq + Jsqte) = .ColHidden(Sydz("003", GridStr(), .Cols - 1))
                            ElseIf Jsqte = 1 Then
                                .TextMatrix(1, Coljsq + Jsqte) = "单价"
                                .ColFormat(Coljsq + Jsqte) = .ColFormat(Sydz("004", GridStr(), .Cols - 1))
                                .ColWidth(Coljsq + Jsqte) = .ColWidth(Sydz("004", GridStr(), .Cols - 1))
                                .ColHidden(Coljsq + Jsqte) = .ColHidden(Sydz("004", GridStr(), .Cols - 1))
                            Else
                                .TextMatrix(1, Coljsq + Jsqte) = "金额"
                                .ColFormat(Coljsq + Jsqte) = .ColFormat(Sydz("005", GridStr(), .Cols - 1))
                                .ColWidth(Coljsq + Jsqte) = .ColWidth(Sydz("005", GridStr(), .Cols - 1))
                                .ColHidden(Coljsq + Jsqte) = .ColHidden(Sydz("005", GridStr(), .Cols - 1))
                            End If
                        Next Jsqte
                        Rectemp.MoveNext
                        Coljsq = Coljsq + 3
                    Loop
                End With
            End If
        End If
    End If
    
    Select Case SumCondIndex
        Case 0
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "仓库编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "仓库名称"
        Case 1
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "存货编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "存货名称"
        Case 2
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "部门编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "部门名称"
        Case 3
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "出库类别编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "出库类别名称"
        Case 4
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "仓库编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "仓库名称"
            CxbbGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = "仓库编码"
            CxbbGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = "仓库名称"
        Case 5
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "存货编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "存货名称"
            CxbbGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = "存货编码"
            CxbbGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = "存货名称"
        Case 6
            CxbbGrid.TextMatrix(0, Sydz("001", GridStr(), Szzls)) = "部门编码"
            CxbbGrid.TextMatrix(0, Sydz("002", GridStr(), Szzls)) = "部门名称"
            CxbbGrid.TextMatrix(1, Sydz("001", GridStr(), Szzls)) = "部门编码"
            CxbbGrid.TextMatrix(1, Sydz("002", GridStr(), Szzls)) = "部门名称"
    End Select
        
End Sub

Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
    
    Select Case Button.Key
        Case "ymsz"                                          '页面设置
            Dyymctbl.Show 1
        Case "yl"                                            '预 览
            Call bbyl(True)
        Case "dy"                                            '打 印
            Call bbyl(False)
        Case "cx"                                            '查 询
            Tjfx_OutBillSumCond.Show 1
        Case "bz"                                            '帮 助
            Call F1bz
        Case "fh"                                            '退 出
           Unload Me
    End Select

End Sub

Private Sub Timer1_Timer()                                 '在窗体激活后调出查询程序
    
    Timer1.Enabled = False
    Xt_Wait.Show
    Xt_Wait.Refresh
   
    '加快显示速度
    CxbbGrid.Redraw = False

    '生成查询结果
    Call Sub_GridHead(Tjfx_OutBillSumCond.Com_SumCond.ListIndex)
    Call Sub_Query
   
    CxbbGrid.Redraw = True
    
    Xt_Wait.Hide

End Sub

Private Sub Sub_Query()                              '生成查询结果(Define)
    
    Dim Rec_Query As Recordset                  '查询结果动态集
    Dim Coljsq As Long                          '网格列计数器
    Dim Jsqte As Long                           '临时动态计数器
    Dim Str As String
    Dim SqlStr As String
    Dim Sqlstrfz As String
    
    
    '以下为自定义部分[
 
    With Tjfx_OutBillSumCond
     
        '生成查询条件
        Str_QueryCondi = " where inoutflag=0 and " & .WhCode & " and  kjyear= " & Xtyear
        For Jsqte = 0 To 11
            Select Case Jsqte
                Case 0  '月份(起始)
                    Str_QueryCondi = Str_QueryCondi & " And a.period>= '" & .Com_QsMon.ItemData(.Com_QsMon.ListIndex) & "'"
                Case 1  '月份(终止)
                    Str_QueryCondi = Str_QueryCondi & " And a.period<= '" & .Com_JzMon.ItemData(.Com_JzMon.ListIndex) & "'"
                Case 2  '存货分类(Like)
                    If Trim(.LrText(0).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.invsortcode like '" & Trim(.LrText(0).Tag) & "%'"
                    End If
                Case 3  '查询存货范围(起始)
                    If Trim(.LrText(1).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.mnumber>='" & Trim(.LrText(1).Text) & "'"
                    End If
                Case 4  '查询存货范围(终止)
                    If Trim(.LrText(2).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.mnumber<= '" & Trim(.LrText(2).Text) & "'"
                    End If
                Case 5  '收发类别)
                    If Trim(.LrText(3).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and a.inoutclasscode = '" & Trim(.LrText(3).Tag) & "'"
                    End If
                Case 6  '客户
                    If Trim(.LrText(4).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and a.cuscode = '" & Trim(.LrText(4).Tag) & "'"
                    End If
                Case 7  '部门
                    If Trim(.LrText(5).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and a.deptcode = '" & Trim(.LrText(5).Tag) & "'"
                    End If
                Case 8  '查询单据日期范围(起始)
                    If Trim(.LrText(6).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.BillDate>='" & Trim(.LrText(6).Text) & "'"
                    End If
                Case 9  '查询单据日期范围(终止)
                    If Trim(.LrText(7).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.BillDate<= '" & Trim(.LrText(7).Text) & "'"
                    End If
                Case 10  '查询记帐日期范围(起始)
                    If Trim(.LrText(8).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.ChalkDate>='" & Trim(.LrText(8).Text) & "'"
                    End If
                Case 11  '查询记帐日期范围(终止)
                    If Trim(.LrText(9).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And a.ChalkDate<= '" & Trim(.LrText(9).Text) & "'"
                    End If
            End Select
        Next Jsqte
        If .Opt_Check(2).Value Then
           Str_QueryCondi = Str_QueryCondi & " And a.ChalkitupMan= ''"
        End If
    End With
    
    Sqlstrfz = ""
    CxbbGrid.Rows = CxbbGrid.FixedRows
    With Tjfx_OutBillSumCond
        Select Case .Com_SumCond.ListIndex
            Case 0           '按仓库汇总
                If .Opt_Check(1).Value Then
                    SqlStr = "SELECT Whcode, Whname,Sum(OutQuan) as Quan,Sum(OutMoney) as Money " & _
                            " From Chhs_v_List a " & Str_QueryCondi & _
                            " Group by a.Whcode, a.Whname " & _
                            " ORDER BY a.Whcode "
                Else
                    SqlStr = "SELECT Whcode, Whname,Sum(FactissueQuan) as Quan,Sum(IssueMoney) as Money " & _
                            " From Chhs_v_InOut a " & Str_QueryCondi & _
                            " Group by a.Whcode, a.Whname " & _
                            " ORDER BY a.Whcode "
                    Sqlstrfz = "SELECT Whcode, Whname,Sum(OutQuan) as Quan,Sum(OutMoney) as Money " & _
                            " From Chhs_v_List a " & Str_QueryCondi & _
                            " and a.Billcode in ('1302','1303') " & _
                            " Group by a.Whcode, a.Whname " & _
                            " ORDER BY a.Whcode "
                End If
            Case 1          '按存货汇总
                If .Opt_Check(1).Value Then
                    SqlStr = "SELECT Mnumber, Mname,Sum(OutQuan) as Quan,Sum(OutMoney) as Money " & _
                            " From Chhs_v_List a " & Str_QueryCondi & _
                            " Group by a.Mnumber, a.Mname " & _
                            " ORDER BY a.Mnumber "
                Else
                    SqlStr = "SELECT Mnumber, Mname,Sum(FactissueQuan) as Quan,Sum(IssueMoney) as Money " & _
                            " From Chhs_v_InOut a " & Str_QueryCondi & _
                            "  Group by a.Mnumber, a.Mname " & _
                            " ORDER BY a.Mname "
                    Sqlstrfz = "SELECT Mnumber, Mname,Sum(OutQuan) as Quan,Sum(OutMoney) as Money " & _
                            " From Chhs_v_List a " & Str_QueryCondi & _

⌨️ 快捷键说明

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