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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 4 页
字号:
        Str_QueryCondi = " where 1=1 "
        For jsqte = 1 To 12
            Select Case jsqte
                Case 1  '订单日期(起)
                    If Trim(.LrText(0).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And OrderFormDate >='" & Trim(Trim(.LrText(0).Text)) & "'"
                    End If
                Case 2  '订单日期(止)
                    If Trim(.LrText(1).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And OrderFormDate <='" & Trim(Trim(.LrText(1).Text)) & "'"
                    End If
                Case 3  '供应商
                    If Trim(.LrText(2).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " And SupplierCode ='" & Trim(.LrText(2).Tag) & "'"
                    End If
                Case 4  '订单号
                    If Trim(.LrText(3).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and OrderFormNum = '" & Trim(.LrText(3).Text) & "'"
                    End If
                Case 5  '物料分类
                    If Trim(.LrText(4).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and PurSortCode like '" & Trim(.LrText(4).Tag) & "%'"
                    End If
                Case 6   '物料编码
                    If Trim(.LrText(5).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and MNumber = '" & Trim(.LrText(5).Tag) & "'"
                    End If
                Case 7   '付款条件
                    If Trim(.LrText(6).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and PayCode = '" & Trim(.LrText(6).Tag) & "'"
                    End If
                Case 8   '统计方式
                    For Int_Stat = 0 To .Opt_Stat.count - 1
                        If .Opt_Stat(Int_Stat) Then
                            Exit For
                        End If
                    Next
                Case 9  '运输方式
                    If Trim(.LrText(7).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and TransferWayCode = '" & Trim(.LrText(7).Tag) & "'"
                    End If
                Case 10  '币种
                    If Trim(.LrText(8).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and ForeignCurrCode = '" & Trim(.LrText(8).Tag) & "'"
                    End If
                Case 11  '业务员
                    If Trim(.LrText(9).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and PersonCode = '" & Trim(.LrText(9).Tag) & "'"
                    End If
                Case 12  '订单类型
                    If Trim(.LrText(10).Text) <> "" Then
                        Str_QueryCondi = Str_QueryCondi & " and OrderTypeCode = '" & Trim(.LrText(10).Tag) & "'"
                    End If
            End Select
        Next jsqte
    End With
    
    Str_QueryCondi = Str_QueryCondi & " and Checker<>'' "
    '汇总方式
    Select Case Int_Stat
        Case 0
            Sqlstr = "Select SupplierCode,SupplierName,Sum(Quantity) as SumQuantity,Sum(MoneyTotalBb) as SumMoneyTotalBb," & _
                    "Sum(AddupArriveQuan) As SumAddupArriveQuan,Sum(AddupArriveMoneyBb) As SumAddupArriveMoneyBb," & _
                    "Sum(AddupInvoiceQuan) As SumAddupInvoiceQuan,Sum(AddupInvoiceMoneyBb) As SumAddupInvoiceMoneyBb " & _
                    " From Cg_V_OrderForm " & Str_QueryCondi & " Group By SupplierCode,SupplierName"
            '重新初始化网格
            GridCode = "Cg_OrderExecTotal1"
            Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
            Qslz = GridInf(1)
            Sjhgd = GridInf(2)
            Sfxshjwg = GridInf(7)
            Szzls = CxbbGrid.Cols - 1
            '填充网格
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
            With Rec_Query
                CxbbGrid.Rows = CxbbGrid.FixedRows
                jsqte = CxbbGrid.FixedRows
                Do While Not .EOF
                    CxbbGrid.AddItem ""
                    '[>>自定义填充内容
                    CxbbGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("SupplierName") & "")                      '供应商
                    CxbbGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("SumQuantity"))                            '订单数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("SumMoneyTotalBb") & "")                   '订单金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveQuan") & "")                '累计到货数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveMoneyBb") & "")             '累计到货金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceQuan") & "")               '累计发票数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceMoneyBb") & "")            '累计发票金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("SupplierCode") & "")                      '供应商编码
                    '<<]
                    '设置数据行高度(Fixed)
                    CxbbGrid.RowHeight(jsqte) = Sjhgd
             
                    '动态集指针加1,同时将计数器加1(Fixed)
                    .MoveNext
                    jsqte = jsqte + 1
                Loop
            End With
        Case 1
            Sqlstr = "Select MNumber,MName,Model,PurUnitName,Sum(Quantity) as SumQuantity,Sum(MoneyTotalBb) as SumMoneyTotalBb," & _
                    "Sum(AddupArriveQuan) As SumAddupArriveQuan,Sum(AddupArriveMoneyBb) As SumAddupArriveMoneyBb," & _
                    "Sum(AddupInvoiceQuan) As SumAddupInvoiceQuan,Sum(AddupInvoiceMoneyBb) As SumAddupInvoiceMoneyBb " & _
                    " From Cg_V_OrderForm " & Str_QueryCondi & " Group By MNumber,MName,Model,PurUnitName"
            '重新初始化网格
            GridCode = "Cg_OrderExecTotal4"
            Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
            Qslz = GridInf(1)
            Sjhgd = GridInf(2)
            Sfxshjwg = GridInf(7)
            Szzls = CxbbGrid.Cols - 1
            '填充网格
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
            With Rec_Query
                CxbbGrid.Rows = CxbbGrid.FixedRows
                jsqte = CxbbGrid.FixedRows
                Do While Not .EOF
                    CxbbGrid.AddItem ""
                    '[>>自定义填充内容
                    CxbbGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("MNumber") & "")                       '物料编码
                    CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("MName") & "")                         '物料名称
                    CxbbGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                         '规格型号
                    CxbbGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = Trim(.Fields("PurUnitName") & "")                   '计量单位
                    CxbbGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("SumQuantity"))                        '订单数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("SumMoneyTotalBb") & "")               '订单金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveQuan") & "")            '累计到货数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveMoneyBb") & "")         '累计到货金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceQuan") & "")           '累计发票数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceMoneyBb") & "")        '累计发票金额
                    '<<]
                    '设置数据行高度(Fixed)
                    CxbbGrid.RowHeight(jsqte) = Sjhgd
             
                    '动态集指针加1,同时将计数器加1(Fixed)
                    .MoveNext
                    jsqte = jsqte + 1
                Loop
            End With
        Case 2
            Sqlstr = "Select PersonCode,PersonName,Sum(Quantity) as SumQuantity,Sum(MoneyTotalBb) as SumMoneyTotalBb," & _
                    "Sum(AddupArriveQuan) As SumAddupArriveQuan,Sum(AddupArriveMoneyBb) As SumAddupArriveMoneyBb," & _
                    "Sum(AddupInvoiceQuan) As SumAddupInvoiceQuan,Sum(AddupInvoiceMoneyBb) As SumAddupInvoiceMoneyBb " & _
                    " From Cg_V_OrderForm " & Str_QueryCondi & " Group By PersonCode,PersonName"
            '重新初始化网格
            GridCode = "Cg_OrderExecTotal3"
            Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
            Qslz = GridInf(1)
            Sjhgd = GridInf(2)
            Sfxshjwg = GridInf(7)
            Szzls = CxbbGrid.Cols - 1
            '填充网格
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
            With Rec_Query
                CxbbGrid.Rows = CxbbGrid.FixedRows
                jsqte = CxbbGrid.FixedRows
                Do While Not .EOF
                    CxbbGrid.AddItem ""
                    '[>>自定义填充内容
                    CxbbGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("PersonName") & "")                        '业务员
                    CxbbGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("SumQuantity"))                            '订单数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("SumMoneyTotalBb") & "")                   '订单金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveQuan") & "")                '累计到货数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveMoneyBb") & "")             '累计到货金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceQuan") & "")               '累计发票数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceMoneyBb") & "")            '累计发票金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("PersonCode") & "")                        '业务员编码
                    '<<]
                    '设置数据行高度(Fixed)
                    CxbbGrid.RowHeight(jsqte) = Sjhgd
             
                    '动态集指针加1,同时将计数器加1(Fixed)
                    .MoveNext
                    jsqte = jsqte + 1
                Loop
            End With
        Case 3
            Sqlstr = "Select DeptCode,DeptName,Sum(Quantity) as SumQuantity,Sum(MoneyTotalBb) as SumMoneyTotalBb," & _
                    "Sum(AddupArriveQuan) As SumAddupArriveQuan,Sum(AddupArriveMoneyBb) As SumAddupArriveMoneyBb," & _
                    "Sum(AddupInvoiceQuan) As SumAddupInvoiceQuan,Sum(AddupInvoiceMoneyBb) As SumAddupInvoiceMoneyBb " & _
                    " From Cg_V_OrderForm " & Str_QueryCondi & " Group By DeptCode,DeptName"
            '重新初始化网格
            GridCode = "Cg_OrderExecTotal2"
            Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
            Qslz = GridInf(1)
            Sjhgd = GridInf(2)
            Sfxshjwg = GridInf(7)
            Szzls = CxbbGrid.Cols - 1
            '填充网格
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
            With Rec_Query
                CxbbGrid.Rows = CxbbGrid.FixedRows
                jsqte = CxbbGrid.FixedRows
                Do While Not .EOF
                    CxbbGrid.AddItem ""
                    '[>>自定义填充内容
                    CxbbGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("DeptName") & "")                      '部门
                    CxbbGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("SumQuantity"))                        '订单数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("SumMoneyTotalBb") & "")               '订单金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveQuan") & "")            '累计到货数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("SumAddupArriveMoneyBb") & "")         '累计到货金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceQuan") & "")           '累计发票数量
                    CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("SumAddupInvoiceMoneyBb") & "")        '累计发票金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("DeptCode") & "")                      '部门编码
                    '<<]
                    '设置数据行高度(Fixed)
                    CxbbGrid.RowHeight(jsqte) = Sjhgd
             
                    '动态集指针加1,同时将计数器加1(Fixed)
                    .MoveNext
                    jsqte = jsqte + 1
                Loop
            End With
    End Select
    

    ']以上为用户自定义部分

End Sub
Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
    
    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
    Bbxbt(1) = ""
    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

⌨️ 快捷键说明

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