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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 4 页
字号:
                            End If
                        Else
                            .TextMatrix(Yxhzjsq, Yxlzjsq) = Cxsjwg.TextMatrix(Rowjsq, Coljsq)
                        End If
                        Yxlzjsq = Yxlzjsq + 1
                    End If
                Next Coljsq
                .RowHeight(Yxhzjsq) = Cxsjwg.RowHeight(Rowjsq)
                Yxlzjsq = 0
                Yxhzjsq = Yxhzjsq + 1
            End If
        Next Rowjsq
        
        .Redraw = True
    End With
    
End Sub

Public Function GridRowEmpty(Cxsjwg As vsFlexGrid, Rowte As Long) As Boolean           '判断网格行是否为空行
    
    GridRowEmpty = True
    With Cxsjwg
        For jsqte = 0 To .Cols - 1
            If Len(Trim(.TextMatrix(Rowte, jsqte))) <> 0 Then
                GridRowEmpty = False
                Exit Function
            End If
        Next jsqte
    End With
    
End Function

Public Sub dyscbb(Optional PrintMessageNotShow As Boolean)                             '打 印 输 出 报 表(调用打印提示选择项窗体)
    
    If Not PrintMessageNotShow Then
        DY_DytsFrm.Show 1
    Else
        DY_DytsFrm.Output_Printer
    End If
    
End Sub

Private Function Thwxzf(Thzfc As String) As String                                     '替换打印中妨碍字符 ";"和"|" 为全角有效字符
    
    Dim lswz As Integer
    Do While InStr(1, Thzfc, ";") <> 0
        lswz = InStr(1, Thzfc, ";")
        Thzfc = Mid(Thzfc, 1, lswz - 1) + ";" + Mid(Thzfc, lswz + 1, Len(Thzfc))
    Loop
    Do While InStr(1, Thzfc, "|") <> 0
        lswz = InStr(1, Thzfc, "|")
        Thzfc = Mid(Thzfc, 1, lswz - 1) + Mid(Thzfc, lswz + 1, Len(Thzfc))
    Loop
    Thwxzf = Thzfc
    
End Function

'单据打印输出
Public Sub BillGridPrint(WglrGrid As vsFlexGrid, LrText As Object, GridStr() As String, Szzls As Integer, Grid_code As String, Text_code As String, XtReportCode As String, Optional PrintDirect As Boolean = False)
    
    Dim i As Integer, GridTop As Double, GridLeft As Double, BodyTop As Integer, FixRowHeight As Double
    Dim TableFormat As String, TableBody As String, DataRows As Integer, TableData() As String
    Dim DataRowHeight As Integer, Rowjsq As Integer, GridDataRows As Integer
    Dim aDo_Rec As New Recordset, ColSum()
    With DY_Tybbyldy
        '=====================
        Set aDo_Rec = Cw_DataEnvi.DataConnect.Execute("select * from Xt_dybbcs where bbbm='" & XtReportCode & "'")
        .Tydy.PaperSize = aDo_Rec!PaperSize
        .Tydy.Orientation = aDo_Rec!PaperScfx
        .Tydy.MarginLeft = aDo_Rec!bbzbj
        .Tydy.MarginTop = aDo_Rec!bbsbj
        aDo_Rec.Close
        '=====================
        For Rowjsq = WglrGrid.FixedRows To WglrGrid.Rows - 1
            If WglrGrid.TextMatrix(Rowjsq, 0) <> "*" Then
                Exit For
            End If
            GridDataRows = GridDataRows + 1
        Next
        
        '=====================
        Set aDo_Rec = Cw_DataEnvi.DataConnect.Execute("select * from xt_grid where grid_code='" & Grid_code & "' order by colid")
        '================
        If aDo_Rec.RecordCount > 0 Then
            '-----------
            .DyylGrid.FixedRows = aDo_Rec!FixRows: .DyylGrid.Cols = 0
            GridTop = aDo_Rec!PrintGridTop: GridLeft = aDo_Rec!PrintGridLeft
            FixRowHeight = aDo_Rec!FixRowHeight: DataRows = aDo_Rec!PrintDataRows
            DataRowHeight = aDo_Rec!DataRowHeight
            '----------
            If aDo_Rec!FixRows = 1 Then BodyTop = aDo_Rec!FixRowHeight + GridTop
            If aDo_Rec!FixRows = 2 Then BodyTop = aDo_Rec!FixRowHeight * 2 + GridTop
            If aDo_Rec!FixRows = 3 Then BodyTop = aDo_Rec!FixRowHeight * 3 + GridTop
            '----------
            aDo_Rec.MoveNext
            '================
            .DyylGrid.MergeCells = flexMergeFixedOnly
            For i = 0 To .DyylGrid.FixedRows - 1
                .DyylGrid.MergeRow(i) = True
            Next i
            i = 0
            '======================
            ReDim TableData(aDo_Rec.RecordCount - 1)
            ReDim ColSum(2, aDo_Rec.RecordCount - 1)
            
            Do While Not aDo_Rec.EOF           '网格头
                If aDo_Rec!YnPrint = False Then
                    .DyylGrid.Cols = .DyylGrid.Cols + 1
                    .DyylGrid.TextMatrix(0, i) = Trim(aDo_Rec!ColTitle1)
                    If aDo_Rec!FixRows < 1 Then .DyylGrid.TextMatrix(1, i) = Trim(aDo_Rec!ColTitle2)
                    If aDo_Rec!FixRows < 2 Then .DyylGrid.TextMatrix(2, i) = Trim(aDo_Rec!ColTitle3)
                    .DyylGrid.ColWidth(i) = aDo_Rec!ColWidth
                    .DyylGrid.MergeCol(i) = True
                    '-----------
                    If aDo_Rec!ColAlignment = 6 Then
                        TableFormat = TableFormat & "+>" & aDo_Rec!ColWidth & "|"
                    Else
                        TableFormat = TableFormat & "+<" & aDo_Rec!ColWidth & "|"
                    End If
                    TableData(i) = Trim(aDo_Rec!Colindex)
                    ColSum(0, i) = aDo_Rec!ColSum_flag
                    '-----------
                    i = i + 1
                End If
                aDo_Rec.MoveNext
            Loop
            aDo_Rec.Close
            TableFormat = Mid(TableFormat, 1, Len(TableFormat) - 1)
            '---------------
        End If
        '======================
        Dim h As Integer, PrintDataRows As Integer
        Dim PrintRow As Integer: Dim TTF As Boolean
        PrintRow = WglrGrid.FixedRows
        Set aDo_Rec = Cw_DataEnvi.DataConnect.Execute("select * from Xt_text_input where text_group_code='" & Text_code & "' order by text_index")
        '<<<<<<<<
        .Tydy.StartDoc
        '------------
        PrintDataRows = GridDataRows \ (DataRows - 1)
        If GridDataRows Mod (DataRows - 1) > 0 Then PrintDataRows = PrintDataRows + 1
        If PrintDataRows = 0 Then PrintDataRows = 1
        
        For h = 1 To PrintDataRows
            '==============
            aDo_Rec.MoveFirst
            TableBody = ""
            '----------
            Do While Not aDo_Rec.EOF '表头数据
                If aDo_Rec!YnPrint = True Then
                    .Tydy.CurrentX = aDo_Rec!LabelLeft: .Tydy.CurrentY = aDo_Rec!PrintTop
                    .Tydy = Trim(aDo_Rec!Text_Name) & ":"
                    .Tydy.CurrentX = aDo_Rec!PrintLeft: .Tydy.CurrentY = aDo_Rec!PrintTop
                    .Tydy = LrText(aDo_Rec!text_Index)
                End If
                aDo_Rec.MoveNext
            Loop
            '==========
            If DataRows <> 0 Then
                '===================== 表体数据
                
                TableBody = ""
                TTF = False
                For Rowjsq = PrintRow To WglrGrid.Rows - 1
                    If WglrGrid.TextMatrix(Rowjsq, 0) <> "*" Then
                        TTF = True
                        Exit For
                    End If
                    '----------------表体数据行
                    For i = 0 To UBound(TableData) - 1
                        TableBody = TableBody & Format(Trim(WglrGrid.TextMatrix(Rowjsq, Sydz(TableData(i), GridStr(), Szzls))), WglrGrid.ColFormat(Sydz(TableData(i), GridStr(), Szzls))) & "|"
                        If ColSum(0, i) = True Then
                            ColSum(1, i) = ColSum(1, i) + Val(WglrGrid.TextMatrix(Rowjsq, Sydz(TableData(i), GridStr(), Szzls)))
                        End If
                    Next i
                    TableBody = Mid(TableBody, 1, Len(TableBody) - 1)
                    TableBody = TableBody & ";"
                    PrintRow = PrintRow + 1
                    
                    If (Rowjsq - WglrGrid.FixedRows + 1) - ((DataRows - 1) * h) = 0 Then
                        Exit For
                    End If
                    
                Next Rowjsq
                
                For DataRow = (Rowjsq - WglrGrid.FixedRows + 1) - ((DataRows - 1) * (h - 1)) To DataRows
                    
                    If DataRow = IIf(TTF, DataRows, DataRows - 1) Then
                        TableBody = TableBody & "小计:" & "|"
                        '--------
                        For i = 1 To UBound(TableData) - 1
                            If ColSum(0, i) = True Then
                                TableBody = TableBody & Format(Trim(ColSum(1, i)), WglrGrid.ColFormat(Sydz(TableData(i), GridStr(), Szzls))) & "|"
                                ColSum(1, i) = 0
                            Else
                                TableBody = TableBody & " |"
                            End If
                        Next i
                        '--------
                        TableBody = Mid(TableBody, 1, Len(TableBody) - 1) & ";"
                        Exit For
                    End If
                    '=============================
                    For i = 0 To UBound(TableData) - 1
                        TableBody = TableBody & " |"
                    Next i
                    TableBody = Mid(TableBody, 1, Len(TableBody) - 1) & ";"
                Next DataRow
                
                
                '=====================
                Call scbbbt(.DyylGrid, 0, .DyylGrid.Cols - 1, 1, FixRowHeight, GridTop, GridLeft, GridLeft, False)
                '====================
                .Tydy.MarginLeft = GridLeft: .Tydy.CurrentY = BodyTop
                .Tydy.StartTable
                '--------
                .Tydy.AddTable TableFormat, "", TableBody, , , True
                .Tydy.TableCell(tcRows) = DataRows
                For i = 1 To DataRows
                    .Tydy.TableCell(tcRowHeight, i) = DataRowHeight
                Next
                '--------
                .Tydy.EndTable
                '===================
                If h < PrintDataRows Then
                    .Tydy.NewPage
                End If
                '=================
                
            End If
            
        Next h
        '================
        
        .Tydy.EndDoc
        
        '判断是直接打印还是预览
        If Not PrintDirect Then
            .Show 1                                     '预览
        Else
            Call DY_DytsFrm.Output_Printer              '直接打印输出
            Unload DY_Tybbyldy                          '卸载打印预览窗体
            Unload DY_DytsFrm                           '卸载打印选择提示选项
        End If
        
    End With
    
End Sub

'单据打印输出
Public Sub BillTextPrint(LrText As Object, Text_code As String, XtReportCode As String, Optional PrintDirect As Boolean = False)
    Dim aDo_Rec As New Recordset
    With DY_Tybbyldy
        '=====================
        Set aDo_Rec = Cw_DataEnvi.DataConnect.Execute("select * from Xt_dybbcs where bbbm='" & XtReportCode & "'")
        .Tydy.PaperSize = aDo_Rec!PaperSize
        .Tydy.Orientation = aDo_Rec!PaperScfx
        .Tydy.MarginLeft = aDo_Rec!bbzbj
        .Tydy.MarginTop = aDo_Rec!bbsbj
        aDo_Rec.Close
        '=====================
        
        Set aDo_Rec = Cw_DataEnvi.DataConnect.Execute("select * from Xt_text_input where text_group_code='" & Text_code & "' order by text_index")
        '<<<<<<<<
        .Tydy.StartDoc
        
        '=========
        Do While Not aDo_Rec.EOF '表头数据
            If aDo_Rec!YnPrint = True Then
                .Tydy.CurrentX = aDo_Rec!LabelLeft: .Tydy.CurrentY = aDo_Rec!PrintTop
                .Tydy = Trim(aDo_Rec!Text_Name) & ":"
                .Tydy.CurrentX = aDo_Rec!PrintLeft: .Tydy.CurrentY = aDo_Rec!PrintTop
                .Tydy = LrText(aDo_Rec!text_Index)
            End If
            aDo_Rec.MoveNext
        Loop
        '==========
        
        .Tydy.EndDoc
        
        '判断是直接打印还是预览
        If Not PrintDirect Then
            .Show 1                                     '预览
        Else
            Call DY_DytsFrm.Output_Printer              '直接打印输出
            Unload DY_Tybbyldy                          '卸载打印预览窗体
            Unload DY_DytsFrm                           '卸载打印选择提示选项
        End If
        
    End With
    
End Sub

⌨️ 快捷键说明

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