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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 5 页
字号:
        Unload Me
    End Select
End Sub

Private Sub Timer1_Timer()
    Timer1.Enabled = False
    
    '加快显示速度
    CxbbGrid.Redraw = False
    
    '判断用户选择哪种核销
    Call Sub_Query1
    
    With HX_FrmHxCxtj
        
        '记录核销类型
        Int_Hxlx = .Combo_Jshxlx.ListIndex
        
        Select Case .Combo_Jshxlx.ListIndex
        Case 0              '到款结算
            Call Sub_Query2(1)
        Case 1              '预收款冲应收款
            Call Sub_Query2(2)
        Case 2              '应收冲应付款
            Call Sub_Query3
        End Select
    End With
    
    CxbbGrid.Redraw = True
    
End Sub

Private Sub Sub_Query1()                                        '生成查询结果(应收款)
    Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
    Dim Sqlstr As String                        '查询字符串
    Dim Coljsq As Long                          '网格列计数器
    Dim jsqte As Long                       '临时动态计数器
    
    Bln_Foreign = False
    
    '以下为自定义部分[
    With HX_FrmHxCxtj
        
        Str_QueryCondi = " Where 1=1 "
        For jsqte = 1 To 4
            Select Case jsqte
                
            Case 1   '单据日期范围(起始)
                If Trim(.LrText(1).Text) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " And BillDate>=' " & Trim(.LrText(1).Text) & "'"
                End If
            Case 2   '单据日期范围(终止)
                If Trim(.LrText(2).Text) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " And BillDate<= ' " & Trim(.LrText(2).Text) & "'"
                End If
                
            Case 3  '往来客户
                If Trim(.LrText(0).Tag) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " and PSCode = '" & Trim(.LrText(0).Tag) & "'"
                    Str_CusCode = Trim(.LrText(0).Tag)
                Else
                    Str_CusCode = ""
                End If
                
            Case 4  '原币名称
                If GetComboKey(.Imgebo_ForeignCurr, 0) <> "Zhbwb" Then
                    Str_QueryCondi = Str_QueryCondi & " and ForeignCurrCode='" & Trim(GetComboKey(.Imgebo_ForeignCurr, 0)) & "'"
                    Bln_Foreign = True
                End If
                
            End Select
        Next jsqte
    End With
    
    '生成应收款查询结果
    Sqlstr = "SELECT * From Ar_V_AccMxList " & Str_QueryCondi & " And RpFlag='AR' And YbYsje<>0 And OverStatus=0 " & " ORDER BY KJYear,Period,BillDate,AccListId"
    
    Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    With Rec_Query
        CxbbGrid.Rows = CxbbGrid.FixedRows
        CxbbGrid.Rows = CxbbGrid.FixedRows + .RecordCount
        jsqte = CxbbGrid.FixedRows
        
        Do While Not .EOF
            If jsqte >= CxbbGrid.Rows Then
                CxbbGrid.AddItem ""
            End If
            
            CxbbGrid.TextMatrix(jsqte, 0) = .Fields("AccListID")                                               '应收/应付明细帐ID
            
            CxbbGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = jsqte - CxbbGrid.FixedRows + 1         '行值
            CxbbGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = False                                  '选中
            CxbbGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = .Fields("BillDate")                    '单据日期
            CxbbGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("BillItemName") & "")     '单据类型
            CxbbGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("BillCode") & "")         '单据编号
            If Bln_Foreign Then
                If .Fields("YbYsje") <> 0 Then                                                                  '原币应收/应付金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = .Fields("YbYsje")
                End If
                If .Fields("YbYsje") - .Fields("YbCancelje") <> 0 Then
                    CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = .Fields("YbYsje") - .Fields("YbCancelje")  '原币未核销金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = .Fields("YbYsje") - .Fields("YbCancelje")  '本次核销金额
                End If
            Else
                If .Fields("BbYsje") <> 0 Then                                                                  '本币应收/应付金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = .Fields("BbYsje")
                End If
                If .Fields("Bbysje") - .Fields("BbCancelje") <> 0 Then
                    CxbbGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = .Fields("Bbysje") - .Fields("BbCancelje")  '本币未核销金额
                    CxbbGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = .Fields("Bbysje") - .Fields("BbCancelje")  '本次核销金额
                End If
            End If
            
            CxbbGrid.RowHeight(jsqte) = Sjhgd
            
            jsqte = jsqte + 1
            .MoveNext
            
        Loop
        
    End With
    
    ']以上为用户自定义部分
    
End Sub

Private Sub Sub_Query2(Opti As Integer)                              '生成查询结果(到款,预收款)
    Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
    Dim Sqlstr As String                        '查询字符串
    Dim Coljsq As Long                          '网格列计数器
    Dim jsqte As Long                           '临时动态计数器
    
    Bln_Foreign = False
    
    '以下为自定义部分[
    With HX_FrmHxCxtj
        
        Str_QueryCondi = " Where 1=1 "
        For jsqte = 1 To 4
            Select Case jsqte
                
            Case 1   '单据日期范围(起始)
                If Trim(.LrText(1).Text) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " And BillDate>=' " & Trim(.LrText(1).Text) & "'"
                End If
            Case 2   '单据日期范围(终止)
                If Trim(.LrText(2).Text) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " And BillDate<= ' " & Trim(.LrText(2).Text) & "'"
                End If
                
            Case 3  '往来客户
                If Trim(.LrText(0).Tag) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " and PSCode = '" & Trim(.LrText(0).Tag) & "'"
                End If
                
            Case 4  '原币名称
                If GetComboKey(.Imgebo_ForeignCurr, 0) <> "Zhbwb" Then
                    Str_QueryCondi = Str_QueryCondi & " and ForeignCurrCode='" & Trim(GetComboKey(.Imgebo_ForeignCurr, 0)) & "'"
                    Bln_Foreign = True
                End If
                
            End Select
        Next jsqte
    End With
    
    If Opti = 1 Then
        '生成到款查询结果
        Sqlstr = "SELECT * From AR_V_AccMxList " & Str_QueryCondi & " And RpFlag='AR' And (AR_V_AccMxList.BillItemCode='30' OR AR_V_AccMxList.BillItemCode='32') And AR_V_AccMxList.OverStatus=0 " & " ORDER BY KJYear,Period,BillDate,AccListId"
    Else
        '生成预收款查询结果
        Sqlstr = "SELECT * From AR_V_AccMxList " & Str_QueryCondi & " And RpFlag='AR' And (AR_V_AccMxList.BillItemCode='31' OR AR_V_AccMxList.BillItemCode='32') And AR_V_AccMxList.OverStatus=0 " & " ORDER BY KJYear,Period,BillDate,AccListId"
    End If
    
    Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    With Rec_Query
        CxbbGrid1.Rows = CxbbGrid1.FixedRows
        CxbbGrid1.Rows = CxbbGrid1.FixedRows + .RecordCount
        jsqte = CxbbGrid1.FixedRows
        
        Do While Not .EOF
            If jsqte >= CxbbGrid1.Rows Then
                CxbbGrid1.AddItem ""
            End If
            
            CxbbGrid1.TextMatrix(jsqte, 0) = .Fields("AccListID")                                                 '应收/应付明细帐ID
            
            CxbbGrid1.TextMatrix(jsqte, Sydz("001", GridStr1(), Szzls1)) = jsqte - CxbbGrid1.FixedRows + 1        '行值
            CxbbGrid1.TextMatrix(jsqte, Sydz("002", GridStr1(), Szzls1)) = False                                  '选中
            CxbbGrid1.TextMatrix(jsqte, Sydz("003", GridStr1(), Szzls1)) = .Fields("BillDate")                    '单据日期
            CxbbGrid1.TextMatrix(jsqte, Sydz("004", GridStr1(), Szzls1)) = Trim(.Fields("BillItemName") & "")     '单据类型
            CxbbGrid1.TextMatrix(jsqte, Sydz("005", GridStr1(), Szzls1)) = Trim(.Fields("BillCode") & "")         '单据编号
            If Bln_Foreign Then
                If .Fields("YbSsje") <> 0 Then                                                                     '原币收回/付款金额
                    CxbbGrid1.TextMatrix(jsqte, Sydz("006", GridStr1(), Szzls1)) = Trim(Str(.Fields("YbSsje")))
                End If
                If .Fields("YbSsje") - .Fields("YbCancelje") <> 0 Then
                    CxbbGrid1.TextMatrix(jsqte, Sydz("007", GridStr1(), Szzls1)) = Trim(Str(.Fields("YbSsje") - .Fields("YbCancelje")))  '原币已核销金额
                    CxbbGrid1.TextMatrix(jsqte, Sydz("008", GridStr1(), Szzls1)) = Trim(Str(.Fields("YbSsje") - .Fields("YbCancelje")))  '本次核销金额
                End If
            Else
                If .Fields("BbSsje") <> 0 Then                                                                     '收回/付款金额
                    CxbbGrid1.TextMatrix(jsqte, Sydz("006", GridStr1(), Szzls1)) = Trim(Str(.Fields("BbSsje")))
                End If
                If .Fields("BbSsje") - .Fields("BbCancelje") <> 0 Then
                    CxbbGrid1.TextMatrix(jsqte, Sydz("007", GridStr1(), Szzls1)) = Trim(Str(.Fields("BbSsje") - .Fields("BbCancelje")))  '已核销金额
                    CxbbGrid1.TextMatrix(jsqte, Sydz("008", GridStr1(), Szzls1)) = Trim(Str(.Fields("BbSsje") - .Fields("BbCancelje")))  '本次核销金额
                End If
            End If
            
            CxbbGrid1.RowHeight(jsqte) = Sjhgd1
            
            jsqte = jsqte + 1
            .MoveNext
            
        Loop
        
    End With
    
    ']以上为用户自定义部分
    
End Sub

Private Sub Sub_Query3()                                        '生成查询结果(应付款)
    Dim Rec_Query As New ADODB.Recordset        '查询结果动态集
    Dim Sqlstr As String                        '查询字符串
    Dim Coljsq As Long                          '网格列计数器
    Dim jsqte As Long                       '临时动态计数器
    
    Bln_Foreign = False
    
    '以下为自定义部分[
    With HX_FrmHxCxtj
        
        Str_QueryCondi = " Where 1=1 "
        For jsqte = 1 To 4
            Select Case jsqte
                
            Case 1   '单据日期范围(起始)
                If Trim(.LrText(1).Text) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " And BillDate>=' " & Trim(.LrText(1).Text) & "'"
                End If
            Case 2   '单据日期范围(终止)
                If Trim(.LrText(2).Text) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " And BillDate<= ' " & Trim(.LrText(2).Text) & "'"
                End If
                
            Case 3  '往来供应商
                If Trim(.LrText(3).Tag) <> "" Then
                    Str_QueryCondi = Str_QueryCondi & " and PSCode = '" & Trim(.LrText(3).Tag) & "'"
                    Str_SupplierCode = Trim(.LrText(3).Tag)
                Else
                    Str_SupplierCode = ""
                End If
                
            Case 4  '原币名称
                If GetComboKey(.Imgebo_ForeignCurr, 0) <> "Zhbwb" Then
                    Str_QueryCondi = Str_QueryCondi & " and ForeignCurrCode='" & Trim(GetComboKey(.Imgebo_ForeignCurr, 0)) & "'"
                    Bln_Foreign = True
                End If
                
            End Select
        Next jsqte
    End With
    
    '生成应付款查询结果
    Sqlstr = "SELECT * From AP_V_AccMxList " & Str_QueryCondi & " And RpFlag='AP' And YbYsje<>0 And OverStatus=0 " & " ORDER BY KJYear,Period,BillDate,AccListId"
    
    Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    With Rec_Query
        CxbbGrid1.Rows = CxbbGrid1.FixedRows
        CxbbGrid1.Rows = CxbbGrid1.FixedRows + .RecordCount
        jsqte = CxbbGrid1.FixedRows
        
        Do While Not .EOF
            If jsqte >= CxbbGrid1.Rows Then
                CxbbGrid1.AddItem ""
            End If
            
            CxbbGrid1.TextMatrix(jsqte, 0) = .Fields("AccListID")                                               '应收/应付明细帐ID
            
            CxbbGrid1.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = jsqte - CxbbGrid1.FixedRows + 1         '行值
            CxbbGrid1.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = False                                  '选中
            CxbbGrid1.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = .Fields("BillDate")                    '单据日期
            CxbbGrid1.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("BillItemName") & "")     '单据类型
            CxbbGrid1.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("BillCode") & "")         '单据编号
            If Bln_Foreign Then
                If .Fields("YbYsje") <> 0 Then                                                                  '原币应收/应付金额

⌨️ 快捷键说明

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