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

📄 ʰ

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 4 页
字号:
    If Not Textboolean(Index, 1) Then
        '无字段帮助
        Exit Sub
    End If
    TextValiJudgeLock(Index) = True
    '调出通用窗体
    Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
    '数据写回文本框
    If Len(Xtfhcs) <> 0 Then
        If Textint(Index, 3) = 1 Then
            LrText(Index).Text = Xtfhcsfz
            LrText(Index).Tag = Xtfhcs
        Else
            LrText(Index).Text = Xtfhcs
            LrText(Index).Tag = Xtfhcsfz
        End If
    End If
    TextValiJudgeLock(Index) = False
    LrText(Index).SetFocus
End Sub

'文本框得到焦点,显示相应信息
Private Sub TextShow(Index As Integer)
    '填写文本框得到焦点,进行相应信息处理程序
    TextChangeLock = True
    If Val(LrText(Index).Text) = 0 Then
        LrText(Index) = ""
    Else
        LrText(Index) = Format(LrText(Index), "0.00")
    End If
    TextChangeLock = False
End Sub

'录入文本框初始化
Private Sub Wbkcsh()
    Dim Jsqte As Integer
    '最大录入文本框索引值
    Max_Text_Index = Textvar(1)
    ReDim TextValiJudgeLock(Max_Text_Index)
    For Jsqte = 0 To Max_Text_Index
        If Len(Trim(Textstr(Jsqte, 1))) <> 0 Then
            '清空文本框
            TextChangeLock = True
            LrText(Jsqte).Text = ""
            LrText(Jsqte).Tag = ""
            If Textint(Jsqte, 5) <> 0 Then
                LrText(Jsqte).MaxLength = Textint(Jsqte, 5)
            End If
            TextChangeLock = False
        End If
        TextValiJudgeLock(Jsqte) = True
    Next Jsqte
End Sub

'文本框有效性判断
Private Function TextYxxpd(Index As Integer) As Boolean
    Dim Sqlstr As String
    Dim Findrec As ADODB.Recordset
    '文本框内容未曾改变不进行有效性判断
    If TextValiJudgeLock(Index) Then
        TextYxxpd = True
        Exit Function
    End If
    '文本框数据为空不进行有效性判断
    If Trim(LrText(Index)) = "" Then
        LrText(Index).Tag = ""
        Call Wbklrwbcl(Index)
        TextValiJudgeLock(Index) = True
        TextYxxpd = True
        Exit Function
    End If
    
    Select Case Textint(Index, 4)
    Case 1      '编码型
        Sqlstr = Trim(Textstr(Index, 5))
        Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
        Set Findrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
        If Findrec.EOF Then
            Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
            LrText(Index).SetFocus
            Exit Function
        Else
            Select Case Textint(Index, 3)
            Case 0
                If Len(Trim(Textstr(Index, 2))) <> 0 Then
                    LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
                End If
                If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
                    LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
                End If
            Case 1
                If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
                    LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
                End If
                If Len(Trim(Textstr(Index, 2))) <> 0 Then
                    LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
                End If
            End Select
        End If
    Case 2      '日期型
        If IsDate(LrText(Index).Text) Then
            LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
        Else
            Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
            LrText(Index).SetFocus
            Exit Function
        End If
    Case 3      '其他类型
    End Select
    TextValiJudgeLock(Index) = True
    TextYxxpd = True
End Function

'显示文本框所有数据和启用日期
Private Sub XSSJ()
    '查询启用日期和银行对帐单调整前余额。
    Sqlstr = "Select * From CWZZ_BankBill Where rectype=0 And Ccode='" & Val(Label2(1).Caption) & "'"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    If RecTemp.EOF = False Then
        LrText(4).Text = RecTemp.Fields!dfje
        Label2(2).Caption = Format(RecTemp.Fields("billdate"), "yyyy年mm月dd日")
    Else
        LrText(4) = "0"
    End If
    
    '写银行已达帐项
    Sqlstr = "Select Sum(JFJE) AS JFJE, Sum(DFJE) AS DFJE From CWZZ_BankBill Where RecType=1  " _
    & "And Ccode='" & Val(Label2(1).Caption) & "'"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    If RecTemp.EOF = False Then
        If IsNull(RecTemp.Fields!dfje) = False Then
            LrText(1) = RecTemp.Fields!jfje
        Else
            LrText(1) = 0
        End If
        If IsNull(RecTemp.Fields!jfje) = False Then
            LrText(2) = RecTemp.Fields!dfje
        Else
            LrText(2) = 0
        End If
    Else
        LrText(2) = 0
        LrText(1) = 0
    End If
    
    '写单位日记帐调整前余额及启用日期
    Sqlstr = "Select * From CWZZ_RJZNOTCHECK Where RecType=0 And Ccode='" & Val(Label2(1).Caption) & "'"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    If RecTemp.EOF = False Then
        LrText(0) = RecTemp.Fields!jfje
        Label2(2).Caption = Format(RecTemp.Fields("ddate"), "yyyy年mm月dd日")
    Else
        LrText(0) = "0"
    End If
    
    '写企业已达帐项
    Sqlstr = "Select Sum(JFJE) as JFJE, Sum(DFJE) as DFJE From CWZZ_RJZNOTCHECK Where RecType=1 And Ccode='" & Val(Label2(1).Caption) & "'"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    If RecTemp.EOF = False Then
        If IsNull(RecTemp.Fields!dfje) = False Then
            LrText(6) = RecTemp.Fields!dfje
        Else
            LrText(6) = 0
        End If
        If IsNull(RecTemp.Fields!jfje) = False Then
            LrText(5) = RecTemp.Fields!jfje
        Else
            LrText(5) = 0
        End If
    Else
        LrText(5) = 0
        LrText(6) = 0
    End If
    
    '窗体调入时,计算调整前余额,调整后余额,转换各金额
    TextChangeLock = True
    LrText(3) = Val(LrText(0).Text) + Val(LrText(1)) - Val(LrText(2))
    LrText(7) = Val(LrText(4)) + Val(LrText(5)) - Val(LrText(6))
    LrText(0) = Format(LrText(0), "#,###.00")
    LrText(1) = Format(LrText(1), "#,###.00")
    LrText(2) = Format(LrText(2), "#,###.00")
    LrText(3) = Format(LrText(3), "#,###.00")
    LrText(4) = Format(LrText(4), "#,###.00")
    LrText(5) = Format(LrText(5), "#,###.00")
    LrText(6) = Format(LrText(6), "#,###.00")
    LrText(7) = Format(LrText(7), "#,###.00")
    TextChangeLock = False
    
    If Trim(Label2(2)) = "" Then
        Label2(2).Caption = Format(Now, "yyyy年mm月dd日")
    End If
    
    '启用日期控制
    Sqlstr = " Select Count(*) From CWZZ_Bankbill Where RecType=2 And Ccode='" & Val(Label2(1).Caption) & "'"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    If Not IsNull(RecTemp(0)) Then
        If RecTemp(0) > 0 Then
            Command3.Enabled = False
        Else
            Command3.Enabled = True
        End If
    End If
End Sub

'保存期初数据
Private Sub bcsj()
    '查询银行期初余额
    Sqlstr = "Select * From CWZZ_BankBill Where Ccode='" & Val(Label2(1).Caption) & "'And RecType=0"
    If RecTemp.State = 1 Then RecTemp.Close
    RecTemp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
    If RecTemp.EOF = False Then
        '删除银行对帐期初余额
        RecTemp.Delete
    End If
    '添加银行对帐期初数据新纪录
    RecTemp.AddNew
    RecTemp.Fields!Ccode = Val(Label2(1).Caption)                     '科目编码
    RecTemp.Fields!billdate = Format(IIf(Trim(Label2(2)) = "", Date, Trim(Label2(2))), "yyyy-mm-dd")     '票据日期
    RecTemp.Fields!dfje = Val(Format(LrText(4).Text, "0.00"))         '借方金额
    RecTemp.Fields!rectype = 0                                        '记录类型
    RecTemp.Update
    
    '查询单位日记帐期初余额
    Sqlstr = "select * from cwzz_rjznotcheck where ccode='" & Val(Label2(1).Caption) & "' and rectype=0"
    If RecTemp.State = 1 Then RecTemp.Close
    RecTemp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
    If RecTemp.EOF = False Then
        '删除企业日记帐期初余额
        RecTemp.Delete
    End If
    '添加企业日记帐期初余额
    Label2(2) = IIf(Trim(Label2(2)) = "", Date, Trim(Label2(2)))
    RecTemp.AddNew
    RecTemp.Fields!Ccode = Val(Label2(1).Caption)                         '科目编码
    RecTemp.Fields!billdate = Format(Label2(2), "YYYY-MM-DD")             '票据日期
    RecTemp.Fields!jfje = Val(Format(LrText(0).Text, "0.00"))             '借方金额
    RecTemp.Fields!rectype = 0                                            '
    RecTemp.Fields!vouchno = 0                                            '凭证号
    'RecTemp.Fields!VouchClassCode = "银初"                                '凭证类别
    RecTemp.Fields!Year = Format(Label2(2), "yyyy")                       '会计年度
    RecTemp.Fields!Period = Format(Label2(2), "mm")                       '会计区间
    RecTemp.Fields!ddate = Format(Label2(2), "yyyy-mm-dd")                '制单日期
    RecTemp.Update
End Sub

'显示隐藏网格的数据
Private Sub Sub_ShowBill()
    Dim Rowjsq As Integer
    With CxbbGrid
        .Rows = 5
        .TextMatrix(1, 0) = "调整前余额": .TextMatrix(1, 1) = LrText(0)
        .TextMatrix(2, 0) = "加:银行已收  企业未收": .TextMatrix(2, 1) = LrText(1)
        .TextMatrix(3, 0) = "减:银行已付  企业未付": .TextMatrix(3, 1) = LrText(2)
        .TextMatrix(4, 0) = "调整后余额": .TextMatrix(4, 1) = LrText(3)
        .TextMatrix(1, 2) = "调整前余额": .TextMatrix(1, 3) = LrText(4)
        .TextMatrix(2, 2) = "加:企业已收  银行未收": .TextMatrix(2, 3) = LrText(5)
        .TextMatrix(3, 2) = "减:企业已付  银行未付": .TextMatrix(3, 3) = LrText(6)
        .TextMatrix(4, 2) = "调整后余额": .TextMatrix(4, 3) = LrText(7)
        For Rowjsq = 0 To .Rows - 1
            .RowHeight(Rowjsq) = 350
        Next Rowjsq
    End With
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 = 1
    '报表小标题
    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) = Space(0) + Fun_FormatOutPut("启用日期:" + Trim(Label2(2).Caption), 30)
    Bbxbt(1) = Bbxbt(1) + Fun_FormatOutPut("科目编码:" + Trim(Label2(1).Caption), 26)
    '报表小标题组织形式
    '报表行组织形式(0-居左 1-居中 2-居右)
    bbxbtzzxs(1) = 0
    Bbbwhzzxs(1) = 1
    
    '生成报表数据
    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 + -